diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-08-30 10:22:43 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-08-30 12:36:28 +0000 |
commit | 271a6c3487a14599023a9106329505597638d793 (patch) | |
tree | e040d58ffc86c1480b79ca8528020ca9ec919bf8 /chromium/third_party/polymer | |
parent | 7b2ffa587235a47d4094787d72f38102089f402a (diff) | |
download | qtwebengine-chromium-271a6c3487a14599023a9106329505597638d793.tar.gz |
BASELINE: Update Chromium to 77.0.3865.59
Change-Id: I1e89a5f3b009a9519a6705102ad65c92fe736f21
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/polymer')
177 files changed, 650 insertions, 23855 deletions
diff --git a/chromium/third_party/polymer/OWNERS b/chromium/third_party/polymer/OWNERS index 0e971c4f0db..d4423e585e9 100644 --- a/chromium/third_party/polymer/OWNERS +++ b/chromium/third_party/polymer/OWNERS @@ -1,3 +1,5 @@ dbeam@chromium.org dpapad@chromium.org michaelpg@chromium.org + +# COMPONENT: UI>Browser>WebUI diff --git a/chromium/third_party/polymer/v1_0/bower.json b/chromium/third_party/polymer/v1_0/bower.json index dfa9461d661..f44cbdeb571 100644 --- a/chromium/third_party/polymer/v1_0/bower.json +++ b/chromium/third_party/polymer/v1_0/bower.json @@ -31,7 +31,6 @@ "iron-validatable-behavior": "PolymerElements/iron-validatable-behavior#2.1.0", "neon-animation": "PolymerElements/neon-animation#2.1.0", "paper-behaviors": "PolymerElements/paper-behaviors#2.1.0", - "paper-button": "PolymerElements/paper-button#2.0.0", "paper-input": "PolymerElements/paper-input#2.2.2", "paper-progress": "PolymerElements/paper-progress#2.0.1", "paper-ripple": "PolymerElements/paper-ripple#2.0.1", diff --git a/chromium/third_party/polymer/v1_0/components-chromium/iron-test-helpers/iron-test-helpers.html b/chromium/third_party/polymer/v1_0/components-chromium/iron-test-helpers/iron-test-helpers.html deleted file mode 100644 index b5678b988ab..00000000000 --- a/chromium/third_party/polymer/v1_0/components-chromium/iron-test-helpers/iron-test-helpers.html +++ /dev/null @@ -1,11 +0,0 @@ -<!-- -@license -Copyright (c) 2015 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 ---> -<link rel="import" href="mock-interactions.html"> -<link rel="import" href="test-helpers.html"> diff --git a/chromium/third_party/polymer/v1_0/components-chromium/iron-test-helpers/test-helpers.html b/chromium/third_party/polymer/v1_0/components-chromium/iron-test-helpers/test-helpers.html deleted file mode 100644 index d75a3d298d0..00000000000 --- a/chromium/third_party/polymer/v1_0/components-chromium/iron-test-helpers/test-helpers.html +++ /dev/null @@ -1,11 +0,0 @@ -<!-- -@license -Copyright (c) 2015 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 ---> -<link rel="import" href="../polymer/polymer.html"> -<script src="test-helpers.js"></script> diff --git a/chromium/third_party/polymer/v1_0/components-chromium/iron-test-helpers/test-helpers.js b/chromium/third_party/polymer/v1_0/components-chromium/iron-test-helpers/test-helpers.js deleted file mode 100644 index ed1ef346b39..00000000000 --- a/chromium/third_party/polymer/v1_0/components-chromium/iron-test-helpers/test-helpers.js +++ /dev/null @@ -1,100 +0,0 @@ -/** - * @license - * Copyright (c) 2015 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 - */ - -// We declare it as a namespace to be compatible with JSCompiler. -/** @const */ var TestHelpers = {}; - -(function(scope, global) { - 'use strict'; - - // In case the var above was not global, or if it was renamed. - global.TestHelpers = scope; - - /** - * Forces distribution of light children, and lifecycle callbacks on the - * Custom Elements polyfill. Used when testing elements that rely on their - * distributed children. - */ - global.flushAsynchronousOperations = function() { - // force distribution - Polymer.dom.flush(); - // force lifecycle callback to fire on polyfill - window.CustomElements && window.CustomElements.takeRecords(); - }; - - /** - * Stamps and renders a `dom-if` template. - * - * @param {!Element} node The node containing the template, - */ - global.forceXIfStamp = function(node) { - var templates = Polymer.dom(node.root).querySelectorAll('template[is=dom-if]'); - for (var tmpl, i = 0; tmpl = templates[i]; i++) { - tmpl.render(); - } - - global.flushAsynchronousOperations(); - }; - - /** - * Fires a custom event on a specific node. This event bubbles and is cancellable. - * - * @param {string} type The type of event. - * @param {?Object} props Any custom properties the event contains. - * @param {!Element} node The node to fire the event on. - */ - global.fireEvent = function(type, props, node) { - var event = new CustomEvent(type, { - bubbles: true, - cancelable: true - }); - for (var p in props) { - event[p] = props[p]; - } - node.dispatchEvent(event); - }; - - /** - * Skips a test unless a condition is met. Sample use: - * function isNotIE() { - * return !navigator.userAgent.match(/MSIE/i); - * } - * test('runs on non IE browsers', skipUnless(isNotIE, function() { - * ... - * }); - * - * @param {Function} condition The name of a Boolean function determining if the test should be run. - * @param {Function} test The test to be run. - */ - global.skipUnless = function(condition, test) { - var isAsyncTest = !!test.length; - - return function(done) { - var testCalledDone = false; - - if (!condition()) { - return done(); - } - - var result = test.call(this, done); - - if (!isAsyncTest) { - done(); - } - - return result; - }; - }; - - scope.flushAsynchronousOperations = global.flushAsynchronousOperations; - scope.forceXIfStamp = global.forceXIfStamp; - scope.fireEvent = global.fireEvent; - scope.skipUnless = global.skipUnless; -})(TestHelpers, this); diff --git a/chromium/third_party/polymer/v1_0/components-chromium/neon-animation/BUILD.gn b/chromium/third_party/polymer/v1_0/components-chromium/neon-animation/BUILD.gn index e9a13b38897..d27d48929fa 100644 --- a/chromium/third_party/polymer/v1_0/components-chromium/neon-animation/BUILD.gn +++ b/chromium/third_party/polymer/v1_0/components-chromium/neon-animation/BUILD.gn @@ -32,15 +32,3 @@ js_library("neon-animation-runner-behavior-extracted") { ":neon-animatable-behavior-extracted", ] } - -js_library("neon-shared-element-animatable-behavior-extracted") { - deps = [ - ":neon-animatable-behavior-extracted", - ] -} - -js_library("neon-shared-element-animation-behavior-extracted") { - deps = [ - ":neon-animation-behavior-extracted", - ] -} diff --git a/chromium/third_party/polymer/v1_0/components-chromium/neon-animation/neon-shared-element-animatable-behavior-extracted.js b/chromium/third_party/polymer/v1_0/components-chromium/neon-animation/neon-shared-element-animatable-behavior-extracted.js deleted file mode 100644 index b179ff0d443..00000000000 --- a/chromium/third_party/polymer/v1_0/components-chromium/neon-animation/neon-shared-element-animatable-behavior-extracted.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Use `Polymer.NeonSharedElementAnimatableBehavior` to implement elements containing shared element - * animations. - * @polymerBehavior Polymer.NeonSharedElementAnimatableBehavior - */ - Polymer.NeonSharedElementAnimatableBehaviorImpl = { - - properties: { - - /** - * A map of shared element id to node. - */ - sharedElements: { - type: Object, - value: {} - } - - } - - }; - - /** @polymerBehavior Polymer.NeonSharedElementAnimatableBehavior */ - Polymer.NeonSharedElementAnimatableBehavior = [ - Polymer.NeonAnimatableBehavior, - Polymer.NeonSharedElementAnimatableBehaviorImpl - ];
\ No newline at end of file diff --git a/chromium/third_party/polymer/v1_0/components-chromium/neon-animation/neon-shared-element-animatable-behavior.html b/chromium/third_party/polymer/v1_0/components-chromium/neon-animation/neon-shared-element-animatable-behavior.html deleted file mode 100644 index e78bf554a5a..00000000000 --- a/chromium/third_party/polymer/v1_0/components-chromium/neon-animation/neon-shared-element-animatable-behavior.html +++ /dev/null @@ -1,12 +0,0 @@ -<!-- -@license -Copyright (c) 2015 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 ---><html><head><link rel="import" href="../polymer/polymer.html"> -<link rel="import" href="neon-animatable-behavior.html"> - -</head><body><script src="neon-shared-element-animatable-behavior-extracted.js"></script></body></html>
\ No newline at end of file diff --git a/chromium/third_party/polymer/v1_0/components-chromium/neon-animation/neon-shared-element-animation-behavior-extracted.js b/chromium/third_party/polymer/v1_0/components-chromium/neon-animation/neon-shared-element-animation-behavior-extracted.js deleted file mode 100644 index 65dda47042a..00000000000 --- a/chromium/third_party/polymer/v1_0/components-chromium/neon-animation/neon-shared-element-animation-behavior-extracted.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Use `Polymer.NeonSharedElementAnimationBehavior` to implement shared element animations. - * @polymerBehavior Polymer.NeonSharedElementAnimationBehavior - */ - Polymer.NeonSharedElementAnimationBehaviorImpl = { - - properties: { - - /** - * Cached copy of shared elements. - */ - sharedElements: { - type: Object - } - - }, - - /** - * Finds shared elements based on `config`. - */ - findSharedElements: function(config) { - var fromPage = config.fromPage; - var toPage = config.toPage; - if (!fromPage || !toPage) { - console.warn(this.is + ':', !fromPage ? 'fromPage' : 'toPage', 'is undefined!'); - return null; - }; - - if (!fromPage.sharedElements || !toPage.sharedElements) { - console.warn(this.is + ':', 'sharedElements are undefined for', !fromPage.sharedElements ? fromPage : toPage); - return null; - }; - - var from = fromPage.sharedElements[config.id]; - var to = toPage.sharedElements[config.id]; - - if (!from || !to) { - console.warn(this.is + ':', 'sharedElement with id', config.id, 'not found in', !from ? fromPage : toPage); - return null; - } - - this.sharedElements = { - from: from, - to: to - }; - return this.sharedElements; - } - - }; - - /** @polymerBehavior Polymer.NeonSharedElementAnimationBehavior */ - Polymer.NeonSharedElementAnimationBehavior = [ - Polymer.NeonAnimationBehavior, - Polymer.NeonSharedElementAnimationBehaviorImpl - ];
\ No newline at end of file diff --git a/chromium/third_party/polymer/v1_0/components-chromium/neon-animation/neon-shared-element-animation-behavior.html b/chromium/third_party/polymer/v1_0/components-chromium/neon-animation/neon-shared-element-animation-behavior.html deleted file mode 100644 index da562578962..00000000000 --- a/chromium/third_party/polymer/v1_0/components-chromium/neon-animation/neon-shared-element-animation-behavior.html +++ /dev/null @@ -1,12 +0,0 @@ -<!-- -@license -Copyright (c) 2015 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 ---><html><head><link rel="import" href="../polymer/polymer.html"> -<link rel="import" href="neon-animation-behavior.html"> - -</head><body><script src="neon-shared-element-animation-behavior-extracted.js"></script></body></html>
\ No newline at end of file diff --git a/chromium/third_party/polymer/v1_0/components-chromium/paper-behaviors/BUILD.gn b/chromium/third_party/polymer/v1_0/components-chromium/paper-behaviors/BUILD.gn index 4541ea92619..ee3258f1503 100644 --- a/chromium/third_party/polymer/v1_0/components-chromium/paper-behaviors/BUILD.gn +++ b/chromium/third_party/polymer/v1_0/components-chromium/paper-behaviors/BUILD.gn @@ -6,13 +6,6 @@ import("//third_party/closure_compiler/compile_js.gni") -js_library("paper-button-behavior-extracted") { - deps = [ - ":paper-ripple-behavior-extracted", - "../iron-behaviors:iron-button-state-extracted", - ] -} - js_library("paper-ripple-behavior-extracted") { deps = [ "../iron-behaviors:iron-button-state-extracted", diff --git a/chromium/third_party/polymer/v1_0/components-chromium/paper-behaviors/paper-button-behavior-extracted.js b/chromium/third_party/polymer/v1_0/components-chromium/paper-behaviors/paper-button-behavior-extracted.js deleted file mode 100644 index c02810ab0bd..00000000000 --- a/chromium/third_party/polymer/v1_0/components-chromium/paper-behaviors/paper-button-behavior-extracted.js +++ /dev/null @@ -1,81 +0,0 @@ -/** @polymerBehavior Polymer.PaperButtonBehavior */ - Polymer.PaperButtonBehaviorImpl = { - properties: { - /** - * The z-depth of this element, from 0-5. Setting to 0 will remove the - * shadow, and each increasing number greater than 0 will be "deeper" - * than the last. - * - * @attribute elevation - * @type number - * @default 1 - */ - elevation: { - type: Number, - reflectToAttribute: true, - readOnly: true - } - }, - - observers: [ - '_calculateElevation(focused, disabled, active, pressed, receivedFocusFromKeyboard)', - '_computeKeyboardClass(receivedFocusFromKeyboard)' - ], - - hostAttributes: { - role: 'button', - tabindex: '0', - animated: true - }, - - _calculateElevation: function() { - var e = 1; - if (this.disabled) { - e = 0; - } else if (this.active || this.pressed) { - e = 4; - } else if (this.receivedFocusFromKeyboard) { - e = 3; - } - this._setElevation(e); - }, - - _computeKeyboardClass: function(receivedFocusFromKeyboard) { - this.toggleClass('keyboard-focus', receivedFocusFromKeyboard); - }, - - /** - * In addition to `IronButtonState` behavior, when space key goes down, - * create a ripple down effect. - * - * @param {!KeyboardEvent} event . - */ - _spaceKeyDownHandler: function(event) { - Polymer.IronButtonStateImpl._spaceKeyDownHandler.call(this, event); - // Ensure that there is at most one ripple when the space key is held down. - if (this.hasRipple() && this.getRipple().ripples.length < 1) { - this._ripple.uiDownAction(); - } - }, - - /** - * In addition to `IronButtonState` behavior, when space key goes up, - * create a ripple up effect. - * - * @param {!KeyboardEvent} event . - */ - _spaceKeyUpHandler: function(event) { - Polymer.IronButtonStateImpl._spaceKeyUpHandler.call(this, event); - if (this.hasRipple()) { - this._ripple.uiUpAction(); - } - } - }; - - /** @polymerBehavior */ - Polymer.PaperButtonBehavior = [ - Polymer.IronButtonState, - Polymer.IronControlState, - Polymer.PaperRippleBehavior, - Polymer.PaperButtonBehaviorImpl - ];
\ No newline at end of file diff --git a/chromium/third_party/polymer/v1_0/components-chromium/paper-behaviors/paper-button-behavior.html b/chromium/third_party/polymer/v1_0/components-chromium/paper-behaviors/paper-button-behavior.html deleted file mode 100644 index 966b67a29db..00000000000 --- a/chromium/third_party/polymer/v1_0/components-chromium/paper-behaviors/paper-button-behavior.html +++ /dev/null @@ -1,13 +0,0 @@ -<!-- -@license -Copyright (c) 2015 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 ---><html><head><link rel="import" href="../polymer/polymer.html"> -<link rel="import" href="../iron-behaviors/iron-button-state.html"> -<link rel="import" href="paper-ripple-behavior.html"> - -</head><body><script src="paper-button-behavior-extracted.js"></script></body></html>
\ No newline at end of file diff --git a/chromium/third_party/polymer/v1_0/components-chromium/paper-button/BUILD.gn b/chromium/third_party/polymer/v1_0/components-chromium/paper-button/BUILD.gn deleted file mode 100644 index e1876334615..00000000000 --- a/chromium/third_party/polymer/v1_0/components-chromium/paper-button/BUILD.gn +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2019 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -# -# NOTE: Created with generate_gn.py, please do not edit. - -import("//third_party/closure_compiler/compile_js.gni") - -js_library("paper-button-extracted") { - deps = [ - "../paper-behaviors:paper-button-behavior-extracted", - ] -} diff --git a/chromium/third_party/polymer/v1_0/components-chromium/paper-button/bower.json b/chromium/third_party/polymer/v1_0/components-chromium/paper-button/bower.json deleted file mode 100644 index 680013d42ef..00000000000 --- a/chromium/third_party/polymer/v1_0/components-chromium/paper-button/bower.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "paper-button", - "version": "2.0.0", - "description": "Material design button", - "authors": [ - "The Polymer Authors" - ], - "keywords": [ - "web-components", - "web-component", - "polymer", - "paper", - "button" - ], - "main": "paper-button.html", - "private": true, - "repository": { - "type": "git", - "url": "git://github.com/PolymerElements/paper-button.git" - }, - "license": "http://polymer.github.io/LICENSE.txt", - "homepage": "https://github.com/PolymerElements/paper-button", - "dependencies": { - "polymer": "Polymer/polymer#1.9 - 2", - "iron-flex-layout": "PolymerElements/iron-flex-layout#1 - 2", - "paper-behaviors": "PolymerElements/paper-behaviors#1 - 2", - "paper-styles": "PolymerElements/paper-styles#1 - 2" - }, - "devDependencies": { - "iron-component-page": "PolymerElements/iron-component-page#1 - 2", - "iron-demo-helpers": "PolymerElements/iron-demo-helpers#1 - 2", - "iron-icon": "PolymerElements/iron-icon#1 - 2", - "iron-icons": "PolymerElements/iron-icons#1 - 2", - "iron-test-helpers": "PolymerElements/iron-test-helpers#1 - 2", - "test-fixture": "PolymerElements/test-fixture#^3.0.0-rc.1", - "web-component-tester": "^6.0.0", - "webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.0" - }, - "variants": { - "1.x": { - "dependencies": { - "polymer": "Polymer/polymer#^1.9", - "iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0", - "paper-behaviors": "PolymerElements/paper-behaviors#^1.0.0", - "paper-styles": "PolymerElements/paper-styles#^1.0.0" - }, - "devDependencies": { - "iron-component-page": "PolymerElements/iron-component-page#^1.0.0", - "iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.0.0", - "iron-icon": "PolymerElements/iron-icon#^1.0.0", - "iron-icons": "PolymerElements/iron-icons#^1.0.0", - "iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0", - "test-fixture": "PolymerElements/test-fixture#^1.0.0", - "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0", - "web-component-tester": "Polymer/web-component-tester#^4.0.0" - }, - "resolutions": { - "webcomponentsjs": "^0.7" - } - } - }, - "ignore": [], - "resolutions": { - "webcomponentsjs": "^1.0.0" - } -} diff --git a/chromium/third_party/polymer/v1_0/components-chromium/paper-button/paper-button-extracted.js b/chromium/third_party/polymer/v1_0/components-chromium/paper-button/paper-button-extracted.js deleted file mode 100644 index 5dddd75b475..00000000000 --- a/chromium/third_party/polymer/v1_0/components-chromium/paper-button/paper-button-extracted.js +++ /dev/null @@ -1,36 +0,0 @@ -Polymer({ - is: 'paper-button', - - behaviors: [ - Polymer.PaperButtonBehavior - ], - - properties: { - /** - * If true, the button should be styled with a shadow. - */ - raised: { - type: Boolean, - reflectToAttribute: true, - value: false, - observer: '_calculateElevation' - } - }, - - _calculateElevation: function() { - if (!this.raised) { - this._setElevation(0); - } else { - Polymer.PaperButtonBehaviorImpl._calculateElevation.apply(this); - } - } - - /** - Fired when the animation finishes. - This is useful if you want to wait until - the ripple animation finishes to perform some action. - - @event transitionend - Event param: {{node: Object}} detail Contains the animated node. - */ - });
\ No newline at end of file diff --git a/chromium/third_party/polymer/v1_0/components-chromium/paper-button/paper-button.html b/chromium/third_party/polymer/v1_0/components-chromium/paper-button/paper-button.html deleted file mode 100644 index 65a168e92de..00000000000 --- a/chromium/third_party/polymer/v1_0/components-chromium/paper-button/paper-button.html +++ /dev/null @@ -1,165 +0,0 @@ -<!-- -@license -Copyright (c) 2015 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 ---><html><head><link rel="import" href="../polymer/polymer.html"> -<link rel="import" href="../iron-flex-layout/iron-flex-layout.html"> -<link rel="import" href="../paper-behaviors/paper-button-behavior.html"> -<link rel="import" href="../paper-styles/element-styles/paper-material-styles.html"> - -<!-- -Material design: [Buttons](https://www.google.com/design/spec/components/buttons.html) - -`paper-button` is a button. When the user touches the button, a ripple effect emanates -from the point of contact. It may be flat or raised. A raised button is styled with a -shadow. - -Example: - - <paper-button>Flat button</paper-button> - <paper-button raised>Raised button</paper-button> - <paper-button noink>No ripple effect</paper-button> - <paper-button toggles>Toggle-able button</paper-button> - -A button that has `toggles` true will remain `active` after being clicked (and -will have an `active` attribute set). For more information, see the `Polymer.IronButtonState` -behavior. - -You may use custom DOM in the button body to create a variety of buttons. For example, to -create a button with an icon and some text: - - <paper-button> - <iron-icon icon="favorite"></iron-icon> - custom button content - </paper-button> - -To use `paper-button` as a link, wrap it in an anchor tag. Since `paper-button` will already -receive focus, you may want to prevent the anchor tag from receiving focus as well by setting -its tabindex to -1. - - <a href="https://www.polymer-project.org/" tabindex="-1"> - <paper-button raised>Polymer Project</paper-button> - </a> - -### Styling - -Style the button with CSS as you would a normal DOM element. - - paper-button.fancy { - background: green; - color: yellow; - } - - paper-button.fancy:hover { - background: lime; - } - - paper-button[disabled], - paper-button[toggles][active] { - background: red; - } - -By default, the ripple is the same color as the foreground at 25% opacity. You may -customize the color using the `--paper-button-ink-color` custom property. - -The following custom properties and mixins are also available for styling: - -Custom property | Description | Default -----------------|-------------|---------- -`--paper-button-ink-color` | Background color of the ripple | `Based on the button's color` -`--paper-button` | Mixin applied to the button | `{}` -`--paper-button-disabled` | Mixin applied to the disabled button. Note that you can also use the `paper-button[disabled]` selector | `{}` -`--paper-button-flat-keyboard-focus` | Mixin applied to a flat button after it's been focused using the keyboard | `{}` -`--paper-button-raised-keyboard-focus` | Mixin applied to a raised button after it's been focused using the keyboard | `{}` - -@demo demo/index.html ---> - -</head><body><dom-module id="paper-button"> - <template strip-whitespace=""> - <style include="paper-material-styles"> - /* Need to specify the same specificity as the styles imported from paper-material. */ - :host { - @apply --layout-inline; - @apply --layout-center-center; - position: relative; - box-sizing: border-box; - min-width: 5.14em; - margin: 0 0.29em; - background: transparent; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); - -webkit-tap-highlight-color: transparent; - font: inherit; - text-transform: uppercase; - outline-width: 0; - border-radius: 3px; - user-select: none; - cursor: pointer; - z-index: 0; - padding: 0.7em 0.57em; - - @apply --paper-font-common-base; - @apply --paper-button; - } - - :host([elevation="1"]) { - @apply --paper-material-elevation-1; - } - - :host([elevation="2"]) { - @apply --paper-material-elevation-2; - } - - :host([elevation="3"]) { - @apply --paper-material-elevation-3; - } - - :host([elevation="4"]) { - @apply --paper-material-elevation-4; - } - - :host([elevation="5"]) { - @apply --paper-material-elevation-5; - } - - :host([hidden]) { - display: none !important; - } - - :host([raised].keyboard-focus) { - font-weight: bold; - @apply --paper-button-raised-keyboard-focus; - } - - :host(:not([raised]).keyboard-focus) { - font-weight: bold; - @apply --paper-button-flat-keyboard-focus; - } - - :host([disabled]) { - background: #eaeaea; - color: #a8a8a8; - cursor: auto; - pointer-events: none; - - @apply --paper-button-disabled; - } - - :host([animated]) { - @apply --shadow-transition; - } - - paper-ripple { - color: var(--paper-button-ink-color); - } - </style> - - <slot></slot> - </template> - - </dom-module> -<script src="paper-button-extracted.js"></script></body></html>
\ No newline at end of file diff --git a/chromium/third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple-extracted.js b/chromium/third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple-extracted.js index 74089a2ab15..e232c78f16f 100644 --- a/chromium/third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple-extracted.js +++ b/chromium/third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple-extracted.js @@ -79,7 +79,15 @@ Polymer({ this.debounce('show ripple', function() { this.__showRipple(e); }, 1); }, + clear: function() { + this.__hideRipple(); + this.holdDown = false; + }, + showAndHoldDown: function() { + if (this.holdDown) { + return; + } this.ripples.forEach(ripple => { ripple.remove(); }); diff --git a/chromium/third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple.html b/chromium/third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple.html index c170faff377..5275d0eca05 100644 --- a/chromium/third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple.html +++ b/chromium/third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple.html @@ -100,8 +100,6 @@ Apply `circle` class to make the rippling effect within a circle. position: absolute; right: 0; top: 0; - /* For rounded corners: http://jsbin.com/temexa/4. */ - transform: translate3d(0, 0, 0); } .ripple { diff --git a/chromium/third_party/polymer/v1_0/components_summary.txt b/chromium/third_party/polymer/v1_0/components_summary.txt index b432e63ce4d..3320e605ca5 100644 --- a/chromium/third_party/polymer/v1_0/components_summary.txt +++ b/chromium/third_party/polymer/v1_0/components_summary.txt @@ -172,12 +172,6 @@ Tree: v2.1.0 Revision: ddde7f8cf41078b7a7b724473558421d6bc37f57 Tree link: https://github.com/PolymerElements/paper-behaviors/tree/v2.1.0 -Name: paper-button -Repository: https://github.com/PolymerElements/paper-button.git -Tree: v2.0.0 -Revision: b37655b85e1c3364ce9f5ca0470ddf1071cca3aa -Tree link: https://github.com/PolymerElements/paper-button/tree/v2.0.0 - Name: paper-input Repository: https://github.com/PolymerElements/paper-input.git Tree: v2.2.2 diff --git a/chromium/third_party/polymer/v1_0/css_strip_prefixes.py b/chromium/third_party/polymer/v1_0/css_strip_prefixes.py index 868b93fdb0b..86b87a3136a 100644 --- a/chromium/third_party/polymer/v1_0/css_strip_prefixes.py +++ b/chromium/third_party/polymer/v1_0/css_strip_prefixes.py @@ -2,9 +2,11 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import argparse import fnmatch import os import re +import sys # List of CSS properties to be removed. CSS_PROPERTIES_TO_REMOVE = [ @@ -84,14 +86,19 @@ def ShouldRemoveLine(line): return any(pred(p) for p in CSS_PROPERTIES_TO_REMOVE) -def main(): - html_files = [os.path.join(dirpath, f) +def main(argv): + parser = argparse.ArgumentParser('Strips CSS rules not needed by Chrome') + parser.add_argument( + '--file_extension', choices=['js', 'html'], required=True) + opts = parser.parse_args(sys.argv[1:]) + + files_to_process = [os.path.join(dirpath, f) for dirpath, dirnames, files in os.walk('components-chromium') - for f in fnmatch.filter(files, '*.html')] + for f in fnmatch.filter(files, '*.' + opts.file_extension)] - for f in html_files: + for f in files_to_process: ProcessFile(f) if __name__ == '__main__': - main() + main(sys.argv[1:]) diff --git a/chromium/third_party/polymer/v1_0/reproduce.sh b/chromium/third_party/polymer/v1_0/reproduce.sh index a88ccd8894f..9b73718f75e 100755 --- a/chromium/third_party/polymer/v1_0/reproduce.sh +++ b/chromium/third_party/polymer/v1_0/reproduce.sh @@ -98,7 +98,7 @@ if [[ ! -z "${new}${deleted}" ]]; then fi echo 'Stripping unnecessary prefixed CSS rules...' -python css_strip_prefixes.py +python css_strip_prefixes.py --file_extension=html echo 'Generating -rgb versions of --google-* vars in paper-style/colors.html...' python rgbify_hex_vars.py --filter-prefix=google --replace \ diff --git a/chromium/third_party/polymer/v1_0/rsync_exclude.txt b/chromium/third_party/polymer/v1_0/rsync_exclude.txt index ec83ac99111..b5da044c456 100644 --- a/chromium/third_party/polymer/v1_0/rsync_exclude.txt +++ b/chromium/third_party/polymer/v1_0/rsync_exclude.txt @@ -45,7 +45,13 @@ iron-checked-element-behavior/* # iron-form-element-behavior iron-form-element-behavior/* +# iron-test-helpers +iron-test-helpers/iron-test-helpers.html +iron-test-helpers/test-helpers.html +iron-test-helpers/test-helpers.js + # paper-behaviors +paper-behaviors/paper-button-behavior.html paper-behaviors/paper-checked-element-behavior.html paper-behaviors/paper-inky-focus-behavior.html @@ -84,3 +90,5 @@ neon-animation/animations/slide-up-animation.html neon-animation/animations/transform-animation.html neon-animation/neon-animation.html neon-animation/neon-animations.html +neon-animation/neon-shared-element-animatable-behavior.html +neon-animation/neon-shared-element-animation-behavior.html diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-a11y-announcer/iron-a11y-announcer.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-a11y-announcer/iron-a11y-announcer.js index 93b9e37d05a..7d8d859bf83 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-a11y-announcer/iron-a11y-announcer.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-a11y-announcer/iron-a11y-announcer.js @@ -8,10 +8,10 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; /** `iron-a11y-announcer` is a singleton element that is intended to add a11y diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js index dae57c46ac3..84eb1822920 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js @@ -8,7 +8,7 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; /** * Chrome uses an older version of DOM Level 3 Keyboard Events diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-a11y-keys/iron-a11y-keys.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-a11y-keys/iron-a11y-keys.js index a84490a278b..c974bb614c0 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-a11y-keys/iron-a11y-keys.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-a11y-keys/iron-a11y-keys.js @@ -8,10 +8,10 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import {IronA11yKeysBehavior} from '../iron-a11y-keys-behavior/iron-a11y-keys-behavior.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; /** `iron-a11y-keys` provides a cross-browser interface for processing keyboard commands. The interface adheres to [WAI-ARIA best diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-behaviors/iron-button-state.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-behaviors/iron-button-state.js index a16367424e5..ca9a41e7fd1 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-behaviors/iron-button-state.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-behaviors/iron-button-state.js @@ -8,11 +8,11 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import './iron-control-state.js'; import {IronA11yKeysBehavior} from '../iron-a11y-keys-behavior/iron-a11y-keys-behavior.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; /** * @demo demo/index.html diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-behaviors/iron-control-state.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-behaviors/iron-control-state.js index 0d7d3a1e2db..15b4cbb819f 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-behaviors/iron-control-state.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-behaviors/iron-control-state.js @@ -8,9 +8,9 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; /** * @demo demo/index.html diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-collapse/iron-collapse.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-collapse/iron-collapse.js index 75372dbd9bd..ad45d50067e 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-collapse/iron-collapse.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-collapse/iron-collapse.js @@ -9,10 +9,10 @@ part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ import {IronResizableBehavior} from '../iron-resizable-behavior/iron-resizable-behavior.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; -import {Base} from '../polymer/polymer-legacy.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; +import {Base} from '../polymer/polymer_bundled.min.js'; /** `iron-collapse` creates a collapsible block of content. By default, the content @@ -67,7 +67,6 @@ Polymer({ display: block; transition-duration: var(--iron-collapse-transition-duration, 300ms); /* Safari 10 needs this property prefixed to correctly apply the custom property */ - -webkit-transition-duration: var(--iron-collapse-transition-duration, 300ms); overflow: visible; } diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-dropdown/iron-dropdown.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-dropdown/iron-dropdown.js index 288e624df24..83bef0eed3d 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-dropdown/iron-dropdown.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-dropdown/iron-dropdown.js @@ -8,15 +8,15 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import {IronA11yKeysBehavior} from '../iron-a11y-keys-behavior/iron-a11y-keys-behavior.js'; import {IronControlState} from '../iron-behaviors/iron-control-state.js'; import {IronOverlayBehavior, IronOverlayBehaviorImpl} from '../iron-overlay-behavior/iron-overlay-behavior.js'; import {NeonAnimationRunnerBehavior} from '../neon-animation/neon-animation-runner-behavior.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; /** `<iron-dropdown>` is a generalized element that is useful when you have diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-fit-behavior/iron-fit-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-fit-behavior/iron-fit-behavior.js index 48d9b70f1e9..b8cae1171af 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-fit-behavior/iron-fit-behavior.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-fit-behavior/iron-fit-behavior.js @@ -8,9 +8,9 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; /** `Polymer.IronFitBehavior` fits an element in another element using `max-height` diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-flex-layout/iron-flex-layout-classes.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-flex-layout/iron-flex-layout-classes.js index 54edcb4c300..59c36a39806 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-flex-layout/iron-flex-layout-classes.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-flex-layout/iron-flex-layout-classes.js @@ -8,8 +8,8 @@ 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 */ -import '../polymer/polymer-legacy.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; /* A set of layout classes that let you specify layout properties directly in @@ -45,72 +45,49 @@ const template = html` <style> .layout.horizontal, .layout.vertical { - display: -ms-flexbox; - display: -webkit-flex; display: flex; } .layout.inline { - display: -ms-inline-flexbox; - display: -webkit-inline-flex; display: inline-flex; } .layout.horizontal { - -ms-flex-direction: row; - -webkit-flex-direction: row; flex-direction: row; } .layout.vertical { - -ms-flex-direction: column; - -webkit-flex-direction: column; flex-direction: column; } .layout.wrap { - -ms-flex-wrap: wrap; - -webkit-flex-wrap: wrap; flex-wrap: wrap; } .layout.no-wrap { - -ms-flex-wrap: nowrap; - -webkit-flex-wrap: nowrap; flex-wrap: nowrap; } .layout.center, .layout.center-center { - -ms-flex-align: center; - -webkit-align-items: center; align-items: center; } .layout.center-justified, .layout.center-center { - -ms-flex-pack: center; - -webkit-justify-content: center; justify-content: center; } .flex { - -ms-flex: 1 1 0.000000001px; - -webkit-flex: 1; flex: 1; - -webkit-flex-basis: 0.000000001px; flex-basis: 0.000000001px; } .flex-auto { - -ms-flex: 1 1 auto; - -webkit-flex: 1 1 auto; flex: 1 1 auto; } .flex-none { - -ms-flex: none; - -webkit-flex: none; flex: none; } </style> @@ -122,26 +99,18 @@ const template = html` <style> .layout.horizontal-reverse, .layout.vertical-reverse { - display: -ms-flexbox; - display: -webkit-flex; display: flex; } .layout.horizontal-reverse { - -ms-flex-direction: row-reverse; - -webkit-flex-direction: row-reverse; flex-direction: row-reverse; } .layout.vertical-reverse { - -ms-flex-direction: column-reverse; - -webkit-flex-direction: column-reverse; flex-direction: column-reverse; } .layout.wrap-reverse { - -ms-flex-wrap: wrap-reverse; - -webkit-flex-wrap: wrap-reverse; flex-wrap: wrap-reverse; } </style> @@ -155,27 +124,19 @@ const template = html` * Alignment in cross axis. */ .layout.start { - -ms-flex-align: start; - -webkit-align-items: flex-start; align-items: flex-start; } .layout.center, .layout.center-center { - -ms-flex-align: center; - -webkit-align-items: center; align-items: center; } .layout.end { - -ms-flex-align: end; - -webkit-align-items: flex-end; align-items: flex-end; } .layout.baseline { - -ms-flex-align: baseline; - -webkit-align-items: baseline; align-items: baseline; } @@ -183,33 +144,23 @@ const template = html` * Alignment in main axis. */ .layout.start-justified { - -ms-flex-pack: start; - -webkit-justify-content: flex-start; justify-content: flex-start; } .layout.center-justified, .layout.center-center { - -ms-flex-pack: center; - -webkit-justify-content: center; justify-content: center; } .layout.end-justified { - -ms-flex-pack: end; - -webkit-justify-content: flex-end; justify-content: flex-end; } .layout.around-justified { - -ms-flex-pack: distribute; - -webkit-justify-content: space-around; justify-content: space-around; } .layout.justified { - -ms-flex-pack: justify; - -webkit-justify-content: space-between; justify-content: space-between; } @@ -217,32 +168,22 @@ const template = html` * Self alignment. */ .self-start { - -ms-align-self: flex-start; - -webkit-align-self: flex-start; align-self: flex-start; } .self-center { - -ms-align-self: center; - -webkit-align-self: center; align-self: center; } .self-end { - -ms-align-self: flex-end; - -webkit-align-self: flex-end; align-self: flex-end; } .self-stretch { - -ms-align-self: stretch; - -webkit-align-self: stretch; align-self: stretch; } .self-baseline { - -ms-align-self: baseline; - -webkit-align-self: baseline; align-self: baseline; } @@ -250,37 +191,22 @@ const template = html` * multi-line alignment in main axis. */ .layout.start-aligned { - -ms-flex-line-pack: start; /* IE10 */ - -ms-align-content: flex-start; - -webkit-align-content: flex-start; align-content: flex-start; } .layout.end-aligned { - -ms-flex-line-pack: end; /* IE10 */ - -ms-align-content: flex-end; - -webkit-align-content: flex-end; align-content: flex-end; } .layout.center-aligned { - -ms-flex-line-pack: center; /* IE10 */ - -ms-align-content: center; - -webkit-align-content: center; align-content: center; } .layout.between-aligned { - -ms-flex-line-pack: justify; /* IE10 */ - -ms-align-content: space-between; - -webkit-align-content: space-between; align-content: space-between; } .layout.around-aligned { - -ms-flex-line-pack: distribute; /* IE10 */ - -ms-align-content: space-around; - -webkit-align-content: space-around; align-content: space-around; } </style> @@ -292,76 +218,51 @@ const template = html` <style> .flex, .flex-1 { - -ms-flex: 1 1 0.000000001px; - -webkit-flex: 1; flex: 1; - -webkit-flex-basis: 0.000000001px; flex-basis: 0.000000001px; } .flex-2 { - -ms-flex: 2; - -webkit-flex: 2; flex: 2; } .flex-3 { - -ms-flex: 3; - -webkit-flex: 3; flex: 3; } .flex-4 { - -ms-flex: 4; - -webkit-flex: 4; flex: 4; } .flex-5 { - -ms-flex: 5; - -webkit-flex: 5; flex: 5; } .flex-6 { - -ms-flex: 6; - -webkit-flex: 6; flex: 6; } .flex-7 { - -ms-flex: 7; - -webkit-flex: 7; flex: 7; } .flex-8 { - -ms-flex: 8; - -webkit-flex: 8; flex: 8; } .flex-9 { - -ms-flex: 9; - -webkit-flex: 9; flex: 9; } .flex-10 { - -ms-flex: 10; - -webkit-flex: 10; flex: 10; } .flex-11 { - -ms-flex: 11; - -webkit-flex: 11; flex: 11; } .flex-12 { - -ms-flex: 12; - -webkit-flex: 12; flex: 12; } </style> diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-flex-layout/iron-flex-layout.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-flex-layout/iron-flex-layout.js index 279345c38d7..37ca84e3f0a 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-flex-layout/iron-flex-layout.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-flex-layout/iron-flex-layout.js @@ -8,8 +8,8 @@ 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 */ -import '../polymer/polymer-legacy.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; /** The `<iron-flex-layout>` component provides simple ways to use @@ -40,7 +40,7 @@ file in every element that needs to use them. ``` ```js - import {html} from '../polymer/lib/utils/html-tag.js'; + import {html} from '../polymer/polymer_bundled.min.js'; import '../iron-flex-layout/iron-flex-layout-classes.js'; const template = html` @@ -86,202 +86,139 @@ const template = html` html { --layout: { - display: -ms-flexbox; - display: -webkit-flex; display: flex; }; --layout-inline: { - display: -ms-inline-flexbox; - display: -webkit-inline-flex; display: inline-flex; }; --layout-horizontal: { @apply --layout; - -ms-flex-direction: row; - -webkit-flex-direction: row; flex-direction: row; }; --layout-horizontal-reverse: { @apply --layout; - -ms-flex-direction: row-reverse; - -webkit-flex-direction: row-reverse; flex-direction: row-reverse; }; --layout-vertical: { @apply --layout; - -ms-flex-direction: column; - -webkit-flex-direction: column; flex-direction: column; }; --layout-vertical-reverse: { @apply --layout; - -ms-flex-direction: column-reverse; - -webkit-flex-direction: column-reverse; flex-direction: column-reverse; }; --layout-wrap: { - -ms-flex-wrap: wrap; - -webkit-flex-wrap: wrap; flex-wrap: wrap; }; --layout-wrap-reverse: { - -ms-flex-wrap: wrap-reverse; - -webkit-flex-wrap: wrap-reverse; flex-wrap: wrap-reverse; }; --layout-flex-auto: { - -ms-flex: 1 1 auto; - -webkit-flex: 1 1 auto; flex: 1 1 auto; }; --layout-flex-none: { - -ms-flex: none; - -webkit-flex: none; flex: none; }; --layout-flex: { - -ms-flex: 1 1 0.000000001px; - -webkit-flex: 1; flex: 1; - -webkit-flex-basis: 0.000000001px; flex-basis: 0.000000001px; }; --layout-flex-2: { - -ms-flex: 2; - -webkit-flex: 2; flex: 2; }; --layout-flex-3: { - -ms-flex: 3; - -webkit-flex: 3; flex: 3; }; --layout-flex-4: { - -ms-flex: 4; - -webkit-flex: 4; flex: 4; }; --layout-flex-5: { - -ms-flex: 5; - -webkit-flex: 5; flex: 5; }; --layout-flex-6: { - -ms-flex: 6; - -webkit-flex: 6; flex: 6; }; --layout-flex-7: { - -ms-flex: 7; - -webkit-flex: 7; flex: 7; }; --layout-flex-8: { - -ms-flex: 8; - -webkit-flex: 8; flex: 8; }; --layout-flex-9: { - -ms-flex: 9; - -webkit-flex: 9; flex: 9; }; --layout-flex-10: { - -ms-flex: 10; - -webkit-flex: 10; flex: 10; }; --layout-flex-11: { - -ms-flex: 11; - -webkit-flex: 11; flex: 11; }; --layout-flex-12: { - -ms-flex: 12; - -webkit-flex: 12; flex: 12; }; /* alignment in cross axis */ --layout-start: { - -ms-flex-align: start; - -webkit-align-items: flex-start; align-items: flex-start; }; --layout-center: { - -ms-flex-align: center; - -webkit-align-items: center; align-items: center; }; --layout-end: { - -ms-flex-align: end; - -webkit-align-items: flex-end; align-items: flex-end; }; --layout-baseline: { - -ms-flex-align: baseline; - -webkit-align-items: baseline; align-items: baseline; }; /* alignment in main axis */ --layout-start-justified: { - -ms-flex-pack: start; - -webkit-justify-content: flex-start; justify-content: flex-start; }; --layout-center-justified: { - -ms-flex-pack: center; - -webkit-justify-content: center; justify-content: center; }; --layout-end-justified: { - -ms-flex-pack: end; - -webkit-justify-content: flex-end; justify-content: flex-end; }; --layout-around-justified: { - -ms-flex-pack: distribute; - -webkit-justify-content: space-around; justify-content: space-around; }; --layout-justified: { - -ms-flex-pack: justify; - -webkit-justify-content: space-between; justify-content: space-between; }; @@ -293,69 +230,44 @@ const template = html` /* self alignment */ --layout-self-start: { - -ms-align-self: flex-start; - -webkit-align-self: flex-start; align-self: flex-start; }; --layout-self-center: { - -ms-align-self: center; - -webkit-align-self: center; align-self: center; }; --layout-self-end: { - -ms-align-self: flex-end; - -webkit-align-self: flex-end; align-self: flex-end; }; --layout-self-stretch: { - -ms-align-self: stretch; - -webkit-align-self: stretch; align-self: stretch; }; --layout-self-baseline: { - -ms-align-self: baseline; - -webkit-align-self: baseline; align-self: baseline; }; /* multi-line alignment in main axis */ --layout-start-aligned: { - -ms-flex-line-pack: start; /* IE10 */ - -ms-align-content: flex-start; - -webkit-align-content: flex-start; align-content: flex-start; }; --layout-end-aligned: { - -ms-flex-line-pack: end; /* IE10 */ - -ms-align-content: flex-end; - -webkit-align-content: flex-end; align-content: flex-end; }; --layout-center-aligned: { - -ms-flex-line-pack: center; /* IE10 */ - -ms-align-content: center; - -webkit-align-content: center; align-content: center; }; --layout-between-aligned: { - -ms-flex-line-pack: justify; /* IE10 */ - -ms-align-content: space-between; - -webkit-align-content: space-between; align-content: space-between; }; --layout-around-aligned: { - -ms-flex-line-pack: distribute; /* IE10 */ - -ms-align-content: space-around; - -webkit-align-content: space-around; align-content: space-around; }; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-icon/iron-icon.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-icon/iron-icon.js index 001d8d58cb3..35835d2b5c4 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-icon/iron-icon.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-icon/iron-icon.js @@ -11,10 +11,10 @@ found at http://polymer.github.io/PATENTS.txt import '../iron-flex-layout/iron-flex-layout.js'; import {IronMeta} from '../iron-meta/iron-meta.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; -import {Base} from '../polymer/polymer-legacy.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; +import {Base} from '../polymer/polymer_bundled.min.js'; /** diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-iconset-svg/iron-iconset-svg.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-iconset-svg/iron-iconset-svg.js index c76a5304d74..9bd6935fa7a 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-iconset-svg/iron-iconset-svg.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-iconset-svg/iron-iconset-svg.js @@ -8,11 +8,11 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import {IronMeta} from '../iron-meta/iron-meta.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; /** * The `iron-iconset-svg` element allows users to define their own icon sets * that contain svg icons. The svg icon elements should be children of the diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-input/iron-input.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-input/iron-input.js index 3c85279191f..2754f1aecf5 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-input/iron-input.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-input/iron-input.js @@ -8,13 +8,13 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import {IronA11yAnnouncer} from '../iron-a11y-announcer/iron-a11y-announcer.js'; import {IronValidatableBehavior} from '../iron-validatable-behavior/iron-validatable-behavior.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; /** `<iron-input>` is a wrapper to a native `<input>` element, that adds two-way diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-list/iron-list.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-list/iron-list.js index 62f676834f2..28b93538766 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-list/iron-list.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-list/iron-list.js @@ -8,21 +8,21 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import '../iron-a11y-keys-behavior/iron-a11y-keys-behavior.js'; import {IronResizableBehavior} from '../iron-resizable-behavior/iron-resizable-behavior.js'; import {IronScrollTargetBehavior} from '../iron-scroll-target-behavior/iron-scroll-target-behavior.js'; -import {OptionalMutableDataBehavior} from '../polymer/lib/legacy/mutable-data-behavior.js'; -import {Polymer as Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; -import {Templatizer} from '../polymer/lib/legacy/templatizer-behavior.js'; -import {animationFrame, idlePeriod, microTask} from '../polymer/lib/utils/async.js'; -import {Debouncer} from '../polymer/lib/utils/debounce.js'; -import {enqueueDebouncer, flush} from '../polymer/lib/utils/flush.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; -import {matches, translate} from '../polymer/lib/utils/path.js'; -import {TemplateInstanceBase} from '../polymer/lib/utils/templatize.js'; +import {OptionalMutableDataBehavior} from '../polymer/polymer_bundled.min.js'; +import {Polymer as Polymer} from '../polymer/polymer_bundled.min.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; +import {Templatizer} from '../polymer/polymer_bundled.min.js'; +import {animationFrame, idlePeriod, microTask} from '../polymer/polymer_bundled.min.js'; +import {Debouncer} from '../polymer/polymer_bundled.min.js'; +import {enqueueDebouncer, flush} from '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; +import {matches, translate} from '../polymer/polymer_bundled.min.js'; +import {TemplateInstanceBase} from '../polymer/polymer_bundled.min.js'; var IOS = navigator.userAgent.match(/iP(?:hone|ad;(?: U;)? CPU) OS (\d+)/); var IOS_TOUCH_SCROLLING = IOS && IOS[1] >= 8; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-location/iron-location.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-location/iron-location.js index 5a402bf23e1..89acb2861d7 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-location/iron-location.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-location/iron-location.js @@ -8,10 +8,10 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; /** The `iron-location` element manages binding to and from the current URL. diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-location/iron-query-params.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-location/iron-query-params.js index 98e10b78dd3..c307d78c294 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-location/iron-query-params.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-location/iron-query-params.js @@ -8,9 +8,9 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; /** * @demo demo/iron-query-params.html */ diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-media-query/iron-media-query.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-media-query/iron-media-query.js index 48cb83992b1..2125b005581 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-media-query/iron-media-query.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-media-query/iron-media-query.js @@ -8,9 +8,9 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; /** `iron-media-query` can be used to data bind to a CSS media query. diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-meta/iron-meta.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-meta/iron-meta.js index e32da21b83c..acc3c2c0a6f 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-meta/iron-meta.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-meta/iron-meta.js @@ -8,9 +8,9 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; export class IronMeta { /** diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-focusables-helper.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-focusables-helper.js index 40c10a08482..d2edaa0dfca 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-focusables-helper.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-focusables-helper.js @@ -8,9 +8,9 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; var p = Element.prototype; var matches = p.matches || p.matchesSelector || p.mozMatchesSelector || diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-overlay-backdrop.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-overlay-backdrop.js index 8bd49271328..fca79f0d2cd 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-overlay-backdrop.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-overlay-backdrop.js @@ -8,11 +8,11 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; /* `iron-overlay-backdrop` is a backdrop used by `Polymer.IronOverlayBehavior`. It diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-overlay-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-overlay-behavior.js index 0f215b1b6fb..6200ea121b9 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-overlay-behavior.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-overlay-behavior.js @@ -8,12 +8,12 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import {IronFitBehavior} from '../iron-fit-behavior/iron-fit-behavior.js'; import {IronResizableBehavior} from '../iron-resizable-behavior/iron-resizable-behavior.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; -import {useShadow} from '../polymer/lib/utils/settings.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; +import {useShadow} from '../polymer/polymer_bundled.min.js'; import {IronFocusablesHelper} from './iron-focusables-helper.js'; import {IronOverlayManager} from './iron-overlay-manager.js'; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-overlay-manager.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-overlay-manager.js index 99768f41968..ac72c52492f 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-overlay-manager.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-overlay-manager.js @@ -8,12 +8,12 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import './iron-overlay-backdrop.js'; import {IronA11yKeysBehavior} from '../iron-a11y-keys-behavior/iron-a11y-keys-behavior.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; -import * as gestures from '../polymer/lib/utils/gestures.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; +import * as gestures from '../polymer/polymer_bundled.min.js'; /** * @struct @@ -231,7 +231,7 @@ IronOverlayManagerClass.prototype = { this.backdropElement.opened = !!overlay; // Property observers are not fired until element is attached // in Polymer 2.x, so we ensure element is attached if needed. - // https://github.com/Polymer/polymer/issues/4526 + // https://github.com/Polymer/polymer/polymer_bundled.min.js4526 this.backdropElement.prepare(); }, diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-scroll-manager.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-scroll-manager.js index 156d1435ae9..247be1df978 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-scroll-manager.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-overlay-behavior/iron-scroll-manager.js @@ -8,9 +8,9 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; /** * Used to calculate the scroll direction during touch events. * @type {!Object} diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-pages/iron-pages.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-pages/iron-pages.js index 2708d9a6c90..a99c00dbc0d 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-pages/iron-pages.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-pages/iron-pages.js @@ -8,12 +8,12 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import {IronResizableBehavior} from '../iron-resizable-behavior/iron-resizable-behavior.js'; import {IronSelectableBehavior} from '../iron-selector/iron-selectable.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; /** `iron-pages` is used to select one of its children to show. One use is to cycle diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-range-behavior/iron-range-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-range-behavior/iron-range-behavior.js index 18028545d19..ec84de0ff83 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-range-behavior/iron-range-behavior.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-range-behavior/iron-range-behavior.js @@ -8,7 +8,7 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; /** * `iron-range-behavior` provides the behavior for something with a minimum to diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-resizable-behavior/iron-resizable-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-resizable-behavior/iron-resizable-behavior.js index 8a5317e7931..0dc27e4bea3 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-resizable-behavior/iron-resizable-behavior.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-resizable-behavior/iron-resizable-behavior.js @@ -8,10 +8,10 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; -import {useShadow} from '../polymer/lib/utils/settings.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; +import {useShadow} from '../polymer/polymer_bundled.min.js'; // Contains all connected resizables that do not have a parent. var ORPHANS = new Set(); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-scroll-target-behavior/iron-scroll-target-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-scroll-target-behavior/iron-scroll-target-behavior.js index a9d889bdf9e..14118df50db 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-scroll-target-behavior/iron-scroll-target-behavior.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-scroll-target-behavior/iron-scroll-target-behavior.js @@ -8,9 +8,9 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; /** * `Polymer.IronScrollTargetBehavior` allows an element to respond to scroll diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-scroll-threshold/iron-scroll-threshold.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-scroll-threshold/iron-scroll-threshold.js index c592f931b95..a5b87ed342a 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-scroll-threshold/iron-scroll-threshold.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-scroll-threshold/iron-scroll-threshold.js @@ -8,11 +8,11 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import {IronScrollTargetBehavior} from '../iron-scroll-target-behavior/iron-scroll-target-behavior.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; /** `iron-scroll-threshold` is a utility element that listens for `scroll` events diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-selector/iron-multi-selectable.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-selector/iron-multi-selectable.js index 9a797323d84..9acb77a3c4a 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-selector/iron-multi-selectable.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-selector/iron-multi-selectable.js @@ -8,7 +8,7 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import {IronSelectableBehavior} from './iron-selectable.js'; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-selector/iron-selectable.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-selector/iron-selectable.js index 9a4cd9e6ad6..e18d709fa36 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-selector/iron-selectable.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-selector/iron-selectable.js @@ -8,10 +8,10 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; -import {dashToCamelCase} from '../polymer/lib/utils/case-map.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; +import {dashToCamelCase} from '../polymer/polymer_bundled.min.js'; import {IronSelection} from './iron-selection.js'; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-selector/iron-selection.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-selector/iron-selection.js index ebdc9e2b3ca..3788264bc9a 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-selector/iron-selection.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-selector/iron-selection.js @@ -8,7 +8,7 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; export class IronSelection { /** diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-selector/iron-selector.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-selector/iron-selector.js index 1991f5835e4..b12ab29804b 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-selector/iron-selector.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-selector/iron-selector.js @@ -8,9 +8,9 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; import {IronMultiSelectableBehavior} from './iron-multi-selectable.js'; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-test-helpers/iron-test-helpers.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-test-helpers/iron-test-helpers.js deleted file mode 100644 index 8fd6155a23e..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-test-helpers/iron-test-helpers.js +++ /dev/null @@ -1,12 +0,0 @@ -/** -@license -Copyright (c) 2015 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 -*/ -import './mock-interactions.js'; -import './test-helpers.js'; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-test-helpers/mock-interactions.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-test-helpers/mock-interactions.js index 13b9380bea6..86b19e61bf7 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-test-helpers/mock-interactions.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-test-helpers/mock-interactions.js @@ -9,7 +9,7 @@ * rights grant found at http://polymer.github.io/PATENTS.txt */ -import {Base} from '../polymer/polymer-legacy.js'; +import {Base} from '../polymer/polymer_bundled.min.js'; const HAS_NEW_MOUSE = (() => { let has = false; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-test-helpers/test-helpers.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-test-helpers/test-helpers.js deleted file mode 100644 index af806277b37..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-test-helpers/test-helpers.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * @license - * Copyright (c) 2015 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 - */ - -import {dom, flush} from '../polymer/lib/legacy/polymer.dom.js'; - -/** - * Forces distribution of light children, and lifecycle callbacks on the - * Custom Elements polyfill. Used when testing elements that rely on their - * distributed children. - */ -export function flushAsynchronousOperations() { - // force distribution - flush(); - // force lifecycle callback to fire on polyfill - window.CustomElements && window.CustomElements.takeRecords(); -} - -/** - * Stamps and renders a `dom-if` template. - * - * @param {!Element} node The node containing the template, - */ -export function forceXIfStamp(node) { - const templates = dom(node.root).querySelectorAll('template[is=dom-if]'); - for (let tmpl, i = 0; tmpl = templates[i]; i++) { - tmpl.render(); - } - - flushAsynchronousOperations(); -} - -/** - * Fires a custom event on a specific node. This event bubbles and is - * cancellable. - * - * @param {string} type The type of event. - * @param {?Object} props Any custom properties the event contains. - * @param {!Element} node The node to fire the event on. - */ -export function fireEvent(type, props, node) { - const event = new CustomEvent(type, {bubbles: true, cancelable: true}); - for (const p in props) { - event[p] = props[p]; - } - node.dispatchEvent(event); -} - -/** - * Skips a test unless a condition is met. Sample use: - * function isNotIE() { - * return !navigator.userAgent.match(/MSIE/i); - * } - * test('runs on non IE browsers', skipUnless(isNotIE, function() { - * ... - * }); - * - * @param {Function} condition The name of a Boolean function determining if the - * test should be run. - * @param {Function} test The test to be run. - */ -export function skipUnless(condition, test) { - const isAsyncTest = !!test.length; - - return (done) => { - if (!condition()) { - return done(); - } - - const result = test.call(this, done); - - if (!isAsyncTest) { - done(); - } - - return result; - }; -} - -/** - * The globals below are provided for backwards compatibility and will be - * removed in the next major version. All users should migrate to importing - * functions directly from this module instead of accessing them via globals. - */ -window.TestHelpers = { - flushAsynchronousOperations, - forceXIfStamp, - fireEvent, - skipUnless, -}; - -window.flushAsynchronousOperations = flushAsynchronousOperations; -window.forceXIfStamp = forceXIfStamp; -window.fireEvent = fireEvent; -window.skipUnless = skipUnless; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/iron-validatable-behavior/iron-validatable-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/iron-validatable-behavior/iron-validatable-behavior.js index c0cf7479da8..7e3dc51872c 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/iron-validatable-behavior/iron-validatable-behavior.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/iron-validatable-behavior/iron-validatable-behavior.js @@ -8,7 +8,7 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import {IronMeta} from '../iron-meta/iron-meta.js'; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/animations/fade-in-animation.js b/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/animations/fade-in-animation.js index 257320ccbb5..51de8dd63ef 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/animations/fade-in-animation.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/animations/fade-in-animation.js @@ -8,9 +8,9 @@ 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 */ -import '../../polymer/polymer-legacy.js'; +import '../../polymer/polymer_bundled.min.js'; -import {Polymer} from '../../polymer/lib/legacy/polymer-fn.js'; +import {Polymer} from '../../polymer/polymer_bundled.min.js'; import {NeonAnimationBehavior} from '../neon-animation-behavior.js'; /* `<fade-in-animation>` animates the opacity of an element from 0 to 1. diff --git a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/animations/fade-out-animation.js b/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/animations/fade-out-animation.js index 83c586e9e34..de7e04a2b9e 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/animations/fade-out-animation.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/animations/fade-out-animation.js @@ -8,9 +8,9 @@ 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 */ -import '../../polymer/polymer-legacy.js'; +import '../../polymer/polymer_bundled.min.js'; -import {Polymer} from '../../polymer/lib/legacy/polymer-fn.js'; +import {Polymer} from '../../polymer/polymer_bundled.min.js'; import {NeonAnimationBehavior} from '../neon-animation-behavior.js'; /* `<fade-out-animation>` animates the opacity of an element from 1 to 0. diff --git a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animatable-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animatable-behavior.js index 14c4709f0ef..e8ab42fe1d5 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animatable-behavior.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animatable-behavior.js @@ -8,7 +8,7 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; /** * `NeonAnimatableBehavior` is implemented by elements containing diff --git a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animatable.js b/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animatable.js index 215593dfc6d..cba6aeb55a5 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animatable.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animatable.js @@ -8,11 +8,11 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import {IronResizableBehavior} from '../iron-resizable-behavior/iron-resizable-behavior.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; import {NeonAnimatableBehavior} from './neon-animatable-behavior.js'; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animated-pages.js b/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animated-pages.js index 0ea3e08c19d..d4ee33ec618 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animated-pages.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animated-pages.js @@ -8,13 +8,13 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import {IronResizableBehavior} from '../iron-resizable-behavior/iron-resizable-behavior.js'; import {IronSelectableBehavior} from '../iron-selector/iron-selectable.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; import {NeonAnimationRunnerBehavior} from './neon-animation-runner-behavior.js'; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animation-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animation-behavior.js index 33be9de32c0..5897c90c363 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animation-behavior.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animation-behavior.js @@ -8,7 +8,7 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; /** * Use `NeonAnimationBehavior` to implement an animation. diff --git a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animation-runner-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animation-runner-behavior.js index c718e877a47..6749b5b311a 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animation-runner-behavior.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-animation-runner-behavior.js @@ -8,7 +8,7 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import {NeonAnimatableBehavior} from './neon-animatable-behavior.js'; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-shared-element-animatable-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-shared-element-animatable-behavior.js deleted file mode 100644 index 9f8b10f6d0c..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-shared-element-animatable-behavior.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -@license -Copyright (c) 2015 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 -*/ -import '../polymer/polymer-legacy.js'; - -import {NeonAnimatableBehavior} from './neon-animatable-behavior.js'; - -/** - * Use `NeonSharedElementAnimatableBehavior` to implement elements - * containing shared element animations. - * @polymerBehavior NeonSharedElementAnimatableBehavior - */ -export const NeonSharedElementAnimatableBehaviorImpl = { - - properties: { - - /** - * A map of shared element id to node. - */ - sharedElements: {type: Object, value: {}} - - } - -}; - -/** @polymerBehavior */ -export const NeonSharedElementAnimatableBehavior = - [NeonAnimatableBehavior, NeonSharedElementAnimatableBehaviorImpl]; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-shared-element-animation-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-shared-element-animation-behavior.js deleted file mode 100644 index 9343824d48f..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/neon-animation/neon-shared-element-animation-behavior.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -@license -Copyright (c) 2015 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 -*/ -import '../polymer/polymer-legacy.js'; - -import {NeonAnimationBehavior} from './neon-animation-behavior.js'; - -/** - * Use `NeonSharedElementAnimationBehavior` to implement shared element - * animations. - * @polymerBehavior NeonSharedElementAnimationBehavior - */ -export const NeonSharedElementAnimationBehaviorImpl = { - - properties: { - - /** - * Cached copy of shared elements. - */ - sharedElements: {type: Object} - - }, - - /** - * Finds shared elements based on `config`. - */ - findSharedElements: function(config) { - var fromPage = config.fromPage; - var toPage = config.toPage; - if (!fromPage || !toPage) { - console.warn( - this.is + ':', !fromPage ? 'fromPage' : 'toPage', 'is undefined!'); - return null; - }; - - if (!fromPage.sharedElements || !toPage.sharedElements) { - console.warn( - this.is + ':', - 'sharedElements are undefined for', - !fromPage.sharedElements ? fromPage : toPage); - return null; - }; - - var from = fromPage.sharedElements[config.id]; - var to = toPage.sharedElements[config.id]; - - if (!from || !to) { - console.warn( - this.is + ':', - 'sharedElement with id', - config.id, - 'not found in', - !from ? fromPage : toPage); - return null; - } - - this.sharedElements = {from: from, to: to}; - return this.sharedElements; - } - -}; - -/** @polymerBehavior */ -export const NeonSharedElementAnimationBehavior = - [NeonAnimationBehavior, NeonSharedElementAnimationBehaviorImpl]; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-behaviors/paper-button-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-behaviors/paper-button-behavior.js deleted file mode 100644 index 23c9908a2a0..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-behaviors/paper-button-behavior.js +++ /dev/null @@ -1,90 +0,0 @@ -/** -@license -Copyright (c) 2015 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 -*/ -import '../polymer/polymer-legacy.js'; - -import {IronButtonState, IronButtonStateImpl} from '../iron-behaviors/iron-button-state.js'; -import {IronControlState} from '../iron-behaviors/iron-control-state.js'; - -import {PaperRippleBehavior} from './paper-ripple-behavior.js'; - -/** @polymerBehavior PaperButtonBehavior */ -export const PaperButtonBehaviorImpl = { - properties: { - /** - * The z-depth of this element, from 0-5. Setting to 0 will remove the - * shadow, and each increasing number greater than 0 will be "deeper" - * than the last. - * - * @attribute elevation - * @type number - * @default 1 - */ - elevation: {type: Number, reflectToAttribute: true, readOnly: true} - }, - - observers: [ - '_calculateElevation(focused, disabled, active, pressed, receivedFocusFromKeyboard)', - '_computeKeyboardClass(receivedFocusFromKeyboard)' - ], - - hostAttributes: {role: 'button', tabindex: '0', animated: true}, - - _calculateElevation: function() { - var e = 1; - if (this.disabled) { - e = 0; - } else if (this.active || this.pressed) { - e = 4; - } else if (this.receivedFocusFromKeyboard) { - e = 3; - } - this._setElevation(e); - }, - - _computeKeyboardClass: function(receivedFocusFromKeyboard) { - this.toggleClass('keyboard-focus', receivedFocusFromKeyboard); - }, - - /** - * In addition to `IronButtonState` behavior, when space key goes down, - * create a ripple down effect. - * - * @param {!KeyboardEvent} event . - */ - _spaceKeyDownHandler: function(event) { - IronButtonStateImpl._spaceKeyDownHandler.call(this, event); - // Ensure that there is at most one ripple when the space key is held down. - if (this.hasRipple() && this.getRipple().ripples.length < 1) { - this._ripple.uiDownAction(); - } - }, - - /** - * In addition to `IronButtonState` behavior, when space key goes up, - * create a ripple up effect. - * - * @param {!KeyboardEvent} event . - */ - _spaceKeyUpHandler: function(event) { - IronButtonStateImpl._spaceKeyUpHandler.call(this, event); - if (this.hasRipple()) { - this._ripple.uiUpAction(); - } - } -}; - -/** @polymerBehavior */ -export const PaperButtonBehavior = [ - IronButtonState, - IronControlState, - PaperRippleBehavior, - PaperButtonBehaviorImpl -]; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-behaviors/paper-inky-focus-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-behaviors/paper-inky-focus-behavior.js index 73a141bfdea..8e5a3ccf901 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-behaviors/paper-inky-focus-behavior.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-behaviors/paper-inky-focus-behavior.js @@ -8,7 +8,7 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import {IronButtonState} from '../iron-behaviors/iron-button-state.js'; import {IronControlState} from '../iron-behaviors/iron-control-state.js'; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-behaviors/paper-ripple-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-behaviors/paper-ripple-behavior.js index 7976f0b2c51..6aba337e287 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-behaviors/paper-ripple-behavior.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-behaviors/paper-ripple-behavior.js @@ -8,11 +8,11 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import '../paper-ripple/paper-ripple.js'; import {IronButtonStateImpl} from '../iron-behaviors/iron-button-state.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; /** * `PaperRippleBehavior` dynamically implements a ripple when the element has diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-button/paper-button.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-button/paper-button.js deleted file mode 100644 index eb9535ccb61..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-button/paper-button.js +++ /dev/null @@ -1,211 +0,0 @@ -/** -@license -Copyright (c) 2015 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 -*/ -import '../iron-flex-layout/iron-flex-layout.js'; -import '../paper-styles/element-styles/paper-material-styles.js'; - -import {PaperButtonBehavior, PaperButtonBehaviorImpl} from '../paper-behaviors/paper-button-behavior.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {html} from '../polymer/polymer-legacy.js'; - -const template = html` - <style include="paper-material-styles"> - /* Need to specify the same specificity as the styles imported from paper-material. */ - :host { - @apply --layout-inline; - @apply --layout-center-center; - position: relative; - box-sizing: border-box; - min-width: 5.14em; - margin: 0 0.29em; - background: transparent; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); - -webkit-tap-highlight-color: transparent; - font: inherit; - text-transform: uppercase; - outline-width: 0; - border-radius: 3px; - -moz-user-select: none; - -ms-user-select: none; - -webkit-user-select: none; - user-select: none; - cursor: pointer; - z-index: 0; - padding: 0.7em 0.57em; - - @apply --paper-font-common-base; - @apply --paper-button; - } - - :host([elevation="1"]) { - @apply --paper-material-elevation-1; - } - - :host([elevation="2"]) { - @apply --paper-material-elevation-2; - } - - :host([elevation="3"]) { - @apply --paper-material-elevation-3; - } - - :host([elevation="4"]) { - @apply --paper-material-elevation-4; - } - - :host([elevation="5"]) { - @apply --paper-material-elevation-5; - } - - :host([hidden]) { - display: none !important; - } - - :host([raised].keyboard-focus) { - font-weight: bold; - @apply --paper-button-raised-keyboard-focus; - } - - :host(:not([raised]).keyboard-focus) { - font-weight: bold; - @apply --paper-button-flat-keyboard-focus; - } - - :host([disabled]) { - background: none; - color: #a8a8a8; - cursor: auto; - pointer-events: none; - - @apply --paper-button-disabled; - } - - :host([disabled][raised]) { - background: #eaeaea; - } - - - :host([animated]) { - @apply --shadow-transition; - } - - paper-ripple { - color: var(--paper-button-ink-color); - } - </style> - - <slot></slot>`; - -template.setAttribute('strip-whitespace', ''); - -/** -Material design: -[Buttons](https://www.google.com/design/spec/components/buttons.html) - -`paper-button` is a button. When the user touches the button, a ripple effect -emanates from the point of contact. It may be flat or raised. A raised button is -styled with a shadow. - -Example: - - <paper-button>Flat button</paper-button> - <paper-button raised>Raised button</paper-button> - <paper-button noink>No ripple effect</paper-button> - <paper-button toggles>Toggle-able button</paper-button> - -A button that has `toggles` true will remain `active` after being clicked (and -will have an `active` attribute set). For more information, see the -`IronButtonState` behavior. - -You may use custom DOM in the button body to create a variety of buttons. For -example, to create a button with an icon and some text: - - <paper-button> - <iron-icon icon="favorite"></iron-icon> - custom button content - </paper-button> - -To use `paper-button` as a link, wrap it in an anchor tag. Since `paper-button` -will already receive focus, you may want to prevent the anchor tag from -receiving focus as well by setting its tabindex to -1. - - <a href="https://www.polymer-project.org/" tabindex="-1"> - <paper-button raised>Polymer Project</paper-button> - </a> - -### Styling - -Style the button with CSS as you would a normal DOM element. - - paper-button.fancy { - background: green; - color: yellow; - } - - paper-button.fancy:hover { - background: lime; - } - - paper-button[disabled], - paper-button[toggles][active] { - background: red; - } - -By default, the ripple is the same color as the foreground at 25% opacity. You -may customize the color using the `--paper-button-ink-color` custom property. - -The following custom properties and mixins are also available for styling: - -Custom property | Description | Default -----------------|-------------|---------- -`--paper-button-ink-color` | Background color of the ripple | `Based on the button's color` -`--paper-button` | Mixin applied to the button | `{}` -`--paper-button-disabled` | Mixin applied to the disabled button. Note that you can also use the `paper-button[disabled]` selector | `{}` -`--paper-button-flat-keyboard-focus` | Mixin applied to a flat button after it's been focused using the keyboard | `{}` -`--paper-button-raised-keyboard-focus` | Mixin applied to a raised button after it's been focused using the keyboard | `{}` - -@demo demo/index.html -*/ -Polymer({ - _template: template, - - is: 'paper-button', - - behaviors: [PaperButtonBehavior], - - properties: { - /** - * If true, the button should be styled with a shadow. - */ - raised: { - type: Boolean, - reflectToAttribute: true, - value: false, - observer: '_calculateElevation', - } - }, - - _calculateElevation: function() { - if (!this.raised) { - this._setElevation(0); - } else { - PaperButtonBehaviorImpl._calculateElevation.apply(this); - } - } - - /** - Fired when the animation finishes. - This is useful if you want to wait until - the ripple animation finishes to perform some action. - - @event transitionend - Event param: {{node: Object}} detail Contains the animated node. - */ -}); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-input/paper-input-addon-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-input/paper-input-addon-behavior.js index 1f7e4b5a0fc..b2dae3c8895 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-input/paper-input-addon-behavior.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-input/paper-input-addon-behavior.js @@ -8,7 +8,7 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; /** * Use `Polymer.PaperInputAddonBehavior` to implement an add-on for diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-input/paper-input-container.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-input/paper-input-container.js index 3e724e7ebe0..47dcb3ef416 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-input/paper-input-container.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-input/paper-input-container.js @@ -8,15 +8,15 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import '../iron-flex-layout/iron-flex-layout.js'; import '../paper-styles/default-theme.js'; import '../paper-styles/typography.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; -import {dashToCamelCase} from '../polymer/lib/utils/case-map.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; +import {dashToCamelCase} from '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; const template = html` <custom-style> <style is="custom-style"> @@ -197,18 +197,14 @@ Polymer({ @apply --layout-fit; border-bottom: 2px solid var(--paper-input-container-focus-color, var(--primary-color)); - -webkit-transform-origin: center center; transform-origin: center center; - -webkit-transform: scale3d(0,1,1); transform: scale3d(0,1,1); @apply --paper-input-container-underline-focus; } .underline.is-highlighted .focused-line { - -webkit-transform: none; transform: none; - -webkit-transition: -webkit-transform 0.25s; transition: transform 0.25s; @apply --paper-transition-easing; @@ -216,9 +212,7 @@ Polymer({ .underline.is-invalid .focused-line { border-color: var(--paper-input-container-invalid-color, var(--error-color)); - -webkit-transform: none; transform: none; - -webkit-transition: -webkit-transform 0.25s; transition: transform 0.25s; @apply --paper-transition-easing; @@ -256,9 +250,7 @@ Polymer({ width: 100%; font: inherit; color: var(--paper-input-container-color, var(--secondary-text-color)); - -webkit-transition: -webkit-transform 0.25s, width 0.25s; transition: transform 0.25s, width 0.25s; - -webkit-transform-origin: left top; transform-origin: left top; /* Fix for safari not focusing 0-height date/time inputs with -webkit-apperance: none; */ min-height: 1px; @@ -271,7 +263,6 @@ Polymer({ .input-content.label-is-floating ::slotted(label), .input-content.label-is-floating ::slotted(.paper-input-label) { - -webkit-transform: translateY(-75%) scale(0.75); transform: translateY(-75%) scale(0.75); /* Since we scale to 75/100 of the size, we actually have 100/75 of the @@ -285,7 +276,6 @@ Polymer({ :host(:dir(rtl)) .input-content.label-is-floating ::slotted(.paper-input-label) { right: 0; left: auto; - -webkit-transform-origin: right top; transform-origin: right top; } diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-input/paper-input-error.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-input/paper-input-error.js index afd9adcaa4e..97589a3287a 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-input/paper-input-error.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-input/paper-input-error.js @@ -8,12 +8,12 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import '../paper-styles/default-theme.js'; import '../paper-styles/typography.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; import {PaperInputAddonBehavior} from './paper-input-addon-behavior.js'; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-progress/paper-progress.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-progress/paper-progress.js index fdb26f773b1..17ac1b7f203 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-progress/paper-progress.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-progress/paper-progress.js @@ -8,13 +8,13 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import '../iron-flex-layout/iron-flex-layout.js'; import '../paper-styles/color.js'; import {IronRangeBehavior} from '../iron-range-behavior/iron-range-behavior.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; /** Material design: [Progress & @@ -128,28 +128,22 @@ Polymer({ :host(.transiting) #primaryProgress, :host(.transiting) #secondaryProgress { - -webkit-transition-property: -webkit-transform; transition-property: transform; /* Duration */ - -webkit-transition-duration: var(--paper-progress-transition-duration, 0.08s); transition-duration: var(--paper-progress-transition-duration, 0.08s); /* Timing function */ - -webkit-transition-timing-function: var(--paper-progress-transition-timing-function, ease); transition-timing-function: var(--paper-progress-transition-timing-function, ease); /* Delay */ - -webkit-transition-delay: var(--paper-progress-transition-delay, 0s); transition-delay: var(--paper-progress-transition-delay, 0s); } #primaryProgress, #secondaryProgress { @apply --layout-fit; - -webkit-transform-origin: left center; transform-origin: left center; - -webkit-transform: scaleX(0); transform: scaleX(0); will-change: transform; } @@ -171,50 +165,36 @@ Polymer({ } :host(:not([disabled])) #primaryProgress.indeterminate { - -webkit-transform-origin: right center; transform-origin: right center; - -webkit-animation: indeterminate-bar var(--paper-progress-indeterminate-cycle-duration, 2s) linear infinite; animation: indeterminate-bar var(--paper-progress-indeterminate-cycle-duration, 2s) linear infinite; } :host(:not([disabled])) #primaryProgress.indeterminate::after { content: ""; - -webkit-transform-origin: center center; transform-origin: center center; - -webkit-animation: indeterminate-splitter var(--paper-progress-indeterminate-cycle-duration, 2s) linear infinite; animation: indeterminate-splitter var(--paper-progress-indeterminate-cycle-duration, 2s) linear infinite; } @-webkit-keyframes indeterminate-bar { 0% { - -webkit-transform: scaleX(1) translateX(-100%); } 50% { - -webkit-transform: scaleX(1) translateX(0%); } 75% { - -webkit-transform: scaleX(1) translateX(0%); - -webkit-animation-timing-function: cubic-bezier(.28,.62,.37,.91); } 100% { - -webkit-transform: scaleX(0) translateX(0%); } } @-webkit-keyframes indeterminate-splitter { 0% { - -webkit-transform: scaleX(.75) translateX(-125%); } 30% { - -webkit-transform: scaleX(.75) translateX(-125%); - -webkit-animation-timing-function: cubic-bezier(.42,0,.6,.8); } 90% { - -webkit-transform: scaleX(.75) translateX(125%); } 100% { - -webkit-transform: scaleX(.75) translateX(125%); } } diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-ripple/paper-ripple.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-ripple/paper-ripple.js index 6969cd74296..4ad33bc1367 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-ripple/paper-ripple.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-ripple/paper-ripple.js @@ -1,736 +1,253 @@ -/** -@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 -*/ -import '../polymer/polymer-legacy.js'; - import {IronA11yKeysBehavior} from '../iron-a11y-keys-behavior/iron-a11y-keys-behavior.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; - -var Utility = { - distance: function(x1, y1, x2, y2) { - var xDelta = (x1 - x2); - var yDelta = (y1 - y2); - - return Math.sqrt(xDelta * xDelta + yDelta * yDelta); - }, +import {Polymer, dom, html} from '../polymer/polymer_bundled.min.js'; - now: window.performance && window.performance.now ? - window.performance.now.bind(window.performance) : - Date.now -}; +var MAX_RADIUS_PX = 300; +var MIN_DURATION_MS = 800; /** - * @param {HTMLElement} element - * @constructor + * @param {number} x1 + * @param {number} y1 + * @param {number} x2 + * @param {number} y2 + * @return {number} The distance between (x1, y1) and (x2, y2). */ -function ElementMetrics(element) { - this.element = element; - this.width = this.boundingRect.width; - this.height = this.boundingRect.height; - - this.size = Math.max(this.width, this.height); -} - -ElementMetrics.prototype = { - get boundingRect() { - return this.element.getBoundingClientRect(); - }, - - furthestCornerDistanceFrom: function(x, y) { - var topLeft = Utility.distance(x, y, 0, 0); - var topRight = Utility.distance(x, y, this.width, 0); - var bottomLeft = Utility.distance(x, y, 0, this.height); - var bottomRight = Utility.distance(x, y, this.width, this.height); - - return Math.max(topLeft, topRight, bottomLeft, bottomRight); - } +var distance = function(x1, y1, x2, y2) { + var xDelta = x1 - x2; + var yDelta = y1 - y2; + return Math.sqrt(xDelta * xDelta + yDelta * yDelta); }; -/** - * @param {HTMLElement} element - * @constructor - */ -function Ripple(element) { - this.element = element; - this.color = window.getComputedStyle(element).color; - - this.wave = document.createElement('div'); - this.waveContainer = document.createElement('div'); - this.wave.style.backgroundColor = this.color; - this.wave.classList.add('wave'); - this.waveContainer.classList.add('wave-container'); - dom(this.waveContainer).appendChild(this.wave); - - this.resetInteractionState(); -} - -Ripple.MAX_RADIUS = 300; - -Ripple.prototype = { - get recenters() { - return this.element.recenters; - }, - - get center() { - return this.element.center; - }, - - get mouseDownElapsed() { - var elapsed; - - if (!this.mouseDownStart) { - return 0; - } - - elapsed = Utility.now() - this.mouseDownStart; - - if (this.mouseUpStart) { - elapsed -= this.mouseUpElapsed; - } - - return elapsed; - }, - - get mouseUpElapsed() { - return this.mouseUpStart ? Utility.now() - this.mouseUpStart : 0; - }, - - get mouseDownElapsedSeconds() { - return this.mouseDownElapsed / 1000; - }, - - get mouseUpElapsedSeconds() { - return this.mouseUpElapsed / 1000; - }, - - get mouseInteractionSeconds() { - return this.mouseDownElapsedSeconds + this.mouseUpElapsedSeconds; - }, - - get initialOpacity() { - return this.element.initialOpacity; - }, - - get opacityDecayVelocity() { - return this.element.opacityDecayVelocity; - }, - - get radius() { - var width2 = this.containerMetrics.width * this.containerMetrics.width; - var height2 = this.containerMetrics.height * this.containerMetrics.height; - var waveRadius = - Math.min(Math.sqrt(width2 + height2), Ripple.MAX_RADIUS) * 1.1 + 5; - - var duration = 1.1 - 0.2 * (waveRadius / Ripple.MAX_RADIUS); - var timeNow = this.mouseInteractionSeconds / duration; - var size = waveRadius * (1 - Math.pow(80, -timeNow)); - - return Math.abs(size); - }, - - get opacity() { - if (!this.mouseUpStart) { - return this.initialOpacity; - } - - return Math.max( - 0, - this.initialOpacity - - this.mouseUpElapsedSeconds * this.opacityDecayVelocity); - }, - - get outerOpacity() { - // Linear increase in background opacity, capped at the opacity - // of the wavefront (waveOpacity). - var outerOpacity = this.mouseUpElapsedSeconds * 0.3; - var waveOpacity = this.opacity; - - return Math.max(0, Math.min(outerOpacity, waveOpacity)); - }, - - get isOpacityFullyDecayed() { - return this.opacity < 0.01 && - this.radius >= Math.min(this.maxRadius, Ripple.MAX_RADIUS); - }, - - get isRestingAtMaxRadius() { - return this.opacity >= this.initialOpacity && - this.radius >= Math.min(this.maxRadius, Ripple.MAX_RADIUS); - }, - - get isAnimationComplete() { - return this.mouseUpStart ? this.isOpacityFullyDecayed : - this.isRestingAtMaxRadius; - }, - - get translationFraction() { - return Math.min( - 1, this.radius / this.containerMetrics.size * 2 / Math.sqrt(2)); - }, - - get xNow() { - if (this.xEnd) { - return this.xStart + this.translationFraction * (this.xEnd - this.xStart); - } - - return this.xStart; - }, - - get yNow() { - if (this.yEnd) { - return this.yStart + this.translationFraction * (this.yEnd - this.yStart); - } - - return this.yStart; - }, - - get isMouseDown() { - return this.mouseDownStart && !this.mouseUpStart; - }, - - resetInteractionState: function() { - this.maxRadius = 0; - this.mouseDownStart = 0; - this.mouseUpStart = 0; - - this.xStart = 0; - this.yStart = 0; - this.xEnd = 0; - this.yEnd = 0; - this.slideDistance = 0; - - this.containerMetrics = new ElementMetrics(this.element); - }, - - draw: function() { - var scale; - var dx; - var dy; - - this.wave.style.opacity = this.opacity; - - scale = this.radius / (this.containerMetrics.size / 2); - dx = this.xNow - (this.containerMetrics.width / 2); - dy = this.yNow - (this.containerMetrics.height / 2); - - - // 2d transform for safari because of border-radius and overflow:hidden - // clipping bug. https://bugs.webkit.org/show_bug.cgi?id=98538 - this.waveContainer.style.webkitTransform = - 'translate(' + dx + 'px, ' + dy + 'px)'; - this.waveContainer.style.transform = - 'translate3d(' + dx + 'px, ' + dy + 'px, 0)'; - this.wave.style.webkitTransform = 'scale(' + scale + ',' + scale + ')'; - this.wave.style.transform = 'scale3d(' + scale + ',' + scale + ',1)'; - }, - - /** @param {Event=} event */ - downAction: function(event) { - var xCenter = this.containerMetrics.width / 2; - var yCenter = this.containerMetrics.height / 2; - - this.resetInteractionState(); - this.mouseDownStart = Utility.now(); - - if (this.center) { - this.xStart = xCenter; - this.yStart = yCenter; - this.slideDistance = - Utility.distance(this.xStart, this.yStart, this.xEnd, this.yEnd); - } else { - this.xStart = event ? - event.detail.x - this.containerMetrics.boundingRect.left : - this.containerMetrics.width / 2; - this.yStart = event ? - event.detail.y - this.containerMetrics.boundingRect.top : - this.containerMetrics.height / 2; - } - - if (this.recenters) { - this.xEnd = xCenter; - this.yEnd = yCenter; - this.slideDistance = - Utility.distance(this.xStart, this.yStart, this.xEnd, this.yEnd); - } - - this.maxRadius = this.containerMetrics.furthestCornerDistanceFrom( - this.xStart, this.yStart); - - this.waveContainer.style.top = - (this.containerMetrics.height - this.containerMetrics.size) / 2 + 'px'; - this.waveContainer.style.left = - (this.containerMetrics.width - this.containerMetrics.size) / 2 + 'px'; - - this.waveContainer.style.width = this.containerMetrics.size + 'px'; - this.waveContainer.style.height = this.containerMetrics.size + 'px'; - }, - - /** @param {Event=} event */ - upAction: function(event) { - if (!this.isMouseDown) { - return; - } - - this.mouseUpStart = Utility.now(); - }, - - remove: function() { - dom(this.waveContainer.parentNode).removeChild(this.waveContainer); - } -}; - -/** -Material design: [Surface -reaction](https://www.google.com/design/spec/animation/responsive-interaction.html#responsive-interaction-surface-reaction) - -`paper-ripple` provides a visual effect that other paper elements can -use to simulate a rippling effect emanating from the point of contact. The -effect can be visualized as a concentric circle with motion. - -Example: - - <div style="position:relative"> - <paper-ripple></paper-ripple> - </div> - -Note, it's important that the parent container of the ripple be relative -position, otherwise the ripple will emanate outside of the desired container. - -`paper-ripple` listens to "mousedown" and "mouseup" events so it would display -ripple effect when touches on it. You can also defeat the default behavior and -manually route the down and up actions to the ripple element. Note that it is -important if you call `downAction()` you will have to make sure to call -`upAction()` so that `paper-ripple` would end the animation loop. - -Example: - - <paper-ripple id="ripple" style="pointer-events: none;"></paper-ripple> - ... - downAction: function(e) { - this.$.ripple.downAction(e.detail); - }, - upAction: function(e) { - this.$.ripple.upAction(); - } - -Styling ripple effect: - - Use CSS color property to style the ripple: - - paper-ripple { - color: #4285f4; - } - - Note that CSS color property is inherited so it is not required to set it on - the `paper-ripple` element directly. - -By default, the ripple is centered on the point of contact. Apply the -`recenters` attribute to have the ripple grow toward the center of its -container. - - <paper-ripple recenters></paper-ripple> - -You can also center the ripple inside its container from the start. - - <paper-ripple center></paper-ripple> - -Apply `circle` class to make the rippling effect within a circle. - - <paper-ripple class="circle"></paper-ripple> - -@group Paper Elements -@element paper-ripple -@hero hero.svg -@demo demo/index.html -*/ Polymer({ _template: html` <style> :host { - display: block; - position: absolute; border-radius: inherit; - overflow: hidden; - top: 0; - left: 0; - right: 0; bottom: 0; - - /* See PolymerElements/paper-behaviors/issues/34. On non-Chrome browsers, - * creating a node (with a position:absolute) in the middle of an event - * handler "interrupts" that event handler (which happens when the - * ripple is created on demand) */ + display: block; + left: 0; + overflow: hidden; pointer-events: none; - } - - :host([animating]) { - /* This resolves a rendering issue in Chrome (as of 40) where the - ripple is not properly clipped by its parent (which may have - rounded corners). See: http://jsbin.com/temexa/4 - - Note: We only apply this style conditionally. Otherwise, the browser - will create a new compositing layer for every ripple element on the - page, and that would be bad. */ - -webkit-transform: translate(0, 0); + position: absolute; + right: 0; + top: 0; + /* For rounded corners: http://jsbin.com/temexa/4. */ transform: translate3d(0, 0, 0); } - #background, - #waves, - .wave-container, - .wave { + .ripple { + background-color: currentcolor; + left: 0; + opacity: var(--paper-ripple-opacity, 0.25); pointer-events: none; position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - } - - #background, - .wave { - opacity: 0; + will-change: height, transform, width; } - #waves, - .wave { - overflow: hidden; - } - - .wave-container, - .wave { + .ripple, + :host(.circle) { border-radius: 50%; } - - :host(.circle) #background, - :host(.circle) #waves { - border-radius: 50%; - } - - :host(.circle) .wave-container { - overflow: hidden; - } </style> - - <div id="background"></div> - <div id="waves"></div> `, is: 'paper-ripple', behaviors: [IronA11yKeysBehavior], properties: { - /** - * The initial opacity set on the wave. - * - * @attribute initialOpacity - * @type number - * @default 0.25 - */ - initialOpacity: {type: Number, value: 0.25}, - - /** - * How fast (opacity per second) the wave fades out. - * - * @attribute opacityDecayVelocity - * @type number - * @default 0.8 - */ - opacityDecayVelocity: {type: Number, value: 0.8}, - - /** - * If true, ripples will exhibit a gravitational pull towards - * the center of their container as they fade away. - * - * @attribute recenters - * @type boolean - * @default false - */ - recenters: {type: Boolean, value: false}, - - /** - * If true, ripples will center inside its container - * - * @attribute recenters - * @type boolean - * @default false - */ center: {type: Boolean, value: false}, - - /** - * A list of the visual ripples. - * - * @attribute ripples - * @type Array - * @default [] - */ - ripples: { - type: Array, - value: function() { - return []; - } - }, - - /** - * True when there are visible ripples animating within the - * element. - */ - animating: - {type: Boolean, readOnly: true, reflectToAttribute: true, value: false}, - - /** - * If true, the ripple will remain in the "down" state until `holdDown` - * is set to false again. - */ holdDown: {type: Boolean, value: false, observer: '_holdDownChanged'}, - - /** - * If true, the ripple will not generate a ripple effect - * via pointer interaction. - * Calling ripple's imperative api like `simulatedRipple` will - * still generate the ripple effect. - */ + recenters: {type: Boolean, value: false}, noink: {type: Boolean, value: false}, - - _animating: {type: Boolean}, - - _boundAnimate: { - type: Function, - value: function() { - return this.animate.bind(this); - } - } - }, - - get target() { - return this.keyEventTarget; }, - /** - * @type {!Object} - */ keyBindings: { 'enter:keydown': '_onEnterKeydown', 'space:keydown': '_onSpaceKeydown', - 'space:keyup': '_onSpaceKeyup' + 'space:keyup': '_onSpaceKeyup', + }, + + /** @override */ + created: function() { + /** @type {Array<!Element>} */ + this.ripples = []; }, + /** @override */ attached: function() { - // Set up a11yKeysBehavior to listen to key events on the target, - // so that space and enter activate the ripple even if the target doesn't - // handle key events. The key handlers deal with `noink` themselves. - if (this.parentNode.nodeType == 11) { // DOCUMENT_FRAGMENT_NODE - this.keyEventTarget = dom(this).getOwnerRoot().host; - } else { - this.keyEventTarget = this.parentNode; - } - var keyEventTarget = /** @type {!EventTarget} */ (this.keyEventTarget); - this.listen(keyEventTarget, 'up', 'uiUpAction'); - this.listen(keyEventTarget, 'down', 'uiDownAction'); + this.keyEventTarget = this.parentNode.nodeType == 11 ? + dom(this).getOwnerRoot().host : this.parentNode; + this.keyEventTarget = /** @type {!EventTarget} */ (this.keyEventTarget); + this.listen(this.keyEventTarget, 'up', 'uiUpAction'); + this.listen(this.keyEventTarget, 'down', 'uiDownAction'); }, + /** @override */ detached: function() { this.unlisten(this.keyEventTarget, 'up', 'uiUpAction'); this.unlisten(this.keyEventTarget, 'down', 'uiDownAction'); this.keyEventTarget = null; }, - get shouldKeepAnimating() { - for (var index = 0; index < this.ripples.length; ++index) { - if (!this.ripples[index].isAnimationComplete) { - return true; - } - } - - return false; - }, - simulatedRipple: function() { - this.downAction(null); - - // Please see polymer/polymer#1305 - this.async(function() { - this.upAction(); - }, 1); + this.downAction(); + // Using a 1ms delay ensures a macro-task. + this.async(function() { this.upAction(); }.bind(this), 1); }, - /** - * Provokes a ripple down effect via a UI event, - * respecting the `noink` property. - * @param {Event=} event - */ - uiDownAction: function(event) { - if (!this.noink) { - this.downAction(event); - } + /** @param {Event=} e */ + uiDownAction: function(e) { + if (!this.noink) + this.downAction(e); }, - /** - * Provokes a ripple down effect via a UI event, - * *not* respecting the `noink` property. - * @param {Event=} event - */ - downAction: function(event) { - if (this.holdDown && this.ripples.length > 0) { + /** @param {Event=} e */ + downAction: function(e) { + if (this.ripples.length && this.holdDown) return; - } - - var ripple = this.addRipple(); - - ripple.downAction(event); - - if (!this._animating) { - this._animating = true; - this.animate(); - } + // TODO(dbeam): some things (i.e. paper-icon-button-light) dynamically + // create ripples on 'up', Ripples register an event listener on their + // parent (or shadow DOM host) when attached(). This sometimes causes + // duplicate events to fire on us. + this.debounce('show ripple', function() { this.__showRipple(e); }, 1); }, - /** - * Provokes a ripple up effect via a UI event, - * respecting the `noink` property. - * @param {Event=} event - */ - uiUpAction: function(event) { - if (!this.noink) { - this.upAction(event); - } + clear: function() { + this.__hideRipple(); + this.holdDown = false; }, - /** - * Provokes a ripple up effect via a UI event, - * *not* respecting the `noink` property. - * @param {Event=} event - */ - upAction: function(event) { - if (this.holdDown) { - return; - } - - this.ripples.forEach(function(ripple) { - ripple.upAction(event); + showAndHoldDown: function() { + this.ripples.forEach(ripple => { + ripple.remove(); }); - - this._animating = true; - this.animate(); + this.ripples = []; + this.holdDown = true; }, - onAnimationComplete: function() { - this._animating = false; - this.$.background.style.backgroundColor = null; - this.fire('transitionend'); - }, - - addRipple: function() { - var ripple = new Ripple(this); - - dom(this.$.waves).appendChild(ripple.waveContainer); - this.$.background.style.backgroundColor = ripple.color; - this.ripples.push(ripple); - - this._setAnimating(true); - - return ripple; - }, + /** + * @param {Event=} e + * @private + * @suppress {checkTypes} + */ + __showRipple: function(e) { + var rect = this.getBoundingClientRect(); - removeRipple: function(ripple) { - var rippleIndex = this.ripples.indexOf(ripple); + var roundedCenterX = function() { return Math.round(rect.width / 2); }; + var roundedCenterY = function() { return Math.round(rect.height / 2); }; - if (rippleIndex < 0) { - return; + var centered = !e || this.center; + if (centered) { + var x = roundedCenterX(); + var y = roundedCenterY(); + } else { + var sourceEvent = e.detail.sourceEvent; + var x = Math.round(sourceEvent.clientX - rect.left); + var y = Math.round(sourceEvent.clientY - rect.top); } - this.ripples.splice(rippleIndex, 1); + var corners = [ + {x: 0, y: 0}, + {x: rect.width, y: 0}, + {x: 0, y: rect.height}, + {x: rect.width, y: rect.height}, + ]; - ripple.remove(); + var cornerDistances = corners.map(function(corner) { + return Math.round(distance(x, y, corner.x, corner.y)); + }); - if (!this.ripples.length) { - this._setAnimating(false); - } - }, + var radius = Math.min(MAX_RADIUS_PX, Math.max.apply(Math, cornerDistances)); - /** - * Deprecated. Please use animateRipple() instead. - * - * This method name conflicts with Element#animate(). - * https://developer.mozilla.org/en-US/docs/Web/API/Element/animate. - * - * @suppress {checkTypes} - */ - animate: function() { - if (!this._animating) { - return; + var startTranslate = (x - radius) + 'px, ' + (y - radius) + 'px'; + if (this.recenters && !centered) { + var endTranslate = (roundedCenterX() - radius) + 'px, ' + + (roundedCenterY() - radius) + 'px'; + } else { + var endTranslate = startTranslate; } - var index; - var ripple; - - for (index = 0; index < this.ripples.length; ++index) { - ripple = this.ripples[index]; - ripple.draw(); + var ripple = document.createElement('div'); + ripple.classList.add('ripple'); + ripple.style.height = ripple.style.width = (2 * radius) + 'px'; - this.$.background.style.opacity = ripple.outerOpacity; + this.ripples.push(ripple); + this.shadowRoot.appendChild(ripple); + + ripple.animate({ + // TODO(dbeam): scale to 90% of radius at .75 offset? + transform: ['translate(' + startTranslate + ') scale(0)', + 'translate(' + endTranslate + ') scale(1)'], + }, { + duration: Math.max(MIN_DURATION_MS, Math.log(radius) * radius) || 0, + easing: 'cubic-bezier(.2, .9, .1, .9)', + fill: 'forwards', + }); + }, - if (ripple.isOpacityFullyDecayed && !ripple.isRestingAtMaxRadius) { - this.removeRipple(ripple); - } - } + /** @param {Event=} e */ + uiUpAction: function(e) { + if (!this.noink) + this.upAction(); + }, - if (!this.shouldKeepAnimating && this.ripples.length === 0) { - this.onAnimationComplete(); - } else { - window.requestAnimationFrame(this._boundAnimate); - } + /** @param {Event=} e */ + upAction: function(e) { + if (!this.holdDown) + this.debounce('hide ripple', function() { this.__hideRipple(); }, 1); }, /** - * An alias for animate() whose name does not conflict with the platform - * Element.animate() method. + * @private + * @suppress {checkTypes} */ - animateRipple: function() { - return this.animate(); - }, - + __hideRipple: function() { + Promise.all(this.ripples.map(function(ripple) { + return new Promise(function(resolve) { + var removeRipple = function() { + ripple.remove(); + resolve(); + }; + var opacity = getComputedStyle(ripple).opacity; + if (!opacity.length) { + removeRipple(); + } else { + var animation = ripple.animate({ + opacity: [opacity, 0], + }, { + duration: 150, + fill: 'forwards', + }); + animation.addEventListener('finish', removeRipple); + animation.addEventListener('cancel', removeRipple); + } + }); + })).then(function() { this.fire('transitionend'); }.bind(this)); + this.ripples = []; + }, + + /** @protected */ _onEnterKeydown: function() { this.uiDownAction(); this.async(this.uiUpAction, 1); }, + /** @protected */ _onSpaceKeydown: function() { this.uiDownAction(); }, + /** @protected */ _onSpaceKeyup: function() { this.uiUpAction(); }, - // note: holdDown does not respect noink since it can be a focus based - // effect. - _holdDownChanged: function(newVal, oldVal) { - if (oldVal === undefined) { + /** @protected */ + _holdDownChanged: function(newHoldDown, oldHoldDown) { + if (oldHoldDown === undefined) return; - } - if (newVal) { + if (newHoldDown) this.downAction(); - } else { + else this.upAction(); - } - } - - /** - Fired when the animation finishes. - This is useful if you want to wait until - the ripple animation finishes to perform some action. - - @event transitionend - @param {{node: Object}} detail Contains the animated node. - */ + }, }); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-spinner/paper-spinner-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-spinner/paper-spinner-behavior.js index ebc060e1665..8ab7c526b82 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-spinner/paper-spinner-behavior.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-spinner/paper-spinner-behavior.js @@ -8,7 +8,7 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; /** @polymerBehavior */ export const PaperSpinnerBehavior = { diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-spinner/paper-spinner-lite.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-spinner/paper-spinner-lite.js index 740be3771da..2577e3a37ed 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-spinner/paper-spinner-lite.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-spinner/paper-spinner-lite.js @@ -8,12 +8,12 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import '../paper-styles/color.js'; import './paper-spinner-styles.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; import {PaperSpinnerBehavior} from './paper-spinner-behavior.js'; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-spinner/paper-spinner-styles.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-spinner/paper-spinner-styles.js index 43b6553e770..1fe43d0e8e6 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-spinner/paper-spinner-styles.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-spinner/paper-spinner-styles.js @@ -61,7 +61,6 @@ $_documentContainer.innerHTML = `<dom-module id="paper-spinner-styles"> } #spinnerContainer.active { - -webkit-animation: container-rotate var(--paper-spinner-container-rotation-duration) linear infinite; animation: container-rotate var(--paper-spinner-container-rotation-duration) linear infinite; } @@ -107,10 +106,6 @@ $_documentContainer.innerHTML = `<dom-module id="paper-spinner-styles"> * seems). */ .active .spinner-layer { - -webkit-animation-name: fill-unfill-rotate; - -webkit-animation-duration: var(--paper-spinner-full-cycle-duration); - -webkit-animation-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1); - -webkit-animation-iteration-count: infinite; animation-name: fill-unfill-rotate; animation-duration: var(--paper-spinner-full-cycle-duration); animation-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1); @@ -119,22 +114,18 @@ $_documentContainer.innerHTML = `<dom-module id="paper-spinner-styles"> } .active .spinner-layer.layer-1 { - -webkit-animation-name: fill-unfill-rotate, layer-1-fade-in-out; animation-name: fill-unfill-rotate, layer-1-fade-in-out; } .active .spinner-layer.layer-2 { - -webkit-animation-name: fill-unfill-rotate, layer-2-fade-in-out; animation-name: fill-unfill-rotate, layer-2-fade-in-out; } .active .spinner-layer.layer-3 { - -webkit-animation-name: fill-unfill-rotate, layer-3-fade-in-out; animation-name: fill-unfill-rotate, layer-3-fade-in-out; } .active .spinner-layer.layer-4 { - -webkit-animation-name: fill-unfill-rotate, layer-4-fade-in-out; animation-name: fill-unfill-rotate, layer-4-fade-in-out; } @@ -268,34 +259,27 @@ $_documentContainer.innerHTML = `<dom-module id="paper-spinner-styles"> .circle-clipper.left .circle { left: 0; border-right-color: transparent !important; - -webkit-transform: rotate(129deg); transform: rotate(129deg); } .circle-clipper.right .circle { left: -100%; border-left-color: transparent !important; - -webkit-transform: rotate(-129deg); transform: rotate(-129deg); } .active .gap-patch::after, .active .circle-clipper .circle { - -webkit-animation-duration: var(--paper-spinner-expand-contract-duration); - -webkit-animation-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1); - -webkit-animation-iteration-count: infinite; animation-duration: var(--paper-spinner-expand-contract-duration); animation-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1); animation-iteration-count: infinite; } .active .circle-clipper.left .circle { - -webkit-animation-name: left-spin; animation-name: left-spin; } .active .circle-clipper.right .circle { - -webkit-animation-name: right-spin; animation-name: right-spin; } @@ -324,7 +308,6 @@ $_documentContainer.innerHTML = `<dom-module id="paper-spinner-styles"> } #spinnerContainer.cooldown { - -webkit-animation: container-rotate var(--paper-spinner-container-rotation-duration) linear infinite, fade-out var(--paper-spinner-cooldown-duration) cubic-bezier(0.4, 0.0, 0.2, 1); animation: container-rotate var(--paper-spinner-container-rotation-duration) linear infinite, fade-out var(--paper-spinner-cooldown-duration) cubic-bezier(0.4, 0.0, 0.2, 1); } diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/classes/global.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/classes/global.js index 2082c8f9ae6..9a4d2e2ab9b 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/classes/global.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/classes/global.js @@ -17,7 +17,7 @@ you import this file. import '../paper-styles-classes.js'; -import {html} from '../../polymer/lib/utils/html-tag.js'; +import {html} from '../../polymer/polymer_bundled.min.js'; const template = html`<style> /* Mixins */ diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/classes/shadow.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/classes/shadow.js index 44dcd290b3f..a88a6e17c0b 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/classes/shadow.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/classes/shadow.js @@ -17,7 +17,7 @@ you import this file. For a set of styles that can be applied to an element, check paper-styles/shadow.js. */ -import {html} from '../../polymer/lib/utils/html-tag.js'; +import {html} from '../../polymer/polymer_bundled.min.js'; const template = html` <style> .shadow-transition { diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/classes/typography.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/classes/typography.js index b35f8899558..0c397e032e2 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/classes/typography.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/classes/typography.js @@ -18,7 +18,7 @@ For a set of styles that can be applied to an element, check paper-styles/typography.html. */ import '../../font-roboto/roboto.js'; -import {html} from '../../polymer/lib/utils/html-tag.js'; +import {html} from '../../polymer/polymer_bundled.min.js'; const template = html` <style> diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/color.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/color.js index dac65303c15..6af2fa35933 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/color.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/color.js @@ -9,9 +9,9 @@ part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {html} from '../polymer/polymer_bundled.min.js'; const template = html` <custom-style> <style is="custom-style"> @@ -19,30 +19,50 @@ const template = html` /* Material Design color palette for Google products */ - --google-red-100: #f4c7c3; - --google-red-300: #e67c73; - --google-red-500: #db4437; - --google-red-700: #c53929; - - --google-blue-100: #c6dafc; - --google-blue-300: #7baaf7; - --google-blue-500: #4285f4; - --google-blue-700: #3367d6; - - --google-green-100: #b7e1cd; - --google-green-300: #57bb8a; - --google-green-500: #0f9d58; - --google-green-700: #0b8043; - - --google-yellow-100: #fce8b2; - --google-yellow-300: #f7cb4d; - --google-yellow-500: #f4b400; - --google-yellow-700: #f09300; - - --google-grey-100: #f5f5f5; - --google-grey-300: #e0e0e0; - --google-grey-500: #9e9e9e; - --google-grey-700: #616161; + --google-red-100-rgb: 244, 199, 195; /* #f4c7c3 */ + --google-red-100: rgb(var(--google-red-100-rgb)); + --google-red-300-rgb: 230, 124, 115; /* #e67c73 */ + --google-red-300: rgb(var(--google-red-300-rgb)); + --google-red-500-rgb: 219, 68, 55; /* #db4437 */ + --google-red-500: rgb(var(--google-red-500-rgb)); + --google-red-700-rgb: 197, 57, 41; /* #c53929 */ + --google-red-700: rgb(var(--google-red-700-rgb)); + + --google-blue-100-rgb: 198, 218, 252; /* #c6dafc */ + --google-blue-100: rgb(var(--google-blue-100-rgb)); + --google-blue-300-rgb: 123, 170, 247; /* #7baaf7 */ + --google-blue-300: rgb(var(--google-blue-300-rgb)); + --google-blue-500-rgb: 66, 133, 244; /* #4285f4 */ + --google-blue-500: rgb(var(--google-blue-500-rgb)); + --google-blue-700-rgb: 51, 103, 214; /* #3367d6 */ + --google-blue-700: rgb(var(--google-blue-700-rgb)); + + --google-green-100-rgb: 183, 225, 205; /* #b7e1cd */ + --google-green-100: rgb(var(--google-green-100-rgb)); + --google-green-300-rgb: 87, 187, 138; /* #57bb8a */ + --google-green-300: rgb(var(--google-green-300-rgb)); + --google-green-500-rgb: 15, 157, 88; /* #0f9d58 */ + --google-green-500: rgb(var(--google-green-500-rgb)); + --google-green-700-rgb: 11, 128, 67; /* #0b8043 */ + --google-green-700: rgb(var(--google-green-700-rgb)); + + --google-yellow-100-rgb: 252, 232, 178; /* #fce8b2 */ + --google-yellow-100: rgb(var(--google-yellow-100-rgb)); + --google-yellow-300-rgb: 247, 203, 77; /* #f7cb4d */ + --google-yellow-300: rgb(var(--google-yellow-300-rgb)); + --google-yellow-500-rgb: 244, 180, 0; /* #f4b400 */ + --google-yellow-500: rgb(var(--google-yellow-500-rgb)); + --google-yellow-700-rgb: 240, 147, 0; /* #f09300 */ + --google-yellow-700: rgb(var(--google-yellow-700-rgb)); + + --google-grey-100-rgb: 245, 245, 245; /* #f5f5f5 */ + --google-grey-100: rgb(var(--google-grey-100-rgb)); + --google-grey-300-rgb: 224, 224, 224; /* #e0e0e0 */ + --google-grey-300: rgb(var(--google-grey-300-rgb)); + --google-grey-500-rgb: 158, 158, 158; /* #9e9e9e */ + --google-grey-500: rgb(var(--google-grey-500-rgb)); + --google-grey-700-rgb: 97, 97, 97; /* #616161 */ + --google-grey-700: rgb(var(--google-grey-700-rgb)); /* Material Design color palette from online spec document */ @@ -337,4 +357,4 @@ const template = html` </custom-style> `; template.setAttribute('style', 'display: none;'); -document.head.appendChild(template.content); +document.head.appendChild(template.content);
\ No newline at end of file diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/default-theme.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/default-theme.js index 59533eb1493..9b3350245ae 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/default-theme.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/default-theme.js @@ -11,10 +11,10 @@ found at http://polymer.github.io/PATENTS.txt /* Taken from * https://www.google.com/design/spec/style/color.html#color-ui-color-application */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import './color.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {html} from '../polymer/polymer_bundled.min.js'; const template = html` <custom-style> <style is="custom-style"> diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/demo-pages.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/demo-pages.js index 2cfb51baf6f..d90c8a9eed0 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/demo-pages.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/demo-pages.js @@ -18,13 +18,13 @@ For a set of styles that can be applied to an element, check iron-demo-helpers/demo-pages-shared-styles.html. */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import '../iron-flex-layout/iron-flex-layout.js'; import './color.js'; import './typography.js'; import './shadow.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {html} from '../polymer/polymer_bundled.min.js'; const template = html`<custom-style> <style is="custom-style"> body { diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/element-styles/paper-item-styles.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/element-styles/paper-item-styles.js index 3d9d2ab9592..042f89bcac0 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/element-styles/paper-item-styles.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/element-styles/paper-item-styles.js @@ -29,12 +29,12 @@ element: @demo demo/index.html */ -import '../../polymer/polymer-legacy.js'; +import '../../polymer/polymer_bundled.min.js'; import '../color.js'; import '../default-theme.js'; import '../typography.js'; -import {html} from '../../polymer/lib/utils/html-tag.js'; +import {html} from '../../polymer/polymer_bundled.min.js'; const template = html` <dom-module id="paper-item-styles"> <template> diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/element-styles/paper-material-styles.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/element-styles/paper-material-styles.js index d2e3e08c3a0..298b1ab3ba1 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/element-styles/paper-material-styles.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/element-styles/paper-material-styles.js @@ -29,10 +29,10 @@ Example: @demo demo/index.html */ -import '../../polymer/polymer-legacy.js'; +import '../../polymer/polymer_bundled.min.js'; import '../shadow.js'; -import {html} from '../../polymer/lib/utils/html-tag.js'; +import {html} from '../../polymer/polymer_bundled.min.js'; const template = html` <dom-module id="paper-material-styles"> <template> diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/shadow.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/shadow.js index 1e7eb9445eb..36f66c543ed 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/shadow.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/shadow.js @@ -9,9 +9,9 @@ part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {html} from '../polymer/polymer_bundled.min.js'; const template = html` <custom-style> <style is="custom-style"> diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/typography.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/typography.js index ec805f0bf60..ed930d05cf9 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/typography.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-styles/typography.js @@ -17,10 +17,10 @@ line heights and weights for CJK typesetting. See the notes in the Material Design typography section. */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; import '../font-roboto/roboto.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {html} from '../polymer/polymer_bundled.min.js'; const template = html`<custom-style> <style is="custom-style"> html { diff --git a/chromium/third_party/polymer/v3_0/components-chromium/paper-tooltip/paper-tooltip.js b/chromium/third_party/polymer/v3_0/components-chromium/paper-tooltip/paper-tooltip.js index 1599a284498..853eee19902 100644 --- a/chromium/third_party/polymer/v3_0/components-chromium/paper-tooltip/paper-tooltip.js +++ b/chromium/third_party/polymer/v3_0/components-chromium/paper-tooltip/paper-tooltip.js @@ -8,11 +8,11 @@ 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 */ -import '../polymer/polymer-legacy.js'; +import '../polymer/polymer_bundled.min.js'; -import {Polymer} from '../polymer/lib/legacy/polymer-fn.js'; -import {dom} from '../polymer/lib/legacy/polymer.dom.js'; -import {html} from '../polymer/lib/utils/html-tag.js'; +import {Polymer} from '../polymer/polymer_bundled.min.js'; +import {dom} from '../polymer/polymer_bundled.min.js'; +import {html} from '../polymer/polymer_bundled.min.js'; /** Material design: @@ -60,9 +60,6 @@ Polymer({ position: absolute; outline: none; z-index: 1002; - -moz-user-select: none; - -ms-user-select: none; - -webkit-user-select: none; user-select: none; cursor: default; } diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/closure-types.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/closure-types.js deleted file mode 100644 index 86ddb0889a9..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/closure-types.js +++ /dev/null @@ -1,1588 +0,0 @@ -/** - * @fileoverview Generated typings for Polymer mixins - * @externs - * @suppress {checkPrototypalTypes} - * - * @license - * Copyright (c) 2017 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 - */ -/* eslint-disable */ -/** -* @interface -*/ -function Polymer_PropertiesChanged(){} -/** @type {undefined} */ -Polymer_PropertiesChanged.prototype.__dataEnabled; - -/** -* @override -* @param {string} property Name of the property -* @param {boolean=} readOnly When true, no setter is created; the - protected `_setProperty` function must be used to set the property -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._createPropertyAccessor = function(property, readOnly){}; -/** -* @override -* @param {string} property Name of the property -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._addPropertyToAttributeMap = function(property){}; -/** -* @override -* @param {string} property Name of the property -* @param {boolean=} readOnly When true, no setter is created -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._definePropertyAccessor = function(property, readOnly){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertiesChanged.prototype.ready = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._initializeProperties = function(){}; -/** -* @override -* @param {Object} props Bag of property values that were overwritten - when creating property accessors. -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._initializeInstanceProperties = function(props){}; -/** -* @override -* @param {string} property Name of the property -* @param {*} value Value to set -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._setProperty = function(property, value){}; -/** -* @override -* @param {string} property Name of property -* @return {*} -*/ -Polymer_PropertiesChanged.prototype._getProperty = function(property){}; -/** -* @override -* @param {string} property Name of the property -* @param {*} value Value to set -* @param {boolean=} ext Not used here; affordance for closure -* @return {boolean} -*/ -Polymer_PropertiesChanged.prototype._setPendingProperty = function(property, value, ext){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._invalidateProperties = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._enableProperties = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._flushProperties = function(){}; -/** -* @override -* @param {!Object} currentProps Bag of all current accessor values -* @param {?Object} changedProps Bag of properties changed since the last - call to `_propertiesChanged` -* @param {?Object} oldProps Bag of previous values for each property - in `changedProps` -* @return {boolean} -*/ -Polymer_PropertiesChanged.prototype._shouldPropertiesChange = function(currentProps, changedProps, oldProps){}; -/** -* @override -* @param {!Object} currentProps Bag of all current accessor values -* @param {?Object} changedProps Bag of properties changed since the last - call to `_propertiesChanged` -* @param {?Object} oldProps Bag of previous values for each property - in `changedProps` -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._propertiesChanged = function(currentProps, changedProps, oldProps){}; -/** -* @override -* @param {string} property Property name -* @param {*} value New property value -* @param {*} old Previous property value -* @return {boolean} -*/ -Polymer_PropertiesChanged.prototype._shouldPropertyChange = function(property, value, old){}; -/** -* @override -* @param {string} name Name of attribute that changed -* @param {?string} old Old attribute value -* @param {?string} value New attribute value -* @param {?string=} namespace Attribute namespace. -* @return {void} -*/ -Polymer_PropertiesChanged.prototype.attributeChangedCallback = function(name, old, value, namespace){}; -/** -* @override -* @param {string} attribute Name of attribute to deserialize. -* @param {?string} value of the attribute. -* @param {*=} type type to deserialize to, defaults to the value -returned from `typeForProperty` -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._attributeToProperty = function(attribute, value, type){}; -/** -* @override -* @param {string} property Property name to reflect. -* @param {string=} attribute Attribute name to reflect to. -* @param {*=} value Property value to refect. -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._propertyToAttribute = function(property, attribute, value){}; -/** -* @override -* @param {Element} node Element to set attribute to. -* @param {*} value Value to serialize. -* @param {string} attribute Attribute name to serialize to. -* @return {void} -*/ -Polymer_PropertiesChanged.prototype._valueToNodeAttribute = function(node, value, attribute){}; -/** -* @override -* @param {*} value Property value to serialize. -* @return {(string | undefined)} -*/ -Polymer_PropertiesChanged.prototype._serializeValue = function(value){}; -/** -* @override -* @param {?string} value Value to deserialize. -* @param {*=} type Type to deserialize the string to. -* @return {*} -*/ -Polymer_PropertiesChanged.prototype._deserializeValue = function(value, type){}; -/** -* @param {!Object} props Object whose keys are names of accessors. -* @return {void} -*/ -Polymer_PropertiesChanged.createProperties = function(props){}; -/** -* @param {string} property Property to convert -* @return {string} -*/ -Polymer_PropertiesChanged.attributeNameForProperty = function(property){}; -/** -* @param {string} name Name of property -* @return {void} -*/ -Polymer_PropertiesChanged.typeForProperty = function(name){}; -/** -* @interface -* @extends {Polymer_PropertiesChanged} -*/ -function Polymer_PropertyAccessors(){} -/** -* @override -* @param {string} property Name of the property -* @param {boolean=} readOnly When true, no setter is created - -When calling on a prototype, any overwritten values are saved in -`__dataProto`, and it is up to the subclasser to decide how/when -to set those properties back into the accessor. When calling on an -instance, the overwritten value is set via `_setPendingProperty`, -and the user should call `_invalidateProperties` or `_flushProperties` -for the values to take effect. -* @return {void} -*/ -Polymer_PropertyAccessors.prototype._definePropertyAccessor = function(property, readOnly){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertyAccessors.prototype._initializeProperties = function(){}; -/** -* @override -* @param {*} value Property value to serialize. -* @return {(string | undefined)} -*/ -Polymer_PropertyAccessors.prototype._serializeValue = function(value){}; -/** -* @override -* @param {?string} value Attribute value to deserialize. -* @param {*=} type Type to deserialize the string to. -* @return {*} -*/ -Polymer_PropertyAccessors.prototype._deserializeValue = function(value, type){}; -/** -* @override -* @param {Object} props Bag of property values that were overwritten - when creating property accessors. -* @return {void} -*/ -Polymer_PropertyAccessors.prototype._initializeProtoProperties = function(props){}; -/** -* @override -* @param {string} attribute Name of attribute to ensure is set. -* @param {string} value of the attribute. -* @return {void} -*/ -Polymer_PropertyAccessors.prototype._ensureAttribute = function(attribute, value){}; -/** -* @override -* @param {string} property Property name -* @return {boolean} -*/ -Polymer_PropertyAccessors.prototype._hasAccessor = function(property){}; -/** -* @override -* @param {string} prop Property name -* @return {boolean} -*/ -Polymer_PropertyAccessors.prototype._isPropertyPending = function(prop){}; -/** -* @param {string} property Property to convert -* @return {string} -*/ -Polymer_PropertyAccessors.attributeNameForProperty = function(property){}; -/** -* @return {void} -*/ -Polymer_PropertyAccessors.createPropertiesForAttributes = function(){}; -/** -* @interface -*/ -function Polymer_TemplateStamp(){} -/** -* @override -* @param {!HTMLTemplateElement} template Template to stamp -* @return {!StampedTemplate} -*/ -Polymer_TemplateStamp.prototype._stampTemplate = function(template){}; -/** -* @override -* @param {!EventTarget} node Node to add listener on -* @param {string} eventName Name of event -* @param {string} methodName Name of method -* @param {*=} context Context the method will be called on (defaults - to `node`) -* @return {Function} -*/ -Polymer_TemplateStamp.prototype._addMethodEventListenerToNode = function(node, eventName, methodName, context){}; -/** -* @override -* @param {!EventTarget} node Node to add event listener to -* @param {string} eventName Name of event -* @param {function (!Event): void} handler Listener function to add -* @return {void} -*/ -Polymer_TemplateStamp.prototype._addEventListenerToNode = function(node, eventName, handler){}; -/** -* @override -* @param {!EventTarget} node Node to remove event listener from -* @param {string} eventName Name of event -* @param {function (!Event): void} handler Listener function to remove -* @return {void} -*/ -Polymer_TemplateStamp.prototype._removeEventListenerFromNode = function(node, eventName, handler){}; -/** -* @param {!HTMLTemplateElement} template Template to parse -* @param {TemplateInfo=} outerTemplateInfo Template metadata from the outer - template, for parsing nested templates -* @return {!TemplateInfo} -*/ -Polymer_TemplateStamp._parseTemplate = function(template, outerTemplateInfo){}; -/** -* @param {*} template -* @param {*} templateInfo -* @param {*} nodeInfo -*/ -Polymer_TemplateStamp._parseTemplateContent = function(template, templateInfo, nodeInfo){}; -/** -* @param {Node} node Node to parse -* @param {!TemplateInfo} templateInfo Template metadata for current template -* @param {!NodeInfo} nodeInfo Node metadata for current template. -* @return {boolean} -*/ -Polymer_TemplateStamp._parseTemplateNode = function(node, templateInfo, nodeInfo){}; -/** -* @param {Node} root Root node whose `childNodes` will be parsed -* @param {!TemplateInfo} templateInfo Template metadata for current template -* @param {!NodeInfo} nodeInfo Node metadata for current template. -* @return {void} -*/ -Polymer_TemplateStamp._parseTemplateChildNodes = function(root, templateInfo, nodeInfo){}; -/** -* @param {HTMLTemplateElement} node Node to parse (a <template>) -* @param {TemplateInfo} outerTemplateInfo Template metadata for current template - that includes the template `node` -* @param {!NodeInfo} nodeInfo Node metadata for current template. -* @return {boolean} -*/ -Polymer_TemplateStamp._parseTemplateNestedTemplate = function(node, outerTemplateInfo, nodeInfo){}; -/** -* @param {Element} node Node to parse -* @param {TemplateInfo} templateInfo Template metadata for current template -* @param {NodeInfo} nodeInfo Node metadata for current template. -* @return {boolean} -*/ -Polymer_TemplateStamp._parseTemplateNodeAttributes = function(node, templateInfo, nodeInfo){}; -/** -* @param {Element} node Node to parse -* @param {!TemplateInfo} templateInfo Template metadata for current template -* @param {!NodeInfo} nodeInfo Node metadata for current template. -* @param {string} name Attribute name -* @param {string} value Attribute value -* @return {boolean} -*/ -Polymer_TemplateStamp._parseTemplateNodeAttribute = function(node, templateInfo, nodeInfo, name, value){}; -/** -* @param {HTMLTemplateElement} template Template to retrieve `content` for -* @return {DocumentFragment} -*/ -Polymer_TemplateStamp._contentForTemplate = function(template){}; -/** -* @interface -* @extends {Polymer_TemplateStamp} -* @extends {Polymer_PropertyAccessors} -*/ -function Polymer_PropertyEffects(){} -/** @type {boolean} */ -Polymer_PropertyEffects.prototype.__dataClientsReady; - -/** @type {Array} */ -Polymer_PropertyEffects.prototype.__dataPendingClients; - -/** @type {Object} */ -Polymer_PropertyEffects.prototype.__dataToNotify; - -/** @type {Object} */ -Polymer_PropertyEffects.prototype.__dataLinkedPaths; - -/** @type {boolean} */ -Polymer_PropertyEffects.prototype.__dataHasPaths; - -/** @type {Object} */ -Polymer_PropertyEffects.prototype.__dataCompoundStorage; - -/** @type {Polymer_PropertyEffects} */ -Polymer_PropertyEffects.prototype.__dataHost; - -/** @type {!Object} */ -Polymer_PropertyEffects.prototype.__dataTemp; - -/** @type {boolean} */ -Polymer_PropertyEffects.prototype.__dataClientsInitialized; - -/** @type {!Object} */ -Polymer_PropertyEffects.prototype.__data; - -/** @type {(!Object | null)} */ -Polymer_PropertyEffects.prototype.__dataPending; - -/** @type {!Object} */ -Polymer_PropertyEffects.prototype.__dataOld; - -/** @type {Object} */ -Polymer_PropertyEffects.prototype.__computeEffects; - -/** @type {Object} */ -Polymer_PropertyEffects.prototype.__reflectEffects; - -/** @type {Object} */ -Polymer_PropertyEffects.prototype.__notifyEffects; - -/** @type {Object} */ -Polymer_PropertyEffects.prototype.__propagateEffects; - -/** @type {Object} */ -Polymer_PropertyEffects.prototype.__observeEffects; - -/** @type {Object} */ -Polymer_PropertyEffects.prototype.__readOnly; - -/** @type {!TemplateInfo} */ -Polymer_PropertyEffects.prototype.__templateInfo; - -/** @type {undefined} */ -Polymer_PropertyEffects.prototype.PROPERTY_EFFECT_TYPES; - -/** -* @override -* @param {!HTMLTemplateElement} template Template to stamp -* @return {!StampedTemplate} -*/ -Polymer_PropertyEffects.prototype._stampTemplate = function(template){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertyEffects.prototype.ready = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertyEffects.prototype._initializeProperties = function(){}; -/** -* @override -* @param {Object} props Properties to initialize on the instance -* @return {void} -*/ -Polymer_PropertyEffects.prototype._initializeInstanceProperties = function(props){}; -/** -* @override -* @param {string} property Name of the property -* @param {*} value Value to set -* @return {void} -*/ -Polymer_PropertyEffects.prototype._setProperty = function(property, value){}; -/** -* @override -* @param {string} property Name of the property -* @param {*} value Value to set -* @param {boolean=} shouldNotify True if property should fire notification - event (applies only for `notify: true` properties) -* @return {boolean} -*/ -Polymer_PropertyEffects.prototype._setPendingProperty = function(property, value, shouldNotify){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertyEffects.prototype._invalidateProperties = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertyEffects.prototype._flushProperties = function(){}; -/** -* @override -* @param {!Object} currentProps Bag of all current accessor values -* @param {?Object} changedProps Bag of properties changed since the last - call to `_propertiesChanged` -* @param {?Object} oldProps Bag of previous values for each property - in `changedProps` -* @return {void} -*/ -Polymer_PropertyEffects.prototype._propertiesChanged = function(currentProps, changedProps, oldProps){}; -/** -* @override -* @param {Object} props Properties to initialize on the prototype -* @return {void} -*/ -Polymer_PropertyEffects.prototype._initializeProtoProperties = function(props){}; -/** -* @override -* @param {string} property Property that should trigger the effect -* @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES -* @param {Object=} effect Effect metadata object -* @return {void} -*/ -Polymer_PropertyEffects.prototype._addPropertyEffect = function(property, type, effect){}; -/** -* @override -* @param {string} property Property the effect was associated with -* @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES -* @param {Object=} effect Effect metadata object to remove -* @return {void} -*/ -Polymer_PropertyEffects.prototype._removePropertyEffect = function(property, type, effect){}; -/** -* @override -* @param {string} property Property name -* @param {string=} type Effect type, from this.PROPERTY_EFFECT_TYPES -* @return {boolean} -*/ -Polymer_PropertyEffects.prototype._hasPropertyEffect = function(property, type){}; -/** -* @override -* @param {string} property Property name -* @return {boolean} -*/ -Polymer_PropertyEffects.prototype._hasReadOnlyEffect = function(property){}; -/** -* @override -* @param {string} property Property name -* @return {boolean} -*/ -Polymer_PropertyEffects.prototype._hasNotifyEffect = function(property){}; -/** -* @override -* @param {string} property Property name -* @return {boolean} -*/ -Polymer_PropertyEffects.prototype._hasReflectEffect = function(property){}; -/** -* @override -* @param {string} property Property name -* @return {boolean} -*/ -Polymer_PropertyEffects.prototype._hasComputedEffect = function(property){}; -/** -* @override -* @param {(string | !Array.<(number | string)>)} path Path to set -* @param {*} value Value to set -* @param {boolean=} shouldNotify Set to true if this change should - cause a property notification event dispatch -* @param {boolean=} isPathNotification If the path being set is a path - notification of an already changed value, as opposed to a request - to set and notify the change. In the latter `false` case, a dirty - check is performed and then the value is set to the path before - enqueuing the pending property change. -* @return {boolean} -*/ -Polymer_PropertyEffects.prototype._setPendingPropertyOrPath = function(path, value, shouldNotify, isPathNotification){}; -/** -* @override -* @param {!Node} node The node to set a property on -* @param {string} prop The property to set -* @param {*} value The value to set -* @return {void} -*/ -Polymer_PropertyEffects.prototype._setUnmanagedPropertyToNode = function(node, prop, value){}; -/** -* @override -* @param {Object} client PropertyEffects client to enqueue -* @return {void} -*/ -Polymer_PropertyEffects.prototype._enqueueClient = function(client){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertyEffects.prototype._flushClients = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertyEffects.prototype._readyClients = function(){}; -/** -* @override -* @param {Object} props Bag of one or more key-value pairs whose key is - a property and value is the new value to set for that property. -* @param {boolean=} setReadOnly When true, any private values set in - `props` will be set. By default, `setProperties` will not set - `readOnly: true` root properties. -* @return {void} -*/ -Polymer_PropertyEffects.prototype.setProperties = function(props, setReadOnly){}; -/** -* @override -* @param {Object} changedProps Bag of changed properties -* @param {Object} oldProps Bag of previous values for changed properties -* @param {boolean} hasPaths True with `props` contains one or more paths -* @return {void} -*/ -Polymer_PropertyEffects.prototype._propagatePropertyChanges = function(changedProps, oldProps, hasPaths){}; -/** -* @override -* @param {(string | !Array.<(string | number)>)} to Target path to link. -* @param {(string | !Array.<(string | number)>)} from Source path to link. -* @return {void} -*/ -Polymer_PropertyEffects.prototype.linkPaths = function(to, from){}; -/** -* @override -* @param {(string | !Array.<(string | number)>)} path Target path to unlink. -* @return {void} -*/ -Polymer_PropertyEffects.prototype.unlinkPaths = function(path){}; -/** -* @override -* @param {string} path Path that should be notified. -* @param {Array} splices Array of splice records indicating ordered - changes that occurred to the array. Each record should have the - following fields: - * index: index at which the change occurred - * removed: array of items that were removed from this index - * addedCount: number of new items added at this index - * object: a reference to the array in question - * type: the string literal 'splice' - - Note that splice records _must_ be normalized such that they are - reported in index order (raw results from `Object.observe` are not - ordered and must be normalized/merged before notifying). -* @return {void} -*/ -Polymer_PropertyEffects.prototype.notifySplices = function(path, splices){}; -/** -* @override -* @param {(string | !Array.<(string | number)>)} path Path to the value - to read. The path may be specified as a string (e.g. `foo.bar.baz`) - or an array of path parts (e.g. `['foo.bar', 'baz']`). Note that - bracketed expressions are not supported; string-based path parts - *must* be separated by dots. Note that when dereferencing array - indices, the index may be used as a dotted part directly - (e.g. `users.12.name` or `['users', 12, 'name']`). -* @param {Object=} root Root object from which the path is evaluated. -* @return {*} -*/ -Polymer_PropertyEffects.prototype.get = function(path, root){}; -/** -* @override -* @param {(string | !Array.<(string | number)>)} path Path to the value - to write. The path may be specified as a string (e.g. `'foo.bar.baz'`) - or an array of path parts (e.g. `['foo.bar', 'baz']`). Note that - bracketed expressions are not supported; string-based path parts - *must* be separated by dots. Note that when dereferencing array - indices, the index may be used as a dotted part directly - (e.g. `'users.12.name'` or `['users', 12, 'name']`). -* @param {*} value Value to set at the specified path. -* @param {Object=} root Root object from which the path is evaluated. - When specified, no notification will occur. -* @return {void} -*/ -Polymer_PropertyEffects.prototype.set = function(path, value, root){}; -/** -* @override -* @param {(string | !Array.<(string | number)>)} path Path to array. -* @param {...*} items Items to push onto array -* @return {number} -*/ -Polymer_PropertyEffects.prototype.push = function(path, items){}; -/** -* @override -* @param {(string | !Array.<(string | number)>)} path Path to array. -* @return {*} -*/ -Polymer_PropertyEffects.prototype.pop = function(path){}; -/** -* @override -* @param {(string | !Array.<(string | number)>)} path Path to array. -* @param {number} start Index from which to start removing/inserting. -* @param {number=} deleteCount Number of items to remove. -* @param {...*} items Items to insert into array. -* @return {Array} -*/ -Polymer_PropertyEffects.prototype.splice = function(path, start, deleteCount, items){}; -/** -* @override -* @param {(string | !Array.<(string | number)>)} path Path to array. -* @return {*} -*/ -Polymer_PropertyEffects.prototype.shift = function(path){}; -/** -* @override -* @param {(string | !Array.<(string | number)>)} path Path to array. -* @param {...*} items Items to insert info array -* @return {number} -*/ -Polymer_PropertyEffects.prototype.unshift = function(path, items){}; -/** -* @override -* @param {string} path Path that should be notified. -* @param {*=} value Value at the path (optional). -* @return {void} -*/ -Polymer_PropertyEffects.prototype.notifyPath = function(path, value){}; -/** -* @override -* @param {string} property Property name -* @param {boolean=} protectedSetter Creates a custom protected setter - when `true`. -* @return {void} -*/ -Polymer_PropertyEffects.prototype._createReadOnlyProperty = function(property, protectedSetter){}; -/** -* @override -* @param {string} property Property name -* @param {(string | function (*, *))} method Function or name of observer method - to call -* @param {boolean=} dynamicFn Whether the method name should be included as - a dependency to the effect. -* @return {void} -*/ -Polymer_PropertyEffects.prototype._createPropertyObserver = function(property, method, dynamicFn){}; -/** -* @override -* @param {string} expression Method expression -* @param {(boolean | Object)=} dynamicFn Boolean or object map indicating - whether method names should be included as a dependency to the effect. -* @return {void} -*/ -Polymer_PropertyEffects.prototype._createMethodObserver = function(expression, dynamicFn){}; -/** -* @override -* @param {string} property Property name -* @return {void} -*/ -Polymer_PropertyEffects.prototype._createNotifyingProperty = function(property){}; -/** -* @override -* @param {string} property Property name -* @return {void} -*/ -Polymer_PropertyEffects.prototype._createReflectedProperty = function(property){}; -/** -* @override -* @param {string} property Name of computed property to set -* @param {string} expression Method expression -* @param {(boolean | Object)=} dynamicFn Boolean or object map indicating - whether method names should be included as a dependency to the effect. -* @return {void} -*/ -Polymer_PropertyEffects.prototype._createComputedProperty = function(property, expression, dynamicFn){}; -/** -* @override -* @param {!HTMLTemplateElement} template Template containing binding - bindings -* @param {boolean=} instanceBinding When false (default), performs - "prototypical" binding of the template and overwrites any previously - bound template for the class. When true (as passed from - `_stampTemplate`), the template info is instanced and linked into - the list of bound templates. -* @return {!TemplateInfo} -*/ -Polymer_PropertyEffects.prototype._bindTemplate = function(template, instanceBinding){}; -/** -* @override -* @param {!StampedTemplate} dom DocumentFragment previously returned - from `_stampTemplate` associated with the nodes to be removed -* @return {void} -*/ -Polymer_PropertyEffects.prototype._removeBoundDom = function(dom){}; -/** -* @param {Node} node Node to parse -* @param {TemplateInfo} templateInfo Template metadata for current template -* @param {NodeInfo} nodeInfo Node metadata for current template node -* @return {boolean} -*/ -Polymer_PropertyEffects._parseTemplateNode = function(node, templateInfo, nodeInfo){}; -/** -* @param {Node} node Node to parse -* @param {TemplateInfo} templateInfo Template metadata for current template -* @param {NodeInfo} nodeInfo Node metadata for current template node -* @return {boolean} -*/ -Polymer_PropertyEffects._parseTemplateNestedTemplate = function(node, templateInfo, nodeInfo){}; -/** -* @param {Element} node Node to parse -* @param {TemplateInfo} templateInfo Template metadata for current template -* @param {NodeInfo} nodeInfo Node metadata for current template node -* @param {string} name Attribute name -* @param {string} value Attribute value -* @return {boolean} -*/ -Polymer_PropertyEffects._parseTemplateNodeAttribute = function(node, templateInfo, nodeInfo, name, value){}; -/** -* @param {string} property Property that should trigger the effect -* @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES -* @param {Object=} effect Effect metadata object -* @return {void} -*/ -Polymer_PropertyEffects.addPropertyEffect = function(property, type, effect){}; -/** -* @param {string} property Property name -* @param {(string | function (*, *))} method Function or name of observer method to call -* @param {boolean=} dynamicFn Whether the method name should be included as - a dependency to the effect. -* @return {void} -*/ -Polymer_PropertyEffects.createPropertyObserver = function(property, method, dynamicFn){}; -/** -* @param {string} expression Method expression -* @param {(boolean | Object)=} dynamicFn Boolean or object map indicating -* @return {void} -*/ -Polymer_PropertyEffects.createMethodObserver = function(expression, dynamicFn){}; -/** -* @param {string} property Property name -* @return {void} -*/ -Polymer_PropertyEffects.createNotifyingProperty = function(property){}; -/** -* @param {string} property Property name -* @param {boolean=} protectedSetter Creates a custom protected setter - when `true`. -* @return {void} -*/ -Polymer_PropertyEffects.createReadOnlyProperty = function(property, protectedSetter){}; -/** -* @param {string} property Property name -* @return {void} -*/ -Polymer_PropertyEffects.createReflectedProperty = function(property){}; -/** -* @param {string} property Name of computed property to set -* @param {string} expression Method expression -* @param {(boolean | Object)=} dynamicFn Boolean or object map indicating whether - method names should be included as a dependency to the effect. -* @return {void} -*/ -Polymer_PropertyEffects.createComputedProperty = function(property, expression, dynamicFn){}; -/** -* @param {!HTMLTemplateElement} template Template containing binding - bindings -* @return {!TemplateInfo} -*/ -Polymer_PropertyEffects.bindTemplate = function(template){}; -/** -* @param {Object} templateInfo Template metadata to add effect to -* @param {string} prop Property that should trigger the effect -* @param {Object=} effect Effect metadata object -* @return {void} -*/ -Polymer_PropertyEffects._addTemplatePropertyEffect = function(templateInfo, prop, effect){}; -/** -* @param {string} text Text to parse from attribute or textContent -* @param {Object} templateInfo Current template metadata -* @return {Array.<!BindingPart>} -*/ -Polymer_PropertyEffects._parseBindings = function(text, templateInfo){}; -/** -* @param {!Polymer_PropertyEffects} inst Element that should be used as - scope for binding dependencies -* @param {BindingPart} part Binding part metadata -* @param {string} path Property/path that triggered this effect -* @param {Object} props Bag of current property changes -* @param {Object} oldProps Bag of previous values for changed properties -* @param {boolean} hasPaths True with `props` contains one or more paths -* @return {*} -*/ -Polymer_PropertyEffects._evaluateBinding = function(inst, part, path, props, oldProps, hasPaths){}; -/** -* @interface -* @extends {Polymer_PropertiesChanged} -*/ -function Polymer_PropertiesMixin(){} -/** -* @override -* @return {void} -*/ -Polymer_PropertiesMixin.prototype._initializeProperties = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertiesMixin.prototype.connectedCallback = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_PropertiesMixin.prototype.disconnectedCallback = function(){}; -/** -* @param {string} name Name of property -* @return {*} -*/ -Polymer_PropertiesMixin.typeForProperty = function(name){}; -/** -* @return {void} -*/ -Polymer_PropertiesMixin.finalize = function(){}; -/** -* @return {void} -*/ -Polymer_PropertiesMixin._finalizeClass = function(){}; -/** -* @interface -* @extends {Polymer_PropertyEffects} -* @extends {Polymer_PropertiesMixin} -*/ -function Polymer_ElementMixin(){} -/** @type {HTMLTemplateElement} */ -Polymer_ElementMixin.prototype._template; - -/** @type {string} */ -Polymer_ElementMixin.prototype._importPath; - -/** @type {string} */ -Polymer_ElementMixin.prototype.rootPath; - -/** @type {string} */ -Polymer_ElementMixin.prototype.importPath; - -/** @type {(StampedTemplate | HTMLElement | ShadowRoot)} */ -Polymer_ElementMixin.prototype.root; - -/** @type {!Object.<string, !Element>} */ -Polymer_ElementMixin.prototype.$; - -/** -* @override -* @return {void} -*/ -Polymer_ElementMixin.prototype.ready = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_ElementMixin.prototype._initializeProperties = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_ElementMixin.prototype._readyClients = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_ElementMixin.prototype.connectedCallback = function(){}; -/** -* @override -* @param {StampedTemplate} dom to attach to the element. -* @return {ShadowRoot} -*/ -Polymer_ElementMixin.prototype._attachDom = function(dom){}; -/** -* @override -* @param {Object=} properties Bag of custom property key/values to - apply to this element. -* @return {void} -*/ -Polymer_ElementMixin.prototype.updateStyles = function(properties){}; -/** -* @override -* @param {string} url URL to resolve. -* @param {string=} base Optional base URL to resolve against, defaults -to the element's `importPath` -* @return {string} -*/ -Polymer_ElementMixin.prototype.resolveUrl = function(url, base){}; -/** -* @param {!HTMLTemplateElement} template Template -* @param {!TemplateInfo} templateInfo Template metadata for current template -* @param {!NodeInfo} nodeInfo Node metadata for current template. -* @return {boolean} -*/ -Polymer_ElementMixin._parseTemplateContent = function(template, templateInfo, nodeInfo){}; -/** -* @param {!Object} props . -* @return {void} -*/ -Polymer_ElementMixin.createProperties = function(props){}; -/** -* @param {Object} templateInfo Template metadata to add effect to -* @param {string} prop Property that should trigger the effect -* @param {Object=} effect Effect metadata object -* @return {void} -*/ -Polymer_ElementMixin._addTemplatePropertyEffect = function(templateInfo, prop, effect){}; -/** -* @return {void} -*/ -Polymer_ElementMixin._finalizeClass = function(){}; -/** -* @return {void} -*/ -Polymer_ElementMixin._prepareTemplate = function(){}; -/** -* @param {Object} observers Array of observer descriptors for - this class -* @param {Object} dynamicFns Object containing keys for any properties - that are functions and should trigger the effect when the function - reference is changed -* @return {void} -*/ -Polymer_ElementMixin.createObservers = function(observers, dynamicFns){}; -/** -* @param {string} cssText Text containing styling to process -* @param {string} baseURI Base URI to rebase CSS paths against -* @return {string} -*/ -Polymer_ElementMixin._processStyleText = function(cssText, baseURI){}; -/** -* @param {string} is Tag name (or type extension name) for this element -* @return {void} -*/ -Polymer_ElementMixin._finalizeTemplate = function(is){}; -/** -* @interface -*/ -function Polymer_GestureEventListeners(){} -/** -* @override -* @param {!EventTarget} node Node to add event listener to -* @param {string} eventName Name of event -* @param {function (!Event): void} handler Listener function to add -* @return {void} -*/ -Polymer_GestureEventListeners.prototype._addEventListenerToNode = function(node, eventName, handler){}; -/** -* @override -* @param {!EventTarget} node Node to remove event listener from -* @param {string} eventName Name of event -* @param {function (!Event): void} handler Listener function to remove -* @return {void} -*/ -Polymer_GestureEventListeners.prototype._removeEventListenerFromNode = function(node, eventName, handler){}; -/** -* @interface -* @extends {Polymer_PropertyAccessors} -*/ -function Polymer_DirMixin(){} -/** @type {boolean} */ -Polymer_DirMixin.prototype.__autoDirOptOut; - -/** -* @override -* @return {void} -*/ -Polymer_DirMixin.prototype.ready = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_DirMixin.prototype.connectedCallback = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_DirMixin.prototype.disconnectedCallback = function(){}; -/** -* @param {string} cssText . -* @param {string} baseURI . -* @return {string} -*/ -Polymer_DirMixin._processStyleText = function(cssText, baseURI){}; -/** -* @param {string} text CSS text to replace DIR -* @return {string} -*/ -Polymer_DirMixin._replaceDirInCssText = function(text){}; -/** -* @interface -* @extends {Polymer_ElementMixin} -* @extends {Polymer_GestureEventListeners} -*/ -function Polymer_LegacyElementMixin(){} -/** @type {boolean} */ -Polymer_LegacyElementMixin.prototype.isAttached; - -/** @type {?WeakMap.<!Element, !Object.<string, !Function>>} */ -Polymer_LegacyElementMixin.prototype.__boundListeners; - -/** @type {?Object.<string, ?Function>} */ -Polymer_LegacyElementMixin.prototype._debouncers; - -/** @type {undefined} */ -Polymer_LegacyElementMixin.prototype.domHost; - -/** @type {string} */ -Polymer_LegacyElementMixin.prototype.is; - -/** -* @override -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.ready = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype._initializeProperties = function(){}; -/** -* @override -* @param {string} name Name of attribute. -* @param {?string} old Old value of attribute. -* @param {?string} value Current value of attribute. -* @param {?string} namespace Attribute namespace. -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.attributeChangedCallback = function(name, old, value, namespace){}; -/** -* @override -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.connectedCallback = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.disconnectedCallback = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.created = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.attached = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.detached = function(){}; -/** -* @override -* @param {string} name Name of attribute. -* @param {?string} old Old value of attribute. -* @param {?string} value Current value of attribute. -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.attributeChanged = function(name, old, value){}; -/** -* @override -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype._registered = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype._ensureAttributes = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype._applyListeners = function(){}; -/** -* @override -* @param {*} value Value to deserialize -* @return {(string | undefined)} -*/ -Polymer_LegacyElementMixin.prototype.serialize = function(value){}; -/** -* @override -* @param {string} value String to deserialize -* @param {*} type Type to deserialize the string to -* @return {*} -*/ -Polymer_LegacyElementMixin.prototype.deserialize = function(value, type){}; -/** -* @override -* @param {string} property Property name to reflect. -* @param {string=} attribute Attribute name to reflect. -* @param {*=} value Property value to reflect. -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.reflectPropertyToAttribute = function(property, attribute, value){}; -/** -* @override -* @param {*} value Value to serialize. -* @param {string} attribute Attribute name to serialize to. -* @param {Element} node Element to set attribute to. -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.serializeValueToAttribute = function(value, attribute, node){}; -/** -* @override -* @param {Object} prototype Target object to copy properties to. -* @param {Object} api Source object to copy properties from. -* @return {Object} -*/ -Polymer_LegacyElementMixin.prototype.extend = function(prototype, api){}; -/** -* @override -* @param {!Object} target Target object to copy properties to. -* @param {!Object} source Source object to copy properties from. -* @return {!Object} -*/ -Polymer_LegacyElementMixin.prototype.mixin = function(target, source){}; -/** -* @override -* @param {Object} object The object on which to set the prototype. -* @param {Object} prototype The prototype that will be set on the given -`object`. -* @return {Object} -*/ -Polymer_LegacyElementMixin.prototype.chainObject = function(object, prototype){}; -/** -* @override -* @param {HTMLTemplateElement} template HTML template element to instance. -* @return {!DocumentFragment} -*/ -Polymer_LegacyElementMixin.prototype.instanceTemplate = function(template){}; -/** -* @override -* @param {string} type Name of event type. -* @param {*=} detail Detail value containing event-specific - payload. -* @param {{bubbles: (boolean | undefined), cancelable: (boolean | undefined), composed: (boolean | undefined)}=} options Object specifying options. These may include: - `bubbles` (boolean, defaults to `true`), - `cancelable` (boolean, defaults to false), and - `node` on which to fire the event (HTMLElement, defaults to `this`). -* @return {!Event} -*/ -Polymer_LegacyElementMixin.prototype.fire = function(type, detail, options){}; -/** -* @override -* @param {?EventTarget} node Element to add event listener to. -* @param {string} eventName Name of event to listen for. -* @param {string} methodName Name of handler method on `this` to call. -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.listen = function(node, eventName, methodName){}; -/** -* @override -* @param {?EventTarget} node Element to remove event listener from. -* @param {string} eventName Name of event to stop listening to. -* @param {string} methodName Name of handler method on `this` to not call - anymore. -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.unlisten = function(node, eventName, methodName){}; -/** -* @override -* @param {string=} direction Direction to allow scrolling -Defaults to `all`. -* @param {Element=} node Element to apply scroll direction setting. -Defaults to `this`. -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.setScrollDirection = function(direction, node){}; -/** -* @override -* @param {string} slctr Selector to run on this local DOM scope -* @return {Element} -*/ -Polymer_LegacyElementMixin.prototype.$$ = function(slctr){}; -/** -* @override -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.distributeContent = function(){}; -/** -* @override -* @return {!Array.<!Node>} -*/ -Polymer_LegacyElementMixin.prototype.getEffectiveChildNodes = function(){}; -/** -* @override -* @param {string} selector Selector to run. -* @return {!Array.<!Node>} -*/ -Polymer_LegacyElementMixin.prototype.queryDistributedElements = function(selector){}; -/** -* @override -* @return {!Array.<!Node>} -*/ -Polymer_LegacyElementMixin.prototype.getEffectiveChildren = function(){}; -/** -* @override -* @return {string} -*/ -Polymer_LegacyElementMixin.prototype.getEffectiveTextContent = function(){}; -/** -* @override -* @param {string} selector Selector to run. -* @return {Node} -*/ -Polymer_LegacyElementMixin.prototype.queryEffectiveChildren = function(selector){}; -/** -* @override -* @param {string} selector Selector to run. -* @return {!Array.<!Node>} -*/ -Polymer_LegacyElementMixin.prototype.queryAllEffectiveChildren = function(selector){}; -/** -* @override -* @param {string=} slctr CSS selector to choose the desired - `<slot>`. Defaults to `content`. -* @return {!Array.<!Node>} -*/ -Polymer_LegacyElementMixin.prototype.getContentChildNodes = function(slctr){}; -/** -* @override -* @param {string=} slctr CSS selector to choose the desired - `<content>`. Defaults to `content`. -* @return {!Array.<!HTMLElement>} -*/ -Polymer_LegacyElementMixin.prototype.getContentChildren = function(slctr){}; -/** -* @override -* @param {?Node} node The element to be checked. -* @return {boolean} -*/ -Polymer_LegacyElementMixin.prototype.isLightDescendant = function(node){}; -/** -* @override -* @param {!Element} node The element to be checked. -* @return {boolean} -*/ -Polymer_LegacyElementMixin.prototype.isLocalDescendant = function(node){}; -/** -* @override -* @param {*} container Unused -* @param {*} shouldObserve Unused -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.scopeSubtree = function(container, shouldObserve){}; -/** -* @override -* @param {string} property The css property name. -* @return {string} -*/ -Polymer_LegacyElementMixin.prototype.getComputedStyleValue = function(property){}; -/** -* @override -* @param {string} jobName String to identify the debounce job. -* @param {function (): void} callback Function that is called (with `this` - context) when the wait time elapses. -* @param {number=} wait Optional wait time in milliseconds (ms) after the - last signal that must elapse before invoking `callback` -* @return {!Object} -*/ -Polymer_LegacyElementMixin.prototype.debounce = function(jobName, callback, wait){}; -/** -* @override -* @param {string} jobName The name of the debouncer started with `debounce` -* @return {boolean} -*/ -Polymer_LegacyElementMixin.prototype.isDebouncerActive = function(jobName){}; -/** -* @override -* @param {string} jobName The name of the debouncer started with `debounce` -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.flushDebouncer = function(jobName){}; -/** -* @override -* @param {string} jobName The name of the debouncer started with `debounce` -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.cancelDebouncer = function(jobName){}; -/** -* @override -* @param {!Function} callback The callback function to run, bound to - `this`. -* @param {number=} waitTime Time to wait before calling the - `callback`. If unspecified or 0, the callback will be run at microtask - timing (before paint). -* @return {number} -*/ -Polymer_LegacyElementMixin.prototype.async = function(callback, waitTime){}; -/** -* @override -* @param {number} handle Handle returned from original `async` call to - cancel. -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.cancelAsync = function(handle){}; -/** -* @override -* @param {string} tag HTML element tag to create. -* @param {Object=} props Object of properties to configure on the - instance. -* @return {!Element} -*/ -Polymer_LegacyElementMixin.prototype.create = function(tag, props){}; -/** -* @override -* @param {string} selector Selector to test. -* @param {!Element=} node Element to test the selector against. -* @return {boolean} -*/ -Polymer_LegacyElementMixin.prototype.elementMatches = function(selector, node){}; -/** -* @override -* @param {string} name HTML attribute name -* @param {boolean=} bool Boolean to force the attribute on or off. - When unspecified, the state of the attribute will be reversed. -* @return {boolean} -*/ -Polymer_LegacyElementMixin.prototype.toggleAttribute = function(name, bool){}; -/** -* @override -* @param {string} name CSS class name -* @param {boolean=} bool Boolean to force the class on or off. - When unspecified, the state of the class will be reversed. -* @param {Element=} node Node to target. Defaults to `this`. -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.toggleClass = function(name, bool, node){}; -/** -* @override -* @param {string} transformText Transform setting. -* @param {Element=} node Element to apply the transform to. -Defaults to `this` -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.transform = function(transformText, node){}; -/** -* @override -* @param {number} x X offset. -* @param {number} y Y offset. -* @param {number} z Z offset. -* @param {Element=} node Element to apply the transform to. -Defaults to `this`. -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype.translate3d = function(x, y, z, node){}; -/** -* @override -* @param {(string | !Array.<(number | string)>)} arrayOrPath Path to array from - which to remove the item - (or the array itself). -* @param {*} item Item to remove. -* @return {Array} -*/ -Polymer_LegacyElementMixin.prototype.arrayDelete = function(arrayOrPath, item){}; -/** -* @override -* @param {string} level One of 'log', 'warn', 'error' -* @param {Array} args Array of strings or objects to log -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype._logger = function(level, args){}; -/** -* @override -* @param {...*} args Array of strings or objects to log -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype._log = function(args){}; -/** -* @override -* @param {...*} args Array of strings or objects to log -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype._warn = function(args){}; -/** -* @override -* @param {...*} args Array of strings or objects to log -* @return {void} -*/ -Polymer_LegacyElementMixin.prototype._error = function(args){}; -/** -* @override -* @param {string} methodName Method name to associate with message -* @param {...*} args Array of strings or objects to log -* @return {Array} -*/ -Polymer_LegacyElementMixin.prototype._logf = function(methodName, args){}; -/** -* @interface -*/ -function Polymer_MutableData(){} -/** -* @param {string} property Property name -* @param {*} value New property value -* @param {*} old Previous property value -* @return {boolean} -*/ -Polymer_MutableData.prototype._shouldPropertyChange = function(property, value, old){}; -/** -* @interface -*/ -function Polymer_OptionalMutableData(){} -/** @type {boolean | null | undefined} */ -Polymer_OptionalMutableData.prototype.mutableData; - -/** -* @param {string} property Property name -* @param {*} value New property value -* @param {*} old Previous property value -* @return {boolean} -*/ -Polymer_OptionalMutableData.prototype._shouldPropertyChange = function(property, value, old){}; -/** -* @interface -* @extends {Polymer_ElementMixin} -*/ -function Polymer_ArraySelectorMixin(){} -/** @type {Array | null | undefined} */ -Polymer_ArraySelectorMixin.prototype.items; - -/** @type {boolean | null | undefined} */ -Polymer_ArraySelectorMixin.prototype.multi; - -/** @type {(?Object | ?Array.<!Object>)} */ -Polymer_ArraySelectorMixin.prototype.selected; - -/** @type {?Object} */ -Polymer_ArraySelectorMixin.prototype.selectedItem; - -/** @type {boolean | null | undefined} */ -Polymer_ArraySelectorMixin.prototype.toggle; - -/** -* @override -* @return {void} -*/ -Polymer_ArraySelectorMixin.prototype.clearSelection = function(){}; -/** -* @override -* @param {*} item Item from `items` array to test -* @return {boolean} -*/ -Polymer_ArraySelectorMixin.prototype.isSelected = function(item){}; -/** -* @override -* @param {number} idx Index from `items` array to test -* @return {boolean} -*/ -Polymer_ArraySelectorMixin.prototype.isIndexSelected = function(idx){}; -/** -* @override -* @param {*} item Item from `items` array to deselect -* @return {void} -*/ -Polymer_ArraySelectorMixin.prototype.deselect = function(item){}; -/** -* @override -* @param {number} idx Index from `items` array to deselect -* @return {void} -*/ -Polymer_ArraySelectorMixin.prototype.deselectIndex = function(idx){}; -/** -* @override -* @param {*} item Item from `items` array to select -* @return {void} -*/ -Polymer_ArraySelectorMixin.prototype.select = function(item){}; -/** -* @override -* @param {number} idx Index from `items` array to select -* @return {void} -*/ -Polymer_ArraySelectorMixin.prototype.selectIndex = function(idx){}; -/** -* @interface -* @extends {Polymer_PropertyEffects} -*/ -function Polymer_StrictBindingParser(){} -/** -* @param {string} text Text to parse from attribute or textContent -* @param {Object} templateInfo Current template metadata -* @return {Array.<!BindingPart>} -*/ -Polymer_StrictBindingParser._parseBindings = function(text, templateInfo){}; -/** -* @interface -* @extends {Polymer_ElementMixin} -*/ -function Polymer_DisableUpgradeMixin(){} -/** -* @override -* @return {void} -*/ -Polymer_DisableUpgradeMixin.prototype._initializeProperties = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_DisableUpgradeMixin.prototype._enableProperties = function(){}; -/** -* @override -* @param {string} name Attribute name. -* @param {?string} old The previous value for the attribute. -* @param {?string} value The new value for the attribute. -* @param {?string=} namespace The XML namespace for the attribute. -* @return {undefined} -*/ -Polymer_DisableUpgradeMixin.prototype.attributeChangedCallback = function(name, old, value, namespace){}; -/** -* @override -* @return {void} -*/ -Polymer_DisableUpgradeMixin.prototype.connectedCallback = function(){}; -/** -* @override -* @return {void} -*/ -Polymer_DisableUpgradeMixin.prototype.disconnectedCallback = function(){}; -/** -* @interface -*/ -function Polymer_LegacyDataMixin(){} -/** -* @interface -*/ -function Polymer_TemplatizeMixin(){}
\ No newline at end of file diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/polymer-dom-api-externs.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/polymer-dom-api-externs.js deleted file mode 100644 index 9b52e3394de..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/polymer-dom-api-externs.js +++ /dev/null @@ -1,179 +0,0 @@ -/** - * @externs - * @fileoverview Externs for PolymerDomApi for backwards compatibility with - * the Polymer 1 externs. - */ - -/** - * A Polymer DOM API for manipulating DOM such that local DOM and light DOM - * trees are properly maintained. - * - * This type exists only to provide compatibility between compiled hybrid - * Polymer V1 and V2 code. Polymer V2 only code should simply use the DomApi - * class type. - * - * @interface - */ -var PolymerDomApi = function() {}; - -/** - * @param {?Node} node - * @return {boolean} - */ -PolymerDomApi.prototype.deepContains = function(node) {}; - -/** @param {!Node} node */ -PolymerDomApi.prototype.appendChild = function(node) {}; - -/** - * @param {!Node} oldNode - * @param {!Node} newNode - */ -PolymerDomApi.prototype.replaceChild = function(oldNode, newNode) {}; - -/** - * @param {!Node} node - * @param {?Node} beforeNode - */ -PolymerDomApi.prototype.insertBefore = function(node, beforeNode) {}; - -/** @param {!Node} node */ -PolymerDomApi.prototype.removeChild = function(node) {}; - -/** @type {!Array<!HTMLElement>|!NodeList<!HTMLElement>} */ -PolymerDomApi.prototype.children; - -/** @type {!Array<!Node>|!NodeList<!Node>} */ -PolymerDomApi.prototype.childNodes; - -/** @type {?Node} */ -PolymerDomApi.prototype.parentNode; - -/** @type {?Node} */ -PolymerDomApi.prototype.firstChild; - -/** @type {?Node} */ -PolymerDomApi.prototype.lastChild; - -/** @type {?HTMLElement} */ -PolymerDomApi.prototype.firstElementChild; - -/** @type {?HTMLElement} */ -PolymerDomApi.prototype.lastElementChild; - -/** @type {?Node} */ -PolymerDomApi.prototype.previousSibling; - -/** @type {?Node} */ -PolymerDomApi.prototype.nextSibling; - -/** @type {?HTMLElement} */ -PolymerDomApi.prototype.previousElementSibling; - -/** @type {?HTMLElement} */ -PolymerDomApi.prototype.nextElementSibling; - -/** @type {string} */ -PolymerDomApi.prototype.textContent; - -/** @type {string} */ -PolymerDomApi.prototype.innerHTML; - -/** @type {?HTMLElement} */ -PolymerDomApi.prototype.activeElement; - -/** - * @param {string} selector - * @return {?Element} - */ -PolymerDomApi.prototype.querySelector = function(selector) {}; - -/** - * @param {string} selector - * @return {!Array<!Element>|!NodeList<!Element>} - */ -PolymerDomApi.prototype.querySelectorAll = function(selector) {}; - -/** @return {!Array<!Node>} */ -PolymerDomApi.prototype.getDistributedNodes = function() {}; - -/** @return {!Array<!Node>} */ -PolymerDomApi.prototype.getDestinationInsertionPoints = function() {}; - -/** @return {?Node} */ -PolymerDomApi.prototype.getOwnerRoot = function() {}; - -/** - * @param {string} attribute - * @param {string} value - */ -PolymerDomApi.prototype.setAttribute = function(attribute, value) {}; - -/** @param {string} attribute */ -PolymerDomApi.prototype.removeAttribute = function(attribute) {}; - -/** - * @typedef {function(!PolymerDomApi.ObserveInfo)} - */ -PolymerDomApi.ObserveCallback; - -/** - * @typedef {{ - * target: !Node, - * addedNodes: !Array<!Node>, - * removedNodes: !Array<!Node> - * }} - */ -PolymerDomApi.ObserveInfo; - -/** - * A virtual type for observer callback handles. - * - * @interface - */ -PolymerDomApi.ObserveHandle = function() {}; - -/** - * @return {void} - */ -PolymerDomApi.ObserveHandle.prototype.disconnect = function() {}; - -/** - * Notifies callers about changes to the element's effective child nodes, - * the same list as returned by `getEffectiveChildNodes`. - * - * @param {!PolymerDomApi.ObserveCallback} callback The supplied callback - * is called with an `info` argument which is an object that provides - * the `target` on which the changes occurred, a list of any nodes - * added in the `addedNodes` array, and nodes removed in the - * `removedNodes` array. - * - * @return {!PolymerDomApi.ObserveHandle} Handle which is the argument to - * `unobserveNodes`. - */ -PolymerDomApi.prototype.observeNodes = function(callback) {}; - -/** - * Stops observing changes to the element's effective child nodes. - * - * @param {!PolymerDomApi.ObserveHandle} handle The handle for the - * callback that should no longer receive notifications. This - * handle is returned from `observeNodes`. - */ -PolymerDomApi.prototype.unobserveNodes = function(handle) {}; - -/** @type {?DOMTokenList} */ -PolymerDomApi.prototype.classList; - -/** - * @param {string} selector - * @return {!Array<!HTMLElement>} - */ -PolymerDomApi.prototype.queryDistributedElements = function(selector) {}; - -/** - * Returns a list of effective child nodes for this element. - * - * @return {!Array<!HTMLElement>} - */ -PolymerDomApi.prototype.getEffectiveChildNodes = function() {}; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/polymer-externs.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/polymer-externs.js deleted file mode 100644 index 0c7b8ea4580..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/polymer-externs.js +++ /dev/null @@ -1,216 +0,0 @@ -/** - * @fileoverview Externs for Polymer Pass and external Polymer API - * @externs - * - * @license - * Copyright (c) 2017 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 - */ - -/* eslint-disable */ - -/** - * @typedef {{ - * type: !Function, - * value: (* | undefined), - * readOnly: (boolean | undefined), - * computed: (string | undefined), - * reflectToAttribute: (boolean | undefined), - * notify: (boolean | undefined), - * observer: (string | function(this:?, ?, ?) | undefined) - * }} - */ -let PolymerElementPropertiesMeta; - -/** - * @typedef {Object<string, !Function|!PolymerElementPropertiesMeta>} - */ -let PolymerElementProperties; - -/** @record */ -let PolymerInit = function() {}; -/** @type {string} */ -PolymerInit.prototype.is; -/** @type {(string | undefined)} */ -PolymerInit.prototype.extends; -/** @type {(!PolymerElementProperties | undefined)} */ -PolymerInit.prototype.properties; -/** @type {(!Array<string> | undefined)} */ -PolymerInit.prototype.observers; -/** @type {(!HTMLTemplateElement | string | undefined)} */ -PolymerInit.prototype.template; -/** @type {(!Object<string, *> | undefined)} */ -PolymerInit.prototype.hostAttributes; -/** @type {(!Object<string, string> | undefined)} */ -PolymerInit.prototype.listeners; -/** @type {(!Object| !Array<!Object> | undefined)} */ -PolymerInit.prototype.behaviors; - -/** @record */ -let PolymerElementConstructor = function () {}; -/** @type {(string | undefined)} */ -PolymerElementConstructor.is; -/** @type {(string | undefined)} */ -PolymerElementConstructor.extends; -/** @type {(!PolymerElementProperties | undefined)} */ -PolymerElementConstructor.properties; -/** @type {(!Array<string> | undefined)} */ -PolymerElementConstructor.observers; -/** @type {(!HTMLTemplateElement | string | undefined)} */ -PolymerElementConstructor.template; - -/** @interface */ -let PropertiesMixinConstructor = function () {}; -/** @type {(!PolymerElementProperties | undefined)} */ -PropertiesMixinConstructor.prototype.properties; -/** @return {void} */ -PropertiesMixinConstructor.prototype.finalize = function() {}; - -/** - * @param {!PolymerInit} init - * @return {!function(new:HTMLElement)} - */ -function Polymer(init){} - -/** - * @type {(function(*,string,string,Node):*)|undefined} - */ -Polymer.sanitizeDOMValue; - -/** - * @type {boolean} - */ -Polymer.passiveTouchGestures; - -/** - * @type {boolean} - */ -Polymer.strictTemplatePolicy; - -/** - * @type {boolean} - */ -Polymer.allowTemplateFromDomModule; - -/** - * @type {string} - */ -Polymer.rootPath; - -/** - * @param {string} string - * @param {Object} obj - * @return {string} - */ -function JSCompiler_renameProperty(string, obj) {} - -/** @record */ -function PolymerTelemetry() {} -/** @type {number} */ -PolymerTelemetry.instanceCount; -/** @type {function():void} */ -PolymerTelemetry.incrementInstanceCount; -/** @type {Array<HTMLElement>} */ -PolymerTelemetry.registrations; -/** @type {function(HTMLElement)} */ -PolymerTelemetry._regLog; -/** @type {function(HTMLElement)} */ -PolymerTelemetry.register; -/** @type {function(HTMLElement)} */ -PolymerTelemetry.dumpRegistrations; - -/** @type {PolymerTelemetry} */ -Polymer.telemetry; - -/** @type {string} */ -Polymer.version; - -/** @type {boolean} */ -Polymer.legacyOptimizations; - -/** @type {boolean} */ -Polymer.syncInitialRender; - -// nb. This is explicitly 'var', as Closure Compiler checks that this is the case. -/** - * @constructor - * @extends {HTMLElement} - * @implements {Polymer_LegacyElementMixin} - */ -var PolymerElement = function() {}; - -/** - * On create callback. - * @override - */ -PolymerElement.prototype.created = function() {}; -/** - * On ready callback. - * @override - */ -PolymerElement.prototype.ready = function() {}; -/** On before register callback. */ -PolymerElement.prototype.beforeRegister = function() {}; -/** On registered callback. */ -PolymerElement.prototype.registered = function() {}; -/** - * On attached to the DOM callback. - * @override - */ -PolymerElement.prototype.attached = function() {}; -/** - * On detached from the DOM callback. - * @override - */ -PolymerElement.prototype.detached = function() {}; - -/** - * @typedef {{ - * index: number, - * removed: !Array, - * addedCount: number, - * object: !Array, - * type: string, - * }} - */ -var PolymerSplice; -/** - * @typedef {{ - * indexSplices: ?Array<!PolymerSplice>, - * }} - */ -var PolymerSpliceChange; - -/** - * The type of the object received by an observer function when deep - * sub-property observation is enabled. See: - * https://www.polymer-project.org/2.0/docs/devguide/observers#deep-observation - * - * @typedef {{ - * path: string, - * value: (?Object|undefined), - * base: (?Object|undefined) - * }} - */ -var PolymerDeepPropertyChange; - -/** - * Event object for events dispatched by children of a dom-repeat template. - * @see https://www.polymer-project.org/2.0/docs/devguide/templates#handling-events - * @extends {Event} - * @constructor - * @template T - */ -var DomRepeatEvent = function() {}; - -/** - * @type {{ - * index: number, - * item: T - * }} - */ -DomRepeatEvent.prototype.model; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/polymer-iconset-externs.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/polymer-iconset-externs.js deleted file mode 100644 index 916fee8a7d5..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/polymer-iconset-externs.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @externs - * @fileoverview Externs for Polymer.Iconset. - */ - -/** - * The interface that iconsets should obey. Iconsets are registered by setting - * their name in the IronMeta 'iconset' db, and a value of type Polymer.Iconset. - * - * Used by iron-icon but needs to live here since iron-icon, iron-iconset, etc don't - * depend on each other at all and talk only through iron-meta. - * - * @interface - */ -Polymer.Iconset = function() {}; - -/** - * Applies an icon to the given element as a css background image. This - * method does not size the element, and it's usually necessary to set - * the element's height and width so that the background image is visible. - * - * @param {Element} element The element to which the icon is applied. - * @param {string} icon The name of the icon to apply. - * @param {string=} theme (optional) The name or index of the icon to apply. - * @param {number=} scale (optional, defaults to 1) Icon scaling factor. - */ -Polymer.Iconset.prototype.applyIcon = function( - element, icon, theme, scale) {}; - -/** - * Remove an icon from the given element by undoing the changes effected - * by `applyIcon`. - * - * @param {Element} element The element from which the icon is removed. - */ -Polymer.Iconset.prototype.removeIcon = function(element) {}; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/polymer-internal-shared-types.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/polymer-internal-shared-types.js deleted file mode 100644 index fd954c11809..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/polymer-internal-shared-types.js +++ /dev/null @@ -1,214 +0,0 @@ -/** - * @fileoverview Internal shared types for Polymer - * @externs - * - * @license - * Copyright (c) 2017 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 - */ - -/* eslint-disable no-unused-vars, strict, valid-jsdoc */ - -/** - * @constructor - * @extends {DocumentFragment} - */ -function StampedTemplate() { } -/** @type {boolean} */ -StampedTemplate.prototype.__noInsertionPoint; -/** @type {!Array<!Node>} */ -StampedTemplate.prototype.nodeList; -/** @type {!Object<string, !Element>} */ -StampedTemplate.prototype.$; -/** @type {!TemplateInfo | undefined} */ -StampedTemplate.prototype.templateInfo; - -/** @interface */ -function NodeInfo() { } -/** @type {string} */ -NodeInfo.prototype.id; -/** @type {!Array<{name: string, value: string}>}*/ -NodeInfo.prototype.events; -/** @type {boolean} */ -NodeInfo.prototype.hasInsertionPoint; -/** @type {!TemplateInfo} */ -NodeInfo.prototype.templateInfo; -/** @type {!NodeInfo} */ -NodeInfo.prototype.parentInfo; -/** @type {number} */ -NodeInfo.prototype.parentIndex; -/** @type {number} */ -NodeInfo.prototype.infoIndex; -/** @type {!Array<!Binding>} */ -NodeInfo.prototype.bindings; - -/** @interface */ -function TemplateInfo() { } -/** @type {!Array<!NodeInfo>} */ -TemplateInfo.prototype.nodeInfoList; -/** @type {!Array<!Node>} */ -TemplateInfo.prototype.nodeList; -/** @type {boolean} */ -TemplateInfo.prototype.stripWhitespace; -/** @type {boolean | undefined} */ -TemplateInfo.prototype.hasInsertionPoint; -/** @type {!Object} */ -TemplateInfo.prototype.hostProps; -/** @type {!Object} */ -TemplateInfo.prototype.propertyEffects; -/** @type {TemplateInfo | undefined} */ -TemplateInfo.prototype.nextTemplateInfo; -/** @type {TemplateInfo | undefined} */ -TemplateInfo.prototype.previousTemplateInfo; -/** @type {!Array<!Node>} */ -TemplateInfo.prototype.childNodes; -/** @type {boolean} */ -TemplateInfo.prototype.wasPreBound; - -/** - * type for HTMLTemplateElement with `_templateInfo` - * - * @constructor - * @extends {HTMLTemplateElement} - */ -function HTMLTemplateElementWithInfo() { } -/** @type {TemplateInfo} */ -HTMLTemplateElementWithInfo.prototype._templateInfo; - -/** - * @typedef {{ - * literal: string, - * compoundIndex: (number | undefined) - * }} - */ -let LiteralBindingPart; - -/** - * @typedef {{ - * literal: boolean, - * name: string, - * value: (string | number), - * rootProperty: (string | undefined), - * structured: (boolean | undefined), - * wildcard: (boolean | undefined) - * }} - */ -let MethodArg; - -/** - * @typedef {{ - * methodName: string, - * static: boolean, - * args: !Array<!MethodArg>, - * dynamicFn: (boolean | undefined), - * }} - */ -let MethodSignature; - -/** - * @typedef {{ - * mode: string, - * negate: boolean, - * source: string, - * dependencies: !Array<(!MethodArg|string)>, - * customEvent: boolean, - * signature: Object, - * event: string - * }} - */ -let ExpressionBindingPart; - -/** - * @typedef {LiteralBindingPart | ExpressionBindingPart} - */ -let BindingPart; - -/** - * @typedef {{ - * kind: string, - * target: string, - * parts: Array<!BindingPart>, - * literal: (string | undefined), - * isCompound: boolean, - * listenerEvent: (string | undefined), - * listenerNegate: (boolean | undefined) - * }} - */ -let Binding; - -/** - * @typedef {{ - * path: string - * }} - */ -let PathInfo; - -/** - * @typedef {{ - * forwardHostProp: (function(string, *) | undefined), - * instanceProps: (Object | undefined), - * mutableData: (boolean | undefined), - * notifyInstanceProp: (function(*, string, *) | undefined), - * parentModel: (boolean | undefined) - * }} - */ -let TemplatizeOptions; - -/** @record */ -function AsyncInterface(){} -/** @type {function(!Function, number=): number} */ -AsyncInterface.prototype.run; -/** @type {function(number): void} */ -AsyncInterface.prototype.cancel; - -/** @record */ -let GestureInfo = function(){}; -/** @type {string|undefined} */ -GestureInfo.prototype.state; -/** @type {boolean|undefined} */ -GestureInfo.prototype.started; -/** @type {!Array<?>|undefined} */ -GestureInfo.prototype.moves; -/** @type {number|undefined} */ -GestureInfo.prototype.x; -/** @type {number|undefined} */ -GestureInfo.prototype.y; -/** @type {boolean|undefined} */ -GestureInfo.prototype.prevent; -/** @type {function(?): void|undefined} */ -GestureInfo.prototype.addMove; -/** @type {null|undefined} */ -GestureInfo.prototype.movefn; -/** @type {null|undefined} */ -GestureInfo.prototype.upFn; - -/** @record */ -let GestureRecognizer = function(){}; -/** @type {string} */ -GestureRecognizer.prototype.name; -/** @type {!Array<string>} */ -GestureRecognizer.prototype.deps; -/** @type {function(): void} */ -GestureRecognizer.prototype.reset; -/** @type {function(MouseEvent): void | undefined} */ -GestureRecognizer.prototype.mousedown; -/** @type {(function(MouseEvent): void | undefined)} */ -GestureRecognizer.prototype.mousemove; -/** @type {(function(MouseEvent): void | undefined)} */ -GestureRecognizer.prototype.mouseup; -/** @type {(function(TouchEvent): void | undefined)} */ -GestureRecognizer.prototype.touchstart; -/** @type {(function(TouchEvent): void | undefined)} */ -GestureRecognizer.prototype.touchmove; -/** @type {(function(TouchEvent): void | undefined)} */ -GestureRecognizer.prototype.touchend; -/** @type {(function(MouseEvent): void | undefined)} */ -GestureRecognizer.prototype.click; -/** @type {!GestureInfo} */ -GestureRecognizer.prototype.info; -/** @type {!Array<string>} */ -GestureRecognizer.prototype.emits; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/polymer-internal-types.html b/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/polymer-internal-types.html deleted file mode 100644 index bc7abad6366..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/polymer-internal-types.html +++ /dev/null @@ -1,11 +0,0 @@ -<!-- -@license -Copyright (c) 2017 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 ---> -<!-- internal shared types for closure pass --> -<script src="polymer-internal-shared-types.js"></script>
\ No newline at end of file diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/webcomponents-externs.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/webcomponents-externs.js deleted file mode 100644 index 1d796ded489..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/externs/webcomponents-externs.js +++ /dev/null @@ -1,68 +0,0 @@ -/** - * @fileoverview Externs for webcomponents polyfills - * @externs - * - * @license - * Copyright (c) 2017 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 - */ -/* eslint-disable */ - -var HTMLImports = { - /** - * @param {function()} callback - */ - whenReady(callback) {}, - /** - * @param {!Node} element - * @return {?HTMLLinkElement|?Document|undefined} - */ - importForElement(element) {} -}; - -window.HTMLImports = HTMLImports; - -var ShadyDOM = { - inUse: false, - flush() {}, - /** - * @param {!Node} target - * @param {function(Array<MutationRecord>, MutationObserver)} callback - * @return {MutationObserver} - */ - observeChildren(target, callback) {}, - /** - * @param {MutationObserver} observer - */ - unobserveChildren(observer) {}, - /** - * @param {Node} node - */ - patch(node) {}, - /** - * @param {!ShadowRoot} shadowroot - */ - flushInitial(shadowroot) {} -}; - -window.ShadyDOM = ShadyDOM; - -var WebComponents = {}; -window.WebComponents = WebComponents; - -/** @type {Element} */ -HTMLElement.prototype._activeElement; - -/** - * @param {HTMLTemplateElement} template - */ -HTMLTemplateElement.decorate = function(template){}; - -/** - * @param {function(function())} cb callback - */ -CustomElementRegistry.prototype.polyfillWrapFlushCallback = function(cb){}; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/array-selector.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/array-selector.js deleted file mode 100644 index 158d242cea6..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/array-selector.js +++ /dev/null @@ -1,434 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import { PolymerElement } from '../../polymer-element.js'; - -import { dedupingMixin } from '../utils/mixin.js'; -import { calculateSplices } from '../utils/array-splice.js'; -import { ElementMixin } from '../mixins/element-mixin.js'; - -/** - * Element mixin for recording dynamic associations between item paths in a - * master `items` array and a `selected` array such that path changes to the - * master array (at the host) element or elsewhere via data-binding) are - * correctly propagated to items in the selected array and vice-versa. - * - * The `items` property accepts an array of user data, and via the - * `select(item)` and `deselect(item)` API, updates the `selected` property - * which may be bound to other parts of the application, and any changes to - * sub-fields of `selected` item(s) will be kept in sync with items in the - * `items` array. When `multi` is false, `selected` is a property - * representing the last selected item. When `multi` is true, `selected` - * is an array of multiply selected items. - * - * @polymer - * @mixinFunction - * @appliesMixin ElementMixin - * @summary Element mixin for recording dynamic associations between item paths in a - * master `items` array and a `selected` array - */ -let ArraySelectorMixin = dedupingMixin(superClass => { - - /** - * @constructor - * @implements {Polymer_ElementMixin} - * @private - */ - let elementBase = ElementMixin(superClass); - - /** - * @polymer - * @mixinClass - * @implements {Polymer_ArraySelectorMixin} - * @unrestricted - */ - class ArraySelectorMixin extends elementBase { - - static get properties() { - return { - - /** - * An array containing items from which selection will be made. - */ - items: { - type: Array, - }, - - /** - * When `true`, multiple items may be selected at once (in this case, - * `selected` is an array of currently selected items). When `false`, - * only one item may be selected at a time. - */ - multi: { - type: Boolean, - value: false, - }, - - /** - * When `multi` is true, this is an array that contains any selected. - * When `multi` is false, this is the currently selected item, or `null` - * if no item is selected. - * @type {?Object|?Array<!Object>} - */ - selected: {type: Object, notify: true}, - - /** - * When `multi` is false, this is the currently selected item, or `null` - * if no item is selected. - * @type {?Object} - */ - selectedItem: {type: Object, notify: true}, - - /** - * When `true`, calling `select` on an item that is already selected - * will deselect the item. - */ - toggle: {type: Boolean, value: false} - - }; - } - - static get observers() { - return ['__updateSelection(multi, items.*)']; - } - - constructor() { - super(); - this.__lastItems = null; - this.__lastMulti = null; - this.__selectedMap = null; - } - - __updateSelection(multi, itemsInfo) { - let path = itemsInfo.path; - if (path == JSCompiler_renameProperty('items', this)) { - // Case 1 - items array changed, so diff against previous array and - // deselect any removed items and adjust selected indices - let newItems = itemsInfo.base || []; - let lastItems = this.__lastItems; - let lastMulti = this.__lastMulti; - if (multi !== lastMulti) { - this.clearSelection(); - } - if (lastItems) { - let splices = calculateSplices(newItems, lastItems); - this.__applySplices(splices); - } - this.__lastItems = newItems; - this.__lastMulti = multi; - } else if (itemsInfo.path == `${JSCompiler_renameProperty('items', this)}.splices`) { - // Case 2 - got specific splice information describing the array mutation: - // deselect any removed items and adjust selected indices - this.__applySplices(itemsInfo.value.indexSplices); - } else { - // Case 3 - an array element was changed, so deselect the previous - // item for that index if it was previously selected - let part = path.slice(`${JSCompiler_renameProperty('items', this)}.`.length); - let idx = parseInt(part, 10); - if ((part.indexOf('.') < 0) && part == idx) { - this.__deselectChangedIdx(idx); - } - } - } - - __applySplices(splices) { - let selected = this.__selectedMap; - // Adjust selected indices and mark removals - for (let i=0; i<splices.length; i++) { - let s = splices[i]; - selected.forEach((idx, item) => { - if (idx < s.index) { - // no change - } else if (idx >= s.index + s.removed.length) { - // adjust index - selected.set(item, idx + s.addedCount - s.removed.length); - } else { - // remove index - selected.set(item, -1); - } - }); - for (let j=0; j<s.addedCount; j++) { - let idx = s.index + j; - if (selected.has(this.items[idx])) { - selected.set(this.items[idx], idx); - } - } - } - // Update linked paths - this.__updateLinks(); - // Remove selected items that were removed from the items array - let sidx = 0; - selected.forEach((idx, item) => { - if (idx < 0) { - if (this.multi) { - this.splice(JSCompiler_renameProperty('selected', this), sidx, 1); - } else { - this.selected = this.selectedItem = null; - } - selected.delete(item); - } else { - sidx++; - } - }); - } - - __updateLinks() { - this.__dataLinkedPaths = {}; - if (this.multi) { - let sidx = 0; - this.__selectedMap.forEach(idx => { - if (idx >= 0) { - this.linkPaths( - `${JSCompiler_renameProperty('items', this)}.${idx}`, - `${JSCompiler_renameProperty('selected', this)}.${sidx++}`); - } - }); - } else { - this.__selectedMap.forEach(idx => { - this.linkPaths( - JSCompiler_renameProperty('selected', this), - `${JSCompiler_renameProperty('items', this)}.${idx}`); - this.linkPaths( - JSCompiler_renameProperty('selectedItem', this), - `${JSCompiler_renameProperty('items', this)}.${idx}`); - }); - } - } - - /** - * Clears the selection state. - * @override - * @return {void} - */ - clearSelection() { - // Unbind previous selection - this.__dataLinkedPaths = {}; - // The selected map stores 3 pieces of information: - // key: items array object - // value: items array index - // order: selected array index - this.__selectedMap = new Map(); - // Initialize selection - this.selected = this.multi ? [] : null; - this.selectedItem = null; - } - - /** - * Returns whether the item is currently selected. - * - * @override - * @param {*} item Item from `items` array to test - * @return {boolean} Whether the item is selected - */ - isSelected(item) { - return this.__selectedMap.has(item); - } - - /** - * Returns whether the item is currently selected. - * - * @override - * @param {number} idx Index from `items` array to test - * @return {boolean} Whether the item is selected - */ - isIndexSelected(idx) { - return this.isSelected(this.items[idx]); - } - - __deselectChangedIdx(idx) { - let sidx = this.__selectedIndexForItemIndex(idx); - if (sidx >= 0) { - let i = 0; - this.__selectedMap.forEach((idx, item) => { - if (sidx == i++) { - this.deselect(item); - } - }); - } - } - - __selectedIndexForItemIndex(idx) { - let selected = this.__dataLinkedPaths[`${JSCompiler_renameProperty('items', this)}.${idx}`]; - if (selected) { - return parseInt(selected.slice(`${JSCompiler_renameProperty('selected', this)}.`.length), 10); - } - } - - /** - * Deselects the given item if it is already selected. - * - * @override - * @param {*} item Item from `items` array to deselect - * @return {void} - */ - deselect(item) { - let idx = this.__selectedMap.get(item); - if (idx >= 0) { - this.__selectedMap.delete(item); - let sidx; - if (this.multi) { - sidx = this.__selectedIndexForItemIndex(idx); - } - this.__updateLinks(); - if (this.multi) { - this.splice(JSCompiler_renameProperty('selected', this), sidx, 1); - } else { - this.selected = this.selectedItem = null; - } - } - } - - /** - * Deselects the given index if it is already selected. - * - * @override - * @param {number} idx Index from `items` array to deselect - * @return {void} - */ - deselectIndex(idx) { - this.deselect(this.items[idx]); - } - - /** - * Selects the given item. When `toggle` is true, this will automatically - * deselect the item if already selected. - * - * @override - * @param {*} item Item from `items` array to select - * @return {void} - */ - select(item) { - this.selectIndex(this.items.indexOf(item)); - } - - /** - * Selects the given index. When `toggle` is true, this will automatically - * deselect the item if already selected. - * - * @override - * @param {number} idx Index from `items` array to select - * @return {void} - */ - selectIndex(idx) { - let item = this.items[idx]; - if (!this.isSelected(item)) { - if (!this.multi) { - this.__selectedMap.clear(); - } - this.__selectedMap.set(item, idx); - this.__updateLinks(); - if (this.multi) { - this.push(JSCompiler_renameProperty('selected', this), item); - } else { - this.selected = this.selectedItem = item; - } - } else if (this.toggle) { - this.deselectIndex(idx); - } - } - - } - - return ArraySelectorMixin; - -}); - -// export mixin -export { ArraySelectorMixin }; - -/** - * @constructor - * @extends {PolymerElement} - * @implements {Polymer_ArraySelectorMixin} - * @private - */ -let baseArraySelector = ArraySelectorMixin(PolymerElement); - -/** - * Element implementing the `ArraySelector` mixin, which records - * dynamic associations between item paths in a master `items` array and a - * `selected` array such that path changes to the master array (at the host) - * element or elsewhere via data-binding) are correctly propagated to items - * in the selected array and vice-versa. - * - * The `items` property accepts an array of user data, and via the - * `select(item)` and `deselect(item)` API, updates the `selected` property - * which may be bound to other parts of the application, and any changes to - * sub-fields of `selected` item(s) will be kept in sync with items in the - * `items` array. When `multi` is false, `selected` is a property - * representing the last selected item. When `multi` is true, `selected` - * is an array of multiply selected items. - * - * Example: - * - * ```js - * import {PolymerElement} from '@polymer/polymer'; - * import '@polymer/polymer/lib/elements/array-selector.js'; - * - * class EmployeeList extends PolymerElement { - * static get _template() { - * return html` - * <div> Employee list: </div> - * <dom-repeat id="employeeList" items="{{employees}}"> - * <template> - * <div>First name: <span>{{item.first}}</span></div> - * <div>Last name: <span>{{item.last}}</span></div> - * <button on-click="toggleSelection">Select</button> - * </template> - * </dom-repeat> - * - * <array-selector id="selector" - * items="{{employees}}" - * selected="{{selected}}" - * multi toggle></array-selector> - * - * <div> Selected employees: </div> - * <dom-repeat items="{{selected}}"> - * <template> - * <div>First name: <span>{{item.first}}</span></div> - * <div>Last name: <span>{{item.last}}</span></div> - * </template> - * </dom-repeat>`; - * } - * static get is() { return 'employee-list'; } - * static get properties() { - * return { - * employees: { - * value() { - * return [ - * {first: 'Bob', last: 'Smith'}, - * {first: 'Sally', last: 'Johnson'}, - * ... - * ]; - * } - * } - * }; - * } - * toggleSelection(e) { - * const item = this.$.employeeList.itemForElement(e.target); - * this.$.selector.select(item); - * } - * } - * ``` - * - * @polymer - * @customElement - * @extends {baseArraySelector} - * @appliesMixin ArraySelectorMixin - * @summary Custom element that links paths between an input `items` array and - * an output `selected` item or array based on calls to its selection API. - */ -class ArraySelector extends baseArraySelector { - // Not needed to find template; can be removed once the analyzer - // can find the tag name from customElements.define call - static get is() { return 'array-selector'; } - static get template() { return null; } -} -customElements.define(ArraySelector.is, ArraySelector); -export { ArraySelector }; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/custom-style.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/custom-style.js deleted file mode 100644 index b58b320d064..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/custom-style.js +++ /dev/null @@ -1,109 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import '../../../shadycss/entrypoints/custom-style-interface.js'; - -import { cssFromModules } from '../utils/style-gather.js'; - -const attr = 'include'; - -const CustomStyleInterface = window.ShadyCSS.CustomStyleInterface; - -/** - * Custom element for defining styles in the main document that can take - * advantage of [shady DOM](https://github.com/webcomponents/shadycss) shims - * for style encapsulation, custom properties, and custom mixins. - * - * - Document styles defined in a `<custom-style>` are shimmed to ensure they - * do not leak into local DOM when running on browsers without native - * Shadow DOM. - * - Custom properties can be defined in a `<custom-style>`. Use the `html` selector - * to define custom properties that apply to all custom elements. - * - Custom mixins can be defined in a `<custom-style>`, if you import the optional - * [apply shim](https://github.com/webcomponents/shadycss#about-applyshim) - * (`shadycss/apply-shim.html`). - * - * To use: - * - * - Import `custom-style.html`. - * - Place a `<custom-style>` element in the main document, wrapping an inline `<style>` tag that - * contains the CSS rules you want to shim. - * - * For example: - * - * ```html - * <!-- import apply shim--only required if using mixins --> - * <link rel="import" href="bower_components/shadycss/apply-shim.html"> - * <!-- import custom-style element --> - * <link rel="import" href="bower_components/polymer/lib/elements/custom-style.html"> - * - * <custom-style> - * <style> - * html { - * --custom-color: blue; - * --custom-mixin: { - * font-weight: bold; - * color: red; - * }; - * } - * </style> - * </custom-style> - * ``` - * - * @customElement - * @extends HTMLElement - * @summary Custom element for defining styles in the main document that can - * take advantage of Polymer's style scoping and custom properties shims. - */ -export class CustomStyle extends HTMLElement { - constructor() { - super(); - this._style = null; - CustomStyleInterface.addCustomStyle(this); - } - /** - * Returns the light-DOM `<style>` child this element wraps. Upon first - * call any style modules referenced via the `include` attribute will be - * concatenated to this element's `<style>`. - * - * @export - * @return {HTMLStyleElement} This element's light-DOM `<style>` - */ - getStyle() { - if (this._style) { - return this._style; - } - const style = /** @type {HTMLStyleElement} */(this.querySelector('style')); - if (!style) { - return null; - } - this._style = style; - const include = style.getAttribute(attr); - if (include) { - style.removeAttribute(attr); - style.textContent = cssFromModules(include) + style.textContent; - } - /* - HTML Imports styling the main document are deprecated in Chrome - https://crbug.com/523952 - - If this element is not in the main document, then it must be in an HTML Import document. - In that case, move the custom style to the main document. - - The ordering of `<custom-style>` should stay the same as when loaded by HTML Imports, but there may be odd - cases of ordering w.r.t the main document styles. - */ - if (this.ownerDocument !== window.document) { - window.document.head.appendChild(this); - } - return this._style; - } -} - -window.customElements.define('custom-style', CustomStyle); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/dom-bind.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/dom-bind.js deleted file mode 100644 index e02d041a90d..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/dom-bind.js +++ /dev/null @@ -1,143 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import '../utils/boot.js'; - -import { PropertyEffects } from '../mixins/property-effects.js'; -import { OptionalMutableData } from '../mixins/mutable-data.js'; -import { GestureEventListeners } from '../mixins/gesture-event-listeners.js'; -import { strictTemplatePolicy } from '../utils/settings.js'; -import { wrap } from '../utils/wrap.js'; - -/** - * @constructor - * @extends {HTMLElement} - * @implements {Polymer_PropertyEffects} - * @implements {Polymer_OptionalMutableData} - * @implements {Polymer_GestureEventListeners} - * @private - */ -const domBindBase = - GestureEventListeners( - OptionalMutableData( - PropertyEffects(HTMLElement))); - -/** - * Custom element to allow using Polymer's template features (data binding, - * declarative event listeners, etc.) in the main document without defining - * a new custom element. - * - * `<template>` tags utilizing bindings may be wrapped with the `<dom-bind>` - * element, which will immediately stamp the wrapped template into the main - * document and bind elements to the `dom-bind` element itself as the - * binding scope. - * - * @polymer - * @customElement - * @appliesMixin PropertyEffects - * @appliesMixin OptionalMutableData - * @appliesMixin GestureEventListeners - * @extends {domBindBase} - * @summary Custom element to allow using Polymer's template features (data - * binding, declarative event listeners, etc.) in the main document. - */ -export class DomBind extends domBindBase { - - static get observedAttributes() { return ['mutable-data']; } - - constructor() { - super(); - if (strictTemplatePolicy) { - throw new Error(`strictTemplatePolicy: dom-bind not allowed`); - } - this.root = null; - this.$ = null; - this.__children = null; - } - - /** - * @override - * @return {void} - */ - attributeChangedCallback() { - // assumes only one observed attribute - this.mutableData = true; - } - - /** - * @override - * @return {void} - */ - connectedCallback() { - this.style.display = 'none'; - this.render(); - } - - /** - * @override - * @return {void} - */ - disconnectedCallback() { - this.__removeChildren(); - } - - __insertChildren() { - wrap(wrap(this).parentNode).insertBefore(this.root, this); - } - - __removeChildren() { - if (this.__children) { - for (let i=0; i<this.__children.length; i++) { - this.root.appendChild(this.__children[i]); - } - } - } - - /** - * Forces the element to render its content. This is typically only - * necessary to call if HTMLImports with the async attribute are used. - * @return {void} - */ - render() { - let template; - if (!this.__children) { - template = /** @type {HTMLTemplateElement} */(template || this.querySelector('template')); - if (!template) { - // Wait until childList changes and template should be there by then - let observer = new MutationObserver(() => { - template = /** @type {HTMLTemplateElement} */(this.querySelector('template')); - if (template) { - observer.disconnect(); - this.render(); - } else { - throw new Error('dom-bind requires a <template> child'); - } - }); - observer.observe(this, {childList: true}); - return; - } - this.root = this._stampTemplate( - /** @type {!HTMLTemplateElement} */(template)); - this.$ = this.root.$; - this.__children = []; - for (let n=this.root.firstChild; n; n=n.nextSibling) { - this.__children[this.__children.length] = n; - } - this._enableProperties(); - } - this.__insertChildren(); - this.dispatchEvent(new CustomEvent('dom-change', { - bubbles: true, - composed: true - })); - } - -} - -customElements.define('dom-bind', DomBind); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/dom-if.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/dom-if.js deleted file mode 100644 index a13940ad1a8..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/dom-if.js +++ /dev/null @@ -1,289 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import { PolymerElement } from '../../polymer-element.js'; - -import { templatize } from '../utils/templatize.js'; -import { Debouncer } from '../utils/debounce.js'; -import { enqueueDebouncer, flush } from '../utils/flush.js'; -import { microTask } from '../utils/async.js'; -import { root } from '../utils/path.js'; -import { wrap } from '../utils/wrap.js'; - -/** - * The `<dom-if>` element will stamp a light-dom `<template>` child when - * the `if` property becomes truthy, and the template can use Polymer - * data-binding and declarative event features when used in the context of - * a Polymer element's template. - * - * When `if` becomes falsy, the stamped content is hidden but not - * removed from dom. When `if` subsequently becomes truthy again, the content - * is simply re-shown. This approach is used due to its favorable performance - * characteristics: the expense of creating template content is paid only - * once and lazily. - * - * Set the `restamp` property to true to force the stamped content to be - * created / destroyed when the `if` condition changes. - * - * @customElement - * @polymer - * @extends PolymerElement - * @summary Custom element that conditionally stamps and hides or removes - * template content based on a boolean flag. - */ -export class DomIf extends PolymerElement { - - // Not needed to find template; can be removed once the analyzer - // can find the tag name from customElements.define call - static get is() { return 'dom-if'; } - - static get template() { return null; } - - static get properties() { - - return { - - /** - * Fired whenever DOM is added or removed/hidden by this template (by - * default, rendering occurs lazily). To force immediate rendering, call - * `render`. - * - * @event dom-change - */ - - /** - * A boolean indicating whether this template should stamp. - */ - if: { - type: Boolean, - observer: '__debounceRender' - }, - - /** - * When true, elements will be removed from DOM and discarded when `if` - * becomes false and re-created and added back to the DOM when `if` - * becomes true. By default, stamped elements will be hidden but left - * in the DOM when `if` becomes false, which is generally results - * in better performance. - */ - restamp: { - type: Boolean, - observer: '__debounceRender' - } - - }; - - } - - constructor() { - super(); - this.__renderDebouncer = null; - this.__invalidProps = null; - this.__instance = null; - this._lastIf = false; - this.__ctor = null; - this.__hideTemplateChildren__ = false; - } - - __debounceRender() { - // Render is async for 2 reasons: - // 1. To eliminate dom creation trashing if user code thrashes `if` in the - // same turn. This was more common in 1.x where a compound computed - // property could result in the result changing multiple times, but is - // mitigated to a large extent by batched property processing in 2.x. - // 2. To avoid double object propagation when a bag including values bound - // to the `if` property as well as one or more hostProps could enqueue - // the <dom-if> to flush before the <template>'s host property - // forwarding. In that scenario creating an instance would result in - // the host props being set once, and then the enqueued changes on the - // template would set properties a second time, potentially causing an - // object to be set to an instance more than once. Creating the - // instance async from flushing data ensures this doesn't happen. If - // we wanted a sync option in the future, simply having <dom-if> flush - // (or clear) its template's pending host properties before creating - // the instance would also avoid the problem. - this.__renderDebouncer = Debouncer.debounce( - this.__renderDebouncer - , microTask - , () => this.__render()); - enqueueDebouncer(this.__renderDebouncer); - } - - /** - * @override - * @return {void} - */ - disconnectedCallback() { - super.disconnectedCallback(); - const parent = wrap(this).parentNode; - if (!parent || (parent.nodeType == Node.DOCUMENT_FRAGMENT_NODE && - !wrap(parent).host)) { - this.__teardownInstance(); - } - } - - /** - * @override - * @return {void} - */ - connectedCallback() { - super.connectedCallback(); - this.style.display = 'none'; - if (this.if) { - this.__debounceRender(); - } - } - - /** - * Forces the element to render its content. Normally rendering is - * asynchronous to a provoking change. This is done for efficiency so - * that multiple changes trigger only a single render. The render method - * should be called if, for example, template rendering is required to - * validate application state. - * @return {void} - */ - render() { - flush(); - } - - __render() { - if (this.if) { - if (!this.__ensureInstance()) { - // No template found yet - return; - } - this._showHideChildren(); - } else if (this.restamp) { - this.__teardownInstance(); - } - if (!this.restamp && this.__instance) { - this._showHideChildren(); - } - if (this.if != this._lastIf) { - this.dispatchEvent(new CustomEvent('dom-change', { - bubbles: true, - composed: true - })); - this._lastIf = this.if; - } - } - - __ensureInstance() { - let parentNode = wrap(this).parentNode; - // Guard against element being detached while render was queued - if (parentNode) { - if (!this.__ctor) { - let template = /** @type {HTMLTemplateElement} */(wrap(this).querySelector('template')); - if (!template) { - // Wait until childList changes and template should be there by then - let observer = new MutationObserver(() => { - if (wrap(this).querySelector('template')) { - observer.disconnect(); - this.__render(); - } else { - throw new Error('dom-if requires a <template> child'); - } - }); - observer.observe(this, {childList: true}); - return false; - } - this.__ctor = templatize(template, this, { - // dom-if templatizer instances require `mutable: true`, as - // `__syncHostProperties` relies on that behavior to sync objects - mutableData: true, - /** - * @param {string} prop Property to forward - * @param {*} value Value of property - * @this {DomIf} - */ - forwardHostProp: function(prop, value) { - if (this.__instance) { - if (this.if) { - this.__instance.forwardHostProp(prop, value); - } else { - // If we have an instance but are squelching host property - // forwarding due to if being false, note the invalidated - // properties so `__syncHostProperties` can sync them the next - // time `if` becomes true - this.__invalidProps = this.__invalidProps || Object.create(null); - this.__invalidProps[root(prop)] = true; - } - } - } - }); - } - if (!this.__instance) { - this.__instance = new this.__ctor(); - wrap(parentNode).insertBefore(this.__instance.root, this); - } else { - this.__syncHostProperties(); - let c$ = this.__instance.children; - if (c$ && c$.length) { - // Detect case where dom-if was re-attached in new position - let lastChild = wrap(this).previousSibling; - if (lastChild !== c$[c$.length-1]) { - for (let i=0, n; (i<c$.length) && (n=c$[i]); i++) { - wrap(parentNode).insertBefore(n, this); - } - } - } - } - } - return true; - } - - __syncHostProperties() { - let props = this.__invalidProps; - if (props) { - for (let prop in props) { - this.__instance._setPendingProperty(prop, this.__dataHost[prop]); - } - this.__invalidProps = null; - this.__instance._flushProperties(); - } - } - - __teardownInstance() { - if (this.__instance) { - let c$ = this.__instance.children; - if (c$ && c$.length) { - // use first child parent, for case when dom-if may have been detached - let parent = wrap(c$[0]).parentNode; - // Instance children may be disconnected from parents when dom-if - // detaches if a tree was innerHTML'ed - if (parent) { - parent = wrap(parent); - for (let i=0, n; (i<c$.length) && (n=c$[i]); i++) { - parent.removeChild(n); - } - } - } - this.__instance = null; - this.__invalidProps = null; - } - } - - /** - * Shows or hides the template instance top level child elements. For - * text nodes, `textContent` is removed while "hidden" and replaced when - * "shown." - * @return {void} - * @protected - * @suppress {visibility} - */ - _showHideChildren() { - let hidden = this.__hideTemplateChildren__ || !this.if; - if (this.__instance) { - this.__instance._showHideChildren(hidden); - } - } - -} - -customElements.define(DomIf.is, DomIf); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/dom-module.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/dom-module.js deleted file mode 100644 index 02c41e7203b..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/dom-module.js +++ /dev/null @@ -1,163 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import '../utils/boot.js'; - -import { resolveUrl, pathFromUrl } from '../utils/resolve-url.js'; -import { strictTemplatePolicy } from '../utils/settings.js'; - -let modules = {}; -let lcModules = {}; -/** - * Sets a dom-module into the global registry by id. - * - * @param {string} id dom-module id - * @param {DomModule} module dom-module instance - * @return {void} - */ -function setModule(id, module) { - // store id separate from lowercased id so that - // in all cases mixedCase id will stored distinctly - // and lowercase version is a fallback - modules[id] = lcModules[id.toLowerCase()] = module; -} -/** - * Retrieves a dom-module from the global registry by id. - * - * @param {string} id dom-module id - * @return {DomModule!} dom-module instance - */ -function findModule(id) { - return modules[id] || lcModules[id.toLowerCase()]; -} - -function styleOutsideTemplateCheck(inst) { - if (inst.querySelector('style')) { - console.warn('dom-module %s has style outside template', inst.id); - } -} - -/** - * The `dom-module` element registers the dom it contains to the name given - * by the module's id attribute. It provides a unified database of dom - * accessible via its static `import` API. - * - * A key use case of `dom-module` is for providing custom element `<template>`s - * via HTML imports that are parsed by the native HTML parser, that can be - * relocated during a bundling pass and still looked up by `id`. - * - * Example: - * - * <dom-module id="foo"> - * <img src="stuff.png"> - * </dom-module> - * - * Then in code in some other location that cannot access the dom-module above - * - * let img = customElements.get('dom-module').import('foo', 'img'); - * - * @customElement - * @extends HTMLElement - * @summary Custom element that provides a registry of relocatable DOM content - * by `id` that is agnostic to bundling. - * @unrestricted - */ -export class DomModule extends HTMLElement { - - static get observedAttributes() { return ['id']; } - - /** - * Retrieves the element specified by the css `selector` in the module - * registered by `id`. For example, this.import('foo', 'img'); - * @param {string} id The id of the dom-module in which to search. - * @param {string=} selector The css selector by which to find the element. - * @return {Element} Returns the element which matches `selector` in the - * module registered at the specified `id`. - * - * @export - * @nocollapse Referred to indirectly in style-gather.js - */ - static import(id, selector) { - if (id) { - let m = findModule(id); - if (m && selector) { - return m.querySelector(selector); - } - return m; - } - return null; - } - - /* eslint-disable no-unused-vars */ - /** - * @param {string} name Name of attribute. - * @param {?string} old Old value of attribute. - * @param {?string} value Current value of attribute. - * @param {?string} namespace Attribute namespace. - * @return {void} - * @override - */ - attributeChangedCallback(name, old, value, namespace) { - if (old !== value) { - this.register(); - } - } - /* eslint-enable no-unused-args */ - - /** - * The absolute URL of the original location of this `dom-module`. - * - * This value will differ from this element's `ownerDocument` in the - * following ways: - * - Takes into account any `assetpath` attribute added during bundling - * to indicate the original location relative to the bundled location - * - Uses the HTMLImports polyfill's `importForElement` API to ensure - * the path is relative to the import document's location since - * `ownerDocument` is not currently polyfilled - */ - get assetpath() { - // Don't override existing assetpath. - if (!this.__assetpath) { - // note: assetpath set via an attribute must be relative to this - // element's location; accomodate polyfilled HTMLImports - const owner = window.HTMLImports && HTMLImports.importForElement ? - HTMLImports.importForElement(this) || document : this.ownerDocument; - const url = resolveUrl( - this.getAttribute('assetpath') || '', owner.baseURI); - this.__assetpath = pathFromUrl(url); - } - return this.__assetpath; - } - - /** - * Registers the dom-module at a given id. This method should only be called - * when a dom-module is imperatively created. For - * example, `document.createElement('dom-module').register('foo')`. - * @param {string=} id The id at which to register the dom-module. - * @return {void} - */ - register(id) { - id = id || this.id; - if (id) { - // Under strictTemplatePolicy, reject and null out any re-registered - // dom-module since it is ambiguous whether first-in or last-in is trusted - if (strictTemplatePolicy && findModule(id) !== undefined) { - setModule(id, null); - throw new Error(`strictTemplatePolicy: dom-module ${id} re-registered`); - } - this.id = id; - setModule(id, this); - styleOutsideTemplateCheck(this); - } - } -} - -DomModule.prototype['modules'] = modules; - -customElements.define('dom-module', DomModule); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/dom-repeat.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/dom-repeat.js deleted file mode 100644 index 74f12659d9c..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/elements/dom-repeat.js +++ /dev/null @@ -1,733 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import { PolymerElement } from '../../polymer-element.js'; - -import { TemplateInstanceBase, templatize, modelForElement } from '../utils/templatize.js'; // eslint-disable-line no-unused-vars -import { Debouncer } from '../utils/debounce.js'; -import { enqueueDebouncer, flush } from '../utils/flush.js'; -import { OptionalMutableData } from '../mixins/mutable-data.js'; -import { matches, translate } from '../utils/path.js'; -import { timeOut, microTask } from '../utils/async.js'; -import { wrap } from '../utils/wrap.js'; - -/** - * @constructor - * @implements {Polymer_OptionalMutableData} - * @extends {PolymerElement} - * @private - */ -const domRepeatBase = OptionalMutableData(PolymerElement); - -/** - * The `<dom-repeat>` element will automatically stamp and binds one instance - * of template content to each object in a user-provided array. - * `dom-repeat` accepts an `items` property, and one instance of the template - * is stamped for each item into the DOM at the location of the `dom-repeat` - * element. The `item` property will be set on each instance's binding - * scope, thus templates should bind to sub-properties of `item`. - * - * Example: - * - * ```html - * <dom-module id="employee-list"> - * - * <template> - * - * <div> Employee list: </div> - * <dom-repeat items="{{employees}}"> - * <template> - * <div>First name: <span>{{item.first}}</span></div> - * <div>Last name: <span>{{item.last}}</span></div> - * </template> - * </dom-repeat> - * - * </template> - * - * </dom-module> - * ``` - * - * With the following custom element definition: - * - * ```js - * class EmployeeList extends PolymerElement { - * static get is() { return 'employee-list'; } - * static get properties() { - * return { - * employees: { - * value() { - * return [ - * {first: 'Bob', last: 'Smith'}, - * {first: 'Sally', last: 'Johnson'}, - * ... - * ]; - * } - * } - * }; - * } - * } - * ``` - * - * Notifications for changes to items sub-properties will be forwarded to template - * instances, which will update via the normal structured data notification system. - * - * Mutations to the `items` array itself should be made using the Array - * mutation API's on the PropertyEffects mixin (`push`, `pop`, `splice`, - * `shift`, `unshift`), and template instances will be kept in sync with the - * data in the array. - * - * Events caught by event handlers within the `dom-repeat` template will be - * decorated with a `model` property, which represents the binding scope for - * each template instance. The model should be used to manipulate data on the - * instance, for example `event.model.set('item.checked', true);`. - * - * Alternatively, the model for a template instance for an element stamped by - * a `dom-repeat` can be obtained using the `modelForElement` API on the - * `dom-repeat` that stamped it, for example - * `this.$.domRepeat.modelForElement(event.target).set('item.checked', true);`. - * This may be useful for manipulating instance data of event targets obtained - * by event handlers on parents of the `dom-repeat` (event delegation). - * - * A view-specific filter/sort may be applied to each `dom-repeat` by supplying a - * `filter` and/or `sort` property. This may be a string that names a function on - * the host, or a function may be assigned to the property directly. The functions - * should implemented following the standard `Array` filter/sort API. - * - * In order to re-run the filter or sort functions based on changes to sub-fields - * of `items`, the `observe` property may be set as a space-separated list of - * `item` sub-fields that should cause a re-filter/sort when modified. If - * the filter or sort function depends on properties not contained in `items`, - * the user should observe changes to those properties and call `render` to update - * the view based on the dependency change. - * - * For example, for an `dom-repeat` with a filter of the following: - * - * ```js - * isEngineer(item) { - * return item.type == 'engineer' || item.manager.type == 'engineer'; - * } - * ``` - * - * Then the `observe` property should be configured as follows: - * - * ```html - * <dom-repeat items="{{employees}}" filter="isEngineer" observe="type manager.type"> - * ``` - * - * @customElement - * @polymer - * @extends {domRepeatBase} - * @appliesMixin OptionalMutableData - * @summary Custom element for stamping instance of a template bound to - * items in an array. - */ -export class DomRepeat extends domRepeatBase { - - // Not needed to find template; can be removed once the analyzer - // can find the tag name from customElements.define call - static get is() { return 'dom-repeat'; } - - static get template() { return null; } - - static get properties() { - - /** - * Fired whenever DOM is added or removed by this template (by - * default, rendering occurs lazily). To force immediate rendering, call - * `render`. - * - * @event dom-change - */ - return { - - /** - * An array containing items determining how many instances of the template - * to stamp and that that each template instance should bind to. - */ - items: { - type: Array - }, - - /** - * The name of the variable to add to the binding scope for the array - * element associated with a given template instance. - */ - as: { - type: String, - value: 'item' - }, - - /** - * The name of the variable to add to the binding scope with the index - * of the instance in the sorted and filtered list of rendered items. - * Note, for the index in the `this.items` array, use the value of the - * `itemsIndexAs` property. - */ - indexAs: { - type: String, - value: 'index' - }, - - /** - * The name of the variable to add to the binding scope with the index - * of the instance in the `this.items` array. Note, for the index of - * this instance in the sorted and filtered list of rendered items, - * use the value of the `indexAs` property. - */ - itemsIndexAs: { - type: String, - value: 'itemsIndex' - }, - - /** - * A function that should determine the sort order of the items. This - * property should either be provided as a string, indicating a method - * name on the element's host, or else be an actual function. The - * function should match the sort function passed to `Array.sort`. - * Using a sort function has no effect on the underlying `items` array. - */ - sort: { - type: Function, - observer: '__sortChanged' - }, - - /** - * A function that can be used to filter items out of the view. This - * property should either be provided as a string, indicating a method - * name on the element's host, or else be an actual function. The - * function should match the sort function passed to `Array.filter`. - * Using a filter function has no effect on the underlying `items` array. - */ - filter: { - type: Function, - observer: '__filterChanged' - }, - - /** - * When using a `filter` or `sort` function, the `observe` property - * should be set to a space-separated list of the names of item - * sub-fields that should trigger a re-sort or re-filter when changed. - * These should generally be fields of `item` that the sort or filter - * function depends on. - */ - observe: { - type: String, - observer: '__observeChanged' - }, - - /** - * When using a `filter` or `sort` function, the `delay` property - * determines a debounce time in ms after a change to observed item - * properties that must pass before the filter or sort is re-run. - * This is useful in rate-limiting shuffling of the view when - * item changes may be frequent. - */ - delay: Number, - - /** - * Count of currently rendered items after `filter` (if any) has been applied. - * If "chunking mode" is enabled, `renderedItemCount` is updated each time a - * set of template instances is rendered. - * - */ - renderedItemCount: { - type: Number, - notify: true, - readOnly: true - }, - - /** - * Defines an initial count of template instances to render after setting - * the `items` array, before the next paint, and puts the `dom-repeat` - * into "chunking mode". The remaining items will be created and rendered - * incrementally at each animation frame therof until all instances have - * been rendered. - */ - initialCount: { - type: Number, - observer: '__initializeChunking' - }, - - /** - * When `initialCount` is used, this property defines a frame rate (in - * fps) to target by throttling the number of instances rendered each - * frame to not exceed the budget for the target frame rate. The - * framerate is effectively the number of `requestAnimationFrame`s that - * it tries to allow to actually fire in a given second. It does this - * by measuring the time between `rAF`s and continuously adjusting the - * number of items created each `rAF` to maintain the target framerate. - * Setting this to a higher number allows lower latency and higher - * throughput for event handlers and other tasks, but results in a - * longer time for the remaining items to complete rendering. - */ - targetFramerate: { - type: Number, - value: 20 - }, - - _targetFrameTime: { - type: Number, - computed: '__computeFrameTime(targetFramerate)' - } - - }; - - } - - static get observers() { - return [ '__itemsChanged(items.*)' ]; - } - - constructor() { - super(); - this.__instances = []; - this.__limit = Infinity; - this.__pool = []; - this.__renderDebouncer = null; - this.__itemsIdxToInstIdx = {}; - this.__chunkCount = null; - this.__lastChunkTime = null; - this.__sortFn = null; - this.__filterFn = null; - this.__observePaths = null; - /** @type {?function(new:Polymer.TemplateInstanceBase, *)} */ - this.__ctor = null; - this.__isDetached = true; - this.template = null; - } - - /** - * @override - * @return {void} - */ - disconnectedCallback() { - super.disconnectedCallback(); - this.__isDetached = true; - for (let i=0; i<this.__instances.length; i++) { - this.__detachInstance(i); - } - } - - /** - * @override - * @return {void} - */ - connectedCallback() { - super.connectedCallback(); - this.style.display = 'none'; - // only perform attachment if the element was previously detached. - if (this.__isDetached) { - this.__isDetached = false; - let wrappedParent = wrap(wrap(this).parentNode); - for (let i=0; i<this.__instances.length; i++) { - this.__attachInstance(i, wrappedParent); - } - } - } - - __ensureTemplatized() { - // Templatizing (generating the instance constructor) needs to wait - // until ready, since won't have its template content handed back to - // it until then - if (!this.__ctor) { - let template = this.template = /** @type {HTMLTemplateElement} */(this.querySelector('template')); - if (!template) { - // // Wait until childList changes and template should be there by then - let observer = new MutationObserver(() => { - if (this.querySelector('template')) { - observer.disconnect(); - this.__render(); - } else { - throw new Error('dom-repeat requires a <template> child'); - } - }); - observer.observe(this, {childList: true}); - return false; - } - // Template instance props that should be excluded from forwarding - let instanceProps = {}; - instanceProps[this.as] = true; - instanceProps[this.indexAs] = true; - instanceProps[this.itemsIndexAs] = true; - this.__ctor = templatize(template, this, { - mutableData: this.mutableData, - parentModel: true, - instanceProps: instanceProps, - /** - * @this {DomRepeat} - * @param {string} prop Property to set - * @param {*} value Value to set property to - */ - forwardHostProp: function(prop, value) { - let i$ = this.__instances; - for (let i=0, inst; (i<i$.length) && (inst=i$[i]); i++) { - inst.forwardHostProp(prop, value); - } - }, - /** - * @this {DomRepeat} - * @param {Object} inst Instance to notify - * @param {string} prop Property to notify - * @param {*} value Value to notify - */ - notifyInstanceProp: function(inst, prop, value) { - if (matches(this.as, prop)) { - let idx = inst[this.itemsIndexAs]; - if (prop == this.as) { - this.items[idx] = value; - } - let path = translate(this.as, `${JSCompiler_renameProperty('items', this)}.${idx}`, prop); - this.notifyPath(path, value); - } - } - }); - } - return true; - } - - __getMethodHost() { - // Technically this should be the owner of the outermost template. - // In shadow dom, this is always getRootNode().host, but we can - // approximate this via cooperation with our dataHost always setting - // `_methodHost` as long as there were bindings (or id's) on this - // instance causing it to get a dataHost. - return this.__dataHost._methodHost || this.__dataHost; - } - - __functionFromPropertyValue(functionOrMethodName) { - if (typeof functionOrMethodName === 'string') { - let methodName = functionOrMethodName; - let obj = this.__getMethodHost(); - return function() { return obj[methodName].apply(obj, arguments); }; - } - - return functionOrMethodName; - } - - __sortChanged(sort) { - this.__sortFn = this.__functionFromPropertyValue(sort); - if (this.items) { this.__debounceRender(this.__render); } - } - - __filterChanged(filter) { - this.__filterFn = this.__functionFromPropertyValue(filter); - if (this.items) { this.__debounceRender(this.__render); } - } - - __computeFrameTime(rate) { - return Math.ceil(1000/rate); - } - - __initializeChunking() { - if (this.initialCount) { - this.__limit = this.initialCount; - this.__chunkCount = this.initialCount; - this.__lastChunkTime = performance.now(); - } - } - - __tryRenderChunk() { - // Debounced so that multiple calls through `_render` between animation - // frames only queue one new rAF (e.g. array mutation & chunked render) - if (this.items && this.__limit < this.items.length) { - this.__debounceRender(this.__requestRenderChunk); - } - } - - __requestRenderChunk() { - requestAnimationFrame(()=>this.__renderChunk()); - } - - __renderChunk() { - // Simple auto chunkSize throttling algorithm based on feedback loop: - // measure actual time between frames and scale chunk count by ratio - // of target/actual frame time - let currChunkTime = performance.now(); - let ratio = this._targetFrameTime / (currChunkTime - this.__lastChunkTime); - this.__chunkCount = Math.round(this.__chunkCount * ratio) || 1; - this.__limit += this.__chunkCount; - this.__lastChunkTime = currChunkTime; - this.__debounceRender(this.__render); - } - - __observeChanged() { - this.__observePaths = this.observe && - this.observe.replace('.*', '.').split(' '); - } - - __itemsChanged(change) { - if (this.items && !Array.isArray(this.items)) { - console.warn('dom-repeat expected array for `items`, found', this.items); - } - // If path was to an item (e.g. 'items.3' or 'items.3.foo'), forward the - // path to that instance synchronously (returns false for non-item paths) - if (!this.__handleItemPath(change.path, change.value)) { - // Otherwise, the array was reset ('items') or spliced ('items.splices'), - // so queue a full refresh - this.__initializeChunking(); - this.__debounceRender(this.__render); - } - } - - __handleObservedPaths(path) { - // Handle cases where path changes should cause a re-sort/filter - if (this.__sortFn || this.__filterFn) { - if (!path) { - // Always re-render if the item itself changed - this.__debounceRender(this.__render, this.delay); - } else if (this.__observePaths) { - // Otherwise, re-render if the path changed matches an observed path - let paths = this.__observePaths; - for (let i=0; i<paths.length; i++) { - if (path.indexOf(paths[i]) === 0) { - this.__debounceRender(this.__render, this.delay); - } - } - } - } - } - - /** - * @param {function(this:DomRepeat)} fn Function to debounce. - * @param {number=} delay Delay in ms to debounce by. - */ - __debounceRender(fn, delay = 0) { - this.__renderDebouncer = Debouncer.debounce( - this.__renderDebouncer - , delay > 0 ? timeOut.after(delay) : microTask - , fn.bind(this)); - enqueueDebouncer(this.__renderDebouncer); - } - - /** - * Forces the element to render its content. Normally rendering is - * asynchronous to a provoking change. This is done for efficiency so - * that multiple changes trigger only a single render. The render method - * should be called if, for example, template rendering is required to - * validate application state. - * @return {void} - */ - render() { - // Queue this repeater, then flush all in order - this.__debounceRender(this.__render); - flush(); - } - - __render() { - if (!this.__ensureTemplatized()) { - // No template found yet - return; - } - this.__applyFullRefresh(); - // Reset the pool - // TODO(kschaaf): Reuse pool across turns and nested templates - // Now that objects/arrays are re-evaluated when set, we can safely - // reuse pooled instances across turns, however we still need to decide - // semantics regarding how long to hold, how many to hold, etc. - this.__pool.length = 0; - // Set rendered item count - this._setRenderedItemCount(this.__instances.length); - // Notify users - this.dispatchEvent(new CustomEvent('dom-change', { - bubbles: true, - composed: true - })); - // Check to see if we need to render more items - this.__tryRenderChunk(); - } - - __applyFullRefresh() { - let items = this.items || []; - let isntIdxToItemsIdx = new Array(items.length); - for (let i=0; i<items.length; i++) { - isntIdxToItemsIdx[i] = i; - } - // Apply user filter - if (this.__filterFn) { - isntIdxToItemsIdx = isntIdxToItemsIdx.filter((i, idx, array) => - this.__filterFn(items[i], idx, array)); - } - // Apply user sort - if (this.__sortFn) { - isntIdxToItemsIdx.sort((a, b) => this.__sortFn(items[a], items[b])); - } - // items->inst map kept for item path forwarding - const itemsIdxToInstIdx = this.__itemsIdxToInstIdx = {}; - let instIdx = 0; - // Generate instances and assign items - const limit = Math.min(isntIdxToItemsIdx.length, this.__limit); - for (; instIdx<limit; instIdx++) { - let inst = this.__instances[instIdx]; - let itemIdx = isntIdxToItemsIdx[instIdx]; - let item = items[itemIdx]; - itemsIdxToInstIdx[itemIdx] = instIdx; - if (inst) { - inst._setPendingProperty(this.as, item); - inst._setPendingProperty(this.indexAs, instIdx); - inst._setPendingProperty(this.itemsIndexAs, itemIdx); - inst._flushProperties(); - } else { - this.__insertInstance(item, instIdx, itemIdx); - } - } - // Remove any extra instances from previous state - for (let i=this.__instances.length-1; i>=instIdx; i--) { - this.__detachAndRemoveInstance(i); - } - } - - __detachInstance(idx) { - let inst = this.__instances[idx]; - const wrappedRoot = wrap(inst.root); - for (let i=0; i<inst.children.length; i++) { - let el = inst.children[i]; - wrappedRoot.appendChild(el); - } - return inst; - } - - __attachInstance(idx, parent) { - let inst = this.__instances[idx]; - // Note, this is pre-wrapped as an optimization - parent.insertBefore(inst.root, this); - } - - __detachAndRemoveInstance(idx) { - let inst = this.__detachInstance(idx); - if (inst) { - this.__pool.push(inst); - } - this.__instances.splice(idx, 1); - } - - __stampInstance(item, instIdx, itemIdx) { - let model = {}; - model[this.as] = item; - model[this.indexAs] = instIdx; - model[this.itemsIndexAs] = itemIdx; - return new this.__ctor(model); - } - - __insertInstance(item, instIdx, itemIdx) { - let inst = this.__pool.pop(); - if (inst) { - // TODO(kschaaf): If the pool is shared across turns, hostProps - // need to be re-set to reused instances in addition to item - inst._setPendingProperty(this.as, item); - inst._setPendingProperty(this.indexAs, instIdx); - inst._setPendingProperty(this.itemsIndexAs, itemIdx); - inst._flushProperties(); - } else { - inst = this.__stampInstance(item, instIdx, itemIdx); - } - let beforeRow = this.__instances[instIdx + 1]; - let beforeNode = beforeRow ? beforeRow.children[0] : this; - wrap(wrap(this).parentNode).insertBefore(inst.root, beforeNode); - this.__instances[instIdx] = inst; - return inst; - } - - // Implements extension point from Templatize mixin - /** - * Shows or hides the template instance top level child elements. For - * text nodes, `textContent` is removed while "hidden" and replaced when - * "shown." - * @param {boolean} hidden Set to true to hide the children; - * set to false to show them. - * @return {void} - * @protected - */ - _showHideChildren(hidden) { - for (let i=0; i<this.__instances.length; i++) { - this.__instances[i]._showHideChildren(hidden); - } - } - - // Called as a side effect of a host items.<key>.<path> path change, - // responsible for notifying item.<path> changes to inst for key - __handleItemPath(path, value) { - let itemsPath = path.slice(6); // 'items.'.length == 6 - let dot = itemsPath.indexOf('.'); - let itemsIdx = dot < 0 ? itemsPath : itemsPath.substring(0, dot); - // If path was index into array... - if (itemsIdx == parseInt(itemsIdx, 10)) { - let itemSubPath = dot < 0 ? '' : itemsPath.substring(dot+1); - // If the path is observed, it will trigger a full refresh - this.__handleObservedPaths(itemSubPath); - // Note, even if a rull refresh is triggered, always do the path - // notification because unless mutableData is used for dom-repeat - // and all elements in the instance subtree, a full refresh may - // not trigger the proper update. - let instIdx = this.__itemsIdxToInstIdx[itemsIdx]; - let inst = this.__instances[instIdx]; - if (inst) { - let itemPath = this.as + (itemSubPath ? '.' + itemSubPath : ''); - // This is effectively `notifyPath`, but avoids some of the overhead - // of the public API - inst._setPendingPropertyOrPath(itemPath, value, false, true); - inst._flushProperties(); - } - return true; - } - } - - /** - * Returns the item associated with a given element stamped by - * this `dom-repeat`. - * - * Note, to modify sub-properties of the item, - * `modelForElement(el).set('item.<sub-prop>', value)` - * should be used. - * - * @param {!HTMLElement} el Element for which to return the item. - * @return {*} Item associated with the element. - */ - itemForElement(el) { - let instance = this.modelForElement(el); - return instance && instance[this.as]; - } - - /** - * Returns the inst index for a given element stamped by this `dom-repeat`. - * If `sort` is provided, the index will reflect the sorted order (rather - * than the original array order). - * - * @param {!HTMLElement} el Element for which to return the index. - * @return {?number} Row index associated with the element (note this may - * not correspond to the array index if a user `sort` is applied). - */ - indexForElement(el) { - let instance = this.modelForElement(el); - return instance && instance[this.indexAs]; - } - - /** - * Returns the template "model" associated with a given element, which - * serves as the binding scope for the template instance the element is - * contained in. A template model - * should be used to manipulate data associated with this template instance. - * - * Example: - * - * let model = modelForElement(el); - * if (model.index < 10) { - * model.set('item.checked', true); - * } - * - * @param {!HTMLElement} el Element for which to return a template model. - * @return {TemplateInstanceBase} Model representing the binding scope for - * the element. - */ - modelForElement(el) { - return modelForElement(this.template, el); - } - -} - -customElements.define(DomRepeat.is, DomRepeat); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/class.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/class.js deleted file mode 100644 index a35c0c5c84d..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/class.js +++ /dev/null @@ -1,534 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ - -import { LegacyElementMixin } from './legacy-element-mixin.js'; -import { legacyOptimizations } from '../utils/settings.js'; - -const lifecycleProps = { - attached: true, - detached: true, - ready: true, - created: true, - beforeRegister: true, - registered: true, - attributeChanged: true, - listeners: true, - hostAttributes: true -}; - -const excludeOnInfo = { - attached: true, - detached: true, - ready: true, - created: true, - beforeRegister: true, - registered: true, - attributeChanged: true, - behaviors: true, - _noAccessors: true -}; - -const excludeOnBehaviors = Object.assign({ - listeners: true, - hostAttributes: true, - properties: true, - observers: true, -}, excludeOnInfo); - -function copyProperties(source, target, excludeProps) { - const noAccessors = source._noAccessors; - const propertyNames = Object.getOwnPropertyNames(source); - for (let i = 0; i < propertyNames.length; i++) { - let p = propertyNames[i]; - if (p in excludeProps) { - continue; - } - if (noAccessors) { - target[p] = source[p]; - } else { - let pd = Object.getOwnPropertyDescriptor(source, p); - if (pd) { - // ensure property is configurable so that a later behavior can - // re-configure it. - pd.configurable = true; - Object.defineProperty(target, p, pd); - } - } - } -} - -/** - * Applies a "legacy" behavior or array of behaviors to the provided class. - * - * Note: this method will automatically also apply the `LegacyElementMixin` - * to ensure that any legacy behaviors can rely on legacy Polymer API on - * the underlying element. - * - * @function - * @template T - * @param {!Object|!Array<!Object>} behaviors Behavior object or array of behaviors. - * @param {function(new:T)} klass Element class. - * @return {?} Returns a new Element class extended by the - * passed in `behaviors` and also by `LegacyElementMixin`. - * @suppress {invalidCasts, checkTypes} - */ -export function mixinBehaviors(behaviors, klass) { - return GenerateClassFromInfo({}, LegacyElementMixin(klass), behaviors); -} - -// NOTE: -// 1.x -// Behaviors were mixed in *in reverse order* and de-duped on the fly. -// The rule was that behavior properties were copied onto the element -// prototype if and only if the property did not already exist. -// Given: Polymer{ behaviors: [A, B, C, A, B]}, property copy order was: -// (1), B, (2), A, (3) C. This means prototype properties win over -// B properties win over A win over C. This mirrors what would happen -// with inheritance if element extended B extended A extended C. -// -// Again given, Polymer{ behaviors: [A, B, C, A, B]}, the resulting -// `behaviors` array was [C, A, B]. -// Behavior lifecycle methods were called in behavior array order -// followed by the element, e.g. (1) C.created, (2) A.created, -// (3) B.created, (4) element.created. There was no support for -// super, and "super-behavior" methods were callable only by name). -// -// 2.x -// Behaviors are made into proper mixins which live in the -// element's prototype chain. Behaviors are placed in the element prototype -// eldest to youngest and de-duped youngest to oldest: -// So, first [A, B, C, A, B] becomes [C, A, B] then, -// the element prototype becomes (oldest) (1) PolymerElement, (2) class(C), -// (3) class(A), (4) class(B), (5) class(Polymer({...})). -// Result: -// This means element properties win over B properties win over A win -// over C. (same as 1.x) -// If lifecycle is called (super then me), order is -// (1) C.created, (2) A.created, (3) B.created, (4) element.created -// (again same as 1.x) -function applyBehaviors(proto, behaviors, lifecycle) { - for (let i=0; i<behaviors.length; i++) { - applyInfo(proto, behaviors[i], lifecycle, excludeOnBehaviors); - } -} - -function applyInfo(proto, info, lifecycle, excludeProps) { - copyProperties(info, proto, excludeProps); - for (let p in lifecycleProps) { - if (info[p]) { - lifecycle[p] = lifecycle[p] || []; - lifecycle[p].push(info[p]); - } - } -} - -/** - * @param {Array} behaviors List of behaviors to flatten. - * @param {Array=} list Target list to flatten behaviors into. - * @param {Array=} exclude List of behaviors to exclude from the list. - * @return {!Array} Returns the list of flattened behaviors. - */ -function flattenBehaviors(behaviors, list, exclude) { - list = list || []; - for (let i=behaviors.length-1; i >= 0; i--) { - let b = behaviors[i]; - if (b) { - if (Array.isArray(b)) { - flattenBehaviors(b, list); - } else { - // dedup - if (list.indexOf(b) < 0 && (!exclude || exclude.indexOf(b) < 0)) { - list.unshift(b); - } - } - } else { - console.warn('behavior is null, check for missing or 404 import'); - } - } - return list; -} - -/** - * Copies property descriptors from source to target, overwriting all fields - * of any previous descriptor for a property *except* for `value`, which is - * merged in from the target if it does not exist on the source. - * - * @param {*} target Target properties object - * @param {*} source Source properties object - */ -function mergeProperties(target, source) { - for (const p in source) { - const targetInfo = target[p]; - const sourceInfo = source[p]; - if (!('value' in sourceInfo) && targetInfo && ('value' in targetInfo)) { - target[p] = Object.assign({value: targetInfo.value}, sourceInfo); - } else { - target[p] = sourceInfo; - } - } -} - -/* Note about construction and extension of legacy classes. - [Changed in Q4 2018 to optimize performance.] - - When calling `Polymer` or `mixinBehaviors`, the generated class below is - made. The list of behaviors was previously made into one generated class per - behavior, but this is no longer the case as behaviors are now called - manually. Note, there may *still* be multiple generated classes in the - element's prototype chain if extension is used with `mixinBehaviors`. - - The generated class is directly tied to the info object and behaviors - used to create it. That list of behaviors is filtered so it's only the - behaviors not active on the superclass. In order to call through to the - entire list of lifecycle methods, it's important to call `super`. - - The element's `properties` and `observers` are controlled via the finalization - mechanism provided by `PropertiesMixin`. `Properties` and `observers` are - collected by manually traversing the prototype chain and merging. - - To limit changes, the `_registered` method is called via `_initializeProperties` - and not `_finalizeClass`. - -*/ -/** - * @param {!PolymerInit} info Polymer info object - * @param {function(new:HTMLElement)} Base base class to extend with info object - * @param {Object=} behaviors behaviors to copy into the element - * @return {function(new:HTMLElement)} Generated class - * @suppress {checkTypes} - * @private - */ -function GenerateClassFromInfo(info, Base, behaviors) { - - // manages behavior and lifecycle processing (filled in after class definition) - let behaviorList; - const lifecycle = {}; - - /** @private */ - class PolymerGenerated extends Base { - - // explicitly not calling super._finalizeClass - static _finalizeClass() { - // if calling via a subclass that hasn't been generated, pass through to super - if (!this.hasOwnProperty(JSCompiler_renameProperty('generatedFrom', this))) { - super._finalizeClass(); - } else { - // interleave properties and observers per behavior and `info` - if (behaviorList) { - for (let i=0, b; i < behaviorList.length; i++) { - b = behaviorList[i]; - if (b.properties) { - this.createProperties(b.properties); - } - if (b.observers) { - this.createObservers(b.observers, b.properties); - } - } - } - if (info.properties) { - this.createProperties(info.properties); - } - if (info.observers) { - this.createObservers(info.observers, info.properties); - } - // make sure to prepare the element template - this._prepareTemplate(); - } - } - - static get properties() { - const properties = {}; - if (behaviorList) { - for (let i=0; i < behaviorList.length; i++) { - mergeProperties(properties, behaviorList[i].properties); - } - } - mergeProperties(properties, info.properties); - return properties; - } - - static get observers() { - let observers = []; - if (behaviorList) { - for (let i=0, b; i < behaviorList.length; i++) { - b = behaviorList[i]; - if (b.observers) { - observers = observers.concat(b.observers); - } - } - } - if (info.observers) { - observers = observers.concat(info.observers); - } - return observers; - } - - /** - * @return {void} - */ - created() { - super.created(); - const list = lifecycle.created; - if (list) { - for (let i=0; i < list.length; i++) { - list[i].call(this); - } - } - } - - /** - * @return {void} - */ - _registered() { - /* NOTE: `beforeRegister` is called here for bc, but the behavior - is different than in 1.x. In 1.0, the method was called *after* - mixing prototypes together but *before* processing of meta-objects. - However, dynamic effects can still be set here and can be done either - in `beforeRegister` or `registered`. It is no longer possible to set - `is` in `beforeRegister` as you could in 1.x. - */ - // only proceed if the generated class' prototype has not been registered. - const generatedProto = PolymerGenerated.prototype; - if (!generatedProto.hasOwnProperty('__hasRegisterFinished')) { - generatedProto.__hasRegisterFinished = true; - // ensure superclass is registered first. - super._registered(); - // copy properties onto the generated class lazily if we're optimizing, - if (legacyOptimizations) { - copyPropertiesToProto(generatedProto); - } - // make sure legacy lifecycle is called on the *element*'s prototype - // and not the generated class prototype; if the element has been - // extended, these are *not* the same. - const proto = Object.getPrototypeOf(this); - let list = lifecycle.beforeRegister; - if (list) { - for (let i=0; i < list.length; i++) { - list[i].call(proto); - } - } - list = lifecycle.registered; - if (list) { - for (let i=0; i < list.length; i++) { - list[i].call(proto); - } - } - } - } - - /** - * @return {void} - */ - _applyListeners() { - super._applyListeners(); - const list = lifecycle.listeners; - if (list) { - for (let i=0; i < list.length; i++) { - const listeners = list[i]; - if (listeners) { - for (let l in listeners) { - this._addMethodEventListenerToNode(this, l, listeners[l]); - } - } - } - } - } - - // note: exception to "super then me" rule; - // do work before calling super so that super attributes - // only apply if not already set. - /** - * @return {void} - */ - _ensureAttributes() { - const list = lifecycle.hostAttributes; - if (list) { - for (let i=list.length-1; i >= 0; i--) { - const hostAttributes = list[i]; - for (let a in hostAttributes) { - this._ensureAttribute(a, hostAttributes[a]); - } - } - } - super._ensureAttributes(); - } - - /** - * @return {void} - */ - ready() { - super.ready(); - let list = lifecycle.ready; - if (list) { - for (let i=0; i < list.length; i++) { - list[i].call(this); - } - } - } - - /** - * @return {void} - */ - attached() { - super.attached(); - let list = lifecycle.attached; - if (list) { - for (let i=0; i < list.length; i++) { - list[i].call(this); - } - } - } - - /** - * @return {void} - */ - detached() { - super.detached(); - let list = lifecycle.detached; - if (list) { - for (let i=0; i < list.length; i++) { - list[i].call(this); - } - } - } - - /** - * Implements native Custom Elements `attributeChangedCallback` to - * set an attribute value to a property via `_attributeToProperty`. - * - * @param {string} name Name of attribute that changed - * @param {?string} old Old attribute value - * @param {?string} value New attribute value - * @return {void} - */ - attributeChanged(name, old, value) { - super.attributeChanged(); - let list = lifecycle.attributeChanged; - if (list) { - for (let i=0; i < list.length; i++) { - list[i].call(this, name, old, value); - } - } - } - } - - // apply behaviors, note actual copying is done lazily at first instance creation - if (behaviors) { - // NOTE: ensure the behavior is extending a class with - // legacy element api. This is necessary since behaviors expect to be able - // to access 1.x legacy api. - if (!Array.isArray(behaviors)) { - behaviors = [behaviors]; - } - let superBehaviors = Base.prototype.behaviors; - // get flattened, deduped list of behaviors *not* already on super class - behaviorList = flattenBehaviors(behaviors, null, superBehaviors); - PolymerGenerated.prototype.behaviors = superBehaviors ? - superBehaviors.concat(behaviors) : behaviorList; - } - - const copyPropertiesToProto = (proto) => { - if (behaviorList) { - applyBehaviors(proto, behaviorList, lifecycle); - } - applyInfo(proto, info, lifecycle, excludeOnInfo); - }; - - // copy properties if we're not optimizing - if (!legacyOptimizations) { - copyPropertiesToProto(PolymerGenerated.prototype); - } - - PolymerGenerated.generatedFrom = info; - - return PolymerGenerated; -} - -/** - * Generates a class that extends `LegacyElement` based on the - * provided info object. Metadata objects on the `info` object - * (`properties`, `observers`, `listeners`, `behaviors`, `is`) are used - * for Polymer's meta-programming systems, and any functions are copied - * to the generated class. - * - * Valid "metadata" values are as follows: - * - * `is`: String providing the tag name to register the element under. In - * addition, if a `dom-module` with the same id exists, the first template - * in that `dom-module` will be stamped into the shadow root of this element, - * with support for declarative event listeners (`on-...`), Polymer data - * bindings (`[[...]]` and `{{...}}`), and id-based node finding into - * `this.$`. - * - * `properties`: Object describing property-related metadata used by Polymer - * features (key: property names, value: object containing property metadata). - * Valid keys in per-property metadata include: - * - `type` (String|Number|Object|Array|...): Used by - * `attributeChangedCallback` to determine how string-based attributes - * are deserialized to JavaScript property values. - * - `notify` (boolean): Causes a change in the property to fire a - * non-bubbling event called `<property>-changed`. Elements that have - * enabled two-way binding to the property use this event to observe changes. - * - `readOnly` (boolean): Creates a getter for the property, but no setter. - * To set a read-only property, use the private setter method - * `_setProperty(property, value)`. - * - `observer` (string): Observer method name that will be called when - * the property changes. The arguments of the method are - * `(value, previousValue)`. - * - `computed` (string): String describing method and dependent properties - * for computing the value of this property (e.g. `'computeFoo(bar, zot)'`). - * Computed properties are read-only by default and can only be changed - * via the return value of the computing method. - * - * `observers`: Array of strings describing multi-property observer methods - * and their dependent properties (e.g. `'observeABC(a, b, c)'`). - * - * `listeners`: Object describing event listeners to be added to each - * instance of this element (key: event name, value: method name). - * - * `behaviors`: Array of additional `info` objects containing metadata - * and callbacks in the same format as the `info` object here which are - * merged into this element. - * - * `hostAttributes`: Object listing attributes to be applied to the host - * once created (key: attribute name, value: attribute value). Values - * are serialized based on the type of the value. Host attributes should - * generally be limited to attributes such as `tabIndex` and `aria-...`. - * Attributes in `hostAttributes` are only applied if a user-supplied - * attribute is not already present (attributes in markup override - * `hostAttributes`). - * - * In addition, the following Polymer-specific callbacks may be provided: - * - `registered`: called after first instance of this element, - * - `created`: called during `constructor` - * - `attached`: called during `connectedCallback` - * - `detached`: called during `disconnectedCallback` - * - `ready`: called before first `attached`, after all properties of - * this element have been propagated to its template and all observers - * have run - * - * @param {!PolymerInit} info Object containing Polymer metadata and functions - * to become class methods. - * @template T - * @param {function(T):T} mixin Optional mixin to apply to legacy base class - * before extending with Polymer metaprogramming. - * @return {function(new:HTMLElement)} Generated class - */ -export const Class = function(info, mixin) { - if (!info) { - console.warn('Polymer.Class requires `info` argument'); - } - let klass = mixin ? mixin(LegacyElementMixin(HTMLElement)) : - LegacyElementMixin(HTMLElement); - klass = GenerateClassFromInfo(info, klass, info.behaviors); - // decorate klass with registration info - klass.is = klass.prototype.is = info.is; - return klass; -}; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/legacy-data-mixin.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/legacy-data-mixin.js deleted file mode 100644 index b2a255386d4..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/legacy-data-mixin.js +++ /dev/null @@ -1,181 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ - -import { Class } from './class.js'; -import { Polymer } from '../../polymer-legacy.js'; -import { dedupingMixin } from '../utils/mixin.js'; -import { templatize } from '../utils/templatize.js'; - -const UndefinedArgumentError = class extends Error { - constructor(message, arg) { - super(message); - this.arg = arg; - this.name = this.constructor.name; - // Affordances for ensuring instanceof works after babel ES5 compilation - // TODO(kschaaf): Remove after polymer CLI updates to newer Babel that - // sets the constructor/prototype correctly for subclassed builtins - this.constructor = UndefinedArgumentError; - this.__proto__ = UndefinedArgumentError.prototype; - } -}; - -/** - * Wraps effect functions to catch `UndefinedArgumentError`s and warn. - * - * @param {Object=} effect Effect metadata object - * @param {Object=} fnName Name of user function, if known - * @return {?Object|undefined} Effect metadata object - */ -function wrapEffect(effect, fnName) { - if (effect && effect.fn) { - const fn = effect.fn; - effect.fn = function() { - try { - fn.apply(this, arguments); - } catch (e) { - if (e instanceof UndefinedArgumentError) { - console.warn(`Argument '${e.arg}'${fnName ?` for method '${fnName}'` : ''} was undefined. Ensure it has a default value, or else ensure the method handles the argument being undefined.`); - } else { - throw e; - } - } - }; - } - return effect; -} - -/** - * Mixin to selectively add back Polymer 1.x's `undefined` rules - * governing when observers & computing functions run based - * on all arguments being defined (reference https://www.polymer-project.org/1.0/docs/devguide/observers#multi-property-observers). - * - * When loaded, all legacy elements (defined with `Polymer({...})`) - * will have the mixin applied. The mixin only restores legacy data handling - * if `_legacyUndefinedCheck: true` is set on the element's prototype. - * - * This mixin is intended for use to help migration from Polymer 1.x to - * 2.x+ by allowing legacy code to work while identifying observers and - * computing functions that need undefined checks to work without - * the mixin in Polymer 2. - * - * @mixinFunction - * @polymer - * @summary Mixin to selectively add back Polymer 1.x's `undefined` rules - * governing when observers & computing functions run. - */ -export const LegacyDataMixin = dedupingMixin(superClass => { - - /** - * @unrestricted - * @private - */ - class LegacyDataMixin extends superClass { - /** - * Overrides `Polymer.PropertyEffects` to add `undefined` argument - * checking to match Polymer 1.x style rules - * - * @param {!Array<!MethodArg>} args Array of argument metadata - * @param {string} path Property/path name that triggered the method effect - * @param {Object} props Bag of current property changes - * @return {Array<*>} Array of argument values - * @private - */ - _marshalArgs(args, path, props) { - const vals = super._marshalArgs(args, path, props); - // Per legacy data rules, single-property observers (whether in `properties` - // and in `observers`) are called regardless of whether their argument is - // undefined or not. Multi-property observers must have all arguments defined - if (this._legacyUndefinedCheck && vals.length > 1) { - for (let i=0; i<vals.length; i++) { - if (vals[i] === undefined) { - // Break out of effect's control flow; will be caught in - // wrapped property effect function below - const name = args[i].name; - throw new UndefinedArgumentError(`Argument '${name}' is undefined.`, name); - } - } - } - return vals; - } - - /** - * Overrides `Polyer.PropertyEffects` to wrap effect functions to - * catch `UndefinedArgumentError`s and warn. - * - * @param {string} property Property that should trigger the effect - * @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES - * @param {Object=} effect Effect metadata object - * @return {void} - * @protected - */ - _addPropertyEffect(property, type, effect) { - return super._addPropertyEffect(property, type, - wrapEffect(effect, effect && effect.info && effect.info.methodName)); - } - - /** - * Overrides `Polyer.PropertyEffects` to wrap effect functions to - * catch `UndefinedArgumentError`s and warn. - * - * @param {Object} templateInfo Template metadata to add effect to - * @param {string} prop Property that should trigger the effect - * @param {Object=} effect Effect metadata object - * @return {void} - * @protected - */ - static _addTemplatePropertyEffect(templateInfo, prop, effect) { - return super._addTemplatePropertyEffect(templateInfo, prop, wrapEffect(effect)); - } - - } - - return LegacyDataMixin; - -}); - -// LegacyDataMixin is applied to base class _before_ metaprogramming, to -// ensure override of _addPropertyEffect et.al. are used by metaprogramming -// performed in _finalizeClass -Polymer.Class = (info, mixin) => Class(info, - superClass => mixin ? - mixin(LegacyDataMixin(superClass)) : - LegacyDataMixin(superClass) -); - -// Apply LegacyDataMixin to Templatizer instances as well, and defer -// runtime switch to the root's host (_methodHost) -/** - * @mixinFunction - * @polymer - */ -const TemplatizeMixin = - dedupingMixin(superClass => { - /** - * @constructor - * @extends {HTMLElement} - */ - const legacyBase = LegacyDataMixin(superClass); - /** - * @private - */ - class TemplateLegacy extends legacyBase { - get _legacyUndefinedCheck() { - return this._methodHost && this._methodHost._legacyUndefinedCheck; - } - } - /** @type {!Polymer_PropertyEffects} */ - TemplateLegacy.prototype._methodHost; - return TemplateLegacy; - }); - -templatize.mixin = TemplatizeMixin; - -console.info('LegacyDataMixin will be applied to all legacy elements.\n' + - 'Set `_legacyUndefinedCheck: true` on element class to enable.'); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/legacy-element-mixin.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/legacy-element-mixin.js deleted file mode 100644 index bd591b6dd34..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/legacy-element-mixin.js +++ /dev/null @@ -1,1059 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import '../../../shadycss/entrypoints/apply-shim.js'; -import { ElementMixin } from '../mixins/element-mixin.js'; -import { GestureEventListeners } from '../mixins/gesture-event-listeners.js'; -import { dedupingMixin } from '../utils/mixin.js'; -import '../utils/render-status.js'; -import '../utils/unresolved.js'; -import { dom, matchesSelector } from './polymer.dom.js'; -import { setTouchAction } from '../utils/gestures.js'; -import { Debouncer } from '../utils/debounce.js'; -import { timeOut, microTask } from '../utils/async.js'; -import { get } from '../utils/path.js'; -import { wrap } from '../utils/wrap.js'; - -let styleInterface = window.ShadyCSS; - -/** - * Element class mixin that provides Polymer's "legacy" API intended to be - * backward-compatible to the greatest extent possible with the API - * found on the Polymer 1.x `Polymer.Base` prototype applied to all elements - * defined using the `Polymer({...})` function. - * - * @mixinFunction - * @polymer - * @appliesMixin ElementMixin - * @appliesMixin GestureEventListeners - * @property isAttached {boolean} Set to `true` in this element's - * `connectedCallback` and `false` in `disconnectedCallback` - * @summary Element class mixin that provides Polymer's "legacy" API - */ -export const LegacyElementMixin = dedupingMixin((base) => { - /** - * @constructor - * @implements {Polymer_ElementMixin} - * @implements {Polymer_GestureEventListeners} - * @extends {HTMLElement} - * @private - */ - const legacyElementBase = GestureEventListeners(ElementMixin(base)); - - /** - * Map of simple names to touch action names - * @dict - */ - const DIRECTION_MAP = { - 'x': 'pan-x', - 'y': 'pan-y', - 'none': 'none', - 'all': 'auto' - }; - - /** - * @polymer - * @mixinClass - * @extends {legacyElementBase} - * @implements {Polymer_LegacyElementMixin} - * @unrestricted - */ - class LegacyElement extends legacyElementBase { - - constructor() { - super(); - /** @type {boolean} */ - this.isAttached; - /** @type {?WeakMap<!Element, !Object<string, !Function>>} */ - this.__boundListeners; - /** @type {?Object<string, ?Function>} */ - this._debouncers; - } - - /** - * Forwards `importMeta` from the prototype (i.e. from the info object - * passed to `Polymer({...})`) to the static API. - * - * @return {!Object} The `import.meta` object set on the prototype - * @suppress {missingProperties} `this` is always in the instance in - * closure for some reason even in a static method, rather than the class - */ - static get importMeta() { - return this.prototype.importMeta; - } - - /** - * Legacy callback called during the `constructor`, for overriding - * by the user. - * @override - * @return {void} - */ - created() {} - - /** - * Provides an implementation of `connectedCallback` - * which adds Polymer legacy API's `attached` method. - * @return {void} - * @override - */ - connectedCallback() { - super.connectedCallback(); - this.isAttached = true; - this.attached(); - } - - /** - * Legacy callback called during `connectedCallback`, for overriding - * by the user. - * @override - * @return {void} - */ - attached() {} - - /** - * Provides an implementation of `disconnectedCallback` - * which adds Polymer legacy API's `detached` method. - * @return {void} - * @override - */ - disconnectedCallback() { - super.disconnectedCallback(); - this.isAttached = false; - this.detached(); - } - - /** - * Legacy callback called during `disconnectedCallback`, for overriding - * by the user. - * @override - * @return {void} - */ - detached() {} - - /** - * Provides an override implementation of `attributeChangedCallback` - * which adds the Polymer legacy API's `attributeChanged` method. - * @param {string} name Name of attribute. - * @param {?string} old Old value of attribute. - * @param {?string} value Current value of attribute. - * @param {?string} namespace Attribute namespace. - * @return {void} - * @override - */ - attributeChangedCallback(name, old, value, namespace) { - if (old !== value) { - super.attributeChangedCallback(name, old, value, namespace); - this.attributeChanged(name, old, value); - } - } - - /** - * Legacy callback called during `attributeChangedChallback`, for overriding - * by the user. - * @param {string} name Name of attribute. - * @param {?string} old Old value of attribute. - * @param {?string} value Current value of attribute. - * @return {void} - * @override - */ - attributeChanged(name, old, value) {} // eslint-disable-line no-unused-vars - - /** - * Overrides the default `Polymer.PropertyEffects` implementation to - * add support for class initialization via the `_registered` callback. - * This is called only when the first instance of the element is created. - * - * @return {void} - * @override - * @suppress {invalidCasts} - */ - _initializeProperties() { - let proto = Object.getPrototypeOf(this); - if (!proto.hasOwnProperty('__hasRegisterFinished')) { - this._registered(); - // backstop in case the `_registered` implementation does not set this - proto.__hasRegisterFinished = true; - } - super._initializeProperties(); - this.root = /** @type {HTMLElement} */(this); - this.created(); - // Ensure listeners are applied immediately so that they are - // added before declarative event listeners. This allows an element to - // decorate itself via an event prior to any declarative listeners - // seeing the event. Note, this ensures compatibility with 1.x ordering. - this._applyListeners(); - } - - /** - * Called automatically when an element is initializing. - * Users may override this method to perform class registration time - * work. The implementation should ensure the work is performed - * only once for the class. - * @protected - * @return {void} - * @override - */ - _registered() {} - - /** - * Overrides the default `Polymer.PropertyEffects` implementation to - * add support for installing `hostAttributes` and `listeners`. - * - * @return {void} - * @override - */ - ready() { - this._ensureAttributes(); - super.ready(); - } - - /** - * Ensures an element has required attributes. Called when the element - * is being readied via `ready`. Users should override to set the - * element's required attributes. The implementation should be sure - * to check and not override existing attributes added by - * the user of the element. Typically, setting attributes should be left - * to the element user and not done here; reasonable exceptions include - * setting aria roles and focusability. - * @protected - * @return {void} - * @override - */ - _ensureAttributes() {} - - /** - * Adds element event listeners. Called when the element - * is being readied via `ready`. Users should override to - * add any required element event listeners. - * In performance critical elements, the work done here should be kept - * to a minimum since it is done before the element is rendered. In - * these elements, consider adding listeners asynchronously so as not to - * block render. - * @protected - * @return {void} - * @override - */ - _applyListeners() {} - - /** - * Converts a typed JavaScript value to a string. - * - * Note this method is provided as backward-compatible legacy API - * only. It is not directly called by any Polymer features. To customize - * how properties are serialized to attributes for attribute bindings and - * `reflectToAttribute: true` properties as well as this method, override - * the `_serializeValue` method provided by `Polymer.PropertyAccessors`. - * - * @param {*} value Value to deserialize - * @return {string | undefined} Serialized value - * @override - */ - serialize(value) { - return this._serializeValue(value); - } - - /** - * Converts a string to a typed JavaScript value. - * - * Note this method is provided as backward-compatible legacy API - * only. It is not directly called by any Polymer features. To customize - * how attributes are deserialized to properties for in - * `attributeChangedCallback`, override `_deserializeValue` method - * provided by `Polymer.PropertyAccessors`. - * - * @param {string} value String to deserialize - * @param {*} type Type to deserialize the string to - * @return {*} Returns the deserialized value in the `type` given. - * @override - */ - deserialize(value, type) { - return this._deserializeValue(value, type); - } - - /** - * Serializes a property to its associated attribute. - * - * Note this method is provided as backward-compatible legacy API - * only. It is not directly called by any Polymer features. - * - * @param {string} property Property name to reflect. - * @param {string=} attribute Attribute name to reflect. - * @param {*=} value Property value to reflect. - * @return {void} - * @override - */ - reflectPropertyToAttribute(property, attribute, value) { - this._propertyToAttribute(property, attribute, value); - } - - /** - * Sets a typed value to an HTML attribute on a node. - * - * Note this method is provided as backward-compatible legacy API - * only. It is not directly called by any Polymer features. - * - * @param {*} value Value to serialize. - * @param {string} attribute Attribute name to serialize to. - * @param {Element} node Element to set attribute to. - * @return {void} - * @override - */ - serializeValueToAttribute(value, attribute, node) { - this._valueToNodeAttribute(/** @type {Element} */ (node || this), value, attribute); - } - - /** - * Copies own properties (including accessor descriptors) from a source - * object to a target object. - * - * @param {Object} prototype Target object to copy properties to. - * @param {Object} api Source object to copy properties from. - * @return {Object} prototype object that was passed as first argument. - * @override - */ - extend(prototype, api) { - if (!(prototype && api)) { - return prototype || api; - } - let n$ = Object.getOwnPropertyNames(api); - for (let i=0, n; (i<n$.length) && (n=n$[i]); i++) { - let pd = Object.getOwnPropertyDescriptor(api, n); - if (pd) { - Object.defineProperty(prototype, n, pd); - } - } - return prototype; - } - - /** - * Copies props from a source object to a target object. - * - * Note, this method uses a simple `for...in` strategy for enumerating - * properties. To ensure only `ownProperties` are copied from source - * to target and that accessor implementations are copied, use `extend`. - * - * @param {!Object} target Target object to copy properties to. - * @param {!Object} source Source object to copy properties from. - * @return {!Object} Target object that was passed as first argument. - * @override - */ - mixin(target, source) { - for (let i in source) { - target[i] = source[i]; - } - return target; - } - - /** - * Sets the prototype of an object. - * - * Note this method is provided as backward-compatible legacy API - * only. It is not directly called by any Polymer features. - * @param {Object} object The object on which to set the prototype. - * @param {Object} prototype The prototype that will be set on the given - * `object`. - * @return {Object} Returns the given `object` with its prototype set - * to the given `prototype` object. - * @override - */ - chainObject(object, prototype) { - if (object && prototype && object !== prototype) { - object.__proto__ = prototype; - } - return object; - } - - /* **** Begin Template **** */ - - /** - * Calls `importNode` on the `content` of the `template` specified and - * returns a document fragment containing the imported content. - * - * @param {HTMLTemplateElement} template HTML template element to instance. - * @return {!DocumentFragment} Document fragment containing the imported - * template content. - * @override - * @suppress {missingProperties} go/missingfnprops - */ - instanceTemplate(template) { - let content = this.constructor._contentForTemplate(template); - let dom = /** @type {!DocumentFragment} */ - (document.importNode(content, true)); - return dom; - } - - /* **** Begin Events **** */ - - - - /** - * Dispatches a custom event with an optional detail value. - * - * @param {string} type Name of event type. - * @param {*=} detail Detail value containing event-specific - * payload. - * @param {{ bubbles: (boolean|undefined), cancelable: (boolean|undefined), - * composed: (boolean|undefined) }=} - * options Object specifying options. These may include: - * `bubbles` (boolean, defaults to `true`), - * `cancelable` (boolean, defaults to false), and - * `node` on which to fire the event (HTMLElement, defaults to `this`). - * @return {!Event} The new event that was fired. - * @override - */ - fire(type, detail, options) { - options = options || {}; - detail = (detail === null || detail === undefined) ? {} : detail; - let event = new Event(type, { - bubbles: options.bubbles === undefined ? true : options.bubbles, - cancelable: Boolean(options.cancelable), - composed: options.composed === undefined ? true: options.composed - }); - event.detail = detail; - let node = options.node || this; - wrap(node).dispatchEvent(event); - return event; - } - - /** - * Convenience method to add an event listener on a given element, - * late bound to a named method on this element. - * - * @param {?EventTarget} node Element to add event listener to. - * @param {string} eventName Name of event to listen for. - * @param {string} methodName Name of handler method on `this` to call. - * @return {void} - * @override - */ - listen(node, eventName, methodName) { - node = /** @type {!EventTarget} */ (node || this); - let hbl = this.__boundListeners || - (this.__boundListeners = new WeakMap()); - let bl = hbl.get(node); - if (!bl) { - bl = {}; - hbl.set(node, bl); - } - let key = eventName + methodName; - if (!bl[key]) { - bl[key] = this._addMethodEventListenerToNode( - /** @type {!Node} */ (node), eventName, methodName, this); - } - } - - /** - * Convenience method to remove an event listener from a given element, - * late bound to a named method on this element. - * - * @param {?EventTarget} node Element to remove event listener from. - * @param {string} eventName Name of event to stop listening to. - * @param {string} methodName Name of handler method on `this` to not call - anymore. - * @return {void} - * @override - */ - unlisten(node, eventName, methodName) { - node = /** @type {!EventTarget} */ (node || this); - let bl = this.__boundListeners && - this.__boundListeners.get(/** @type {!Element} */ (node)); - let key = eventName + methodName; - let handler = bl && bl[key]; - if (handler) { - this._removeEventListenerFromNode( - /** @type {!Node} */ (node), eventName, handler); - bl[key] = /** @type {?} */ (null); - } - } - - /** - * Override scrolling behavior to all direction, one direction, or none. - * - * Valid scroll directions: - * - 'all': scroll in any direction - * - 'x': scroll only in the 'x' direction - * - 'y': scroll only in the 'y' direction - * - 'none': disable scrolling for this node - * - * @param {string=} direction Direction to allow scrolling - * Defaults to `all`. - * @param {Element=} node Element to apply scroll direction setting. - * Defaults to `this`. - * @return {void} - * @override - */ - setScrollDirection(direction, node) { - setTouchAction( - /** @type {!Element} */ (node || this), - DIRECTION_MAP[direction] || 'auto'); - } - /* **** End Events **** */ - - /** - * Convenience method to run `querySelector` on this local DOM scope. - * - * This function calls `Polymer.dom(this.root).querySelector(slctr)`. - * - * @param {string} slctr Selector to run on this local DOM scope - * @return {Element} Element found by the selector, or null if not found. - * @override - */ - $$(slctr) { - // Note, no need to `wrap` this because root is always patched - return this.root.querySelector(slctr); - } - - /** - * Return the element whose local dom within which this element - * is contained. This is a shorthand for - * `this.getRootNode().host`. - * @this {Element} - */ - get domHost() { - let root = wrap(this).getRootNode(); - return (root instanceof DocumentFragment) ? /** @type {ShadowRoot} */ (root).host : root; - } - - /** - * Force this element to distribute its children to its local dom. - * This should not be necessary as of Polymer 2.0.2 and is provided only - * for backwards compatibility. - * @return {void} - * @override - */ - distributeContent() { - const thisEl = /** @type {Element} */ (this); - const domApi = /** @type {PolymerDomApi} */(dom(thisEl)); - if (window.ShadyDOM && domApi.shadowRoot) { - ShadyDOM.flush(); - } - } - - /** - * Returns a list of nodes that are the effective childNodes. The effective - * childNodes list is the same as the element's childNodes except that - * any `<content>` elements are replaced with the list of nodes distributed - * to the `<content>`, the result of its `getDistributedNodes` method. - * @return {!Array<!Node>} List of effective child nodes. - * @suppress {invalidCasts} LegacyElementMixin must be applied to an - * HTMLElement - * @override - */ - getEffectiveChildNodes() { - const thisEl = /** @type {Element} */ (this); - const domApi = /** @type {PolymerDomApi} */ (dom(thisEl)); - return domApi.getEffectiveChildNodes(); - } - - /** - * Returns a list of nodes distributed within this element that match - * `selector`. These can be dom children or elements distributed to - * children that are insertion points. - * @param {string} selector Selector to run. - * @return {!Array<!Node>} List of distributed elements that match selector. - * @suppress {invalidCasts} LegacyElementMixin must be applied to an - * HTMLElement - * @override - */ - queryDistributedElements(selector) { - const thisEl = /** @type {Element} */ (this); - const domApi = /** @type {PolymerDomApi} */ (dom(thisEl)); - return domApi.queryDistributedElements(selector); - } - - /** - * Returns a list of elements that are the effective children. The effective - * children list is the same as the element's children except that - * any `<content>` elements are replaced with the list of elements - * distributed to the `<content>`. - * - * @return {!Array<!Node>} List of effective children. - * @override - */ - getEffectiveChildren() { - let list = this.getEffectiveChildNodes(); - return list.filter(function(/** @type {!Node} */ n) { - return (n.nodeType === Node.ELEMENT_NODE); - }); - } - - /** - * Returns a string of text content that is the concatenation of the - * text content's of the element's effective childNodes (the elements - * returned by <a href="#getEffectiveChildNodes>getEffectiveChildNodes</a>. - * - * @return {string} List of effective children. - * @override - */ - getEffectiveTextContent() { - let cn = this.getEffectiveChildNodes(); - let tc = []; - for (let i=0, c; (c = cn[i]); i++) { - if (c.nodeType !== Node.COMMENT_NODE) { - tc.push(c.textContent); - } - } - return tc.join(''); - } - - /** - * Returns the first effective childNode within this element that - * match `selector`. These can be dom child nodes or elements distributed - * to children that are insertion points. - * @param {string} selector Selector to run. - * @return {Node} First effective child node that matches selector. - * @override - */ - queryEffectiveChildren(selector) { - let e$ = this.queryDistributedElements(selector); - return e$ && e$[0]; - } - - /** - * Returns a list of effective childNodes within this element that - * match `selector`. These can be dom child nodes or elements distributed - * to children that are insertion points. - * @param {string} selector Selector to run. - * @return {!Array<!Node>} List of effective child nodes that match - * selector. - * @override - */ - queryAllEffectiveChildren(selector) { - return this.queryDistributedElements(selector); - } - - /** - * Returns a list of nodes distributed to this element's `<slot>`. - * - * If this element contains more than one `<slot>` in its local DOM, - * an optional selector may be passed to choose the desired content. - * - * @param {string=} slctr CSS selector to choose the desired - * `<slot>`. Defaults to `content`. - * @return {!Array<!Node>} List of distributed nodes for the `<slot>`. - * @override - */ - getContentChildNodes(slctr) { - // Note, no need to `wrap` this because root is always - let content = this.root.querySelector(slctr || 'slot'); - return content ? - /** @type {PolymerDomApi} */ (dom(content)).getDistributedNodes() : - []; - } - - /** - * Returns a list of element children distributed to this element's - * `<slot>`. - * - * If this element contains more than one `<slot>` in its - * local DOM, an optional selector may be passed to choose the desired - * content. This method differs from `getContentChildNodes` in that only - * elements are returned. - * - * @param {string=} slctr CSS selector to choose the desired - * `<content>`. Defaults to `content`. - * @return {!Array<!HTMLElement>} List of distributed nodes for the - * `<slot>`. - * @suppress {invalidCasts} - * @override - */ - getContentChildren(slctr) { - let children = /** @type {!Array<!HTMLElement>} */(this.getContentChildNodes(slctr).filter(function(n) { - return (n.nodeType === Node.ELEMENT_NODE); - })); - return children; - } - - /** - * Checks whether an element is in this element's light DOM tree. - * - * @param {?Node} node The element to be checked. - * @return {boolean} true if node is in this element's light DOM tree. - * @suppress {invalidCasts} LegacyElementMixin must be applied to an - * HTMLElement - * @override - */ - isLightDescendant(node) { - const thisNode = /** @type {Node} */ (this); - return thisNode !== node && wrap(thisNode).contains(node) && - wrap(thisNode).getRootNode() === wrap(node).getRootNode(); - } - - /** - * Checks whether an element is in this element's local DOM tree. - * - * @param {!Element} node The element to be checked. - * @return {boolean} true if node is in this element's local DOM tree. - * @override - */ - isLocalDescendant(node) { - return this.root === wrap(node).getRootNode(); - } - - /** - * No-op for backwards compatibility. This should now be handled by - * ShadyCss library. - * @param {*} container Unused - * @param {*} shouldObserve Unused - * @return {void} - * @override - */ - scopeSubtree(container, shouldObserve) { // eslint-disable-line no-unused-vars - } - - /** - * Returns the computed style value for the given property. - * @param {string} property The css property name. - * @return {string} Returns the computed css property value for the given - * `property`. - * @suppress {invalidCasts} LegacyElementMixin must be applied to an - * HTMLElement - * @override - */ - getComputedStyleValue(property) { - return styleInterface.getComputedStyleValue(/** @type {!Element} */(this), property); - } - - // debounce - - /** - * Call `debounce` to collapse multiple requests for a named task into - * one invocation which is made after the wait time has elapsed with - * no new request. If no wait time is given, the callback will be called - * at microtask timing (guaranteed before paint). - * - * debouncedClickAction(e) { - * // will not call `processClick` more than once per 100ms - * this.debounce('click', function() { - * this.processClick(); - * } 100); - * } - * - * @param {string} jobName String to identify the debounce job. - * @param {function():void} callback Function that is called (with `this` - * context) when the wait time elapses. - * @param {number=} wait Optional wait time in milliseconds (ms) after the - * last signal that must elapse before invoking `callback` - * @return {!Object} Returns a debouncer object on which exists the - * following methods: `isActive()` returns true if the debouncer is - * active; `cancel()` cancels the debouncer if it is active; - * `flush()` immediately invokes the debounced callback if the debouncer - * is active. - * @override - */ - debounce(jobName, callback, wait) { - this._debouncers = this._debouncers || {}; - return this._debouncers[jobName] = Debouncer.debounce( - this._debouncers[jobName] - , wait > 0 ? timeOut.after(wait) : microTask - , callback.bind(this)); - } - - /** - * Returns whether a named debouncer is active. - * - * @param {string} jobName The name of the debouncer started with `debounce` - * @return {boolean} Whether the debouncer is active (has not yet fired). - * @override - */ - isDebouncerActive(jobName) { - this._debouncers = this._debouncers || {}; - let debouncer = this._debouncers[jobName]; - return !!(debouncer && debouncer.isActive()); - } - - /** - * Immediately calls the debouncer `callback` and inactivates it. - * - * @param {string} jobName The name of the debouncer started with `debounce` - * @return {void} - * @override - */ - flushDebouncer(jobName) { - this._debouncers = this._debouncers || {}; - let debouncer = this._debouncers[jobName]; - if (debouncer) { - debouncer.flush(); - } - } - - /** - * Cancels an active debouncer. The `callback` will not be called. - * - * @param {string} jobName The name of the debouncer started with `debounce` - * @return {void} - * @override - */ - cancelDebouncer(jobName) { - this._debouncers = this._debouncers || {}; - let debouncer = this._debouncers[jobName]; - if (debouncer) { - debouncer.cancel(); - } - } - - /** - * Runs a callback function asynchronously. - * - * By default (if no waitTime is specified), async callbacks are run at - * microtask timing, which will occur before paint. - * - * @param {!Function} callback The callback function to run, bound to - * `this`. - * @param {number=} waitTime Time to wait before calling the - * `callback`. If unspecified or 0, the callback will be run at microtask - * timing (before paint). - * @return {number} Handle that may be used to cancel the async job. - * @override - */ - async(callback, waitTime) { - return waitTime > 0 ? timeOut.run(callback.bind(this), waitTime) : - ~microTask.run(callback.bind(this)); - } - - /** - * Cancels an async operation started with `async`. - * - * @param {number} handle Handle returned from original `async` call to - * cancel. - * @return {void} - * @override - */ - cancelAsync(handle) { - handle < 0 ? microTask.cancel(~handle) : - timeOut.cancel(handle); - } - - // other - - /** - * Convenience method for creating an element and configuring it. - * - * @param {string} tag HTML element tag to create. - * @param {Object=} props Object of properties to configure on the - * instance. - * @return {!Element} Newly created and configured element. - * @override - */ - create(tag, props) { - let elt = document.createElement(tag); - if (props) { - if (elt.setProperties) { - elt.setProperties(props); - } else { - for (let n in props) { - elt[n] = props[n]; - } - } - } - return elt; - } - - /** - * Polyfill for Element.prototype.matches, which is sometimes still - * prefixed. - * - * @param {string} selector Selector to test. - * @param {!Element=} node Element to test the selector against. - * @return {boolean} Whether the element matches the selector. - * @override - */ - elementMatches(selector, node) { - return matchesSelector( (node || this), selector); - } - - /** - * Toggles an HTML attribute on or off. - * - * @param {string} name HTML attribute name - * @param {boolean=} bool Boolean to force the attribute on or off. - * When unspecified, the state of the attribute will be reversed. - * @return {boolean} true if the attribute now exists - * @override - */ - toggleAttribute(name, bool) { - let node = /** @type {Element} */(this); - if (arguments.length === 3) { - node = /** @type {Element} */(arguments[2]); - } - if (arguments.length == 1) { - bool = !node.hasAttribute(name); - } - if (bool) { - wrap(node).setAttribute(name, ''); - return true; - } else { - wrap(node).removeAttribute(name); - return false; - } - } - - - /** - * Toggles a CSS class on or off. - * - * @param {string} name CSS class name - * @param {boolean=} bool Boolean to force the class on or off. - * When unspecified, the state of the class will be reversed. - * @param {Element=} node Node to target. Defaults to `this`. - * @return {void} - * @override - */ - toggleClass(name, bool, node) { - node = /** @type {Element} */ (node || this); - if (arguments.length == 1) { - bool = !node.classList.contains(name); - } - if (bool) { - node.classList.add(name); - } else { - node.classList.remove(name); - } - } - - /** - * Cross-platform helper for setting an element's CSS `transform` property. - * - * @param {string} transformText Transform setting. - * @param {Element=} node Element to apply the transform to. - * Defaults to `this` - * @return {void} - * @override - */ - transform(transformText, node) { - node = /** @type {Element} */ (node || this); - node.style.webkitTransform = transformText; - node.style.transform = transformText; - } - - /** - * Cross-platform helper for setting an element's CSS `translate3d` - * property. - * - * @param {number} x X offset. - * @param {number} y Y offset. - * @param {number} z Z offset. - * @param {Element=} node Element to apply the transform to. - * Defaults to `this`. - * @return {void} - * @override - */ - translate3d(x, y, z, node) { - node = /** @type {Element} */ (node || this); - this.transform('translate3d(' + x + ',' + y + ',' + z + ')', node); - } - - /** - * Removes an item from an array, if it exists. - * - * If the array is specified by path, a change notification is - * generated, so that observers, data bindings and computed - * properties watching that path can update. - * - * If the array is passed directly, **no change - * notification is generated**. - * - * @param {string | !Array<number|string>} arrayOrPath Path to array from - * which to remove the item - * (or the array itself). - * @param {*} item Item to remove. - * @return {Array} Array containing item removed. - * @override - */ - arrayDelete(arrayOrPath, item) { - let index; - if (Array.isArray(arrayOrPath)) { - index = arrayOrPath.indexOf(item); - if (index >= 0) { - return arrayOrPath.splice(index, 1); - } - } else { - let arr = get(this, arrayOrPath); - index = arr.indexOf(item); - if (index >= 0) { - return this.splice(arrayOrPath, index, 1); - } - } - return null; - } - - // logging - - /** - * Facades `console.log`/`warn`/`error` as override point. - * - * @param {string} level One of 'log', 'warn', 'error' - * @param {Array} args Array of strings or objects to log - * @return {void} - * @override - */ - _logger(level, args) { - // accept ['foo', 'bar'] and [['foo', 'bar']] - if (Array.isArray(args) && args.length === 1 && Array.isArray(args[0])) { - args = args[0]; - } - switch(level) { - case 'log': - case 'warn': - case 'error': - console[level](...args); - } - } - - /** - * Facades `console.log` as an override point. - * - * @param {...*} args Array of strings or objects to log - * @return {void} - * @override - */ - _log(...args) { - this._logger('log', args); - } - - /** - * Facades `console.warn` as an override point. - * - * @param {...*} args Array of strings or objects to log - * @return {void} - * @override - */ - _warn(...args) { - this._logger('warn', args); - } - - /** - * Facades `console.error` as an override point. - * - * @param {...*} args Array of strings or objects to log - * @return {void} - * @override - */ - _error(...args) { - this._logger('error', args); - } - - /** - * Formats a message using the element type an a method name. - * - * @param {string} methodName Method name to associate with message - * @param {...*} args Array of strings or objects to log - * @return {Array} Array with formatting information for `console` - * logging. - * @override - */ - _logf(methodName, ...args) { - return ['[%s::%s]', this.is, methodName, ...args]; - } - - } - - LegacyElement.prototype.is = ''; - - return LegacyElement; -}); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/mutable-data-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/mutable-data-behavior.js deleted file mode 100644 index ee236668b7a..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/mutable-data-behavior.js +++ /dev/null @@ -1,150 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import { MutableData } from '../mixins/mutable-data.js'; - -let mutablePropertyChange; -/** @suppress {missingProperties} */ -(() => { - mutablePropertyChange = MutableData._mutablePropertyChange; -})(); - -/** - * Legacy element behavior to skip strict dirty-checking for objects and arrays, - * (always consider them to be "dirty") for use on legacy API Polymer elements. - * - * By default, `Polymer.PropertyEffects` performs strict dirty checking on - * objects, which means that any deep modifications to an object or array will - * not be propagated unless "immutable" data patterns are used (i.e. all object - * references from the root to the mutation were changed). - * - * Polymer also provides a proprietary data mutation and path notification API - * (e.g. `notifyPath`, `set`, and array mutation API's) that allow efficient - * mutation and notification of deep changes in an object graph to all elements - * bound to the same object graph. - * - * In cases where neither immutable patterns nor the data mutation API can be - * used, applying this mixin will cause Polymer to skip dirty checking for - * objects and arrays (always consider them to be "dirty"). This allows a - * user to make a deep modification to a bound object graph, and then either - * simply re-set the object (e.g. `this.items = this.items`) or call `notifyPath` - * (e.g. `this.notifyPath('items')`) to update the tree. Note that all - * elements that wish to be updated based on deep mutations must apply this - * mixin or otherwise skip strict dirty checking for objects/arrays. - * Specifically, any elements in the binding tree between the source of a - * mutation and the consumption of it must apply this behavior or enable the - * `Polymer.OptionalMutableDataBehavior`. - * - * In order to make the dirty check strategy configurable, see - * `Polymer.OptionalMutableDataBehavior`. - * - * Note, the performance characteristics of propagating large object graphs - * will be worse as opposed to using strict dirty checking with immutable - * patterns or Polymer's path notification API. - * - * @polymerBehavior - * @summary Behavior to skip strict dirty-checking for objects and - * arrays - */ -export const MutableDataBehavior = { - - /** - * Overrides `Polymer.PropertyEffects` to provide option for skipping - * strict equality checking for Objects and Arrays. - * - * This method pulls the value to dirty check against from the `__dataTemp` - * cache (rather than the normal `__data` cache) for Objects. Since the temp - * cache is cleared at the end of a turn, this implementation allows - * side-effects of deep object changes to be processed by re-setting the - * same object (using the temp cache as an in-turn backstop to prevent - * cycles due to 2-way notification). - * - * @param {string} property Property name - * @param {*} value New property value - * @param {*} old Previous property value - * @return {boolean} Whether the property should be considered a change - * @protected - */ - _shouldPropertyChange(property, value, old) { - return mutablePropertyChange(this, property, value, old, true); - } -}; - -/** - * Legacy element behavior to add the optional ability to skip strict - * dirty-checking for objects and arrays (always consider them to be - * "dirty") by setting a `mutable-data` attribute on an element instance. - * - * By default, `Polymer.PropertyEffects` performs strict dirty checking on - * objects, which means that any deep modifications to an object or array will - * not be propagated unless "immutable" data patterns are used (i.e. all object - * references from the root to the mutation were changed). - * - * Polymer also provides a proprietary data mutation and path notification API - * (e.g. `notifyPath`, `set`, and array mutation API's) that allow efficient - * mutation and notification of deep changes in an object graph to all elements - * bound to the same object graph. - * - * In cases where neither immutable patterns nor the data mutation API can be - * used, applying this mixin will allow Polymer to skip dirty checking for - * objects and arrays (always consider them to be "dirty"). This allows a - * user to make a deep modification to a bound object graph, and then either - * simply re-set the object (e.g. `this.items = this.items`) or call `notifyPath` - * (e.g. `this.notifyPath('items')`) to update the tree. Note that all - * elements that wish to be updated based on deep mutations must apply this - * mixin or otherwise skip strict dirty checking for objects/arrays. - * Specifically, any elements in the binding tree between the source of a - * mutation and the consumption of it must enable this behavior or apply the - * `Polymer.OptionalMutableDataBehavior`. - * - * While this behavior adds the ability to forgo Object/Array dirty checking, - * the `mutableData` flag defaults to false and must be set on the instance. - * - * Note, the performance characteristics of propagating large object graphs - * will be worse by relying on `mutableData: true` as opposed to using - * strict dirty checking with immutable patterns or Polymer's path notification - * API. - * - * @polymerBehavior - * @summary Behavior to optionally skip strict dirty-checking for objects and - * arrays - */ -export const OptionalMutableDataBehavior = { - - properties: { - /** - * Instance-level flag for configuring the dirty-checking strategy - * for this element. When true, Objects and Arrays will skip dirty - * checking, otherwise strict equality checking will be used. - */ - mutableData: Boolean - }, - - /** - * Overrides `Polymer.PropertyEffects` to skip strict equality checking - * for Objects and Arrays. - * - * Pulls the value to dirty check against from the `__dataTemp` cache - * (rather than the normal `__data` cache) for Objects. Since the temp - * cache is cleared at the end of a turn, this implementation allows - * side-effects of deep object changes to be processed by re-setting the - * same object (using the temp cache as an in-turn backstop to prevent - * cycles due to 2-way notification). - * - * @param {string} property Property name - * @param {*} value New property value - * @param {*} old Previous property value - * @return {boolean} Whether the property should be considered a change - * @this {this} - * @protected - */ - _shouldPropertyChange(property, value, old) { - return mutablePropertyChange(this, property, value, old, this.mutableData); - } -}; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/polymer-fn.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/polymer-fn.js deleted file mode 100644 index de019be6a9e..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/polymer-fn.js +++ /dev/null @@ -1,48 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import { Class } from './class.js'; - -import '../utils/boot.js'; - -/** - * Legacy class factory and registration helper for defining Polymer - * elements. - * - * This method is equivalent to - * - * import {Class} from '@polymer/polymer/lib/legacy/class.js'; - * customElements.define(info.is, Class(info)); - * - * See `Class` for details on valid legacy metadata format for `info`. - * - * @global - * @override - * @function - * @param {!PolymerInit} info Object containing Polymer metadata and functions - * to become class methods. - * @return {function(new: HTMLElement)} Generated class - * @suppress {duplicate, invalidCasts, checkTypes} - */ -const Polymer = function(info) { - // if input is a `class` (aka a function with a prototype), use the prototype - // remember that the `constructor` will never be called - let klass; - if (typeof info === 'function') { - klass = info; - } else { - klass = Polymer.Class(info); - } - customElements.define(klass.is, /** @type {!HTMLElement} */(klass)); - return klass; -}; - -Polymer.Class = Class; - -export { Polymer };
\ No newline at end of file diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/polymer.dom.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/polymer.dom.js deleted file mode 100644 index 6d7f0eb6678..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/polymer.dom.js +++ /dev/null @@ -1,482 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import '../utils/boot.js'; -import { wrap } from '../utils/wrap.js'; -import '../utils/settings.js'; -import { FlattenedNodesObserver } from '../utils/flattened-nodes-observer.js'; -export { flush, enqueueDebouncer as addDebouncer } from '../utils/flush.js'; -/* eslint-disable no-unused-vars */ -import { Debouncer } from '../utils/debounce.js'; // used in type annotations -/* eslint-enable no-unused-vars */ - -const p = Element.prototype; -/** - * @const {function(this:Node, string): boolean} - */ -const normalizedMatchesSelector = p.matches || p.matchesSelector || - p.mozMatchesSelector || p.msMatchesSelector || - p.oMatchesSelector || p.webkitMatchesSelector; - -/** - * Cross-platform `element.matches` shim. - * - * @function matchesSelector - * @param {!Node} node Node to check selector against - * @param {string} selector Selector to match - * @return {boolean} True if node matched selector - */ -export const matchesSelector = function(node, selector) { - return normalizedMatchesSelector.call(node, selector); -}; - -/** - * Node API wrapper class returned from `Polymer.dom.(target)` when - * `target` is a `Node`. - * @implements {PolymerDomApi} - * @unrestricted - */ -class DomApiNative { - - /** - * @param {Node} node Node for which to create a Polymer.dom helper object. - */ - constructor(node) { - this.node = node; - } - - /** - * Returns an instance of `FlattenedNodesObserver` that - * listens for node changes on this element. - * - * @param {function(this:HTMLElement, { target: !HTMLElement, addedNodes: !Array<!Element>, removedNodes: !Array<!Element> }):void} callback Called when direct or distributed children - * of this element changes - * @return {!PolymerDomApi.ObserveHandle} Observer instance - * @override - */ - observeNodes(callback) { - return new FlattenedNodesObserver( - /** @type {!HTMLElement} */(this.node), callback); - } - - /** - * Disconnects an observer previously created via `observeNodes` - * - * @param {!PolymerDomApi.ObserveHandle} observerHandle Observer instance - * to disconnect. - * @return {void} - * @override - */ - unobserveNodes(observerHandle) { - observerHandle.disconnect(); - } - - /** - * Provided as a backwards-compatible API only. This method does nothing. - * @return {void} - */ - notifyObserver() {} - - /** - * Returns true if the provided node is contained with this element's - * light-DOM children or shadow root, including any nested shadow roots - * of children therein. - * - * @param {Node} node Node to test - * @return {boolean} Returns true if the given `node` is contained within - * this element's light or shadow DOM. - * @override - */ - deepContains(node) { - if (wrap(this.node).contains(node)) { - return true; - } - let n = node; - let doc = node.ownerDocument; - // walk from node to `this` or `document` - while (n && n !== doc && n !== this.node) { - // use logical parentnode, or native ShadowRoot host - n = wrap(n).parentNode || wrap(n).host; - } - return n === this.node; - } - - /** - * Returns the root node of this node. Equivalent to `getRootNode()`. - * - * @return {Node} Top most element in the dom tree in which the node - * exists. If the node is connected to a document this is either a - * shadowRoot or the document; otherwise, it may be the node - * itself or a node or document fragment containing it. - * @override - */ - getOwnerRoot() { - return wrap(this.node).getRootNode(); - } - - /** - * For slot elements, returns the nodes assigned to the slot; otherwise - * an empty array. It is equivalent to `<slot>.addignedNodes({flatten:true})`. - * - * @return {!Array<!Node>} Array of assigned nodes - * @override - */ - getDistributedNodes() { - return (this.node.localName === 'slot') ? - wrap(this.node).assignedNodes({flatten: true}) : - []; - } - - /** - * Returns an array of all slots this element was distributed to. - * - * @return {!Array<!HTMLSlotElement>} Description - * @override - */ - getDestinationInsertionPoints() { - let ip$ = []; - let n = wrap(this.node).assignedSlot; - while (n) { - ip$.push(n); - n = wrap(n).assignedSlot; - } - return ip$; - } - - /** - * Calls `importNode` on the `ownerDocument` for this node. - * - * @param {!Node} node Node to import - * @param {boolean} deep True if the node should be cloned deeply during - * import - * @return {Node} Clone of given node imported to this owner document - */ - importNode(node, deep) { - let doc = this.node instanceof Document ? this.node : - this.node.ownerDocument; - return wrap(doc).importNode(node, deep); - } - - /** - * @return {!Array<!Node>} Returns a flattened list of all child nodes and - * nodes assigned to child slots. - * @override - */ - getEffectiveChildNodes() { - return FlattenedNodesObserver.getFlattenedNodes( - /** @type {!HTMLElement} */ (this.node)); - } - - /** - * Returns a filtered list of flattened child elements for this element based - * on the given selector. - * - * @param {string} selector Selector to filter nodes against - * @return {!Array<!HTMLElement>} List of flattened child elements - * @override - */ - queryDistributedElements(selector) { - let c$ = this.getEffectiveChildNodes(); - let list = []; - for (let i=0, l=c$.length, c; (i<l) && (c=c$[i]); i++) { - if ((c.nodeType === Node.ELEMENT_NODE) && - matchesSelector(c, selector)) { - list.push(c); - } - } - return list; - } - - /** - * For shadow roots, returns the currently focused element within this - * shadow root. - * - * return {Node|undefined} Currently focused element - * @override - */ - get activeElement() { - let node = this.node; - return node._activeElement !== undefined ? node._activeElement : node.activeElement; - } -} - -function forwardMethods(proto, methods) { - for (let i=0; i < methods.length; i++) { - let method = methods[i]; - /* eslint-disable valid-jsdoc */ - proto[method] = /** @this {DomApiNative} */ function() { - return this.node[method].apply(this.node, arguments); - }; - /* eslint-enable */ - } -} - -function forwardReadOnlyProperties(proto, properties) { - for (let i=0; i < properties.length; i++) { - let name = properties[i]; - Object.defineProperty(proto, name, { - get: function() { - const domApi = /** @type {DomApiNative} */(this); - return domApi.node[name]; - }, - configurable: true - }); - } -} - -function forwardProperties(proto, properties) { - for (let i=0; i < properties.length; i++) { - let name = properties[i]; - Object.defineProperty(proto, name, { - /** - * @this {DomApiNative} - * @return {*} . - */ - get: function() { - return this.node[name]; - }, - /** - * @this {DomApiNative} - * @param {*} value . - */ - set: function(value) { - this.node[name] = value; - }, - configurable: true - }); - } -} - - -/** - * Event API wrapper class returned from `dom.(target)` when - * `target` is an `Event`. - */ -export class EventApi { - constructor(event) { - this.event = event; - } - - /** - * Returns the first node on the `composedPath` of this event. - * - * @return {!EventTarget} The node this event was dispatched to - */ - get rootTarget() { - return this.path[0]; - } - - /** - * Returns the local (re-targeted) target for this event. - * - * @return {!EventTarget} The local (re-targeted) target for this event. - */ - get localTarget() { - return this.event.target; - } - - /** - * Returns the `composedPath` for this event. - * @return {!Array<!EventTarget>} The nodes this event propagated through - */ - get path() { - return this.event.composedPath(); - } -} - -/** - * @function - * @param {boolean=} deep - * @return {!Node} - */ -DomApiNative.prototype.cloneNode; -/** - * @function - * @param {!Node} node - * @return {!Node} - */ -DomApiNative.prototype.appendChild; -/** - * @function - * @param {!Node} newChild - * @param {Node} refChild - * @return {!Node} - */ -DomApiNative.prototype.insertBefore; -/** - * @function - * @param {!Node} node - * @return {!Node} - */ -DomApiNative.prototype.removeChild; -/** - * @function - * @param {!Node} oldChild - * @param {!Node} newChild - * @return {!Node} - */ -DomApiNative.prototype.replaceChild; -/** - * @function - * @param {string} name - * @param {string} value - * @return {void} - */ -DomApiNative.prototype.setAttribute; -/** - * @function - * @param {string} name - * @return {void} - */ -DomApiNative.prototype.removeAttribute; -/** - * @function - * @param {string} selector - * @return {?Element} - */ -DomApiNative.prototype.querySelector; -/** - * @function - * @param {string} selector - * @return {!NodeList<!Element>} - */ -DomApiNative.prototype.querySelectorAll; - -/** @type {?Node} */ -DomApiNative.prototype.parentNode; -/** @type {?Node} */ -DomApiNative.prototype.firstChild; -/** @type {?Node} */ -DomApiNative.prototype.lastChild; -/** @type {?Node} */ -DomApiNative.prototype.nextSibling; -/** @type {?Node} */ -DomApiNative.prototype.previousSibling; -/** @type {?HTMLElement} */ -DomApiNative.prototype.firstElementChild; -/** @type {?HTMLElement} */ -DomApiNative.prototype.lastElementChild; -/** @type {?HTMLElement} */ -DomApiNative.prototype.nextElementSibling; -/** @type {?HTMLElement} */ -DomApiNative.prototype.previousElementSibling; -/** @type {!Array<!Node>} */ -DomApiNative.prototype.childNodes; -/** @type {!Array<!HTMLElement>} */ -DomApiNative.prototype.children; -/** @type {?DOMTokenList} */ -DomApiNative.prototype.classList; - -/** @type {string} */ -DomApiNative.prototype.textContent; -/** @type {string} */ -DomApiNative.prototype.innerHTML; - -let DomApiImpl = DomApiNative; - -if (window['ShadyDOM'] && window['ShadyDOM']['inUse'] && window['ShadyDOM']['noPatch'] && window['ShadyDOM']['Wrapper']) { - - /** - * @private - * @extends {HTMLElement} - */ - class Wrapper extends window['ShadyDOM']['Wrapper'] {} - - // copy bespoke API onto wrapper - Object.getOwnPropertyNames(DomApiNative.prototype).forEach((prop) => { - if (prop != 'activeElement') { - Wrapper.prototype[prop] = DomApiNative.prototype[prop]; - } - }); - - // Note, `classList` is here only for legacy compatibility since it does not - // trigger distribution in v1 Shadow DOM. - forwardReadOnlyProperties(Wrapper.prototype, [ - 'classList' - ]); - - DomApiImpl = Wrapper; - - Object.defineProperties(EventApi.prototype, { - - localTarget: { - get() { - return this.event.currentTarget; - }, - configurable: true - }, - - path: { - get() { - return window['ShadyDOM']['composedPath'](this.event); - }, - configurable: true - } - }); - -} else { - - // Methods that can provoke distribution or must return the logical, not - // composed tree. - forwardMethods(DomApiNative.prototype, [ - 'cloneNode', 'appendChild', 'insertBefore', 'removeChild', - 'replaceChild', 'setAttribute', 'removeAttribute', - 'querySelector', 'querySelectorAll' - ]); - - // Properties that should return the logical, not composed tree. Note, `classList` - // is here only for legacy compatibility since it does not trigger distribution - // in v1 Shadow DOM. - forwardReadOnlyProperties(DomApiNative.prototype, [ - 'parentNode', 'firstChild', 'lastChild', - 'nextSibling', 'previousSibling', 'firstElementChild', - 'lastElementChild', 'nextElementSibling', 'previousElementSibling', - 'childNodes', 'children', 'classList' - ]); - - forwardProperties(DomApiNative.prototype, [ - 'textContent', 'innerHTML' - ]); -} - -export const DomApi = DomApiImpl; - -/** - * Legacy DOM and Event manipulation API wrapper factory used to abstract - * differences between native Shadow DOM and "Shady DOM" when polyfilling on - * older browsers. - * - * Note that in Polymer 2.x use of `Polymer.dom` is no longer required and - * in the majority of cases simply facades directly to the standard native - * API. - * - * @summary Legacy DOM and Event manipulation API wrapper factory used to - * abstract differences between native Shadow DOM and "Shady DOM." - * @param {(Node|Event|DomApiNative|EventApi)=} obj Node or event to operate on - * @return {!DomApiNative|!EventApi} Wrapper providing either node API or event API - */ -export const dom = function(obj) { - obj = obj || document; - if (obj instanceof DomApiImpl) { - return /** @type {!DomApi} */(obj); - } - if (obj instanceof EventApi) { - return /** @type {!EventApi} */(obj); - } - let helper = obj['__domApi']; - if (!helper) { - if (obj instanceof Event) { - helper = new EventApi(obj); - } else { - helper = new DomApiImpl(/** @type {Node} */(obj)); - } - obj['__domApi'] = helper; - } - return helper; -}; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/templatizer-behavior.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/templatizer-behavior.js deleted file mode 100644 index 2dfbbc3a093..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/legacy/templatizer-behavior.js +++ /dev/null @@ -1,142 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import { TemplateInstanceBase, templatize, modelForElement } from '../utils/templatize.js'; // eslint-disable-line no-unused-vars - -/** - * @typedef {{ - * _templatizerTemplate: HTMLTemplateElement, - * _parentModel: boolean, - * _instanceProps: Object, - * _forwardHostPropV2: Function, - * _notifyInstancePropV2: Function, - * ctor: TemplateInstanceBase - * }} - */ -let TemplatizerUser; // eslint-disable-line - -/** - * The `Templatizer` behavior adds methods to generate instances of - * templates that are each managed by an anonymous `PropertyEffects` - * instance where data-bindings in the stamped template content are bound to - * accessors on itself. - * - * This behavior is provided in Polymer 2.x-3.x as a hybrid-element convenience - * only. For non-hybrid usage, the `Templatize` library - * should be used instead. - * - * Example: - * - * import {dom} from '@polymer/polymer/lib/legacy/polymer.dom.js'; - * // Get a template from somewhere, e.g. light DOM - * let template = this.querySelector('template'); - * // Prepare the template - * this.templatize(template); - * // Instance the template with an initial data model - * let instance = this.stamp({myProp: 'initial'}); - * // Insert the instance's DOM somewhere, e.g. light DOM - * dom(this).appendChild(instance.root); - * // Changing a property on the instance will propagate to bindings - * // in the template - * instance.myProp = 'new value'; - * - * Users of `Templatizer` may need to implement the following abstract - * API's to determine how properties and paths from the host should be - * forwarded into to instances: - * - * _forwardHostPropV2: function(prop, value) - * - * Likewise, users may implement these additional abstract API's to determine - * how instance-specific properties that change on the instance should be - * forwarded out to the host, if necessary. - * - * _notifyInstancePropV2: function(inst, prop, value) - * - * In order to determine which properties are instance-specific and require - * custom notification via `_notifyInstanceProp`, define an `_instanceProps` - * object containing keys for each instance prop, for example: - * - * _instanceProps: { - * item: true, - * index: true - * } - * - * Any properties used in the template that are not defined in _instanceProp - * will be forwarded out to the Templatize `owner` automatically. - * - * Users may also implement the following abstract function to show or - * hide any DOM generated using `stamp`: - * - * _showHideChildren: function(shouldHide) - * - * Note that some callbacks are suffixed with `V2` in the Polymer 2.x behavior - * as the implementations will need to differ from the callbacks required - * by the 1.x Templatizer API due to changes in the `TemplateInstance` API - * between versions 1.x and 2.x. - * - * @polymerBehavior - */ -export const Templatizer = { - - /** - * Generates an anonymous `TemplateInstance` class (stored as `this.ctor`) - * for the provided template. This method should be called once per - * template to prepare an element for stamping the template, followed - * by `stamp` to create new instances of the template. - * - * @param {!HTMLTemplateElement} template Template to prepare - * @param {boolean=} mutableData When `true`, the generated class will skip - * strict dirty-checking for objects and arrays (always consider them to - * be "dirty"). Defaults to false. - * @return {void} - * @this {TemplatizerUser} - */ - templatize(template, mutableData) { - this._templatizerTemplate = template; - this.ctor = templatize(template, this, { - mutableData: Boolean(mutableData), - parentModel: this._parentModel, - instanceProps: this._instanceProps, - forwardHostProp: this._forwardHostPropV2, - notifyInstanceProp: this._notifyInstancePropV2 - }); - }, - - /** - * Creates an instance of the template prepared by `templatize`. The object - * returned is an instance of the anonymous class generated by `templatize` - * whose `root` property is a document fragment containing newly cloned - * template content, and which has property accessors corresponding to - * properties referenced in template bindings. - * - * @param {Object=} model Object containing initial property values to - * populate into the template bindings. - * @return {TemplateInstanceBase} Returns the created instance of - * the template prepared by `templatize`. - * @this {TemplatizerUser} - */ - stamp(model) { - return new this.ctor(model); - }, - - /** - * Returns the template "model" (`TemplateInstance`) associated with - * a given element, which serves as the binding scope for the template - * instance the element is contained in. A template model should be used - * to manipulate data associated with this template instance. - * - * @param {HTMLElement} el Element for which to return a template model. - * @return {TemplateInstanceBase} Model representing the binding scope for - * the element. - * @this {TemplatizerUser} - */ - modelForElement(el) { - return modelForElement(this._templatizerTemplate, el); - } -}; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/dir-mixin.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/dir-mixin.js deleted file mode 100644 index 3237511791e..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/dir-mixin.js +++ /dev/null @@ -1,195 +0,0 @@ -/** - * @fileoverview - * @suppress {checkPrototypalTypes} - * @license Copyright (c) 2017 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 - */ -import { PropertyAccessors } from './property-accessors.js'; - -import { dedupingMixin } from '../utils/mixin.js'; - -const HOST_DIR = /:host\(:dir\((ltr|rtl)\)\)/g; -const HOST_DIR_REPLACMENT = ':host([dir="$1"])'; - -const EL_DIR = /([\s\w-#\.\[\]\*]*):dir\((ltr|rtl)\)/g; -const EL_DIR_REPLACMENT = ':host([dir="$2"]) $1'; - -const DIR_CHECK = /:dir\((?:ltr|rtl)\)/; - -const SHIM_SHADOW = Boolean(window['ShadyDOM'] && window['ShadyDOM']['inUse']); - -/** - * @type {!Array<!Polymer_DirMixin>} - */ -const DIR_INSTANCES = []; - -/** @type {?MutationObserver} */ -let observer = null; - -let DOCUMENT_DIR = ''; - -function getRTL() { - DOCUMENT_DIR = document.documentElement.getAttribute('dir'); -} - -/** - * @param {!Polymer_DirMixin} instance Instance to set RTL status on - */ -function setRTL(instance) { - if (!instance.__autoDirOptOut) { - const el = /** @type {!HTMLElement} */(instance); - el.setAttribute('dir', DOCUMENT_DIR); - } -} - -function updateDirection() { - getRTL(); - DOCUMENT_DIR = document.documentElement.getAttribute('dir'); - for (let i = 0; i < DIR_INSTANCES.length; i++) { - setRTL(DIR_INSTANCES[i]); - } -} - -function takeRecords() { - if (observer && observer.takeRecords().length) { - updateDirection(); - } -} - -/** - * Element class mixin that allows elements to use the `:dir` CSS Selector to - * have text direction specific styling. - * - * With this mixin, any stylesheet provided in the template will transform - * `:dir` into `:host([dir])` and sync direction with the page via the - * element's `dir` attribute. - * - * Elements can opt out of the global page text direction by setting the `dir` - * attribute directly in `ready()` or in HTML. - * - * Caveats: - * - Applications must set `<html dir="ltr">` or `<html dir="rtl">` to sync - * direction - * - Automatic left-to-right or right-to-left styling is sync'd with the - * `<html>` element only. - * - Changing `dir` at runtime is supported. - * - Opting out of the global direction styling is permanent - * - * @mixinFunction - * @polymer - * @appliesMixin PropertyAccessors - */ -export const DirMixin = dedupingMixin((base) => { - - if (!SHIM_SHADOW) { - if (!observer) { - getRTL(); - observer = new MutationObserver(updateDirection); - observer.observe(document.documentElement, {attributes: true, attributeFilter: ['dir']}); - } - } - - /** - * @constructor - * @implements {Polymer_PropertyAccessors} - * @private - */ - const elementBase = PropertyAccessors(base); - - /** - * @polymer - * @mixinClass - * @implements {Polymer_DirMixin} - */ - class Dir extends elementBase { - - /** - * @param {string} cssText . - * @param {string} baseURI . - * @return {string} . - * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do - */ - static _processStyleText(cssText, baseURI) { - cssText = super._processStyleText(cssText, baseURI); - if (!SHIM_SHADOW && DIR_CHECK.test(cssText)) { - cssText = this._replaceDirInCssText(cssText); - this.__activateDir = true; - } - return cssText; - } - - /** - * Replace `:dir` in the given CSS text - * - * @param {string} text CSS text to replace DIR - * @return {string} Modified CSS - */ - static _replaceDirInCssText(text) { - let replacedText = text; - replacedText = replacedText.replace(HOST_DIR, HOST_DIR_REPLACMENT); - replacedText = replacedText.replace(EL_DIR, EL_DIR_REPLACMENT); - return replacedText; - } - - constructor() { - super(); - /** @type {boolean} */ - this.__autoDirOptOut = false; - } - - /** - * @override - * @suppress {invalidCasts} Closure doesn't understand that `this` is an - * HTMLElement - * @return {void} - */ - ready() { - super.ready(); - this.__autoDirOptOut = /** @type {!HTMLElement} */(this).hasAttribute('dir'); - } - - /** - * @override - * @suppress {missingProperties} If it exists on elementBase, it can be - * super'd - * @return {void} - */ - connectedCallback() { - if (elementBase.prototype.connectedCallback) { - super.connectedCallback(); - } - if (this.constructor.__activateDir) { - takeRecords(); - DIR_INSTANCES.push(this); - setRTL(this); - } - } - - /** - * @override - * @suppress {missingProperties} If it exists on elementBase, it can be - * super'd - * @return {void} - */ - disconnectedCallback() { - if (elementBase.prototype.disconnectedCallback) { - super.disconnectedCallback(); - } - if (this.constructor.__activateDir) { - const idx = DIR_INSTANCES.indexOf(this); - if (idx > -1) { - DIR_INSTANCES.splice(idx, 1); - } - } - } - } - - Dir.__activateDir = false; - - return Dir; -}); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/disable-upgrade-mixin.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/disable-upgrade-mixin.js deleted file mode 100644 index a97aa9e9bae..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/disable-upgrade-mixin.js +++ /dev/null @@ -1,122 +0,0 @@ -/** - * @fileoverview - * @suppress {checkPrototypalTypes} - * @license Copyright (c) 2017 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 - */ -import { ElementMixin } from './element-mixin.js'; - -import { dedupingMixin } from '../utils/mixin.js'; - -const DISABLED_ATTR = 'disable-upgrade'; - -/** - * Element class mixin that allows the element to boot up in a non-enabled - * state when the `disable-upgrade` attribute is present. This mixin is - * designed to be used with element classes like PolymerElement that perform - * initial startup work when they are first connected. When the - * `disable-upgrade` attribute is removed, if the element is connected, it - * boots up and "enables" as it otherwise would; if it is not connected, the - * element boots up when it is next connected. - * - * Using `disable-upgrade` with PolymerElement prevents any data propagation - * to the element, any element DOM from stamping, or any work done in - * connected/disconnctedCallback from occuring, but it does not prevent work - * done in the element constructor. - * - * Note, this mixin must be applied on top of any element class that - * itself implements a `connectedCallback` so that it can control the work - * done in `connectedCallback`. For example, - * - * MyClass = DisableUpgradeMixin(class extends BaseClass {...}); - * - * @mixinFunction - * @polymer - * @appliesMixin ElementMixin - */ -export const DisableUpgradeMixin = dedupingMixin((base) => { - /** - * @constructor - * @implements {Polymer_ElementMixin} - * @extends {HTMLElement} - * @private - */ - const superClass = ElementMixin(base); - - /** - * @polymer - * @mixinClass - * @implements {Polymer_DisableUpgradeMixin} - */ - class DisableUpgradeClass extends superClass { - - /** - * @suppress {missingProperties} go/missingfnprops - */ - static get observedAttributes() { - return super.observedAttributes.concat(DISABLED_ATTR); - } - - /** - * @override - * @param {string} name Attribute name. - * @param {?string} old The previous value for the attribute. - * @param {?string} value The new value for the attribute. - * @param {?string=} namespace The XML namespace for the attribute. - * @return {undefined} - */ - attributeChangedCallback(name, old, value, namespace) { - if (name == DISABLED_ATTR) { - if (!this.__dataEnabled && value == null && this.isConnected) { - super.connectedCallback(); - } - } else { - super.attributeChangedCallback( - name, old, value, /** @type {null|string} */ (namespace)); - } - } - - /* - NOTE: cannot gate on attribute because this is called before - attributes are delivered. Therefore, we stub this out and - call `super._initializeProperties()` manually. - */ - /** @override */ - _initializeProperties() {} - - // prevent user code in connected from running - /** @override */ - connectedCallback() { - if (this.__dataEnabled || !this.hasAttribute(DISABLED_ATTR)) { - super.connectedCallback(); - } - } - - // prevent element from turning on properties - /** @override */ - _enableProperties() { - if (!this.hasAttribute(DISABLED_ATTR)) { - if (!this.__dataEnabled) { - super._initializeProperties(); - } - super._enableProperties(); - } - } - - // only go if "enabled" - /** @override */ - disconnectedCallback() { - if (this.__dataEnabled) { - super.disconnectedCallback(); - } - } - - } - - return DisableUpgradeClass; -}); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/element-mixin.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/element-mixin.js deleted file mode 100644 index af291ac45b8..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/element-mixin.js +++ /dev/null @@ -1,813 +0,0 @@ -/** - * @fileoverview - * @suppress {checkPrototypalTypes} - * @license Copyright (c) 2017 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 - */ -import '../utils/boot.js'; - -import { rootPath, strictTemplatePolicy, allowTemplateFromDomModule, legacyOptimizations, syncInitialRender } from '../utils/settings.js'; -import { dedupingMixin } from '../utils/mixin.js'; -import { stylesFromTemplate, stylesFromModuleImports } from '../utils/style-gather.js'; -import { pathFromUrl, resolveCss, resolveUrl } from '../utils/resolve-url.js'; -import { DomModule } from '../elements/dom-module.js'; -import { PropertyEffects } from './property-effects.js'; -import { PropertiesMixin } from './properties-mixin.js'; -import { wrap } from '../utils/wrap.js'; - -/** - * Current Polymer version in Semver notation. - * @type {string} Semver notation of the current version of Polymer. - */ -export const version = '3.2.0'; - -const builtCSS = window.ShadyCSS && window.ShadyCSS['cssBuild']; - -/** - * Element class mixin that provides the core API for Polymer's meta-programming - * features including template stamping, data-binding, attribute deserialization, - * and property change observation. - * - * Subclassers may provide the following static getters to return metadata - * used to configure Polymer's features for the class: - * - * - `static get is()`: When the template is provided via a `dom-module`, - * users should return the `dom-module` id from a static `is` getter. If - * no template is needed or the template is provided directly via the - * `template` getter, there is no need to define `is` for the element. - * - * - `static get template()`: Users may provide the template directly (as - * opposed to via `dom-module`) by implementing a static `template` getter. - * The getter must return an `HTMLTemplateElement`. - * - * - `static get properties()`: Should return an object describing - * property-related metadata used by Polymer features (key: property name - * value: object containing property metadata). Valid keys in per-property - * metadata include: - * - `type` (String|Number|Object|Array|...): Used by - * `attributeChangedCallback` to determine how string-based attributes - * are deserialized to JavaScript property values. - * - `notify` (boolean): Causes a change in the property to fire a - * non-bubbling event called `<property>-changed`. Elements that have - * enabled two-way binding to the property use this event to observe changes. - * - `readOnly` (boolean): Creates a getter for the property, but no setter. - * To set a read-only property, use the private setter method - * `_setProperty(property, value)`. - * - `observer` (string): Observer method name that will be called when - * the property changes. The arguments of the method are - * `(value, previousValue)`. - * - `computed` (string): String describing method and dependent properties - * for computing the value of this property (e.g. `'computeFoo(bar, zot)'`). - * Computed properties are read-only by default and can only be changed - * via the return value of the computing method. - * - * - `static get observers()`: Array of strings describing multi-property - * observer methods and their dependent properties (e.g. - * `'observeABC(a, b, c)'`). - * - * The base class provides default implementations for the following standard - * custom element lifecycle callbacks; users may override these, but should - * call the super method to ensure - * - `constructor`: Run when the element is created or upgraded - * - `connectedCallback`: Run each time the element is connected to the - * document - * - `disconnectedCallback`: Run each time the element is disconnected from - * the document - * - `attributeChangedCallback`: Run each time an attribute in - * `observedAttributes` is set or removed (note: this element's default - * `observedAttributes` implementation will automatically return an array - * of dash-cased attributes based on `properties`) - * - * @mixinFunction - * @polymer - * @appliesMixin PropertyEffects - * @appliesMixin PropertiesMixin - * @property rootPath {string} Set to the value of `rootPath`, - * which defaults to the main document path - * @property importPath {string} Set to the value of the class's static - * `importPath` property, which defaults to the path of this element's - * `dom-module` (when `is` is used), but can be overridden for other - * import strategies. - * @summary Element class mixin that provides the core API for Polymer's - * meta-programming features. - */ -export const ElementMixin = dedupingMixin(base => { - /** - * @constructor - * @implements {Polymer_PropertyEffects} - * @implements {Polymer_PropertiesMixin} - * @extends {HTMLElement} - * @private - */ - const polymerElementBase = PropertiesMixin(PropertyEffects(base)); - - /** - * Returns a list of properties with default values. - * This list is created as an optimization since it is a subset of - * the list returned from `_properties`. - * This list is used in `_initializeProperties` to set property defaults. - * - * @param {PolymerElementConstructor} constructor Element class - * @return {PolymerElementProperties} Flattened properties for this class - * that have default values - * @private - */ - function propertyDefaults(constructor) { - if (!constructor.hasOwnProperty( - JSCompiler_renameProperty('__propertyDefaults', constructor))) { - constructor.__propertyDefaults = null; - let props = constructor._properties; - for (let p in props) { - let info = props[p]; - if ('value' in info) { - constructor.__propertyDefaults = constructor.__propertyDefaults || {}; - constructor.__propertyDefaults[p] = info; - } - } - } - return constructor.__propertyDefaults; - } - - /** - * Returns a memoized version of the `observers` array. - * @param {PolymerElementConstructor} constructor Element class - * @return {Array} Array containing own observers for the given class - * @protected - */ - function ownObservers(constructor) { - if (!constructor.hasOwnProperty( - JSCompiler_renameProperty('__ownObservers', constructor))) { - constructor.__ownObservers = - constructor.hasOwnProperty( - JSCompiler_renameProperty('observers', constructor)) ? - /** @type {PolymerElementConstructor} */ (constructor).observers : - null; - } - return constructor.__ownObservers; - } - - /** - * Creates effects for a property. - * - * Note, once a property has been set to - * `readOnly`, `computed`, `reflectToAttribute`, or `notify` - * these values may not be changed. For example, a subclass cannot - * alter these settings. However, additional `observers` may be added - * by subclasses. - * - * The info object should contain property metadata as follows: - * - * * `type`: {function} type to which an attribute matching the property - * is deserialized. Note the property is camel-cased from a dash-cased - * attribute. For example, 'foo-bar' attribute is deserialized to a - * property named 'fooBar'. - * - * * `readOnly`: {boolean} creates a readOnly property and - * makes a private setter for the private of the form '_setFoo' for a - * property 'foo', - * - * * `computed`: {string} creates a computed property. A computed property - * is also automatically set to `readOnly: true`. The value is calculated - * by running a method and arguments parsed from the given string. For - * example 'compute(foo)' will compute a given property when the - * 'foo' property changes by executing the 'compute' method. This method - * must return the computed value. - * - * * `reflectToAttribute`: {boolean} If true, the property value is reflected - * to an attribute of the same name. Note, the attribute is dash-cased - * so a property named 'fooBar' is reflected as 'foo-bar'. - * - * * `notify`: {boolean} sends a non-bubbling notification event when - * the property changes. For example, a property named 'foo' sends an - * event named 'foo-changed' with `event.detail` set to the value of - * the property. - * - * * observer: {string} name of a method that runs when the property - * changes. The arguments of the method are (value, previousValue). - * - * Note: Users may want control over modifying property - * effects via subclassing. For example, a user might want to make a - * reflectToAttribute property not do so in a subclass. We've chosen to - * disable this because it leads to additional complication. - * For example, a readOnly effect generates a special setter. If a subclass - * disables the effect, the setter would fail unexpectedly. - * Based on feedback, we may want to try to make effects more malleable - * and/or provide an advanced api for manipulating them. - * - * @param {!PolymerElement} proto Element class prototype to add accessors - * and effects to - * @param {string} name Name of the property. - * @param {Object} info Info object from which to create property effects. - * Supported keys: - * @param {Object} allProps Flattened map of all properties defined in this - * element (including inherited properties) - * @return {void} - * @private - */ - function createPropertyFromConfig(proto, name, info, allProps) { - // computed forces readOnly... - if (info.computed) { - info.readOnly = true; - } - // Note, since all computed properties are readOnly, this prevents - // adding additional computed property effects (which leads to a confusing - // setup where multiple triggers for setting a property) - // While we do have `hasComputedEffect` this is set on the property's - // dependencies rather than itself. - if (info.computed) { - if (proto._hasReadOnlyEffect(name)) { - console.warn(`Cannot redefine computed property '${name}'.`); - } else { - proto._createComputedProperty(name, info.computed, allProps); - } - } - if (info.readOnly && !proto._hasReadOnlyEffect(name)) { - proto._createReadOnlyProperty(name, !info.computed); - } else if (info.readOnly === false && proto._hasReadOnlyEffect(name)) { - console.warn(`Cannot make readOnly property '${name}' non-readOnly.`); - } - if (info.reflectToAttribute && !proto._hasReflectEffect(name)) { - proto._createReflectedProperty(name); - } else if (info.reflectToAttribute === false && proto._hasReflectEffect(name)) { - console.warn(`Cannot make reflected property '${name}' non-reflected.`); - } - if (info.notify && !proto._hasNotifyEffect(name)) { - proto._createNotifyingProperty(name); - } else if (info.notify === false && proto._hasNotifyEffect(name)) { - console.warn(`Cannot make notify property '${name}' non-notify.`); - } - // always add observer - if (info.observer) { - proto._createPropertyObserver(name, info.observer, allProps[info.observer]); - } - // always create the mapping from attribute back to property for deserialization. - proto._addPropertyToAttributeMap(name); - } - - /** - * Process all style elements in the element template. Styles with the - * `include` attribute are processed such that any styles in - * the associated "style modules" are included in the element template. - * @param {PolymerElementConstructor} klass Element class - * @param {!HTMLTemplateElement} template Template to process - * @param {string} is Name of element - * @param {string} baseURI Base URI for element - * @private - */ - function processElementStyles(klass, template, is, baseURI) { - if (!builtCSS) { - const templateStyles = template.content.querySelectorAll('style'); - const stylesWithImports = stylesFromTemplate(template); - // insert styles from <link rel="import" type="css"> at the top of the template - const linkedStyles = stylesFromModuleImports(is); - const firstTemplateChild = template.content.firstElementChild; - for (let idx = 0; idx < linkedStyles.length; idx++) { - let s = linkedStyles[idx]; - s.textContent = klass._processStyleText(s.textContent, baseURI); - template.content.insertBefore(s, firstTemplateChild); - } - // keep track of the last "concrete" style in the template we have encountered - let templateStyleIndex = 0; - // ensure all gathered styles are actually in this template. - for (let i = 0; i < stylesWithImports.length; i++) { - let s = stylesWithImports[i]; - let templateStyle = templateStyles[templateStyleIndex]; - // if the style is not in this template, it's been "included" and - // we put a clone of it in the template before the style that included it - if (templateStyle !== s) { - s = s.cloneNode(true); - templateStyle.parentNode.insertBefore(s, templateStyle); - } else { - templateStyleIndex++; - } - s.textContent = klass._processStyleText(s.textContent, baseURI); - } - } - if (window.ShadyCSS) { - window.ShadyCSS.prepareTemplate(template, is); - } - } - - /** - * Look up template from dom-module for element - * - * @param {string} is Element name to look up - * @return {?HTMLTemplateElement|undefined} Template found in dom module, or - * undefined if not found - * @protected - */ - function getTemplateFromDomModule(is) { - let template = null; - // Under strictTemplatePolicy in 3.x+, dom-module lookup is only allowed - // when opted-in via allowTemplateFromDomModule - if (is && (!strictTemplatePolicy || allowTemplateFromDomModule)) { - template = /** @type {?HTMLTemplateElement} */ ( - DomModule.import(is, 'template')); - // Under strictTemplatePolicy, require any element with an `is` - // specified to have a dom-module - if (strictTemplatePolicy && !template) { - throw new Error(`strictTemplatePolicy: expecting dom-module or null template for ${is}`); - } - } - return template; - } - - /** - * @polymer - * @mixinClass - * @unrestricted - * @implements {Polymer_ElementMixin} - * @extends {polymerElementBase} - */ - class PolymerElement extends polymerElementBase { - - /** - * Current Polymer version in Semver notation. - * @type {string} Semver notation of the current version of Polymer. - */ - static get polymerElementVersion() { - return version; - } - - /** - * Override of PropertiesMixin _finalizeClass to create observers and - * find the template. - * @return {void} - * @protected - * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do - */ - static _finalizeClass() { - super._finalizeClass(); - const observers = ownObservers(this); - if (observers) { - this.createObservers(observers, this._properties); - } - this._prepareTemplate(); - } - - static _prepareTemplate() { - // note: create "working" template that is finalized at instance time - let template = /** @type {PolymerElementConstructor} */ (this).template; - if (template) { - if (typeof template === 'string') { - console.error('template getter must return HTMLTemplateElement'); - template = null; - } else if (!legacyOptimizations) { - template = template.cloneNode(true); - } - } - - this.prototype._template = template; - } - - /** - * Override of PropertiesChanged createProperties to create accessors - * and property effects for all of the properties. - * @param {!Object} props . - * @return {void} - * @protected - */ - static createProperties(props) { - for (let p in props) { - createPropertyFromConfig(this.prototype, p, props[p], props); - } - } - - /** - * Creates observers for the given `observers` array. - * Leverages `PropertyEffects` to create observers. - * @param {Object} observers Array of observer descriptors for - * this class - * @param {Object} dynamicFns Object containing keys for any properties - * that are functions and should trigger the effect when the function - * reference is changed - * @return {void} - * @protected - */ - static createObservers(observers, dynamicFns) { - const proto = this.prototype; - for (let i=0; i < observers.length; i++) { - proto._createMethodObserver(observers[i], dynamicFns); - } - } - - /** - * Returns the template that will be stamped into this element's shadow root. - * - * If a `static get is()` getter is defined, the default implementation - * will return the first `<template>` in a `dom-module` whose `id` - * matches this element's `is`. - * - * Users may override this getter to return an arbitrary template - * (in which case the `is` getter is unnecessary). The template returned - * must be an `HTMLTemplateElement`. - * - * Note that when subclassing, if the super class overrode the default - * implementation and the subclass would like to provide an alternate - * template via a `dom-module`, it should override this getter and - * return `DomModule.import(this.is, 'template')`. - * - * If a subclass would like to modify the super class template, it should - * clone it rather than modify it in place. If the getter does expensive - * work such as cloning/modifying a template, it should memoize the - * template for maximum performance: - * - * let memoizedTemplate; - * class MySubClass extends MySuperClass { - * static get template() { - * if (!memoizedTemplate) { - * memoizedTemplate = super.template.cloneNode(true); - * let subContent = document.createElement('div'); - * subContent.textContent = 'This came from MySubClass'; - * memoizedTemplate.content.appendChild(subContent); - * } - * return memoizedTemplate; - * } - * } - * - * @return {!HTMLTemplateElement|string} Template to be stamped - */ - static get template() { - // Explanation of template-related properties: - // - constructor.template (this getter): the template for the class. - // This can come from the prototype (for legacy elements), from a - // dom-module, or from the super class's template (or can be overridden - // altogether by the user) - // - constructor._template: memoized version of constructor.template - // - prototype._template: working template for the element, which will be - // parsed and modified in place. It is a cloned version of - // constructor.template, saved in _finalizeClass(). Note that before - // this getter is called, for legacy elements this could be from a - // _template field on the info object passed to Polymer(), a behavior, - // or set in registered(); once the static getter runs, a clone of it - // will overwrite it on the prototype as the working template. - if (!this.hasOwnProperty(JSCompiler_renameProperty('_template', this))) { - this._template = - // If user has put template on prototype (e.g. in legacy via registered - // callback or info object), prefer that first - this.prototype.hasOwnProperty(JSCompiler_renameProperty('_template', this.prototype)) ? - this.prototype._template : - // Look in dom-module associated with this element's is - (getTemplateFromDomModule(/** @type {PolymerElementConstructor}*/ (this).is) || - // Next look for superclass template (call the super impl this - // way so that `this` points to the superclass) - Object.getPrototypeOf(/** @type {PolymerElementConstructor}*/ (this).prototype).constructor.template); - } - return this._template; - } - - /** - * Set the template. - * - * @param {!HTMLTemplateElement|string} value Template to set. - */ - static set template(value) { - this._template = value; - } - - /** - * Path matching the url from which the element was imported. - * - * This path is used to resolve url's in template style cssText. - * The `importPath` property is also set on element instances and can be - * used to create bindings relative to the import path. - * - * For elements defined in ES modules, users should implement - * `static get importMeta() { return import.meta; }`, and the default - * implementation of `importPath` will return `import.meta.url`'s path. - * For elements defined in HTML imports, this getter will return the path - * to the document containing a `dom-module` element matching this - * element's static `is` property. - * - * Note, this path should contain a trailing `/`. - * - * @return {string} The import path for this element class - * @suppress {missingProperties} - */ - static get importPath() { - if (!this.hasOwnProperty(JSCompiler_renameProperty('_importPath', this))) { - const meta = this.importMeta; - if (meta) { - this._importPath = pathFromUrl(meta.url); - } else { - const module = DomModule.import(/** @type {PolymerElementConstructor} */ (this).is); - this._importPath = (module && module.assetpath) || - Object.getPrototypeOf(/** @type {PolymerElementConstructor}*/ (this).prototype).constructor.importPath; - } - } - return this._importPath; - } - - constructor() { - super(); - /** @type {HTMLTemplateElement} */ - this._template; - /** @type {string} */ - this._importPath; - /** @type {string} */ - this.rootPath; - /** @type {string} */ - this.importPath; - /** @type {StampedTemplate | HTMLElement | ShadowRoot} */ - this.root; - /** @type {!Object<string, !Element>} */ - this.$; - } - - /** - * Overrides the default `PropertyAccessors` to ensure class - * metaprogramming related to property accessors and effects has - * completed (calls `finalize`). - * - * It also initializes any property defaults provided via `value` in - * `properties` metadata. - * - * @return {void} - * @override - * @suppress {invalidCasts,missingProperties} go/missingfnprops - */ - _initializeProperties() { - this.constructor.finalize(); - // note: finalize template when we have access to `localName` to - // avoid dependence on `is` for polyfilling styling. - this.constructor._finalizeTemplate(/** @type {!HTMLElement} */(this).localName); - super._initializeProperties(); - // set path defaults - this.rootPath = rootPath; - this.importPath = this.constructor.importPath; - // apply property defaults... - let p$ = propertyDefaults(this.constructor); - if (!p$) { - return; - } - for (let p in p$) { - let info = p$[p]; - // Don't set default value if there is already an own property, which - // happens when a `properties` property with default but no effects had - // a property set (e.g. bound) by its host before upgrade - if (!this.hasOwnProperty(p)) { - let value = typeof info.value == 'function' ? - info.value.call(this) : - info.value; - // Set via `_setProperty` if there is an accessor, to enable - // initializing readOnly property defaults - if (this._hasAccessor(p)) { - this._setPendingProperty(p, value, true); - } else { - this[p] = value; - } - } - } - } - - /** - * Gather style text for a style element in the template. - * - * @param {string} cssText Text containing styling to process - * @param {string} baseURI Base URI to rebase CSS paths against - * @return {string} The processed CSS text - * @protected - */ - static _processStyleText(cssText, baseURI) { - return resolveCss(cssText, baseURI); - } - - /** - * Configures an element `proto` to function with a given `template`. - * The element name `is` and extends `ext` must be specified for ShadyCSS - * style scoping. - * - * @param {string} is Tag name (or type extension name) for this element - * @return {void} - * @protected - */ - static _finalizeTemplate(is) { - /** @const {HTMLTemplateElement} */ - const template = this.prototype._template; - if (template && !template.__polymerFinalized) { - template.__polymerFinalized = true; - const importPath = this.importPath; - const baseURI = importPath ? resolveUrl(importPath) : ''; - // e.g. support `include="module-name"`, and ShadyCSS - processElementStyles(this, template, is, baseURI); - this.prototype._bindTemplate(template); - } - } - - /** - * Provides a default implementation of the standard Custom Elements - * `connectedCallback`. - * - * The default implementation enables the property effects system and - * flushes any pending properties, and updates shimmed CSS properties - * when using the ShadyCSS scoping/custom properties polyfill. - * - * @override - * @suppress {missingProperties, invalidCasts} Super may or may not - * implement the callback - * @return {void} - */ - connectedCallback() { - if (window.ShadyCSS && this._template) { - window.ShadyCSS.styleElement(/** @type {!HTMLElement} */(this)); - } - super.connectedCallback(); - } - - /** - * Stamps the element template. - * - * @return {void} - * @override - */ - ready() { - if (this._template) { - this.root = this._stampTemplate(this._template); - this.$ = this.root.$; - } - super.ready(); - } - - /** - * Implements `PropertyEffects`'s `_readyClients` call. Attaches - * element dom by calling `_attachDom` with the dom stamped from the - * element's template via `_stampTemplate`. Note that this allows - * client dom to be attached to the element prior to any observers - * running. - * - * @return {void} - * @override - */ - _readyClients() { - if (this._template) { - this.root = this._attachDom(/** @type {StampedTemplate} */(this.root)); - } - // The super._readyClients here sets the clients initialized flag. - // We must wait to do this until after client dom is created/attached - // so that this flag can be checked to prevent notifications fired - // during this process from being handled before clients are ready. - super._readyClients(); - } - - - /** - * Attaches an element's stamped dom to itself. By default, - * this method creates a `shadowRoot` and adds the dom to it. - * However, this method may be overridden to allow an element - * to put its dom in another location. - * - * @override - * @throws {Error} - * @suppress {missingReturn} - * @param {StampedTemplate} dom to attach to the element. - * @return {ShadowRoot} node to which the dom has been attached. - */ - _attachDom(dom) { - const n = wrap(this); - if (n.attachShadow) { - if (dom) { - if (!n.shadowRoot) { - n.attachShadow({mode: 'open'}); - } - n.shadowRoot.appendChild(dom); - if (syncInitialRender && window.ShadyDOM) { - ShadyDOM.flushInitial(n.shadowRoot); - } - return n.shadowRoot; - } - return null; - } else { - throw new Error('ShadowDOM not available. ' + - // TODO(sorvell): move to compile-time conditional when supported - 'PolymerElement can create dom as children instead of in ' + - 'ShadowDOM by setting `this.root = this;\` before \`ready\`.'); - } - } - - /** - * When using the ShadyCSS scoping and custom property shim, causes all - * shimmed styles in this element (and its subtree) to be updated - * based on current custom property values. - * - * The optional parameter overrides inline custom property styles with an - * object of properties where the keys are CSS properties, and the values - * are strings. - * - * Example: `this.updateStyles({'--color': 'blue'})` - * - * These properties are retained unless a value of `null` is set. - * - * Note: This function does not support updating CSS mixins. - * You can not dynamically change the value of an `@apply`. - * - * @override - * @param {Object=} properties Bag of custom property key/values to - * apply to this element. - * @return {void} - * @suppress {invalidCasts} - */ - updateStyles(properties) { - if (window.ShadyCSS) { - window.ShadyCSS.styleSubtree(/** @type {!HTMLElement} */(this), properties); - } - } - - /** - * Rewrites a given URL relative to a base URL. The base URL defaults to - * the original location of the document containing the `dom-module` for - * this element. This method will return the same URL before and after - * bundling. - * - * Note that this function performs no resolution for URLs that start - * with `/` (absolute URLs) or `#` (hash identifiers). For general purpose - * URL resolution, use `window.URL`. - * - * @override - * @param {string} url URL to resolve. - * @param {string=} base Optional base URL to resolve against, defaults - * to the element's `importPath` - * @return {string} Rewritten URL relative to base - */ - resolveUrl(url, base) { - if (!base && this.importPath) { - base = resolveUrl(this.importPath); - } - return resolveUrl(url, base); - } - - /** - * Overrides `PropertyEffects` to add map of dynamic functions on - * template info, for consumption by `PropertyEffects` template binding - * code. This map determines which method templates should have accessors - * created for them. - * - * @param {!HTMLTemplateElement} template Template - * @param {!TemplateInfo} templateInfo Template metadata for current template - * @param {!NodeInfo} nodeInfo Node metadata for current template. - * @return {boolean} . - * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do - */ - static _parseTemplateContent(template, templateInfo, nodeInfo) { - templateInfo.dynamicFns = templateInfo.dynamicFns || this._properties; - return super._parseTemplateContent(template, templateInfo, nodeInfo); - } - - /** - * Overrides `PropertyEffects` to warn on use of undeclared properties in - * template. - * - * @param {Object} templateInfo Template metadata to add effect to - * @param {string} prop Property that should trigger the effect - * @param {Object=} effect Effect metadata object - * @return {void} - * @protected - * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do - */ - static _addTemplatePropertyEffect(templateInfo, prop, effect) { - // Warn if properties are used in template without being declared. - // Properties must be listed in `properties` to be included in - // `observedAttributes` since CE V1 reads that at registration time, and - // since we want to keep template parsing lazy, we can't automatically - // add undeclared properties used in templates to `observedAttributes`. - // The warning is only enabled in `legacyOptimizations` mode, since - // we don't want to spam existing users who might have adopted the - // shorthand when attribute deserialization is not important. - if (legacyOptimizations && !(prop in this._properties)) { - console.warn(`Property '${prop}' used in template but not declared in 'properties'; ` + - `attribute will not be observed.`); - } - return super._addTemplatePropertyEffect(templateInfo, prop, effect); - } - - } - - return PolymerElement; -}); - -/** - * When using the ShadyCSS scoping and custom property shim, causes all - * shimmed `styles` (via `custom-style`) in the document (and its subtree) - * to be updated based on current custom property values. - * - * The optional parameter overrides inline custom property styles with an - * object of properties where the keys are CSS properties, and the values - * are strings. - * - * Example: `updateStyles({'--color': 'blue'})` - * - * These properties are retained unless a value of `null` is set. - * - * @param {Object=} props Bag of custom property key/values to - * apply to the document. - * @return {void} - */ -export const updateStyles = function(props) { - if (window.ShadyCSS) { - window.ShadyCSS.styleDocument(props); - } -}; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/gesture-event-listeners.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/gesture-event-listeners.js deleted file mode 100644 index 04ad6efed8a..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/gesture-event-listeners.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import '../utils/boot.js'; - -import { dedupingMixin } from '../utils/mixin.js'; -import { addListener, removeListener } from '../utils/gestures.js'; - -/** - * Element class mixin that provides API for adding Polymer's cross-platform - * gesture events to nodes. - * - * The API is designed to be compatible with override points implemented - * in `TemplateStamp` such that declarative event listeners in - * templates will support gesture events when this mixin is applied along with - * `TemplateStamp`. - * - * @mixinFunction - * @polymer - * @summary Element class mixin that provides API for adding Polymer's - * cross-platform - * gesture events to nodes - */ -export const GestureEventListeners = dedupingMixin( - /** - * @template T - * @param {function(new:T)} superClass Class to apply mixin to. - * @return {function(new:T)} superClass with mixin applied. - */ - (superClass) => { - /** - * @polymer - * @mixinClass - * @implements {Polymer_GestureEventListeners} - */ - class GestureEventListeners extends superClass { - /** - * Add the event listener to the node if it is a gestures event. - * - * @param {!EventTarget} node Node to add event listener to - * @param {string} eventName Name of event - * @param {function(!Event):void} handler Listener function to add - * @return {void} - * @override - */ - _addEventListenerToNode(node, eventName, handler) { - if (!addListener(node, eventName, handler)) { - super._addEventListenerToNode(node, eventName, handler); - } - } - - /** - * Remove the event listener to the node if it is a gestures event. - * - * @param {!EventTarget} node Node to remove event listener from - * @param {string} eventName Name of event - * @param {function(!Event):void} handler Listener function to remove - * @return {void} - * @override - */ - _removeEventListenerFromNode(node, eventName, handler) { - if (!removeListener(node, eventName, handler)) { - super._removeEventListenerFromNode(node, eventName, handler); - } - } - } - - return GestureEventListeners; - }); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/mutable-data.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/mutable-data.js deleted file mode 100644 index 3c937b94e81..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/mutable-data.js +++ /dev/null @@ -1,194 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import { dedupingMixin } from '../utils/mixin.js'; - -// Common implementation for mixin & behavior -function mutablePropertyChange(inst, property, value, old, mutableData) { - let isObject; - if (mutableData) { - isObject = (typeof value === 'object' && value !== null); - // Pull `old` for Objects from temp cache, but treat `null` as a primitive - if (isObject) { - old = inst.__dataTemp[property]; - } - } - // Strict equality check, but return false for NaN===NaN - let shouldChange = (old !== value && (old === old || value === value)); - // Objects are stored in temporary cache (cleared at end of - // turn), which is used for dirty-checking - if (isObject && shouldChange) { - inst.__dataTemp[property] = value; - } - return shouldChange; -} - -/** - * Element class mixin to skip strict dirty-checking for objects and arrays - * (always consider them to be "dirty"), for use on elements utilizing - * `PropertyEffects` - * - * By default, `PropertyEffects` performs strict dirty checking on - * objects, which means that any deep modifications to an object or array will - * not be propagated unless "immutable" data patterns are used (i.e. all object - * references from the root to the mutation were changed). - * - * Polymer also provides a proprietary data mutation and path notification API - * (e.g. `notifyPath`, `set`, and array mutation API's) that allow efficient - * mutation and notification of deep changes in an object graph to all elements - * bound to the same object graph. - * - * In cases where neither immutable patterns nor the data mutation API can be - * used, applying this mixin will cause Polymer to skip dirty checking for - * objects and arrays (always consider them to be "dirty"). This allows a - * user to make a deep modification to a bound object graph, and then either - * simply re-set the object (e.g. `this.items = this.items`) or call `notifyPath` - * (e.g. `this.notifyPath('items')`) to update the tree. Note that all - * elements that wish to be updated based on deep mutations must apply this - * mixin or otherwise skip strict dirty checking for objects/arrays. - * Specifically, any elements in the binding tree between the source of a - * mutation and the consumption of it must apply this mixin or enable the - * `OptionalMutableData` mixin. - * - * In order to make the dirty check strategy configurable, see - * `OptionalMutableData`. - * - * Note, the performance characteristics of propagating large object graphs - * will be worse as opposed to using strict dirty checking with immutable - * patterns or Polymer's path notification API. - * - * @mixinFunction - * @polymer - * @summary Element class mixin to skip strict dirty-checking for objects - * and arrays - */ -export const MutableData = dedupingMixin(superClass => { - - /** - * @polymer - * @mixinClass - * @implements {Polymer_MutableData} - */ - class MutableData extends superClass { - /** - * Overrides `PropertyEffects` to provide option for skipping - * strict equality checking for Objects and Arrays. - * - * This method pulls the value to dirty check against from the `__dataTemp` - * cache (rather than the normal `__data` cache) for Objects. Since the temp - * cache is cleared at the end of a turn, this implementation allows - * side-effects of deep object changes to be processed by re-setting the - * same object (using the temp cache as an in-turn backstop to prevent - * cycles due to 2-way notification). - * - * @param {string} property Property name - * @param {*} value New property value - * @param {*} old Previous property value - * @return {boolean} Whether the property should be considered a change - * @protected - */ - _shouldPropertyChange(property, value, old) { - return mutablePropertyChange(this, property, value, old, true); - } - - } - - return MutableData; - -}); - -/** - * Element class mixin to add the optional ability to skip strict - * dirty-checking for objects and arrays (always consider them to be - * "dirty") by setting a `mutable-data` attribute on an element instance. - * - * By default, `PropertyEffects` performs strict dirty checking on - * objects, which means that any deep modifications to an object or array will - * not be propagated unless "immutable" data patterns are used (i.e. all object - * references from the root to the mutation were changed). - * - * Polymer also provides a proprietary data mutation and path notification API - * (e.g. `notifyPath`, `set`, and array mutation API's) that allow efficient - * mutation and notification of deep changes in an object graph to all elements - * bound to the same object graph. - * - * In cases where neither immutable patterns nor the data mutation API can be - * used, applying this mixin will allow Polymer to skip dirty checking for - * objects and arrays (always consider them to be "dirty"). This allows a - * user to make a deep modification to a bound object graph, and then either - * simply re-set the object (e.g. `this.items = this.items`) or call `notifyPath` - * (e.g. `this.notifyPath('items')`) to update the tree. Note that all - * elements that wish to be updated based on deep mutations must apply this - * mixin or otherwise skip strict dirty checking for objects/arrays. - * Specifically, any elements in the binding tree between the source of a - * mutation and the consumption of it must enable this mixin or apply the - * `MutableData` mixin. - * - * While this mixin adds the ability to forgo Object/Array dirty checking, - * the `mutableData` flag defaults to false and must be set on the instance. - * - * Note, the performance characteristics of propagating large object graphs - * will be worse by relying on `mutableData: true` as opposed to using - * strict dirty checking with immutable patterns or Polymer's path notification - * API. - * - * @mixinFunction - * @polymer - * @summary Element class mixin to optionally skip strict dirty-checking - * for objects and arrays - */ -export const OptionalMutableData = dedupingMixin(superClass => { - - /** - * @mixinClass - * @polymer - * @implements {Polymer_OptionalMutableData} - */ - class OptionalMutableData extends superClass { - - static get properties() { - return { - /** - * Instance-level flag for configuring the dirty-checking strategy - * for this element. When true, Objects and Arrays will skip dirty - * checking, otherwise strict equality checking will be used. - */ - mutableData: Boolean - }; - } - - /** - * Overrides `PropertyEffects` to provide option for skipping - * strict equality checking for Objects and Arrays. - * - * When `this.mutableData` is true on this instance, this method - * pulls the value to dirty check against from the `__dataTemp` cache - * (rather than the normal `__data` cache) for Objects. Since the temp - * cache is cleared at the end of a turn, this implementation allows - * side-effects of deep object changes to be processed by re-setting the - * same object (using the temp cache as an in-turn backstop to prevent - * cycles due to 2-way notification). - * - * @param {string} property Property name - * @param {*} value New property value - * @param {*} old Previous property value - * @return {boolean} Whether the property should be considered a change - * @protected - */ - _shouldPropertyChange(property, value, old) { - return mutablePropertyChange(this, property, value, old, this.mutableData); - } - } - - return OptionalMutableData; - -}); - -// Export for use by legacy behavior -MutableData._mutablePropertyChange = mutablePropertyChange; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/properties-changed.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/properties-changed.js deleted file mode 100644 index 78ec739ae2c..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/properties-changed.js +++ /dev/null @@ -1,555 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import '../utils/boot.js'; - -import { dedupingMixin } from '../utils/mixin.js'; -import { microTask } from '../utils/async.js'; -import { wrap } from '../utils/wrap.js'; - -/** @const {!AsyncInterface} */ -const microtask = microTask; - -/** - * Element class mixin that provides basic meta-programming for creating one - * or more property accessors (getter/setter pair) that enqueue an async - * (batched) `_propertiesChanged` callback. - * - * For basic usage of this mixin, call `MyClass.createProperties(props)` - * once at class definition time to create property accessors for properties - * named in props, implement `_propertiesChanged` to react as desired to - * property changes, and implement `static get observedAttributes()` and - * include lowercase versions of any property names that should be set from - * attributes. Last, call `this._enableProperties()` in the element's - * `connectedCallback` to enable the accessors. - * - * @mixinFunction - * @polymer - * @summary Element class mixin for reacting to property changes from - * generated property accessors. - */ -export const PropertiesChanged = dedupingMixin( - /** - * @template T - * @param {function(new:T)} superClass Class to apply mixin to. - * @return {function(new:T)} superClass with mixin applied. - */ - (superClass) => { - - /** - * @polymer - * @mixinClass - * @implements {Polymer_PropertiesChanged} - * @unrestricted - */ - class PropertiesChanged extends superClass { - - /** - * Creates property accessors for the given property names. - * @param {!Object} props Object whose keys are names of accessors. - * @return {void} - * @protected - */ - static createProperties(props) { - const proto = this.prototype; - for (let prop in props) { - // don't stomp an existing accessor - if (!(prop in proto)) { - proto._createPropertyAccessor(prop); - } - } - } - - /** - * Returns an attribute name that corresponds to the given property. - * The attribute name is the lowercased property name. Override to - * customize this mapping. - * @param {string} property Property to convert - * @return {string} Attribute name corresponding to the given property. - * - * @protected - */ - static attributeNameForProperty(property) { - return property.toLowerCase(); - } - - /** - * Override point to provide a type to which to deserialize a value to - * a given property. - * @param {string} name Name of property - * - * @protected - */ - static typeForProperty(name) { } //eslint-disable-line no-unused-vars - - /** - * Creates a setter/getter pair for the named property with its own - * local storage. The getter returns the value in the local storage, - * and the setter calls `_setProperty`, which updates the local storage - * for the property and enqueues a `_propertiesChanged` callback. - * - * This method may be called on a prototype or an instance. Calling - * this method may overwrite a property value that already exists on - * the prototype/instance by creating the accessor. - * - * @param {string} property Name of the property - * @param {boolean=} readOnly When true, no setter is created; the - * protected `_setProperty` function must be used to set the property - * @return {void} - * @protected - * @override - */ - _createPropertyAccessor(property, readOnly) { - this._addPropertyToAttributeMap(property); - if (!this.hasOwnProperty('__dataHasAccessor')) { - this.__dataHasAccessor = Object.assign({}, this.__dataHasAccessor); - } - if (!this.__dataHasAccessor[property]) { - this.__dataHasAccessor[property] = true; - this._definePropertyAccessor(property, readOnly); - } - } - - /** - * Adds the given `property` to a map matching attribute names - * to property names, using `attributeNameForProperty`. This map is - * used when deserializing attribute values to properties. - * - * @param {string} property Name of the property - * @override - */ - _addPropertyToAttributeMap(property) { - if (!this.hasOwnProperty('__dataAttributes')) { - this.__dataAttributes = Object.assign({}, this.__dataAttributes); - } - if (!this.__dataAttributes[property]) { - const attr = this.constructor.attributeNameForProperty(property); - this.__dataAttributes[attr] = property; - } - } - - /** - * Defines a property accessor for the given property. - * @param {string} property Name of the property - * @param {boolean=} readOnly When true, no setter is created - * @return {void} - * @override - */ - _definePropertyAccessor(property, readOnly) { - Object.defineProperty(this, property, { - /* eslint-disable valid-jsdoc */ - /** @this {PropertiesChanged} */ - get() { - return this._getProperty(property); - }, - /** @this {PropertiesChanged} */ - set: readOnly ? function () {} : function (value) { - this._setProperty(property, value); - } - /* eslint-enable */ - }); - } - - constructor() { - super(); - /** @protected {boolean} */ - this.__dataEnabled = false; - this.__dataReady = false; - this.__dataInvalid = false; - this.__data = {}; - this.__dataPending = null; - this.__dataOld = null; - this.__dataInstanceProps = null; - this.__serializing = false; - this._initializeProperties(); - } - - /** - * Lifecycle callback called when properties are enabled via - * `_enableProperties`. - * - * Users may override this function to implement behavior that is - * dependent on the element having its property data initialized, e.g. - * from defaults (initialized from `constructor`, `_initializeProperties`), - * `attributeChangedCallback`, or values propagated from host e.g. via - * bindings. `super.ready()` must be called to ensure the data system - * becomes enabled. - * - * @return {void} - * @public - * @override - */ - ready() { - this.__dataReady = true; - this._flushProperties(); - } - - /** - * Initializes the local storage for property accessors. - * - * Provided as an override point for performing any setup work prior - * to initializing the property accessor system. - * - * @return {void} - * @protected - * @override - */ - _initializeProperties() { - // Capture instance properties; these will be set into accessors - // during first flush. Don't set them here, since we want - // these to overwrite defaults/constructor assignments - for (let p in this.__dataHasAccessor) { - if (this.hasOwnProperty(p)) { - this.__dataInstanceProps = this.__dataInstanceProps || {}; - this.__dataInstanceProps[p] = this[p]; - delete this[p]; - } - } - } - - /** - * Called at ready time with bag of instance properties that overwrote - * accessors when the element upgraded. - * - * The default implementation sets these properties back into the - * setter at ready time. This method is provided as an override - * point for customizing or providing more efficient initialization. - * - * @param {Object} props Bag of property values that were overwritten - * when creating property accessors. - * @return {void} - * @protected - * @override - */ - _initializeInstanceProperties(props) { - Object.assign(this, props); - } - - /** - * Updates the local storage for a property (via `_setPendingProperty`) - * and enqueues a `_proeprtiesChanged` callback. - * - * @param {string} property Name of the property - * @param {*} value Value to set - * @return {void} - * @protected - * @override - */ - _setProperty(property, value) { - if (this._setPendingProperty(property, value)) { - this._invalidateProperties(); - } - } - - /** - * Returns the value for the given property. - * @param {string} property Name of property - * @return {*} Value for the given property - * @protected - * @override - */ - _getProperty(property) { - return this.__data[property]; - } - - /* eslint-disable no-unused-vars */ - /** - * Updates the local storage for a property, records the previous value, - * and adds it to the set of "pending changes" that will be passed to the - * `_propertiesChanged` callback. This method does not enqueue the - * `_propertiesChanged` callback. - * - * @param {string} property Name of the property - * @param {*} value Value to set - * @param {boolean=} ext Not used here; affordance for closure - * @return {boolean} Returns true if the property changed - * @protected - * @override - */ - _setPendingProperty(property, value, ext) { - let old = this.__data[property]; - let changed = this._shouldPropertyChange(property, value, old); - if (changed) { - if (!this.__dataPending) { - this.__dataPending = {}; - this.__dataOld = {}; - } - // Ensure old is captured from the last turn - if (this.__dataOld && !(property in this.__dataOld)) { - this.__dataOld[property] = old; - } - this.__data[property] = value; - this.__dataPending[property] = value; - } - return changed; - } - /* eslint-enable */ - - /** - * Marks the properties as invalid, and enqueues an async - * `_propertiesChanged` callback. - * - * @return {void} - * @protected - * @override - */ - _invalidateProperties() { - if (!this.__dataInvalid && this.__dataReady) { - this.__dataInvalid = true; - microtask.run(() => { - if (this.__dataInvalid) { - this.__dataInvalid = false; - this._flushProperties(); - } - }); - } - } - - /** - * Call to enable property accessor processing. Before this method is - * called accessor values will be set but side effects are - * queued. When called, any pending side effects occur immediately. - * For elements, generally `connectedCallback` is a normal spot to do so. - * It is safe to call this method multiple times as it only turns on - * property accessors once. - * - * @return {void} - * @protected - * @override - */ - _enableProperties() { - if (!this.__dataEnabled) { - this.__dataEnabled = true; - if (this.__dataInstanceProps) { - this._initializeInstanceProperties(this.__dataInstanceProps); - this.__dataInstanceProps = null; - } - this.ready(); - } - } - - /** - * Calls the `_propertiesChanged` callback with the current set of - * pending changes (and old values recorded when pending changes were - * set), and resets the pending set of changes. Generally, this method - * should not be called in user code. - * - * @return {void} - * @protected - * @override - */ - _flushProperties() { - const props = this.__data; - const changedProps = this.__dataPending; - const old = this.__dataOld; - if (this._shouldPropertiesChange(props, changedProps, old)) { - this.__dataPending = null; - this.__dataOld = null; - this._propertiesChanged(props, changedProps, old); - } - } - - /** - * Called in `_flushProperties` to determine if `_propertiesChanged` - * should be called. The default implementation returns true if - * properties are pending. Override to customize when - * `_propertiesChanged` is called. - * @param {!Object} currentProps Bag of all current accessor values - * @param {?Object} changedProps Bag of properties changed since the last - * call to `_propertiesChanged` - * @param {?Object} oldProps Bag of previous values for each property - * in `changedProps` - * @return {boolean} true if changedProps is truthy - * @override - */ - _shouldPropertiesChange(currentProps, changedProps, oldProps) { // eslint-disable-line no-unused-vars - return Boolean(changedProps); - } - - /** - * Callback called when any properties with accessors created via - * `_createPropertyAccessor` have been set. - * - * @param {!Object} currentProps Bag of all current accessor values - * @param {?Object} changedProps Bag of properties changed since the last - * call to `_propertiesChanged` - * @param {?Object} oldProps Bag of previous values for each property - * in `changedProps` - * @return {void} - * @protected - * @override - */ - _propertiesChanged(currentProps, changedProps, oldProps) { // eslint-disable-line no-unused-vars - } - - /** - * Method called to determine whether a property value should be - * considered as a change and cause the `_propertiesChanged` callback - * to be enqueued. - * - * The default implementation returns `true` if a strict equality - * check fails. The method always returns false for `NaN`. - * - * Override this method to e.g. provide stricter checking for - * Objects/Arrays when using immutable patterns. - * - * @param {string} property Property name - * @param {*} value New property value - * @param {*} old Previous property value - * @return {boolean} Whether the property should be considered a change - * and enqueue a `_proeprtiesChanged` callback - * @protected - * @override - */ - _shouldPropertyChange(property, value, old) { - return ( - // Strict equality check - (old !== value && - // This ensures (old==NaN, value==NaN) always returns false - (old === old || value === value)) - ); - } - - /** - * Implements native Custom Elements `attributeChangedCallback` to - * set an attribute value to a property via `_attributeToProperty`. - * - * @param {string} name Name of attribute that changed - * @param {?string} old Old attribute value - * @param {?string} value New attribute value - * @param {?string=} namespace Attribute namespace. - * @return {void} - * @suppress {missingProperties} Super may or may not implement the callback - * @override - */ - attributeChangedCallback(name, old, value, namespace) { - if (old !== value) { - this._attributeToProperty(name, value); - } - if (super.attributeChangedCallback) { - super.attributeChangedCallback(name, old, value, namespace); - } - } - - /** - * Deserializes an attribute to its associated property. - * - * This method calls the `_deserializeValue` method to convert the string to - * a typed value. - * - * @param {string} attribute Name of attribute to deserialize. - * @param {?string} value of the attribute. - * @param {*=} type type to deserialize to, defaults to the value - * returned from `typeForProperty` - * @return {void} - * @override - */ - _attributeToProperty(attribute, value, type) { - if (!this.__serializing) { - const map = this.__dataAttributes; - const property = map && map[attribute] || attribute; - this[property] = this._deserializeValue(value, type || - this.constructor.typeForProperty(property)); - } - } - - /** - * Serializes a property to its associated attribute. - * - * @suppress {invalidCasts} Closure can't figure out `this` is an element. - * - * @param {string} property Property name to reflect. - * @param {string=} attribute Attribute name to reflect to. - * @param {*=} value Property value to refect. - * @return {void} - * @override - */ - _propertyToAttribute(property, attribute, value) { - this.__serializing = true; - value = (arguments.length < 3) ? this[property] : value; - this._valueToNodeAttribute(/** @type {!HTMLElement} */(this), value, - attribute || this.constructor.attributeNameForProperty(property)); - this.__serializing = false; - } - - /** - * Sets a typed value to an HTML attribute on a node. - * - * This method calls the `_serializeValue` method to convert the typed - * value to a string. If the `_serializeValue` method returns `undefined`, - * the attribute will be removed (this is the default for boolean - * type `false`). - * - * @param {Element} node Element to set attribute to. - * @param {*} value Value to serialize. - * @param {string} attribute Attribute name to serialize to. - * @return {void} - * @override - */ - _valueToNodeAttribute(node, value, attribute) { - const str = this._serializeValue(value); - if (str === undefined) { - node.removeAttribute(attribute); - } else { - if (attribute === 'class' || attribute === 'name' || attribute === 'slot') { - node = /** @type {?Element} */(wrap(node)); - } - node.setAttribute(attribute, str); - } - } - - /** - * Converts a typed JavaScript value to a string. - * - * This method is called when setting JS property values to - * HTML attributes. Users may override this method to provide - * serialization for custom types. - * - * @param {*} value Property value to serialize. - * @return {string | undefined} String serialized from the provided - * property value. - * @override - */ - _serializeValue(value) { - switch (typeof value) { - case 'boolean': - return value ? '' : undefined; - default: - return value != null ? value.toString() : undefined; - } - } - - /** - * Converts a string to a typed JavaScript value. - * - * This method is called when reading HTML attribute values to - * JS properties. Users may override this method to provide - * deserialization for custom `type`s. Types for `Boolean`, `String`, - * and `Number` convert attributes to the expected types. - * - * @param {?string} value Value to deserialize. - * @param {*=} type Type to deserialize the string to. - * @return {*} Typed value deserialized from the provided string. - * @override - */ - _deserializeValue(value, type) { - switch (type) { - case Boolean: - return (value !== null); - case Number: - return Number(value); - default: - return value; - } - } - - } - - return PropertiesChanged; -}); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/properties-mixin.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/properties-mixin.js deleted file mode 100644 index 871937bac26..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/properties-mixin.js +++ /dev/null @@ -1,233 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import '../utils/boot.js'; - -import { dedupingMixin } from '../utils/mixin.js'; -import { register, incrementInstanceCount } from '../utils/telemetry.js'; -import { PropertiesChanged } from './properties-changed.js'; - -/** - * Creates a copy of `props` with each property normalized such that - * upgraded it is an object with at least a type property { type: Type}. - * - * @param {Object} props Properties to normalize - * @return {Object} Copy of input `props` with normalized properties that - * are in the form {type: Type} - * @private - */ -function normalizeProperties(props) { - const output = {}; - for (let p in props) { - const o = props[p]; - output[p] = (typeof o === 'function') ? {type: o} : o; - } - return output; -} - -/** - * Mixin that provides a minimal starting point to using the PropertiesChanged - * mixin by providing a mechanism to declare properties in a static - * getter (e.g. static get properties() { return { foo: String } }). Changes - * are reported via the `_propertiesChanged` method. - * - * This mixin provides no specific support for rendering. Users are expected - * to create a ShadowRoot and put content into it and update it in whatever - * way makes sense. This can be done in reaction to properties changing by - * implementing `_propertiesChanged`. - * - * @mixinFunction - * @polymer - * @appliesMixin PropertiesChanged - * @summary Mixin that provides a minimal starting point for using - * the PropertiesChanged mixin by providing a declarative `properties` object. - */ -export const PropertiesMixin = dedupingMixin(superClass => { - - /** - * @constructor - * @implements {Polymer_PropertiesChanged} - * @private - */ - const base = PropertiesChanged(superClass); - - /** - * Returns the super class constructor for the given class, if it is an - * instance of the PropertiesMixin. - * - * @param {!PropertiesMixinConstructor} constructor PropertiesMixin constructor - * @return {?PropertiesMixinConstructor} Super class constructor - */ - function superPropertiesClass(constructor) { - const superCtor = Object.getPrototypeOf(constructor); - - // Note, the `PropertiesMixin` class below only refers to the class - // generated by this call to the mixin; the instanceof test only works - // because the mixin is deduped and guaranteed only to apply once, hence - // all constructors in a proto chain will see the same `PropertiesMixin` - return (superCtor.prototype instanceof PropertiesMixin) ? - /** @type {!PropertiesMixinConstructor} */ (superCtor) : null; - } - - /** - * Returns a memoized version of the `properties` object for the - * given class. Properties not in object format are converted to at - * least {type}. - * - * @param {PropertiesMixinConstructor} constructor PropertiesMixin constructor - * @return {Object} Memoized properties object - */ - function ownProperties(constructor) { - if (!constructor.hasOwnProperty(JSCompiler_renameProperty('__ownProperties', constructor))) { - let props = null; - - if (constructor.hasOwnProperty(JSCompiler_renameProperty('properties', constructor))) { - const properties = constructor.properties; - - if (properties) { - props = normalizeProperties(properties); - } - } - - constructor.__ownProperties = props; - } - return constructor.__ownProperties; - } - - /** - * @polymer - * @mixinClass - * @extends {base} - * @implements {Polymer_PropertiesMixin} - * @unrestricted - */ - class PropertiesMixin extends base { - - /** - * Implements standard custom elements getter to observes the attributes - * listed in `properties`. - * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do - */ - static get observedAttributes() { - if (!this.hasOwnProperty('__observedAttributes')) { - register(this.prototype); - const props = this._properties; - this.__observedAttributes = props ? Object.keys(props).map(p => this.attributeNameForProperty(p)) : []; - } - return this.__observedAttributes; - } - - /** - * Finalizes an element definition, including ensuring any super classes - * are also finalized. This includes ensuring property - * accessors exist on the element prototype. This method calls - * `_finalizeClass` to finalize each constructor in the prototype chain. - * @return {void} - */ - static finalize() { - if (!this.hasOwnProperty(JSCompiler_renameProperty('__finalized', this))) { - const superCtor = superPropertiesClass(/** @type {!PropertiesMixinConstructor} */(this)); - if (superCtor) { - superCtor.finalize(); - } - this.__finalized = true; - this._finalizeClass(); - } - } - - /** - * Finalize an element class. This includes ensuring property - * accessors exist on the element prototype. This method is called by - * `finalize` and finalizes the class constructor. - * - * @protected - */ - static _finalizeClass() { - const props = ownProperties(/** @type {!PropertiesMixinConstructor} */(this)); - if (props) { - this.createProperties(props); - } - } - - /** - * Returns a memoized version of all properties, including those inherited - * from super classes. Properties not in object format are converted to - * at least {type}. - * - * @return {Object} Object containing properties for this class - * @protected - */ - static get _properties() { - if (!this.hasOwnProperty( - JSCompiler_renameProperty('__properties', this))) { - const superCtor = superPropertiesClass(/** @type {!PropertiesMixinConstructor} */(this)); - this.__properties = Object.assign({}, - superCtor && superCtor._properties, - ownProperties(/** @type {PropertiesMixinConstructor} */(this))); - } - return this.__properties; - } - - /** - * Overrides `PropertiesChanged` method to return type specified in the - * static `properties` object for the given property. - * @param {string} name Name of property - * @return {*} Type to which to deserialize attribute - * - * @protected - */ - static typeForProperty(name) { - const info = this._properties[name]; - return info && info.type; - } - - /** - * Overrides `PropertiesChanged` method and adds a call to - * `finalize` which lazily configures the element's property accessors. - * @override - * @return {void} - */ - _initializeProperties() { - incrementInstanceCount(); - this.constructor.finalize(); - super._initializeProperties(); - } - - /** - * Called when the element is added to a document. - * Calls `_enableProperties` to turn on property system from - * `PropertiesChanged`. - * @suppress {missingProperties} Super may or may not implement the callback - * @return {void} - * @override - */ - connectedCallback() { - if (super.connectedCallback) { - super.connectedCallback(); - } - this._enableProperties(); - } - - /** - * Called when the element is removed from a document - * @suppress {missingProperties} Super may or may not implement the callback - * @return {void} - * @override - */ - disconnectedCallback() { - if (super.disconnectedCallback) { - super.disconnectedCallback(); - } - } - - } - - return PropertiesMixin; - -}); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/property-accessors.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/property-accessors.js deleted file mode 100644 index bfa7f33a7e2..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/property-accessors.js +++ /dev/null @@ -1,323 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import '../utils/boot.js'; - -import { dedupingMixin } from '../utils/mixin.js'; -import { camelToDashCase, dashToCamelCase } from '../utils/case-map.js'; -import { PropertiesChanged } from './properties-changed.js'; - -// Save map of native properties; this forms a blacklist or properties -// that won't have their values "saved" by `saveAccessorValue`, since -// reading from an HTMLElement accessor from the context of a prototype throws -const nativeProperties = {}; -let proto = HTMLElement.prototype; -while (proto) { - let props = Object.getOwnPropertyNames(proto); - for (let i=0; i<props.length; i++) { - nativeProperties[props[i]] = true; - } - proto = Object.getPrototypeOf(proto); -} - -/** - * Used to save the value of a property that will be overridden with - * an accessor. If the `model` is a prototype, the values will be saved - * in `__dataProto`, and it's up to the user (or downstream mixin) to - * decide how/when to set these values back into the accessors. - * If `model` is already an instance (it has a `__data` property), then - * the value will be set as a pending property, meaning the user should - * call `_invalidateProperties` or `_flushProperties` to take effect - * - * @param {Object} model Prototype or instance - * @param {string} property Name of property - * @return {void} - * @private - */ -function saveAccessorValue(model, property) { - // Don't read/store value for any native properties since they could throw - if (!nativeProperties[property]) { - let value = model[property]; - if (value !== undefined) { - if (model.__data) { - // Adding accessor to instance; update the property - // It is the user's responsibility to call _flushProperties - model._setPendingProperty(property, value); - } else { - // Adding accessor to proto; save proto's value for instance-time use - if (!model.__dataProto) { - model.__dataProto = {}; - } else if (!model.hasOwnProperty(JSCompiler_renameProperty('__dataProto', model))) { - model.__dataProto = Object.create(model.__dataProto); - } - model.__dataProto[property] = value; - } - } - } -} - -/** - * Element class mixin that provides basic meta-programming for creating one - * or more property accessors (getter/setter pair) that enqueue an async - * (batched) `_propertiesChanged` callback. - * - * For basic usage of this mixin: - * - * - Declare attributes to observe via the standard `static get - * observedAttributes()`. Use `dash-case` attribute names to represent - * `camelCase` property names. - * - Implement the `_propertiesChanged` callback on the class. - * - Call `MyClass.createPropertiesForAttributes()` **once** on the class to - * generate property accessors for each observed attribute. This must be - * called before the first instance is created, for example, by calling it - * before calling `customElements.define`. It can also be called lazily from - * the element's `constructor`, as long as it's guarded so that the call is - * only made once, when the first instance is created. - * - Call `this._enableProperties()` in the element's `connectedCallback` to - * enable the accessors. - * - * Any `observedAttributes` will automatically be - * deserialized via `attributeChangedCallback` and set to the associated - * property using `dash-case`-to-`camelCase` convention. - * - * @mixinFunction - * @polymer - * @appliesMixin PropertiesChanged - * @summary Element class mixin for reacting to property changes from - * generated property accessors. - */ -export const PropertyAccessors = dedupingMixin(superClass => { - - /** - * @constructor - * @implements {Polymer_PropertiesChanged} - * @unrestricted - * @private - */ - const base = PropertiesChanged(superClass); - - /** - * @polymer - * @mixinClass - * @implements {Polymer_PropertyAccessors} - * @extends {base} - * @unrestricted - */ - class PropertyAccessors extends base { - - /** - * Generates property accessors for all attributes in the standard - * static `observedAttributes` array. - * - * Attribute names are mapped to property names using the `dash-case` to - * `camelCase` convention - * - * @return {void} - */ - static createPropertiesForAttributes() { - let a$ = this.observedAttributes; - for (let i=0; i < a$.length; i++) { - this.prototype._createPropertyAccessor(dashToCamelCase(a$[i])); - } - } - - /** - * Returns an attribute name that corresponds to the given property. - * By default, converts camel to dash case, e.g. `fooBar` to `foo-bar`. - * @param {string} property Property to convert - * @return {string} Attribute name corresponding to the given property. - * - * @protected - */ - static attributeNameForProperty(property) { - return camelToDashCase(property); - } - - /** - * Overrides PropertiesChanged implementation to initialize values for - * accessors created for values that already existed on the element - * prototype. - * - * @return {void} - * @protected - * @override - */ - _initializeProperties() { - if (this.__dataProto) { - this._initializeProtoProperties(this.__dataProto); - this.__dataProto = null; - } - super._initializeProperties(); - } - - /** - * Called at instance time with bag of properties that were overwritten - * by accessors on the prototype when accessors were created. - * - * The default implementation sets these properties back into the - * setter at instance time. This method is provided as an override - * point for customizing or providing more efficient initialization. - * - * @param {Object} props Bag of property values that were overwritten - * when creating property accessors. - * @return {void} - * @protected - * @override - */ - _initializeProtoProperties(props) { - for (let p in props) { - this._setProperty(p, props[p]); - } - } - - /** - * Ensures the element has the given attribute. If it does not, - * assigns the given value to the attribute. - * - * @suppress {invalidCasts} Closure can't figure out `this` is infact an - * element - * - * @param {string} attribute Name of attribute to ensure is set. - * @param {string} value of the attribute. - * @return {void} - * @override - */ - _ensureAttribute(attribute, value) { - const el = /** @type {!HTMLElement} */(this); - if (!el.hasAttribute(attribute)) { - this._valueToNodeAttribute(el, value, attribute); - } - } - - /** - * Overrides PropertiesChanged implemention to serialize objects as JSON. - * - * @param {*} value Property value to serialize. - * @return {string | undefined} String serialized from the provided property - * value. - * @override - */ - _serializeValue(value) { - /* eslint-disable no-fallthrough */ - switch (typeof value) { - case 'object': - if (value instanceof Date) { - return value.toString(); - } else if (value) { - try { - return JSON.stringify(value); - } catch(x) { - return ''; - } - } - - default: - return super._serializeValue(value); - } - } - - /** - * Converts a string to a typed JavaScript value. - * - * This method is called by Polymer when reading HTML attribute values to - * JS properties. Users may override this method on Polymer element - * prototypes to provide deserialization for custom `type`s. Note, - * the `type` argument is the value of the `type` field provided in the - * `properties` configuration object for a given property, and is - * by convention the constructor for the type to deserialize. - * - * - * @param {?string} value Attribute value to deserialize. - * @param {*=} type Type to deserialize the string to. - * @return {*} Typed value deserialized from the provided string. - * @override - */ - _deserializeValue(value, type) { - /** - * @type {*} - */ - let outValue; - switch (type) { - case Object: - try { - outValue = JSON.parse(/** @type {string} */(value)); - } catch(x) { - // allow non-JSON literals like Strings and Numbers - outValue = value; - } - break; - case Array: - try { - outValue = JSON.parse(/** @type {string} */(value)); - } catch(x) { - outValue = null; - console.warn(`Polymer::Attributes: couldn't decode Array as JSON: ${value}`); - } - break; - case Date: - outValue = isNaN(value) ? String(value) : Number(value); - outValue = new Date(outValue); - break; - default: - outValue = super._deserializeValue(value, type); - break; - } - return outValue; - } - /* eslint-enable no-fallthrough */ - - /** - * Overrides PropertiesChanged implementation to save existing prototype - * property value so that it can be reset. - * @param {string} property Name of the property - * @param {boolean=} readOnly When true, no setter is created - * - * When calling on a prototype, any overwritten values are saved in - * `__dataProto`, and it is up to the subclasser to decide how/when - * to set those properties back into the accessor. When calling on an - * instance, the overwritten value is set via `_setPendingProperty`, - * and the user should call `_invalidateProperties` or `_flushProperties` - * for the values to take effect. - * @protected - * @return {void} - * @override - */ - _definePropertyAccessor(property, readOnly) { - saveAccessorValue(this, property); - super._definePropertyAccessor(property, readOnly); - } - - /** - * Returns true if this library created an accessor for the given property. - * - * @param {string} property Property name - * @return {boolean} True if an accessor was created - * @override - */ - _hasAccessor(property) { - return this.__dataHasAccessor && this.__dataHasAccessor[property]; - } - - /** - * Returns true if the specified property has a pending change. - * - * @param {string} prop Property name - * @return {boolean} True if property has a pending change - * @protected - * @override - */ - _isPropertyPending(prop) { - return Boolean(this.__dataPending && (prop in this.__dataPending)); - } - - } - - return PropertyAccessors; - -}); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/property-effects.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/property-effects.js deleted file mode 100644 index c92bea3fa62..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/property-effects.js +++ /dev/null @@ -1,2856 +0,0 @@ -/** - * @fileoverview - * @suppress {checkPrototypalTypes} - * @license Copyright (c) 2017 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 - */ - -import '../utils/boot.js'; -import { wrap } from '../utils/wrap.js'; -import { dedupingMixin } from '../utils/mixin.js'; -import { root, isAncestor, isDescendant, get, translate, isPath, set, normalize } from '../utils/path.js'; -/* for notify, reflect */ -import { camelToDashCase, dashToCamelCase } from '../utils/case-map.js'; -import { PropertyAccessors } from './property-accessors.js'; -/* for annotated effects */ -import { TemplateStamp } from './template-stamp.js'; -import { sanitizeDOMValue } from '../utils/settings.js'; - -// Monotonically increasing unique ID used for de-duping effects triggered -// from multiple properties in the same turn -let dedupeId = 0; - -/** - * Property effect types; effects are stored on the prototype using these keys - * @enum {string} - */ -const TYPES = { - COMPUTE: '__computeEffects', - REFLECT: '__reflectEffects', - NOTIFY: '__notifyEffects', - PROPAGATE: '__propagateEffects', - OBSERVE: '__observeEffects', - READ_ONLY: '__readOnly' -}; - -/** @const {!RegExp} */ -const capitalAttributeRegex = /[A-Z]/; - -/** - * @typedef {{ - * name: (string | undefined), - * structured: (boolean | undefined), - * wildcard: (boolean | undefined) - * }} - */ -let DataTrigger; //eslint-disable-line no-unused-vars - -/** - * @typedef {{ - * info: ?, - * trigger: (!DataTrigger | undefined), - * fn: (!Function | undefined) - * }} - */ -let DataEffect; //eslint-disable-line no-unused-vars - -/** - * Ensures that the model has an own-property map of effects for the given type. - * The model may be a prototype or an instance. - * - * Property effects are stored as arrays of effects by property in a map, - * by named type on the model. e.g. - * - * __computeEffects: { - * foo: [ ... ], - * bar: [ ... ] - * } - * - * If the model does not yet have an effect map for the type, one is created - * and returned. If it does, but it is not an own property (i.e. the - * prototype had effects), the the map is deeply cloned and the copy is - * set on the model and returned, ready for new effects to be added. - * - * @param {Object} model Prototype or instance - * @param {string} type Property effect type - * @return {Object} The own-property map of effects for the given type - * @private - */ -function ensureOwnEffectMap(model, type) { - let effects = model[type]; - if (!effects) { - effects = model[type] = {}; - } else if (!model.hasOwnProperty(type)) { - effects = model[type] = Object.create(model[type]); - for (let p in effects) { - let protoFx = effects[p]; - let instFx = effects[p] = Array(protoFx.length); - for (let i=0; i<protoFx.length; i++) { - instFx[i] = protoFx[i]; - } - } - } - return effects; -} - -// -- effects ---------------------------------------------- - -/** - * Runs all effects of a given type for the given set of property changes - * on an instance. - * - * @param {!Polymer_PropertyEffects} inst The instance with effects to run - * @param {?Object} effects Object map of property-to-Array of effects - * @param {?Object} props Bag of current property changes - * @param {?Object=} oldProps Bag of previous values for changed properties - * @param {boolean=} hasPaths True with `props` contains one or more paths - * @param {*=} extraArgs Additional metadata to pass to effect function - * @return {boolean} True if an effect ran for this property - * @private - */ -function runEffects(inst, effects, props, oldProps, hasPaths, extraArgs) { - if (effects) { - let ran = false; - let id = dedupeId++; - for (let prop in props) { - if (runEffectsForProperty( - inst, /** @type {!Object} */ (effects), id, prop, props, oldProps, - hasPaths, extraArgs)) { - ran = true; - } - } - return ran; - } - return false; -} - -/** - * Runs a list of effects for a given property. - * - * @param {!Polymer_PropertyEffects} inst The instance with effects to run - * @param {!Object} effects Object map of property-to-Array of effects - * @param {number} dedupeId Counter used for de-duping effects - * @param {string} prop Name of changed property - * @param {*} props Changed properties - * @param {*} oldProps Old properties - * @param {boolean=} hasPaths True with `props` contains one or more paths - * @param {*=} extraArgs Additional metadata to pass to effect function - * @return {boolean} True if an effect ran for this property - * @private - */ -function runEffectsForProperty(inst, effects, dedupeId, prop, props, oldProps, hasPaths, extraArgs) { - let ran = false; - let rootProperty = hasPaths ? root(prop) : prop; - let fxs = effects[rootProperty]; - if (fxs) { - for (let i=0, l=fxs.length, fx; (i<l) && (fx=fxs[i]); i++) { - if ((!fx.info || fx.info.lastRun !== dedupeId) && - (!hasPaths || pathMatchesTrigger(prop, fx.trigger))) { - if (fx.info) { - fx.info.lastRun = dedupeId; - } - fx.fn(inst, prop, props, oldProps, fx.info, hasPaths, extraArgs); - ran = true; - } - } - } - return ran; -} - -/** - * Determines whether a property/path that has changed matches the trigger - * criteria for an effect. A trigger is a descriptor with the following - * structure, which matches the descriptors returned from `parseArg`. - * e.g. for `foo.bar.*`: - * ``` - * trigger: { - * name: 'a.b', - * structured: true, - * wildcard: true - * } - * ``` - * If no trigger is given, the path is deemed to match. - * - * @param {string} path Path or property that changed - * @param {?DataTrigger} trigger Descriptor - * @return {boolean} Whether the path matched the trigger - */ -function pathMatchesTrigger(path, trigger) { - if (trigger) { - let triggerPath = /** @type {string} */ (trigger.name); - return (triggerPath == path) || - !!(trigger.structured && isAncestor(triggerPath, path)) || - !!(trigger.wildcard && isDescendant(triggerPath, path)); - } else { - return true; - } -} - -/** - * Implements the "observer" effect. - * - * Calls the method with `info.methodName` on the instance, passing the - * new and old values. - * - * @param {!Polymer_PropertyEffects} inst The instance the effect will be run on - * @param {string} property Name of property - * @param {Object} props Bag of current property changes - * @param {Object} oldProps Bag of previous values for changed properties - * @param {?} info Effect metadata - * @return {void} - * @private - */ -function runObserverEffect(inst, property, props, oldProps, info) { - let fn = typeof info.method === "string" ? inst[info.method] : info.method; - let changedProp = info.property; - if (fn) { - fn.call(inst, inst.__data[changedProp], oldProps[changedProp]); - } else if (!info.dynamicFn) { - console.warn('observer method `' + info.method + '` not defined'); - } -} - -/** - * Runs "notify" effects for a set of changed properties. - * - * This method differs from the generic `runEffects` method in that it - * will dispatch path notification events in the case that the property - * changed was a path and the root property for that path didn't have a - * "notify" effect. This is to maintain 1.0 behavior that did not require - * `notify: true` to ensure object sub-property notifications were - * sent. - * - * @param {!Polymer_PropertyEffects} inst The instance with effects to run - * @param {Object} notifyProps Bag of properties to notify - * @param {Object} props Bag of current property changes - * @param {Object} oldProps Bag of previous values for changed properties - * @param {boolean} hasPaths True with `props` contains one or more paths - * @return {void} - * @private - */ -function runNotifyEffects(inst, notifyProps, props, oldProps, hasPaths) { - // Notify - let fxs = inst[TYPES.NOTIFY]; - let notified; - let id = dedupeId++; - // Try normal notify effects; if none, fall back to try path notification - for (let prop in notifyProps) { - if (notifyProps[prop]) { - if (fxs && runEffectsForProperty(inst, fxs, id, prop, props, oldProps, hasPaths)) { - notified = true; - } else if (hasPaths && notifyPath(inst, prop, props)) { - notified = true; - } - } - } - // Flush host if we actually notified and host was batching - // And the host has already initialized clients; this prevents - // an issue with a host observing data changes before clients are ready. - let host; - if (notified && (host = inst.__dataHost) && host._invalidateProperties) { - host._invalidateProperties(); - } -} - -/** - * Dispatches {property}-changed events with path information in the detail - * object to indicate a sub-path of the property was changed. - * - * @param {!Polymer_PropertyEffects} inst The element from which to fire the - * event - * @param {string} path The path that was changed - * @param {Object} props Bag of current property changes - * @return {boolean} Returns true if the path was notified - * @private - */ -function notifyPath(inst, path, props) { - let rootProperty = root(path); - if (rootProperty !== path) { - let eventName = camelToDashCase(rootProperty) + '-changed'; - dispatchNotifyEvent(inst, eventName, props[path], path); - return true; - } - return false; -} - -/** - * Dispatches {property}-changed events to indicate a property (or path) - * changed. - * - * @param {!Polymer_PropertyEffects} inst The element from which to fire the - * event - * @param {string} eventName The name of the event to send - * ('{property}-changed') - * @param {*} value The value of the changed property - * @param {string | null | undefined} path If a sub-path of this property - * changed, the path that changed (optional). - * @return {void} - * @private - * @suppress {invalidCasts} - */ -function dispatchNotifyEvent(inst, eventName, value, path) { - let detail = { - value: value, - queueProperty: true - }; - if (path) { - detail.path = path; - } - wrap(/** @type {!HTMLElement} */(inst)).dispatchEvent(new CustomEvent(eventName, { detail })); -} - -/** - * Implements the "notify" effect. - * - * Dispatches a non-bubbling event named `info.eventName` on the instance - * with a detail object containing the new `value`. - * - * @param {!Polymer_PropertyEffects} inst The instance the effect will be run on - * @param {string} property Name of property - * @param {Object} props Bag of current property changes - * @param {Object} oldProps Bag of previous values for changed properties - * @param {?} info Effect metadata - * @param {boolean} hasPaths True with `props` contains one or more paths - * @return {void} - * @private - */ -function runNotifyEffect(inst, property, props, oldProps, info, hasPaths) { - let rootProperty = hasPaths ? root(property) : property; - let path = rootProperty != property ? property : null; - let value = path ? get(inst, path) : inst.__data[property]; - if (path && value === undefined) { - value = props[property]; // specifically for .splices - } - dispatchNotifyEvent(inst, info.eventName, value, path); -} - -/** - * Handler function for 2-way notification events. Receives context - * information captured in the `addNotifyListener` closure from the - * `__notifyListeners` metadata. - * - * Sets the value of the notified property to the host property or path. If - * the event contained path information, translate that path to the host - * scope's name for that path first. - * - * @param {CustomEvent} event Notification event (e.g. '<property>-changed') - * @param {!Polymer_PropertyEffects} inst Host element instance handling the - * notification event - * @param {string} fromProp Child element property that was bound - * @param {string} toPath Host property/path that was bound - * @param {boolean} negate Whether the binding was negated - * @return {void} - * @private - */ -function handleNotification(event, inst, fromProp, toPath, negate) { - let value; - let detail = /** @type {Object} */(event.detail); - let fromPath = detail && detail.path; - if (fromPath) { - toPath = translate(fromProp, toPath, fromPath); - value = detail && detail.value; - } else { - value = event.currentTarget[fromProp]; - } - value = negate ? !value : value; - if (!inst[TYPES.READ_ONLY] || !inst[TYPES.READ_ONLY][toPath]) { - if (inst._setPendingPropertyOrPath(toPath, value, true, Boolean(fromPath)) - && (!detail || !detail.queueProperty)) { - inst._invalidateProperties(); - } - } -} - -/** - * Implements the "reflect" effect. - * - * Sets the attribute named `info.attrName` to the given property value. - * - * @param {!Polymer_PropertyEffects} inst The instance the effect will be run on - * @param {string} property Name of property - * @param {Object} props Bag of current property changes - * @param {Object} oldProps Bag of previous values for changed properties - * @param {?} info Effect metadata - * @return {void} - * @private - */ -function runReflectEffect(inst, property, props, oldProps, info) { - let value = inst.__data[property]; - if (sanitizeDOMValue) { - value = sanitizeDOMValue(value, info.attrName, 'attribute', /** @type {Node} */(inst)); - } - inst._propertyToAttribute(property, info.attrName, value); -} - -/** - * Runs "computed" effects for a set of changed properties. - * - * This method differs from the generic `runEffects` method in that it - * continues to run computed effects based on the output of each pass until - * there are no more newly computed properties. This ensures that all - * properties that will be computed by the initial set of changes are - * computed before other effects (binding propagation, observers, and notify) - * run. - * - * @param {!Polymer_PropertyEffects} inst The instance the effect will be run on - * @param {?Object} changedProps Bag of changed properties - * @param {?Object} oldProps Bag of previous values for changed properties - * @param {boolean} hasPaths True with `props` contains one or more paths - * @return {void} - * @private - */ -function runComputedEffects(inst, changedProps, oldProps, hasPaths) { - let computeEffects = inst[TYPES.COMPUTE]; - if (computeEffects) { - let inputProps = changedProps; - while (runEffects(inst, computeEffects, inputProps, oldProps, hasPaths)) { - Object.assign(/** @type {!Object} */ (oldProps), inst.__dataOld); - Object.assign(/** @type {!Object} */ (changedProps), inst.__dataPending); - inputProps = inst.__dataPending; - inst.__dataPending = null; - } - } -} - -/** - * Implements the "computed property" effect by running the method with the - * values of the arguments specified in the `info` object and setting the - * return value to the computed property specified. - * - * @param {!Polymer_PropertyEffects} inst The instance the effect will be run on - * @param {string} property Name of property - * @param {?Object} props Bag of current property changes - * @param {?Object} oldProps Bag of previous values for changed properties - * @param {?} info Effect metadata - * @return {void} - * @private - */ -function runComputedEffect(inst, property, props, oldProps, info) { - let result = runMethodEffect(inst, property, props, oldProps, info); - let computedProp = info.methodInfo; - if (inst.__dataHasAccessor && inst.__dataHasAccessor[computedProp]) { - inst._setPendingProperty(computedProp, result, true); - } else { - inst[computedProp] = result; - } -} - -/** - * Computes path changes based on path links set up using the `linkPaths` - * API. - * - * @param {!Polymer_PropertyEffects} inst The instance whose props are changing - * @param {string} path Path that has changed - * @param {*} value Value of changed path - * @return {void} - * @private - */ -function computeLinkedPaths(inst, path, value) { - let links = inst.__dataLinkedPaths; - if (links) { - let link; - for (let a in links) { - let b = links[a]; - if (isDescendant(a, path)) { - link = translate(a, b, path); - inst._setPendingPropertyOrPath(link, value, true, true); - } else if (isDescendant(b, path)) { - link = translate(b, a, path); - inst._setPendingPropertyOrPath(link, value, true, true); - } - } - } -} - -// -- bindings ---------------------------------------------- - -/** - * Adds binding metadata to the current `nodeInfo`, and binding effects - * for all part dependencies to `templateInfo`. - * - * @param {Function} constructor Class that `_parseTemplate` is currently - * running on - * @param {TemplateInfo} templateInfo Template metadata for current template - * @param {NodeInfo} nodeInfo Node metadata for current template node - * @param {string} kind Binding kind, either 'property', 'attribute', or 'text' - * @param {string} target Target property name - * @param {!Array<!BindingPart>} parts Array of binding part metadata - * @param {string=} literal Literal text surrounding binding parts (specified - * only for 'property' bindings, since these must be initialized as part - * of boot-up) - * @return {void} - * @private - */ -function addBinding(constructor, templateInfo, nodeInfo, kind, target, parts, literal) { - // Create binding metadata and add to nodeInfo - nodeInfo.bindings = nodeInfo.bindings || []; - let /** Binding */ binding = { kind, target, parts, literal, isCompound: (parts.length !== 1) }; - nodeInfo.bindings.push(binding); - // Add listener info to binding metadata - if (shouldAddListener(binding)) { - let {event, negate} = binding.parts[0]; - binding.listenerEvent = event || (camelToDashCase(target) + '-changed'); - binding.listenerNegate = negate; - } - // Add "propagate" property effects to templateInfo - let index = templateInfo.nodeInfoList.length; - for (let i=0; i<binding.parts.length; i++) { - let part = binding.parts[i]; - part.compoundIndex = i; - addEffectForBindingPart(constructor, templateInfo, binding, part, index); - } -} - -/** - * Adds property effects to the given `templateInfo` for the given binding - * part. - * - * @param {Function} constructor Class that `_parseTemplate` is currently - * running on - * @param {TemplateInfo} templateInfo Template metadata for current template - * @param {!Binding} binding Binding metadata - * @param {!BindingPart} part Binding part metadata - * @param {number} index Index into `nodeInfoList` for this node - * @return {void} - */ -function addEffectForBindingPart(constructor, templateInfo, binding, part, index) { - if (!part.literal) { - if (binding.kind === 'attribute' && binding.target[0] === '-') { - console.warn('Cannot set attribute ' + binding.target + - ' because "-" is not a valid attribute starting character'); - } else { - let dependencies = part.dependencies; - let info = { index, binding, part, evaluator: constructor }; - for (let j=0; j<dependencies.length; j++) { - let trigger = dependencies[j]; - if (typeof trigger == 'string') { - trigger = parseArg(trigger); - trigger.wildcard = true; - } - constructor._addTemplatePropertyEffect(templateInfo, trigger.rootProperty, { - fn: runBindingEffect, - info, trigger - }); - } - } - } -} - -/** - * Implements the "binding" (property/path binding) effect. - * - * Note that binding syntax is overridable via `_parseBindings` and - * `_evaluateBinding`. This method will call `_evaluateBinding` for any - * non-literal parts returned from `_parseBindings`. However, - * there is no support for _path_ bindings via custom binding parts, - * as this is specific to Polymer's path binding syntax. - * - * @param {!Polymer_PropertyEffects} inst The instance the effect will be run on - * @param {string} path Name of property - * @param {Object} props Bag of current property changes - * @param {Object} oldProps Bag of previous values for changed properties - * @param {?} info Effect metadata - * @param {boolean} hasPaths True with `props` contains one or more paths - * @param {Array} nodeList List of nodes associated with `nodeInfoList` template - * metadata - * @return {void} - * @private - */ -function runBindingEffect(inst, path, props, oldProps, info, hasPaths, nodeList) { - let node = nodeList[info.index]; - let binding = info.binding; - let part = info.part; - // Subpath notification: transform path and set to client - // e.g.: foo="{{obj.sub}}", path: 'obj.sub.prop', set 'foo.prop'=obj.sub.prop - if (hasPaths && part.source && (path.length > part.source.length) && - (binding.kind == 'property') && !binding.isCompound && - node.__isPropertyEffectsClient && - node.__dataHasAccessor && node.__dataHasAccessor[binding.target]) { - let value = props[path]; - path = translate(part.source, binding.target, path); - if (node._setPendingPropertyOrPath(path, value, false, true)) { - inst._enqueueClient(node); - } - } else { - let value = info.evaluator._evaluateBinding(inst, part, path, props, oldProps, hasPaths); - // Propagate value to child - applyBindingValue(inst, node, binding, part, value); - } -} - -/** - * Sets the value for an "binding" (binding) effect to a node, - * either as a property or attribute. - * - * @param {!Polymer_PropertyEffects} inst The instance owning the binding effect - * @param {Node} node Target node for binding - * @param {!Binding} binding Binding metadata - * @param {!BindingPart} part Binding part metadata - * @param {*} value Value to set - * @return {void} - * @private - */ -function applyBindingValue(inst, node, binding, part, value) { - value = computeBindingValue(node, value, binding, part); - if (sanitizeDOMValue) { - value = sanitizeDOMValue(value, binding.target, binding.kind, node); - } - if (binding.kind == 'attribute') { - // Attribute binding - inst._valueToNodeAttribute(/** @type {Element} */(node), value, binding.target); - } else { - // Property binding - let prop = binding.target; - if (node.__isPropertyEffectsClient && - node.__dataHasAccessor && node.__dataHasAccessor[prop]) { - if (!node[TYPES.READ_ONLY] || !node[TYPES.READ_ONLY][prop]) { - if (node._setPendingProperty(prop, value)) { - inst._enqueueClient(node); - } - } - } else { - inst._setUnmanagedPropertyToNode(node, prop, value); - } - } -} - -/** - * Transforms an "binding" effect value based on compound & negation - * effect metadata, as well as handling for special-case properties - * - * @param {Node} node Node the value will be set to - * @param {*} value Value to set - * @param {!Binding} binding Binding metadata - * @param {!BindingPart} part Binding part metadata - * @return {*} Transformed value to set - * @private - */ -function computeBindingValue(node, value, binding, part) { - if (binding.isCompound) { - let storage = node.__dataCompoundStorage[binding.target]; - storage[part.compoundIndex] = value; - value = storage.join(''); - } - if (binding.kind !== 'attribute') { - // Some browsers serialize `undefined` to `"undefined"` - if (binding.target === 'textContent' || - (binding.target === 'value' && - (node.localName === 'input' || node.localName === 'textarea'))) { - value = value == undefined ? '' : value; - } - } - return value; -} - -/** - * Returns true if a binding's metadata meets all the requirements to allow - * 2-way binding, and therefore a `<property>-changed` event listener should be - * added: - * - used curly braces - * - is a property (not attribute) binding - * - is not a textContent binding - * - is not compound - * - * @param {!Binding} binding Binding metadata - * @return {boolean} True if 2-way listener should be added - * @private - */ -function shouldAddListener(binding) { - return Boolean(binding.target) && - binding.kind != 'attribute' && - binding.kind != 'text' && - !binding.isCompound && - binding.parts[0].mode === '{'; -} - -/** - * Setup compound binding storage structures, notify listeners, and dataHost - * references onto the bound nodeList. - * - * @param {!Polymer_PropertyEffects} inst Instance that bas been previously - * bound - * @param {TemplateInfo} templateInfo Template metadata - * @return {void} - * @private - */ -function setupBindings(inst, templateInfo) { - // Setup compound storage, dataHost, and notify listeners - let {nodeList, nodeInfoList} = templateInfo; - if (nodeInfoList.length) { - for (let i=0; i < nodeInfoList.length; i++) { - let info = nodeInfoList[i]; - let node = nodeList[i]; - let bindings = info.bindings; - if (bindings) { - for (let i=0; i<bindings.length; i++) { - let binding = bindings[i]; - setupCompoundStorage(node, binding); - addNotifyListener(node, inst, binding); - } - } - node.__dataHost = inst; - } - } -} - -/** - * Initializes `__dataCompoundStorage` local storage on a bound node with - * initial literal data for compound bindings, and sets the joined - * literal parts to the bound property. - * - * When changes to compound parts occur, they are first set into the compound - * storage array for that property, and then the array is joined to result in - * the final value set to the property/attribute. - * - * @param {Node} node Bound node to initialize - * @param {Binding} binding Binding metadata - * @return {void} - * @private - */ -function setupCompoundStorage(node, binding) { - if (binding.isCompound) { - // Create compound storage map - let storage = node.__dataCompoundStorage || - (node.__dataCompoundStorage = {}); - let parts = binding.parts; - // Copy literals from parts into storage for this binding - let literals = new Array(parts.length); - for (let j=0; j<parts.length; j++) { - literals[j] = parts[j].literal; - } - let target = binding.target; - storage[target] = literals; - // Configure properties with their literal parts - if (binding.literal && binding.kind == 'property') { - node[target] = binding.literal; - } - } -} - -/** - * Adds a 2-way binding notification event listener to the node specified - * - * @param {Object} node Child element to add listener to - * @param {!Polymer_PropertyEffects} inst Host element instance to handle - * notification event - * @param {Binding} binding Binding metadata - * @return {void} - * @private - */ -function addNotifyListener(node, inst, binding) { - if (binding.listenerEvent) { - let part = binding.parts[0]; - node.addEventListener(binding.listenerEvent, function(e) { - handleNotification(e, inst, binding.target, part.source, part.negate); - }); - } -} - -// -- for method-based effects (complexObserver & computed) -------------- - -/** - * Adds property effects for each argument in the method signature (and - * optionally, for the method name if `dynamic` is true) that calls the - * provided effect function. - * - * @param {Element | Object} model Prototype or instance - * @param {!MethodSignature} sig Method signature metadata - * @param {string} type Type of property effect to add - * @param {Function} effectFn Function to run when arguments change - * @param {*=} methodInfo Effect-specific information to be included in - * method effect metadata - * @param {boolean|Object=} dynamicFn Boolean or object map indicating whether - * method names should be included as a dependency to the effect. Note, - * defaults to true if the signature is static (sig.static is true). - * @return {void} - * @private - */ -function createMethodEffect(model, sig, type, effectFn, methodInfo, dynamicFn) { - dynamicFn = sig.static || (dynamicFn && - (typeof dynamicFn !== 'object' || dynamicFn[sig.methodName])); - let info = { - methodName: sig.methodName, - args: sig.args, - methodInfo, - dynamicFn - }; - for (let i=0, arg; (i<sig.args.length) && (arg=sig.args[i]); i++) { - if (!arg.literal) { - model._addPropertyEffect(arg.rootProperty, type, { - fn: effectFn, info: info, trigger: arg - }); - } - } - if (dynamicFn) { - model._addPropertyEffect(sig.methodName, type, { - fn: effectFn, info: info - }); - } -} - -/** - * Calls a method with arguments marshaled from properties on the instance - * based on the method signature contained in the effect metadata. - * - * Multi-property observers, computed properties, and inline computing - * functions call this function to invoke the method, then use the return - * value accordingly. - * - * @param {!Polymer_PropertyEffects} inst The instance the effect will be run on - * @param {string} property Name of property - * @param {Object} props Bag of current property changes - * @param {Object} oldProps Bag of previous values for changed properties - * @param {?} info Effect metadata - * @return {*} Returns the return value from the method invocation - * @private - */ -function runMethodEffect(inst, property, props, oldProps, info) { - // Instances can optionally have a _methodHost which allows redirecting where - // to find methods. Currently used by `templatize`. - let context = inst._methodHost || inst; - let fn = context[info.methodName]; - if (fn) { - let args = inst._marshalArgs(info.args, property, props); - return fn.apply(context, args); - } else if (!info.dynamicFn) { - console.warn('method `' + info.methodName + '` not defined'); - } -} - -const emptyArray = []; - -// Regular expressions used for binding -const IDENT = '(?:' + '[a-zA-Z_$][\\w.:$\\-*]*' + ')'; -const NUMBER = '(?:' + '[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?' + ')'; -const SQUOTE_STRING = '(?:' + '\'(?:[^\'\\\\]|\\\\.)*\'' + ')'; -const DQUOTE_STRING = '(?:' + '"(?:[^"\\\\]|\\\\.)*"' + ')'; -const STRING = '(?:' + SQUOTE_STRING + '|' + DQUOTE_STRING + ')'; -const ARGUMENT = '(?:(' + IDENT + '|' + NUMBER + '|' + STRING + ')\\s*' + ')'; -const ARGUMENTS = '(?:' + ARGUMENT + '(?:,\\s*' + ARGUMENT + ')*' + ')'; -const ARGUMENT_LIST = '(?:' + '\\(\\s*' + - '(?:' + ARGUMENTS + '?' + ')' + - '\\)\\s*' + ')'; -const BINDING = '(' + IDENT + '\\s*' + ARGUMENT_LIST + '?' + ')'; // Group 3 -const OPEN_BRACKET = '(\\[\\[|{{)' + '\\s*'; -const CLOSE_BRACKET = '(?:]]|}})'; -const NEGATE = '(?:(!)\\s*)?'; // Group 2 -const EXPRESSION = OPEN_BRACKET + NEGATE + BINDING + CLOSE_BRACKET; -const bindingRegex = new RegExp(EXPRESSION, "g"); - -/** - * Create a string from binding parts of all the literal parts - * - * @param {!Array<BindingPart>} parts All parts to stringify - * @return {string} String made from the literal parts - */ -function literalFromParts(parts) { - let s = ''; - for (let i=0; i<parts.length; i++) { - let literal = parts[i].literal; - s += literal || ''; - } - return s; -} - -/** - * Parses an expression string for a method signature, and returns a metadata - * describing the method in terms of `methodName`, `static` (whether all the - * arguments are literals), and an array of `args` - * - * @param {string} expression The expression to parse - * @return {?MethodSignature} The method metadata object if a method expression was - * found, otherwise `undefined` - * @private - */ -function parseMethod(expression) { - // tries to match valid javascript property names - let m = expression.match(/([^\s]+?)\(([\s\S]*)\)/); - if (m) { - let methodName = m[1]; - let sig = { methodName, static: true, args: emptyArray }; - if (m[2].trim()) { - // replace escaped commas with comma entity, split on un-escaped commas - let args = m[2].replace(/\\,/g, ',').split(','); - return parseArgs(args, sig); - } else { - return sig; - } - } - return null; -} - -/** - * Parses an array of arguments and sets the `args` property of the supplied - * signature metadata object. Sets the `static` property to false if any - * argument is a non-literal. - * - * @param {!Array<string>} argList Array of argument names - * @param {!MethodSignature} sig Method signature metadata object - * @return {!MethodSignature} The updated signature metadata object - * @private - */ -function parseArgs(argList, sig) { - sig.args = argList.map(function(rawArg) { - let arg = parseArg(rawArg); - if (!arg.literal) { - sig.static = false; - } - return arg; - }, this); - return sig; -} - -/** - * Parses an individual argument, and returns an argument metadata object - * with the following fields: - * - * { - * value: 'prop', // property/path or literal value - * literal: false, // whether argument is a literal - * structured: false, // whether the property is a path - * rootProperty: 'prop', // the root property of the path - * wildcard: false // whether the argument was a wildcard '.*' path - * } - * - * @param {string} rawArg The string value of the argument - * @return {!MethodArg} Argument metadata object - * @private - */ -function parseArg(rawArg) { - // clean up whitespace - let arg = rawArg.trim() - // replace comma entity with comma - .replace(/,/g, ',') - // repair extra escape sequences; note only commas strictly need - // escaping, but we allow any other char to be escaped since its - // likely users will do this - .replace(/\\(.)/g, '\$1') - ; - // basic argument descriptor - let a = { - name: arg, - value: '', - literal: false - }; - // detect literal value (must be String or Number) - let fc = arg[0]; - if (fc === '-') { - fc = arg[1]; - } - if (fc >= '0' && fc <= '9') { - fc = '#'; - } - switch(fc) { - case "'": - case '"': - a.value = arg.slice(1, -1); - a.literal = true; - break; - case '#': - a.value = Number(arg); - a.literal = true; - break; - } - // if not literal, look for structured path - if (!a.literal) { - a.rootProperty = root(arg); - // detect structured path (has dots) - a.structured = isPath(arg); - if (a.structured) { - a.wildcard = (arg.slice(-2) == '.*'); - if (a.wildcard) { - a.name = arg.slice(0, -2); - } - } - } - return a; -} - -function getArgValue(data, props, path) { - let value = get(data, path); - // when data is not stored e.g. `splices`, get the value from changedProps - // TODO(kschaaf): Note, this can cause a rare issue where the wildcard - // info.value could pull a stale value out of changedProps during a reentrant - // change that sets the value back to undefined. - // https://github.com/Polymer/polymer/issues/5479 - if (value === undefined) { - value = props[path]; - } - return value; -} - -// data api - -/** - * Sends array splice notifications (`.splices` and `.length`) - * - * Note: this implementation only accepts normalized paths - * - * @param {!Polymer_PropertyEffects} inst Instance to send notifications to - * @param {Array} array The array the mutations occurred on - * @param {string} path The path to the array that was mutated - * @param {Array} splices Array of splice records - * @return {void} - * @private - */ -function notifySplices(inst, array, path, splices) { - inst.notifyPath(path + '.splices', { indexSplices: splices }); - inst.notifyPath(path + '.length', array.length); -} - -/** - * Creates a splice record and sends an array splice notification for - * the described mutation - * - * Note: this implementation only accepts normalized paths - * - * @param {!Polymer_PropertyEffects} inst Instance to send notifications to - * @param {Array} array The array the mutations occurred on - * @param {string} path The path to the array that was mutated - * @param {number} index Index at which the array mutation occurred - * @param {number} addedCount Number of added items - * @param {Array} removed Array of removed items - * @return {void} - * @private - */ -function notifySplice(inst, array, path, index, addedCount, removed) { - notifySplices(inst, array, path, [{ - index: index, - addedCount: addedCount, - removed: removed, - object: array, - type: 'splice' - }]); -} - -/** - * Returns an upper-cased version of the string. - * - * @param {string} name String to uppercase - * @return {string} Uppercased string - * @private - */ -function upper(name) { - return name[0].toUpperCase() + name.substring(1); -} - -/** - * Element class mixin that provides meta-programming for Polymer's template - * binding and data observation (collectively, "property effects") system. - * - * This mixin uses provides the following key static methods for adding - * property effects to an element class: - * - `addPropertyEffect` - * - `createPropertyObserver` - * - `createMethodObserver` - * - `createNotifyingProperty` - * - `createReadOnlyProperty` - * - `createReflectedProperty` - * - `createComputedProperty` - * - `bindTemplate` - * - * Each method creates one or more property accessors, along with metadata - * used by this mixin's implementation of `_propertiesChanged` to perform - * the property effects. - * - * Underscored versions of the above methods also exist on the element - * prototype for adding property effects on instances at runtime. - * - * Note that this mixin overrides several `PropertyAccessors` methods, in - * many cases to maintain guarantees provided by the Polymer 1.x features; - * notably it changes property accessors to be synchronous by default - * whereas the default when using `PropertyAccessors` standalone is to be - * async by default. - * - * @mixinFunction - * @polymer - * @appliesMixin TemplateStamp - * @appliesMixin PropertyAccessors - * @summary Element class mixin that provides meta-programming for Polymer's - * template binding and data observation system. - */ -export const PropertyEffects = dedupingMixin(superClass => { - - /** - * @constructor - * @implements {Polymer_PropertyAccessors} - * @implements {Polymer_TemplateStamp} - * @unrestricted - * @private - */ - const propertyEffectsBase = TemplateStamp(PropertyAccessors(superClass)); - - /** - * @polymer - * @mixinClass - * @implements {Polymer_PropertyEffects} - * @extends {propertyEffectsBase} - * @unrestricted - */ - class PropertyEffects extends propertyEffectsBase { - - constructor() { - super(); - /** @type {boolean} */ - // Used to identify users of this mixin, ala instanceof - this.__isPropertyEffectsClient = true; - /** @type {number} */ - // NOTE: used to track re-entrant calls to `_flushProperties` - // path changes dirty check against `__dataTemp` only during one "turn" - // and are cleared when `__dataCounter` returns to 0. - this.__dataCounter = 0; - /** @type {boolean} */ - this.__dataClientsReady; - /** @type {Array} */ - this.__dataPendingClients; - /** @type {Object} */ - this.__dataToNotify; - /** @type {Object} */ - this.__dataLinkedPaths; - /** @type {boolean} */ - this.__dataHasPaths; - /** @type {Object} */ - this.__dataCompoundStorage; - /** @type {Polymer_PropertyEffects} */ - this.__dataHost; - /** @type {!Object} */ - this.__dataTemp; - /** @type {boolean} */ - this.__dataClientsInitialized; - /** @type {!Object} */ - this.__data; - /** @type {!Object|null} */ - this.__dataPending; - /** @type {!Object} */ - this.__dataOld; - /** @type {Object} */ - this.__computeEffects; - /** @type {Object} */ - this.__reflectEffects; - /** @type {Object} */ - this.__notifyEffects; - /** @type {Object} */ - this.__propagateEffects; - /** @type {Object} */ - this.__observeEffects; - /** @type {Object} */ - this.__readOnly; - /** @type {!TemplateInfo} */ - this.__templateInfo; - } - - get PROPERTY_EFFECT_TYPES() { - return TYPES; - } - - /** - * @override - * @return {void} - */ - _initializeProperties() { - super._initializeProperties(); - hostStack.registerHost(this); - this.__dataClientsReady = false; - this.__dataPendingClients = null; - this.__dataToNotify = null; - this.__dataLinkedPaths = null; - this.__dataHasPaths = false; - // May be set on instance prior to upgrade - this.__dataCompoundStorage = this.__dataCompoundStorage || null; - this.__dataHost = this.__dataHost || null; - this.__dataTemp = {}; - this.__dataClientsInitialized = false; - } - - /** - * Overrides `PropertyAccessors` implementation to provide a - * more efficient implementation of initializing properties from - * the prototype on the instance. - * - * @override - * @param {Object} props Properties to initialize on the prototype - * @return {void} - */ - _initializeProtoProperties(props) { - this.__data = Object.create(props); - this.__dataPending = Object.create(props); - this.__dataOld = {}; - } - - /** - * Overrides `PropertyAccessors` implementation to avoid setting - * `_setProperty`'s `shouldNotify: true`. - * - * @override - * @param {Object} props Properties to initialize on the instance - * @return {void} - */ - _initializeInstanceProperties(props) { - let readOnly = this[TYPES.READ_ONLY]; - for (let prop in props) { - if (!readOnly || !readOnly[prop]) { - this.__dataPending = this.__dataPending || {}; - this.__dataOld = this.__dataOld || {}; - this.__data[prop] = this.__dataPending[prop] = props[prop]; - } - } - } - - // Prototype setup ---------------------------------------- - - /** - * Equivalent to static `addPropertyEffect` API but can be called on - * an instance to add effects at runtime. See that method for - * full API docs. - * - * @override - * @param {string} property Property that should trigger the effect - * @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES - * @param {Object=} effect Effect metadata object - * @return {void} - * @protected - */ - _addPropertyEffect(property, type, effect) { - this._createPropertyAccessor(property, type == TYPES.READ_ONLY); - // effects are accumulated into arrays per property based on type - let effects = ensureOwnEffectMap(this, type)[property]; - if (!effects) { - effects = this[type][property] = []; - } - effects.push(effect); - } - - /** - * Removes the given property effect. - * - * @override - * @param {string} property Property the effect was associated with - * @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES - * @param {Object=} effect Effect metadata object to remove - * @return {void} - */ - _removePropertyEffect(property, type, effect) { - let effects = ensureOwnEffectMap(this, type)[property]; - let idx = effects.indexOf(effect); - if (idx >= 0) { - effects.splice(idx, 1); - } - } - - /** - * Returns whether the current prototype/instance has a property effect - * of a certain type. - * - * @override - * @param {string} property Property name - * @param {string=} type Effect type, from this.PROPERTY_EFFECT_TYPES - * @return {boolean} True if the prototype/instance has an effect of this - * type - * @protected - */ - _hasPropertyEffect(property, type) { - let effects = this[type]; - return Boolean(effects && effects[property]); - } - - /** - * Returns whether the current prototype/instance has a "read only" - * accessor for the given property. - * - * @override - * @param {string} property Property name - * @return {boolean} True if the prototype/instance has an effect of this - * type - * @protected - */ - _hasReadOnlyEffect(property) { - return this._hasPropertyEffect(property, TYPES.READ_ONLY); - } - - /** - * Returns whether the current prototype/instance has a "notify" - * property effect for the given property. - * - * @override - * @param {string} property Property name - * @return {boolean} True if the prototype/instance has an effect of this - * type - * @protected - */ - _hasNotifyEffect(property) { - return this._hasPropertyEffect(property, TYPES.NOTIFY); - } - - /** - * Returns whether the current prototype/instance has a "reflect to - * attribute" property effect for the given property. - * - * @override - * @param {string} property Property name - * @return {boolean} True if the prototype/instance has an effect of this - * type - * @protected - */ - _hasReflectEffect(property) { - return this._hasPropertyEffect(property, TYPES.REFLECT); - } - - /** - * Returns whether the current prototype/instance has a "computed" - * property effect for the given property. - * - * @override - * @param {string} property Property name - * @return {boolean} True if the prototype/instance has an effect of this - * type - * @protected - */ - _hasComputedEffect(property) { - return this._hasPropertyEffect(property, TYPES.COMPUTE); - } - - // Runtime ---------------------------------------- - - /** - * Sets a pending property or path. If the root property of the path in - * question had no accessor, the path is set, otherwise it is enqueued - * via `_setPendingProperty`. - * - * This function isolates relatively expensive functionality necessary - * for the public API (`set`, `setProperties`, `notifyPath`, and property - * change listeners via {{...}} bindings), such that it is only done - * when paths enter the system, and not at every propagation step. It - * also sets a `__dataHasPaths` flag on the instance which is used to - * fast-path slower path-matching code in the property effects host paths. - * - * `path` can be a path string or array of path parts as accepted by the - * public API. - * - * @override - * @param {string | !Array<number|string>} path Path to set - * @param {*} value Value to set - * @param {boolean=} shouldNotify Set to true if this change should - * cause a property notification event dispatch - * @param {boolean=} isPathNotification If the path being set is a path - * notification of an already changed value, as opposed to a request - * to set and notify the change. In the latter `false` case, a dirty - * check is performed and then the value is set to the path before - * enqueuing the pending property change. - * @return {boolean} Returns true if the property/path was enqueued in - * the pending changes bag. - * @protected - */ - _setPendingPropertyOrPath(path, value, shouldNotify, isPathNotification) { - if (isPathNotification || - root(Array.isArray(path) ? path[0] : path) !== path) { - // Dirty check changes being set to a path against the actual object, - // since this is the entry point for paths into the system; from here - // the only dirty checks are against the `__dataTemp` cache to prevent - // duplicate work in the same turn only. Note, if this was a notification - // of a change already set to a path (isPathNotification: true), - // we always let the change through and skip the `set` since it was - // already dirty checked at the point of entry and the underlying - // object has already been updated - if (!isPathNotification) { - let old = get(this, path); - path = /** @type {string} */ (set(this, path, value)); - // Use property-accessor's simpler dirty check - if (!path || !super._shouldPropertyChange(path, value, old)) { - return false; - } - } - this.__dataHasPaths = true; - if (this._setPendingProperty(/**@type{string}*/(path), value, shouldNotify)) { - computeLinkedPaths(this, /**@type{string}*/ (path), value); - return true; - } - } else { - if (this.__dataHasAccessor && this.__dataHasAccessor[path]) { - return this._setPendingProperty(/**@type{string}*/(path), value, shouldNotify); - } else { - this[path] = value; - } - } - return false; - } - - /** - * Applies a value to a non-Polymer element/node's property. - * - * The implementation makes a best-effort at binding interop: - * Some native element properties have side-effects when - * re-setting the same value (e.g. setting `<input>.value` resets the - * cursor position), so we do a dirty-check before setting the value. - * However, for better interop with non-Polymer custom elements that - * accept objects, we explicitly re-set object changes coming from the - * Polymer world (which may include deep object changes without the - * top reference changing), erring on the side of providing more - * information. - * - * Users may override this method to provide alternate approaches. - * - * @override - * @param {!Node} node The node to set a property on - * @param {string} prop The property to set - * @param {*} value The value to set - * @return {void} - * @protected - */ - _setUnmanagedPropertyToNode(node, prop, value) { - // It is a judgment call that resetting primitives is - // "bad" and resettings objects is also "good"; alternatively we could - // implement a whitelist of tag & property values that should never - // be reset (e.g. <input>.value && <select>.value) - if (value !== node[prop] || typeof value == 'object') { - node[prop] = value; - } - } - - /** - * Overrides the `PropertiesChanged` implementation to introduce special - * dirty check logic depending on the property & value being set: - * - * 1. Any value set to a path (e.g. 'obj.prop': 42 or 'obj.prop': {...}) - * Stored in `__dataTemp`, dirty checked against `__dataTemp` - * 2. Object set to simple property (e.g. 'prop': {...}) - * Stored in `__dataTemp` and `__data`, dirty checked against - * `__dataTemp` by default implementation of `_shouldPropertyChange` - * 3. Primitive value set to simple property (e.g. 'prop': 42) - * Stored in `__data`, dirty checked against `__data` - * - * The dirty-check is important to prevent cycles due to two-way - * notification, but paths and objects are only dirty checked against any - * previous value set during this turn via a "temporary cache" that is - * cleared when the last `_propertiesChanged` exits. This is so: - * a. any cached array paths (e.g. 'array.3.prop') may be invalidated - * due to array mutations like shift/unshift/splice; this is fine - * since path changes are dirty-checked at user entry points like `set` - * b. dirty-checking for objects only lasts one turn to allow the user - * to mutate the object in-place and re-set it with the same identity - * and have all sub-properties re-propagated in a subsequent turn. - * - * The temp cache is not necessarily sufficient to prevent invalid array - * paths, since a splice can happen during the same turn (with pathological - * user code); we could introduce a "fixup" for temporarily cached array - * paths if needed: https://github.com/Polymer/polymer/issues/4227 - * - * @override - * @param {string} property Name of the property - * @param {*} value Value to set - * @param {boolean=} shouldNotify True if property should fire notification - * event (applies only for `notify: true` properties) - * @return {boolean} Returns true if the property changed - */ - _setPendingProperty(property, value, shouldNotify) { - let propIsPath = this.__dataHasPaths && isPath(property); - let prevProps = propIsPath ? this.__dataTemp : this.__data; - if (this._shouldPropertyChange(property, value, prevProps[property])) { - if (!this.__dataPending) { - this.__dataPending = {}; - this.__dataOld = {}; - } - // Ensure old is captured from the last turn - if (!(property in this.__dataOld)) { - this.__dataOld[property] = this.__data[property]; - } - // Paths are stored in temporary cache (cleared at end of turn), - // which is used for dirty-checking, all others stored in __data - if (propIsPath) { - this.__dataTemp[property] = value; - } else { - this.__data[property] = value; - } - // All changes go into pending property bag, passed to _propertiesChanged - this.__dataPending[property] = value; - // Track properties that should notify separately - if (propIsPath || (this[TYPES.NOTIFY] && this[TYPES.NOTIFY][property])) { - this.__dataToNotify = this.__dataToNotify || {}; - this.__dataToNotify[property] = shouldNotify; - } - return true; - } - return false; - } - - /** - * Overrides base implementation to ensure all accessors set `shouldNotify` - * to true, for per-property notification tracking. - * - * @override - * @param {string} property Name of the property - * @param {*} value Value to set - * @return {void} - */ - _setProperty(property, value) { - if (this._setPendingProperty(property, value, true)) { - this._invalidateProperties(); - } - } - - /** - * Overrides `PropertyAccessor`'s default async queuing of - * `_propertiesChanged`: if `__dataReady` is false (has not yet been - * manually flushed), the function no-ops; otherwise flushes - * `_propertiesChanged` synchronously. - * - * @override - * @return {void} - */ - _invalidateProperties() { - if (this.__dataReady) { - this._flushProperties(); - } - } - - /** - * Enqueues the given client on a list of pending clients, whose - * pending property changes can later be flushed via a call to - * `_flushClients`. - * - * @override - * @param {Object} client PropertyEffects client to enqueue - * @return {void} - * @protected - */ - _enqueueClient(client) { - this.__dataPendingClients = this.__dataPendingClients || []; - if (client !== this) { - this.__dataPendingClients.push(client); - } - } - - /** - * Overrides superclass implementation. - * - * @override - * @return {void} - * @protected - */ - _flushProperties() { - this.__dataCounter++; - super._flushProperties(); - this.__dataCounter--; - } - - /** - * Flushes any clients previously enqueued via `_enqueueClient`, causing - * their `_flushProperties` method to run. - * - * @override - * @return {void} - * @protected - */ - _flushClients() { - if (!this.__dataClientsReady) { - this.__dataClientsReady = true; - this._readyClients(); - // Override point where accessors are turned on; importantly, - // this is after clients have fully readied, providing a guarantee - // that any property effects occur only after all clients are ready. - this.__dataReady = true; - } else { - this.__enableOrFlushClients(); - } - } - - // NOTE: We ensure clients either enable or flush as appropriate. This - // handles two corner cases: - // (1) clients flush properly when connected/enabled before the host - // enables; e.g. - // (a) Templatize stamps with no properties and does not flush and - // (b) the instance is inserted into dom and - // (c) then the instance flushes. - // (2) clients enable properly when not connected/enabled when the host - // flushes; e.g. - // (a) a template is runtime stamped and not yet connected/enabled - // (b) a host sets a property, causing stamped dom to flush - // (c) the stamped dom enables. - __enableOrFlushClients() { - let clients = this.__dataPendingClients; - if (clients) { - this.__dataPendingClients = null; - for (let i=0; i < clients.length; i++) { - let client = clients[i]; - if (!client.__dataEnabled) { - client._enableProperties(); - } else if (client.__dataPending) { - client._flushProperties(); - } - } - } - } - - /** - * Perform any initial setup on client dom. Called before the first - * `_flushProperties` call on client dom and before any element - * observers are called. - * - * @override - * @return {void} - * @protected - */ - _readyClients() { - this.__enableOrFlushClients(); - } - - /** - * Sets a bag of property changes to this instance, and - * synchronously processes all effects of the properties as a batch. - * - * Property names must be simple properties, not paths. Batched - * path propagation is not supported. - * - * @override - * @param {Object} props Bag of one or more key-value pairs whose key is - * a property and value is the new value to set for that property. - * @param {boolean=} setReadOnly When true, any private values set in - * `props` will be set. By default, `setProperties` will not set - * `readOnly: true` root properties. - * @return {void} - * @public - */ - setProperties(props, setReadOnly) { - for (let path in props) { - if (setReadOnly || !this[TYPES.READ_ONLY] || !this[TYPES.READ_ONLY][path]) { - //TODO(kschaaf): explicitly disallow paths in setProperty? - // wildcard observers currently only pass the first changed path - // in the `info` object, and you could do some odd things batching - // paths, e.g. {'foo.bar': {...}, 'foo': null} - this._setPendingPropertyOrPath(path, props[path], true); - } - } - this._invalidateProperties(); - } - - /** - * Overrides `PropertyAccessors` so that property accessor - * side effects are not enabled until after client dom is fully ready. - * Also calls `_flushClients` callback to ensure client dom is enabled - * that was not enabled as a result of flushing properties. - * - * @override - * @return {void} - */ - ready() { - // It is important that `super.ready()` is not called here as it - // immediately turns on accessors. Instead, we wait until `readyClients` - // to enable accessors to provide a guarantee that clients are ready - // before processing any accessors side effects. - this._flushProperties(); - // If no data was pending, `_flushProperties` will not `flushClients` - // so ensure this is done. - if (!this.__dataClientsReady) { - this._flushClients(); - } - // Before ready, client notifications do not trigger _flushProperties. - // Therefore a flush is necessary here if data has been set. - if (this.__dataPending) { - this._flushProperties(); - } - } - - /** - * Implements `PropertyAccessors`'s properties changed callback. - * - * Runs each class of effects for the batch of changed properties in - * a specific order (compute, propagate, reflect, observe, notify). - * - * @override - * @param {!Object} currentProps Bag of all current accessor values - * @param {?Object} changedProps Bag of properties changed since the last - * call to `_propertiesChanged` - * @param {?Object} oldProps Bag of previous values for each property - * in `changedProps` - * @return {void} - */ - _propertiesChanged(currentProps, changedProps, oldProps) { - // ---------------------------- - // let c = Object.getOwnPropertyNames(changedProps || {}); - // window.debug && console.group(this.localName + '#' + this.id + ': ' + c); - // if (window.debug) { debugger; } - // ---------------------------- - let hasPaths = this.__dataHasPaths; - this.__dataHasPaths = false; - // Compute properties - runComputedEffects(this, changedProps, oldProps, hasPaths); - // Clear notify properties prior to possible reentry (propagate, observe), - // but after computing effects have a chance to add to them - let notifyProps = this.__dataToNotify; - this.__dataToNotify = null; - // Propagate properties to clients - this._propagatePropertyChanges(changedProps, oldProps, hasPaths); - // Flush clients - this._flushClients(); - // Reflect properties - runEffects(this, this[TYPES.REFLECT], changedProps, oldProps, hasPaths); - // Observe properties - runEffects(this, this[TYPES.OBSERVE], changedProps, oldProps, hasPaths); - // Notify properties to host - if (notifyProps) { - runNotifyEffects(this, notifyProps, changedProps, oldProps, hasPaths); - } - // Clear temporary cache at end of turn - if (this.__dataCounter == 1) { - this.__dataTemp = {}; - } - // ---------------------------- - // window.debug && console.groupEnd(this.localName + '#' + this.id + ': ' + c); - // ---------------------------- - } - - /** - * Called to propagate any property changes to stamped template nodes - * managed by this element. - * - * @override - * @param {Object} changedProps Bag of changed properties - * @param {Object} oldProps Bag of previous values for changed properties - * @param {boolean} hasPaths True with `props` contains one or more paths - * @return {void} - * @protected - */ - _propagatePropertyChanges(changedProps, oldProps, hasPaths) { - if (this[TYPES.PROPAGATE]) { - runEffects(this, this[TYPES.PROPAGATE], changedProps, oldProps, hasPaths); - } - let templateInfo = this.__templateInfo; - while (templateInfo) { - runEffects(this, templateInfo.propertyEffects, changedProps, oldProps, - hasPaths, templateInfo.nodeList); - templateInfo = templateInfo.nextTemplateInfo; - } - } - - /** - * Aliases one data path as another, such that path notifications from one - * are routed to the other. - * - * @override - * @param {string | !Array<string|number>} to Target path to link. - * @param {string | !Array<string|number>} from Source path to link. - * @return {void} - * @public - */ - linkPaths(to, from) { - to = normalize(to); - from = normalize(from); - this.__dataLinkedPaths = this.__dataLinkedPaths || {}; - this.__dataLinkedPaths[to] = from; - } - - /** - * Removes a data path alias previously established with `_linkPaths`. - * - * Note, the path to unlink should be the target (`to`) used when - * linking the paths. - * - * @override - * @param {string | !Array<string|number>} path Target path to unlink. - * @return {void} - * @public - */ - unlinkPaths(path) { - path = normalize(path); - if (this.__dataLinkedPaths) { - delete this.__dataLinkedPaths[path]; - } - } - - /** - * Notify that an array has changed. - * - * Example: - * - * this.items = [ {name: 'Jim'}, {name: 'Todd'}, {name: 'Bill'} ]; - * ... - * this.items.splice(1, 1, {name: 'Sam'}); - * this.items.push({name: 'Bob'}); - * this.notifySplices('items', [ - * { index: 1, removed: [{name: 'Todd'}], addedCount: 1, - * object: this.items, type: 'splice' }, - * { index: 3, removed: [], addedCount: 1, - * object: this.items, type: 'splice'} - * ]); - * - * @param {string} path Path that should be notified. - * @param {Array} splices Array of splice records indicating ordered - * changes that occurred to the array. Each record should have the - * following fields: - * * index: index at which the change occurred - * * removed: array of items that were removed from this index - * * addedCount: number of new items added at this index - * * object: a reference to the array in question - * * type: the string literal 'splice' - * - * Note that splice records _must_ be normalized such that they are - * reported in index order (raw results from `Object.observe` are not - * ordered and must be normalized/merged before notifying). - * - * @override - * @return {void} - * @public - */ - notifySplices(path, splices) { - let info = {path: ''}; - let array = /** @type {Array} */(get(this, path, info)); - notifySplices(this, array, info.path, splices); - } - - /** - * Convenience method for reading a value from a path. - * - * Note, if any part in the path is undefined, this method returns - * `undefined` (this method does not throw when dereferencing undefined - * paths). - * - * @override - * @param {(string|!Array<(string|number)>)} path Path to the value - * to read. The path may be specified as a string (e.g. `foo.bar.baz`) - * or an array of path parts (e.g. `['foo.bar', 'baz']`). Note that - * bracketed expressions are not supported; string-based path parts - * *must* be separated by dots. Note that when dereferencing array - * indices, the index may be used as a dotted part directly - * (e.g. `users.12.name` or `['users', 12, 'name']`). - * @param {Object=} root Root object from which the path is evaluated. - * @return {*} Value at the path, or `undefined` if any part of the path - * is undefined. - * @public - */ - get(path, root) { - return get(root || this, path); - } - - /** - * Convenience method for setting a value to a path and notifying any - * elements bound to the same path. - * - * Note, if any part in the path except for the last is undefined, - * this method does nothing (this method does not throw when - * dereferencing undefined paths). - * - * @override - * @param {(string|!Array<(string|number)>)} path Path to the value - * to write. The path may be specified as a string (e.g. `'foo.bar.baz'`) - * or an array of path parts (e.g. `['foo.bar', 'baz']`). Note that - * bracketed expressions are not supported; string-based path parts - * *must* be separated by dots. Note that when dereferencing array - * indices, the index may be used as a dotted part directly - * (e.g. `'users.12.name'` or `['users', 12, 'name']`). - * @param {*} value Value to set at the specified path. - * @param {Object=} root Root object from which the path is evaluated. - * When specified, no notification will occur. - * @return {void} - * @public - */ - set(path, value, root) { - if (root) { - set(root, path, value); - } else { - if (!this[TYPES.READ_ONLY] || !this[TYPES.READ_ONLY][/** @type {string} */(path)]) { - if (this._setPendingPropertyOrPath(path, value, true)) { - this._invalidateProperties(); - } - } - } - } - - /** - * Adds items onto the end of the array at the path specified. - * - * The arguments after `path` and return value match that of - * `Array.prototype.push`. - * - * This method notifies other paths to the same array that a - * splice occurred to the array. - * - * @override - * @param {string | !Array<string|number>} path Path to array. - * @param {...*} items Items to push onto array - * @return {number} New length of the array. - * @public - */ - push(path, ...items) { - let info = {path: ''}; - let array = /** @type {Array}*/(get(this, path, info)); - let len = array.length; - let ret = array.push(...items); - if (items.length) { - notifySplice(this, array, info.path, len, items.length, []); - } - return ret; - } - - /** - * Removes an item from the end of array at the path specified. - * - * The arguments after `path` and return value match that of - * `Array.prototype.pop`. - * - * This method notifies other paths to the same array that a - * splice occurred to the array. - * - * @override - * @param {string | !Array<string|number>} path Path to array. - * @return {*} Item that was removed. - * @public - */ - pop(path) { - let info = {path: ''}; - let array = /** @type {Array} */(get(this, path, info)); - let hadLength = Boolean(array.length); - let ret = array.pop(); - if (hadLength) { - notifySplice(this, array, info.path, array.length, 0, [ret]); - } - return ret; - } - - /** - * Starting from the start index specified, removes 0 or more items - * from the array and inserts 0 or more new items in their place. - * - * The arguments after `path` and return value match that of - * `Array.prototype.splice`. - * - * This method notifies other paths to the same array that a - * splice occurred to the array. - * - * @override - * @param {string | !Array<string|number>} path Path to array. - * @param {number} start Index from which to start removing/inserting. - * @param {number=} deleteCount Number of items to remove. - * @param {...*} items Items to insert into array. - * @return {Array} Array of removed items. - * @public - */ - splice(path, start, deleteCount, ...items) { - let info = {path : ''}; - let array = /** @type {Array} */(get(this, path, info)); - // Normalize fancy native splice handling of crazy start values - if (start < 0) { - start = array.length - Math.floor(-start); - } else if (start) { - start = Math.floor(start); - } - // array.splice does different things based on the number of arguments - // you pass in. Therefore, array.splice(0) and array.splice(0, undefined) - // do different things. In the former, the whole array is cleared. In the - // latter, no items are removed. - // This means that we need to detect whether 1. one of the arguments - // is actually passed in and then 2. determine how many arguments - // we should pass on to the native array.splice - // - let ret; - // Omit any additional arguments if they were not passed in - if (arguments.length === 2) { - ret = array.splice(start); - // Either start was undefined and the others were defined, but in this - // case we can safely pass on all arguments - // - // Note: this includes the case where none of the arguments were passed in, - // e.g. this.splice('array'). However, if both start and deleteCount - // are undefined, array.splice will not modify the array (as expected) - } else { - ret = array.splice(start, deleteCount, ...items); - } - // At the end, check whether any items were passed in (e.g. insertions) - // or if the return array contains items (e.g. deletions). - // Only notify if items were added or deleted. - if (items.length || ret.length) { - notifySplice(this, array, info.path, start, items.length, ret); - } - return ret; - } - - /** - * Removes an item from the beginning of array at the path specified. - * - * The arguments after `path` and return value match that of - * `Array.prototype.pop`. - * - * This method notifies other paths to the same array that a - * splice occurred to the array. - * - * @override - * @param {string | !Array<string|number>} path Path to array. - * @return {*} Item that was removed. - * @public - */ - shift(path) { - let info = {path: ''}; - let array = /** @type {Array} */(get(this, path, info)); - let hadLength = Boolean(array.length); - let ret = array.shift(); - if (hadLength) { - notifySplice(this, array, info.path, 0, 0, [ret]); - } - return ret; - } - - /** - * Adds items onto the beginning of the array at the path specified. - * - * The arguments after `path` and return value match that of - * `Array.prototype.push`. - * - * This method notifies other paths to the same array that a - * splice occurred to the array. - * - * @override - * @param {string | !Array<string|number>} path Path to array. - * @param {...*} items Items to insert info array - * @return {number} New length of the array. - * @public - */ - unshift(path, ...items) { - let info = {path: ''}; - let array = /** @type {Array} */(get(this, path, info)); - let ret = array.unshift(...items); - if (items.length) { - notifySplice(this, array, info.path, 0, items.length, []); - } - return ret; - } - - /** - * Notify that a path has changed. - * - * Example: - * - * this.item.user.name = 'Bob'; - * this.notifyPath('item.user.name'); - * - * @override - * @param {string} path Path that should be notified. - * @param {*=} value Value at the path (optional). - * @return {void} - * @public - */ - notifyPath(path, value) { - /** @type {string} */ - let propPath; - if (arguments.length == 1) { - // Get value if not supplied - let info = {path: ''}; - value = get(this, path, info); - propPath = info.path; - } else if (Array.isArray(path)) { - // Normalize path if needed - propPath = normalize(path); - } else { - propPath = /** @type{string} */(path); - } - if (this._setPendingPropertyOrPath(propPath, value, true, true)) { - this._invalidateProperties(); - } - } - - /** - * Equivalent to static `createReadOnlyProperty` API but can be called on - * an instance to add effects at runtime. See that method for - * full API docs. - * - * @override - * @param {string} property Property name - * @param {boolean=} protectedSetter Creates a custom protected setter - * when `true`. - * @return {void} - * @protected - */ - _createReadOnlyProperty(property, protectedSetter) { - this._addPropertyEffect(property, TYPES.READ_ONLY); - if (protectedSetter) { - this['_set' + upper(property)] = /** @this {PropertyEffects} */function(value) { - this._setProperty(property, value); - }; - } - } - - /** - * Equivalent to static `createPropertyObserver` API but can be called on - * an instance to add effects at runtime. See that method for - * full API docs. - * - * @override - * @param {string} property Property name - * @param {string|function(*,*)} method Function or name of observer method - * to call - * @param {boolean=} dynamicFn Whether the method name should be included as - * a dependency to the effect. - * @return {void} - * @protected - */ - _createPropertyObserver(property, method, dynamicFn) { - let info = { property, method, dynamicFn: Boolean(dynamicFn) }; - this._addPropertyEffect(property, TYPES.OBSERVE, { - fn: runObserverEffect, info, trigger: {name: property} - }); - if (dynamicFn) { - this._addPropertyEffect(/** @type {string} */(method), TYPES.OBSERVE, { - fn: runObserverEffect, info, trigger: {name: method} - }); - } - } - - /** - * Equivalent to static `createMethodObserver` API but can be called on - * an instance to add effects at runtime. See that method for - * full API docs. - * - * @override - * @param {string} expression Method expression - * @param {boolean|Object=} dynamicFn Boolean or object map indicating - * whether method names should be included as a dependency to the effect. - * @return {void} - * @protected - */ - _createMethodObserver(expression, dynamicFn) { - let sig = parseMethod(expression); - if (!sig) { - throw new Error("Malformed observer expression '" + expression + "'"); - } - createMethodEffect(this, sig, TYPES.OBSERVE, runMethodEffect, null, dynamicFn); - } - - /** - * Equivalent to static `createNotifyingProperty` API but can be called on - * an instance to add effects at runtime. See that method for - * full API docs. - * - * @override - * @param {string} property Property name - * @return {void} - * @protected - */ - _createNotifyingProperty(property) { - this._addPropertyEffect(property, TYPES.NOTIFY, { - fn: runNotifyEffect, - info: { - eventName: camelToDashCase(property) + '-changed', - property: property - } - }); - } - - /** - * Equivalent to static `createReflectedProperty` API but can be called on - * an instance to add effects at runtime. See that method for - * full API docs. - * - * @override - * @param {string} property Property name - * @return {void} - * @protected - * @suppress {missingProperties} go/missingfnprops - */ - _createReflectedProperty(property) { - let attr = this.constructor.attributeNameForProperty(property); - if (attr[0] === '-') { - console.warn('Property ' + property + ' cannot be reflected to attribute ' + - attr + ' because "-" is not a valid starting attribute name. Use a lowercase first letter for the property instead.'); - } else { - this._addPropertyEffect(property, TYPES.REFLECT, { - fn: runReflectEffect, - info: { - attrName: attr - } - }); - } - } - - /** - * Equivalent to static `createComputedProperty` API but can be called on - * an instance to add effects at runtime. See that method for - * full API docs. - * - * @override - * @param {string} property Name of computed property to set - * @param {string} expression Method expression - * @param {boolean|Object=} dynamicFn Boolean or object map indicating - * whether method names should be included as a dependency to the effect. - * @return {void} - * @protected - */ - _createComputedProperty(property, expression, dynamicFn) { - let sig = parseMethod(expression); - if (!sig) { - throw new Error("Malformed computed expression '" + expression + "'"); - } - createMethodEffect(this, sig, TYPES.COMPUTE, runComputedEffect, property, dynamicFn); - } - - /** - * Gather the argument values for a method specified in the provided array - * of argument metadata. - * - * The `path` and `value` arguments are used to fill in wildcard descriptor - * when the method is being called as a result of a path notification. - * - * @param {!Array<!MethodArg>} args Array of argument metadata - * @param {string} path Property/path name that triggered the method effect - * @param {Object} props Bag of current property changes - * @return {Array<*>} Array of argument values - * @private - */ - _marshalArgs(args, path, props) { - const data = this.__data; - const values = []; - for (let i=0, l=args.length; i<l; i++) { - let {name, structured, wildcard, value, literal} = args[i]; - if (!literal) { - if (wildcard) { - const matches = isDescendant(name, path); - const pathValue = getArgValue(data, props, matches ? path : name); - value = { - path: matches ? path : name, - value: pathValue, - base: matches ? get(data, name) : pathValue - }; - } else { - value = structured ? getArgValue(data, props, name) : data[name]; - } - } - values[i] = value; - } - return values; - } - - // -- static class methods ------------ - - /** - * Ensures an accessor exists for the specified property, and adds - * to a list of "property effects" that will run when the accessor for - * the specified property is set. Effects are grouped by "type", which - * roughly corresponds to a phase in effect processing. The effect - * metadata should be in the following form: - * - * { - * fn: effectFunction, // Reference to function to call to perform effect - * info: { ... } // Effect metadata passed to function - * trigger: { // Optional triggering metadata; if not provided - * name: string // the property is treated as a wildcard - * structured: boolean - * wildcard: boolean - * } - * } - * - * Effects are called from `_propertiesChanged` in the following order by - * type: - * - * 1. COMPUTE - * 2. PROPAGATE - * 3. REFLECT - * 4. OBSERVE - * 5. NOTIFY - * - * Effect functions are called with the following signature: - * - * effectFunction(inst, path, props, oldProps, info, hasPaths) - * - * @param {string} property Property that should trigger the effect - * @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES - * @param {Object=} effect Effect metadata object - * @return {void} - * @protected - */ - static addPropertyEffect(property, type, effect) { - this.prototype._addPropertyEffect(property, type, effect); - } - - /** - * Creates a single-property observer for the given property. - * - * @param {string} property Property name - * @param {string|function(*,*)} method Function or name of observer method to call - * @param {boolean=} dynamicFn Whether the method name should be included as - * a dependency to the effect. - * @return {void} - * @protected - */ - static createPropertyObserver(property, method, dynamicFn) { - this.prototype._createPropertyObserver(property, method, dynamicFn); - } - - /** - * Creates a multi-property "method observer" based on the provided - * expression, which should be a string in the form of a normal JavaScript - * function signature: `'methodName(arg1, [..., argn])'`. Each argument - * should correspond to a property or path in the context of this - * prototype (or instance), or may be a literal string or number. - * - * @param {string} expression Method expression - * @param {boolean|Object=} dynamicFn Boolean or object map indicating - * @return {void} - * whether method names should be included as a dependency to the effect. - * @protected - */ - static createMethodObserver(expression, dynamicFn) { - this.prototype._createMethodObserver(expression, dynamicFn); - } - - /** - * Causes the setter for the given property to dispatch `<property>-changed` - * events to notify of changes to the property. - * - * @param {string} property Property name - * @return {void} - * @protected - */ - static createNotifyingProperty(property) { - this.prototype._createNotifyingProperty(property); - } - - /** - * Creates a read-only accessor for the given property. - * - * To set the property, use the protected `_setProperty` API. - * To create a custom protected setter (e.g. `_setMyProp()` for - * property `myProp`), pass `true` for `protectedSetter`. - * - * Note, if the property will have other property effects, this method - * should be called first, before adding other effects. - * - * @param {string} property Property name - * @param {boolean=} protectedSetter Creates a custom protected setter - * when `true`. - * @return {void} - * @protected - */ - static createReadOnlyProperty(property, protectedSetter) { - this.prototype._createReadOnlyProperty(property, protectedSetter); - } - - /** - * Causes the setter for the given property to reflect the property value - * to a (dash-cased) attribute of the same name. - * - * @param {string} property Property name - * @return {void} - * @protected - */ - static createReflectedProperty(property) { - this.prototype._createReflectedProperty(property); - } - - /** - * Creates a computed property whose value is set to the result of the - * method described by the given `expression` each time one or more - * arguments to the method changes. The expression should be a string - * in the form of a normal JavaScript function signature: - * `'methodName(arg1, [..., argn])'` - * - * @param {string} property Name of computed property to set - * @param {string} expression Method expression - * @param {boolean|Object=} dynamicFn Boolean or object map indicating whether - * method names should be included as a dependency to the effect. - * @return {void} - * @protected - */ - static createComputedProperty(property, expression, dynamicFn) { - this.prototype._createComputedProperty(property, expression, dynamicFn); - } - - /** - * Parses the provided template to ensure binding effects are created - * for them, and then ensures property accessors are created for any - * dependent properties in the template. Binding effects for bound - * templates are stored in a linked list on the instance so that - * templates can be efficiently stamped and unstamped. - * - * @param {!HTMLTemplateElement} template Template containing binding - * bindings - * @return {!TemplateInfo} Template metadata object - * @protected - */ - static bindTemplate(template) { - return this.prototype._bindTemplate(template); - } - - // -- binding ---------------------------------------------- - - /** - * Equivalent to static `bindTemplate` API but can be called on - * an instance to add effects at runtime. See that method for - * full API docs. - * - * This method may be called on the prototype (for prototypical template - * binding, to avoid creating accessors every instance) once per prototype, - * and will be called with `runtimeBinding: true` by `_stampTemplate` to - * create and link an instance of the template metadata associated with a - * particular stamping. - * - * @override - * @param {!HTMLTemplateElement} template Template containing binding - * bindings - * @param {boolean=} instanceBinding When false (default), performs - * "prototypical" binding of the template and overwrites any previously - * bound template for the class. When true (as passed from - * `_stampTemplate`), the template info is instanced and linked into - * the list of bound templates. - * @return {!TemplateInfo} Template metadata object; for `runtimeBinding`, - * this is an instance of the prototypical template info - * @protected - * @suppress {missingProperties} go/missingfnprops - */ - _bindTemplate(template, instanceBinding) { - let templateInfo = this.constructor._parseTemplate(template); - let wasPreBound = this.__templateInfo == templateInfo; - // Optimization: since this is called twice for proto-bound templates, - // don't attempt to recreate accessors if this template was pre-bound - if (!wasPreBound) { - for (let prop in templateInfo.propertyEffects) { - this._createPropertyAccessor(prop); - } - } - if (instanceBinding) { - // For instance-time binding, create instance of template metadata - // and link into list of templates if necessary - templateInfo = /** @type {!TemplateInfo} */(Object.create(templateInfo)); - templateInfo.wasPreBound = wasPreBound; - if (!wasPreBound && this.__templateInfo) { - let last = this.__templateInfoLast || this.__templateInfo; - this.__templateInfoLast = last.nextTemplateInfo = templateInfo; - templateInfo.previousTemplateInfo = last; - return templateInfo; - } - } - return this.__templateInfo = templateInfo; - } - - /** - * Adds a property effect to the given template metadata, which is run - * at the "propagate" stage of `_propertiesChanged` when the template - * has been bound to the element via `_bindTemplate`. - * - * The `effect` object should match the format in `_addPropertyEffect`. - * - * @param {Object} templateInfo Template metadata to add effect to - * @param {string} prop Property that should trigger the effect - * @param {Object=} effect Effect metadata object - * @return {void} - * @protected - */ - static _addTemplatePropertyEffect(templateInfo, prop, effect) { - let hostProps = templateInfo.hostProps = templateInfo.hostProps || {}; - hostProps[prop] = true; - let effects = templateInfo.propertyEffects = templateInfo.propertyEffects || {}; - let propEffects = effects[prop] = effects[prop] || []; - propEffects.push(effect); - } - - /** - * Stamps the provided template and performs instance-time setup for - * Polymer template features, including data bindings, declarative event - * listeners, and the `this.$` map of `id`'s to nodes. A document fragment - * is returned containing the stamped DOM, ready for insertion into the - * DOM. - * - * This method may be called more than once; however note that due to - * `shadycss` polyfill limitations, only styles from templates prepared - * using `ShadyCSS.prepareTemplate` will be correctly polyfilled (scoped - * to the shadow root and support CSS custom properties), and note that - * `ShadyCSS.prepareTemplate` may only be called once per element. As such, - * any styles required by in runtime-stamped templates must be included - * in the main element template. - * - * @param {!HTMLTemplateElement} template Template to stamp - * @return {!StampedTemplate} Cloned template content - * @override - * @protected - */ - _stampTemplate(template) { - // Ensures that created dom is `_enqueueClient`'d to this element so - // that it can be flushed on next call to `_flushProperties` - hostStack.beginHosting(this); - let dom = super._stampTemplate(template); - hostStack.endHosting(this); - let templateInfo = /** @type {!TemplateInfo} */(this._bindTemplate(template, true)); - // Add template-instance-specific data to instanced templateInfo - templateInfo.nodeList = dom.nodeList; - // Capture child nodes to allow unstamping of non-prototypical templates - if (!templateInfo.wasPreBound) { - let nodes = templateInfo.childNodes = []; - for (let n=dom.firstChild; n; n=n.nextSibling) { - nodes.push(n); - } - } - dom.templateInfo = templateInfo; - // Setup compound storage, 2-way listeners, and dataHost for bindings - setupBindings(this, templateInfo); - // Flush properties into template nodes if already booted - if (this.__dataReady) { - runEffects(this, templateInfo.propertyEffects, this.__data, null, - false, templateInfo.nodeList); - } - return dom; - } - - /** - * Removes and unbinds the nodes previously contained in the provided - * DocumentFragment returned from `_stampTemplate`. - * - * @override - * @param {!StampedTemplate} dom DocumentFragment previously returned - * from `_stampTemplate` associated with the nodes to be removed - * @return {void} - * @protected - */ - _removeBoundDom(dom) { - // Unlink template info - let templateInfo = dom.templateInfo; - if (templateInfo.previousTemplateInfo) { - templateInfo.previousTemplateInfo.nextTemplateInfo = - templateInfo.nextTemplateInfo; - } - if (templateInfo.nextTemplateInfo) { - templateInfo.nextTemplateInfo.previousTemplateInfo = - templateInfo.previousTemplateInfo; - } - if (this.__templateInfoLast == templateInfo) { - this.__templateInfoLast = templateInfo.previousTemplateInfo; - } - templateInfo.previousTemplateInfo = templateInfo.nextTemplateInfo = null; - // Remove stamped nodes - let nodes = templateInfo.childNodes; - for (let i=0; i<nodes.length; i++) { - let node = nodes[i]; - node.parentNode.removeChild(node); - } - } - - /** - * Overrides default `TemplateStamp` implementation to add support for - * parsing bindings from `TextNode`'s' `textContent`. A `bindings` - * array is added to `nodeInfo` and populated with binding metadata - * with information capturing the binding target, and a `parts` array - * with one or more metadata objects capturing the source(s) of the - * binding. - * - * @param {Node} node Node to parse - * @param {TemplateInfo} templateInfo Template metadata for current template - * @param {NodeInfo} nodeInfo Node metadata for current template node - * @return {boolean} `true` if the visited node added node-specific - * metadata to `nodeInfo` - * @protected - * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do - */ - static _parseTemplateNode(node, templateInfo, nodeInfo) { - let noted = super._parseTemplateNode(node, templateInfo, nodeInfo); - if (node.nodeType === Node.TEXT_NODE) { - let parts = this._parseBindings(node.textContent, templateInfo); - if (parts) { - // Initialize the textContent with any literal parts - // NOTE: default to a space here so the textNode remains; some browsers - // (IE) omit an empty textNode following cloneNode/importNode. - node.textContent = literalFromParts(parts) || ' '; - addBinding(this, templateInfo, nodeInfo, 'text', 'textContent', parts); - noted = true; - } - } - return noted; - } - - /** - * Overrides default `TemplateStamp` implementation to add support for - * parsing bindings from attributes. A `bindings` - * array is added to `nodeInfo` and populated with binding metadata - * with information capturing the binding target, and a `parts` array - * with one or more metadata objects capturing the source(s) of the - * binding. - * - * @param {Element} node Node to parse - * @param {TemplateInfo} templateInfo Template metadata for current template - * @param {NodeInfo} nodeInfo Node metadata for current template node - * @param {string} name Attribute name - * @param {string} value Attribute value - * @return {boolean} `true` if the visited node added node-specific - * metadata to `nodeInfo` - * @protected - * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do - */ - static _parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value) { - let parts = this._parseBindings(value, templateInfo); - if (parts) { - // Attribute or property - let origName = name; - let kind = 'property'; - // The only way we see a capital letter here is if the attr has - // a capital letter in it per spec. In this case, to make sure - // this binding works, we go ahead and make the binding to the attribute. - if (capitalAttributeRegex.test(name)) { - kind = 'attribute'; - } else if (name[name.length-1] == '$') { - name = name.slice(0, -1); - kind = 'attribute'; - } - // Initialize attribute bindings with any literal parts - let literal = literalFromParts(parts); - if (literal && kind == 'attribute') { - // Ensure a ShadyCSS template scoped style is not removed - // when a class$ binding's initial literal value is set. - if (name == 'class' && node.hasAttribute('class')) { - literal += ' ' + node.getAttribute(name); - } - node.setAttribute(name, literal); - } - // Clear attribute before removing, since IE won't allow removing - // `value` attribute if it previously had a value (can't - // unconditionally set '' before removing since attributes with `$` - // can't be set using setAttribute) - if (node.localName === 'input' && origName === 'value') { - node.setAttribute(origName, ''); - } - // Remove annotation - node.removeAttribute(origName); - // Case hackery: attributes are lower-case, but bind targets - // (properties) are case sensitive. Gambit is to map dash-case to - // camel-case: `foo-bar` becomes `fooBar`. - // Attribute bindings are excepted. - if (kind === 'property') { - name = dashToCamelCase(name); - } - addBinding(this, templateInfo, nodeInfo, kind, name, parts, literal); - return true; - } else { - return super._parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value); - } - } - - /** - * Overrides default `TemplateStamp` implementation to add support for - * binding the properties that a nested template depends on to the template - * as `_host_<property>`. - * - * @param {Node} node Node to parse - * @param {TemplateInfo} templateInfo Template metadata for current template - * @param {NodeInfo} nodeInfo Node metadata for current template node - * @return {boolean} `true` if the visited node added node-specific - * metadata to `nodeInfo` - * @protected - * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do - */ - static _parseTemplateNestedTemplate(node, templateInfo, nodeInfo) { - let noted = super._parseTemplateNestedTemplate(node, templateInfo, nodeInfo); - // Merge host props into outer template and add bindings - let hostProps = nodeInfo.templateInfo.hostProps; - let mode = '{'; - for (let source in hostProps) { - let parts = [{ mode, source, dependencies: [source] }]; - addBinding(this, templateInfo, nodeInfo, 'property', '_host_' + source, parts); - } - return noted; - } - - /** - * Called to parse text in a template (either attribute values or - * textContent) into binding metadata. - * - * Any overrides of this method should return an array of binding part - * metadata representing one or more bindings found in the provided text - * and any "literal" text in between. Any non-literal parts will be passed - * to `_evaluateBinding` when any dependencies change. The only required - * fields of each "part" in the returned array are as follows: - * - * - `dependencies` - Array containing trigger metadata for each property - * that should trigger the binding to update - * - `literal` - String containing text if the part represents a literal; - * in this case no `dependencies` are needed - * - * Additional metadata for use by `_evaluateBinding` may be provided in - * each part object as needed. - * - * The default implementation handles the following types of bindings - * (one or more may be intermixed with literal strings): - * - Property binding: `[[prop]]` - * - Path binding: `[[object.prop]]` - * - Negated property or path bindings: `[[!prop]]` or `[[!object.prop]]` - * - Two-way property or path bindings (supports negation): - * `{{prop}}`, `{{object.prop}}`, `{{!prop}}` or `{{!object.prop}}` - * - Inline computed method (supports negation): - * `[[compute(a, 'literal', b)]]`, `[[!compute(a, 'literal', b)]]` - * - * The default implementation uses a regular expression for best - * performance. However, the regular expression uses a white-list of - * allowed characters in a data-binding, which causes problems for - * data-bindings that do use characters not in this white-list. - * - * Instead of updating the white-list with all allowed characters, - * there is a StrictBindingParser (see lib/mixins/strict-binding-parser) - * that uses a state machine instead. This state machine is able to handle - * all characters. However, it is slightly less performant, therefore we - * extracted it into a separate optional mixin. - * - * @param {string} text Text to parse from attribute or textContent - * @param {Object} templateInfo Current template metadata - * @return {Array<!BindingPart>} Array of binding part metadata - * @protected - */ - static _parseBindings(text, templateInfo) { - let parts = []; - let lastIndex = 0; - let m; - // Example: "literal1{{prop}}literal2[[!compute(foo,bar)]]final" - // Regex matches: - // Iteration 1: Iteration 2: - // m[1]: '{{' '[[' - // m[2]: '' '!' - // m[3]: 'prop' 'compute(foo,bar)' - while ((m = bindingRegex.exec(text)) !== null) { - // Add literal part - if (m.index > lastIndex) { - parts.push({literal: text.slice(lastIndex, m.index)}); - } - // Add binding part - let mode = m[1][0]; - let negate = Boolean(m[2]); - let source = m[3].trim(); - let customEvent = false, notifyEvent = '', colon = -1; - if (mode == '{' && (colon = source.indexOf('::')) > 0) { - notifyEvent = source.substring(colon + 2); - source = source.substring(0, colon); - customEvent = true; - } - let signature = parseMethod(source); - let dependencies = []; - if (signature) { - // Inline computed function - let {args, methodName} = signature; - for (let i=0; i<args.length; i++) { - let arg = args[i]; - if (!arg.literal) { - dependencies.push(arg); - } - } - let dynamicFns = templateInfo.dynamicFns; - if (dynamicFns && dynamicFns[methodName] || signature.static) { - dependencies.push(methodName); - signature.dynamicFn = true; - } - } else { - // Property or path - dependencies.push(source); - } - parts.push({ - source, mode, negate, customEvent, signature, dependencies, - event: notifyEvent - }); - lastIndex = bindingRegex.lastIndex; - } - // Add a final literal part - if (lastIndex && lastIndex < text.length) { - let literal = text.substring(lastIndex); - if (literal) { - parts.push({ - literal: literal - }); - } - } - if (parts.length) { - return parts; - } else { - return null; - } - } - - /** - * Called to evaluate a previously parsed binding part based on a set of - * one or more changed dependencies. - * - * @param {!Polymer_PropertyEffects} inst Element that should be used as - * scope for binding dependencies - * @param {BindingPart} part Binding part metadata - * @param {string} path Property/path that triggered this effect - * @param {Object} props Bag of current property changes - * @param {Object} oldProps Bag of previous values for changed properties - * @param {boolean} hasPaths True with `props` contains one or more paths - * @return {*} Value the binding part evaluated to - * @protected - */ - static _evaluateBinding(inst, part, path, props, oldProps, hasPaths) { - let value; - if (part.signature) { - value = runMethodEffect(inst, path, props, oldProps, part.signature); - } else if (path != part.source) { - value = get(inst, part.source); - } else { - if (hasPaths && isPath(path)) { - value = get(inst, path); - } else { - value = inst.__data[path]; - } - } - if (part.negate) { - value = !value; - } - return value; - } - - } - - return PropertyEffects; -}); - -/** - * Helper api for enqueuing client dom created by a host element. - * - * By default elements are flushed via `_flushProperties` when - * `connectedCallback` is called. Elements attach their client dom to - * themselves at `ready` time which results from this first flush. - * This provides an ordering guarantee that the client dom an element - * creates is flushed before the element itself (i.e. client `ready` - * fires before host `ready`). - * - * However, if `_flushProperties` is called *before* an element is connected, - * as for example `Templatize` does, this ordering guarantee cannot be - * satisfied because no elements are connected. (Note: Bound elements that - * receive data do become enqueued clients and are properly ordered but - * unbound elements are not.) - * - * To maintain the desired "client before host" ordering guarantee for this - * case we rely on the "host stack. Client nodes registers themselves with - * the creating host element when created. This ensures that all client dom - * is readied in the proper order, maintaining the desired guarantee. - * - * @private - */ -class HostStack { - constructor() { - this.stack = []; - } - - /** - * @param {*} inst Instance to add to hostStack - * @return {void} - */ - registerHost(inst) { - if (this.stack.length) { - let host = this.stack[this.stack.length-1]; - host._enqueueClient(inst); - } - } - - /** - * @param {*} inst Instance to begin hosting - * @return {void} - */ - beginHosting(inst) { - this.stack.push(inst); - } - - /** - * @param {*} inst Instance to end hosting - * @return {void} - */ - endHosting(inst) { - let stackLen = this.stack.length; - if (stackLen && this.stack[stackLen-1] == inst) { - this.stack.pop(); - } - } -} -const hostStack = new HostStack(); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/strict-binding-parser.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/strict-binding-parser.js deleted file mode 100644 index 924c69c70f5..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/strict-binding-parser.js +++ /dev/null @@ -1,414 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import '../utils/boot.js'; - -import { isPath } from '../utils/path.js'; -import { dedupingMixin } from '../utils/mixin.js'; -import { PropertyEffects } from './property-effects.js'; - -/** - * The open and corresponding closing brackets for surrounding bindings. - * @enum {string} - */ -const BINDINGS = { - '{': '}', - '[': ']' -}; - -/** - * All states that the parser can be in. The states represent the state-machine as a whole. - * @enum {number} - */ -const STATE = { - INITIAL: 1, - FIRSTOPENINGBINDING: 2, - FIRSTCHARACTERBINDING: 3, - BINDING: 4, - FIRSTCOLON: 5, - COLONNOTIFYEVENT: 6, - COLONNOTIFYEVENTFIRSTCLOSINGBINDING: 7, - FIRSTCLOSINGBINDING: 8, - STRING: 9, - METHOD: 10, - STRINGARG: 11, - NUMBERARG: 12, - VARIABLEARG: 13, - METHODCLOSED: 14, - METHODCLOSEDBINDING: 15 -}; - -function pushLiteral(text, i, parts, startChar) { - const literal = text.substring(startChar || 0, i); - if (literal) { - parts.push({ - literal - }); - } -} - -function storeMethod(bindingData, templateInfo) { - const methodName = bindingData.signature.methodName; - const dynamicFns = templateInfo.dynamicFns; - if (dynamicFns && dynamicFns[methodName] || bindingData.signature.static) { - bindingData.dependencies.push(methodName); - bindingData.signature.dynamicFn = true; - } -} - -function storeVariableBinding(parts, bindingData, prop, i) { - bindingData.source = prop; - bindingData.dependencies.push(prop); - bindingData.startChar = i + 1; - parts.push(bindingData); -} - -function storeMethodVariable(bindingData, text, i) { - const name = text.substring(bindingData.startChar, i).trim(); - if (name) { - if (name === 'true' || name === 'false') { - bindingData.signature.args.push({ - name, - value: name == 'true', - literal: true - }); - } else { - const arg = { - name - }; - arg.structured = isPath(name); - if (arg.structured) { - arg.wildcard = (name.slice(-2) == '.*'); - if (arg.wildcard) { - arg.name = name.slice(0, -2); - } - } - bindingData.signature.args.push(arg); - bindingData.dependencies.push(name); - bindingData.signature.static = false; - } - } -} - -function storeMethodNumber(bindingData, text, i) { - const value = text.substring(bindingData.startChar, i).trim(); - bindingData.signature.args.push({ - name: value, - value: Number(value), - literal: true - }); -} - -/** - * Mixin that parses binding expressions and generates corresponding metadata. - * The implementation is different than in `property-effects`, as it uses a - * state machine instead of a regex. As such, this implementation is able to - * handle more cases, with the potential performance hit. - * - * @mixinFunction - * @appliesMixin PropertyEffects - * @polymer - * @summary Mixin that parses binding expressions and generates corresponding metadata. - */ -const StrictBindingParser = dedupingMixin((base) => { - - /** - * @constructor - * @extends {base} - * @implements {Polymer_PropertyEffects} - * @private - */ - const elementBase = PropertyEffects(base); - - /** - * @polymer - * @mixinClass - * @implements {Polymer_PropertyEffects} - */ - return class extends elementBase { - - /** - * Called to parse text in a template (either attribute values or - * textContent) into binding metadata. - * - * Any overrides of this method should return an array of binding part - * metadata representing one or more bindings found in the provided text - * and any "literal" text in between. Any non-literal parts will be passed - * to `_evaluateBinding` when any dependencies change. The only required - * fields of each "part" in the returned array are as follows: - * - * - `dependencies` - Array containing trigger metadata for each property - * that should trigger the binding to update - * - `literal` - String containing text if the part represents a literal; - * in this case no `dependencies` are needed - * - * Additional metadata for use by `_evaluateBinding` may be provided in - * each part object as needed. - * - * The default implementation handles the following types of bindings - * (one or more may be intermixed with literal strings): - * - Property binding: `[[prop]]` - * - Path binding: `[[object.prop]]` - * - Negated property or path bindings: `[[!prop]]` or `[[!object.prop]]` - * - Two-way property or path bindings (supports negation): - * `{{prop}}`, `{{object.prop}}`, `{{!prop}}` or `{{!object.prop}}` - * - Inline computed method (supports negation): - * `[[compute(a, 'literal', b)]]`, `[[!compute(a, 'literal', b)]]` - * - * @param {string} text Text to parse from attribute or textContent - * @param {Object} templateInfo Current template metadata - * @return {Array<!BindingPart>} Array of binding part metadata - * @protected - */ - static _parseBindings(text, templateInfo) { - const parts = []; - let bindingData = {}; - let escaped = false; - /** @type {string} */ - let quote; - /** @type {number} */ - let state = STATE.INITIAL; - let i,l; - - for (i=0,l=text.length; i<l; i++) { - const char = text.charAt(i); - switch (state) { - case STATE.INITIAL: { - if ((char === '{' || char === '[')) { - bindingData = { - mode: char, - dependencies: [], - startChar: bindingData.startChar - }; - state = STATE.FIRSTOPENINGBINDING; - } - break; - } - case STATE.FIRSTOPENINGBINDING: { - if (char === bindingData.mode) { - pushLiteral(text, i - 1, parts, bindingData.startChar); - bindingData.startChar = i + 1; - state = STATE.FIRSTCHARACTERBINDING; - } else { - bindingData = {}; - state = STATE.INITIAL; - } - break; - } - case STATE.FIRSTCHARACTERBINDING: { - if (char !== ' ' && char !== '\t' && char !== '\n') { - if (char === '!') { - bindingData.negate = true; - bindingData.startChar = i + 1; - } - state = STATE.BINDING; - } - break; - } - case STATE.BINDING: { - switch (char) { - case BINDINGS[bindingData.mode]: { - state = STATE.FIRSTCLOSINGBINDING; - break; - } - case '\'': - case '"': { - quote = char; - state = STATE.STRING; - break; - } - case '(': { - bindingData.signature = { - methodName: text.substring(bindingData.startChar, i).trim(), - args: [], - static: true - }; - bindingData.startChar = i + 1; - state = STATE.METHOD; - break; - } - case ':': { - state = STATE.FIRSTCOLON; - } - } - break; - } - case STATE.FIRSTCOLON: { - if (char === ':') { - bindingData.customEvent = true; - bindingData.startCharAfterColon = i + 1; - state = STATE.COLONNOTIFYEVENT; - } else { - state = STATE.BINDING; - } - break; - } - case STATE.COLONNOTIFYEVENT: { - if (char === BINDINGS[bindingData.mode]) { - state = STATE.COLONNOTIFYEVENTFIRSTCLOSINGBINDING; - } - break; - } - case STATE.COLONNOTIFYEVENTFIRSTCLOSINGBINDING: { - if (char === BINDINGS[bindingData.mode]) { - bindingData.event = text.substring(bindingData.startCharAfterColon, i - 1).trim(); - const prop = text.substring(bindingData.startChar, bindingData.startCharAfterColon - 2).trim(); - storeVariableBinding(parts, bindingData, prop, i); - state = STATE.INITIAL; - } else { - state = STATE.BINDING; - } - break; - } - case STATE.FIRSTCLOSINGBINDING: { - if (char === BINDINGS[bindingData.mode]) { - const prop = text.substring(bindingData.startChar, i - 1).trim(); - storeVariableBinding(parts, bindingData, prop, i); - state = STATE.INITIAL; - } else { - state = STATE.BINDING; - } - break; - } - case STATE.STRING: { - if (char === '\\') { - escaped = true; - } else if (char === quote && !escaped) { - state = STATE.BINDING; - } else { - escaped = false; - } - break; - } - case STATE.METHOD: { - switch (char) { - case ')': { - storeMethodVariable(bindingData, text, i); - storeMethod(bindingData, templateInfo); - bindingData.startChar = i + 1; - state = STATE.METHODCLOSED; - break; - } - case ',': { - storeMethodVariable(bindingData, text, i); - bindingData.startChar = i + 1; - break; - } - case '\'': - case '"': { - quote = char; - state = STATE.STRINGARG; - break; - } - default: { - if (char >= '0' && char <= '9' || char === '-') { - state = STATE.NUMBERARG; - } else if (char != ' ' && char != '\n') { - state = STATE.VARIABLEARG; - } - } - } - break; - } - case STATE.STRINGARG: { - if (char === '\\') { - escaped = true; - } else if (char === quote && !escaped) { - const value = text.substring(bindingData.startChar, i) - .replace(/^\s+/, '') - .substring(1) - // replace comma entity with comma - .replace(/,/g, ',') - // repair extra escape sequences; note only commas strictly need - // escaping, but we allow any other char to be escaped since its - // likely users will do this - .replace(/\\(.)/g, '\$1'); - bindingData.signature.args.push({ - value, - name: value, - literal: true - }); - bindingData.startChar = i + 1; - state = STATE.METHOD; - } else { - escaped = false; - } - break; - } - case STATE.NUMBERARG: { - switch (char) { - case ',': { - storeMethodNumber(bindingData, text, i); - bindingData.startChar = i + 1; - state = STATE.METHOD; - break; - } - case ')': { - storeMethodNumber(bindingData, text, i); - storeMethod(bindingData, templateInfo); - state = STATE.METHODCLOSED; - break; - } - default: { - if (char < '0' || char > '9') { - state = STATE.VARIABLEARG; - } - } - } - break; - } - case STATE.VARIABLEARG: { - switch (char) { - case ',': { - storeMethodVariable(bindingData, text, i); - bindingData.startChar = i + 1; - state = STATE.METHOD; - break; - } - case ')': { - storeMethodVariable(bindingData, text, i); - storeMethod(bindingData, templateInfo); - state = STATE.METHODCLOSED; - break; - } - } - break; - } - case STATE.METHODCLOSED: { - if (char === BINDINGS[bindingData.mode]) { - state = STATE.METHODCLOSEDBINDING; - } else if (char !== ' ' && char !== '\t' && char !== '\n') { - console.warn(`Expected two closing "${BINDINGS[bindingData.mode]}" for binding "${text}"`); - } - break; - } - case STATE.METHODCLOSEDBINDING: { - if (char === BINDINGS[bindingData.mode]) { - bindingData.startChar = i + 1; - parts.push(bindingData); - state = STATE.INITIAL; - } else if (char !== ' ' && char !== '\t' && char !== '\n') { - console.warn(`Expected one closing "${BINDINGS[bindingData.mode]}" for binding "${text}"`); - } - break; - } - } - } - - if (parts.length) { - pushLiteral(text, i, parts, parts[parts.length - 1].startChar); - return parts; - } - - return null; - } - }; -}); - -export { StrictBindingParser }; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/template-stamp.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/template-stamp.js deleted file mode 100644 index 167fbe530a9..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/mixins/template-stamp.js +++ /dev/null @@ -1,500 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import '../utils/boot.js'; - -import { dedupingMixin } from '../utils/mixin.js'; - -const walker = document.createTreeWalker(document, NodeFilter.SHOW_ALL, - null, false); - -// 1.x backwards-compatible auto-wrapper for template type extensions -// This is a clear layering violation and gives favored-nation status to -// dom-if and dom-repeat templates. This is a conceit we're choosing to keep -// a.) to ease 1.x backwards-compatibility due to loss of `is`, and -// b.) to maintain if/repeat capability in parser-constrained elements -// (e.g. table, select) in lieu of native CE type extensions without -// massive new invention in this space (e.g. directive system) -const templateExtensions = { - 'dom-if': true, - 'dom-repeat': true -}; -function wrapTemplateExtension(node) { - let is = node.getAttribute('is'); - if (is && templateExtensions[is]) { - let t = node; - t.removeAttribute('is'); - node = t.ownerDocument.createElement(is); - t.parentNode.replaceChild(node, t); - node.appendChild(t); - while(t.attributes.length) { - node.setAttribute(t.attributes[0].name, t.attributes[0].value); - t.removeAttribute(t.attributes[0].name); - } - } - return node; -} - -function findTemplateNode(root, nodeInfo) { - // recursively ascend tree until we hit root - let parent = nodeInfo.parentInfo && findTemplateNode(root, nodeInfo.parentInfo); - // unwind the stack, returning the indexed node at each level - if (parent) { - // note: marginally faster than indexing via childNodes - // (http://jsperf.com/childnodes-lookup) - walker.currentNode = parent; - for (let n=walker.firstChild(), i=0; n; n=walker.nextSibling()) { - if (nodeInfo.parentIndex === i++) { - return n; - } - } - } else { - return root; - } -} - -// construct `$` map (from id annotations) -function applyIdToMap(inst, map, node, nodeInfo) { - if (nodeInfo.id) { - map[nodeInfo.id] = node; - } -} - -// install event listeners (from event annotations) -function applyEventListener(inst, node, nodeInfo) { - if (nodeInfo.events && nodeInfo.events.length) { - for (let j=0, e$=nodeInfo.events, e; (j<e$.length) && (e=e$[j]); j++) { - inst._addMethodEventListenerToNode(node, e.name, e.value, inst); - } - } -} - -// push configuration references at configure time -function applyTemplateContent(inst, node, nodeInfo) { - if (nodeInfo.templateInfo) { - node._templateInfo = nodeInfo.templateInfo; - } -} - -function createNodeEventHandler(context, eventName, methodName) { - // Instances can optionally have a _methodHost which allows redirecting where - // to find methods. Currently used by `templatize`. - context = context._methodHost || context; - let handler = function(e) { - if (context[methodName]) { - context[methodName](e, e.detail); - } else { - console.warn('listener method `' + methodName + '` not defined'); - } - }; - return handler; -} - -/** - * Element mixin that provides basic template parsing and stamping, including - * the following template-related features for stamped templates: - * - * - Declarative event listeners (`on-eventname="listener"`) - * - Map of node id's to stamped node instances (`this.$.id`) - * - Nested template content caching/removal and re-installation (performance - * optimization) - * - * @mixinFunction - * @polymer - * @summary Element class mixin that provides basic template parsing and stamping - */ -export const TemplateStamp = dedupingMixin( - /** - * @template T - * @param {function(new:T)} superClass Class to apply mixin to. - * @return {function(new:T)} superClass with mixin applied. - */ - (superClass) => { - - /** - * @polymer - * @mixinClass - * @implements {Polymer_TemplateStamp} - */ - class TemplateStamp extends superClass { - - /** - * Scans a template to produce template metadata. - * - * Template-specific metadata are stored in the object returned, and node- - * specific metadata are stored in objects in its flattened `nodeInfoList` - * array. Only nodes in the template that were parsed as nodes of - * interest contain an object in `nodeInfoList`. Each `nodeInfo` object - * contains an `index` (`childNodes` index in parent) and optionally - * `parent`, which points to node info of its parent (including its index). - * - * The template metadata object returned from this method has the following - * structure (many fields optional): - * - * ```js - * { - * // Flattened list of node metadata (for nodes that generated metadata) - * nodeInfoList: [ - * { - * // `id` attribute for any nodes with id's for generating `$` map - * id: {string}, - * // `on-event="handler"` metadata - * events: [ - * { - * name: {string}, // event name - * value: {string}, // handler method name - * }, ... - * ], - * // Notes when the template contained a `<slot>` for shady DOM - * // optimization purposes - * hasInsertionPoint: {boolean}, - * // For nested `<template>`` nodes, nested template metadata - * templateInfo: {object}, // nested template metadata - * // Metadata to allow efficient retrieval of instanced node - * // corresponding to this metadata - * parentInfo: {number}, // reference to parent nodeInfo> - * parentIndex: {number}, // index in parent's `childNodes` collection - * infoIndex: {number}, // index of this `nodeInfo` in `templateInfo.nodeInfoList` - * }, - * ... - * ], - * // When true, the template had the `strip-whitespace` attribute - * // or was nested in a template with that setting - * stripWhitespace: {boolean}, - * // For nested templates, nested template content is moved into - * // a document fragment stored here; this is an optimization to - * // avoid the cost of nested template cloning - * content: {DocumentFragment} - * } - * ``` - * - * This method kicks off a recursive treewalk as follows: - * - * ``` - * _parseTemplate <---------------------+ - * _parseTemplateContent | - * _parseTemplateNode <------------|--+ - * _parseTemplateNestedTemplate --+ | - * _parseTemplateChildNodes ---------+ - * _parseTemplateNodeAttributes - * _parseTemplateNodeAttribute - * - * ``` - * - * These methods may be overridden to add custom metadata about templates - * to either `templateInfo` or `nodeInfo`. - * - * Note that this method may be destructive to the template, in that - * e.g. event annotations may be removed after being noted in the - * template metadata. - * - * @param {!HTMLTemplateElement} template Template to parse - * @param {TemplateInfo=} outerTemplateInfo Template metadata from the outer - * template, for parsing nested templates - * @return {!TemplateInfo} Parsed template metadata - */ - static _parseTemplate(template, outerTemplateInfo) { - // since a template may be re-used, memo-ize metadata - if (!template._templateInfo) { - let templateInfo = template._templateInfo = {}; - templateInfo.nodeInfoList = []; - templateInfo.stripWhiteSpace = - (outerTemplateInfo && outerTemplateInfo.stripWhiteSpace) || - template.hasAttribute('strip-whitespace'); - this._parseTemplateContent(template, templateInfo, {parent: null}); - } - return template._templateInfo; - } - - static _parseTemplateContent(template, templateInfo, nodeInfo) { - return this._parseTemplateNode(template.content, templateInfo, nodeInfo); - } - - /** - * Parses template node and adds template and node metadata based on - * the current node, and its `childNodes` and `attributes`. - * - * This method may be overridden to add custom node or template specific - * metadata based on this node. - * - * @param {Node} node Node to parse - * @param {!TemplateInfo} templateInfo Template metadata for current template - * @param {!NodeInfo} nodeInfo Node metadata for current template. - * @return {boolean} `true` if the visited node added node-specific - * metadata to `nodeInfo` - */ - static _parseTemplateNode(node, templateInfo, nodeInfo) { - let noted; - let element = /** @type {Element} */(node); - if (element.localName == 'template' && !element.hasAttribute('preserve-content')) { - noted = this._parseTemplateNestedTemplate(element, templateInfo, nodeInfo) || noted; - } else if (element.localName === 'slot') { - // For ShadyDom optimization, indicating there is an insertion point - templateInfo.hasInsertionPoint = true; - } - walker.currentNode = element; - if (walker.firstChild()) { - noted = this._parseTemplateChildNodes(element, templateInfo, nodeInfo) || noted; - } - if (element.hasAttributes && element.hasAttributes()) { - noted = this._parseTemplateNodeAttributes(element, templateInfo, nodeInfo) || noted; - } - return noted; - } - - /** - * Parses template child nodes for the given root node. - * - * This method also wraps whitelisted legacy template extensions - * (`is="dom-if"` and `is="dom-repeat"`) with their equivalent element - * wrappers, collapses text nodes, and strips whitespace from the template - * if the `templateInfo.stripWhitespace` setting was provided. - * - * @param {Node} root Root node whose `childNodes` will be parsed - * @param {!TemplateInfo} templateInfo Template metadata for current template - * @param {!NodeInfo} nodeInfo Node metadata for current template. - * @return {void} - */ - static _parseTemplateChildNodes(root, templateInfo, nodeInfo) { - if (root.localName === 'script' || root.localName === 'style') { - return; - } - walker.currentNode = root; - for (let node=walker.firstChild(), parentIndex=0, next; node; node=next) { - // Wrap templates - if (node.localName == 'template') { - node = wrapTemplateExtension(node); - } - // collapse adjacent textNodes: fixes an IE issue that can cause - // text nodes to be inexplicably split =( - // note that root.normalize() should work but does not so we do this - // manually. - walker.currentNode = node; - next = walker.nextSibling(); - if (node.nodeType === Node.TEXT_NODE) { - let /** Node */ n = next; - while (n && (n.nodeType === Node.TEXT_NODE)) { - node.textContent += n.textContent; - next = walker.nextSibling(); - root.removeChild(n); - n = next; - } - // optionally strip whitespace - if (templateInfo.stripWhiteSpace && !node.textContent.trim()) { - root.removeChild(node); - continue; - } - } - let childInfo = { parentIndex, parentInfo: nodeInfo }; - if (this._parseTemplateNode(node, templateInfo, childInfo)) { - childInfo.infoIndex = templateInfo.nodeInfoList.push(/** @type {!NodeInfo} */(childInfo)) - 1; - } - // Increment if not removed - walker.currentNode = node; - if (walker.parentNode()) { - parentIndex++; - } - } - } - - /** - * Parses template content for the given nested `<template>`. - * - * Nested template info is stored as `templateInfo` in the current node's - * `nodeInfo`. `template.content` is removed and stored in `templateInfo`. - * It will then be the responsibility of the host to set it back to the - * template and for users stamping nested templates to use the - * `_contentForTemplate` method to retrieve the content for this template - * (an optimization to avoid the cost of cloning nested template content). - * - * @param {HTMLTemplateElement} node Node to parse (a <template>) - * @param {TemplateInfo} outerTemplateInfo Template metadata for current template - * that includes the template `node` - * @param {!NodeInfo} nodeInfo Node metadata for current template. - * @return {boolean} `true` if the visited node added node-specific - * metadata to `nodeInfo` - */ - static _parseTemplateNestedTemplate(node, outerTemplateInfo, nodeInfo) { - let templateInfo = this._parseTemplate(node, outerTemplateInfo); - let content = templateInfo.content = - node.content.ownerDocument.createDocumentFragment(); - content.appendChild(node.content); - nodeInfo.templateInfo = templateInfo; - return true; - } - - /** - * Parses template node attributes and adds node metadata to `nodeInfo` - * for nodes of interest. - * - * @param {Element} node Node to parse - * @param {TemplateInfo} templateInfo Template metadata for current template - * @param {NodeInfo} nodeInfo Node metadata for current template. - * @return {boolean} `true` if the visited node added node-specific - * metadata to `nodeInfo` - */ - static _parseTemplateNodeAttributes(node, templateInfo, nodeInfo) { - // Make copy of original attribute list, since the order may change - // as attributes are added and removed - let noted = false; - let attrs = Array.from(node.attributes); - for (let i=attrs.length-1, a; (a=attrs[i]); i--) { - noted = this._parseTemplateNodeAttribute(node, templateInfo, nodeInfo, a.name, a.value) || noted; - } - return noted; - } - - /** - * Parses a single template node attribute and adds node metadata to - * `nodeInfo` for attributes of interest. - * - * This implementation adds metadata for `on-event="handler"` attributes - * and `id` attributes. - * - * @param {Element} node Node to parse - * @param {!TemplateInfo} templateInfo Template metadata for current template - * @param {!NodeInfo} nodeInfo Node metadata for current template. - * @param {string} name Attribute name - * @param {string} value Attribute value - * @return {boolean} `true` if the visited node added node-specific - * metadata to `nodeInfo` - */ - static _parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value) { - // events (on-*) - if (name.slice(0, 3) === 'on-') { - node.removeAttribute(name); - nodeInfo.events = nodeInfo.events || []; - nodeInfo.events.push({ - name: name.slice(3), - value - }); - return true; - } - // static id - else if (name === 'id') { - nodeInfo.id = value; - return true; - } - return false; - } - - /** - * Returns the `content` document fragment for a given template. - * - * For nested templates, Polymer performs an optimization to cache nested - * template content to avoid the cost of cloning deeply nested templates. - * This method retrieves the cached content for a given template. - * - * @param {HTMLTemplateElement} template Template to retrieve `content` for - * @return {DocumentFragment} Content fragment - */ - static _contentForTemplate(template) { - let templateInfo = /** @type {HTMLTemplateElementWithInfo} */ (template)._templateInfo; - return (templateInfo && templateInfo.content) || template.content; - } - - /** - * Clones the provided template content and returns a document fragment - * containing the cloned dom. - * - * The template is parsed (once and memoized) using this library's - * template parsing features, and provides the following value-added - * features: - * * Adds declarative event listeners for `on-event="handler"` attributes - * * Generates an "id map" for all nodes with id's under `$` on returned - * document fragment - * * Passes template info including `content` back to templates as - * `_templateInfo` (a performance optimization to avoid deep template - * cloning) - * - * Note that the memoized template parsing process is destructive to the - * template: attributes for bindings and declarative event listeners are - * removed after being noted in notes, and any nested `<template>.content` - * is removed and stored in notes as well. - * - * @param {!HTMLTemplateElement} template Template to stamp - * @return {!StampedTemplate} Cloned template content - * @override - */ - _stampTemplate(template) { - // Polyfill support: bootstrap the template if it has not already been - if (template && !template.content && - window.HTMLTemplateElement && HTMLTemplateElement.decorate) { - HTMLTemplateElement.decorate(template); - } - let templateInfo = this.constructor._parseTemplate(template); - let nodeInfo = templateInfo.nodeInfoList; - let content = templateInfo.content || template.content; - let dom = /** @type {DocumentFragment} */ (document.importNode(content, true)); - // NOTE: ShadyDom optimization indicating there is an insertion point - dom.__noInsertionPoint = !templateInfo.hasInsertionPoint; - let nodes = dom.nodeList = new Array(nodeInfo.length); - dom.$ = {}; - for (let i=0, l=nodeInfo.length, info; (i<l) && (info=nodeInfo[i]); i++) { - let node = nodes[i] = findTemplateNode(dom, info); - applyIdToMap(this, dom.$, node, info); - applyTemplateContent(this, node, info); - applyEventListener(this, node, info); - } - dom = /** @type {!StampedTemplate} */(dom); // eslint-disable-line no-self-assign - return dom; - } - - /** - * Adds an event listener by method name for the event provided. - * - * This method generates a handler function that looks up the method - * name at handling time. - * - * @param {!EventTarget} node Node to add listener on - * @param {string} eventName Name of event - * @param {string} methodName Name of method - * @param {*=} context Context the method will be called on (defaults - * to `node`) - * @return {Function} Generated handler function - * @override - */ - _addMethodEventListenerToNode(node, eventName, methodName, context) { - context = context || node; - let handler = createNodeEventHandler(context, eventName, methodName); - this._addEventListenerToNode(node, eventName, handler); - return handler; - } - - /** - * Override point for adding custom or simulated event handling. - * - * @param {!EventTarget} node Node to add event listener to - * @param {string} eventName Name of event - * @param {function(!Event):void} handler Listener function to add - * @return {void} - * @override - */ - _addEventListenerToNode(node, eventName, handler) { - node.addEventListener(eventName, handler); - } - - /** - * Override point for adding custom or simulated event handling. - * - * @param {!EventTarget} node Node to remove event listener from - * @param {string} eventName Name of event - * @param {function(!Event):void} handler Listener function to remove - * @return {void} - * @override - */ - _removeEventListenerFromNode(node, eventName, handler) { - node.removeEventListener(eventName, handler); - } - - } - - return TemplateStamp; - -}); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/array-splice.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/array-splice.js deleted file mode 100644 index 77ccb1af5c1..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/array-splice.js +++ /dev/null @@ -1,299 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import './boot.js'; - -function newSplice(index, removed, addedCount) { - return { - index: index, - removed: removed, - addedCount: addedCount - }; -} - -const EDIT_LEAVE = 0; -const EDIT_UPDATE = 1; -const EDIT_ADD = 2; -const EDIT_DELETE = 3; - -// Note: This function is *based* on the computation of the Levenshtein -// "edit" distance. The one change is that "updates" are treated as two -// edits - not one. With Array splices, an update is really a delete -// followed by an add. By retaining this, we optimize for "keeping" the -// maximum array items in the original array. For example: -// -// 'xxxx123' -> '123yyyy' -// -// With 1-edit updates, the shortest path would be just to update all seven -// characters. With 2-edit updates, we delete 4, leave 3, and add 4. This -// leaves the substring '123' intact. -function calcEditDistances(current, currentStart, currentEnd, - old, oldStart, oldEnd) { - // "Deletion" columns - let rowCount = oldEnd - oldStart + 1; - let columnCount = currentEnd - currentStart + 1; - let distances = new Array(rowCount); - - // "Addition" rows. Initialize null column. - for (let i = 0; i < rowCount; i++) { - distances[i] = new Array(columnCount); - distances[i][0] = i; - } - - // Initialize null row - for (let j = 0; j < columnCount; j++) - distances[0][j] = j; - - for (let i = 1; i < rowCount; i++) { - for (let j = 1; j < columnCount; j++) { - if (equals(current[currentStart + j - 1], old[oldStart + i - 1])) - distances[i][j] = distances[i - 1][j - 1]; - else { - let north = distances[i - 1][j] + 1; - let west = distances[i][j - 1] + 1; - distances[i][j] = north < west ? north : west; - } - } - } - - return distances; -} - -// This starts at the final weight, and walks "backward" by finding -// the minimum previous weight recursively until the origin of the weight -// matrix. -function spliceOperationsFromEditDistances(distances) { - let i = distances.length - 1; - let j = distances[0].length - 1; - let current = distances[i][j]; - let edits = []; - while (i > 0 || j > 0) { - if (i == 0) { - edits.push(EDIT_ADD); - j--; - continue; - } - if (j == 0) { - edits.push(EDIT_DELETE); - i--; - continue; - } - let northWest = distances[i - 1][j - 1]; - let west = distances[i - 1][j]; - let north = distances[i][j - 1]; - - let min; - if (west < north) - min = west < northWest ? west : northWest; - else - min = north < northWest ? north : northWest; - - if (min == northWest) { - if (northWest == current) { - edits.push(EDIT_LEAVE); - } else { - edits.push(EDIT_UPDATE); - current = northWest; - } - i--; - j--; - } else if (min == west) { - edits.push(EDIT_DELETE); - i--; - current = west; - } else { - edits.push(EDIT_ADD); - j--; - current = north; - } - } - - edits.reverse(); - return edits; -} - -/** - * Splice Projection functions: - * - * A splice map is a representation of how a previous array of items - * was transformed into a new array of items. Conceptually it is a list of - * tuples of - * - * <index, removed, addedCount> - * - * which are kept in ascending index order of. The tuple represents that at - * the |index|, |removed| sequence of items were removed, and counting forward - * from |index|, |addedCount| items were added. - */ - -/** - * Lacking individual splice mutation information, the minimal set of - * splices can be synthesized given the previous state and final state of an - * array. The basic approach is to calculate the edit distance matrix and - * choose the shortest path through it. - * - * Complexity: O(l * p) - * l: The length of the current array - * p: The length of the old array - * - * @param {!Array} current The current "changed" array for which to - * calculate splices. - * @param {number} currentStart Starting index in the `current` array for - * which splices are calculated. - * @param {number} currentEnd Ending index in the `current` array for - * which splices are calculated. - * @param {!Array} old The original "unchanged" array to compare `current` - * against to determine splices. - * @param {number} oldStart Starting index in the `old` array for - * which splices are calculated. - * @param {number} oldEnd Ending index in the `old` array for - * which splices are calculated. - * @return {!Array} Returns an array of splice record objects. Each of these - * contains: `index` the location where the splice occurred; `removed` - * the array of removed items from this location; `addedCount` the number - * of items added at this location. - */ -function calcSplices(current, currentStart, currentEnd, - old, oldStart, oldEnd) { - let prefixCount = 0; - let suffixCount = 0; - let splice; - - let minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart); - if (currentStart == 0 && oldStart == 0) - prefixCount = sharedPrefix(current, old, minLength); - - if (currentEnd == current.length && oldEnd == old.length) - suffixCount = sharedSuffix(current, old, minLength - prefixCount); - - currentStart += prefixCount; - oldStart += prefixCount; - currentEnd -= suffixCount; - oldEnd -= suffixCount; - - if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0) - return []; - - if (currentStart == currentEnd) { - splice = newSplice(currentStart, [], 0); - while (oldStart < oldEnd) - splice.removed.push(old[oldStart++]); - - return [ splice ]; - } else if (oldStart == oldEnd) - return [ newSplice(currentStart, [], currentEnd - currentStart) ]; - - let ops = spliceOperationsFromEditDistances( - calcEditDistances(current, currentStart, currentEnd, - old, oldStart, oldEnd)); - - splice = undefined; - let splices = []; - let index = currentStart; - let oldIndex = oldStart; - for (let i = 0; i < ops.length; i++) { - switch(ops[i]) { - case EDIT_LEAVE: - if (splice) { - splices.push(splice); - splice = undefined; - } - - index++; - oldIndex++; - break; - case EDIT_UPDATE: - if (!splice) - splice = newSplice(index, [], 0); - - splice.addedCount++; - index++; - - splice.removed.push(old[oldIndex]); - oldIndex++; - break; - case EDIT_ADD: - if (!splice) - splice = newSplice(index, [], 0); - - splice.addedCount++; - index++; - break; - case EDIT_DELETE: - if (!splice) - splice = newSplice(index, [], 0); - - splice.removed.push(old[oldIndex]); - oldIndex++; - break; - } - } - - if (splice) { - splices.push(splice); - } - return splices; -} - -function sharedPrefix(current, old, searchLength) { - for (let i = 0; i < searchLength; i++) - if (!equals(current[i], old[i])) - return i; - return searchLength; -} - -function sharedSuffix(current, old, searchLength) { - let index1 = current.length; - let index2 = old.length; - let count = 0; - while (count < searchLength && equals(current[--index1], old[--index2])) - count++; - - return count; -} - -/** - * Returns an array of splice records indicating the minimum edits required - * to transform the `previous` array into the `current` array. - * - * Splice records are ordered by index and contain the following fields: - * - `index`: index where edit started - * - `removed`: array of removed items from this index - * - `addedCount`: number of items added at this index - * - * This function is based on the Levenshtein "minimum edit distance" - * algorithm. Note that updates are treated as removal followed by addition. - * - * The worst-case time complexity of this algorithm is `O(l * p)` - * l: The length of the current array - * p: The length of the previous array - * - * However, the worst-case complexity is reduced by an `O(n)` optimization - * to detect any shared prefix & suffix between the two arrays and only - * perform the more expensive minimum edit distance calculation over the - * non-shared portions of the arrays. - * - * @function - * @param {!Array} current The "changed" array for which splices will be - * calculated. - * @param {!Array} previous The "unchanged" original array to compare - * `current` against to determine the splices. - * @return {!Array} Returns an array of splice record objects. Each of these - * contains: `index` the location where the splice occurred; `removed` - * the array of removed items from this location; `addedCount` the number - * of items added at this location. - */ -export function calculateSplices(current, previous) { - return calcSplices(current, 0, current.length, previous, 0, - previous.length); -} - -function equals(currentValue, previousValue) { - return currentValue === previousValue; -} diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/async.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/async.js deleted file mode 100644 index e332f95325c..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/async.js +++ /dev/null @@ -1,207 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ - -/** - * @fileoverview - * - * This module provides a number of strategies for enqueuing asynchronous - * tasks. Each sub-module provides a standard `run(fn)` interface that returns a - * handle, and a `cancel(handle)` interface for canceling async tasks before - * they run. - * - * @summary Module that provides a number of strategies for enqueuing - * asynchronous tasks. - */ - -import './boot.js'; - -// Microtask implemented using Mutation Observer -let microtaskCurrHandle = 0; -let microtaskLastHandle = 0; -let microtaskCallbacks = []; -let microtaskNodeContent = 0; -let microtaskNode = document.createTextNode(''); -new window.MutationObserver(microtaskFlush).observe(microtaskNode, {characterData: true}); - -function microtaskFlush() { - const len = microtaskCallbacks.length; - for (let i = 0; i < len; i++) { - let cb = microtaskCallbacks[i]; - if (cb) { - try { - cb(); - } catch (e) { - setTimeout(() => { throw e; }); - } - } - } - microtaskCallbacks.splice(0, len); - microtaskLastHandle += len; -} - -/** - * Async interface wrapper around `setTimeout`. - * - * @namespace - * @summary Async interface wrapper around `setTimeout`. - */ -const timeOut = { - /** - * Returns a sub-module with the async interface providing the provided - * delay. - * - * @memberof timeOut - * @param {number=} delay Time to wait before calling callbacks in ms - * @return {!AsyncInterface} An async timeout interface - */ - after(delay) { - return { - run(fn) { return window.setTimeout(fn, delay); }, - cancel(handle) { - window.clearTimeout(handle); - } - }; - }, - /** - * Enqueues a function called in the next task. - * - * @memberof timeOut - * @param {!Function} fn Callback to run - * @param {number=} delay Delay in milliseconds - * @return {number} Handle used for canceling task - */ - run(fn, delay) { - return window.setTimeout(fn, delay); - }, - /** - * Cancels a previously enqueued `timeOut` callback. - * - * @memberof timeOut - * @param {number} handle Handle returned from `run` of callback to cancel - * @return {void} - */ - cancel(handle) { - window.clearTimeout(handle); - } -}; -export {timeOut}; - -/** - * Async interface wrapper around `requestAnimationFrame`. - * - * @namespace - * @summary Async interface wrapper around `requestAnimationFrame`. - */ -const animationFrame = { - /** - * Enqueues a function called at `requestAnimationFrame` timing. - * - * @memberof animationFrame - * @param {function(number):void} fn Callback to run - * @return {number} Handle used for canceling task - */ - run(fn) { - return window.requestAnimationFrame(fn); - }, - /** - * Cancels a previously enqueued `animationFrame` callback. - * - * @memberof animationFrame - * @param {number} handle Handle returned from `run` of callback to cancel - * @return {void} - */ - cancel(handle) { - window.cancelAnimationFrame(handle); - } -}; -export {animationFrame}; - -/** - * Async interface wrapper around `requestIdleCallback`. Falls back to - * `setTimeout` on browsers that do not support `requestIdleCallback`. - * - * @namespace - * @summary Async interface wrapper around `requestIdleCallback`. - */ -const idlePeriod = { - /** - * Enqueues a function called at `requestIdleCallback` timing. - * - * @memberof idlePeriod - * @param {function(!IdleDeadline):void} fn Callback to run - * @return {number} Handle used for canceling task - */ - run(fn) { - return window.requestIdleCallback ? - window.requestIdleCallback(fn) : - window.setTimeout(fn, 16); - }, - /** - * Cancels a previously enqueued `idlePeriod` callback. - * - * @memberof idlePeriod - * @param {number} handle Handle returned from `run` of callback to cancel - * @return {void} - */ - cancel(handle) { - window.cancelIdleCallback ? - window.cancelIdleCallback(handle) : - window.clearTimeout(handle); - } -}; -export {idlePeriod}; - -/** - * Async interface for enqueuing callbacks that run at microtask timing. - * - * Note that microtask timing is achieved via a single `MutationObserver`, - * and thus callbacks enqueued with this API will all run in a single - * batch, and not interleaved with other microtasks such as promises. - * Promises are avoided as an implementation choice for the time being - * due to Safari bugs that cause Promises to lack microtask guarantees. - * - * @namespace - * @summary Async interface for enqueuing callbacks that run at microtask - * timing. - */ -const microTask = { - - /** - * Enqueues a function called at microtask timing. - * - * @memberof microTask - * @param {!Function=} callback Callback to run - * @return {number} Handle used for canceling task - */ - run(callback) { - microtaskNode.textContent = microtaskNodeContent++; - microtaskCallbacks.push(callback); - return microtaskCurrHandle++; - }, - - /** - * Cancels a previously enqueued `microTask` callback. - * - * @memberof microTask - * @param {number} handle Handle returned from `run` of callback to cancel - * @return {void} - */ - cancel(handle) { - const idx = handle - microtaskLastHandle; - if (idx >= 0) { - if (!microtaskCallbacks[idx]) { - throw new Error('invalid async handle: ' + handle); - } - microtaskCallbacks[idx] = null; - } - } - -}; -export {microTask}; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/boot.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/boot.js deleted file mode 100644 index d2bce392638..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/boot.js +++ /dev/null @@ -1,25 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ - -/* eslint-disable no-unused-vars */ -/** - * When using Closure Compiler, JSCompiler_renameProperty(property, object) is replaced by the munged name for object[property] - * We cannot alias this function, so we have to use a small shim that has the same behavior when not compiling. - * - * @param {string} prop Property name - * @param {?Object} obj Reference object - * @return {string} Potentially renamed property name - */ -window.JSCompiler_renameProperty = function(prop, obj) { - return prop; -}; -/* eslint-enable */ - -export {}; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/case-map.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/case-map.js deleted file mode 100644 index 1963b025b55..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/case-map.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import './boot.js'; - -const caseMap = {}; -const DASH_TO_CAMEL = /-[a-z]/g; -const CAMEL_TO_DASH = /([A-Z])/g; - -/** - * @fileoverview Module with utilities for converting between "dash-case" and - * "camelCase" identifiers. - */ - -/** - * Converts "dash-case" identifier (e.g. `foo-bar-baz`) to "camelCase" - * (e.g. `fooBarBaz`). - * - * @param {string} dash Dash-case identifier - * @return {string} Camel-case representation of the identifier - */ -export function dashToCamelCase(dash) { - return caseMap[dash] || ( - caseMap[dash] = dash.indexOf('-') < 0 ? dash : dash.replace(DASH_TO_CAMEL, - (m) => m[1].toUpperCase() - ) - ); -} - -/** - * Converts "camelCase" identifier (e.g. `fooBarBaz`) to "dash-case" - * (e.g. `foo-bar-baz`). - * - * @param {string} camel Camel-case identifier - * @return {string} Dash-case representation of the identifier - */ -export function camelToDashCase(camel) { - return caseMap[camel] || ( - caseMap[camel] = camel.replace(CAMEL_TO_DASH, '-$1').toLowerCase() - ); -} diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/debounce.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/debounce.js deleted file mode 100644 index cf4311abbcc..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/debounce.js +++ /dev/null @@ -1,165 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import './boot.js'; - -import './mixin.js'; -import './async.js'; - -/** - * @summary Collapse multiple callbacks into one invocation after a timer. - */ -export class Debouncer { - constructor() { - this._asyncModule = null; - this._callback = null; - this._timer = null; - } - /** - * Sets the scheduler; that is, a module with the Async interface, - * a callback and optional arguments to be passed to the run function - * from the async module. - * - * @param {!AsyncInterface} asyncModule Object with Async interface. - * @param {function()} callback Callback to run. - * @return {void} - */ - setConfig(asyncModule, callback) { - this._asyncModule = asyncModule; - this._callback = callback; - this._timer = this._asyncModule.run(() => { - this._timer = null; - debouncerQueue.delete(this); - this._callback(); - }); - } - /** - * Cancels an active debouncer and returns a reference to itself. - * - * @return {void} - */ - cancel() { - if (this.isActive()) { - this._cancelAsync(); - // Canceling a debouncer removes its spot from the flush queue, - // so if a debouncer is manually canceled and re-debounced, it - // will reset its flush order (this is a very minor difference from 1.x) - // Re-debouncing via the `debounce` API retains the 1.x FIFO flush order - debouncerQueue.delete(this); - } - } - /** - * Cancels a debouncer's async callback. - * - * @return {void} - */ - _cancelAsync() { - if (this.isActive()) { - this._asyncModule.cancel(/** @type {number} */(this._timer)); - this._timer = null; - } - } - /** - * Flushes an active debouncer and returns a reference to itself. - * - * @return {void} - */ - flush() { - if (this.isActive()) { - this.cancel(); - this._callback(); - } - } - /** - * Returns true if the debouncer is active. - * - * @return {boolean} True if active. - */ - isActive() { - return this._timer != null; - } - /** - * Creates a debouncer if no debouncer is passed as a parameter - * or it cancels an active debouncer otherwise. The following - * example shows how a debouncer can be called multiple times within a - * microtask and "debounced" such that the provided callback function is - * called once. Add this method to a custom element: - * - * ```js - * import {microTask} from '@polymer/polymer/lib/utils/async.js'; - * import {Debouncer} from '@polymer/polymer/lib/utils/debounce.js'; - * // ... - * - * _debounceWork() { - * this._debounceJob = Debouncer.debounce(this._debounceJob, - * microTask, () => this._doWork()); - * } - * ``` - * - * If the `_debounceWork` method is called multiple times within the same - * microtask, the `_doWork` function will be called only once at the next - * microtask checkpoint. - * - * Note: In testing it is often convenient to avoid asynchrony. To accomplish - * this with a debouncer, you can use `enqueueDebouncer` and - * `flush`. For example, extend the above example by adding - * `enqueueDebouncer(this._debounceJob)` at the end of the - * `_debounceWork` method. Then in a test, call `flush` to ensure - * the debouncer has completed. - * - * @param {Debouncer?} debouncer Debouncer object. - * @param {!AsyncInterface} asyncModule Object with Async interface - * @param {function()} callback Callback to run. - * @return {!Debouncer} Returns a debouncer object. - */ - static debounce(debouncer, asyncModule, callback) { - if (debouncer instanceof Debouncer) { - // Cancel the async callback, but leave in debouncerQueue if it was - // enqueued, to maintain 1.x flush order - debouncer._cancelAsync(); - } else { - debouncer = new Debouncer(); - } - debouncer.setConfig(asyncModule, callback); - return debouncer; - } -} - -let debouncerQueue = new Set(); - -/** - * Adds a `Debouncer` to a list of globally flushable tasks. - * - * @param {!Debouncer} debouncer Debouncer to enqueue - * @return {void} - */ -export const enqueueDebouncer = function(debouncer) { - debouncerQueue.add(debouncer); -}; - -/** - * Flushes any enqueued debouncers - * - * @return {boolean} Returns whether any debouncers were flushed - */ -export const flushDebouncers = function() { - const didFlush = Boolean(debouncerQueue.size); - // If new debouncers are added while flushing, Set.forEach will ensure - // newly added ones are also flushed - debouncerQueue.forEach(debouncer => { - try { - debouncer.flush(); - } catch(e) { - setTimeout(() => { - throw e; - }); - } - }); - return didFlush; -};
\ No newline at end of file diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/flattened-nodes-observer.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/flattened-nodes-observer.js deleted file mode 100644 index ddc8b7483f9..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/flattened-nodes-observer.js +++ /dev/null @@ -1,314 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import './boot.js'; - -import { calculateSplices } from './array-splice.js'; -import { microTask } from './async.js'; -import { wrap } from './wrap.js'; - -/** - * Returns true if `node` is a slot element - * @param {!Node} node Node to test. - * @return {boolean} Returns true if the given `node` is a slot - * @private - */ -function isSlot(node) { - return (node.localName === 'slot'); -} - -/** - * Class that listens for changes (additions or removals) to - * "flattened nodes" on a given `node`. The list of flattened nodes consists - * of a node's children and, for any children that are `<slot>` elements, - * the expanded flattened list of `assignedNodes`. - * For example, if the observed node has children `<a></a><slot></slot><b></b>` - * and the `<slot>` has one `<div>` assigned to it, then the flattened - * nodes list is `<a></a><div></div><b></b>`. If the `<slot>` has other - * `<slot>` elements assigned to it, these are flattened as well. - * - * The provided `callback` is called whenever any change to this list - * of flattened nodes occurs, where an addition or removal of a node is - * considered a change. The `callback` is called with one argument, an object - * containing an array of any `addedNodes` and `removedNodes`. - * - * Note: the callback is called asynchronous to any changes - * at a microtask checkpoint. This is because observation is performed using - * `MutationObserver` and the `<slot>` element's `slotchange` event which - * are asynchronous. - * - * An example: - * ```js - * class TestSelfObserve extends PolymerElement { - * static get is() { return 'test-self-observe';} - * connectedCallback() { - * super.connectedCallback(); - * this._observer = new FlattenedNodesObserver(this, (info) => { - * this.info = info; - * }); - * } - * disconnectedCallback() { - * super.disconnectedCallback(); - * this._observer.disconnect(); - * } - * } - * customElements.define(TestSelfObserve.is, TestSelfObserve); - * ``` - * - * @summary Class that listens for changes (additions or removals) to - * "flattened nodes" on a given `node`. - * @implements {PolymerDomApi.ObserveHandle} - */ -export let FlattenedNodesObserver = class { - - /** - * Returns the list of flattened nodes for the given `node`. - * This list consists of a node's children and, for any children - * that are `<slot>` elements, the expanded flattened list of `assignedNodes`. - * For example, if the observed node has children `<a></a><slot></slot><b></b>` - * and the `<slot>` has one `<div>` assigned to it, then the flattened - * nodes list is `<a></a><div></div><b></b>`. If the `<slot>` has other - * `<slot>` elements assigned to it, these are flattened as well. - * - * @param {!HTMLElement|!HTMLSlotElement} node The node for which to - * return the list of flattened nodes. - * @return {!Array<!Node>} The list of flattened nodes for the given `node`. - * @nocollapse See https://github.com/google/closure-compiler/issues/2763 - */ - // eslint-disable-next-line - static getFlattenedNodes(node) { - const wrapped = wrap(node); - if (isSlot(node)) { - node = /** @type {!HTMLSlotElement} */(node); // eslint-disable-line no-self-assign - return wrapped.assignedNodes({flatten: true}); - } else { - return Array.from(wrapped.childNodes).map((node) => { - if (isSlot(node)) { - node = /** @type {!HTMLSlotElement} */(node); // eslint-disable-line no-self-assign - return wrap(node).assignedNodes({flatten: true}); - } else { - return [node]; - } - }).reduce((a, b) => a.concat(b), []); - } - } - - /** - * @param {!HTMLElement} target Node on which to listen for changes. - * @param {?function(this: Element, { target: !HTMLElement, addedNodes: !Array<!Element>, removedNodes: !Array<!Element> }):void} callback Function called when there are additions - * or removals from the target's list of flattened nodes. - */ - // eslint-disable-next-line - constructor(target, callback) { - /** - * @type {MutationObserver} - * @private - */ - this._shadyChildrenObserver = null; - /** - * @type {MutationObserver} - * @private - */ - this._nativeChildrenObserver = null; - this._connected = false; - /** - * @type {!HTMLElement} - * @private - */ - this._target = target; - this.callback = callback; - this._effectiveNodes = []; - this._observer = null; - this._scheduled = false; - /** - * @type {function()} - * @private - */ - this._boundSchedule = () => { - this._schedule(); - }; - this.connect(); - this._schedule(); - } - - /** - * Activates an observer. This method is automatically called when - * a `FlattenedNodesObserver` is created. It should only be called to - * re-activate an observer that has been deactivated via the `disconnect` method. - * - * @return {void} - */ - connect() { - if (isSlot(this._target)) { - this._listenSlots([this._target]); - } else if (wrap(this._target).children) { - this._listenSlots( - /** @type {!NodeList<!Node>} */ (wrap(this._target).children)); - if (window.ShadyDOM) { - this._shadyChildrenObserver = - ShadyDOM.observeChildren(this._target, (mutations) => { - this._processMutations(mutations); - }); - } else { - this._nativeChildrenObserver = - new MutationObserver((mutations) => { - this._processMutations(mutations); - }); - this._nativeChildrenObserver.observe(this._target, {childList: true}); - } - } - this._connected = true; - } - - /** - * Deactivates the flattened nodes observer. After calling this method - * the observer callback will not be called when changes to flattened nodes - * occur. The `connect` method may be subsequently called to reactivate - * the observer. - * - * @return {void} - * @override - */ - disconnect() { - if (isSlot(this._target)) { - this._unlistenSlots([this._target]); - } else if (wrap(this._target).children) { - this._unlistenSlots( - /** @type {!NodeList<!Node>} */ (wrap(this._target).children)); - if (window.ShadyDOM && this._shadyChildrenObserver) { - ShadyDOM.unobserveChildren(this._shadyChildrenObserver); - this._shadyChildrenObserver = null; - } else if (this._nativeChildrenObserver) { - this._nativeChildrenObserver.disconnect(); - this._nativeChildrenObserver = null; - } - } - this._connected = false; - } - - /** - * @return {void} - * @private - */ - _schedule() { - if (!this._scheduled) { - this._scheduled = true; - microTask.run(() => this.flush()); - } - } - - /** - * @param {Array<MutationRecord>} mutations Mutations signaled by the mutation observer - * @return {void} - * @private - */ - _processMutations(mutations) { - this._processSlotMutations(mutations); - this.flush(); - } - - /** - * @param {Array<MutationRecord>} mutations Mutations signaled by the mutation observer - * @return {void} - * @private - */ - _processSlotMutations(mutations) { - if (mutations) { - for (let i=0; i < mutations.length; i++) { - let mutation = mutations[i]; - if (mutation.addedNodes) { - this._listenSlots(mutation.addedNodes); - } - if (mutation.removedNodes) { - this._unlistenSlots(mutation.removedNodes); - } - } - } - } - - /** - * Flushes the observer causing any pending changes to be immediately - * delivered the observer callback. By default these changes are delivered - * asynchronously at the next microtask checkpoint. - * - * @return {boolean} Returns true if any pending changes caused the observer - * callback to run. - */ - flush() { - if (!this._connected) { - return false; - } - if (window.ShadyDOM) { - ShadyDOM.flush(); - } - if (this._nativeChildrenObserver) { - this._processSlotMutations(this._nativeChildrenObserver.takeRecords()); - } else if (this._shadyChildrenObserver) { - this._processSlotMutations(this._shadyChildrenObserver.takeRecords()); - } - this._scheduled = false; - let info = { - target: this._target, - addedNodes: [], - removedNodes: [] - }; - let newNodes = this.constructor.getFlattenedNodes(this._target); - let splices = calculateSplices(newNodes, - this._effectiveNodes); - // process removals - for (let i=0, s; (i<splices.length) && (s=splices[i]); i++) { - for (let j=0, n; (j < s.removed.length) && (n=s.removed[j]); j++) { - info.removedNodes.push(n); - } - } - // process adds - for (let i=0, s; (i<splices.length) && (s=splices[i]); i++) { - for (let j=s.index; j < s.index + s.addedCount; j++) { - info.addedNodes.push(newNodes[j]); - } - } - // update cache - this._effectiveNodes = newNodes; - let didFlush = false; - if (info.addedNodes.length || info.removedNodes.length) { - didFlush = true; - this.callback.call(this._target, info); - } - return didFlush; - } - - /** - * @param {!Array<!Node>|!NodeList<!Node>} nodeList Nodes that could change - * @return {void} - * @private - */ - _listenSlots(nodeList) { - for (let i=0; i < nodeList.length; i++) { - let n = nodeList[i]; - if (isSlot(n)) { - n.addEventListener('slotchange', this._boundSchedule); - } - } - } - - /** - * @param {!Array<!Node>|!NodeList<!Node>} nodeList Nodes that could change - * @return {void} - * @private - */ - _unlistenSlots(nodeList) { - for (let i=0; i < nodeList.length; i++) { - let n = nodeList[i]; - if (isSlot(n)) { - n.removeEventListener('slotchange', this._boundSchedule); - } - } - } - -};
\ No newline at end of file diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/flush.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/flush.js deleted file mode 100644 index a7190470103..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/flush.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import './boot.js'; -/* eslint-disable no-unused-vars */ -import { Debouncer } from '../utils/debounce.js'; // used in type annotations -/* eslint-enable no-unused-vars */ -import { flushDebouncers } from '../utils/debounce.js'; // used in type annotations -export { enqueueDebouncer } from '../utils/debounce.js'; // used in type annotations - -/** - * Forces several classes of asynchronously queued tasks to flush: - * - Debouncers added via `enqueueDebouncer` - * - ShadyDOM distribution - * - * @return {void} - */ -export const flush = function() { - let shadyDOM, debouncers; - do { - shadyDOM = window.ShadyDOM && ShadyDOM.flush(); - if (window.ShadyCSS && window.ShadyCSS.ScopingShim) { - window.ShadyCSS.ScopingShim.flush(); - } - debouncers = flushDebouncers(); - } while (shadyDOM || debouncers); -}; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/gestures.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/gestures.js deleted file mode 100644 index f5f4bfd680d..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/gestures.js +++ /dev/null @@ -1,1079 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ - -/** - * @fileoverview - * - * Module for adding listeners to a node for the following normalized - * cross-platform "gesture" events: - * - `down` - mouse or touch went down - * - `up` - mouse or touch went up - * - `tap` - mouse click or finger tap - * - `track` - mouse drag or touch move - * - * @summary Module for adding cross-platform gesture event listeners. - */ - -import './boot.js'; - -import { timeOut, microTask } from './async.js'; -import { Debouncer } from './debounce.js'; -import { passiveTouchGestures } from './settings.js'; -import { wrap } from './wrap.js'; - -// detect native touch action support -let HAS_NATIVE_TA = typeof document.head.style.touchAction === 'string'; -let GESTURE_KEY = '__polymerGestures'; -let HANDLED_OBJ = '__polymerGesturesHandled'; -let TOUCH_ACTION = '__polymerGesturesTouchAction'; -// radius for tap and track -let TAP_DISTANCE = 25; -let TRACK_DISTANCE = 5; -// number of last N track positions to keep -let TRACK_LENGTH = 2; - -// Disabling "mouse" handlers for 2500ms is enough -let MOUSE_TIMEOUT = 2500; -let MOUSE_EVENTS = ['mousedown', 'mousemove', 'mouseup', 'click']; -// an array of bitmask values for mapping MouseEvent.which to MouseEvent.buttons -let MOUSE_WHICH_TO_BUTTONS = [0, 1, 4, 2]; -let MOUSE_HAS_BUTTONS = (function() { - try { - return new MouseEvent('test', {buttons: 1}).buttons === 1; - } catch (e) { - return false; - } -})(); - -/** - * @param {string} name Possible mouse event name - * @return {boolean} true if mouse event, false if not - */ -function isMouseEvent(name) { - return MOUSE_EVENTS.indexOf(name) > -1; -} - -/* eslint no-empty: ["error", { "allowEmptyCatch": true }] */ -// check for passive event listeners -let SUPPORTS_PASSIVE = false; -(function() { - try { - let opts = Object.defineProperty({}, 'passive', {get() {SUPPORTS_PASSIVE = true;}}); - window.addEventListener('test', null, opts); - window.removeEventListener('test', null, opts); - } catch(e) {} -})(); - -/** - * Generate settings for event listeners, dependant on `passiveTouchGestures` - * - * @param {string} eventName Event name to determine if `{passive}` option is - * needed - * @return {{passive: boolean} | undefined} Options to use for addEventListener - * and removeEventListener - */ -function PASSIVE_TOUCH(eventName) { - if (isMouseEvent(eventName) || eventName === 'touchend') { - return; - } - if (HAS_NATIVE_TA && SUPPORTS_PASSIVE && passiveTouchGestures) { - return {passive: true}; - } else { - return; - } -} - -// Check for touch-only devices -let IS_TOUCH_ONLY = navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/); - -// keep track of any labels hit by the mouseCanceller -/** @type {!Array<!HTMLLabelElement>} */ -const clickedLabels = []; - -/** @type {!Object<boolean>} */ -const labellable = { - 'button': true, - 'input': true, - 'keygen': true, - 'meter': true, - 'output': true, - 'textarea': true, - 'progress': true, - 'select': true -}; - -// Defined at https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#enabling-and-disabling-form-controls:-the-disabled-attribute -/** @type {!Object<boolean>} */ -const canBeDisabled = { - 'button': true, - 'command': true, - 'fieldset': true, - 'input': true, - 'keygen': true, - 'optgroup': true, - 'option': true, - 'select': true, - 'textarea': true -}; - -/** - * @param {HTMLElement} el Element to check labelling status - * @return {boolean} element can have labels - */ -function canBeLabelled(el) { - return labellable[el.localName] || false; -} - -/** - * @param {HTMLElement} el Element that may be labelled. - * @return {!Array<!HTMLLabelElement>} Relevant label for `el` - */ -function matchingLabels(el) { - let labels = Array.prototype.slice.call(/** @type {HTMLInputElement} */(el).labels || []); - // IE doesn't have `labels` and Safari doesn't populate `labels` - // if element is in a shadowroot. - // In this instance, finding the non-ancestor labels is enough, - // as the mouseCancellor code will handle ancstor labels - if (!labels.length) { - labels = []; - let root = el.getRootNode(); - // if there is an id on `el`, check for all labels with a matching `for` attribute - if (el.id) { - let matching = root.querySelectorAll(`label[for = ${el.id}]`); - for (let i = 0; i < matching.length; i++) { - labels.push(/** @type {!HTMLLabelElement} */(matching[i])); - } - } - } - return labels; -} - -// touch will make synthetic mouse events -// `preventDefault` on touchend will cancel them, -// but this breaks `<input>` focus and link clicks -// disable mouse handlers for MOUSE_TIMEOUT ms after -// a touchend to ignore synthetic mouse events -let mouseCanceller = function(mouseEvent) { - // Check for sourceCapabilities, used to distinguish synthetic events - // if mouseEvent did not come from a device that fires touch events, - // it was made by a real mouse and should be counted - // http://wicg.github.io/InputDeviceCapabilities/#dom-inputdevicecapabilities-firestouchevents - let sc = mouseEvent.sourceCapabilities; - if (sc && !sc.firesTouchEvents) { - return; - } - // skip synthetic mouse events - mouseEvent[HANDLED_OBJ] = {skip: true}; - // disable "ghost clicks" - if (mouseEvent.type === 'click') { - let clickFromLabel = false; - let path = getComposedPath(mouseEvent); - for (let i = 0; i < path.length; i++) { - if (path[i].nodeType === Node.ELEMENT_NODE) { - if (path[i].localName === 'label') { - clickedLabels.push(/** @type {!HTMLLabelElement} */ (path[i])); - } else if (canBeLabelled(/** @type {!HTMLElement} */ (path[i]))) { - let ownerLabels = - matchingLabels(/** @type {!HTMLElement} */ (path[i])); - // check if one of the clicked labels is labelling this element - for (let j = 0; j < ownerLabels.length; j++) { - clickFromLabel = clickFromLabel || clickedLabels.indexOf(ownerLabels[j]) > -1; - } - } - } - if (path[i] === POINTERSTATE.mouse.target) { - return; - } - } - // if one of the clicked labels was labelling the target element, - // this is not a ghost click - if (clickFromLabel) { - return; - } - mouseEvent.preventDefault(); - mouseEvent.stopPropagation(); - } -}; - -/** - * @param {boolean=} setup True to add, false to remove. - * @return {void} - */ -function setupTeardownMouseCanceller(setup) { - let events = IS_TOUCH_ONLY ? ['click'] : MOUSE_EVENTS; - for (let i = 0, en; i < events.length; i++) { - en = events[i]; - if (setup) { - // reset clickLabels array - clickedLabels.length = 0; - document.addEventListener(en, mouseCanceller, true); - } else { - document.removeEventListener(en, mouseCanceller, true); - } - } -} - -function ignoreMouse(e) { - if (!POINTERSTATE.mouse.mouseIgnoreJob) { - setupTeardownMouseCanceller(true); - } - let unset = function() { - setupTeardownMouseCanceller(); - POINTERSTATE.mouse.target = null; - POINTERSTATE.mouse.mouseIgnoreJob = null; - }; - POINTERSTATE.mouse.target = getComposedPath(e)[0]; - POINTERSTATE.mouse.mouseIgnoreJob = Debouncer.debounce( - POINTERSTATE.mouse.mouseIgnoreJob - , timeOut.after(MOUSE_TIMEOUT) - , unset); -} - -/** - * @param {MouseEvent} ev event to test for left mouse button down - * @return {boolean} has left mouse button down - */ -function hasLeftMouseButton(ev) { - let type = ev.type; - // exit early if the event is not a mouse event - if (!isMouseEvent(type)) { - return false; - } - // ev.button is not reliable for mousemove (0 is overloaded as both left button and no buttons) - // instead we use ev.buttons (bitmask of buttons) or fall back to ev.which (deprecated, 0 for no buttons, 1 for left button) - if (type === 'mousemove') { - // allow undefined for testing events - let buttons = ev.buttons === undefined ? 1 : ev.buttons; - if ((ev instanceof window.MouseEvent) && !MOUSE_HAS_BUTTONS) { - buttons = MOUSE_WHICH_TO_BUTTONS[ev.which] || 0; - } - // buttons is a bitmask, check that the left button bit is set (1) - return Boolean(buttons & 1); - } else { - // allow undefined for testing events - let button = ev.button === undefined ? 0 : ev.button; - // ev.button is 0 in mousedown/mouseup/click for left button activation - return button === 0; - } -} - -function isSyntheticClick(ev) { - if (ev.type === 'click') { - // ev.detail is 0 for HTMLElement.click in most browsers - if (ev.detail === 0) { - return true; - } - // in the worst case, check that the x/y position of the click is within - // the bounding box of the target of the event - // Thanks IE 10 >:( - let t = _findOriginalTarget(ev); - // make sure the target of the event is an element so we can use getBoundingClientRect, - // if not, just assume it is a synthetic click - if (!t.nodeType || /** @type {Element} */(t).nodeType !== Node.ELEMENT_NODE) { - return true; - } - let bcr = /** @type {Element} */(t).getBoundingClientRect(); - // use page x/y to account for scrolling - let x = ev.pageX, y = ev.pageY; - // ev is a synthetic click if the position is outside the bounding box of the target - return !((x >= bcr.left && x <= bcr.right) && (y >= bcr.top && y <= bcr.bottom)); - } - return false; -} - -let POINTERSTATE = { - mouse: { - target: null, - mouseIgnoreJob: null - }, - touch: { - x: 0, - y: 0, - id: -1, - scrollDecided: false - } -}; - -function firstTouchAction(ev) { - let ta = 'auto'; - let path = getComposedPath(ev); - for (let i = 0, n; i < path.length; i++) { - n = path[i]; - if (n[TOUCH_ACTION]) { - ta = n[TOUCH_ACTION]; - break; - } - } - return ta; -} - -function trackDocument(stateObj, movefn, upfn) { - stateObj.movefn = movefn; - stateObj.upfn = upfn; - document.addEventListener('mousemove', movefn); - document.addEventListener('mouseup', upfn); -} - -function untrackDocument(stateObj) { - document.removeEventListener('mousemove', stateObj.movefn); - document.removeEventListener('mouseup', stateObj.upfn); - stateObj.movefn = null; - stateObj.upfn = null; -} - -// use a document-wide touchend listener to start the ghost-click prevention mechanism -// Use passive event listeners, if supported, to not affect scrolling performance -document.addEventListener('touchend', ignoreMouse, SUPPORTS_PASSIVE ? {passive: true} : false); - -/** - * Returns the composedPath for the given event. - * @param {Event} event to process - * @return {!Array<!EventTarget>} Path of the event - */ -const getComposedPath = window.ShadyDOM && window.ShadyDOM.noPatch ? - window.ShadyDOM.composedPath : - (event) => event.composedPath && event.composedPath() || []; - -/** @type {!Object<string, !GestureRecognizer>} */ -export const gestures = {}; - -/** @type {!Array<!GestureRecognizer>} */ -export const recognizers = []; - -/** - * Finds the element rendered on the screen at the provided coordinates. - * - * Similar to `document.elementFromPoint`, but pierces through - * shadow roots. - * - * @param {number} x Horizontal pixel coordinate - * @param {number} y Vertical pixel coordinate - * @return {Element} Returns the deepest shadowRoot inclusive element - * found at the screen position given. - */ -export function deepTargetFind(x, y) { - let node = document.elementFromPoint(x, y); - let next = node; - // this code path is only taken when native ShadowDOM is used - // if there is a shadowroot, it may have a node at x/y - // if there is not a shadowroot, exit the loop - while (next && next.shadowRoot && !window.ShadyDOM) { - // if there is a node at x/y in the shadowroot, look deeper - let oldNext = next; - next = next.shadowRoot.elementFromPoint(x, y); - // on Safari, elementFromPoint may return the shadowRoot host - if (oldNext === next) { - break; - } - if (next) { - node = next; - } - } - return node; -} - -/** - * a cheaper check than ev.composedPath()[0]; - * - * @private - * @param {Event|Touch} ev Event. - * @return {EventTarget} Returns the event target. - */ -function _findOriginalTarget(ev) { - const path = getComposedPath(/** @type {?Event} */ (ev)); - // It shouldn't be, but sometimes path is empty (window on Safari). - return path.length > 0 ? path[0] : ev.target; -} - -/** - * @private - * @param {Event} ev Event. - * @return {void} - */ -function _handleNative(ev) { - let handled; - let type = ev.type; - let node = ev.currentTarget; - let gobj = node[GESTURE_KEY]; - if (!gobj) { - return; - } - let gs = gobj[type]; - if (!gs) { - return; - } - if (!ev[HANDLED_OBJ]) { - ev[HANDLED_OBJ] = {}; - if (type.slice(0, 5) === 'touch') { - ev = /** @type {TouchEvent} */(ev); // eslint-disable-line no-self-assign - let t = ev.changedTouches[0]; - if (type === 'touchstart') { - // only handle the first finger - if (ev.touches.length === 1) { - POINTERSTATE.touch.id = t.identifier; - } - } - if (POINTERSTATE.touch.id !== t.identifier) { - return; - } - if (!HAS_NATIVE_TA) { - if (type === 'touchstart' || type === 'touchmove') { - _handleTouchAction(ev); - } - } - } - } - handled = ev[HANDLED_OBJ]; - // used to ignore synthetic mouse events - if (handled.skip) { - return; - } - // reset recognizer state - for (let i = 0, r; i < recognizers.length; i++) { - r = recognizers[i]; - if (gs[r.name] && !handled[r.name]) { - if (r.flow && r.flow.start.indexOf(ev.type) > -1 && r.reset) { - r.reset(); - } - } - } - // enforce gesture recognizer order - for (let i = 0, r; i < recognizers.length; i++) { - r = recognizers[i]; - if (gs[r.name] && !handled[r.name]) { - handled[r.name] = true; - r[type](ev); - } - } -} - -/** - * @private - * @param {TouchEvent} ev Event. - * @return {void} - */ -function _handleTouchAction(ev) { - let t = ev.changedTouches[0]; - let type = ev.type; - if (type === 'touchstart') { - POINTERSTATE.touch.x = t.clientX; - POINTERSTATE.touch.y = t.clientY; - POINTERSTATE.touch.scrollDecided = false; - } else if (type === 'touchmove') { - if (POINTERSTATE.touch.scrollDecided) { - return; - } - POINTERSTATE.touch.scrollDecided = true; - let ta = firstTouchAction(ev); - let shouldPrevent = false; - let dx = Math.abs(POINTERSTATE.touch.x - t.clientX); - let dy = Math.abs(POINTERSTATE.touch.y - t.clientY); - if (!ev.cancelable) { - // scrolling is happening - } else if (ta === 'none') { - shouldPrevent = true; - } else if (ta === 'pan-x') { - shouldPrevent = dy > dx; - } else if (ta === 'pan-y') { - shouldPrevent = dx > dy; - } - if (shouldPrevent) { - ev.preventDefault(); - } else { - prevent('track'); - } - } -} - -/** - * Adds an event listener to a node for the given gesture type. - * - * @param {!EventTarget} node Node to add listener on - * @param {string} evType Gesture type: `down`, `up`, `track`, or `tap` - * @param {!function(!Event):void} handler Event listener function to call - * @return {boolean} Returns true if a gesture event listener was added. - */ -export function addListener(node, evType, handler) { - if (gestures[evType]) { - _add(node, evType, handler); - return true; - } - return false; -} - -/** - * Removes an event listener from a node for the given gesture type. - * - * @param {!EventTarget} node Node to remove listener from - * @param {string} evType Gesture type: `down`, `up`, `track`, or `tap` - * @param {!function(!Event):void} handler Event listener function previously passed to - * `addListener`. - * @return {boolean} Returns true if a gesture event listener was removed. - */ -export function removeListener(node, evType, handler) { - if (gestures[evType]) { - _remove(node, evType, handler); - return true; - } - return false; -} - -/** - * automate the event listeners for the native events - * - * @private - * @param {!EventTarget} node Node on which to add the event. - * @param {string} evType Event type to add. - * @param {function(!Event)} handler Event handler function. - * @return {void} - */ -function _add(node, evType, handler) { - let recognizer = gestures[evType]; - let deps = recognizer.deps; - let name = recognizer.name; - let gobj = node[GESTURE_KEY]; - if (!gobj) { - node[GESTURE_KEY] = gobj = {}; - } - for (let i = 0, dep, gd; i < deps.length; i++) { - dep = deps[i]; - // don't add mouse handlers on iOS because they cause gray selection overlays - if (IS_TOUCH_ONLY && isMouseEvent(dep) && dep !== 'click') { - continue; - } - gd = gobj[dep]; - if (!gd) { - gobj[dep] = gd = {_count: 0}; - } - if (gd._count === 0) { - node.addEventListener(dep, _handleNative, PASSIVE_TOUCH(dep)); - } - gd[name] = (gd[name] || 0) + 1; - gd._count = (gd._count || 0) + 1; - } - node.addEventListener(evType, handler); - if (recognizer.touchAction) { - setTouchAction(node, recognizer.touchAction); - } -} - -/** - * automate event listener removal for native events - * - * @private - * @param {!EventTarget} node Node on which to remove the event. - * @param {string} evType Event type to remove. - * @param {function(!Event): void} handler Event handler function. - * @return {void} - */ -function _remove(node, evType, handler) { - let recognizer = gestures[evType]; - let deps = recognizer.deps; - let name = recognizer.name; - let gobj = node[GESTURE_KEY]; - if (gobj) { - for (let i = 0, dep, gd; i < deps.length; i++) { - dep = deps[i]; - gd = gobj[dep]; - if (gd && gd[name]) { - gd[name] = (gd[name] || 1) - 1; - gd._count = (gd._count || 1) - 1; - if (gd._count === 0) { - node.removeEventListener(dep, _handleNative, PASSIVE_TOUCH(dep)); - } - } - } - } - node.removeEventListener(evType, handler); -} - -/** - * Registers a new gesture event recognizer for adding new custom - * gesture event types. - * - * @param {!GestureRecognizer} recog Gesture recognizer descriptor - * @return {void} - */ -export function register(recog) { - recognizers.push(recog); - for (let i = 0; i < recog.emits.length; i++) { - gestures[recog.emits[i]] = recog; - } -} - -/** - * @private - * @param {string} evName Event name. - * @return {Object} Returns the gesture for the given event name. - */ -function _findRecognizerByEvent(evName) { - for (let i = 0, r; i < recognizers.length; i++) { - r = recognizers[i]; - for (let j = 0, n; j < r.emits.length; j++) { - n = r.emits[j]; - if (n === evName) { - return r; - } - } - } - return null; -} - -/** - * Sets scrolling direction on node. - * - * This value is checked on first move, thus it should be called prior to - * adding event listeners. - * - * @param {!EventTarget} node Node to set touch action setting on - * @param {string} value Touch action value - * @return {void} - */ -export function setTouchAction(node, value) { - if (HAS_NATIVE_TA && node instanceof HTMLElement) { - // NOTE: add touchAction async so that events can be added in - // custom element constructors. Otherwise we run afoul of custom - // elements restriction against settings attributes (style) in the - // constructor. - microTask.run(() => { - node.style.touchAction = value; - }); - } - node[TOUCH_ACTION] = value; -} - -/** - * Dispatches an event on the `target` element of `type` with the given - * `detail`. - * @private - * @param {!EventTarget} target The element on which to fire an event. - * @param {string} type The type of event to fire. - * @param {!Object=} detail The detail object to populate on the event. - * @return {void} - */ -function _fire(target, type, detail) { - let ev = new Event(type, { bubbles: true, cancelable: true, composed: true }); - ev.detail = detail; - wrap(/** @type {!Node} */(target)).dispatchEvent(ev); - // forward `preventDefault` in a clean way - if (ev.defaultPrevented) { - let preventer = detail.preventer || detail.sourceEvent; - if (preventer && preventer.preventDefault) { - preventer.preventDefault(); - } - } -} - -/** - * Prevents the dispatch and default action of the given event name. - * - * @param {string} evName Event name. - * @return {void} - */ -export function prevent(evName) { - let recognizer = _findRecognizerByEvent(evName); - if (recognizer.info) { - recognizer.info.prevent = true; - } -} - -/** - * Reset the 2500ms timeout on processing mouse input after detecting touch input. - * - * Touch inputs create synthesized mouse inputs anywhere from 0 to 2000ms after the touch. - * This method should only be called during testing with simulated touch inputs. - * Calling this method in production may cause duplicate taps or other Gestures. - * - * @return {void} - */ -export function resetMouseCanceller() { - if (POINTERSTATE.mouse.mouseIgnoreJob) { - POINTERSTATE.mouse.mouseIgnoreJob.flush(); - } -} - -/* eslint-disable valid-jsdoc */ - -register({ - name: 'downup', - deps: ['mousedown', 'touchstart', 'touchend'], - flow: { - start: ['mousedown', 'touchstart'], - end: ['mouseup', 'touchend'] - }, - emits: ['down', 'up'], - - info: { - movefn: null, - upfn: null - }, - - /** - * @this {GestureRecognizer} - * @return {void} - */ - reset: function() { - untrackDocument(this.info); - }, - - /** - * @this {GestureRecognizer} - * @param {MouseEvent} e - * @return {void} - */ - mousedown: function(e) { - if (!hasLeftMouseButton(e)) { - return; - } - let t = _findOriginalTarget(e); - let self = this; - let movefn = function movefn(e) { - if (!hasLeftMouseButton(e)) { - downupFire('up', t, e); - untrackDocument(self.info); - } - }; - let upfn = function upfn(e) { - if (hasLeftMouseButton(e)) { - downupFire('up', t, e); - } - untrackDocument(self.info); - }; - trackDocument(this.info, movefn, upfn); - downupFire('down', t, e); - }, - /** - * @this {GestureRecognizer} - * @param {TouchEvent} e - * @return {void} - */ - touchstart: function(e) { - downupFire('down', _findOriginalTarget(e), e.changedTouches[0], e); - }, - /** - * @this {GestureRecognizer} - * @param {TouchEvent} e - * @return {void} - */ - touchend: function(e) { - downupFire('up', _findOriginalTarget(e), e.changedTouches[0], e); - } -}); - -/** - * @param {string} type - * @param {EventTarget} target - * @param {Event|Touch} event - * @param {Event=} preventer - * @return {void} - */ -function downupFire(type, target, event, preventer) { - if (!target) { - return; - } - _fire(target, type, { - x: event.clientX, - y: event.clientY, - sourceEvent: event, - preventer: preventer, - prevent: function(e) { - return prevent(e); - } - }); -} - -register({ - name: 'track', - touchAction: 'none', - deps: ['mousedown', 'touchstart', 'touchmove', 'touchend'], - flow: { - start: ['mousedown', 'touchstart'], - end: ['mouseup', 'touchend'] - }, - emits: ['track'], - - info: { - x: 0, - y: 0, - state: 'start', - started: false, - moves: [], - /** @this {GestureInfo} */ - addMove: function(move) { - if (this.moves.length > TRACK_LENGTH) { - this.moves.shift(); - } - this.moves.push(move); - }, - movefn: null, - upfn: null, - prevent: false - }, - - /** - * @this {GestureRecognizer} - * @return {void} - */ - reset: function() { - this.info.state = 'start'; - this.info.started = false; - this.info.moves = []; - this.info.x = 0; - this.info.y = 0; - this.info.prevent = false; - untrackDocument(this.info); - }, - - /** - * @this {GestureRecognizer} - * @param {MouseEvent} e - * @return {void} - */ - mousedown: function(e) { - if (!hasLeftMouseButton(e)) { - return; - } - let t = _findOriginalTarget(e); - let self = this; - let movefn = function movefn(e) { - let x = e.clientX, y = e.clientY; - if (trackHasMovedEnough(self.info, x, y)) { - // first move is 'start', subsequent moves are 'move', mouseup is 'end' - self.info.state = self.info.started ? (e.type === 'mouseup' ? 'end' : 'track') : 'start'; - if (self.info.state === 'start') { - // if and only if tracking, always prevent tap - prevent('tap'); - } - self.info.addMove({x: x, y: y}); - if (!hasLeftMouseButton(e)) { - // always fire "end" - self.info.state = 'end'; - untrackDocument(self.info); - } - if (t) { - trackFire(self.info, t, e); - } - self.info.started = true; - } - }; - let upfn = function upfn(e) { - if (self.info.started) { - movefn(e); - } - - // remove the temporary listeners - untrackDocument(self.info); - }; - // add temporary document listeners as mouse retargets - trackDocument(this.info, movefn, upfn); - this.info.x = e.clientX; - this.info.y = e.clientY; - }, - /** - * @this {GestureRecognizer} - * @param {TouchEvent} e - * @return {void} - */ - touchstart: function(e) { - let ct = e.changedTouches[0]; - this.info.x = ct.clientX; - this.info.y = ct.clientY; - }, - /** - * @this {GestureRecognizer} - * @param {TouchEvent} e - * @return {void} - */ - touchmove: function(e) { - let t = _findOriginalTarget(e); - let ct = e.changedTouches[0]; - let x = ct.clientX, y = ct.clientY; - if (trackHasMovedEnough(this.info, x, y)) { - if (this.info.state === 'start') { - // if and only if tracking, always prevent tap - prevent('tap'); - } - this.info.addMove({x: x, y: y}); - trackFire(this.info, t, ct); - this.info.state = 'track'; - this.info.started = true; - } - }, - /** - * @this {GestureRecognizer} - * @param {TouchEvent} e - * @return {void} - */ - touchend: function(e) { - let t = _findOriginalTarget(e); - let ct = e.changedTouches[0]; - // only trackend if track was started and not aborted - if (this.info.started) { - // reset started state on up - this.info.state = 'end'; - this.info.addMove({x: ct.clientX, y: ct.clientY}); - trackFire(this.info, t, ct); - } - } -}); - -/** - * @param {!GestureInfo} info - * @param {number} x - * @param {number} y - * @return {boolean} - */ -function trackHasMovedEnough(info, x, y) { - if (info.prevent) { - return false; - } - if (info.started) { - return true; - } - let dx = Math.abs(info.x - x); - let dy = Math.abs(info.y - y); - return (dx >= TRACK_DISTANCE || dy >= TRACK_DISTANCE); -} - -/** - * @param {!GestureInfo} info - * @param {?EventTarget} target - * @param {Touch} touch - * @return {void} - */ -function trackFire(info, target, touch) { - if (!target) { - return; - } - let secondlast = info.moves[info.moves.length - 2]; - let lastmove = info.moves[info.moves.length - 1]; - let dx = lastmove.x - info.x; - let dy = lastmove.y - info.y; - let ddx, ddy = 0; - if (secondlast) { - ddx = lastmove.x - secondlast.x; - ddy = lastmove.y - secondlast.y; - } - _fire(target, 'track', { - state: info.state, - x: touch.clientX, - y: touch.clientY, - dx: dx, - dy: dy, - ddx: ddx, - ddy: ddy, - sourceEvent: touch, - hover: function() { - return deepTargetFind(touch.clientX, touch.clientY); - } - }); -} - -register({ - name: 'tap', - deps: ['mousedown', 'click', 'touchstart', 'touchend'], - flow: { - start: ['mousedown', 'touchstart'], - end: ['click', 'touchend'] - }, - emits: ['tap'], - info: { - x: NaN, - y: NaN, - prevent: false - }, - /** - * @this {GestureRecognizer} - * @return {void} - */ - reset: function() { - this.info.x = NaN; - this.info.y = NaN; - this.info.prevent = false; - }, - /** - * @this {GestureRecognizer} - * @param {MouseEvent} e - * @return {void} - */ - mousedown: function(e) { - if (hasLeftMouseButton(e)) { - this.info.x = e.clientX; - this.info.y = e.clientY; - } - }, - /** - * @this {GestureRecognizer} - * @param {MouseEvent} e - * @return {void} - */ - click: function(e) { - if (hasLeftMouseButton(e)) { - trackForward(this.info, e); - } - }, - /** - * @this {GestureRecognizer} - * @param {TouchEvent} e - * @return {void} - */ - touchstart: function(e) { - const touch = e.changedTouches[0]; - this.info.x = touch.clientX; - this.info.y = touch.clientY; - }, - /** - * @this {GestureRecognizer} - * @param {TouchEvent} e - * @return {void} - */ - touchend: function(e) { - trackForward(this.info, e.changedTouches[0], e); - } -}); - -/** - * @param {!GestureInfo} info - * @param {Event | Touch} e - * @param {Event=} preventer - * @return {void} - */ -function trackForward(info, e, preventer) { - let dx = Math.abs(e.clientX - info.x); - let dy = Math.abs(e.clientY - info.y); - // find original target from `preventer` for TouchEvents, or `e` for MouseEvents - let t = _findOriginalTarget((preventer || e)); - if (!t || (canBeDisabled[/** @type {!HTMLElement} */(t).localName] && t.hasAttribute('disabled'))) { - return; - } - // dx,dy can be NaN if `click` has been simulated and there was no `down` for `start` - if (isNaN(dx) || isNaN(dy) || (dx <= TAP_DISTANCE && dy <= TAP_DISTANCE) || isSyntheticClick(e)) { - // prevent taps from being generated if an event has canceled them - if (!info.prevent) { - _fire(t, 'tap', { - x: e.clientX, - y: e.clientY, - sourceEvent: e, - preventer: preventer - }); - } - } -} - -/* eslint-enable valid-jsdoc */ - -/** @deprecated */ -export const findOriginalTarget = _findOriginalTarget; - -/** @deprecated */ -export const add = addListener; - -/** @deprecated */ -export const remove = removeListener; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/html-tag.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/html-tag.js deleted file mode 100644 index 3b0e3def9e8..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/html-tag.js +++ /dev/null @@ -1,128 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import './boot.js'; - -/** - * Class representing a static string value which can be used to filter - * strings by asseting that they have been created via this class. The - * `value` property returns the string passed to the constructor. - */ -class LiteralString { - constructor(string) { - /** @type {string} */ - this.value = string.toString(); - } - /** - * @return {string} LiteralString string value - * @override - */ - toString() { - return this.value; - } -} - -/** - * @param {*} value Object to stringify into HTML - * @return {string} HTML stringified form of `obj` - */ -function literalValue(value) { - if (value instanceof LiteralString) { - return /** @type {!LiteralString} */(value).value; - } else { - throw new Error( - `non-literal value passed to Polymer's htmlLiteral function: ${value}` - ); - } -} - -/** - * @param {*} value Object to stringify into HTML - * @return {string} HTML stringified form of `obj` - */ -function htmlValue(value) { - if (value instanceof HTMLTemplateElement) { - return /** @type {!HTMLTemplateElement } */(value).innerHTML; - } else if (value instanceof LiteralString) { - return literalValue(value); - } else { - throw new Error( - `non-template value passed to Polymer's html function: ${value}`); - } -} - -/** - * A template literal tag that creates an HTML <template> element from the - * contents of the string. - * - * This allows you to write a Polymer Template in JavaScript. - * - * Templates can be composed by interpolating `HTMLTemplateElement`s in - * expressions in the JavaScript template literal. The nested template's - * `innerHTML` is included in the containing template. The only other - * values allowed in expressions are those returned from `htmlLiteral` - * which ensures only literal values from JS source ever reach the HTML, to - * guard against XSS risks. - * - * All other values are disallowed in expressions to help prevent XSS - * attacks; however, `htmlLiteral` can be used to compose static - * string values into templates. This is useful to compose strings into - * places that do not accept html, like the css text of a `style` - * element. - * - * Example: - * - * static get template() { - * return html` - * <style>:host{ content:"..." }</style> - * <div class="shadowed">${this.partialTemplate}</div> - * ${super.template} - * `; - * } - * static get partialTemplate() { return html`<span>Partial!</span>`; } - * - * @param {!ITemplateArray} strings Constant parts of tagged template literal - * @param {...*} values Variable parts of tagged template literal - * @return {!HTMLTemplateElement} Constructed HTMLTemplateElement - */ -export const html = function html(strings, ...values) { - const template = /** @type {!HTMLTemplateElement} */(document.createElement('template')); - template.innerHTML = values.reduce((acc, v, idx) => - acc + htmlValue(v) + strings[idx + 1], strings[0]); - return template; -}; - -/** - * An html literal tag that can be used with `html` to compose. - * a literal string. - * - * Example: - * - * static get template() { - * return html` - * <style> - * :host { display: block; } - * ${this.styleTemplate()} - * </style> - * <div class="shadowed">${staticValue}</div> - * ${super.template} - * `; - * } - * static get styleTemplate() { - * return htmlLiteral`.shadowed { background: gray; }`; - * } - * - * @param {!ITemplateArray} strings Constant parts of tagged template literal - * @param {...*} values Variable parts of tagged template literal - * @return {!LiteralString} Constructed literal string - */ -export const htmlLiteral = function(strings, ...values) { - return new LiteralString(values.reduce((acc, v, idx) => - acc + literalValue(v) + strings[idx + 1], strings[0])); -}; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/mixin.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/mixin.js deleted file mode 100644 index b79c7f9a207..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/mixin.js +++ /dev/null @@ -1,67 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import './boot.js'; - -// unique global id for deduping mixins. -let dedupeId = 0; - -/** - * @constructor - * @extends {Function} - * @private - */ -function MixinFunction(){} -/** @type {(WeakMap | undefined)} */ -MixinFunction.prototype.__mixinApplications; -/** @type {(Object | undefined)} */ -MixinFunction.prototype.__mixinSet; - -/* eslint-disable valid-jsdoc */ -/** - * Wraps an ES6 class expression mixin such that the mixin is only applied - * if it has not already been applied its base argument. Also memoizes mixin - * applications. - * - * @template T - * @param {T} mixin ES6 class expression mixin to wrap - * @return {T} - * @suppress {invalidCasts} - */ -export const dedupingMixin = function(mixin) { - let mixinApplications = /** @type {!MixinFunction} */(mixin).__mixinApplications; - if (!mixinApplications) { - mixinApplications = new WeakMap(); - /** @type {!MixinFunction} */(mixin).__mixinApplications = mixinApplications; - } - // maintain a unique id for each mixin - let mixinDedupeId = dedupeId++; - function dedupingMixin(base) { - let baseSet = /** @type {!MixinFunction} */(base).__mixinSet; - if (baseSet && baseSet[mixinDedupeId]) { - return base; - } - let map = mixinApplications; - let extended = map.get(base); - if (!extended) { - extended = /** @type {!Function} */(mixin)(base); - map.set(base, extended); - } - // copy inherited mixin set from the extended class, or the base class - // NOTE: we avoid use of Set here because some browser (IE11) - // cannot extend a base Set via the constructor. - let mixinSet = Object.create(/** @type {!MixinFunction} */(extended).__mixinSet || baseSet || null); - mixinSet[mixinDedupeId] = true; - /** @type {!MixinFunction} */(extended).__mixinSet = mixinSet; - return extended; - } - - return dedupingMixin; -}; -/* eslint-enable valid-jsdoc */ diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/path.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/path.js deleted file mode 100644 index 52fda93c458..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/path.js +++ /dev/null @@ -1,255 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import './boot.js'; - -/** - * Module with utilities for manipulating structured data path strings. - * - * @summary Module with utilities for manipulating structured data path strings. - */ - -/** - * Returns true if the given string is a structured data path (has dots). - * - * Example: - * - * ``` - * isPath('foo.bar.baz') // true - * isPath('foo') // false - * ``` - * - * @param {string} path Path string - * @return {boolean} True if the string contained one or more dots - */ -export function isPath(path) { - return path.indexOf('.') >= 0; -} - -/** - * Returns the root property name for the given path. - * - * Example: - * - * ``` - * root('foo.bar.baz') // 'foo' - * root('foo') // 'foo' - * ``` - * - * @param {string} path Path string - * @return {string} Root property name - */ -export function root(path) { - let dotIndex = path.indexOf('.'); - if (dotIndex === -1) { - return path; - } - return path.slice(0, dotIndex); -} - -/** - * Given `base` is `foo.bar`, `foo` is an ancestor, `foo.bar` is not - * Returns true if the given path is an ancestor of the base path. - * - * Example: - * - * ``` - * isAncestor('foo.bar', 'foo') // true - * isAncestor('foo.bar', 'foo.bar') // false - * isAncestor('foo.bar', 'foo.bar.baz') // false - * ``` - * - * @param {string} base Path string to test against. - * @param {string} path Path string to test. - * @return {boolean} True if `path` is an ancestor of `base`. - */ -export function isAncestor(base, path) { - // base.startsWith(path + '.'); - return base.indexOf(path + '.') === 0; -} - -/** - * Given `base` is `foo.bar`, `foo.bar.baz` is an descendant - * - * Example: - * - * ``` - * isDescendant('foo.bar', 'foo.bar.baz') // true - * isDescendant('foo.bar', 'foo.bar') // false - * isDescendant('foo.bar', 'foo') // false - * ``` - * - * @param {string} base Path string to test against. - * @param {string} path Path string to test. - * @return {boolean} True if `path` is a descendant of `base`. - */ -export function isDescendant(base, path) { - // path.startsWith(base + '.'); - return path.indexOf(base + '.') === 0; -} - -/** - * Replaces a previous base path with a new base path, preserving the - * remainder of the path. - * - * User must ensure `path` has a prefix of `base`. - * - * Example: - * - * ``` - * translate('foo.bar', 'zot', 'foo.bar.baz') // 'zot.baz' - * ``` - * - * @param {string} base Current base string to remove - * @param {string} newBase New base string to replace with - * @param {string} path Path to translate - * @return {string} Translated string - */ -export function translate(base, newBase, path) { - return newBase + path.slice(base.length); -} - -/** - * @param {string} base Path string to test against - * @param {string} path Path string to test - * @return {boolean} True if `path` is equal to `base` - */ -export function matches(base, path) { - return (base === path) || - isAncestor(base, path) || - isDescendant(base, path); -} - -/** - * Converts array-based paths to flattened path. String-based paths - * are returned as-is. - * - * Example: - * - * ``` - * normalize(['foo.bar', 0, 'baz']) // 'foo.bar.0.baz' - * normalize('foo.bar.0.baz') // 'foo.bar.0.baz' - * ``` - * - * @param {string | !Array<string|number>} path Input path - * @return {string} Flattened path - */ -export function normalize(path) { - if (Array.isArray(path)) { - let parts = []; - for (let i=0; i<path.length; i++) { - let args = path[i].toString().split('.'); - for (let j=0; j<args.length; j++) { - parts.push(args[j]); - } - } - return parts.join('.'); - } else { - return path; - } -} - -/** - * Splits a path into an array of property names. Accepts either arrays - * of path parts or strings. - * - * Example: - * - * ``` - * split(['foo.bar', 0, 'baz']) // ['foo', 'bar', '0', 'baz'] - * split('foo.bar.0.baz') // ['foo', 'bar', '0', 'baz'] - * ``` - * - * @param {string | !Array<string|number>} path Input path - * @return {!Array<string>} Array of path parts - * @suppress {checkTypes} - */ -export function split(path) { - if (Array.isArray(path)) { - return normalize(path).split('.'); - } - return path.toString().split('.'); -} - -/** - * Reads a value from a path. If any sub-property in the path is `undefined`, - * this method returns `undefined` (will never throw. - * - * @param {Object} root Object from which to dereference path from - * @param {string | !Array<string|number>} path Path to read - * @param {Object=} info If an object is provided to `info`, the normalized - * (flattened) path will be set to `info.path`. - * @return {*} Value at path, or `undefined` if the path could not be - * fully dereferenced. - */ -export function get(root, path, info) { - let prop = root; - let parts = split(path); - // Loop over path parts[0..n-1] and dereference - for (let i=0; i<parts.length; i++) { - if (!prop) { - return; - } - let part = parts[i]; - prop = prop[part]; - } - if (info) { - info.path = parts.join('.'); - } - return prop; -} - -/** - * Sets a value to a path. If any sub-property in the path is `undefined`, - * this method will no-op. - * - * @param {Object} root Object from which to dereference path from - * @param {string | !Array<string|number>} path Path to set - * @param {*} value Value to set to path - * @return {string | undefined} The normalized version of the input path - */ -export function set(root, path, value) { - let prop = root; - let parts = split(path); - let last = parts[parts.length-1]; - if (parts.length > 1) { - // Loop over path parts[0..n-2] and dereference - for (let i=0; i<parts.length-1; i++) { - let part = parts[i]; - prop = prop[part]; - if (!prop) { - return; - } - } - // Set value to object at end of path - prop[last] = value; - } else { - // Simple property set - prop[path] = value; - } - return parts.join('.'); -} - -/** - * Returns true if the given string is a structured data path (has dots). - * - * This function is deprecated. Use `isPath` instead. - * - * Example: - * - * ``` - * isDeep('foo.bar.baz') // true - * isDeep('foo') // false - * ``` - * - * @deprecated - * @param {string} path Path string - * @return {boolean} True if the string contained one or more dots - */ -export const isDeep = isPath; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/render-status.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/render-status.js deleted file mode 100644 index 0132699a6ca..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/render-status.js +++ /dev/null @@ -1,118 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ - -/** - * Module for scheduling flushable pre-render and post-render tasks. - * - * @summary Module for scheduling flushable pre-render and post-render tasks. - */ - -import './boot.js'; - -let scheduled = false; -let beforeRenderQueue = []; -let afterRenderQueue = []; - -function schedule() { - scheduled = true; - // before next render - requestAnimationFrame(function() { - scheduled = false; - flushQueue(beforeRenderQueue); - // after the render - setTimeout(function() { - runQueue(afterRenderQueue); - }); - }); -} - -function flushQueue(queue) { - while (queue.length) { - callMethod(queue.shift()); - } -} - -function runQueue(queue) { - for (let i=0, l=queue.length; i < l; i++) { - callMethod(queue.shift()); - } -} - -function callMethod(info) { - const context = info[0]; - const callback = info[1]; - const args = info[2]; - try { - callback.apply(context, args); - } catch(e) { - setTimeout(() => { - throw e; - }); - } -} - -/** - * Flushes all `beforeNextRender` tasks, followed by all `afterNextRender` - * tasks. - * - * @return {void} - */ -export function flush() { - while (beforeRenderQueue.length || afterRenderQueue.length) { - flushQueue(beforeRenderQueue); - flushQueue(afterRenderQueue); - } - scheduled = false; -} - - -/** - * Enqueues a callback which will be run before the next render, at - * `requestAnimationFrame` timing. - * - * This method is useful for enqueuing work that requires DOM measurement, - * since measurement may not be reliable in custom element callbacks before - * the first render, as well as for batching measurement tasks in general. - * - * Tasks in this queue may be flushed by calling `flush()`. - * - * @param {*} context Context object the callback function will be bound to - * @param {function(...*):void} callback Callback function - * @param {!Array=} args An array of arguments to call the callback function with - * @return {void} - */ -export function beforeNextRender(context, callback, args) { - if (!scheduled) { - schedule(); - } - beforeRenderQueue.push([context, callback, args]); -} - -/** - * Enqueues a callback which will be run after the next render, equivalent - * to one task (`setTimeout`) after the next `requestAnimationFrame`. - * - * This method is useful for tuning the first-render performance of an - * element or application by deferring non-critical work until after the - * first paint. Typical non-render-critical work may include adding UI - * event listeners and aria attributes. - * - * @param {*} context Context object the callback function will be bound to - * @param {function(...*):void} callback Callback function - * @param {!Array=} args An array of arguments to call the callback function with - * @return {void} - */ -export function afterNextRender(context, callback, args) { - if (!scheduled) { - schedule(); - } - afterRenderQueue.push([context, callback, args]); -} - diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/resolve-url.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/resolve-url.js deleted file mode 100644 index 06b2292e124..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/resolve-url.js +++ /dev/null @@ -1,87 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import './boot.js'; - -let CSS_URL_RX = /(url\()([^)]*)(\))/g; -let ABS_URL = /(^\/)|(^#)|(^[\w-\d]*:)/; -let workingURL; -let resolveDoc; -/** - * Resolves the given URL against the provided `baseUri'. - * - * Note that this function performs no resolution for URLs that start - * with `/` (absolute URLs) or `#` (hash identifiers). For general purpose - * URL resolution, use `window.URL`. - * - * @param {string} url Input URL to resolve - * @param {?string=} baseURI Base URI to resolve the URL against - * @return {string} resolved URL - */ -export function resolveUrl(url, baseURI) { - if (url && ABS_URL.test(url)) { - return url; - } - // Lazy feature detection. - if (workingURL === undefined) { - workingURL = false; - try { - const u = new URL('b', 'http://a'); - u.pathname = 'c%20d'; - workingURL = (u.href === 'http://a/c%20d'); - } catch (e) { - // silently fail - } - } - if (!baseURI) { - baseURI = document.baseURI || window.location.href; - } - if (workingURL) { - return (new URL(url, baseURI)).href; - } - // Fallback to creating an anchor into a disconnected document. - if (!resolveDoc) { - resolveDoc = document.implementation.createHTMLDocument('temp'); - resolveDoc.base = resolveDoc.createElement('base'); - resolveDoc.head.appendChild(resolveDoc.base); - resolveDoc.anchor = resolveDoc.createElement('a'); - resolveDoc.body.appendChild(resolveDoc.anchor); - } - resolveDoc.base.href = baseURI; - resolveDoc.anchor.href = url; - return resolveDoc.anchor.href || url; - -} - -/** - * Resolves any relative URL's in the given CSS text against the provided - * `ownerDocument`'s `baseURI`. - * - * @param {string} cssText CSS text to process - * @param {string} baseURI Base URI to resolve the URL against - * @return {string} Processed CSS text with resolved URL's - */ -export function resolveCss(cssText, baseURI) { - return cssText.replace(CSS_URL_RX, function(m, pre, url, post) { - return pre + '\'' + - resolveUrl(url.replace(/["']/g, ''), baseURI) + - '\'' + post; - }); -} - -/** - * Returns a path from a given `url`. The path includes the trailing - * `/` from the url. - * - * @param {string} url Input URL to transform - * @return {string} resolved path - */ -export function pathFromUrl(url) { - return url.substring(0, url.lastIndexOf('/') + 1); -} diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/settings.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/settings.js deleted file mode 100644 index 6b878c4ed16..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/settings.js +++ /dev/null @@ -1,160 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ -import './boot.js'; - -import { pathFromUrl } from './resolve-url.js'; -export const useShadow = !(window.ShadyDOM); -export const useNativeCSSProperties = Boolean(!window.ShadyCSS || window.ShadyCSS.nativeCss); -export const useNativeCustomElements = !(window.customElements.polyfillWrapFlushCallback); - - -/** - * Globally settable property that is automatically assigned to - * `ElementMixin` instances, useful for binding in templates to - * make URL's relative to an application's root. Defaults to the main - * document URL, but can be overridden by users. It may be useful to set - * `rootPath` to provide a stable application mount path when - * using client side routing. - */ -export let rootPath = pathFromUrl(document.baseURI || window.location.href); - -/** - * Sets the global rootPath property used by `ElementMixin` and - * available via `rootPath`. - * - * @param {string} path The new root path - * @return {void} - */ -export const setRootPath = function(path) { - rootPath = path; -}; - -/** - * A global callback used to sanitize any value before inserting it into the DOM. - * The callback signature is: - * - * function sanitizeDOMValue(value, name, type, node) { ... } - * - * Where: - * - * `value` is the value to sanitize. - * `name` is the name of an attribute or property (for example, href). - * `type` indicates where the value is being inserted: one of property, attribute, or text. - * `node` is the node where the value is being inserted. - * - * @type {(function(*,string,string,Node):*)|undefined} - */ -export let sanitizeDOMValue = window.Polymer && window.Polymer.sanitizeDOMValue || undefined; - -/** - * Sets the global sanitizeDOMValue available via this module's exported - * `sanitizeDOMValue` variable. - * - * @param {(function(*,string,string,Node):*)|undefined} newSanitizeDOMValue the global sanitizeDOMValue callback - * @return {void} - */ -export const setSanitizeDOMValue = function(newSanitizeDOMValue) { - sanitizeDOMValue = newSanitizeDOMValue; -}; - -/** - * Globally settable property to make Polymer Gestures use passive TouchEvent listeners when recognizing gestures. - * When set to `true`, gestures made from touch will not be able to prevent scrolling, allowing for smoother - * scrolling performance. - * Defaults to `false` for backwards compatibility. - */ -export let passiveTouchGestures = false; - -/** - * Sets `passiveTouchGestures` globally for all elements using Polymer Gestures. - * - * @param {boolean} usePassive enable or disable passive touch gestures globally - * @return {void} - */ -export const setPassiveTouchGestures = function(usePassive) { - passiveTouchGestures = usePassive; -}; - -/** - * Setting to ensure Polymer template evaluation only occurs based on tempates - * defined in trusted script. When true, `<dom-module>` re-registration is - * disallowed, `<dom-bind>` is disabled, and `<dom-if>`/`<dom-repeat>` - * templates will only evaluate in the context of a trusted element template. - */ -export let strictTemplatePolicy = false; - -/** - * Sets `strictTemplatePolicy` globally for all elements - * - * @param {boolean} useStrictPolicy enable or disable strict template policy - * globally - * @return {void} - */ -export const setStrictTemplatePolicy = function(useStrictPolicy) { - strictTemplatePolicy = useStrictPolicy; -}; - -/** - * Setting to enable dom-module lookup from Polymer.Element. By default, - * templates must be defined in script using the `static get template()` - * getter and the `html` tag function. To enable legacy loading of templates - * via dom-module, set this flag to true. - */ -export let allowTemplateFromDomModule = false; - -/** - * Sets `lookupTemplateFromDomModule` globally for all elements - * - * @param {boolean} allowDomModule enable or disable template lookup - * globally - * @return {void} - */ -export const setAllowTemplateFromDomModule = function(allowDomModule) { - allowTemplateFromDomModule = allowDomModule; -}; - -/** - * Setting to skip processing style includes and re-writing urls in css styles. - * Normally "included" styles are pulled into the element and all urls in styles - * are re-written to be relative to the containing script url. - * If no includes or relative urls are used in styles, these steps can be - * skipped as an optimization. - */ -export let legacyOptimizations = false; - -/** - * Sets `legacyOptimizations` globally for all elements to enable optimizations - * when only legacy based elements are used. - * - * @param {boolean} useLegacyOptimizations enable or disable legacy optimizations - * includes and url rewriting - * @return {void} - */ -export const setLegacyOptimizations = function(useLegacyOptimizations) { - legacyOptimizations = useLegacyOptimizations; -}; - -/** - * Setting to perform initial rendering synchronously when running under ShadyDOM. - * This matches the behavior of Polymer 1. - */ -export let syncInitialRender = false; - -/** - * Sets `syncInitialRender` globally for all elements to enable synchronous - * initial rendering. - * - * @param {boolean} useSyncInitialRender enable or disable synchronous initial - * rendering globally. - * @return {void} - */ -export const setSyncInitialRender = function(useSyncInitialRender) { - syncInitialRender = useSyncInitialRender; -}; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/style-gather.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/style-gather.js deleted file mode 100644 index b67fcafd904..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/style-gather.js +++ /dev/null @@ -1,274 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ - -/** - * Module with utilities for collection CSS text from `<templates>`, external - * stylesheets, and `dom-module`s. - * - * @summary Module with utilities for collection CSS text from various sources. - */ - -import { DomModule } from '../elements/dom-module.js'; -import { resolveCss } from './resolve-url.js'; - -const MODULE_STYLE_LINK_SELECTOR = 'link[rel=import][type~=css]'; -const INCLUDE_ATTR = 'include'; -const SHADY_UNSCOPED_ATTR = 'shady-unscoped'; - -/** - * @param {string} moduleId . - * @return {?DomModule} . - */ -function importModule(moduleId) { - return /** @type {?DomModule} */(DomModule.import(moduleId)); -} - -function styleForImport(importDoc) { - // NOTE: polyfill affordance. - // under the HTMLImports polyfill, there will be no 'body', - // but the import pseudo-doc can be used directly. - let container = importDoc.body ? importDoc.body : importDoc; - const importCss = resolveCss(container.textContent, - importDoc.baseURI); - const style = document.createElement('style'); - style.textContent = importCss; - return style; -} - -/** @typedef {{assetpath: string}} */ -let templateWithAssetPath; // eslint-disable-line no-unused-vars - - -/** - * Returns a list of <style> elements in a space-separated list of `dom-module`s. - * - * @function - * @param {string} moduleIds List of dom-module id's within which to - * search for css. - * @return {!Array<!HTMLStyleElement>} Array of contained <style> elements - */ -export function stylesFromModules(moduleIds) { - const modules = moduleIds.trim().split(/\s+/); - const styles = []; - for (let i=0; i < modules.length; i++) { - styles.push(...stylesFromModule(modules[i])); - } - return styles; -} - -/** - * Returns a list of <style> elements in a given `dom-module`. - * Styles in a `dom-module` can come either from `<style>`s within the - * first `<template>`, or else from one or more - * `<link rel="import" type="css">` links outside the template. - * - * @param {string} moduleId dom-module id to gather styles from - * @return {!Array<!HTMLStyleElement>} Array of contained styles. - */ -export function stylesFromModule(moduleId) { - const m = importModule(moduleId); - - if (!m) { - console.warn('Could not find style data in module named', moduleId); - return []; - } - - if (m._styles === undefined) { - const styles = []; - // module imports: <link rel="import" type="css"> - styles.push(..._stylesFromModuleImports(m)); - // include css from the first template in the module - const template = /** @type {?HTMLTemplateElement} */( - m.querySelector('template')); - if (template) { - styles.push(...stylesFromTemplate(template, - /** @type {templateWithAssetPath} */(m).assetpath)); - } - - m._styles = styles; - } - - return m._styles; -} - -/** - * Returns the `<style>` elements within a given template. - * - * @param {!HTMLTemplateElement} template Template to gather styles from - * @param {string=} baseURI baseURI for style content - * @return {!Array<!HTMLStyleElement>} Array of styles - */ -export function stylesFromTemplate(template, baseURI) { - if (!template._styles) { - const styles = []; - // if element is a template, get content from its .content - const e$ = template.content.querySelectorAll('style'); - for (let i=0; i < e$.length; i++) { - let e = e$[i]; - // support style sharing by allowing styles to "include" - // other dom-modules that contain styling - let include = e.getAttribute(INCLUDE_ATTR); - if (include) { - styles.push(...stylesFromModules(include).filter(function(item, index, self) { - return self.indexOf(item) === index; - })); - } - if (baseURI) { - e.textContent = - resolveCss(e.textContent, /** @type {string} */ (baseURI)); - } - styles.push(e); - } - template._styles = styles; - } - return template._styles; -} - -/** - * Returns a list of <style> elements from stylesheets loaded via `<link rel="import" type="css">` links within the specified `dom-module`. - * - * @param {string} moduleId Id of `dom-module` to gather CSS from - * @return {!Array<!HTMLStyleElement>} Array of contained styles. - */ -export function stylesFromModuleImports(moduleId) { - let m = importModule(moduleId); - return m ? _stylesFromModuleImports(m) : []; -} - -/** - * @param {!HTMLElement} module dom-module element that could contain `<link rel="import" type="css">` styles - * @return {!Array<!HTMLStyleElement>} Array of contained styles - */ -function _stylesFromModuleImports(module) { - const styles = []; - const p$ = module.querySelectorAll(MODULE_STYLE_LINK_SELECTOR); - for (let i=0; i < p$.length; i++) { - let p = p$[i]; - if (p.import) { - const importDoc = p.import; - const unscoped = p.hasAttribute(SHADY_UNSCOPED_ATTR); - if (unscoped && !importDoc._unscopedStyle) { - const style = styleForImport(importDoc); - style.setAttribute(SHADY_UNSCOPED_ATTR, ''); - importDoc._unscopedStyle = style; - } else if (!importDoc._style) { - importDoc._style = styleForImport(importDoc); - } - styles.push(unscoped ? importDoc._unscopedStyle : importDoc._style); - } - } - return styles; -} - -/** - * - * Returns CSS text of styles in a space-separated list of `dom-module`s. - * Note: This method is deprecated, use `stylesFromModules` instead. - * - * @deprecated - * @param {string} moduleIds List of dom-module id's within which to - * search for css. - * @return {string} Concatenated CSS content from specified `dom-module`s - */ -export function cssFromModules(moduleIds) { - let modules = moduleIds.trim().split(/\s+/); - let cssText = ''; - for (let i=0; i < modules.length; i++) { - cssText += cssFromModule(modules[i]); - } - return cssText; -} - -/** - * Returns CSS text of styles in a given `dom-module`. CSS in a `dom-module` - * can come either from `<style>`s within the first `<template>`, or else - * from one or more `<link rel="import" type="css">` links outside the - * template. - * - * Any `<styles>` processed are removed from their original location. - * Note: This method is deprecated, use `styleFromModule` instead. - * - * @deprecated - * @param {string} moduleId dom-module id to gather styles from - * @return {string} Concatenated CSS content from specified `dom-module` - */ -export function cssFromModule(moduleId) { - let m = importModule(moduleId); - if (m && m._cssText === undefined) { - // module imports: <link rel="import" type="css"> - let cssText = _cssFromModuleImports(m); - // include css from the first template in the module - let t = /** @type {?HTMLTemplateElement} */(m.querySelector('template')); - if (t) { - cssText += cssFromTemplate(t, - /** @type {templateWithAssetPath} */(m).assetpath); - } - m._cssText = cssText || null; - } - if (!m) { - console.warn('Could not find style data in module named', moduleId); - } - return m && m._cssText || ''; -} - -/** - * Returns CSS text of `<styles>` within a given template. - * - * Any `<styles>` processed are removed from their original location. - * Note: This method is deprecated, use `styleFromTemplate` instead. - * - * @deprecated - * @param {!HTMLTemplateElement} template Template to gather styles from - * @param {string} baseURI Base URI to resolve the URL against - * @return {string} Concatenated CSS content from specified template - */ -export function cssFromTemplate(template, baseURI) { - let cssText = ''; - const e$ = stylesFromTemplate(template, baseURI); - // if element is a template, get content from its .content - for (let i=0; i < e$.length; i++) { - let e = e$[i]; - if (e.parentNode) { - e.parentNode.removeChild(e); - } - cssText += e.textContent; - } - return cssText; -} - -/** - * Returns CSS text from stylesheets loaded via `<link rel="import" type="css">` - * links within the specified `dom-module`. - * - * Note: This method is deprecated, use `stylesFromModuleImports` instead. - * - * @deprecated - * - * @param {string} moduleId Id of `dom-module` to gather CSS from - * @return {string} Concatenated CSS content from links in specified `dom-module` - */ -export function cssFromModuleImports(moduleId) { - let m = importModule(moduleId); - return m ? _cssFromModuleImports(m) : ''; -} - -/** - * @deprecated - * @param {!HTMLElement} module dom-module element that could contain `<link rel="import" type="css">` styles - * @return {string} Concatenated CSS content from links in the dom-module - */ -function _cssFromModuleImports(module) { - let cssText = ''; - let styles = _stylesFromModuleImports(module); - for (let i=0; i < styles.length; i++) { - cssText += styles[i].textContent; - } - return cssText; -} diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/telemetry.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/telemetry.js deleted file mode 100644 index 5e12c3e5fb7..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/telemetry.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ - -/** - * Total number of Polymer element instances created. - * @type {number} - */ -export let instanceCount = 0; - -export function incrementInstanceCount() { - instanceCount++; -} - -/** - * Array of Polymer element classes that have been finalized. - * @type {!Array<!PolymerElementConstructor>} - */ -export const registrations = []; - -/** - * @param {!PolymerElementConstructor} prototype Element prototype to log - * @private - */ -function _regLog(prototype) { - console.log('[' + /** @type {?} */(prototype).is + ']: registered'); -} - -/** - * Registers a class prototype for telemetry purposes. - * @param {!PolymerElementConstructor} prototype Element prototype to register - * @protected - */ -export function register(prototype) { - registrations.push(prototype); -} - -/** - * Logs all elements registered with an `is` to the console. - * @public - */ -export function dumpRegistrations() { - registrations.forEach(_regLog); -}
\ No newline at end of file diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/templatize.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/templatize.js deleted file mode 100644 index 9f051354702..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/templatize.js +++ /dev/null @@ -1,610 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ - -/** - * Module for preparing and stamping instances of templates that utilize - * Polymer's data-binding and declarative event listener features. - * - * Example: - * - * // Get a template from somewhere, e.g. light DOM - * let template = this.querySelector('template'); - * // Prepare the template - * let TemplateClass = Templatize.templatize(template); - * // Instance the template with an initial data model - * let instance = new TemplateClass({myProp: 'initial'}); - * // Insert the instance's DOM somewhere, e.g. element's shadow DOM - * this.shadowRoot.appendChild(instance.root); - * // Changing a property on the instance will propagate to bindings - * // in the template - * instance.myProp = 'new value'; - * - * The `options` dictionary passed to `templatize` allows for customizing - * features of the generated template class, including how outer-scope host - * properties should be forwarded into template instances, how any instance - * properties added into the template's scope should be notified out to - * the host, and whether the instance should be decorated as a "parent model" - * of any event handlers. - * - * // Customize property forwarding and event model decoration - * let TemplateClass = Templatize.templatize(template, this, { - * parentModel: true, - * forwardHostProp(property, value) {...}, - * instanceProps: {...}, - * notifyInstanceProp(instance, property, value) {...}, - * }); - * - * @summary Module for preparing and stamping instances of templates - * utilizing Polymer templating features. - */ - -import './boot.js'; - -import { PropertyEffects } from '../mixins/property-effects.js'; -import { MutableData } from '../mixins/mutable-data.js'; -import { strictTemplatePolicy } from './settings.js'; -import { wrap } from './wrap.js'; - -// Base class for HTMLTemplateElement extension that has property effects -// machinery for propagating host properties to children. This is an ES5 -// class only because Babel (incorrectly) requires super() in the class -// constructor even though no `this` is used and it returns an instance. -let newInstance = null; - -/** - * @constructor - * @extends {HTMLTemplateElement} - * @private - */ -function HTMLTemplateElementExtension() { return newInstance; } -HTMLTemplateElementExtension.prototype = Object.create(HTMLTemplateElement.prototype, { - constructor: { - value: HTMLTemplateElementExtension, - writable: true - } -}); - -/** - * @constructor - * @implements {Polymer_PropertyEffects} - * @extends {HTMLTemplateElementExtension} - * @private - */ -const DataTemplate = PropertyEffects(HTMLTemplateElementExtension); - -/** - * @constructor - * @implements {Polymer_MutableData} - * @extends {DataTemplate} - * @private - */ -const MutableDataTemplate = MutableData(DataTemplate); - -// Applies a DataTemplate subclass to a <template> instance -function upgradeTemplate(template, constructor) { - newInstance = template; - Object.setPrototypeOf(template, constructor.prototype); - new constructor(); - newInstance = null; -} - -/** - * Base class for TemplateInstance. - * @constructor - * @implements {Polymer_PropertyEffects} - * @private - */ -const templateInstanceBase = PropertyEffects(class {}); - -/** - * @polymer - * @customElement - * @appliesMixin PropertyEffects - * @unrestricted - */ -class TemplateInstanceBase extends templateInstanceBase { - constructor(props) { - super(); - this._configureProperties(props); - /** @type {!StampedTemplate} */ - this.root = this._stampTemplate(this.__dataHost); - // Save list of stamped children - let children = this.children = []; - // Polymer 1.x did not use `Polymer.dom` here so not bothering. - for (let n = this.root.firstChild; n; n=n.nextSibling) { - children.push(n); - n.__templatizeInstance = this; - } - if (this.__templatizeOwner && - this.__templatizeOwner.__hideTemplateChildren__) { - this._showHideChildren(true); - } - // Flush props only when props are passed if instance props exist - // or when there isn't instance props. - let options = this.__templatizeOptions; - if ((props && options.instanceProps) || !options.instanceProps) { - this._enableProperties(); - } - } - /** - * Configure the given `props` by calling `_setPendingProperty`. Also - * sets any properties stored in `__hostProps`. - * @private - * @param {Object} props Object of property name-value pairs to set. - * @return {void} - */ - _configureProperties(props) { - let options = this.__templatizeOptions; - if (options.forwardHostProp) { - for (let hprop in this.__hostProps) { - this._setPendingProperty(hprop, this.__dataHost['_host_' + hprop]); - } - } - // Any instance props passed in the constructor will overwrite host props; - // normally this would be a user error but we don't specifically filter them - for (let iprop in props) { - this._setPendingProperty(iprop, props[iprop]); - } - } - /** - * Forwards a host property to this instance. This method should be - * called on instances from the `options.forwardHostProp` callback - * to propagate changes of host properties to each instance. - * - * Note this method enqueues the change, which are flushed as a batch. - * - * @param {string} prop Property or path name - * @param {*} value Value of the property to forward - * @return {void} - */ - forwardHostProp(prop, value) { - if (this._setPendingPropertyOrPath(prop, value, false, true)) { - this.__dataHost._enqueueClient(this); - } - } - - /** - * Override point for adding custom or simulated event handling. - * - * @override - * @param {!Node} node Node to add event listener to - * @param {string} eventName Name of event - * @param {function(!Event):void} handler Listener function to add - * @return {void} - */ - _addEventListenerToNode(node, eventName, handler) { - if (this._methodHost && this.__templatizeOptions.parentModel) { - // If this instance should be considered a parent model, decorate - // events this template instance as `model` - this._methodHost._addEventListenerToNode(node, eventName, (e) => { - e.model = this; - handler(e); - }); - } else { - // Otherwise delegate to the template's host (which could be) - // another template instance - let templateHost = this.__dataHost.__dataHost; - if (templateHost) { - templateHost._addEventListenerToNode(node, eventName, handler); - } - } - } - /** - * Shows or hides the template instance top level child elements. For - * text nodes, `textContent` is removed while "hidden" and replaced when - * "shown." - * @param {boolean} hide Set to true to hide the children; - * set to false to show them. - * @return {void} - * @protected - */ - _showHideChildren(hide) { - let c = this.children; - for (let i=0; i<c.length; i++) { - let n = c[i]; - // Ignore non-changes - if (Boolean(hide) != Boolean(n.__hideTemplateChildren__)) { - if (n.nodeType === Node.TEXT_NODE) { - if (hide) { - n.__polymerTextContent__ = n.textContent; - n.textContent = ''; - } else { - n.textContent = n.__polymerTextContent__; - } - // remove and replace slot - } else if (n.localName === 'slot') { - if (hide) { - n.__polymerReplaced__ = document.createComment('hidden-slot'); - wrap(wrap(n).parentNode).replaceChild(n.__polymerReplaced__, n); - } else { - const replace = n.__polymerReplaced__; - if (replace) { - wrap(wrap(replace).parentNode).replaceChild(n, replace); - } - } - } - - else if (n.style) { - if (hide) { - n.__polymerDisplay__ = n.style.display; - n.style.display = 'none'; - } else { - n.style.display = n.__polymerDisplay__; - } - } - } - n.__hideTemplateChildren__ = hide; - if (n._showHideChildren) { - n._showHideChildren(hide); - } - } - } - /** - * Overrides default property-effects implementation to intercept - * textContent bindings while children are "hidden" and cache in - * private storage for later retrieval. - * - * @override - * @param {!Node} node The node to set a property on - * @param {string} prop The property to set - * @param {*} value The value to set - * @return {void} - * @protected - */ - _setUnmanagedPropertyToNode(node, prop, value) { - if (node.__hideTemplateChildren__ && - node.nodeType == Node.TEXT_NODE && prop == 'textContent') { - node.__polymerTextContent__ = value; - } else { - super._setUnmanagedPropertyToNode(node, prop, value); - } - } - /** - * Find the parent model of this template instance. The parent model - * is either another templatize instance that had option `parentModel: true`, - * or else the host element. - * - * @return {!Polymer_PropertyEffects} The parent model of this instance - */ - get parentModel() { - let model = this.__parentModel; - if (!model) { - let options; - model = this; - do { - // A template instance's `__dataHost` is a <template> - // `model.__dataHost.__dataHost` is the template's host - model = model.__dataHost.__dataHost; - } while ((options = model.__templatizeOptions) && !options.parentModel); - this.__parentModel = model; - } - return model; - } - - /** - * Stub of HTMLElement's `dispatchEvent`, so that effects that may - * dispatch events safely no-op. - * - * @param {Event} event Event to dispatch - * @return {boolean} Always true. - */ - dispatchEvent(event) { // eslint-disable-line no-unused-vars - return true; - } -} - -/** @type {!DataTemplate} */ -TemplateInstanceBase.prototype.__dataHost; -/** @type {!TemplatizeOptions} */ -TemplateInstanceBase.prototype.__templatizeOptions; -/** @type {!Polymer_PropertyEffects} */ -TemplateInstanceBase.prototype._methodHost; -/** @type {!Object} */ -TemplateInstanceBase.prototype.__templatizeOwner; -/** @type {!Object} */ -TemplateInstanceBase.prototype.__hostProps; - -/** - * @constructor - * @extends {TemplateInstanceBase} - * @implements {Polymer_MutableData} - * @private - */ -const MutableTemplateInstanceBase = MutableData(TemplateInstanceBase); - -function findMethodHost(template) { - // Technically this should be the owner of the outermost template. - // In shadow dom, this is always getRootNode().host, but we can - // approximate this via cooperation with our dataHost always setting - // `_methodHost` as long as there were bindings (or id's) on this - // instance causing it to get a dataHost. - let templateHost = template.__dataHost; - return templateHost && templateHost._methodHost || templateHost; -} - -/* eslint-disable valid-jsdoc */ -/** - * @suppress {missingProperties} class.prototype is not defined for some reason - */ -function createTemplatizerClass(template, templateInfo, options) { - /** - * @constructor - * @extends {TemplateInstanceBase} - */ - let templatizerBase = options.mutableData ? - MutableTemplateInstanceBase : TemplateInstanceBase; - - // Affordance for global mixins onto TemplatizeInstance - if (templatize.mixin) { - templatizerBase = templatize.mixin(templatizerBase); - } - - /** - * Anonymous class created by the templatize - * @constructor - * @private - */ - let klass = class extends templatizerBase { }; - /** @override */ - klass.prototype.__templatizeOptions = options; - klass.prototype._bindTemplate(template); - addNotifyEffects(klass, template, templateInfo, options); - return klass; -} - -/** - * @suppress {missingProperties} class.prototype is not defined for some reason - */ -function addPropagateEffects(template, templateInfo, options) { - let userForwardHostProp = options.forwardHostProp; - if (userForwardHostProp) { - // Provide data API and property effects on memoized template class - let klass = templateInfo.templatizeTemplateClass; - if (!klass) { - /** - * @constructor - * @extends {DataTemplate} - */ - let templatizedBase = options.mutableData ? MutableDataTemplate : DataTemplate; - /** @private */ - klass = templateInfo.templatizeTemplateClass = - class TemplatizedTemplate extends templatizedBase {}; - // Add template - >instances effects - // and host <- template effects - let hostProps = templateInfo.hostProps; - for (let prop in hostProps) { - klass.prototype._addPropertyEffect('_host_' + prop, - klass.prototype.PROPERTY_EFFECT_TYPES.PROPAGATE, - {fn: createForwardHostPropEffect(prop, userForwardHostProp)}); - klass.prototype._createNotifyingProperty('_host_' + prop); - } - } - upgradeTemplate(template, klass); - // Mix any pre-bound data into __data; no need to flush this to - // instances since they pull from the template at instance-time - if (template.__dataProto) { - // Note, generally `__dataProto` could be chained, but it's guaranteed - // to not be since this is a vanilla template we just added effects to - Object.assign(template.__data, template.__dataProto); - } - // Clear any pending data for performance - template.__dataTemp = {}; - template.__dataPending = null; - template.__dataOld = null; - template._enableProperties(); - } -} -/* eslint-enable valid-jsdoc */ - -function createForwardHostPropEffect(hostProp, userForwardHostProp) { - return function forwardHostProp(template, prop, props) { - userForwardHostProp.call(template.__templatizeOwner, - prop.substring('_host_'.length), props[prop]); - }; -} - -function addNotifyEffects(klass, template, templateInfo, options) { - let hostProps = templateInfo.hostProps || {}; - for (let iprop in options.instanceProps) { - delete hostProps[iprop]; - let userNotifyInstanceProp = options.notifyInstanceProp; - if (userNotifyInstanceProp) { - klass.prototype._addPropertyEffect(iprop, - klass.prototype.PROPERTY_EFFECT_TYPES.NOTIFY, - {fn: createNotifyInstancePropEffect(iprop, userNotifyInstanceProp)}); - } - } - if (options.forwardHostProp && template.__dataHost) { - for (let hprop in hostProps) { - klass.prototype._addPropertyEffect(hprop, - klass.prototype.PROPERTY_EFFECT_TYPES.NOTIFY, - {fn: createNotifyHostPropEffect()}); - } - } -} - -function createNotifyInstancePropEffect(instProp, userNotifyInstanceProp) { - return function notifyInstanceProp(inst, prop, props) { - userNotifyInstanceProp.call(inst.__templatizeOwner, - inst, prop, props[prop]); - }; -} - -function createNotifyHostPropEffect() { - return function notifyHostProp(inst, prop, props) { - inst.__dataHost._setPendingPropertyOrPath('_host_' + prop, props[prop], true, true); - }; -} - - -/** - * Returns an anonymous `PropertyEffects` class bound to the - * `<template>` provided. Instancing the class will result in the - * template being stamped into a document fragment stored as the instance's - * `root` property, after which it can be appended to the DOM. - * - * Templates may utilize all Polymer data-binding features as well as - * declarative event listeners. Event listeners and inline computing - * functions in the template will be called on the host of the template. - * - * The constructor returned takes a single argument dictionary of initial - * property values to propagate into template bindings. Additionally - * host properties can be forwarded in, and instance properties can be - * notified out by providing optional callbacks in the `options` dictionary. - * - * Valid configuration in `options` are as follows: - * - * - `forwardHostProp(property, value)`: Called when a property referenced - * in the template changed on the template's host. As this library does - * not retain references to templates instanced by the user, it is the - * templatize owner's responsibility to forward host property changes into - * user-stamped instances. The `instance.forwardHostProp(property, value)` - * method on the generated class should be called to forward host - * properties into the template to prevent unnecessary property-changed - * notifications. Any properties referenced in the template that are not - * defined in `instanceProps` will be notified up to the template's host - * automatically. - * - `instanceProps`: Dictionary of property names that will be added - * to the instance by the templatize owner. These properties shadow any - * host properties, and changes within the template to these properties - * will result in `notifyInstanceProp` being called. - * - `mutableData`: When `true`, the generated class will skip strict - * dirty-checking for objects and arrays (always consider them to be - * "dirty"). - * - `notifyInstanceProp(instance, property, value)`: Called when - * an instance property changes. Users may choose to call `notifyPath` - * on e.g. the owner to notify the change. - * - `parentModel`: When `true`, events handled by declarative event listeners - * (`on-event="handler"`) will be decorated with a `model` property pointing - * to the template instance that stamped it. It will also be returned - * from `instance.parentModel` in cases where template instance nesting - * causes an inner model to shadow an outer model. - * - * All callbacks are called bound to the `owner`. Any context - * needed for the callbacks (such as references to `instances` stamped) - * should be stored on the `owner` such that they can be retrieved via - * `this`. - * - * When `options.forwardHostProp` is declared as an option, any properties - * referenced in the template will be automatically forwarded from the host of - * the `<template>` to instances, with the exception of any properties listed in - * the `options.instanceProps` object. `instanceProps` are assumed to be - * managed by the owner of the instances, either passed into the constructor - * or set after the fact. Note, any properties passed into the constructor will - * always be set to the instance (regardless of whether they would normally - * be forwarded from the host). - * - * Note that `templatize()` can be run only once for a given `<template>`. - * Further calls will result in an error. Also, there is a special - * behavior if the template was duplicated through a mechanism such as - * `<dom-repeat>` or `<test-fixture>`. In this case, all calls to - * `templatize()` return the same class for all duplicates of a template. - * The class returned from `templatize()` is generated only once using - * the `options` from the first call. This means that any `options` - * provided to subsequent calls will be ignored. Therefore, it is very - * important not to close over any variables inside the callbacks. Also, - * arrow functions must be avoided because they bind the outer `this`. - * Inside the callbacks, any contextual information can be accessed - * through `this`, which points to the `owner`. - * - * @param {!HTMLTemplateElement} template Template to templatize - * @param {Polymer_PropertyEffects=} owner Owner of the template instances; - * any optional callbacks will be bound to this owner. - * @param {Object=} options Options dictionary (see summary for details) - * @return {function(new:TemplateInstanceBase)} Generated class bound to the template - * provided - * @suppress {invalidCasts} - */ -export function templatize(template, owner, options) { - // Under strictTemplatePolicy, the templatized element must be owned - // by a (trusted) Polymer element, indicated by existence of _methodHost; - // e.g. for dom-if & dom-repeat in main document, _methodHost is null - if (strictTemplatePolicy && !findMethodHost(template)) { - throw new Error('strictTemplatePolicy: template owner not trusted'); - } - options = /** @type {!TemplatizeOptions} */(options || {}); - if (template.__templatizeOwner) { - throw new Error('A <template> can only be templatized once'); - } - template.__templatizeOwner = owner; - const ctor = owner ? owner.constructor : TemplateInstanceBase; - let templateInfo = ctor._parseTemplate(template); - // Get memoized base class for the prototypical template, which - // includes property effects for binding template & forwarding - /** - * @constructor - * @extends {TemplateInstanceBase} - */ - let baseClass = templateInfo.templatizeInstanceClass; - if (!baseClass) { - baseClass = createTemplatizerClass(template, templateInfo, options); - templateInfo.templatizeInstanceClass = baseClass; - } - // Host property forwarding must be installed onto template instance - addPropagateEffects(template, templateInfo, options); - // Subclass base class and add reference for this specific template - /** @private */ - let klass = class TemplateInstance extends baseClass {}; - /** @override */ - klass.prototype._methodHost = findMethodHost(template); - /** @override */ - klass.prototype.__dataHost = /** @type {!DataTemplate} */ (template); - /** @override */ - klass.prototype.__templatizeOwner = /** @type {!Object} */ (owner); - /** @override */ - klass.prototype.__hostProps = templateInfo.hostProps; - klass = /** @type {function(new:TemplateInstanceBase)} */(klass); //eslint-disable-line no-self-assign - return klass; -} - -/** - * Returns the template "model" associated with a given element, which - * serves as the binding scope for the template instance the element is - * contained in. A template model is an instance of - * `TemplateInstanceBase`, and should be used to manipulate data - * associated with this template instance. - * - * Example: - * - * let model = modelForElement(el); - * if (model.index < 10) { - * model.set('item.checked', true); - * } - * - * @param {HTMLTemplateElement} template The model will be returned for - * elements stamped from this template - * @param {Node=} node Node for which to return a template model. - * @return {TemplateInstanceBase} Template instance representing the - * binding scope for the element - */ -export function modelForElement(template, node) { - let model; - while (node) { - // An element with a __templatizeInstance marks the top boundary - // of a scope; walk up until we find one, and then ensure that - // its __dataHost matches `this`, meaning this dom-repeat stamped it - if ((model = node.__templatizeInstance)) { - // Found an element stamped by another template; keep walking up - // from its __dataHost - if (model.__dataHost != template) { - node = model.__dataHost; - } else { - return model; - } - } else { - // Still in a template scope, keep going up until - // a __templatizeInstance is found - node = wrap(node).parentNode; - } - } - return null; -} - -export { TemplateInstanceBase }; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/unresolved.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/unresolved.js deleted file mode 100644 index a7c8fc84314..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/unresolved.js +++ /dev/null @@ -1,21 +0,0 @@ -/** -@license -Copyright (c) 2017 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 resolve() { - document.body.removeAttribute('unresolved'); -} - -if (document.readyState === 'interactive' || document.readyState === 'complete') { - resolve(); -} else { - window.addEventListener('DOMContentLoaded', resolve); -} - -export {}; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/wrap.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/wrap.js deleted file mode 100644 index ece21a4e1b0..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/lib/utils/wrap.js +++ /dev/null @@ -1,23 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ - -/* eslint-disable valid-jsdoc */ -/** - * Node wrapper to ensure ShadowDOM safe operation regardless of polyfill - * presence or mode. Note that with the introduction of `ShadyDOM.noPatch`, - * a node wrapper must be used to access ShadowDOM API. - * This is similar to using `Polymer.dom` but relies exclusively - * on the presence of the ShadyDOM polyfill rather than requiring the loading - * of legacy (Polymer.dom) API. - * @type {function(Node):Node} - */ -export const wrap = (window['ShadyDOM'] && window['ShadyDOM']['noPatch'] && window['ShadyDOM']['wrap']) ? - window['ShadyDOM']['wrap'] : (n) => n; - diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/polymer-element.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/polymer-element.js deleted file mode 100644 index 1179d6872bb..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/polymer-element.js +++ /dev/null @@ -1,31 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ - -import { ElementMixin, version } from './lib/mixins/element-mixin.js'; -export { html } from './lib/utils/html-tag.js'; - -export { version }; - -/** - * Base class that provides the core API for Polymer's meta-programming - * features including template stamping, data-binding, attribute deserialization, - * and property change observation. - * - * @customElement - * @polymer - * @constructor - * @implements {Polymer_ElementMixin} - * @extends HTMLElement - * @appliesMixin ElementMixin - * @summary Custom element base class that provides the core API for Polymer's - * key meta-programming features including template stamping, data-binding, - * attribute deserialization, and property change observation - */ -export const PolymerElement = ElementMixin(HTMLElement); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/polymer-legacy.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/polymer-legacy.js deleted file mode 100644 index ffdd35e08e6..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/polymer/polymer-legacy.js +++ /dev/null @@ -1,27 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ - -import { LegacyElementMixin } from './lib/legacy/legacy-element-mixin.js'; -export { Polymer } from './lib/legacy/polymer-fn.js'; -/* template elements */ -import './lib/legacy/templatizer-behavior.js'; -import './lib/elements/dom-bind.js'; -import './lib/elements/dom-repeat.js'; -import './lib/elements/dom-if.js'; -import './lib/elements/array-selector.js'; -/* custom-style */ -import './lib/elements/custom-style.js'; -/* bc behaviors */ -import './lib/legacy/mutable-data-behavior.js'; -/* import html-tag to export html */ -export { html } from './lib/utils/html-tag.js'; - -// bc -export const Base = LegacyElementMixin(HTMLElement).prototype; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/polymer/polymer_bundled.min.js b/chromium/third_party/polymer/v3_0/components-chromium/polymer/polymer_bundled.min.js new file mode 100644 index 00000000000..a6855b96e4b --- /dev/null +++ b/chromium/third_party/polymer/v3_0/components-chromium/polymer/polymer_bundled.min.js @@ -0,0 +1 @@ +window.JSCompiler_renameProperty=function(prop,obj){return prop};let scheduled=false;let beforeRenderQueue=[];let afterRenderQueue=[];function schedule(){scheduled=true;requestAnimationFrame(function(){scheduled=false;flushQueue(beforeRenderQueue);setTimeout(function(){runQueue(afterRenderQueue)})})}function flushQueue(queue){while(queue.length){callMethod(queue.shift())}}function runQueue(queue){for(let i=0,l=queue.length;i<l;i++){callMethod(queue.shift())}}function callMethod(info){const context=info[0];const callback=info[1];const args=info[2];try{callback.apply(context,args)}catch(e){setTimeout(()=>{throw e})}}function beforeNextRender(context,callback,args){if(!scheduled){schedule()}beforeRenderQueue.push([context,callback,args])}function afterNextRender(context,callback,args){if(!scheduled){schedule()}afterRenderQueue.push([context,callback,args])}let microtaskCurrHandle=0;let microtaskLastHandle=0;let microtaskCallbacks=[];let microtaskNodeContent=0;let microtaskNode=document.createTextNode("");new window.MutationObserver(microtaskFlush).observe(microtaskNode,{characterData:true});function microtaskFlush(){const len=microtaskCallbacks.length;for(let i=0;i<len;i++){let cb=microtaskCallbacks[i];if(cb){try{cb()}catch(e){setTimeout(()=>{throw e})}}}microtaskCallbacks.splice(0,len);microtaskLastHandle+=len}const timeOut={after(delay){return{run(fn){return window.setTimeout(fn,delay)},cancel(handle){window.clearTimeout(handle)}}},run(fn,delay){return window.setTimeout(fn,delay)},cancel(handle){window.clearTimeout(handle)}};const animationFrame={run(fn){return window.requestAnimationFrame(fn)},cancel(handle){window.cancelAnimationFrame(handle)}};const idlePeriod={run(fn){return window.requestIdleCallback?window.requestIdleCallback(fn):window.setTimeout(fn,16)},cancel(handle){window.cancelIdleCallback?window.cancelIdleCallback(handle):window.clearTimeout(handle)}};const microTask={run(callback){microtaskNode.textContent=microtaskNodeContent++;microtaskCallbacks.push(callback);return microtaskCurrHandle++},cancel(handle){const idx=handle-microtaskLastHandle;if(idx>=0){if(!microtaskCallbacks[idx]){throw new Error("invalid async handle: "+handle)}microtaskCallbacks[idx]=null}}};let dedupeId=0;const dedupingMixin=function(mixin){let mixinApplications=mixin.__mixinApplications;if(!mixinApplications){mixinApplications=new WeakMap;mixin.__mixinApplications=mixinApplications}let mixinDedupeId=dedupeId++;function dedupingMixin(base){let baseSet=base.__mixinSet;if(baseSet&&baseSet[mixinDedupeId]){return base}let map=mixinApplications;let extended=map.get(base);if(!extended){extended=mixin(base);map.set(base,extended)}let mixinSet=Object.create(extended.__mixinSet||baseSet||null);mixinSet[mixinDedupeId]=true;extended.__mixinSet=mixinSet;return extended}return dedupingMixin};class Debouncer{constructor(){this._asyncModule=null;this._callback=null;this._timer=null}setConfig(asyncModule,callback){this._asyncModule=asyncModule;this._callback=callback;this._timer=this._asyncModule.run(()=>{this._timer=null;debouncerQueue.delete(this);this._callback()})}cancel(){if(this.isActive()){this._cancelAsync();debouncerQueue.delete(this)}}_cancelAsync(){if(this.isActive()){this._asyncModule.cancel(this._timer);this._timer=null}}flush(){if(this.isActive()){this.cancel();this._callback()}}isActive(){return this._timer!=null}static debounce(debouncer,asyncModule,callback){if(debouncer instanceof Debouncer){debouncer._cancelAsync()}else{debouncer=new Debouncer}debouncer.setConfig(asyncModule,callback);return debouncer}}let debouncerQueue=new Set;const enqueueDebouncer=function(debouncer){debouncerQueue.add(debouncer)};const flushDebouncers=function(){const didFlush=Boolean(debouncerQueue.size);debouncerQueue.forEach(debouncer=>{try{debouncer.flush()}catch(e){setTimeout(()=>{throw e})}});return didFlush};let CSS_URL_RX=/(url\()([^)]*)(\))/g;let ABS_URL=/(^\/)|(^#)|(^[\w-\d]*:)/;let workingURL;let resolveDoc;function resolveUrl(url,baseURI){if(url&&ABS_URL.test(url)){return url}if(workingURL===undefined){workingURL=false;try{const u=new URL("b","http://a");u.pathname="c%20d";workingURL=u.href==="http://a/c%20d"}catch(e){}}if(!baseURI){baseURI=document.baseURI||window.location.href}if(workingURL){return new URL(url,baseURI).href}if(!resolveDoc){resolveDoc=document.implementation.createHTMLDocument("temp");resolveDoc.base=resolveDoc.createElement("base");resolveDoc.head.appendChild(resolveDoc.base);resolveDoc.anchor=resolveDoc.createElement("a");resolveDoc.body.appendChild(resolveDoc.anchor)}resolveDoc.base.href=baseURI;resolveDoc.anchor.href=url;return resolveDoc.anchor.href||url}function resolveCss(cssText,baseURI){return cssText.replace(CSS_URL_RX,function(m,pre,url,post){return pre+"'"+resolveUrl(url.replace(/["']/g,""),baseURI)+"'"+post})}function pathFromUrl(url){return url.substring(0,url.lastIndexOf("/")+1)}const useShadow=!window.ShadyDOM;const useNativeCSSProperties=Boolean(!window.ShadyCSS||window.ShadyCSS.nativeCss);const useNativeCustomElements=!window.customElements.polyfillWrapFlushCallback;let rootPath=pathFromUrl(document.baseURI||window.location.href);let sanitizeDOMValue=window.Polymer&&window.Polymer.sanitizeDOMValue||undefined;let passiveTouchGestures=false;let strictTemplatePolicy=false;let allowTemplateFromDomModule=false;let legacyOptimizations=false;let syncInitialRender=false;const wrap=window["ShadyDOM"]&&window["ShadyDOM"]["noPatch"]&&window["ShadyDOM"]["wrap"]?window["ShadyDOM"]["wrap"]:n=>n;let HAS_NATIVE_TA=typeof document.head.style.touchAction==="string";let GESTURE_KEY="__polymerGestures";let HANDLED_OBJ="__polymerGesturesHandled";let TOUCH_ACTION="__polymerGesturesTouchAction";let TAP_DISTANCE=25;let TRACK_DISTANCE=5;let TRACK_LENGTH=2;let MOUSE_TIMEOUT=2500;let MOUSE_EVENTS=["mousedown","mousemove","mouseup","click"];let MOUSE_WHICH_TO_BUTTONS=[0,1,4,2];let MOUSE_HAS_BUTTONS=function(){try{return new MouseEvent("test",{buttons:1}).buttons===1}catch(e){return false}}();function isMouseEvent(name){return MOUSE_EVENTS.indexOf(name)>-1}let SUPPORTS_PASSIVE=false;(function(){try{let opts=Object.defineProperty({},"passive",{get(){SUPPORTS_PASSIVE=true}});window.addEventListener("test",null,opts);window.removeEventListener("test",null,opts)}catch(e){}})();function PASSIVE_TOUCH(eventName){if(isMouseEvent(eventName)||eventName==="touchend"){return}if(HAS_NATIVE_TA&&SUPPORTS_PASSIVE&&passiveTouchGestures){return{passive:true}}else{return}}let IS_TOUCH_ONLY=navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/);const clickedLabels=[];const labellable={button:true,input:true,keygen:true,meter:true,output:true,textarea:true,progress:true,select:true};const canBeDisabled={button:true,command:true,fieldset:true,input:true,keygen:true,optgroup:true,option:true,select:true,textarea:true};function canBeLabelled(el){return labellable[el.localName]||false}function matchingLabels(el){let labels=Array.prototype.slice.call(el.labels||[]);if(!labels.length){labels=[];let root=el.getRootNode();if(el.id){let matching=root.querySelectorAll(`label[for = ${el.id}]`);for(let i=0;i<matching.length;i++){labels.push(matching[i])}}}return labels}let mouseCanceller=function(mouseEvent){let sc=mouseEvent.sourceCapabilities;if(sc&&!sc.firesTouchEvents){return}mouseEvent[HANDLED_OBJ]={skip:true};if(mouseEvent.type==="click"){let clickFromLabel=false;let path=getComposedPath(mouseEvent);for(let i=0;i<path.length;i++){if(path[i].nodeType===Node.ELEMENT_NODE){if(path[i].localName==="label"){clickedLabels.push(path[i])}else if(canBeLabelled(path[i])){let ownerLabels=matchingLabels(path[i]);for(let j=0;j<ownerLabels.length;j++){clickFromLabel=clickFromLabel||clickedLabels.indexOf(ownerLabels[j])>-1}}}if(path[i]===POINTERSTATE.mouse.target){return}}if(clickFromLabel){return}mouseEvent.preventDefault();mouseEvent.stopPropagation()}};function setupTeardownMouseCanceller(setup){let events=IS_TOUCH_ONLY?["click"]:MOUSE_EVENTS;for(let i=0,en;i<events.length;i++){en=events[i];if(setup){clickedLabels.length=0;document.addEventListener(en,mouseCanceller,true)}else{document.removeEventListener(en,mouseCanceller,true)}}}function ignoreMouse(e){if(!POINTERSTATE.mouse.mouseIgnoreJob){setupTeardownMouseCanceller(true)}let unset=function(){setupTeardownMouseCanceller();POINTERSTATE.mouse.target=null;POINTERSTATE.mouse.mouseIgnoreJob=null};POINTERSTATE.mouse.target=getComposedPath(e)[0];POINTERSTATE.mouse.mouseIgnoreJob=Debouncer.debounce(POINTERSTATE.mouse.mouseIgnoreJob,timeOut.after(MOUSE_TIMEOUT),unset)}function hasLeftMouseButton(ev){let type=ev.type;if(!isMouseEvent(type)){return false}if(type==="mousemove"){let buttons=ev.buttons===undefined?1:ev.buttons;if(ev instanceof window.MouseEvent&&!MOUSE_HAS_BUTTONS){buttons=MOUSE_WHICH_TO_BUTTONS[ev.which]||0}return Boolean(buttons&1)}else{let button=ev.button===undefined?0:ev.button;return button===0}}function isSyntheticClick(ev){if(ev.type==="click"){if(ev.detail===0){return true}let t=_findOriginalTarget(ev);if(!t.nodeType||t.nodeType!==Node.ELEMENT_NODE){return true}let bcr=t.getBoundingClientRect();let x=ev.pageX,y=ev.pageY;return!(x>=bcr.left&&x<=bcr.right&&(y>=bcr.top&&y<=bcr.bottom))}return false}let POINTERSTATE={mouse:{target:null,mouseIgnoreJob:null},touch:{x:0,y:0,id:-1,scrollDecided:false}};function firstTouchAction(ev){let ta="auto";let path=getComposedPath(ev);for(let i=0,n;i<path.length;i++){n=path[i];if(n[TOUCH_ACTION]){ta=n[TOUCH_ACTION];break}}return ta}function trackDocument(stateObj,movefn,upfn){stateObj.movefn=movefn;stateObj.upfn=upfn;document.addEventListener("mousemove",movefn);document.addEventListener("mouseup",upfn)}function untrackDocument(stateObj){document.removeEventListener("mousemove",stateObj.movefn);document.removeEventListener("mouseup",stateObj.upfn);stateObj.movefn=null;stateObj.upfn=null}document.addEventListener("touchend",ignoreMouse,SUPPORTS_PASSIVE?{passive:true}:false);const getComposedPath=window.ShadyDOM&&window.ShadyDOM.noPatch?window.ShadyDOM.composedPath:event=>event.composedPath&&event.composedPath()||[];const gestures={};const recognizers=[];function deepTargetFind(x,y){let node=document.elementFromPoint(x,y);let next=node;while(next&&next.shadowRoot&&!window.ShadyDOM){let oldNext=next;next=next.shadowRoot.elementFromPoint(x,y);if(oldNext===next){break}if(next){node=next}}return node}function _findOriginalTarget(ev){const path=getComposedPath(ev);return path.length>0?path[0]:ev.target}function _handleNative(ev){let handled;let type=ev.type;let node=ev.currentTarget;let gobj=node[GESTURE_KEY];if(!gobj){return}let gs=gobj[type];if(!gs){return}if(!ev[HANDLED_OBJ]){ev[HANDLED_OBJ]={};if(type.slice(0,5)==="touch"){ev=ev;let t=ev.changedTouches[0];if(type==="touchstart"){if(ev.touches.length===1){POINTERSTATE.touch.id=t.identifier}}if(POINTERSTATE.touch.id!==t.identifier){return}if(!HAS_NATIVE_TA){if(type==="touchstart"||type==="touchmove"){_handleTouchAction(ev)}}}}handled=ev[HANDLED_OBJ];if(handled.skip){return}for(let i=0,r;i<recognizers.length;i++){r=recognizers[i];if(gs[r.name]&&!handled[r.name]){if(r.flow&&r.flow.start.indexOf(ev.type)>-1&&r.reset){r.reset()}}}for(let i=0,r;i<recognizers.length;i++){r=recognizers[i];if(gs[r.name]&&!handled[r.name]){handled[r.name]=true;r[type](ev)}}}function _handleTouchAction(ev){let t=ev.changedTouches[0];let type=ev.type;if(type==="touchstart"){POINTERSTATE.touch.x=t.clientX;POINTERSTATE.touch.y=t.clientY;POINTERSTATE.touch.scrollDecided=false}else if(type==="touchmove"){if(POINTERSTATE.touch.scrollDecided){return}POINTERSTATE.touch.scrollDecided=true;let ta=firstTouchAction(ev);let shouldPrevent=false;let dx=Math.abs(POINTERSTATE.touch.x-t.clientX);let dy=Math.abs(POINTERSTATE.touch.y-t.clientY);if(!ev.cancelable);else if(ta==="none"){shouldPrevent=true}else if(ta==="pan-x"){shouldPrevent=dy>dx}else if(ta==="pan-y"){shouldPrevent=dx>dy}if(shouldPrevent){ev.preventDefault()}else{prevent("track")}}}function addListener(node,evType,handler){if(gestures[evType]){_add(node,evType,handler);return true}return false}function removeListener(node,evType,handler){if(gestures[evType]){_remove(node,evType,handler);return true}return false}function _add(node,evType,handler){let recognizer=gestures[evType];let deps=recognizer.deps;let name=recognizer.name;let gobj=node[GESTURE_KEY];if(!gobj){node[GESTURE_KEY]=gobj={}}for(let i=0,dep,gd;i<deps.length;i++){dep=deps[i];if(IS_TOUCH_ONLY&&isMouseEvent(dep)&&dep!=="click"){continue}gd=gobj[dep];if(!gd){gobj[dep]=gd={_count:0}}if(gd._count===0){node.addEventListener(dep,_handleNative,PASSIVE_TOUCH(dep))}gd[name]=(gd[name]||0)+1;gd._count=(gd._count||0)+1}node.addEventListener(evType,handler);if(recognizer.touchAction){setTouchAction(node,recognizer.touchAction)}}function _remove(node,evType,handler){let recognizer=gestures[evType];let deps=recognizer.deps;let name=recognizer.name;let gobj=node[GESTURE_KEY];if(gobj){for(let i=0,dep,gd;i<deps.length;i++){dep=deps[i];gd=gobj[dep];if(gd&&gd[name]){gd[name]=(gd[name]||1)-1;gd._count=(gd._count||1)-1;if(gd._count===0){node.removeEventListener(dep,_handleNative,PASSIVE_TOUCH(dep))}}}}node.removeEventListener(evType,handler)}function register(recog){recognizers.push(recog);for(let i=0;i<recog.emits.length;i++){gestures[recog.emits[i]]=recog}}function _findRecognizerByEvent(evName){for(let i=0,r;i<recognizers.length;i++){r=recognizers[i];for(let j=0,n;j<r.emits.length;j++){n=r.emits[j];if(n===evName){return r}}}return null}function setTouchAction(node,value){if(HAS_NATIVE_TA&&node instanceof HTMLElement){microTask.run(()=>{node.style.touchAction=value})}node[TOUCH_ACTION]=value}function _fire(target,type,detail){let ev=new Event(type,{bubbles:true,cancelable:true,composed:true});ev.detail=detail;wrap(target).dispatchEvent(ev);if(ev.defaultPrevented){let preventer=detail.preventer||detail.sourceEvent;if(preventer&&preventer.preventDefault){preventer.preventDefault()}}}function prevent(evName){let recognizer=_findRecognizerByEvent(evName);if(recognizer.info){recognizer.info.prevent=true}}function resetMouseCanceller(){if(POINTERSTATE.mouse.mouseIgnoreJob){POINTERSTATE.mouse.mouseIgnoreJob.flush()}}register({name:"downup",deps:["mousedown","touchstart","touchend"],flow:{start:["mousedown","touchstart"],end:["mouseup","touchend"]},emits:["down","up"],info:{movefn:null,upfn:null},reset:function(){untrackDocument(this.info)},mousedown:function(e){if(!hasLeftMouseButton(e)){return}let t=_findOriginalTarget(e);let self=this;let movefn=function movefn(e){if(!hasLeftMouseButton(e)){downupFire("up",t,e);untrackDocument(self.info)}};let upfn=function upfn(e){if(hasLeftMouseButton(e)){downupFire("up",t,e)}untrackDocument(self.info)};trackDocument(this.info,movefn,upfn);downupFire("down",t,e)},touchstart:function(e){downupFire("down",_findOriginalTarget(e),e.changedTouches[0],e)},touchend:function(e){downupFire("up",_findOriginalTarget(e),e.changedTouches[0],e)}});function downupFire(type,target,event,preventer){if(!target){return}_fire(target,type,{x:event.clientX,y:event.clientY,sourceEvent:event,preventer:preventer,prevent:function(e){return prevent(e)}})}register({name:"track",touchAction:"none",deps:["mousedown","touchstart","touchmove","touchend"],flow:{start:["mousedown","touchstart"],end:["mouseup","touchend"]},emits:["track"],info:{x:0,y:0,state:"start",started:false,moves:[],addMove:function(move){if(this.moves.length>TRACK_LENGTH){this.moves.shift()}this.moves.push(move)},movefn:null,upfn:null,prevent:false},reset:function(){this.info.state="start";this.info.started=false;this.info.moves=[];this.info.x=0;this.info.y=0;this.info.prevent=false;untrackDocument(this.info)},mousedown:function(e){if(!hasLeftMouseButton(e)){return}let t=_findOriginalTarget(e);let self=this;let movefn=function movefn(e){let x=e.clientX,y=e.clientY;if(trackHasMovedEnough(self.info,x,y)){self.info.state=self.info.started?e.type==="mouseup"?"end":"track":"start";if(self.info.state==="start"){prevent("tap")}self.info.addMove({x:x,y:y});if(!hasLeftMouseButton(e)){self.info.state="end";untrackDocument(self.info)}if(t){trackFire(self.info,t,e)}self.info.started=true}};let upfn=function upfn(e){if(self.info.started){movefn(e)}untrackDocument(self.info)};trackDocument(this.info,movefn,upfn);this.info.x=e.clientX;this.info.y=e.clientY},touchstart:function(e){let ct=e.changedTouches[0];this.info.x=ct.clientX;this.info.y=ct.clientY},touchmove:function(e){let t=_findOriginalTarget(e);let ct=e.changedTouches[0];let x=ct.clientX,y=ct.clientY;if(trackHasMovedEnough(this.info,x,y)){if(this.info.state==="start"){prevent("tap")}this.info.addMove({x:x,y:y});trackFire(this.info,t,ct);this.info.state="track";this.info.started=true}},touchend:function(e){let t=_findOriginalTarget(e);let ct=e.changedTouches[0];if(this.info.started){this.info.state="end";this.info.addMove({x:ct.clientX,y:ct.clientY});trackFire(this.info,t,ct)}}});function trackHasMovedEnough(info,x,y){if(info.prevent){return false}if(info.started){return true}let dx=Math.abs(info.x-x);let dy=Math.abs(info.y-y);return dx>=TRACK_DISTANCE||dy>=TRACK_DISTANCE}function trackFire(info,target,touch){if(!target){return}let secondlast=info.moves[info.moves.length-2];let lastmove=info.moves[info.moves.length-1];let dx=lastmove.x-info.x;let dy=lastmove.y-info.y;let ddx,ddy=0;if(secondlast){ddx=lastmove.x-secondlast.x;ddy=lastmove.y-secondlast.y}_fire(target,"track",{state:info.state,x:touch.clientX,y:touch.clientY,dx:dx,dy:dy,ddx:ddx,ddy:ddy,sourceEvent:touch,hover:function(){return deepTargetFind(touch.clientX,touch.clientY)}})}register({name:"tap",deps:["mousedown","click","touchstart","touchend"],flow:{start:["mousedown","touchstart"],end:["click","touchend"]},emits:["tap"],info:{x:NaN,y:NaN,prevent:false},reset:function(){this.info.x=NaN;this.info.y=NaN;this.info.prevent=false},mousedown:function(e){if(hasLeftMouseButton(e)){this.info.x=e.clientX;this.info.y=e.clientY}},click:function(e){if(hasLeftMouseButton(e)){trackForward(this.info,e)}},touchstart:function(e){const touch=e.changedTouches[0];this.info.x=touch.clientX;this.info.y=touch.clientY},touchend:function(e){trackForward(this.info,e.changedTouches[0],e)}});function trackForward(info,e,preventer){let dx=Math.abs(e.clientX-info.x);let dy=Math.abs(e.clientY-info.y);let t=_findOriginalTarget(preventer||e);if(!t||canBeDisabled[t.localName]&&t.hasAttribute("disabled")){return}if(isNaN(dx)||isNaN(dy)||dx<=TAP_DISTANCE&&dy<=TAP_DISTANCE||isSyntheticClick(e)){if(!info.prevent){_fire(t,"tap",{x:e.clientX,y:e.clientY,sourceEvent:e,preventer:preventer})}}}const findOriginalTarget=_findOriginalTarget;const add=addListener;const remove=removeListener;var gestures$1=Object.freeze({gestures:gestures,recognizers:recognizers,deepTargetFind:deepTargetFind,addListener:addListener,removeListener:removeListener,register:register,setTouchAction:setTouchAction,prevent:prevent,resetMouseCanceller:resetMouseCanceller,findOriginalTarget:findOriginalTarget,add:add,remove:remove});const nativeShadow=!(window["ShadyDOM"]&&window["ShadyDOM"]["inUse"]);let nativeCssVariables_;function calcCssVariables(settings){if(settings&&settings["shimcssproperties"]){nativeCssVariables_=false}else{nativeCssVariables_=nativeShadow||Boolean(!navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)&&window.CSS&&CSS.supports&&CSS.supports("box-shadow","0 0 0 var(--foo)"))}}let cssBuild;if(window.ShadyCSS&&window.ShadyCSS.cssBuild!==undefined){cssBuild=window.ShadyCSS.cssBuild}const disableRuntime=Boolean(window.ShadyCSS&&window.ShadyCSS.disableRuntime);if(window.ShadyCSS&&window.ShadyCSS.nativeCss!==undefined){nativeCssVariables_=window.ShadyCSS.nativeCss}else if(window.ShadyCSS){calcCssVariables(window.ShadyCSS);window.ShadyCSS=undefined}else{calcCssVariables(window["WebComponents"]&&window["WebComponents"]["flags"])}const nativeCssVariables=nativeCssVariables_;class StyleNode{constructor(){this["start"]=0;this["end"]=0;this["previous"]=null;this["parent"]=null;this["rules"]=null;this["parsedCssText"]="";this["cssText"]="";this["atRule"]=false;this["type"]=0;this["keyframesName"]="";this["selector"]="";this["parsedSelector"]=""}}function parse(text){text=clean(text);return parseCss(lex(text),text)}function clean(cssText){return cssText.replace(RX.comments,"").replace(RX.port,"")}function lex(text){let root=new StyleNode;root["start"]=0;root["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]||null;n=new StyleNode;n["start"]=i+1;n["parent"]=p;n["previous"]=previous;p["rules"].push(n)}else if(text[i]===CLOSE_BRACE){n["end"]=i+1;n=n["parent"]||root}}return root}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," ");t=t.substring(t.lastIndexOf(";")+1);let s=node["parsedSelector"]=node["selector"]=t.trim();node["atRule"]=s.indexOf(AT_START)===0;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}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})}function stringify(node,preserveProperties,text=""){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"}}}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){let r=rules[0];return Boolean(r)&&Boolean(r["selector"])&&r["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,"")}const types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3};const OPEN_BRACE="{";const CLOSE_BRACE="}";const 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};const VAR_START="--";const MEDIA_START="@media";const AT_START="@";const VAR_ASSIGN=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi;const MIXIN_MATCH=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi;const MEDIA_MATCH=/@media\s(.*)/;const styleTextSet=new Set;const scopingAttribute="shady-unscoped";function processUnscopedStyle(style){const text=style.textContent;if(!styleTextSet.has(text)){styleTextSet.add(text);const newStyle=style.cloneNode(true);document.head.appendChild(newStyle)}}function isUnscopedStyle(style){return style.hasAttribute(scopingAttribute)}function toCssText(rules,callback){if(!rules){return""}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"]||null}function forEachRule(node,styleRuleCallback,keyframesRuleCallback,onlyActiveRules){if(!node){return}let skipRules=false;let type=node["type"];if(onlyActiveRules){if(type===types.MEDIA_RULE){let matchMedia=node["selector"].match(MEDIA_MATCH);if(matchMedia){if(!window.matchMedia(matchMedia[1]).matches){skipRules=true}}}}if(type===types.STYLE_RULE){styleRuleCallback(node)}else if(keyframesRuleCallback&&type===types.KEYFRAMES_RULE){keyframesRuleCallback(node)}else if(type===types.MIXIN_RULE){skipRules=true}let r$=node["rules"];if(r$&&!skipRules){for(let i=0,l=r$.length,r;i<l&&(r=r$[i]);i++){forEachRule(r,styleRuleCallback,keyframesRuleCallback,onlyActiveRules)}}}function findMatchingParen(text,start){let level=0;for(let i=start,l=text.length;i<l;i++){if(text[i]==="("){level++}else if(text[i]===")"){if(--level===0){return i}}}return-1}function processVariableAndFallback(str,callback){let start=str.indexOf("var(");if(start===-1){return callback(str,"","","")}let end=findMatchingParen(str,start+3);let inner=str.substring(start+4,end);let prefix=str.substring(0,start);let suffix=processVariableAndFallback(str.substring(end+1),callback);let comma=inner.indexOf(",");if(comma===-1){return callback(prefix,inner.trim(),"",suffix)}let value=inner.substring(0,comma).trim();let fallback=inner.substring(comma+1).trim();return callback(prefix,value,fallback,suffix)}const wrap$1=window["ShadyDOM"]&&window["ShadyDOM"]["wrap"]||(node=>node);function getIsExtends(element){let localName=element["localName"];let is="",typeExtension="";if(localName){if(localName.indexOf("-")>-1){is=localName}else{typeExtension=localName;is=element.getAttribute&&element.getAttribute("is")||""}}else{is=element.is;typeExtension=element.extends}return{is:is,typeExtension:typeExtension}}function gatherStyleText(element){const styleTextParts=[];const styles=element.querySelectorAll("style");for(let i=0;i<styles.length;i++){const style=styles[i];if(isUnscopedStyle(style)){if(!nativeShadow){processUnscopedStyle(style);style.parentNode.removeChild(style)}}else{styleTextParts.push(style.textContent);style.parentNode.removeChild(style)}}return styleTextParts.join("").trim()}const CSS_BUILD_ATTR="css-build";function getCssBuild(element){if(cssBuild!==undefined){return cssBuild}if(element.__cssBuild===undefined){const attrValue=element.getAttribute(CSS_BUILD_ATTR);if(attrValue){element.__cssBuild=attrValue}else{const buildComment=getBuildComment(element);if(buildComment!==""){removeBuildComment(element)}element.__cssBuild=buildComment}}return element.__cssBuild||""}function elementHasBuiltCss(element){return getCssBuild(element)!==""}function getBuildComment(element){const buildComment=element.localName==="template"?element.content.firstChild:element.firstChild;if(buildComment instanceof Comment){const commentParts=buildComment.textContent.trim().split(":");if(commentParts[0]===CSS_BUILD_ATTR){return commentParts[1]}}return""}function removeBuildComment(element){const buildComment=element.localName==="template"?element.content.firstChild:element.firstChild;buildComment.parentNode.removeChild(buildComment)}function updateNativeProperties(element,properties){for(let p in properties){if(p===null){element.style.removeProperty(p)}else{element.style.setProperty(p,properties[p])}}}function getComputedStyleValue(element,property){const value=window.getComputedStyle(element).getPropertyValue(property);if(!value){return""}else{return value.trim()}}function detectMixin(cssText){const has=MIXIN_MATCH.test(cssText)||VAR_ASSIGN.test(cssText);MIXIN_MATCH.lastIndex=0;VAR_ASSIGN.lastIndex=0;return has}const APPLY_NAME_CLEAN=/;\s*/m;const INITIAL_INHERIT=/^\s*(initial)|(inherit)\s*$/;const IMPORTANT=/\s*!important/;const MIXIN_VAR_SEP="_-_";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]||null}}let invalidCallback=null;class ApplyShim{constructor(){this._currentElement=null;this._measureElement=null;this._map=new MixinMap}detectMixin(cssText){return detectMixin(cssText)}gatherStyles(template){const styleText=gatherStyleText(template.content);if(styleText){const style=document.createElement("style");style.textContent=styleText;template.content.insertBefore(style,template.content.firstChild);return style}return null}transformTemplate(template,elementName){if(template._gatheredStyle===undefined){template._gatheredStyle=this.gatherStyles(template)}const style=template._gatheredStyle;return style?this.transformStyle(style,elementName):null}transformStyle(style,elementName=""){let ast=rulesForStyle(style);this.transformRules(ast,elementName);style.textContent=toCssText(ast);return ast}transformCustomStyle(style){let ast=rulesForStyle(style);forEachRule(ast,rule=>{if(rule["selector"]===":root"){rule["selector"]="html"}this.transformRule(rule)});style.textContent=toCssText(ast);return ast}transformRules(rules,elementName){this._currentElement=elementName;forEachRule(rules,r=>{this.transformRule(r)});this._currentElement=null}transformRule(rule){rule["cssText"]=this.transformCssText(rule["parsedCssText"],rule);if(rule["selector"]===":root"){rule["selector"]=":host > *"}}transformCssText(cssText,rule){cssText=cssText.replace(VAR_ASSIGN,(matchText,propertyName,valueProperty,valueMixin)=>this._produceCssProperties(matchText,propertyName,valueProperty,valueMixin,rule));return this._consumeCssProperties(cssText,rule)}_getInitialValueForProperty(property){if(!this._measureElement){this._measureElement=document.createElement("meta");this._measureElement.setAttribute("apply-shim-measure","");this._measureElement.style.all="initial";document.head.appendChild(this._measureElement)}return window.getComputedStyle(this._measureElement).getPropertyValue(property)}_fallbacksFromPreviousRules(startRule){let topRule=startRule;while(topRule["parent"]){topRule=topRule["parent"]}const fallbacks={};let seenStartRule=false;forEachRule(topRule,r=>{seenStartRule=seenStartRule||r===startRule;if(seenStartRule){return}if(r["selector"]===startRule["selector"]){Object.assign(fallbacks,this._cssTextToMap(r["parsedCssText"]))}});return fallbacks}_consumeCssProperties(text,rule){let m=null;while(m=MIXIN_MATCH.exec(text)){let matchText=m[0];let mixinName=m[1];let idx=m.index;let applyPos=idx+matchText.indexOf("@apply");let afterApplyPos=idx+matchText.length;let textBeforeApply=text.slice(0,applyPos);let textAfterApply=text.slice(afterApplyPos);let defaults=rule?this._fallbacksFromPreviousRules(rule):{};Object.assign(defaults,this._cssTextToMap(textBeforeApply));let replacement=this._atApplyToCssProperties(mixinName,defaults);text=`${textBeforeApply}${replacement}${textAfterApply}`;MIXIN_MATCH.lastIndex=idx+replacement.length}return text}_atApplyToCssProperties(mixinName,fallbacks){mixinName=mixinName.replace(APPLY_NAME_CLEAN,"");let vars=[];let mixinEntry=this._map.get(mixinName);if(!mixinEntry){this._map.set(mixinName,{});mixinEntry=this._map.get(mixinName)}if(mixinEntry){if(this._currentElement){mixinEntry.dependants[this._currentElement]=true}let p,parts,f;const properties=mixinEntry.properties;for(p in properties){f=fallbacks&&fallbacks[p];parts=[p,": var(",mixinName,MIXIN_VAR_SEP,p];if(f){parts.push(",",f.replace(IMPORTANT,""))}parts.push(")");if(IMPORTANT.test(properties[p])){parts.push(" !important")}vars.push(parts.join(""))}}return vars.join("; ")}_replaceInitialOrInherit(property,value){let match=INITIAL_INHERIT.exec(value);if(match){if(match[1]){value=this._getInitialValueForProperty(property)}else{value="apply-shim-inherit"}}return value}_cssTextToMap(text,replaceInitialOrInherit=false){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(":");if(sp.length>1){property=sp[0].trim();value=sp.slice(1).join(":");if(replaceInitialOrInherit){value=this._replaceInitialOrInherit(property,value)}out[property]=value}}}return out}_invalidateMixinEntry(mixinEntry){if(!invalidCallback){return}for(let elementName in mixinEntry.dependants){if(elementName!==this._currentElement){invalidCallback(elementName)}}}_produceCssProperties(matchText,propertyName,valueProperty,valueMixin,rule){if(valueProperty){processVariableAndFallback(valueProperty,(prefix,value)=>{if(value&&this._map.get(value)){valueMixin=`@apply ${value};`}})}if(!valueMixin){return matchText}let mixinAsProperties=this._consumeCssProperties(""+valueMixin,rule);let prefix=matchText.slice(0,matchText.indexOf("--"));let mixinValues=this._cssTextToMap(mixinAsProperties,true);let combinedProps=mixinValues;let mixinEntry=this._map.get(propertyName);let oldProps=mixinEntry&&mixinEntry.properties;if(oldProps){combinedProps=Object.assign(Object.create(oldProps),mixinValues)}else{this._map.set(propertyName,combinedProps)}let out=[];let p,v;let needToInvalidate=false;for(p in combinedProps){v=mixinValues[p];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}if(valueProperty){prefix=`${matchText};${prefix}`}return`${prefix}${out.join("; ")};`}}ApplyShim.prototype["detectMixin"]=ApplyShim.prototype.detectMixin;ApplyShim.prototype["transformStyle"]=ApplyShim.prototype.transformStyle;ApplyShim.prototype["transformCustomStyle"]=ApplyShim.prototype.transformCustomStyle;ApplyShim.prototype["transformRules"]=ApplyShim.prototype.transformRules;ApplyShim.prototype["transformRule"]=ApplyShim.prototype.transformRule;ApplyShim.prototype["transformTemplate"]=ApplyShim.prototype.transformTemplate;ApplyShim.prototype["_separator"]=MIXIN_VAR_SEP;Object.defineProperty(ApplyShim.prototype,"invalidCallback",{get(){return invalidCallback},set(cb){invalidCallback=cb}});const templateMap={};const CURRENT_VERSION="_applyShimCurrentVersion";const NEXT_VERSION="_applyShimNextVersion";const VALIDATING_VERSION="_applyShimValidatingVersion";const promise=Promise.resolve();function invalidate(elementName){let template=templateMap[elementName];if(template){invalidateTemplate(template)}}function invalidateTemplate(template){template[CURRENT_VERSION]=template[CURRENT_VERSION]||0;template[VALIDATING_VERSION]=template[VALIDATING_VERSION]||0;template[NEXT_VERSION]=(template[NEXT_VERSION]||0)+1}function templateIsValid(template){return template[CURRENT_VERSION]===template[NEXT_VERSION]}function templateIsValidating(template){return!templateIsValid(template)&&template[VALIDATING_VERSION]===template[NEXT_VERSION]}function startValidatingTemplate(template){template[VALIDATING_VERSION]=template[NEXT_VERSION];if(!template._validating){template._validating=true;promise.then(function(){template[CURRENT_VERSION]=template[NEXT_VERSION];template._validating=false})}}let readyPromise=null;let whenReady=window["HTMLImports"]&&window["HTMLImports"]["whenReady"]||null;let resolveFn;function documentWait(callback){requestAnimationFrame(function(){if(whenReady){whenReady(callback)}else{if(!readyPromise){readyPromise=new Promise(resolve=>{resolveFn=resolve});if(document.readyState==="complete"){resolveFn()}else{document.addEventListener("readystatechange",()=>{if(document.readyState==="complete"){resolveFn()}})}}readyPromise.then(function(){callback&&callback()})}})}const SEEN_MARKER="__seenByShadyCSS";const CACHED_STYLE="__shadyCSSCachedStyle";let transformFn=null;let validateFn=null;class CustomStyleInterface{constructor(){this["customStyles"]=[];this["enqueued"]=false;documentWait(()=>{if(window["ShadyCSS"]["flushCustomStyles"]){window["ShadyCSS"]["flushCustomStyles"]()}})}enqueueDocumentValidation(){if(this["enqueued"]||!validateFn){return}this["enqueued"]=true;documentWait(validateFn)}addCustomStyle(style){if(!style[SEEN_MARKER]){style[SEEN_MARKER]=true;this["customStyles"].push(style);this.enqueueDocumentValidation()}}getStyleForCustomStyle(customStyle){if(customStyle[CACHED_STYLE]){return customStyle[CACHED_STYLE]}let style;if(customStyle["getStyle"]){style=customStyle["getStyle"]()}else{style=customStyle}return style}processStyles(){const cs=this["customStyles"];for(let i=0;i<cs.length;i++){const customStyle=cs[i];if(customStyle[CACHED_STYLE]){continue}const style=this.getStyleForCustomStyle(customStyle);if(style){const styleToTransform=style["__appliedElement"]||style;if(transformFn){transformFn(styleToTransform)}customStyle[CACHED_STYLE]=styleToTransform}}return cs}}CustomStyleInterface.prototype["addCustomStyle"]=CustomStyleInterface.prototype.addCustomStyle;CustomStyleInterface.prototype["getStyleForCustomStyle"]=CustomStyleInterface.prototype.getStyleForCustomStyle;CustomStyleInterface.prototype["processStyles"]=CustomStyleInterface.prototype.processStyles;Object.defineProperties(CustomStyleInterface.prototype,{transformCallback:{get(){return transformFn},set(fn){transformFn=fn}},validateCallback:{get(){return validateFn},set(fn){let needsEnqueue=false;if(!validateFn){needsEnqueue=true}validateFn=fn;if(needsEnqueue){this.enqueueDocumentValidation()}}}});const applyShim=new ApplyShim;class ApplyShimInterface{constructor(){this.customStyleInterface=null;applyShim["invalidCallback"]=invalidate}ensure(){if(this.customStyleInterface){return}if(window.ShadyCSS.CustomStyleInterface){this.customStyleInterface=window.ShadyCSS.CustomStyleInterface;this.customStyleInterface["transformCallback"]=(style=>{applyShim.transformCustomStyle(style)});this.customStyleInterface["validateCallback"]=(()=>{requestAnimationFrame(()=>{if(this.customStyleInterface["enqueued"]){this.flushCustomStyles()}})})}}prepareTemplate(template,elementName){this.ensure();if(elementHasBuiltCss(template)){return}templateMap[elementName]=template;let ast=applyShim.transformTemplate(template,elementName);template["_styleAst"]=ast}flushCustomStyles(){this.ensure();if(!this.customStyleInterface){return}let styles=this.customStyleInterface["processStyles"]();if(!this.customStyleInterface["enqueued"]){return}for(let i=0;i<styles.length;i++){let cs=styles[i];let style=this.customStyleInterface["getStyleForCustomStyle"](cs);if(style){applyShim.transformCustomStyle(style)}}this.customStyleInterface["enqueued"]=false}styleSubtree(element,properties){this.ensure();if(properties){updateNativeProperties(element,properties)}if(element.shadowRoot){this.styleElement(element);let shadowChildren=element.shadowRoot.children||element.shadowRoot.childNodes;for(let i=0;i<shadowChildren.length;i++){this.styleSubtree(shadowChildren[i])}}else{let children=element.children||element.childNodes;for(let i=0;i<children.length;i++){this.styleSubtree(children[i])}}}styleElement(element){this.ensure();let{is:is}=getIsExtends(element);let template=templateMap[is];if(template&&elementHasBuiltCss(template)){return}if(template&&!templateIsValid(template)){if(!templateIsValidating(template)){this.prepareTemplate(template,is);startValidatingTemplate(template)}let root=element.shadowRoot;if(root){let style=root.querySelector("style");if(style){style["__cssRules"]=template["_styleAst"];style.textContent=toCssText(template["_styleAst"])}}}}styleDocument(properties){this.ensure();this.styleSubtree(document.body,properties)}}if(!window.ShadyCSS||!window.ShadyCSS.ScopingShim){const applyShimInterface=new ApplyShimInterface;let CustomStyleInterface=window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface;window.ShadyCSS={prepareTemplate(template,elementName,elementExtends){applyShimInterface.flushCustomStyles();applyShimInterface.prepareTemplate(template,elementName)},prepareTemplateStyles(template,elementName,elementExtends){window.ShadyCSS.prepareTemplate(template,elementName,elementExtends)},prepareTemplateDom(template,elementName){},styleSubtree(element,properties){applyShimInterface.flushCustomStyles();applyShimInterface.styleSubtree(element,properties)},styleElement(element){applyShimInterface.flushCustomStyles();applyShimInterface.styleElement(element)},styleDocument(properties){applyShimInterface.flushCustomStyles();applyShimInterface.styleDocument(properties)},getComputedStyleValue(element,property){return getComputedStyleValue(element,property)},flushCustomStyles(){applyShimInterface.flushCustomStyles()},nativeCss:nativeCssVariables,nativeShadow:nativeShadow,cssBuild:cssBuild,disableRuntime:disableRuntime};if(CustomStyleInterface){window.ShadyCSS.CustomStyleInterface=CustomStyleInterface}}window.ShadyCSS.ApplyShim=applyShim;let modules={};let lcModules={};function setModule(id,module){modules[id]=lcModules[id.toLowerCase()]=module}function findModule(id){return modules[id]||lcModules[id.toLowerCase()]}function styleOutsideTemplateCheck(inst){if(inst.querySelector("style")){console.warn("dom-module %s has style outside template",inst.id)}}class DomModule extends HTMLElement{static get observedAttributes(){return["id"]}static import(id,selector){if(id){let m=findModule(id);if(m&&selector){return m.querySelector(selector)}return m}return null}attributeChangedCallback(name,old,value,namespace){if(old!==value){this.register()}}get assetpath(){if(!this.__assetpath){const owner=window.HTMLImports&&HTMLImports.importForElement?HTMLImports.importForElement(this)||document:this.ownerDocument;const url=resolveUrl(this.getAttribute("assetpath")||"",owner.baseURI);this.__assetpath=pathFromUrl(url)}return this.__assetpath}register(id){id=id||this.id;if(id){if(strictTemplatePolicy&&findModule(id)!==undefined){setModule(id,null);throw new Error(`strictTemplatePolicy: dom-module ${id} re-registered`)}this.id=id;setModule(id,this);styleOutsideTemplateCheck(this)}}}DomModule.prototype["modules"]=modules;customElements.define("dom-module",DomModule);const MODULE_STYLE_LINK_SELECTOR="link[rel=import][type~=css]";const INCLUDE_ATTR="include";const SHADY_UNSCOPED_ATTR="shady-unscoped";function importModule(moduleId){return DomModule.import(moduleId)}function styleForImport(importDoc){let container=importDoc.body?importDoc.body:importDoc;const importCss=resolveCss(container.textContent,importDoc.baseURI);const style=document.createElement("style");style.textContent=importCss;return style}function stylesFromModules(moduleIds){const modules=moduleIds.trim().split(/\s+/);const styles=[];for(let i=0;i<modules.length;i++){styles.push(...stylesFromModule(modules[i]))}return styles}function stylesFromModule(moduleId){const m=importModule(moduleId);if(!m){console.warn("Could not find style data in module named",moduleId);return[]}if(m._styles===undefined){const styles=[];styles.push(..._stylesFromModuleImports(m));const template=m.querySelector("template");if(template){styles.push(...stylesFromTemplate(template,m.assetpath))}m._styles=styles}return m._styles}function stylesFromTemplate(template,baseURI){if(!template._styles){const styles=[];const e$=template.content.querySelectorAll("style");for(let i=0;i<e$.length;i++){let e=e$[i];let include=e.getAttribute(INCLUDE_ATTR);if(include){styles.push(...stylesFromModules(include).filter(function(item,index,self){return self.indexOf(item)===index}))}if(baseURI){e.textContent=resolveCss(e.textContent,baseURI)}styles.push(e)}template._styles=styles}return template._styles}function stylesFromModuleImports(moduleId){let m=importModule(moduleId);return m?_stylesFromModuleImports(m):[]}function _stylesFromModuleImports(module){const styles=[];const p$=module.querySelectorAll(MODULE_STYLE_LINK_SELECTOR);for(let i=0;i<p$.length;i++){let p=p$[i];if(p.import){const importDoc=p.import;const unscoped=p.hasAttribute(SHADY_UNSCOPED_ATTR);if(unscoped&&!importDoc._unscopedStyle){const style=styleForImport(importDoc);style.setAttribute(SHADY_UNSCOPED_ATTR,"");importDoc._unscopedStyle=style}else if(!importDoc._style){importDoc._style=styleForImport(importDoc)}styles.push(unscoped?importDoc._unscopedStyle:importDoc._style)}}return styles}function cssFromModules(moduleIds){let modules=moduleIds.trim().split(/\s+/);let cssText="";for(let i=0;i<modules.length;i++){cssText+=cssFromModule(modules[i])}return cssText}function cssFromModule(moduleId){let m=importModule(moduleId);if(m&&m._cssText===undefined){let cssText=_cssFromModuleImports(m);let t=m.querySelector("template");if(t){cssText+=cssFromTemplate(t,m.assetpath)}m._cssText=cssText||null}if(!m){console.warn("Could not find style data in module named",moduleId)}return m&&m._cssText||""}function cssFromTemplate(template,baseURI){let cssText="";const e$=stylesFromTemplate(template,baseURI);for(let i=0;i<e$.length;i++){let e=e$[i];if(e.parentNode){e.parentNode.removeChild(e)}cssText+=e.textContent}return cssText}function _cssFromModuleImports(module){let cssText="";let styles=_stylesFromModuleImports(module);for(let i=0;i<styles.length;i++){cssText+=styles[i].textContent}return cssText}function isPath(path){return path.indexOf(".")>=0}function root(path){let dotIndex=path.indexOf(".");if(dotIndex===-1){return path}return path.slice(0,dotIndex)}function isAncestor(base,path){return base.indexOf(path+".")===0}function isDescendant(base,path){return path.indexOf(base+".")===0}function translate(base,newBase,path){return newBase+path.slice(base.length)}function matches(base,path){return base===path||isAncestor(base,path)||isDescendant(base,path)}function normalize(path){if(Array.isArray(path)){let parts=[];for(let i=0;i<path.length;i++){let args=path[i].toString().split(".");for(let j=0;j<args.length;j++){parts.push(args[j])}}return parts.join(".")}else{return path}}function split(path){if(Array.isArray(path)){return normalize(path).split(".")}return path.toString().split(".")}function get(root,path,info){let prop=root;let parts=split(path);for(let i=0;i<parts.length;i++){if(!prop){return}let part=parts[i];prop=prop[part]}if(info){info.path=parts.join(".")}return prop}function set(root,path,value){let prop=root;let parts=split(path);let last=parts[parts.length-1];if(parts.length>1){for(let i=0;i<parts.length-1;i++){let part=parts[i];prop=prop[part];if(!prop){return}}prop[last]=value}else{prop[path]=value}return parts.join(".")}const caseMap={};const DASH_TO_CAMEL=/-[a-z]/g;const CAMEL_TO_DASH=/([A-Z])/g;function dashToCamelCase(dash){return caseMap[dash]||(caseMap[dash]=dash.indexOf("-")<0?dash:dash.replace(DASH_TO_CAMEL,m=>m[1].toUpperCase()))}function camelToDashCase(camel){return caseMap[camel]||(caseMap[camel]=camel.replace(CAMEL_TO_DASH,"-$1").toLowerCase())}const microtask=microTask;const PropertiesChanged=dedupingMixin(superClass=>{class PropertiesChanged extends superClass{static createProperties(props){const proto=this.prototype;for(let prop in props){if(!(prop in proto)){proto._createPropertyAccessor(prop)}}}static attributeNameForProperty(property){return property.toLowerCase()}static typeForProperty(name){}_createPropertyAccessor(property,readOnly){this._addPropertyToAttributeMap(property);if(!this.hasOwnProperty("__dataHasAccessor")){this.__dataHasAccessor=Object.assign({},this.__dataHasAccessor)}if(!this.__dataHasAccessor[property]){this.__dataHasAccessor[property]=true;this._definePropertyAccessor(property,readOnly)}}_addPropertyToAttributeMap(property){if(!this.hasOwnProperty("__dataAttributes")){this.__dataAttributes=Object.assign({},this.__dataAttributes)}if(!this.__dataAttributes[property]){const attr=this.constructor.attributeNameForProperty(property);this.__dataAttributes[attr]=property}}_definePropertyAccessor(property,readOnly){Object.defineProperty(this,property,{get(){return this._getProperty(property)},set:readOnly?function(){}:function(value){this._setProperty(property,value)}})}constructor(){super();this.__dataEnabled=false;this.__dataReady=false;this.__dataInvalid=false;this.__data={};this.__dataPending=null;this.__dataOld=null;this.__dataInstanceProps=null;this.__serializing=false;this._initializeProperties()}ready(){this.__dataReady=true;this._flushProperties()}_initializeProperties(){for(let p in this.__dataHasAccessor){if(this.hasOwnProperty(p)){this.__dataInstanceProps=this.__dataInstanceProps||{};this.__dataInstanceProps[p]=this[p];delete this[p]}}}_initializeInstanceProperties(props){Object.assign(this,props)}_setProperty(property,value){if(this._setPendingProperty(property,value)){this._invalidateProperties()}}_getProperty(property){return this.__data[property]}_setPendingProperty(property,value,ext){let old=this.__data[property];let changed=this._shouldPropertyChange(property,value,old);if(changed){if(!this.__dataPending){this.__dataPending={};this.__dataOld={}}if(this.__dataOld&&!(property in this.__dataOld)){this.__dataOld[property]=old}this.__data[property]=value;this.__dataPending[property]=value}return changed}_invalidateProperties(){if(!this.__dataInvalid&&this.__dataReady){this.__dataInvalid=true;microtask.run(()=>{if(this.__dataInvalid){this.__dataInvalid=false;this._flushProperties()}})}}_enableProperties(){if(!this.__dataEnabled){this.__dataEnabled=true;if(this.__dataInstanceProps){this._initializeInstanceProperties(this.__dataInstanceProps);this.__dataInstanceProps=null}this.ready()}}_flushProperties(){const props=this.__data;const changedProps=this.__dataPending;const old=this.__dataOld;if(this._shouldPropertiesChange(props,changedProps,old)){this.__dataPending=null;this.__dataOld=null;this._propertiesChanged(props,changedProps,old)}}_shouldPropertiesChange(currentProps,changedProps,oldProps){return Boolean(changedProps)}_propertiesChanged(currentProps,changedProps,oldProps){}_shouldPropertyChange(property,value,old){return old!==value&&(old===old||value===value)}attributeChangedCallback(name,old,value,namespace){if(old!==value){this._attributeToProperty(name,value)}if(super.attributeChangedCallback){super.attributeChangedCallback(name,old,value,namespace)}}_attributeToProperty(attribute,value,type){if(!this.__serializing){const map=this.__dataAttributes;const property=map&&map[attribute]||attribute;this[property]=this._deserializeValue(value,type||this.constructor.typeForProperty(property))}}_propertyToAttribute(property,attribute,value){this.__serializing=true;value=arguments.length<3?this[property]:value;this._valueToNodeAttribute(this,value,attribute||this.constructor.attributeNameForProperty(property));this.__serializing=false}_valueToNodeAttribute(node,value,attribute){const str=this._serializeValue(value);if(str===undefined){node.removeAttribute(attribute)}else{if(attribute==="class"||attribute==="name"||attribute==="slot"){node=wrap(node)}node.setAttribute(attribute,str)}}_serializeValue(value){switch(typeof value){case"boolean":return value?"":undefined;default:return value!=null?value.toString():undefined}}_deserializeValue(value,type){switch(type){case Boolean:return value!==null;case Number:return Number(value);default:return value}}}return PropertiesChanged});const nativeProperties={};let proto=HTMLElement.prototype;while(proto){let props=Object.getOwnPropertyNames(proto);for(let i=0;i<props.length;i++){nativeProperties[props[i]]=true}proto=Object.getPrototypeOf(proto)}function saveAccessorValue(model,property){if(!nativeProperties[property]){let value=model[property];if(value!==undefined){if(model.__data){model._setPendingProperty(property,value)}else{if(!model.__dataProto){model.__dataProto={}}else if(!model.hasOwnProperty(JSCompiler_renameProperty("__dataProto",model))){model.__dataProto=Object.create(model.__dataProto)}model.__dataProto[property]=value}}}}const PropertyAccessors=dedupingMixin(superClass=>{const base=PropertiesChanged(superClass);class PropertyAccessors extends base{static createPropertiesForAttributes(){let a$=this.observedAttributes;for(let i=0;i<a$.length;i++){this.prototype._createPropertyAccessor(dashToCamelCase(a$[i]))}}static attributeNameForProperty(property){return camelToDashCase(property)}_initializeProperties(){if(this.__dataProto){this._initializeProtoProperties(this.__dataProto);this.__dataProto=null}super._initializeProperties()}_initializeProtoProperties(props){for(let p in props){this._setProperty(p,props[p])}}_ensureAttribute(attribute,value){const el=this;if(!el.hasAttribute(attribute)){this._valueToNodeAttribute(el,value,attribute)}}_serializeValue(value){switch(typeof value){case"object":if(value instanceof Date){return value.toString()}else if(value){try{return JSON.stringify(value)}catch(x){return""}}default:return super._serializeValue(value)}}_deserializeValue(value,type){let outValue;switch(type){case Object:try{outValue=JSON.parse(value)}catch(x){outValue=value}break;case Array:try{outValue=JSON.parse(value)}catch(x){outValue=null;console.warn(`Polymer::Attributes: couldn't decode Array as JSON: ${value}`)}break;case Date:outValue=isNaN(value)?String(value):Number(value);outValue=new Date(outValue);break;default:outValue=super._deserializeValue(value,type);break}return outValue}_definePropertyAccessor(property,readOnly){saveAccessorValue(this,property);super._definePropertyAccessor(property,readOnly)}_hasAccessor(property){return this.__dataHasAccessor&&this.__dataHasAccessor[property]}_isPropertyPending(prop){return Boolean(this.__dataPending&&prop in this.__dataPending)}}return PropertyAccessors});const walker=document.createTreeWalker(document,NodeFilter.SHOW_ALL,null,false);const templateExtensions={"dom-if":true,"dom-repeat":true};function wrapTemplateExtension(node){let is=node.getAttribute("is");if(is&&templateExtensions[is]){let t=node;t.removeAttribute("is");node=t.ownerDocument.createElement(is);t.parentNode.replaceChild(node,t);node.appendChild(t);while(t.attributes.length){node.setAttribute(t.attributes[0].name,t.attributes[0].value);t.removeAttribute(t.attributes[0].name)}}return node}function findTemplateNode(root,nodeInfo){let parent=nodeInfo.parentInfo&&findTemplateNode(root,nodeInfo.parentInfo);if(parent){walker.currentNode=parent;for(let n=walker.firstChild(),i=0;n;n=walker.nextSibling()){if(nodeInfo.parentIndex===i++){return n}}}else{return root}}function applyIdToMap(inst,map,node,nodeInfo){if(nodeInfo.id){map[nodeInfo.id]=node}}function applyEventListener(inst,node,nodeInfo){if(nodeInfo.events&&nodeInfo.events.length){for(let j=0,e$=nodeInfo.events,e;j<e$.length&&(e=e$[j]);j++){inst._addMethodEventListenerToNode(node,e.name,e.value,inst)}}}function applyTemplateContent(inst,node,nodeInfo){if(nodeInfo.templateInfo){node._templateInfo=nodeInfo.templateInfo}}function createNodeEventHandler(context,eventName,methodName){context=context._methodHost||context;let handler=function(e){if(context[methodName]){context[methodName](e,e.detail)}else{console.warn("listener method `"+methodName+"` not defined")}};return handler}const TemplateStamp=dedupingMixin(superClass=>{class TemplateStamp extends superClass{static _parseTemplate(template,outerTemplateInfo){if(!template._templateInfo){let templateInfo=template._templateInfo={};templateInfo.nodeInfoList=[];templateInfo.stripWhiteSpace=outerTemplateInfo&&outerTemplateInfo.stripWhiteSpace||template.hasAttribute("strip-whitespace");this._parseTemplateContent(template,templateInfo,{parent:null})}return template._templateInfo}static _parseTemplateContent(template,templateInfo,nodeInfo){return this._parseTemplateNode(template.content,templateInfo,nodeInfo)}static _parseTemplateNode(node,templateInfo,nodeInfo){let noted;let element=node;if(element.localName=="template"&&!element.hasAttribute("preserve-content")){noted=this._parseTemplateNestedTemplate(element,templateInfo,nodeInfo)||noted}else if(element.localName==="slot"){templateInfo.hasInsertionPoint=true}walker.currentNode=element;if(walker.firstChild()){noted=this._parseTemplateChildNodes(element,templateInfo,nodeInfo)||noted}if(element.hasAttributes&&element.hasAttributes()){noted=this._parseTemplateNodeAttributes(element,templateInfo,nodeInfo)||noted}return noted}static _parseTemplateChildNodes(root,templateInfo,nodeInfo){if(root.localName==="script"||root.localName==="style"){return}walker.currentNode=root;for(let node=walker.firstChild(),parentIndex=0,next;node;node=next){if(node.localName=="template"){node=wrapTemplateExtension(node)}walker.currentNode=node;next=walker.nextSibling();if(node.nodeType===Node.TEXT_NODE){let n=next;while(n&&n.nodeType===Node.TEXT_NODE){node.textContent+=n.textContent;next=walker.nextSibling();root.removeChild(n);n=next}if(templateInfo.stripWhiteSpace&&!node.textContent.trim()){root.removeChild(node);continue}}let childInfo={parentIndex:parentIndex,parentInfo:nodeInfo};if(this._parseTemplateNode(node,templateInfo,childInfo)){childInfo.infoIndex=templateInfo.nodeInfoList.push(childInfo)-1}walker.currentNode=node;if(walker.parentNode()){parentIndex++}}}static _parseTemplateNestedTemplate(node,outerTemplateInfo,nodeInfo){let templateInfo=this._parseTemplate(node,outerTemplateInfo);let content=templateInfo.content=node.content.ownerDocument.createDocumentFragment();content.appendChild(node.content);nodeInfo.templateInfo=templateInfo;return true}static _parseTemplateNodeAttributes(node,templateInfo,nodeInfo){let noted=false;let attrs=Array.from(node.attributes);for(let i=attrs.length-1,a;a=attrs[i];i--){noted=this._parseTemplateNodeAttribute(node,templateInfo,nodeInfo,a.name,a.value)||noted}return noted}static _parseTemplateNodeAttribute(node,templateInfo,nodeInfo,name,value){if(name.slice(0,3)==="on-"){node.removeAttribute(name);nodeInfo.events=nodeInfo.events||[];nodeInfo.events.push({name:name.slice(3),value:value});return true}else if(name==="id"){nodeInfo.id=value;return true}return false}static _contentForTemplate(template){let templateInfo=template._templateInfo;return templateInfo&&templateInfo.content||template.content}_stampTemplate(template){if(template&&!template.content&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate){HTMLTemplateElement.decorate(template)}let templateInfo=this.constructor._parseTemplate(template);let nodeInfo=templateInfo.nodeInfoList;let content=templateInfo.content||template.content;let dom=document.importNode(content,true);dom.__noInsertionPoint=!templateInfo.hasInsertionPoint;let nodes=dom.nodeList=new Array(nodeInfo.length);dom.$={};for(let i=0,l=nodeInfo.length,info;i<l&&(info=nodeInfo[i]);i++){let node=nodes[i]=findTemplateNode(dom,info);applyIdToMap(this,dom.$,node,info);applyTemplateContent(this,node,info);applyEventListener(this,node,info)}dom=dom;return dom}_addMethodEventListenerToNode(node,eventName,methodName,context){context=context||node;let handler=createNodeEventHandler(context,eventName,methodName);this._addEventListenerToNode(node,eventName,handler);return handler}_addEventListenerToNode(node,eventName,handler){node.addEventListener(eventName,handler)}_removeEventListenerFromNode(node,eventName,handler){node.removeEventListener(eventName,handler)}}return TemplateStamp});let dedupeId$1=0;const TYPES={COMPUTE:"__computeEffects",REFLECT:"__reflectEffects",NOTIFY:"__notifyEffects",PROPAGATE:"__propagateEffects",OBSERVE:"__observeEffects",READ_ONLY:"__readOnly"};const capitalAttributeRegex=/[A-Z]/;function ensureOwnEffectMap(model,type){let effects=model[type];if(!effects){effects=model[type]={}}else if(!model.hasOwnProperty(type)){effects=model[type]=Object.create(model[type]);for(let p in effects){let protoFx=effects[p];let instFx=effects[p]=Array(protoFx.length);for(let i=0;i<protoFx.length;i++){instFx[i]=protoFx[i]}}}return effects}function runEffects(inst,effects,props,oldProps,hasPaths,extraArgs){if(effects){let ran=false;let id=dedupeId$1++;for(let prop in props){if(runEffectsForProperty(inst,effects,id,prop,props,oldProps,hasPaths,extraArgs)){ran=true}}return ran}return false}function runEffectsForProperty(inst,effects,dedupeId,prop,props,oldProps,hasPaths,extraArgs){let ran=false;let rootProperty=hasPaths?root(prop):prop;let fxs=effects[rootProperty];if(fxs){for(let i=0,l=fxs.length,fx;i<l&&(fx=fxs[i]);i++){if((!fx.info||fx.info.lastRun!==dedupeId)&&(!hasPaths||pathMatchesTrigger(prop,fx.trigger))){if(fx.info){fx.info.lastRun=dedupeId}fx.fn(inst,prop,props,oldProps,fx.info,hasPaths,extraArgs);ran=true}}}return ran}function pathMatchesTrigger(path,trigger){if(trigger){let triggerPath=trigger.name;return triggerPath==path||!!(trigger.structured&&isAncestor(triggerPath,path))||!!(trigger.wildcard&&isDescendant(triggerPath,path))}else{return true}}function runObserverEffect(inst,property,props,oldProps,info){let fn=typeof info.method==="string"?inst[info.method]:info.method;let changedProp=info.property;if(fn){fn.call(inst,inst.__data[changedProp],oldProps[changedProp])}else if(!info.dynamicFn){console.warn("observer method `"+info.method+"` not defined")}}function runNotifyEffects(inst,notifyProps,props,oldProps,hasPaths){let fxs=inst[TYPES.NOTIFY];let notified;let id=dedupeId$1++;for(let prop in notifyProps){if(notifyProps[prop]){if(fxs&&runEffectsForProperty(inst,fxs,id,prop,props,oldProps,hasPaths)){notified=true}else if(hasPaths&¬ifyPath(inst,prop,props)){notified=true}}}let host;if(notified&&(host=inst.__dataHost)&&host._invalidateProperties){host._invalidateProperties()}}function notifyPath(inst,path,props){let rootProperty=root(path);if(rootProperty!==path){let eventName=camelToDashCase(rootProperty)+"-changed";dispatchNotifyEvent(inst,eventName,props[path],path);return true}return false}function dispatchNotifyEvent(inst,eventName,value,path){let detail={value:value,queueProperty:true};if(path){detail.path=path}wrap(inst).dispatchEvent(new CustomEvent(eventName,{detail:detail}))}function runNotifyEffect(inst,property,props,oldProps,info,hasPaths){let rootProperty=hasPaths?root(property):property;let path=rootProperty!=property?property:null;let value=path?get(inst,path):inst.__data[property];if(path&&value===undefined){value=props[property]}dispatchNotifyEvent(inst,info.eventName,value,path)}function handleNotification(event,inst,fromProp,toPath,negate){let value;let detail=event.detail;let fromPath=detail&&detail.path;if(fromPath){toPath=translate(fromProp,toPath,fromPath);value=detail&&detail.value}else{value=event.currentTarget[fromProp]}value=negate?!value:value;if(!inst[TYPES.READ_ONLY]||!inst[TYPES.READ_ONLY][toPath]){if(inst._setPendingPropertyOrPath(toPath,value,true,Boolean(fromPath))&&(!detail||!detail.queueProperty)){inst._invalidateProperties()}}}function runReflectEffect(inst,property,props,oldProps,info){let value=inst.__data[property];if(sanitizeDOMValue){value=sanitizeDOMValue(value,info.attrName,"attribute",inst)}inst._propertyToAttribute(property,info.attrName,value)}function runComputedEffects(inst,changedProps,oldProps,hasPaths){let computeEffects=inst[TYPES.COMPUTE];if(computeEffects){let inputProps=changedProps;while(runEffects(inst,computeEffects,inputProps,oldProps,hasPaths)){Object.assign(oldProps,inst.__dataOld);Object.assign(changedProps,inst.__dataPending);inputProps=inst.__dataPending;inst.__dataPending=null}}}function runComputedEffect(inst,property,props,oldProps,info){let result=runMethodEffect(inst,property,props,oldProps,info);let computedProp=info.methodInfo;if(inst.__dataHasAccessor&&inst.__dataHasAccessor[computedProp]){inst._setPendingProperty(computedProp,result,true)}else{inst[computedProp]=result}}function computeLinkedPaths(inst,path,value){let links=inst.__dataLinkedPaths;if(links){let link;for(let a in links){let b=links[a];if(isDescendant(a,path)){link=translate(a,b,path);inst._setPendingPropertyOrPath(link,value,true,true)}else if(isDescendant(b,path)){link=translate(b,a,path);inst._setPendingPropertyOrPath(link,value,true,true)}}}}function addBinding(constructor,templateInfo,nodeInfo,kind,target,parts,literal){nodeInfo.bindings=nodeInfo.bindings||[];let binding={kind:kind,target:target,parts:parts,literal:literal,isCompound:parts.length!==1};nodeInfo.bindings.push(binding);if(shouldAddListener(binding)){let{event:event,negate:negate}=binding.parts[0];binding.listenerEvent=event||camelToDashCase(target)+"-changed";binding.listenerNegate=negate}let index=templateInfo.nodeInfoList.length;for(let i=0;i<binding.parts.length;i++){let part=binding.parts[i];part.compoundIndex=i;addEffectForBindingPart(constructor,templateInfo,binding,part,index)}}function addEffectForBindingPart(constructor,templateInfo,binding,part,index){if(!part.literal){if(binding.kind==="attribute"&&binding.target[0]==="-"){console.warn("Cannot set attribute "+binding.target+' because "-" is not a valid attribute starting character')}else{let dependencies=part.dependencies;let info={index:index,binding:binding,part:part,evaluator:constructor};for(let j=0;j<dependencies.length;j++){let trigger=dependencies[j];if(typeof trigger=="string"){trigger=parseArg(trigger);trigger.wildcard=true}constructor._addTemplatePropertyEffect(templateInfo,trigger.rootProperty,{fn:runBindingEffect,info:info,trigger:trigger})}}}}function runBindingEffect(inst,path,props,oldProps,info,hasPaths,nodeList){let node=nodeList[info.index];let binding=info.binding;let part=info.part;if(hasPaths&&part.source&&path.length>part.source.length&&binding.kind=="property"&&!binding.isCompound&&node.__isPropertyEffectsClient&&node.__dataHasAccessor&&node.__dataHasAccessor[binding.target]){let value=props[path];path=translate(part.source,binding.target,path);if(node._setPendingPropertyOrPath(path,value,false,true)){inst._enqueueClient(node)}}else{let value=info.evaluator._evaluateBinding(inst,part,path,props,oldProps,hasPaths);applyBindingValue(inst,node,binding,part,value)}}function applyBindingValue(inst,node,binding,part,value){value=computeBindingValue(node,value,binding,part);if(sanitizeDOMValue){value=sanitizeDOMValue(value,binding.target,binding.kind,node)}if(binding.kind=="attribute"){inst._valueToNodeAttribute(node,value,binding.target)}else{let prop=binding.target;if(node.__isPropertyEffectsClient&&node.__dataHasAccessor&&node.__dataHasAccessor[prop]){if(!node[TYPES.READ_ONLY]||!node[TYPES.READ_ONLY][prop]){if(node._setPendingProperty(prop,value)){inst._enqueueClient(node)}}}else{inst._setUnmanagedPropertyToNode(node,prop,value)}}}function computeBindingValue(node,value,binding,part){if(binding.isCompound){let storage=node.__dataCompoundStorage[binding.target];storage[part.compoundIndex]=value;value=storage.join("")}if(binding.kind!=="attribute"){if(binding.target==="textContent"||binding.target==="value"&&(node.localName==="input"||node.localName==="textarea")){value=value==undefined?"":value}}return value}function shouldAddListener(binding){return Boolean(binding.target)&&binding.kind!="attribute"&&binding.kind!="text"&&!binding.isCompound&&binding.parts[0].mode==="{"}function setupBindings(inst,templateInfo){let{nodeList:nodeList,nodeInfoList:nodeInfoList}=templateInfo;if(nodeInfoList.length){for(let i=0;i<nodeInfoList.length;i++){let info=nodeInfoList[i];let node=nodeList[i];let bindings=info.bindings;if(bindings){for(let i=0;i<bindings.length;i++){let binding=bindings[i];setupCompoundStorage(node,binding);addNotifyListener(node,inst,binding)}}node.__dataHost=inst}}}function setupCompoundStorage(node,binding){if(binding.isCompound){let storage=node.__dataCompoundStorage||(node.__dataCompoundStorage={});let parts=binding.parts;let literals=new Array(parts.length);for(let j=0;j<parts.length;j++){literals[j]=parts[j].literal}let target=binding.target;storage[target]=literals;if(binding.literal&&binding.kind=="property"){node[target]=binding.literal}}}function addNotifyListener(node,inst,binding){if(binding.listenerEvent){let part=binding.parts[0];node.addEventListener(binding.listenerEvent,function(e){handleNotification(e,inst,binding.target,part.source,part.negate)})}}function createMethodEffect(model,sig,type,effectFn,methodInfo,dynamicFn){dynamicFn=sig.static||dynamicFn&&(typeof dynamicFn!=="object"||dynamicFn[sig.methodName]);let info={methodName:sig.methodName,args:sig.args,methodInfo:methodInfo,dynamicFn:dynamicFn};for(let i=0,arg;i<sig.args.length&&(arg=sig.args[i]);i++){if(!arg.literal){model._addPropertyEffect(arg.rootProperty,type,{fn:effectFn,info:info,trigger:arg})}}if(dynamicFn){model._addPropertyEffect(sig.methodName,type,{fn:effectFn,info:info})}}function runMethodEffect(inst,property,props,oldProps,info){let context=inst._methodHost||inst;let fn=context[info.methodName];if(fn){let args=inst._marshalArgs(info.args,property,props);return fn.apply(context,args)}else if(!info.dynamicFn){console.warn("method `"+info.methodName+"` not defined")}}const emptyArray=[];const IDENT="(?:"+"[a-zA-Z_$][\\w.:$\\-*]*"+")";const NUMBER="(?:"+"[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?"+")";const SQUOTE_STRING="(?:"+"'(?:[^'\\\\]|\\\\.)*'"+")";const DQUOTE_STRING="(?:"+'"(?:[^"\\\\]|\\\\.)*"'+")";const STRING="(?:"+SQUOTE_STRING+"|"+DQUOTE_STRING+")";const ARGUMENT="(?:("+IDENT+"|"+NUMBER+"|"+STRING+")\\s*"+")";const ARGUMENTS="(?:"+ARGUMENT+"(?:,\\s*"+ARGUMENT+")*"+")";const ARGUMENT_LIST="(?:"+"\\(\\s*"+"(?:"+ARGUMENTS+"?"+")"+"\\)\\s*"+")";const BINDING="("+IDENT+"\\s*"+ARGUMENT_LIST+"?"+")";const OPEN_BRACKET="(\\[\\[|{{)"+"\\s*";const CLOSE_BRACKET="(?:]]|}})";const NEGATE="(?:(!)\\s*)?";const EXPRESSION=OPEN_BRACKET+NEGATE+BINDING+CLOSE_BRACKET;const bindingRegex=new RegExp(EXPRESSION,"g");function literalFromParts(parts){let s="";for(let i=0;i<parts.length;i++){let literal=parts[i].literal;s+=literal||""}return s}function parseMethod(expression){let m=expression.match(/([^\s]+?)\(([\s\S]*)\)/);if(m){let methodName=m[1];let sig={methodName:methodName,static:true,args:emptyArray};if(m[2].trim()){let args=m[2].replace(/\\,/g,",").split(",");return parseArgs(args,sig)}else{return sig}}return null}function parseArgs(argList,sig){sig.args=argList.map(function(rawArg){let arg=parseArg(rawArg);if(!arg.literal){sig.static=false}return arg},this);return sig}function parseArg(rawArg){let arg=rawArg.trim().replace(/,/g,",").replace(/\\(.)/g,"$1");let a={name:arg,value:"",literal:false};let fc=arg[0];if(fc==="-"){fc=arg[1]}if(fc>="0"&&fc<="9"){fc="#"}switch(fc){case"'":case'"':a.value=arg.slice(1,-1);a.literal=true;break;case"#":a.value=Number(arg);a.literal=true;break}if(!a.literal){a.rootProperty=root(arg);a.structured=isPath(arg);if(a.structured){a.wildcard=arg.slice(-2)==".*";if(a.wildcard){a.name=arg.slice(0,-2)}}}return a}function getArgValue(data,props,path){let value=get(data,path);if(value===undefined){value=props[path]}return value}function notifySplices(inst,array,path,splices){inst.notifyPath(path+".splices",{indexSplices:splices});inst.notifyPath(path+".length",array.length)}function notifySplice(inst,array,path,index,addedCount,removed){notifySplices(inst,array,path,[{index:index,addedCount:addedCount,removed:removed,object:array,type:"splice"}])}function upper(name){return name[0].toUpperCase()+name.substring(1)}const PropertyEffects=dedupingMixin(superClass=>{const propertyEffectsBase=TemplateStamp(PropertyAccessors(superClass));class PropertyEffects extends propertyEffectsBase{constructor(){super();this.__isPropertyEffectsClient=true;this.__dataCounter=0;this.__dataClientsReady;this.__dataPendingClients;this.__dataToNotify;this.__dataLinkedPaths;this.__dataHasPaths;this.__dataCompoundStorage;this.__dataHost;this.__dataTemp;this.__dataClientsInitialized;this.__data;this.__dataPending;this.__dataOld;this.__computeEffects;this.__reflectEffects;this.__notifyEffects;this.__propagateEffects;this.__observeEffects;this.__readOnly;this.__templateInfo}get PROPERTY_EFFECT_TYPES(){return TYPES}_initializeProperties(){super._initializeProperties();hostStack.registerHost(this);this.__dataClientsReady=false;this.__dataPendingClients=null;this.__dataToNotify=null;this.__dataLinkedPaths=null;this.__dataHasPaths=false;this.__dataCompoundStorage=this.__dataCompoundStorage||null;this.__dataHost=this.__dataHost||null;this.__dataTemp={};this.__dataClientsInitialized=false}_initializeProtoProperties(props){this.__data=Object.create(props);this.__dataPending=Object.create(props);this.__dataOld={}}_initializeInstanceProperties(props){let readOnly=this[TYPES.READ_ONLY];for(let prop in props){if(!readOnly||!readOnly[prop]){this.__dataPending=this.__dataPending||{};this.__dataOld=this.__dataOld||{};this.__data[prop]=this.__dataPending[prop]=props[prop]}}}_addPropertyEffect(property,type,effect){this._createPropertyAccessor(property,type==TYPES.READ_ONLY);let effects=ensureOwnEffectMap(this,type)[property];if(!effects){effects=this[type][property]=[]}effects.push(effect)}_removePropertyEffect(property,type,effect){let effects=ensureOwnEffectMap(this,type)[property];let idx=effects.indexOf(effect);if(idx>=0){effects.splice(idx,1)}}_hasPropertyEffect(property,type){let effects=this[type];return Boolean(effects&&effects[property])}_hasReadOnlyEffect(property){return this._hasPropertyEffect(property,TYPES.READ_ONLY)}_hasNotifyEffect(property){return this._hasPropertyEffect(property,TYPES.NOTIFY)}_hasReflectEffect(property){return this._hasPropertyEffect(property,TYPES.REFLECT)}_hasComputedEffect(property){return this._hasPropertyEffect(property,TYPES.COMPUTE)}_setPendingPropertyOrPath(path,value,shouldNotify,isPathNotification){if(isPathNotification||root(Array.isArray(path)?path[0]:path)!==path){if(!isPathNotification){let old=get(this,path);path=set(this,path,value);if(!path||!super._shouldPropertyChange(path,value,old)){return false}}this.__dataHasPaths=true;if(this._setPendingProperty(path,value,shouldNotify)){computeLinkedPaths(this,path,value);return true}}else{if(this.__dataHasAccessor&&this.__dataHasAccessor[path]){return this._setPendingProperty(path,value,shouldNotify)}else{this[path]=value}}return false}_setUnmanagedPropertyToNode(node,prop,value){if(value!==node[prop]||typeof value=="object"){node[prop]=value}}_setPendingProperty(property,value,shouldNotify){let propIsPath=this.__dataHasPaths&&isPath(property);let prevProps=propIsPath?this.__dataTemp:this.__data;if(this._shouldPropertyChange(property,value,prevProps[property])){if(!this.__dataPending){this.__dataPending={};this.__dataOld={}}if(!(property in this.__dataOld)){this.__dataOld[property]=this.__data[property]}if(propIsPath){this.__dataTemp[property]=value}else{this.__data[property]=value}this.__dataPending[property]=value;if(propIsPath||this[TYPES.NOTIFY]&&this[TYPES.NOTIFY][property]){this.__dataToNotify=this.__dataToNotify||{};this.__dataToNotify[property]=shouldNotify}return true}return false}_setProperty(property,value){if(this._setPendingProperty(property,value,true)){this._invalidateProperties()}}_invalidateProperties(){if(this.__dataReady){this._flushProperties()}}_enqueueClient(client){this.__dataPendingClients=this.__dataPendingClients||[];if(client!==this){this.__dataPendingClients.push(client)}}_flushProperties(){this.__dataCounter++;super._flushProperties();this.__dataCounter--}_flushClients(){if(!this.__dataClientsReady){this.__dataClientsReady=true;this._readyClients();this.__dataReady=true}else{this.__enableOrFlushClients()}}__enableOrFlushClients(){let clients=this.__dataPendingClients;if(clients){this.__dataPendingClients=null;for(let i=0;i<clients.length;i++){let client=clients[i];if(!client.__dataEnabled){client._enableProperties()}else if(client.__dataPending){client._flushProperties()}}}}_readyClients(){this.__enableOrFlushClients()}setProperties(props,setReadOnly){for(let path in props){if(setReadOnly||!this[TYPES.READ_ONLY]||!this[TYPES.READ_ONLY][path]){this._setPendingPropertyOrPath(path,props[path],true)}}this._invalidateProperties()}ready(){this._flushProperties();if(!this.__dataClientsReady){this._flushClients()}if(this.__dataPending){this._flushProperties()}}_propertiesChanged(currentProps,changedProps,oldProps){let hasPaths=this.__dataHasPaths;this.__dataHasPaths=false;runComputedEffects(this,changedProps,oldProps,hasPaths);let notifyProps=this.__dataToNotify;this.__dataToNotify=null;this._propagatePropertyChanges(changedProps,oldProps,hasPaths);this._flushClients();runEffects(this,this[TYPES.REFLECT],changedProps,oldProps,hasPaths);runEffects(this,this[TYPES.OBSERVE],changedProps,oldProps,hasPaths);if(notifyProps){runNotifyEffects(this,notifyProps,changedProps,oldProps,hasPaths)}if(this.__dataCounter==1){this.__dataTemp={}}}_propagatePropertyChanges(changedProps,oldProps,hasPaths){if(this[TYPES.PROPAGATE]){runEffects(this,this[TYPES.PROPAGATE],changedProps,oldProps,hasPaths)}let templateInfo=this.__templateInfo;while(templateInfo){runEffects(this,templateInfo.propertyEffects,changedProps,oldProps,hasPaths,templateInfo.nodeList);templateInfo=templateInfo.nextTemplateInfo}}linkPaths(to,from){to=normalize(to);from=normalize(from);this.__dataLinkedPaths=this.__dataLinkedPaths||{};this.__dataLinkedPaths[to]=from}unlinkPaths(path){path=normalize(path);if(this.__dataLinkedPaths){delete this.__dataLinkedPaths[path]}}notifySplices(path,splices){let info={path:""};let array=get(this,path,info);notifySplices(this,array,info.path,splices)}get(path,root){return get(root||this,path)}set(path,value,root){if(root){set(root,path,value)}else{if(!this[TYPES.READ_ONLY]||!this[TYPES.READ_ONLY][path]){if(this._setPendingPropertyOrPath(path,value,true)){this._invalidateProperties()}}}}push(path,...items){let info={path:""};let array=get(this,path,info);let len=array.length;let ret=array.push(...items);if(items.length){notifySplice(this,array,info.path,len,items.length,[])}return ret}pop(path){let info={path:""};let array=get(this,path,info);let hadLength=Boolean(array.length);let ret=array.pop();if(hadLength){notifySplice(this,array,info.path,array.length,0,[ret])}return ret}splice(path,start,deleteCount,...items){let info={path:""};let array=get(this,path,info);if(start<0){start=array.length-Math.floor(-start)}else if(start){start=Math.floor(start)}let ret;if(arguments.length===2){ret=array.splice(start)}else{ret=array.splice(start,deleteCount,...items)}if(items.length||ret.length){notifySplice(this,array,info.path,start,items.length,ret)}return ret}shift(path){let info={path:""};let array=get(this,path,info);let hadLength=Boolean(array.length);let ret=array.shift();if(hadLength){notifySplice(this,array,info.path,0,0,[ret])}return ret}unshift(path,...items){let info={path:""};let array=get(this,path,info);let ret=array.unshift(...items);if(items.length){notifySplice(this,array,info.path,0,items.length,[])}return ret}notifyPath(path,value){let propPath;if(arguments.length==1){let info={path:""};value=get(this,path,info);propPath=info.path}else if(Array.isArray(path)){propPath=normalize(path)}else{propPath=path}if(this._setPendingPropertyOrPath(propPath,value,true,true)){this._invalidateProperties()}}_createReadOnlyProperty(property,protectedSetter){this._addPropertyEffect(property,TYPES.READ_ONLY);if(protectedSetter){this["_set"+upper(property)]=function(value){this._setProperty(property,value)}}}_createPropertyObserver(property,method,dynamicFn){let info={property:property,method:method,dynamicFn:Boolean(dynamicFn)};this._addPropertyEffect(property,TYPES.OBSERVE,{fn:runObserverEffect,info:info,trigger:{name:property}});if(dynamicFn){this._addPropertyEffect(method,TYPES.OBSERVE,{fn:runObserverEffect,info:info,trigger:{name:method}})}}_createMethodObserver(expression,dynamicFn){let sig=parseMethod(expression);if(!sig){throw new Error("Malformed observer expression '"+expression+"'")}createMethodEffect(this,sig,TYPES.OBSERVE,runMethodEffect,null,dynamicFn)}_createNotifyingProperty(property){this._addPropertyEffect(property,TYPES.NOTIFY,{fn:runNotifyEffect,info:{eventName:camelToDashCase(property)+"-changed",property:property}})}_createReflectedProperty(property){let attr=this.constructor.attributeNameForProperty(property);if(attr[0]==="-"){console.warn("Property "+property+" cannot be reflected to attribute "+attr+' because "-" is not a valid starting attribute name. Use a lowercase first letter for the property instead.')}else{this._addPropertyEffect(property,TYPES.REFLECT,{fn:runReflectEffect,info:{attrName:attr}})}}_createComputedProperty(property,expression,dynamicFn){let sig=parseMethod(expression);if(!sig){throw new Error("Malformed computed expression '"+expression+"'")}createMethodEffect(this,sig,TYPES.COMPUTE,runComputedEffect,property,dynamicFn)}_marshalArgs(args,path,props){const data=this.__data;const values=[];for(let i=0,l=args.length;i<l;i++){let{name:name,structured:structured,wildcard:wildcard,value:value,literal:literal}=args[i];if(!literal){if(wildcard){const matches=isDescendant(name,path);const pathValue=getArgValue(data,props,matches?path:name);value={path:matches?path:name,value:pathValue,base:matches?get(data,name):pathValue}}else{value=structured?getArgValue(data,props,name):data[name]}}values[i]=value}return values}static addPropertyEffect(property,type,effect){this.prototype._addPropertyEffect(property,type,effect)}static createPropertyObserver(property,method,dynamicFn){this.prototype._createPropertyObserver(property,method,dynamicFn)}static createMethodObserver(expression,dynamicFn){this.prototype._createMethodObserver(expression,dynamicFn)}static createNotifyingProperty(property){this.prototype._createNotifyingProperty(property)}static createReadOnlyProperty(property,protectedSetter){this.prototype._createReadOnlyProperty(property,protectedSetter)}static createReflectedProperty(property){this.prototype._createReflectedProperty(property)}static createComputedProperty(property,expression,dynamicFn){this.prototype._createComputedProperty(property,expression,dynamicFn)}static bindTemplate(template){return this.prototype._bindTemplate(template)}_bindTemplate(template,instanceBinding){let templateInfo=this.constructor._parseTemplate(template);let wasPreBound=this.__templateInfo==templateInfo;if(!wasPreBound){for(let prop in templateInfo.propertyEffects){this._createPropertyAccessor(prop)}}if(instanceBinding){templateInfo=Object.create(templateInfo);templateInfo.wasPreBound=wasPreBound;if(!wasPreBound&&this.__templateInfo){let last=this.__templateInfoLast||this.__templateInfo;this.__templateInfoLast=last.nextTemplateInfo=templateInfo;templateInfo.previousTemplateInfo=last;return templateInfo}}return this.__templateInfo=templateInfo}static _addTemplatePropertyEffect(templateInfo,prop,effect){let hostProps=templateInfo.hostProps=templateInfo.hostProps||{};hostProps[prop]=true;let effects=templateInfo.propertyEffects=templateInfo.propertyEffects||{};let propEffects=effects[prop]=effects[prop]||[];propEffects.push(effect)}_stampTemplate(template){hostStack.beginHosting(this);let dom=super._stampTemplate(template);hostStack.endHosting(this);let templateInfo=this._bindTemplate(template,true);templateInfo.nodeList=dom.nodeList;if(!templateInfo.wasPreBound){let nodes=templateInfo.childNodes=[];for(let n=dom.firstChild;n;n=n.nextSibling){nodes.push(n)}}dom.templateInfo=templateInfo;setupBindings(this,templateInfo);if(this.__dataReady){runEffects(this,templateInfo.propertyEffects,this.__data,null,false,templateInfo.nodeList)}return dom}_removeBoundDom(dom){let templateInfo=dom.templateInfo;if(templateInfo.previousTemplateInfo){templateInfo.previousTemplateInfo.nextTemplateInfo=templateInfo.nextTemplateInfo}if(templateInfo.nextTemplateInfo){templateInfo.nextTemplateInfo.previousTemplateInfo=templateInfo.previousTemplateInfo}if(this.__templateInfoLast==templateInfo){this.__templateInfoLast=templateInfo.previousTemplateInfo}templateInfo.previousTemplateInfo=templateInfo.nextTemplateInfo=null;let nodes=templateInfo.childNodes;for(let i=0;i<nodes.length;i++){let node=nodes[i];node.parentNode.removeChild(node)}}static _parseTemplateNode(node,templateInfo,nodeInfo){let noted=super._parseTemplateNode(node,templateInfo,nodeInfo);if(node.nodeType===Node.TEXT_NODE){let parts=this._parseBindings(node.textContent,templateInfo);if(parts){node.textContent=literalFromParts(parts)||" ";addBinding(this,templateInfo,nodeInfo,"text","textContent",parts);noted=true}}return noted}static _parseTemplateNodeAttribute(node,templateInfo,nodeInfo,name,value){let parts=this._parseBindings(value,templateInfo);if(parts){let origName=name;let kind="property";if(capitalAttributeRegex.test(name)){kind="attribute"}else if(name[name.length-1]=="$"){name=name.slice(0,-1);kind="attribute"}let literal=literalFromParts(parts);if(literal&&kind=="attribute"){if(name=="class"&&node.hasAttribute("class")){literal+=" "+node.getAttribute(name)}node.setAttribute(name,literal)}if(node.localName==="input"&&origName==="value"){node.setAttribute(origName,"")}node.removeAttribute(origName);if(kind==="property"){name=dashToCamelCase(name)}addBinding(this,templateInfo,nodeInfo,kind,name,parts,literal);return true}else{return super._parseTemplateNodeAttribute(node,templateInfo,nodeInfo,name,value)}}static _parseTemplateNestedTemplate(node,templateInfo,nodeInfo){let noted=super._parseTemplateNestedTemplate(node,templateInfo,nodeInfo);let hostProps=nodeInfo.templateInfo.hostProps;let mode="{";for(let source in hostProps){let parts=[{mode:mode,source:source,dependencies:[source]}];addBinding(this,templateInfo,nodeInfo,"property","_host_"+source,parts)}return noted}static _parseBindings(text,templateInfo){let parts=[];let lastIndex=0;let m;while((m=bindingRegex.exec(text))!==null){if(m.index>lastIndex){parts.push({literal:text.slice(lastIndex,m.index)})}let mode=m[1][0];let negate=Boolean(m[2]);let source=m[3].trim();let customEvent=false,notifyEvent="",colon=-1;if(mode=="{"&&(colon=source.indexOf("::"))>0){notifyEvent=source.substring(colon+2);source=source.substring(0,colon);customEvent=true}let signature=parseMethod(source);let dependencies=[];if(signature){let{args:args,methodName:methodName}=signature;for(let i=0;i<args.length;i++){let arg=args[i];if(!arg.literal){dependencies.push(arg)}}let dynamicFns=templateInfo.dynamicFns;if(dynamicFns&&dynamicFns[methodName]||signature.static){dependencies.push(methodName);signature.dynamicFn=true}}else{dependencies.push(source)}parts.push({source:source,mode:mode,negate:negate,customEvent:customEvent,signature:signature,dependencies:dependencies,event:notifyEvent});lastIndex=bindingRegex.lastIndex}if(lastIndex&&lastIndex<text.length){let literal=text.substring(lastIndex);if(literal){parts.push({literal:literal})}}if(parts.length){return parts}else{return null}}static _evaluateBinding(inst,part,path,props,oldProps,hasPaths){let value;if(part.signature){value=runMethodEffect(inst,path,props,oldProps,part.signature)}else if(path!=part.source){value=get(inst,part.source)}else{if(hasPaths&&isPath(path)){value=get(inst,path)}else{value=inst.__data[path]}}if(part.negate){value=!value}return value}}return PropertyEffects});class HostStack{constructor(){this.stack=[]}registerHost(inst){if(this.stack.length){let host=this.stack[this.stack.length-1];host._enqueueClient(inst)}}beginHosting(inst){this.stack.push(inst)}endHosting(inst){let stackLen=this.stack.length;if(stackLen&&this.stack[stackLen-1]==inst){this.stack.pop()}}}const hostStack=new HostStack;function register$1(prototype){}function normalizeProperties(props){const output={};for(let p in props){const o=props[p];output[p]=typeof o==="function"?{type:o}:o}return output}const PropertiesMixin=dedupingMixin(superClass=>{const base=PropertiesChanged(superClass);function superPropertiesClass(constructor){const superCtor=Object.getPrototypeOf(constructor);return superCtor.prototype instanceof PropertiesMixin?superCtor:null}function ownProperties(constructor){if(!constructor.hasOwnProperty(JSCompiler_renameProperty("__ownProperties",constructor))){let props=null;if(constructor.hasOwnProperty(JSCompiler_renameProperty("properties",constructor))){const properties=constructor.properties;if(properties){props=normalizeProperties(properties)}}constructor.__ownProperties=props}return constructor.__ownProperties}class PropertiesMixin extends base{static get observedAttributes(){if(!this.hasOwnProperty("__observedAttributes")){register$1(this.prototype);const props=this._properties;this.__observedAttributes=props?Object.keys(props).map(p=>this.attributeNameForProperty(p)):[]}return this.__observedAttributes}static finalize(){if(!this.hasOwnProperty(JSCompiler_renameProperty("__finalized",this))){const superCtor=superPropertiesClass(this);if(superCtor){superCtor.finalize()}this.__finalized=true;this._finalizeClass()}}static _finalizeClass(){const props=ownProperties(this);if(props){this.createProperties(props)}}static get _properties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("__properties",this))){const superCtor=superPropertiesClass(this);this.__properties=Object.assign({},superCtor&&superCtor._properties,ownProperties(this))}return this.__properties}static typeForProperty(name){const info=this._properties[name];return info&&info.type}_initializeProperties(){this.constructor.finalize();super._initializeProperties()}connectedCallback(){if(super.connectedCallback){super.connectedCallback()}this._enableProperties()}disconnectedCallback(){if(super.disconnectedCallback){super.disconnectedCallback()}}}return PropertiesMixin});const version="3.2.0";const builtCSS=window.ShadyCSS&&window.ShadyCSS["cssBuild"];const ElementMixin=dedupingMixin(base=>{const polymerElementBase=PropertiesMixin(PropertyEffects(base));function propertyDefaults(constructor){if(!constructor.hasOwnProperty(JSCompiler_renameProperty("__propertyDefaults",constructor))){constructor.__propertyDefaults=null;let props=constructor._properties;for(let p in props){let info=props[p];if("value"in info){constructor.__propertyDefaults=constructor.__propertyDefaults||{};constructor.__propertyDefaults[p]=info}}}return constructor.__propertyDefaults}function ownObservers(constructor){if(!constructor.hasOwnProperty(JSCompiler_renameProperty("__ownObservers",constructor))){constructor.__ownObservers=constructor.hasOwnProperty(JSCompiler_renameProperty("observers",constructor))?constructor.observers:null}return constructor.__ownObservers}function createPropertyFromConfig(proto,name,info,allProps){if(info.computed){info.readOnly=true}if(info.computed){if(proto._hasReadOnlyEffect(name)){console.warn(`Cannot redefine computed property '${name}'.`)}else{proto._createComputedProperty(name,info.computed,allProps)}}if(info.readOnly&&!proto._hasReadOnlyEffect(name)){proto._createReadOnlyProperty(name,!info.computed)}else if(info.readOnly===false&&proto._hasReadOnlyEffect(name)){console.warn(`Cannot make readOnly property '${name}' non-readOnly.`)}if(info.reflectToAttribute&&!proto._hasReflectEffect(name)){proto._createReflectedProperty(name)}else if(info.reflectToAttribute===false&&proto._hasReflectEffect(name)){console.warn(`Cannot make reflected property '${name}' non-reflected.`)}if(info.notify&&!proto._hasNotifyEffect(name)){proto._createNotifyingProperty(name)}else if(info.notify===false&&proto._hasNotifyEffect(name)){console.warn(`Cannot make notify property '${name}' non-notify.`)}if(info.observer){proto._createPropertyObserver(name,info.observer,allProps[info.observer])}proto._addPropertyToAttributeMap(name)}function processElementStyles(klass,template,is,baseURI){if(!builtCSS){const templateStyles=template.content.querySelectorAll("style");const stylesWithImports=stylesFromTemplate(template);const linkedStyles=stylesFromModuleImports(is);const firstTemplateChild=template.content.firstElementChild;for(let idx=0;idx<linkedStyles.length;idx++){let s=linkedStyles[idx];s.textContent=klass._processStyleText(s.textContent,baseURI);template.content.insertBefore(s,firstTemplateChild)}let templateStyleIndex=0;for(let i=0;i<stylesWithImports.length;i++){let s=stylesWithImports[i];let templateStyle=templateStyles[templateStyleIndex];if(templateStyle!==s){s=s.cloneNode(true);templateStyle.parentNode.insertBefore(s,templateStyle)}else{templateStyleIndex++}s.textContent=klass._processStyleText(s.textContent,baseURI)}}if(window.ShadyCSS){window.ShadyCSS.prepareTemplate(template,is)}}function getTemplateFromDomModule(is){let template=null;if(is&&(!strictTemplatePolicy||allowTemplateFromDomModule)){template=DomModule.import(is,"template");if(strictTemplatePolicy&&!template){throw new Error(`strictTemplatePolicy: expecting dom-module or null template for ${is}`)}}return template}class PolymerElement extends polymerElementBase{static get polymerElementVersion(){return version}static _finalizeClass(){super._finalizeClass();const observers=ownObservers(this);if(observers){this.createObservers(observers,this._properties)}this._prepareTemplate()}static _prepareTemplate(){let template=this.template;if(template){if(typeof template==="string"){console.error("template getter must return HTMLTemplateElement");template=null}else if(!legacyOptimizations){template=template.cloneNode(true)}}this.prototype._template=template}static createProperties(props){for(let p in props){createPropertyFromConfig(this.prototype,p,props[p],props)}}static createObservers(observers,dynamicFns){const proto=this.prototype;for(let i=0;i<observers.length;i++){proto._createMethodObserver(observers[i],dynamicFns)}}static get template(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_template",this))){this._template=this.prototype.hasOwnProperty(JSCompiler_renameProperty("_template",this.prototype))?this.prototype._template:getTemplateFromDomModule(this.is)||Object.getPrototypeOf(this.prototype).constructor.template}return this._template}static set template(value){this._template=value}static get importPath(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_importPath",this))){const meta=this.importMeta;if(meta){this._importPath=pathFromUrl(meta.url)}else{const module=DomModule.import(this.is);this._importPath=module&&module.assetpath||Object.getPrototypeOf(this.prototype).constructor.importPath}}return this._importPath}constructor(){super();this._template;this._importPath;this.rootPath;this.importPath;this.root;this.$}_initializeProperties(){this.constructor.finalize();this.constructor._finalizeTemplate(this.localName);super._initializeProperties();this.rootPath=rootPath;this.importPath=this.constructor.importPath;let p$=propertyDefaults(this.constructor);if(!p$){return}for(let p in p$){let info=p$[p];if(!this.hasOwnProperty(p)){let value=typeof info.value=="function"?info.value.call(this):info.value;if(this._hasAccessor(p)){this._setPendingProperty(p,value,true)}else{this[p]=value}}}}static _processStyleText(cssText,baseURI){return resolveCss(cssText,baseURI)}static _finalizeTemplate(is){const template=this.prototype._template;if(template&&!template.__polymerFinalized){template.__polymerFinalized=true;const importPath=this.importPath;const baseURI=importPath?resolveUrl(importPath):"";processElementStyles(this,template,is,baseURI);this.prototype._bindTemplate(template)}}connectedCallback(){if(window.ShadyCSS&&this._template){window.ShadyCSS.styleElement(this)}super.connectedCallback()}ready(){if(this._template){this.root=this._stampTemplate(this._template);this.$=this.root.$}super.ready()}_readyClients(){if(this._template){this.root=this._attachDom(this.root)}super._readyClients()}_attachDom(dom){const n=wrap(this);if(n.attachShadow){if(dom){if(!n.shadowRoot){n.attachShadow({mode:"open"})}n.shadowRoot.appendChild(dom);if(syncInitialRender&&window.ShadyDOM){ShadyDOM.flushInitial(n.shadowRoot)}return n.shadowRoot}return null}else{throw new Error("ShadowDOM not available. "+"PolymerElement can create dom as children instead of in "+"ShadowDOM by setting `this.root = this;` before `ready`.")}}updateStyles(properties){if(window.ShadyCSS){window.ShadyCSS.styleSubtree(this,properties)}}resolveUrl(url,base){if(!base&&this.importPath){base=resolveUrl(this.importPath)}return resolveUrl(url,base)}static _parseTemplateContent(template,templateInfo,nodeInfo){templateInfo.dynamicFns=templateInfo.dynamicFns||this._properties;return super._parseTemplateContent(template,templateInfo,nodeInfo)}static _addTemplatePropertyEffect(templateInfo,prop,effect){if(legacyOptimizations&&!(prop in this._properties)){console.warn(`Property '${prop}' used in template but not declared in 'properties'; `+`attribute will not be observed.`)}return super._addTemplatePropertyEffect(templateInfo,prop,effect)}}return PolymerElement});const GestureEventListeners=dedupingMixin(superClass=>{class GestureEventListeners extends superClass{_addEventListenerToNode(node,eventName,handler){if(!addListener(node,eventName,handler)){super._addEventListenerToNode(node,eventName,handler)}}_removeEventListenerFromNode(node,eventName,handler){if(!removeListener(node,eventName,handler)){super._removeEventListenerFromNode(node,eventName,handler)}}}return GestureEventListeners});function resolve(){document.body.removeAttribute("unresolved")}if(document.readyState==="interactive"||document.readyState==="complete"){resolve()}else{window.addEventListener("DOMContentLoaded",resolve)}function newSplice(index,removed,addedCount){return{index:index,removed:removed,addedCount:addedCount}}const EDIT_LEAVE=0;const EDIT_UPDATE=1;const EDIT_ADD=2;const EDIT_DELETE=3;function calcEditDistances(current,currentStart,currentEnd,old,oldStart,oldEnd){let rowCount=oldEnd-oldStart+1;let columnCount=currentEnd-currentStart+1;let distances=new Array(rowCount);for(let i=0;i<rowCount;i++){distances[i]=new Array(columnCount);distances[i][0]=i}for(let j=0;j<columnCount;j++)distances[0][j]=j;for(let i=1;i<rowCount;i++){for(let j=1;j<columnCount;j++){if(equals(current[currentStart+j-1],old[oldStart+i-1]))distances[i][j]=distances[i-1][j-1];else{let north=distances[i-1][j]+1;let west=distances[i][j-1]+1;distances[i][j]=north<west?north:west}}}return distances}function spliceOperationsFromEditDistances(distances){let i=distances.length-1;let j=distances[0].length-1;let current=distances[i][j];let edits=[];while(i>0||j>0){if(i==0){edits.push(EDIT_ADD);j--;continue}if(j==0){edits.push(EDIT_DELETE);i--;continue}let northWest=distances[i-1][j-1];let west=distances[i-1][j];let north=distances[i][j-1];let min;if(west<north)min=west<northWest?west:northWest;else min=north<northWest?north:northWest;if(min==northWest){if(northWest==current){edits.push(EDIT_LEAVE)}else{edits.push(EDIT_UPDATE);current=northWest}i--;j--}else if(min==west){edits.push(EDIT_DELETE);i--;current=west}else{edits.push(EDIT_ADD);j--;current=north}}edits.reverse();return edits}function calcSplices(current,currentStart,currentEnd,old,oldStart,oldEnd){let prefixCount=0;let suffixCount=0;let splice;let minLength=Math.min(currentEnd-currentStart,oldEnd-oldStart);if(currentStart==0&&oldStart==0)prefixCount=sharedPrefix(current,old,minLength);if(currentEnd==current.length&&oldEnd==old.length)suffixCount=sharedSuffix(current,old,minLength-prefixCount);currentStart+=prefixCount;oldStart+=prefixCount;currentEnd-=suffixCount;oldEnd-=suffixCount;if(currentEnd-currentStart==0&&oldEnd-oldStart==0)return[];if(currentStart==currentEnd){splice=newSplice(currentStart,[],0);while(oldStart<oldEnd)splice.removed.push(old[oldStart++]);return[splice]}else if(oldStart==oldEnd)return[newSplice(currentStart,[],currentEnd-currentStart)];let ops=spliceOperationsFromEditDistances(calcEditDistances(current,currentStart,currentEnd,old,oldStart,oldEnd));splice=undefined;let splices=[];let index=currentStart;let oldIndex=oldStart;for(let i=0;i<ops.length;i++){switch(ops[i]){case EDIT_LEAVE:if(splice){splices.push(splice);splice=undefined}index++;oldIndex++;break;case EDIT_UPDATE:if(!splice)splice=newSplice(index,[],0);splice.addedCount++;index++;splice.removed.push(old[oldIndex]);oldIndex++;break;case EDIT_ADD:if(!splice)splice=newSplice(index,[],0);splice.addedCount++;index++;break;case EDIT_DELETE:if(!splice)splice=newSplice(index,[],0);splice.removed.push(old[oldIndex]);oldIndex++;break}}if(splice){splices.push(splice)}return splices}function sharedPrefix(current,old,searchLength){for(let i=0;i<searchLength;i++)if(!equals(current[i],old[i]))return i;return searchLength}function sharedSuffix(current,old,searchLength){let index1=current.length;let index2=old.length;let count=0;while(count<searchLength&&equals(current[--index1],old[--index2]))count++;return count}function calculateSplices(current,previous){return calcSplices(current,0,current.length,previous,0,previous.length)}function equals(currentValue,previousValue){return currentValue===previousValue}function isSlot(node){return node.localName==="slot"}let FlattenedNodesObserver=class{static getFlattenedNodes(node){const wrapped=wrap(node);if(isSlot(node)){node=node;return wrapped.assignedNodes({flatten:true})}else{return Array.from(wrapped.childNodes).map(node=>{if(isSlot(node)){node=node;return wrap(node).assignedNodes({flatten:true})}else{return[node]}}).reduce((a,b)=>a.concat(b),[])}}constructor(target,callback){this._shadyChildrenObserver=null;this._nativeChildrenObserver=null;this._connected=false;this._target=target;this.callback=callback;this._effectiveNodes=[];this._observer=null;this._scheduled=false;this._boundSchedule=(()=>{this._schedule()});this.connect();this._schedule()}connect(){if(isSlot(this._target)){this._listenSlots([this._target])}else if(wrap(this._target).children){this._listenSlots(wrap(this._target).children);if(window.ShadyDOM){this._shadyChildrenObserver=ShadyDOM.observeChildren(this._target,mutations=>{this._processMutations(mutations)})}else{this._nativeChildrenObserver=new MutationObserver(mutations=>{this._processMutations(mutations)});this._nativeChildrenObserver.observe(this._target,{childList:true})}}this._connected=true}disconnect(){if(isSlot(this._target)){this._unlistenSlots([this._target])}else if(wrap(this._target).children){this._unlistenSlots(wrap(this._target).children);if(window.ShadyDOM&&this._shadyChildrenObserver){ShadyDOM.unobserveChildren(this._shadyChildrenObserver);this._shadyChildrenObserver=null}else if(this._nativeChildrenObserver){this._nativeChildrenObserver.disconnect();this._nativeChildrenObserver=null}}this._connected=false}_schedule(){if(!this._scheduled){this._scheduled=true;microTask.run(()=>this.flush())}}_processMutations(mutations){this._processSlotMutations(mutations);this.flush()}_processSlotMutations(mutations){if(mutations){for(let i=0;i<mutations.length;i++){let mutation=mutations[i];if(mutation.addedNodes){this._listenSlots(mutation.addedNodes)}if(mutation.removedNodes){this._unlistenSlots(mutation.removedNodes)}}}}flush(){if(!this._connected){return false}if(window.ShadyDOM){ShadyDOM.flush()}if(this._nativeChildrenObserver){this._processSlotMutations(this._nativeChildrenObserver.takeRecords())}else if(this._shadyChildrenObserver){this._processSlotMutations(this._shadyChildrenObserver.takeRecords())}this._scheduled=false;let info={target:this._target,addedNodes:[],removedNodes:[]};let newNodes=this.constructor.getFlattenedNodes(this._target);let splices=calculateSplices(newNodes,this._effectiveNodes);for(let i=0,s;i<splices.length&&(s=splices[i]);i++){for(let j=0,n;j<s.removed.length&&(n=s.removed[j]);j++){info.removedNodes.push(n)}}for(let i=0,s;i<splices.length&&(s=splices[i]);i++){for(let j=s.index;j<s.index+s.addedCount;j++){info.addedNodes.push(newNodes[j])}}this._effectiveNodes=newNodes;let didFlush=false;if(info.addedNodes.length||info.removedNodes.length){didFlush=true;this.callback.call(this._target,info)}return didFlush}_listenSlots(nodeList){for(let i=0;i<nodeList.length;i++){let n=nodeList[i];if(isSlot(n)){n.addEventListener("slotchange",this._boundSchedule)}}}_unlistenSlots(nodeList){for(let i=0;i<nodeList.length;i++){let n=nodeList[i];if(isSlot(n)){n.removeEventListener("slotchange",this._boundSchedule)}}}};const flush=function(){let shadyDOM,debouncers;do{shadyDOM=window.ShadyDOM&&ShadyDOM.flush();if(window.ShadyCSS&&window.ShadyCSS.ScopingShim){window.ShadyCSS.ScopingShim.flush()}debouncers=flushDebouncers()}while(shadyDOM||debouncers)};const p=Element.prototype;const normalizedMatchesSelector=p.matches||p.matchesSelector||p.mozMatchesSelector||p.msMatchesSelector||p.oMatchesSelector||p.webkitMatchesSelector;const matchesSelector=function(node,selector){return normalizedMatchesSelector.call(node,selector)};class DomApiNative{constructor(node){this.node=node}observeNodes(callback){return new FlattenedNodesObserver(this.node,callback)}unobserveNodes(observerHandle){observerHandle.disconnect()}notifyObserver(){}deepContains(node){if(wrap(this.node).contains(node)){return true}let n=node;let doc=node.ownerDocument;while(n&&n!==doc&&n!==this.node){n=wrap(n).parentNode||wrap(n).host}return n===this.node}getOwnerRoot(){return wrap(this.node).getRootNode()}getDistributedNodes(){return this.node.localName==="slot"?wrap(this.node).assignedNodes({flatten:true}):[]}getDestinationInsertionPoints(){let ip$=[];let n=wrap(this.node).assignedSlot;while(n){ip$.push(n);n=wrap(n).assignedSlot}return ip$}importNode(node,deep){let doc=this.node instanceof Document?this.node:this.node.ownerDocument;return wrap(doc).importNode(node,deep)}getEffectiveChildNodes(){return FlattenedNodesObserver.getFlattenedNodes(this.node)}queryDistributedElements(selector){let c$=this.getEffectiveChildNodes();let list=[];for(let i=0,l=c$.length,c;i<l&&(c=c$[i]);i++){if(c.nodeType===Node.ELEMENT_NODE&&matchesSelector(c,selector)){list.push(c)}}return list}get activeElement(){let node=this.node;return node._activeElement!==undefined?node._activeElement:node.activeElement}}function forwardMethods(proto,methods){for(let i=0;i<methods.length;i++){let method=methods[i];proto[method]=function(){return this.node[method].apply(this.node,arguments)}}}function forwardReadOnlyProperties(proto,properties){for(let i=0;i<properties.length;i++){let name=properties[i];Object.defineProperty(proto,name,{get:function(){const domApi=this;return domApi.node[name]},configurable:true})}}function forwardProperties(proto,properties){for(let i=0;i<properties.length;i++){let name=properties[i];Object.defineProperty(proto,name,{get:function(){return this.node[name]},set:function(value){this.node[name]=value},configurable:true})}}class EventApi{constructor(event){this.event=event}get rootTarget(){return this.path[0]}get localTarget(){return this.event.target}get path(){return this.event.composedPath()}}DomApiNative.prototype.cloneNode;DomApiNative.prototype.appendChild;DomApiNative.prototype.insertBefore;DomApiNative.prototype.removeChild;DomApiNative.prototype.replaceChild;DomApiNative.prototype.setAttribute;DomApiNative.prototype.removeAttribute;DomApiNative.prototype.querySelector;DomApiNative.prototype.querySelectorAll;DomApiNative.prototype.parentNode;DomApiNative.prototype.firstChild;DomApiNative.prototype.lastChild;DomApiNative.prototype.nextSibling;DomApiNative.prototype.previousSibling;DomApiNative.prototype.firstElementChild;DomApiNative.prototype.lastElementChild;DomApiNative.prototype.nextElementSibling;DomApiNative.prototype.previousElementSibling;DomApiNative.prototype.childNodes;DomApiNative.prototype.children;DomApiNative.prototype.classList;DomApiNative.prototype.textContent;DomApiNative.prototype.innerHTML;let DomApiImpl=DomApiNative;if(window["ShadyDOM"]&&window["ShadyDOM"]["inUse"]&&window["ShadyDOM"]["noPatch"]&&window["ShadyDOM"]["Wrapper"]){class Wrapper extends window["ShadyDOM"]["Wrapper"]{}Object.getOwnPropertyNames(DomApiNative.prototype).forEach(prop=>{if(prop!="activeElement"){Wrapper.prototype[prop]=DomApiNative.prototype[prop]}});forwardReadOnlyProperties(Wrapper.prototype,["classList"]);DomApiImpl=Wrapper;Object.defineProperties(EventApi.prototype,{localTarget:{get(){return this.event.currentTarget},configurable:true},path:{get(){return window["ShadyDOM"]["composedPath"](this.event)},configurable:true}})}else{forwardMethods(DomApiNative.prototype,["cloneNode","appendChild","insertBefore","removeChild","replaceChild","setAttribute","removeAttribute","querySelector","querySelectorAll"]);forwardReadOnlyProperties(DomApiNative.prototype,["parentNode","firstChild","lastChild","nextSibling","previousSibling","firstElementChild","lastElementChild","nextElementSibling","previousElementSibling","childNodes","children","classList"]);forwardProperties(DomApiNative.prototype,["textContent","innerHTML"])}const dom=function(obj){obj=obj||document;if(obj instanceof DomApiImpl){return obj}if(obj instanceof EventApi){return obj}let helper=obj["__domApi"];if(!helper){if(obj instanceof Event){helper=new EventApi(obj)}else{helper=new DomApiImpl(obj)}obj["__domApi"]=helper}return helper};let styleInterface=window.ShadyCSS;const LegacyElementMixin=dedupingMixin(base=>{const legacyElementBase=GestureEventListeners(ElementMixin(base));const DIRECTION_MAP={x:"pan-x",y:"pan-y",none:"none",all:"auto"};class LegacyElement extends legacyElementBase{constructor(){super();this.isAttached;this.__boundListeners;this._debouncers}static get importMeta(){return this.prototype.importMeta}created(){}connectedCallback(){super.connectedCallback();this.isAttached=true;this.attached()}attached(){}disconnectedCallback(){super.disconnectedCallback();this.isAttached=false;this.detached()}detached(){}attributeChangedCallback(name,old,value,namespace){if(old!==value){super.attributeChangedCallback(name,old,value,namespace);this.attributeChanged(name,old,value)}}attributeChanged(name,old,value){}_initializeProperties(){let proto=Object.getPrototypeOf(this);if(!proto.hasOwnProperty("__hasRegisterFinished")){this._registered();proto.__hasRegisterFinished=true}super._initializeProperties();this.root=this;this.created();this._applyListeners()}_registered(){}ready(){this._ensureAttributes();super.ready()}_ensureAttributes(){}_applyListeners(){}serialize(value){return this._serializeValue(value)}deserialize(value,type){return this._deserializeValue(value,type)}reflectPropertyToAttribute(property,attribute,value){this._propertyToAttribute(property,attribute,value)}serializeValueToAttribute(value,attribute,node){this._valueToNodeAttribute(node||this,value,attribute)}extend(prototype,api){if(!(prototype&&api)){return prototype||api}let n$=Object.getOwnPropertyNames(api);for(let i=0,n;i<n$.length&&(n=n$[i]);i++){let pd=Object.getOwnPropertyDescriptor(api,n);if(pd){Object.defineProperty(prototype,n,pd)}}return prototype}mixin(target,source){for(let i in source){target[i]=source[i]}return target}chainObject(object,prototype){if(object&&prototype&&object!==prototype){object.__proto__=prototype}return object}instanceTemplate(template){let content=this.constructor._contentForTemplate(template);let dom=document.importNode(content,true);return dom}fire(type,detail,options){options=options||{};detail=detail===null||detail===undefined?{}:detail;let event=new Event(type,{bubbles:options.bubbles===undefined?true:options.bubbles,cancelable:Boolean(options.cancelable),composed:options.composed===undefined?true:options.composed});event.detail=detail;let node=options.node||this;wrap(node).dispatchEvent(event);return event}listen(node,eventName,methodName){node=node||this;let hbl=this.__boundListeners||(this.__boundListeners=new WeakMap);let bl=hbl.get(node);if(!bl){bl={};hbl.set(node,bl)}let key=eventName+methodName;if(!bl[key]){bl[key]=this._addMethodEventListenerToNode(node,eventName,methodName,this)}}unlisten(node,eventName,methodName){node=node||this;let bl=this.__boundListeners&&this.__boundListeners.get(node);let key=eventName+methodName;let handler=bl&&bl[key];if(handler){this._removeEventListenerFromNode(node,eventName,handler);bl[key]=null}}setScrollDirection(direction,node){setTouchAction(node||this,DIRECTION_MAP[direction]||"auto")}$$(slctr){return this.root.querySelector(slctr)}get domHost(){let root=wrap(this).getRootNode();return root instanceof DocumentFragment?root.host:root}distributeContent(){const thisEl=this;const domApi=dom(thisEl);if(window.ShadyDOM&&domApi.shadowRoot){ShadyDOM.flush()}}getEffectiveChildNodes(){const thisEl=this;const domApi=dom(thisEl);return domApi.getEffectiveChildNodes()}queryDistributedElements(selector){const thisEl=this;const domApi=dom(thisEl);return domApi.queryDistributedElements(selector)}getEffectiveChildren(){let list=this.getEffectiveChildNodes();return list.filter(function(n){return n.nodeType===Node.ELEMENT_NODE})}getEffectiveTextContent(){let cn=this.getEffectiveChildNodes();let tc=[];for(let i=0,c;c=cn[i];i++){if(c.nodeType!==Node.COMMENT_NODE){tc.push(c.textContent)}}return tc.join("")}queryEffectiveChildren(selector){let e$=this.queryDistributedElements(selector);return e$&&e$[0]}queryAllEffectiveChildren(selector){return this.queryDistributedElements(selector)}getContentChildNodes(slctr){let content=this.root.querySelector(slctr||"slot");return content?dom(content).getDistributedNodes():[]}getContentChildren(slctr){let children=this.getContentChildNodes(slctr).filter(function(n){return n.nodeType===Node.ELEMENT_NODE});return children}isLightDescendant(node){const thisNode=this;return thisNode!==node&&wrap(thisNode).contains(node)&&wrap(thisNode).getRootNode()===wrap(node).getRootNode()}isLocalDescendant(node){return this.root===wrap(node).getRootNode()}scopeSubtree(container,shouldObserve){}getComputedStyleValue(property){return styleInterface.getComputedStyleValue(this,property)}debounce(jobName,callback,wait){this._debouncers=this._debouncers||{};return this._debouncers[jobName]=Debouncer.debounce(this._debouncers[jobName],wait>0?timeOut.after(wait):microTask,callback.bind(this))}isDebouncerActive(jobName){this._debouncers=this._debouncers||{};let debouncer=this._debouncers[jobName];return!!(debouncer&&debouncer.isActive())}flushDebouncer(jobName){this._debouncers=this._debouncers||{};let debouncer=this._debouncers[jobName];if(debouncer){debouncer.flush()}}cancelDebouncer(jobName){this._debouncers=this._debouncers||{};let debouncer=this._debouncers[jobName];if(debouncer){debouncer.cancel()}}async(callback,waitTime){return waitTime>0?timeOut.run(callback.bind(this),waitTime):~microTask.run(callback.bind(this))}cancelAsync(handle){handle<0?microTask.cancel(~handle):timeOut.cancel(handle)}create(tag,props){let elt=document.createElement(tag);if(props){if(elt.setProperties){elt.setProperties(props)}else{for(let n in props){elt[n]=props[n]}}}return elt}elementMatches(selector,node){return matchesSelector(node||this,selector)}toggleAttribute(name,bool){let node=this;if(arguments.length===3){node=arguments[2]}if(arguments.length==1){bool=!node.hasAttribute(name)}if(bool){wrap(node).setAttribute(name,"");return true}else{wrap(node).removeAttribute(name);return false}}toggleClass(name,bool,node){node=node||this;if(arguments.length==1){bool=!node.classList.contains(name)}if(bool){node.classList.add(name)}else{node.classList.remove(name)}}transform(transformText,node){node=node||this;node.style.webkitTransform=transformText;node.style.transform=transformText}translate3d(x,y,z,node){node=node||this;this.transform("translate3d("+x+","+y+","+z+")",node)}arrayDelete(arrayOrPath,item){let index;if(Array.isArray(arrayOrPath)){index=arrayOrPath.indexOf(item);if(index>=0){return arrayOrPath.splice(index,1)}}else{let arr=get(this,arrayOrPath);index=arr.indexOf(item);if(index>=0){return this.splice(arrayOrPath,index,1)}}return null}_logger(level,args){if(Array.isArray(args)&&args.length===1&&Array.isArray(args[0])){args=args[0]}switch(level){case"log":case"warn":case"error":console[level](...args)}}_log(...args){this._logger("log",args)}_warn(...args){this._logger("warn",args)}_error(...args){this._logger("error",args)}_logf(methodName,...args){return["[%s::%s]",this.is,methodName,...args]}}LegacyElement.prototype.is="";return LegacyElement});const lifecycleProps={attached:true,detached:true,ready:true,created:true,beforeRegister:true,registered:true,attributeChanged:true,listeners:true,hostAttributes:true};const excludeOnInfo={attached:true,detached:true,ready:true,created:true,beforeRegister:true,registered:true,attributeChanged:true,behaviors:true,_noAccessors:true};const excludeOnBehaviors=Object.assign({listeners:true,hostAttributes:true,properties:true,observers:true},excludeOnInfo);function copyProperties(source,target,excludeProps){const noAccessors=source._noAccessors;const propertyNames=Object.getOwnPropertyNames(source);for(let i=0;i<propertyNames.length;i++){let p=propertyNames[i];if(p in excludeProps){continue}if(noAccessors){target[p]=source[p]}else{let pd=Object.getOwnPropertyDescriptor(source,p);if(pd){pd.configurable=true;Object.defineProperty(target,p,pd)}}}}function applyBehaviors(proto,behaviors,lifecycle){for(let i=0;i<behaviors.length;i++){applyInfo(proto,behaviors[i],lifecycle,excludeOnBehaviors)}}function applyInfo(proto,info,lifecycle,excludeProps){copyProperties(info,proto,excludeProps);for(let p in lifecycleProps){if(info[p]){lifecycle[p]=lifecycle[p]||[];lifecycle[p].push(info[p])}}}function flattenBehaviors(behaviors,list,exclude){list=list||[];for(let i=behaviors.length-1;i>=0;i--){let b=behaviors[i];if(b){if(Array.isArray(b)){flattenBehaviors(b,list)}else{if(list.indexOf(b)<0&&(!exclude||exclude.indexOf(b)<0)){list.unshift(b)}}}else{console.warn("behavior is null, check for missing or 404 import")}}return list}function mergeProperties(target,source){for(const p in source){const targetInfo=target[p];const sourceInfo=source[p];if(!("value"in sourceInfo)&&targetInfo&&"value"in targetInfo){target[p]=Object.assign({value:targetInfo.value},sourceInfo)}else{target[p]=sourceInfo}}}function GenerateClassFromInfo(info,Base,behaviors){let behaviorList;const lifecycle={};class PolymerGenerated extends Base{static _finalizeClass(){if(!this.hasOwnProperty(JSCompiler_renameProperty("generatedFrom",this))){super._finalizeClass()}else{if(behaviorList){for(let i=0,b;i<behaviorList.length;i++){b=behaviorList[i];if(b.properties){this.createProperties(b.properties)}if(b.observers){this.createObservers(b.observers,b.properties)}}}if(info.properties){this.createProperties(info.properties)}if(info.observers){this.createObservers(info.observers,info.properties)}this._prepareTemplate()}}static get properties(){const properties={};if(behaviorList){for(let i=0;i<behaviorList.length;i++){mergeProperties(properties,behaviorList[i].properties)}}mergeProperties(properties,info.properties);return properties}static get observers(){let observers=[];if(behaviorList){for(let i=0,b;i<behaviorList.length;i++){b=behaviorList[i];if(b.observers){observers=observers.concat(b.observers)}}}if(info.observers){observers=observers.concat(info.observers)}return observers}created(){super.created();const list=lifecycle.created;if(list){for(let i=0;i<list.length;i++){list[i].call(this)}}}_registered(){const generatedProto=PolymerGenerated.prototype;if(!generatedProto.hasOwnProperty("__hasRegisterFinished")){generatedProto.__hasRegisterFinished=true;super._registered();if(legacyOptimizations){copyPropertiesToProto(generatedProto)}const proto=Object.getPrototypeOf(this);let list=lifecycle.beforeRegister;if(list){for(let i=0;i<list.length;i++){list[i].call(proto)}}list=lifecycle.registered;if(list){for(let i=0;i<list.length;i++){list[i].call(proto)}}}}_applyListeners(){super._applyListeners();const list=lifecycle.listeners;if(list){for(let i=0;i<list.length;i++){const listeners=list[i];if(listeners){for(let l in listeners){this._addMethodEventListenerToNode(this,l,listeners[l])}}}}}_ensureAttributes(){const list=lifecycle.hostAttributes;if(list){for(let i=list.length-1;i>=0;i--){const hostAttributes=list[i];for(let a in hostAttributes){this._ensureAttribute(a,hostAttributes[a])}}}super._ensureAttributes()}ready(){super.ready();let list=lifecycle.ready;if(list){for(let i=0;i<list.length;i++){list[i].call(this)}}}attached(){super.attached();let list=lifecycle.attached;if(list){for(let i=0;i<list.length;i++){list[i].call(this)}}}detached(){super.detached();let list=lifecycle.detached;if(list){for(let i=0;i<list.length;i++){list[i].call(this)}}}attributeChanged(name,old,value){super.attributeChanged();let list=lifecycle.attributeChanged;if(list){for(let i=0;i<list.length;i++){list[i].call(this,name,old,value)}}}}if(behaviors){if(!Array.isArray(behaviors)){behaviors=[behaviors]}let superBehaviors=Base.prototype.behaviors;behaviorList=flattenBehaviors(behaviors,null,superBehaviors);PolymerGenerated.prototype.behaviors=superBehaviors?superBehaviors.concat(behaviors):behaviorList}const copyPropertiesToProto=proto=>{if(behaviorList){applyBehaviors(proto,behaviorList,lifecycle)}applyInfo(proto,info,lifecycle,excludeOnInfo)};if(!legacyOptimizations){copyPropertiesToProto(PolymerGenerated.prototype)}PolymerGenerated.generatedFrom=info;return PolymerGenerated}const Class=function(info,mixin){if(!info){console.warn("Polymer.Class requires `info` argument")}let klass=mixin?mixin(LegacyElementMixin(HTMLElement)):LegacyElementMixin(HTMLElement);klass=GenerateClassFromInfo(info,klass,info.behaviors);klass.is=klass.prototype.is=info.is;return klass};const Polymer=function(info){let klass;if(typeof info==="function"){klass=info}else{klass=Polymer.Class(info)}customElements.define(klass.is,klass);return klass};Polymer.Class=Class;function mutablePropertyChange(inst,property,value,old,mutableData){let isObject;if(mutableData){isObject=typeof value==="object"&&value!==null;if(isObject){old=inst.__dataTemp[property]}}let shouldChange=old!==value&&(old===old||value===value);if(isObject&&shouldChange){inst.__dataTemp[property]=value}return shouldChange}const MutableData=dedupingMixin(superClass=>{class MutableData extends superClass{_shouldPropertyChange(property,value,old){return mutablePropertyChange(this,property,value,old,true)}}return MutableData});const OptionalMutableData=dedupingMixin(superClass=>{class OptionalMutableData extends superClass{static get properties(){return{mutableData:Boolean}}_shouldPropertyChange(property,value,old){return mutablePropertyChange(this,property,value,old,this.mutableData)}}return OptionalMutableData});MutableData._mutablePropertyChange=mutablePropertyChange;let newInstance=null;function HTMLTemplateElementExtension(){return newInstance}HTMLTemplateElementExtension.prototype=Object.create(HTMLTemplateElement.prototype,{constructor:{value:HTMLTemplateElementExtension,writable:true}});const DataTemplate=PropertyEffects(HTMLTemplateElementExtension);const MutableDataTemplate=MutableData(DataTemplate);function upgradeTemplate(template,constructor){newInstance=template;Object.setPrototypeOf(template,constructor.prototype);new constructor;newInstance=null}const templateInstanceBase=PropertyEffects(class{});class TemplateInstanceBase extends templateInstanceBase{constructor(props){super();this._configureProperties(props);this.root=this._stampTemplate(this.__dataHost);let children=this.children=[];for(let n=this.root.firstChild;n;n=n.nextSibling){children.push(n);n.__templatizeInstance=this}if(this.__templatizeOwner&&this.__templatizeOwner.__hideTemplateChildren__){this._showHideChildren(true)}let options=this.__templatizeOptions;if(props&&options.instanceProps||!options.instanceProps){this._enableProperties()}}_configureProperties(props){let options=this.__templatizeOptions;if(options.forwardHostProp){for(let hprop in this.__hostProps){this._setPendingProperty(hprop,this.__dataHost["_host_"+hprop])}}for(let iprop in props){this._setPendingProperty(iprop,props[iprop])}}forwardHostProp(prop,value){if(this._setPendingPropertyOrPath(prop,value,false,true)){this.__dataHost._enqueueClient(this)}}_addEventListenerToNode(node,eventName,handler){if(this._methodHost&&this.__templatizeOptions.parentModel){this._methodHost._addEventListenerToNode(node,eventName,e=>{e.model=this;handler(e)})}else{let templateHost=this.__dataHost.__dataHost;if(templateHost){templateHost._addEventListenerToNode(node,eventName,handler)}}}_showHideChildren(hide){let c=this.children;for(let i=0;i<c.length;i++){let n=c[i];if(Boolean(hide)!=Boolean(n.__hideTemplateChildren__)){if(n.nodeType===Node.TEXT_NODE){if(hide){n.__polymerTextContent__=n.textContent;n.textContent=""}else{n.textContent=n.__polymerTextContent__}}else if(n.localName==="slot"){if(hide){n.__polymerReplaced__=document.createComment("hidden-slot");wrap(wrap(n).parentNode).replaceChild(n.__polymerReplaced__,n)}else{const replace=n.__polymerReplaced__;if(replace){wrap(wrap(replace).parentNode).replaceChild(n,replace)}}}else if(n.style){if(hide){n.__polymerDisplay__=n.style.display;n.style.display="none"}else{n.style.display=n.__polymerDisplay__}}}n.__hideTemplateChildren__=hide;if(n._showHideChildren){n._showHideChildren(hide)}}}_setUnmanagedPropertyToNode(node,prop,value){if(node.__hideTemplateChildren__&&node.nodeType==Node.TEXT_NODE&&prop=="textContent"){node.__polymerTextContent__=value}else{super._setUnmanagedPropertyToNode(node,prop,value)}}get parentModel(){let model=this.__parentModel;if(!model){let options;model=this;do{model=model.__dataHost.__dataHost}while((options=model.__templatizeOptions)&&!options.parentModel);this.__parentModel=model}return model}dispatchEvent(event){return true}}TemplateInstanceBase.prototype.__dataHost;TemplateInstanceBase.prototype.__templatizeOptions;TemplateInstanceBase.prototype._methodHost;TemplateInstanceBase.prototype.__templatizeOwner;TemplateInstanceBase.prototype.__hostProps;const MutableTemplateInstanceBase=MutableData(TemplateInstanceBase);function findMethodHost(template){let templateHost=template.__dataHost;return templateHost&&templateHost._methodHost||templateHost}function createTemplatizerClass(template,templateInfo,options){let templatizerBase=options.mutableData?MutableTemplateInstanceBase:TemplateInstanceBase;if(templatize.mixin){templatizerBase=templatize.mixin(templatizerBase)}let klass=class extends templatizerBase{};klass.prototype.__templatizeOptions=options;klass.prototype._bindTemplate(template);addNotifyEffects(klass,template,templateInfo,options);return klass}function addPropagateEffects(template,templateInfo,options){let userForwardHostProp=options.forwardHostProp;if(userForwardHostProp){let klass=templateInfo.templatizeTemplateClass;if(!klass){let templatizedBase=options.mutableData?MutableDataTemplate:DataTemplate;klass=templateInfo.templatizeTemplateClass=class TemplatizedTemplate extends templatizedBase{};let hostProps=templateInfo.hostProps;for(let prop in hostProps){klass.prototype._addPropertyEffect("_host_"+prop,klass.prototype.PROPERTY_EFFECT_TYPES.PROPAGATE,{fn:createForwardHostPropEffect(prop,userForwardHostProp)});klass.prototype._createNotifyingProperty("_host_"+prop)}}upgradeTemplate(template,klass);if(template.__dataProto){Object.assign(template.__data,template.__dataProto)}template.__dataTemp={};template.__dataPending=null;template.__dataOld=null;template._enableProperties()}}function createForwardHostPropEffect(hostProp,userForwardHostProp){return function forwardHostProp(template,prop,props){userForwardHostProp.call(template.__templatizeOwner,prop.substring("_host_".length),props[prop])}}function addNotifyEffects(klass,template,templateInfo,options){let hostProps=templateInfo.hostProps||{};for(let iprop in options.instanceProps){delete hostProps[iprop];let userNotifyInstanceProp=options.notifyInstanceProp;if(userNotifyInstanceProp){klass.prototype._addPropertyEffect(iprop,klass.prototype.PROPERTY_EFFECT_TYPES.NOTIFY,{fn:createNotifyInstancePropEffect(iprop,userNotifyInstanceProp)})}}if(options.forwardHostProp&&template.__dataHost){for(let hprop in hostProps){klass.prototype._addPropertyEffect(hprop,klass.prototype.PROPERTY_EFFECT_TYPES.NOTIFY,{fn:createNotifyHostPropEffect()})}}}function createNotifyInstancePropEffect(instProp,userNotifyInstanceProp){return function notifyInstanceProp(inst,prop,props){userNotifyInstanceProp.call(inst.__templatizeOwner,inst,prop,props[prop])}}function createNotifyHostPropEffect(){return function notifyHostProp(inst,prop,props){inst.__dataHost._setPendingPropertyOrPath("_host_"+prop,props[prop],true,true)}}function templatize(template,owner,options){if(strictTemplatePolicy&&!findMethodHost(template)){throw new Error("strictTemplatePolicy: template owner not trusted")}options=options||{};if(template.__templatizeOwner){throw new Error("A <template> can only be templatized once")}template.__templatizeOwner=owner;const ctor=owner?owner.constructor:TemplateInstanceBase;let templateInfo=ctor._parseTemplate(template);let baseClass=templateInfo.templatizeInstanceClass;if(!baseClass){baseClass=createTemplatizerClass(template,templateInfo,options);templateInfo.templatizeInstanceClass=baseClass}addPropagateEffects(template,templateInfo,options);let klass=class TemplateInstance extends baseClass{};klass.prototype._methodHost=findMethodHost(template);klass.prototype.__dataHost=template;klass.prototype.__templatizeOwner=owner;klass.prototype.__hostProps=templateInfo.hostProps;klass=klass;return klass}function modelForElement(template,node){let model;while(node){if(model=node.__templatizeInstance){if(model.__dataHost!=template){node=model.__dataHost}else{return model}}else{node=wrap(node).parentNode}}return null}const Templatizer={templatize(template,mutableData){this._templatizerTemplate=template;this.ctor=templatize(template,this,{mutableData:Boolean(mutableData),parentModel:this._parentModel,instanceProps:this._instanceProps,forwardHostProp:this._forwardHostPropV2,notifyInstanceProp:this._notifyInstancePropV2})},stamp(model){return new this.ctor(model)},modelForElement(el){return modelForElement(this._templatizerTemplate,el)}};const domBindBase=GestureEventListeners(OptionalMutableData(PropertyEffects(HTMLElement)));class DomBind extends domBindBase{static get observedAttributes(){return["mutable-data"]}constructor(){super();if(strictTemplatePolicy){throw new Error(`strictTemplatePolicy: dom-bind not allowed`)}this.root=null;this.$=null;this.__children=null}attributeChangedCallback(){this.mutableData=true}connectedCallback(){this.style.display="none";this.render()}disconnectedCallback(){this.__removeChildren()}__insertChildren(){wrap(wrap(this).parentNode).insertBefore(this.root,this)}__removeChildren(){if(this.__children){for(let i=0;i<this.__children.length;i++){this.root.appendChild(this.__children[i])}}}render(){let template;if(!this.__children){template=template||this.querySelector("template");if(!template){let observer=new MutationObserver(()=>{template=this.querySelector("template");if(template){observer.disconnect();this.render()}else{throw new Error("dom-bind requires a <template> child")}});observer.observe(this,{childList:true});return}this.root=this._stampTemplate(template);this.$=this.root.$;this.__children=[];for(let n=this.root.firstChild;n;n=n.nextSibling){this.__children[this.__children.length]=n}this._enableProperties()}this.__insertChildren();this.dispatchEvent(new CustomEvent("dom-change",{bubbles:true,composed:true}))}}customElements.define("dom-bind",DomBind);class LiteralString{constructor(string){this.value=string.toString()}toString(){return this.value}}function literalValue(value){if(value instanceof LiteralString){return value.value}else{throw new Error(`non-literal value passed to Polymer's htmlLiteral function: ${value}`)}}function htmlValue(value){if(value instanceof HTMLTemplateElement){return value.innerHTML}else if(value instanceof LiteralString){return literalValue(value)}else{throw new Error(`non-template value passed to Polymer's html function: ${value}`)}}const html=function html(strings,...values){const template=document.createElement("template");template.innerHTML=values.reduce((acc,v,idx)=>acc+htmlValue(v)+strings[idx+1],strings[0]);return template};const PolymerElement=ElementMixin(HTMLElement);const domRepeatBase=OptionalMutableData(PolymerElement);class DomRepeat extends domRepeatBase{static get is(){return"dom-repeat"}static get template(){return null}static get properties(){return{items:{type:Array},as:{type:String,value:"item"},indexAs:{type:String,value:"index"},itemsIndexAs:{type:String,value:"itemsIndex"},sort:{type:Function,observer:"__sortChanged"},filter:{type:Function,observer:"__filterChanged"},observe:{type:String,observer:"__observeChanged"},delay:Number,renderedItemCount:{type:Number,notify:true,readOnly:true},initialCount:{type:Number,observer:"__initializeChunking"},targetFramerate:{type:Number,value:20},_targetFrameTime:{type:Number,computed:"__computeFrameTime(targetFramerate)"}}}static get observers(){return["__itemsChanged(items.*)"]}constructor(){super();this.__instances=[];this.__limit=Infinity;this.__pool=[];this.__renderDebouncer=null;this.__itemsIdxToInstIdx={};this.__chunkCount=null;this.__lastChunkTime=null;this.__sortFn=null;this.__filterFn=null;this.__observePaths=null;this.__ctor=null;this.__isDetached=true;this.template=null}disconnectedCallback(){super.disconnectedCallback();this.__isDetached=true;for(let i=0;i<this.__instances.length;i++){this.__detachInstance(i)}}connectedCallback(){super.connectedCallback();this.style.display="none";if(this.__isDetached){this.__isDetached=false;let wrappedParent=wrap(wrap(this).parentNode);for(let i=0;i<this.__instances.length;i++){this.__attachInstance(i,wrappedParent)}}}__ensureTemplatized(){if(!this.__ctor){let template=this.template=this.querySelector("template");if(!template){let observer=new MutationObserver(()=>{if(this.querySelector("template")){observer.disconnect();this.__render()}else{throw new Error("dom-repeat requires a <template> child")}});observer.observe(this,{childList:true});return false}let instanceProps={};instanceProps[this.as]=true;instanceProps[this.indexAs]=true;instanceProps[this.itemsIndexAs]=true;this.__ctor=templatize(template,this,{mutableData:this.mutableData,parentModel:true,instanceProps:instanceProps,forwardHostProp:function(prop,value){let i$=this.__instances;for(let i=0,inst;i<i$.length&&(inst=i$[i]);i++){inst.forwardHostProp(prop,value)}},notifyInstanceProp:function(inst,prop,value){if(matches(this.as,prop)){let idx=inst[this.itemsIndexAs];if(prop==this.as){this.items[idx]=value}let path=translate(this.as,`${JSCompiler_renameProperty("items",this)}.${idx}`,prop);this.notifyPath(path,value)}}})}return true}__getMethodHost(){return this.__dataHost._methodHost||this.__dataHost}__functionFromPropertyValue(functionOrMethodName){if(typeof functionOrMethodName==="string"){let methodName=functionOrMethodName;let obj=this.__getMethodHost();return function(){return obj[methodName].apply(obj,arguments)}}return functionOrMethodName}__sortChanged(sort){this.__sortFn=this.__functionFromPropertyValue(sort);if(this.items){this.__debounceRender(this.__render)}}__filterChanged(filter){this.__filterFn=this.__functionFromPropertyValue(filter);if(this.items){this.__debounceRender(this.__render)}}__computeFrameTime(rate){return Math.ceil(1e3/rate)}__initializeChunking(){if(this.initialCount){this.__limit=this.initialCount;this.__chunkCount=this.initialCount;this.__lastChunkTime=performance.now()}}__tryRenderChunk(){if(this.items&&this.__limit<this.items.length){this.__debounceRender(this.__requestRenderChunk)}}__requestRenderChunk(){requestAnimationFrame(()=>this.__renderChunk())}__renderChunk(){let currChunkTime=performance.now();let ratio=this._targetFrameTime/(currChunkTime-this.__lastChunkTime);this.__chunkCount=Math.round(this.__chunkCount*ratio)||1;this.__limit+=this.__chunkCount;this.__lastChunkTime=currChunkTime;this.__debounceRender(this.__render)}__observeChanged(){this.__observePaths=this.observe&&this.observe.replace(".*",".").split(" ")}__itemsChanged(change){if(this.items&&!Array.isArray(this.items)){console.warn("dom-repeat expected array for `items`, found",this.items)}if(!this.__handleItemPath(change.path,change.value)){this.__initializeChunking();this.__debounceRender(this.__render)}}__handleObservedPaths(path){if(this.__sortFn||this.__filterFn){if(!path){this.__debounceRender(this.__render,this.delay)}else if(this.__observePaths){let paths=this.__observePaths;for(let i=0;i<paths.length;i++){if(path.indexOf(paths[i])===0){this.__debounceRender(this.__render,this.delay)}}}}}__debounceRender(fn,delay=0){this.__renderDebouncer=Debouncer.debounce(this.__renderDebouncer,delay>0?timeOut.after(delay):microTask,fn.bind(this));enqueueDebouncer(this.__renderDebouncer)}render(){this.__debounceRender(this.__render);flush()}__render(){if(!this.__ensureTemplatized()){return}this.__applyFullRefresh();this.__pool.length=0;this._setRenderedItemCount(this.__instances.length);this.dispatchEvent(new CustomEvent("dom-change",{bubbles:true,composed:true}));this.__tryRenderChunk()}__applyFullRefresh(){let items=this.items||[];let isntIdxToItemsIdx=new Array(items.length);for(let i=0;i<items.length;i++){isntIdxToItemsIdx[i]=i}if(this.__filterFn){isntIdxToItemsIdx=isntIdxToItemsIdx.filter((i,idx,array)=>this.__filterFn(items[i],idx,array))}if(this.__sortFn){isntIdxToItemsIdx.sort((a,b)=>this.__sortFn(items[a],items[b]))}const itemsIdxToInstIdx=this.__itemsIdxToInstIdx={};let instIdx=0;const limit=Math.min(isntIdxToItemsIdx.length,this.__limit);for(;instIdx<limit;instIdx++){let inst=this.__instances[instIdx];let itemIdx=isntIdxToItemsIdx[instIdx];let item=items[itemIdx];itemsIdxToInstIdx[itemIdx]=instIdx;if(inst){inst._setPendingProperty(this.as,item);inst._setPendingProperty(this.indexAs,instIdx);inst._setPendingProperty(this.itemsIndexAs,itemIdx);inst._flushProperties()}else{this.__insertInstance(item,instIdx,itemIdx)}}for(let i=this.__instances.length-1;i>=instIdx;i--){this.__detachAndRemoveInstance(i)}}__detachInstance(idx){let inst=this.__instances[idx];const wrappedRoot=wrap(inst.root);for(let i=0;i<inst.children.length;i++){let el=inst.children[i];wrappedRoot.appendChild(el)}return inst}__attachInstance(idx,parent){let inst=this.__instances[idx];parent.insertBefore(inst.root,this)}__detachAndRemoveInstance(idx){let inst=this.__detachInstance(idx);if(inst){this.__pool.push(inst)}this.__instances.splice(idx,1)}__stampInstance(item,instIdx,itemIdx){let model={};model[this.as]=item;model[this.indexAs]=instIdx;model[this.itemsIndexAs]=itemIdx;return new this.__ctor(model)}__insertInstance(item,instIdx,itemIdx){let inst=this.__pool.pop();if(inst){inst._setPendingProperty(this.as,item);inst._setPendingProperty(this.indexAs,instIdx);inst._setPendingProperty(this.itemsIndexAs,itemIdx);inst._flushProperties()}else{inst=this.__stampInstance(item,instIdx,itemIdx)}let beforeRow=this.__instances[instIdx+1];let beforeNode=beforeRow?beforeRow.children[0]:this;wrap(wrap(this).parentNode).insertBefore(inst.root,beforeNode);this.__instances[instIdx]=inst;return inst}_showHideChildren(hidden){for(let i=0;i<this.__instances.length;i++){this.__instances[i]._showHideChildren(hidden)}}__handleItemPath(path,value){let itemsPath=path.slice(6);let dot=itemsPath.indexOf(".");let itemsIdx=dot<0?itemsPath:itemsPath.substring(0,dot);if(itemsIdx==parseInt(itemsIdx,10)){let itemSubPath=dot<0?"":itemsPath.substring(dot+1);this.__handleObservedPaths(itemSubPath);let instIdx=this.__itemsIdxToInstIdx[itemsIdx];let inst=this.__instances[instIdx];if(inst){let itemPath=this.as+(itemSubPath?"."+itemSubPath:"");inst._setPendingPropertyOrPath(itemPath,value,false,true);inst._flushProperties()}return true}}itemForElement(el){let instance=this.modelForElement(el);return instance&&instance[this.as]}indexForElement(el){let instance=this.modelForElement(el);return instance&&instance[this.indexAs]}modelForElement(el){return modelForElement(this.template,el)}}customElements.define(DomRepeat.is,DomRepeat);class DomIf extends PolymerElement{static get is(){return"dom-if"}static get template(){return null}static get properties(){return{if:{type:Boolean,observer:"__debounceRender"},restamp:{type:Boolean,observer:"__debounceRender"}}}constructor(){super();this.__renderDebouncer=null;this.__invalidProps=null;this.__instance=null;this._lastIf=false;this.__ctor=null;this.__hideTemplateChildren__=false}__debounceRender(){this.__renderDebouncer=Debouncer.debounce(this.__renderDebouncer,microTask,()=>this.__render());enqueueDebouncer(this.__renderDebouncer)}disconnectedCallback(){super.disconnectedCallback();const parent=wrap(this).parentNode;if(!parent||parent.nodeType==Node.DOCUMENT_FRAGMENT_NODE&&!wrap(parent).host){this.__teardownInstance()}}connectedCallback(){super.connectedCallback();this.style.display="none";if(this.if){this.__debounceRender()}}render(){flush()}__render(){if(this.if){if(!this.__ensureInstance()){return}this._showHideChildren()}else if(this.restamp){this.__teardownInstance()}if(!this.restamp&&this.__instance){this._showHideChildren()}if(this.if!=this._lastIf){this.dispatchEvent(new CustomEvent("dom-change",{bubbles:true,composed:true}));this._lastIf=this.if}}__ensureInstance(){let parentNode=wrap(this).parentNode;if(parentNode){if(!this.__ctor){let template=wrap(this).querySelector("template");if(!template){let observer=new MutationObserver(()=>{if(wrap(this).querySelector("template")){observer.disconnect();this.__render()}else{throw new Error("dom-if requires a <template> child")}});observer.observe(this,{childList:true});return false}this.__ctor=templatize(template,this,{mutableData:true,forwardHostProp:function(prop,value){if(this.__instance){if(this.if){this.__instance.forwardHostProp(prop,value)}else{this.__invalidProps=this.__invalidProps||Object.create(null);this.__invalidProps[root(prop)]=true}}}})}if(!this.__instance){this.__instance=new this.__ctor;wrap(parentNode).insertBefore(this.__instance.root,this)}else{this.__syncHostProperties();let c$=this.__instance.children;if(c$&&c$.length){let lastChild=wrap(this).previousSibling;if(lastChild!==c$[c$.length-1]){for(let i=0,n;i<c$.length&&(n=c$[i]);i++){wrap(parentNode).insertBefore(n,this)}}}}}return true}__syncHostProperties(){let props=this.__invalidProps;if(props){for(let prop in props){this.__instance._setPendingProperty(prop,this.__dataHost[prop])}this.__invalidProps=null;this.__instance._flushProperties()}}__teardownInstance(){if(this.__instance){let c$=this.__instance.children;if(c$&&c$.length){let parent=wrap(c$[0]).parentNode;if(parent){parent=wrap(parent);for(let i=0,n;i<c$.length&&(n=c$[i]);i++){parent.removeChild(n)}}}this.__instance=null;this.__invalidProps=null}}_showHideChildren(){let hidden=this.__hideTemplateChildren__||!this.if;if(this.__instance){this.__instance._showHideChildren(hidden)}}}customElements.define(DomIf.is,DomIf);let ArraySelectorMixin=dedupingMixin(superClass=>{let elementBase=ElementMixin(superClass);class ArraySelectorMixin extends elementBase{static get properties(){return{items:{type:Array},multi:{type:Boolean,value:false},selected:{type:Object,notify:true},selectedItem:{type:Object,notify:true},toggle:{type:Boolean,value:false}}}static get observers(){return["__updateSelection(multi, items.*)"]}constructor(){super();this.__lastItems=null;this.__lastMulti=null;this.__selectedMap=null}__updateSelection(multi,itemsInfo){let path=itemsInfo.path;if(path==JSCompiler_renameProperty("items",this)){let newItems=itemsInfo.base||[];let lastItems=this.__lastItems;let lastMulti=this.__lastMulti;if(multi!==lastMulti){this.clearSelection()}if(lastItems){let splices=calculateSplices(newItems,lastItems);this.__applySplices(splices)}this.__lastItems=newItems;this.__lastMulti=multi}else if(itemsInfo.path==`${JSCompiler_renameProperty("items",this)}.splices`){this.__applySplices(itemsInfo.value.indexSplices)}else{let part=path.slice(`${JSCompiler_renameProperty("items",this)}.`.length);let idx=parseInt(part,10);if(part.indexOf(".")<0&&part==idx){this.__deselectChangedIdx(idx)}}}__applySplices(splices){let selected=this.__selectedMap;for(let i=0;i<splices.length;i++){let s=splices[i];selected.forEach((idx,item)=>{if(idx<s.index);else if(idx>=s.index+s.removed.length){selected.set(item,idx+s.addedCount-s.removed.length)}else{selected.set(item,-1)}});for(let j=0;j<s.addedCount;j++){let idx=s.index+j;if(selected.has(this.items[idx])){selected.set(this.items[idx],idx)}}}this.__updateLinks();let sidx=0;selected.forEach((idx,item)=>{if(idx<0){if(this.multi){this.splice(JSCompiler_renameProperty("selected",this),sidx,1)}else{this.selected=this.selectedItem=null}selected.delete(item)}else{sidx++}})}__updateLinks(){this.__dataLinkedPaths={};if(this.multi){let sidx=0;this.__selectedMap.forEach(idx=>{if(idx>=0){this.linkPaths(`${JSCompiler_renameProperty("items",this)}.${idx}`,`${JSCompiler_renameProperty("selected",this)}.${sidx++}`)}})}else{this.__selectedMap.forEach(idx=>{this.linkPaths(JSCompiler_renameProperty("selected",this),`${JSCompiler_renameProperty("items",this)}.${idx}`);this.linkPaths(JSCompiler_renameProperty("selectedItem",this),`${JSCompiler_renameProperty("items",this)}.${idx}`)})}}clearSelection(){this.__dataLinkedPaths={};this.__selectedMap=new Map;this.selected=this.multi?[]:null;this.selectedItem=null}isSelected(item){return this.__selectedMap.has(item)}isIndexSelected(idx){return this.isSelected(this.items[idx])}__deselectChangedIdx(idx){let sidx=this.__selectedIndexForItemIndex(idx);if(sidx>=0){let i=0;this.__selectedMap.forEach((idx,item)=>{if(sidx==i++){this.deselect(item)}})}}__selectedIndexForItemIndex(idx){let selected=this.__dataLinkedPaths[`${JSCompiler_renameProperty("items",this)}.${idx}`];if(selected){return parseInt(selected.slice(`${JSCompiler_renameProperty("selected",this)}.`.length),10)}}deselect(item){let idx=this.__selectedMap.get(item);if(idx>=0){this.__selectedMap.delete(item);let sidx;if(this.multi){sidx=this.__selectedIndexForItemIndex(idx)}this.__updateLinks();if(this.multi){this.splice(JSCompiler_renameProperty("selected",this),sidx,1)}else{this.selected=this.selectedItem=null}}}deselectIndex(idx){this.deselect(this.items[idx])}select(item){this.selectIndex(this.items.indexOf(item))}selectIndex(idx){let item=this.items[idx];if(!this.isSelected(item)){if(!this.multi){this.__selectedMap.clear()}this.__selectedMap.set(item,idx);this.__updateLinks();if(this.multi){this.push(JSCompiler_renameProperty("selected",this),item)}else{this.selected=this.selectedItem=item}}else if(this.toggle){this.deselectIndex(idx)}}}return ArraySelectorMixin});let baseArraySelector=ArraySelectorMixin(PolymerElement);class ArraySelector extends baseArraySelector{static get is(){return"array-selector"}static get template(){return null}}customElements.define(ArraySelector.is,ArraySelector);const customStyleInterface=new CustomStyleInterface;if(!window.ShadyCSS){window.ShadyCSS={prepareTemplate(template,elementName,elementExtends){},prepareTemplateDom(template,elementName){},prepareTemplateStyles(template,elementName,elementExtends){},styleSubtree(element,properties){customStyleInterface.processStyles();updateNativeProperties(element,properties)},styleElement(element){customStyleInterface.processStyles()},styleDocument(properties){customStyleInterface.processStyles();updateNativeProperties(document.body,properties)},getComputedStyleValue(element,property){return getComputedStyleValue(element,property)},flushCustomStyles(){},nativeCss:nativeCssVariables,nativeShadow:nativeShadow,cssBuild:cssBuild,disableRuntime:disableRuntime}}window.ShadyCSS.CustomStyleInterface=customStyleInterface;const attr="include";const CustomStyleInterface$1=window.ShadyCSS.CustomStyleInterface;class CustomStyle extends HTMLElement{constructor(){super();this._style=null;CustomStyleInterface$1.addCustomStyle(this)}getStyle(){if(this._style){return this._style}const style=this.querySelector("style");if(!style){return null}this._style=style;const include=style.getAttribute(attr);if(include){style.removeAttribute(attr);style.textContent=cssFromModules(include)+style.textContent}if(this.ownerDocument!==window.document){window.document.head.appendChild(this)}return this._style}}window.customElements.define("custom-style",CustomStyle);let mutablePropertyChange$1;(()=>{mutablePropertyChange$1=MutableData._mutablePropertyChange})();const OptionalMutableDataBehavior={properties:{mutableData:Boolean},_shouldPropertyChange(property,value,old){return mutablePropertyChange$1(this,property,value,old,this.mutableData)}};const Base=LegacyElementMixin(HTMLElement).prototype;export{Base,Debouncer,OptionalMutableDataBehavior,Polymer,PolymerElement,TemplateInstanceBase,Templatizer,afterNextRender,animationFrame,beforeNextRender,dashToCamelCase,dom,enqueueDebouncer,flush,gestures$1 as gestures,html,idlePeriod,matches,microTask,translate,useShadow};
\ No newline at end of file diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/apply-shim.html b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/apply-shim.html deleted file mode 100644 index d344ec3721b..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/apply-shim.html +++ /dev/null @@ -1,10 +0,0 @@ -<!-- -@license -Copyright (c) 2017 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 ---> -<script src="apply-shim.min.js"></script> diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/apply-shim.min.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/apply-shim.min.js deleted file mode 100644 index fb2ddeedb2d..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/apply-shim.min.js +++ /dev/null @@ -1,32 +0,0 @@ -(function(){/* - -Copyright (c) 2017 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';var l=!(window.ShadyDOM&&window.ShadyDOM.inUse),p;function r(a){p=a&&a.shimcssproperties?!1:l||!(navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)||!window.CSS||!CSS.supports||!CSS.supports("box-shadow","0 0 0 var(--foo)"))}var t;window.ShadyCSS&&void 0!==window.ShadyCSS.cssBuild&&(t=window.ShadyCSS.cssBuild);var aa=!(!window.ShadyCSS||!window.ShadyCSS.disableRuntime); -window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?p=window.ShadyCSS.nativeCss:window.ShadyCSS?(r(window.ShadyCSS),window.ShadyCSS=void 0):r(window.WebComponents&&window.WebComponents.flags);var u=p,v=t;function w(){this.end=this.start=0;this.rules=this.parent=this.previous=null;this.cssText=this.parsedCssText="";this.atRule=!1;this.type=0;this.parsedSelector=this.selector=this.keyframesName=""} -function x(a){a=a.replace(ba,"").replace(ca,"");var b=y,c=a,e=new w;e.start=0;e.end=c.length;for(var d=e,f=0,g=c.length;f<g;f++)if("{"===c[f]){d.rules||(d.rules=[]);var h=d,k=h.rules[h.rules.length-1]||null;d=new w;d.start=f+1;d.parent=h;d.previous=k;h.rules.push(d)}else"}"===c[f]&&(d.end=f+1,d=d.parent||e);return b(e,a)} -function y(a,b){var c=b.substring(a.start,a.end-1);a.parsedCssText=a.cssText=c.trim();a.parent&&(c=b.substring(a.previous?a.previous.end:a.parent.start,a.start-1),c=da(c),c=c.replace(z," "),c=c.substring(c.lastIndexOf(";")+1),c=a.parsedSelector=a.selector=c.trim(),a.atRule=0===c.indexOf("@"),a.atRule?0===c.indexOf("@media")?a.type=A:c.match(ea)&&(a.type=B,a.keyframesName=a.selector.split(z).pop()):a.type=0===c.indexOf("--")?C:D);if(c=a.rules)for(var e=0,d=c.length,f=void 0;e<d&&(f=c[e]);e++)y(f,b); -return a}function da(a){return a.replace(/\\([0-9a-f]{1,6})\s/gi,function(a,c){a=c;for(c=6-a.length;c--;)a="0"+a;return"\\"+a})} -function E(a,b,c){c=void 0===c?"":c;var e="";if(a.cssText||a.rules){var d=a.rules,f;if(f=d)f=d[0],f=!(f&&f.selector&&0===f.selector.indexOf("--"));if(f){f=0;for(var g=d.length,h=void 0;f<g&&(h=d[f]);f++)e=E(h,b,e)}else b?b=a.cssText:(b=a.cssText,b=b.replace(fa,"").replace(ha,""),b=b.replace(ia,"").replace(ja,"")),(e=b.trim())&&(e=" "+e+"\n")}e&&(a.selector&&(c+=a.selector+" {\n"),c+=e,a.selector&&(c+="}\n\n"));return c} -var D=1,B=7,A=4,C=1E3,ba=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,ca=/@import[^;]*;/gim,fa=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,ha=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,ia=/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,ja=/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,ea=/^@[^\s]*keyframes/,z=/\s+/g;var G=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi,H=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,ka=/@media\s(.*)/;var I=new Set;function J(a){if(!a)return"";"string"===typeof a&&(a=x(a));return E(a,u)}function K(a){!a.__cssRules&&a.textContent&&(a.__cssRules=x(a.textContent));return a.__cssRules||null}function L(a,b,c,e){if(a){var d=!1,f=a.type;if(e&&f===A){var g=a.selector.match(ka);g&&(window.matchMedia(g[1]).matches||(d=!0))}f===D?b(a):c&&f===B?c(a):f===C&&(d=!0);if((a=a.rules)&&!d)for(d=0,f=a.length,g=void 0;d<f&&(g=a[d]);d++)L(g,b,c,e)}} -function M(a,b){var c=a.indexOf("var(");if(-1===c)return b(a,"","","");a:{var e=0;var d=c+3;for(var f=a.length;d<f;d++)if("("===a[d])e++;else if(")"===a[d]&&0===--e)break a;d=-1}e=a.substring(c+4,d);c=a.substring(0,c);a=M(a.substring(d+1),b);d=e.indexOf(",");return-1===d?b(c,e.trim(),"",a):b(c,e.substring(0,d).trim(),e.substring(d+1).trim(),a)} -function N(a){if(void 0!==v)return v;if(void 0===a.__cssBuild){var b=a.getAttribute("css-build");if(b)a.__cssBuild=b;else{a:{b="template"===a.localName?a.content.firstChild:a.firstChild;if(b instanceof Comment&&(b=b.textContent.trim().split(":"),"css-build"===b[0])){b=b[1];break a}b=""}if(""!==b){var c="template"===a.localName?a.content.firstChild:a.firstChild;c.parentNode.removeChild(c)}a.__cssBuild=b}}return a.__cssBuild||""};var la=/;\s*/m,ma=/^\s*(initial)|(inherit)\s*$/,O=/\s*!important/;function P(){this.a={}}P.prototype.set=function(a,b){a=a.trim();this.a[a]={h:b,i:{}}};P.prototype.get=function(a){a=a.trim();return this.a[a]||null};var Q=null;function R(){this.b=this.c=null;this.a=new P}R.prototype.o=function(a){a=H.test(a)||G.test(a);H.lastIndex=0;G.lastIndex=0;return a}; -R.prototype.m=function(a,b){if(void 0===a._gatheredStyle){var c=[];for(var e=a.content.querySelectorAll("style"),d=0;d<e.length;d++){var f=e[d];if(f.hasAttribute("shady-unscoped")){if(!l){var g=f.textContent;I.has(g)||(I.add(g),g=f.cloneNode(!0),document.head.appendChild(g));f.parentNode.removeChild(f)}}else c.push(f.textContent),f.parentNode.removeChild(f)}(c=c.join("").trim())?(e=document.createElement("style"),e.textContent=c,a.content.insertBefore(e,a.content.firstChild),c=e):c=null;a._gatheredStyle= -c}return(a=a._gatheredStyle)?this.j(a,b):null};R.prototype.j=function(a,b){b=void 0===b?"":b;var c=K(a);this.l(c,b);a.textContent=J(c);return c};R.prototype.f=function(a){var b=this,c=K(a);L(c,function(a){":root"===a.selector&&(a.selector="html");b.g(a)});a.textContent=J(c);return c};R.prototype.l=function(a,b){var c=this;this.c=b;L(a,function(a){c.g(a)});this.c=null};R.prototype.g=function(a){a.cssText=na(this,a.parsedCssText,a);":root"===a.selector&&(a.selector=":host > *")}; -function na(a,b,c){b=b.replace(G,function(b,d,f,g){return oa(a,b,d,f,g,c)});return S(a,b,c)}function pa(a,b){for(var c=b;c.parent;)c=c.parent;var e={},d=!1;L(c,function(c){(d=d||c===b)||c.selector===b.selector&&Object.assign(e,T(a,c.parsedCssText))});return e} -function S(a,b,c){for(var e;e=H.exec(b);){var d=e[0],f=e[1];e=e.index;var g=b.slice(0,e+d.indexOf("@apply"));b=b.slice(e+d.length);var h=c?pa(a,c):{};Object.assign(h,T(a,g));d=void 0;var k=a;f=f.replace(la,"");var n=[];var m=k.a.get(f);m||(k.a.set(f,{}),m=k.a.get(f));if(m){k.c&&(m.i[k.c]=!0);var q=m.h;for(d in q)k=h&&h[d],m=[d,": var(",f,"_-_",d],k&&m.push(",",k.replace(O,"")),m.push(")"),O.test(q[d])&&m.push(" !important"),n.push(m.join(""))}d=n.join("; ");b=g+d+b;H.lastIndex=e+d.length}return b} -function T(a,b,c){c=void 0===c?!1:c;b=b.split(";");for(var e,d,f={},g=0,h;g<b.length;g++)if(e=b[g])if(h=e.split(":"),1<h.length){e=h[0].trim();d=h.slice(1).join(":");if(c){var k=a;h=e;var n=ma.exec(d);n&&(n[1]?(k.b||(k.b=document.createElement("meta"),k.b.setAttribute("apply-shim-measure",""),k.b.style.all="initial",document.head.appendChild(k.b)),h=window.getComputedStyle(k.b).getPropertyValue(h)):h="apply-shim-inherit",d=h)}f[e]=d}return f}function qa(a,b){if(Q)for(var c in b.i)c!==a.c&&Q(c)} -function oa(a,b,c,e,d,f){e&&M(e,function(b,c){c&&a.a.get(c)&&(d="@apply "+c+";")});if(!d)return b;var g=S(a,""+d,f);f=b.slice(0,b.indexOf("--"));var h=g=T(a,g,!0),k=a.a.get(c),n=k&&k.h;n?h=Object.assign(Object.create(n),g):a.a.set(c,h);var m=[],q,Z=!1;for(q in h){var F=g[q];void 0===F&&(F="initial");!n||q in n||(Z=!0);m.push(c+"_-_"+q+": "+F)}Z&&qa(a,k);k&&(k.h=h);e&&(f=b+";"+f);return f+m.join("; ")+";"}R.prototype.detectMixin=R.prototype.o;R.prototype.transformStyle=R.prototype.j; -R.prototype.transformCustomStyle=R.prototype.f;R.prototype.transformRules=R.prototype.l;R.prototype.transformRule=R.prototype.g;R.prototype.transformTemplate=R.prototype.m;R.prototype._separator="_-_";Object.defineProperty(R.prototype,"invalidCallback",{get:function(){return Q},set:function(a){Q=a}});var U={};var ra=Promise.resolve();function sa(a){if(a=U[a])a._applyShimCurrentVersion=a._applyShimCurrentVersion||0,a._applyShimValidatingVersion=a._applyShimValidatingVersion||0,a._applyShimNextVersion=(a._applyShimNextVersion||0)+1}function ta(a){return a._applyShimCurrentVersion===a._applyShimNextVersion}function ua(a){a._applyShimValidatingVersion=a._applyShimNextVersion;a._validating||(a._validating=!0,ra.then(function(){a._applyShimCurrentVersion=a._applyShimNextVersion;a._validating=!1}))};var V=new R;function W(){this.a=null;V.invalidCallback=sa}function X(a){!a.a&&window.ShadyCSS.CustomStyleInterface&&(a.a=window.ShadyCSS.CustomStyleInterface,a.a.transformCallback=function(a){V.f(a)},a.a.validateCallback=function(){requestAnimationFrame(function(){a.a.enqueued&&a.flushCustomStyles()})})}W.prototype.prepareTemplate=function(a,b){X(this);""===N(a)&&(U[b]=a,b=V.m(a,b),a._styleAst=b)}; -W.prototype.flushCustomStyles=function(){X(this);if(this.a){var a=this.a.processStyles();if(this.a.enqueued){for(var b=0;b<a.length;b++){var c=this.a.getStyleForCustomStyle(a[b]);c&&V.f(c)}this.a.enqueued=!1}}}; -W.prototype.styleSubtree=function(a,b){X(this);if(b)for(var c in b)null===c?a.style.removeProperty(c):a.style.setProperty(c,b[c]);if(a.shadowRoot)for(this.styleElement(a),a=a.shadowRoot.children||a.shadowRoot.childNodes,b=0;b<a.length;b++)this.styleSubtree(a[b]);else for(a=a.children||a.childNodes,b=0;b<a.length;b++)this.styleSubtree(a[b])}; -W.prototype.styleElement=function(a){X(this);var b=a.localName,c;b?-1<b.indexOf("-")?c=b:c=a.getAttribute&&a.getAttribute("is")||"":c=a.is;b=U[c];if(!(b&&""!==N(b)||!b||ta(b))){if(ta(b)||b._applyShimValidatingVersion!==b._applyShimNextVersion)this.prepareTemplate(b,c),ua(b);if(a=a.shadowRoot)if(a=a.querySelector("style"))a.__cssRules=b._styleAst,a.textContent=J(b._styleAst)}};W.prototype.styleDocument=function(a){X(this);this.styleSubtree(document.body,a)}; -if(!window.ShadyCSS||!window.ShadyCSS.ScopingShim){var Y=new W,va=window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface;window.ShadyCSS={prepareTemplate:function(a,b){Y.flushCustomStyles();Y.prepareTemplate(a,b)},prepareTemplateStyles:function(a,b,c){window.ShadyCSS.prepareTemplate(a,b,c)},prepareTemplateDom:function(){},styleSubtree:function(a,b){Y.flushCustomStyles();Y.styleSubtree(a,b)},styleElement:function(a){Y.flushCustomStyles();Y.styleElement(a)},styleDocument:function(a){Y.flushCustomStyles(); -Y.styleDocument(a)},getComputedStyleValue:function(a,b){return(a=window.getComputedStyle(a).getPropertyValue(b))?a.trim():""},flushCustomStyles:function(){Y.flushCustomStyles()},nativeCss:u,nativeShadow:l,cssBuild:v,disableRuntime:aa};va&&(window.ShadyCSS.CustomStyleInterface=va)}window.ShadyCSS.ApplyShim=V;}).call(this); - -//# sourceMappingURL=apply-shim.min.js.map diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/custom-style-interface.html b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/custom-style-interface.html deleted file mode 100644 index a3919fad810..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/custom-style-interface.html +++ /dev/null @@ -1,10 +0,0 @@ -<!-- -@license -Copyright (c) 2017 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 ---> -<script src="custom-style-interface.min.js"></script> diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/custom-style-interface.min.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/custom-style-interface.min.js deleted file mode 100644 index fb31c84b3eb..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/custom-style-interface.min.js +++ /dev/null @@ -1,15 +0,0 @@ -(function(){/* - -Copyright (c) 2017 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';var c=null,f=window.HTMLImports&&window.HTMLImports.whenReady||null,g;function h(a){requestAnimationFrame(function(){f?f(a):(c||(c=new Promise(function(a){g=a}),"complete"===document.readyState?g():document.addEventListener("readystatechange",function(){"complete"===document.readyState&&g()})),c.then(function(){a&&a()}))})};var k=null,l=null;function m(){this.customStyles=[];this.enqueued=!1;h(function(){window.ShadyCSS.flushCustomStyles&&window.ShadyCSS.flushCustomStyles()})}function n(a){!a.enqueued&&l&&(a.enqueued=!0,h(l))}m.prototype.c=function(a){a.__seenByShadyCSS||(a.__seenByShadyCSS=!0,this.customStyles.push(a),n(this))};m.prototype.b=function(a){if(a.__shadyCSSCachedStyle)return a.__shadyCSSCachedStyle;var b;a.getStyle?b=a.getStyle():b=a;return b}; -m.prototype.a=function(){for(var a=this.customStyles,b=0;b<a.length;b++){var d=a[b];if(!d.__shadyCSSCachedStyle){var e=this.b(d);e&&(e=e.__appliedElement||e,k&&k(e),d.__shadyCSSCachedStyle=e)}}return a};m.prototype.addCustomStyle=m.prototype.c;m.prototype.getStyleForCustomStyle=m.prototype.b;m.prototype.processStyles=m.prototype.a; -Object.defineProperties(m.prototype,{transformCallback:{get:function(){return k},set:function(a){k=a}},validateCallback:{get:function(){return l},set:function(a){var b=!1;l||(b=!0);l=a;b&&n(this)}}});function p(a,b){for(var d in b)null===d?a.style.removeProperty(d):a.style.setProperty(d,b[d])};var q=!(window.ShadyDOM&&window.ShadyDOM.inUse),r;function t(a){r=a&&a.shimcssproperties?!1:q||!(navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)||!window.CSS||!CSS.supports||!CSS.supports("box-shadow","0 0 0 var(--foo)"))}var u;window.ShadyCSS&&void 0!==window.ShadyCSS.cssBuild&&(u=window.ShadyCSS.cssBuild);var v=!(!window.ShadyCSS||!window.ShadyCSS.disableRuntime); -window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?r=window.ShadyCSS.nativeCss:window.ShadyCSS?(t(window.ShadyCSS),window.ShadyCSS=void 0):t(window.WebComponents&&window.WebComponents.flags);var w=r,x=u;var y=new m;window.ShadyCSS||(window.ShadyCSS={prepareTemplate:function(){},prepareTemplateDom:function(){},prepareTemplateStyles:function(){},styleSubtree:function(a,b){y.a();p(a,b)},styleElement:function(){y.a()},styleDocument:function(a){y.a();p(document.body,a)},getComputedStyleValue:function(a,b){return(a=window.getComputedStyle(a).getPropertyValue(b))?a.trim():""},flushCustomStyles:function(){},nativeCss:w,nativeShadow:q,cssBuild:x,disableRuntime:v});window.ShadyCSS.CustomStyleInterface=y;}).call(this); - -//# sourceMappingURL=custom-style-interface.min.js.map diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/entrypoints/apply-shim.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/entrypoints/apply-shim.js deleted file mode 100644 index 09ba034f067..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/entrypoints/apply-shim.js +++ /dev/null @@ -1,223 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -import ApplyShim from '../src/apply-shim.js'; -import templateMap from '../src/template-map.js'; -import {getIsExtends, toCssText, elementHasBuiltCss} from '../src/style-util.js'; -import * as ApplyShimUtils from '../src/apply-shim-utils.js'; -import {getComputedStyleValue, updateNativeProperties} from '../src/common-utils.js'; -import {CustomStyleInterfaceInterface} from '../src/custom-style-interface.js'; // eslint-disable-line no-unused-vars -import {nativeCssVariables, nativeShadow, cssBuild, disableRuntime} from '../src/style-settings.js'; - -/** @const {ApplyShim} */ -const applyShim = new ApplyShim(); - -class ApplyShimInterface { - constructor() { - /** @type {?CustomStyleInterfaceInterface} */ - this.customStyleInterface = null; - applyShim['invalidCallback'] = ApplyShimUtils.invalidate; - } - ensure() { - if (this.customStyleInterface) { - return; - } - if (window.ShadyCSS.CustomStyleInterface) { - this.customStyleInterface = - /** @type {!CustomStyleInterfaceInterface} */ ( - window.ShadyCSS.CustomStyleInterface); - this.customStyleInterface['transformCallback'] = (style) => { - applyShim.transformCustomStyle(style); - }; - this.customStyleInterface['validateCallback'] = () => { - requestAnimationFrame(() => { - if (this.customStyleInterface['enqueued']) { - this.flushCustomStyles(); - } - }); - } - } - } - /** - * @param {!HTMLTemplateElement} template - * @param {string} elementName - */ - prepareTemplate(template, elementName) { - this.ensure(); - if (elementHasBuiltCss(template)) { - return; - } - templateMap[elementName] = template; - let ast = applyShim.transformTemplate(template, elementName); - // save original style ast to use for revalidating instances - template['_styleAst'] = ast; - } - flushCustomStyles() { - this.ensure(); - if (!this.customStyleInterface) { - return; - } - let styles = this.customStyleInterface['processStyles'](); - if (!this.customStyleInterface['enqueued']) { - return; - } - for (let i = 0; i < styles.length; i++ ) { - let cs = styles[i]; - let style = this.customStyleInterface['getStyleForCustomStyle'](cs); - if (style) { - applyShim.transformCustomStyle(style); - } - } - this.customStyleInterface['enqueued'] = false; - } - /** - * @param {HTMLElement} element - * @param {Object=} properties - */ - styleSubtree(element, properties) { - this.ensure(); - if (properties) { - updateNativeProperties(element, properties); - } - if (element.shadowRoot) { - this.styleElement(element); - let shadowChildren = - /** @type {!ParentNode} */ (element.shadowRoot).children || - element.shadowRoot.childNodes; - for (let i = 0; i < shadowChildren.length; i++) { - this.styleSubtree(/** @type {HTMLElement} */(shadowChildren[i])); - } - } else { - let children = element.children || element.childNodes; - for (let i = 0; i < children.length; i++) { - this.styleSubtree(/** @type {HTMLElement} */(children[i])); - } - } - } - /** - * @param {HTMLElement} element - */ - styleElement(element) { - this.ensure(); - let {is} = getIsExtends(element); - let template = templateMap[is]; - if (template && elementHasBuiltCss(template)) { - return; - } - if (template && !ApplyShimUtils.templateIsValid(template)) { - // only revalidate template once - if (!ApplyShimUtils.templateIsValidating(template)) { - this.prepareTemplate(template, is); - ApplyShimUtils.startValidatingTemplate(template); - } - // update this element instance - let root = element.shadowRoot; - if (root) { - let style = /** @type {HTMLStyleElement} */(root.querySelector('style')); - if (style) { - // reuse the template's style ast, it has all the original css text - style['__cssRules'] = template['_styleAst']; - style.textContent = toCssText(template['_styleAst']) - } - } - } - } - /** - * @param {Object=} properties - */ - styleDocument(properties) { - this.ensure(); - this.styleSubtree(document.body, properties); - } -} - -if (!window.ShadyCSS || !window.ShadyCSS.ScopingShim) { - const applyShimInterface = new ApplyShimInterface(); - let CustomStyleInterface = window.ShadyCSS && window.ShadyCSS.CustomStyleInterface; - - /** @suppress {duplicate} */ - window.ShadyCSS = { - /** - * @param {!HTMLTemplateElement} template - * @param {string} elementName - * @param {string=} elementExtends - */ - prepareTemplate(template, elementName, elementExtends) { // eslint-disable-line no-unused-vars - applyShimInterface.flushCustomStyles(); - applyShimInterface.prepareTemplate(template, elementName); - }, - - /** - * @param {!HTMLTemplateElement} template - * @param {string} elementName - * @param {string=} elementExtends - */ - prepareTemplateStyles(template, elementName, elementExtends) { - window.ShadyCSS.prepareTemplate(template, elementName, elementExtends); - }, - - /** - * @param {!HTMLTemplateElement} template - * @param {string} elementName - */ - prepareTemplateDom(template, elementName) {}, // eslint-disable-line no-unused-vars - - /** - * @param {!HTMLElement} element - * @param {Object=} properties - */ - styleSubtree(element, properties) { - applyShimInterface.flushCustomStyles(); - applyShimInterface.styleSubtree(element, properties); - }, - - /** - * @param {!HTMLElement} element - */ - styleElement(element) { - applyShimInterface.flushCustomStyles(); - applyShimInterface.styleElement(element); - }, - - /** - * @param {Object=} properties - */ - styleDocument(properties) { - applyShimInterface.flushCustomStyles(); - applyShimInterface.styleDocument(properties); - }, - - /** - * @param {Element} element - * @param {string} property - * @return {string} - */ - getComputedStyleValue(element, property) { - return getComputedStyleValue(element, property); - }, - - flushCustomStyles() { - applyShimInterface.flushCustomStyles(); - }, - - nativeCss: nativeCssVariables, - nativeShadow: nativeShadow, - cssBuild: cssBuild, - disableRuntime: disableRuntime, - }; - - if (CustomStyleInterface) { - window.ShadyCSS.CustomStyleInterface = CustomStyleInterface; - } -} - -window.ShadyCSS.ApplyShim = applyShim; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/entrypoints/custom-style-interface.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/entrypoints/custom-style-interface.js deleted file mode 100644 index bf5024afb92..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/entrypoints/custom-style-interface.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -import CustomStyleInterface from '../src/custom-style-interface.js'; -import {getComputedStyleValue, updateNativeProperties} from '../src/common-utils.js'; -import {nativeCssVariables, nativeShadow, cssBuild, disableRuntime} from '../src/style-settings.js'; - -const customStyleInterface = new CustomStyleInterface(); - -if (!window.ShadyCSS) { - window.ShadyCSS = { - /** - * @param {!HTMLTemplateElement} template - * @param {string} elementName - * @param {string=} elementExtends - */ - prepareTemplate(template, elementName, elementExtends) {}, // eslint-disable-line no-unused-vars - - /** - * @param {!HTMLTemplateElement} template - * @param {string} elementName - */ - prepareTemplateDom(template, elementName) {}, // eslint-disable-line no-unused-vars - - /** - * @param {!HTMLTemplateElement} template - * @param {string} elementName - * @param {string=} elementExtends - */ - prepareTemplateStyles(template, elementName, elementExtends) {}, // eslint-disable-line no-unused-vars - - /** - * @param {Element} element - * @param {Object=} properties - */ - styleSubtree(element, properties) { - customStyleInterface.processStyles(); - updateNativeProperties(element, properties); - }, - - /** - * @param {Element} element - */ - styleElement(element) { // eslint-disable-line no-unused-vars - customStyleInterface.processStyles(); - }, - - /** - * @param {Object=} properties - */ - styleDocument(properties) { - customStyleInterface.processStyles(); - updateNativeProperties(document.body, properties); - }, - - /** - * @param {Element} element - * @param {string} property - * @return {string} - */ - getComputedStyleValue(element, property) { - return getComputedStyleValue(element, property); - }, - - flushCustomStyles() {}, - nativeCss: nativeCssVariables, - nativeShadow: nativeShadow, - cssBuild: cssBuild, - disableRuntime: disableRuntime, - } -} - -window.ShadyCSS.CustomStyleInterface = customStyleInterface;
\ No newline at end of file diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/entrypoints/scoping-shim.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/entrypoints/scoping-shim.js deleted file mode 100644 index b3b898278cc..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/entrypoints/scoping-shim.js +++ /dev/null @@ -1,108 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -import ScopingShim from '../src/scoping-shim.js'; -import {nativeCssVariables, nativeShadow, cssBuild, disableRuntime} from '../src/style-settings.js'; - -/** @const {ScopingShim} */ -const scopingShim = new ScopingShim(); - -let ApplyShim, CustomStyleInterface; - -if (window['ShadyCSS']) { - ApplyShim = window['ShadyCSS']['ApplyShim']; - CustomStyleInterface = window['ShadyCSS']['CustomStyleInterface']; -} - -window.ShadyCSS = { - ScopingShim: scopingShim, - /** - * @param {!HTMLTemplateElement} template - * @param {string} elementName - * @param {string=} elementExtends - */ - prepareTemplate(template, elementName, elementExtends) { - scopingShim.flushCustomStyles(); - scopingShim.prepareTemplate(template, elementName, elementExtends) - }, - - /** - * @param {!HTMLTemplateElement} template - * @param {string} elementName - */ - prepareTemplateDom(template, elementName) { - scopingShim.prepareTemplateDom(template, elementName); - }, - - /** - * @param {!HTMLTemplateElement} template - * @param {string} elementName - * @param {string=} elementExtends - */ - prepareTemplateStyles(template, elementName, elementExtends) { - scopingShim.flushCustomStyles(); - scopingShim.prepareTemplateStyles(template, elementName, elementExtends) - }, - /** - * @param {!HTMLElement} element - * @param {Object=} properties - */ - styleSubtree(element, properties) { - scopingShim.flushCustomStyles(); - scopingShim.styleSubtree(element, properties); - }, - - /** - * @param {!HTMLElement} element - */ - styleElement(element) { - scopingShim.flushCustomStyles(); - scopingShim.styleElement(element); - }, - - /** - * @param {Object=} properties - */ - styleDocument(properties) { - scopingShim.flushCustomStyles(); - scopingShim.styleDocument(properties); - }, - - flushCustomStyles() { - scopingShim.flushCustomStyles(); - }, - - /** - * @param {Element} element - * @param {string} property - * @return {string} - */ - getComputedStyleValue(element, property) { - return scopingShim.getComputedStyleValue(element, property); - }, - - nativeCss: nativeCssVariables, - - nativeShadow: nativeShadow, - - cssBuild: cssBuild, - - disableRuntime: disableRuntime, -}; - -if (ApplyShim) { - window.ShadyCSS.ApplyShim = ApplyShim; -} - -if (CustomStyleInterface) { - window.ShadyCSS.CustomStyleInterface = CustomStyleInterface; -}
\ No newline at end of file diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/externs/shadycss-externs.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/externs/shadycss-externs.js deleted file mode 100644 index 629a24c1ac0..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/externs/shadycss-externs.js +++ /dev/null @@ -1,66 +0,0 @@ -/** @externs */ - -/** @typedef {{ - * styleElement: function(!HTMLElement), - * styleSubtree: function(!HTMLElement, Object<string, string>=), - * prepareTemplate: function(!HTMLTemplateElement, string, string=), - * prepareTemplateStyles: function(!HTMLTemplateElement, string, string=), - * prepareTemplateDom: function(!HTMLTemplateElement, string), - * styleDocument: function(Object<string, string>=), - * flushCustomStyles: function(), - * getComputedStyleValue: function(!Element, string): string, - * ScopingShim: (Object|undefined), - * ApplyShim: (Object|undefined), - * CustomStyleInterface: (Object|undefined), - * nativeCss: boolean, - * nativeShadow: boolean, - * cssBuild: (string | undefined), - * disableRuntime: boolean, - * }} - */ -let ShadyCSSInterface; //eslint-disable-line no-unused-vars - -/** - * @typedef {{ - * shimcssproperties: (boolean | undefined), - * shimshadow: (boolean | undefined), - * cssBuild: (string | undefined), - * disableRuntime: (boolean | undefined), - * }} - */ -let ShadyCSSOptions; //eslint-disable-line no-unused-vars - -/** @type {(ShadyCSSInterface | ShadyCSSOptions | undefined)} */ -window.ShadyCSS; - -/** @type {string|undefined} */ -Element.prototype.extends; - -/** @type {?Element|undefined} */ -Element.prototype._element; - -/** @type {string|undefined} */ -Element.prototype.__cssBuild; - -/** @type {boolean|undefined} */ -HTMLTemplateElement.prototype._validating; - -/** @type {boolean|undefined} */ -HTMLTemplateElement.prototype._prepared; - -/** @type {boolean|undefined} */ -HTMLTemplateElement.prototype._domPrepared; - -/** @type {?DocumentFragment|undefined} */ -HTMLTemplateElement.prototype._content; - -/** @type {?HTMLStyleElement|undefined} */ -HTMLTemplateElement.prototype._gatheredStyle; - -/** @type {?HTMLStyleElement|undefined} */ -HTMLTemplateElement.prototype._style; - -/** - * @type {string | undefined} - */ -DOMTokenList.prototype.value;
\ No newline at end of file diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/scoping-shim.min.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/scoping-shim.min.js deleted file mode 100644 index 36d0290657b..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/scoping-shim.min.js +++ /dev/null @@ -1,59 +0,0 @@ -(function(){/* - -Copyright (c) 2017 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';var k,aa="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function n(){this.end=this.start=0;this.rules=this.parent=this.previous=null;this.cssText=this.parsedCssText="";this.atRule=!1;this.type=0;this.parsedSelector=this.selector=this.keyframesName=""} -function p(a){a=a.replace(ba,"").replace(ca,"");var b=da,c=a,e=new n;e.start=0;e.end=c.length;for(var d=e,f=0,g=c.length;f<g;f++)if("{"===c[f]){d.rules||(d.rules=[]);var h=d,l=h.rules[h.rules.length-1]||null;d=new n;d.start=f+1;d.parent=h;d.previous=l;h.rules.push(d)}else"}"===c[f]&&(d.end=f+1,d=d.parent||e);return b(e,a)} -function da(a,b){var c=b.substring(a.start,a.end-1);a.parsedCssText=a.cssText=c.trim();a.parent&&(c=b.substring(a.previous?a.previous.end:a.parent.start,a.start-1),c=ea(c),c=c.replace(fa," "),c=c.substring(c.lastIndexOf(";")+1),c=a.parsedSelector=a.selector=c.trim(),a.atRule=0===c.indexOf("@"),a.atRule?0===c.indexOf("@media")?a.type=ha:c.match(ia)&&(a.type=q,a.keyframesName=a.selector.split(fa).pop()):a.type=0===c.indexOf("--")?ja:ka);if(c=a.rules)for(var e=0,d=c.length,f=void 0;e<d&&(f=c[e]);e++)da(f, -b);return a}function ea(a){return a.replace(/\\([0-9a-f]{1,6})\s/gi,function(a,c){a=c;for(c=6-a.length;c--;)a="0"+a;return"\\"+a})} -function la(a,b,c){c=void 0===c?"":c;var e="";if(a.cssText||a.rules){var d=a.rules,f;if(f=d)f=d[0],f=!(f&&f.selector&&0===f.selector.indexOf("--"));if(f){f=0;for(var g=d.length,h=void 0;f<g&&(h=d[f]);f++)e=la(h,b,e)}else b?b=a.cssText:(b=a.cssText,b=b.replace(ma,"").replace(na,""),b=b.replace(oa,"").replace(pa,"")),(e=b.trim())&&(e=" "+e+"\n")}e&&(a.selector&&(c+=a.selector+" {\n"),c+=e,a.selector&&(c+="}\n\n"));return c} -var ka=1,q=7,ha=4,ja=1E3,ba=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,ca=/@import[^;]*;/gim,ma=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,na=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,oa=/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,pa=/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,ia=/^@[^\s]*keyframes/,fa=/\s+/g;var r=!(window.ShadyDOM&&window.ShadyDOM.inUse),t;function qa(a){t=a&&a.shimcssproperties?!1:r||!(navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)||!window.CSS||!CSS.supports||!CSS.supports("box-shadow","0 0 0 var(--foo)"))}var ra;window.ShadyCSS&&void 0!==window.ShadyCSS.cssBuild&&(ra=window.ShadyCSS.cssBuild);var u=!(!window.ShadyCSS||!window.ShadyCSS.disableRuntime); -window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?t=window.ShadyCSS.nativeCss:window.ShadyCSS?(qa(window.ShadyCSS),window.ShadyCSS=void 0):qa(window.WebComponents&&window.WebComponents.flags);var v=t,w=ra;var x=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi,y=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,sa=/(--[\w-]+)\s*([:,;)]|$)/gi,ta=/(animation\s*:)|(animation-name\s*:)/,ua=/@media\s(.*)/,va=/\{[^}]*\}/g;var wa=new Set;function z(a,b){if(!a)return"";"string"===typeof a&&(a=p(a));b&&A(a,b);return la(a,v)}function B(a){!a.__cssRules&&a.textContent&&(a.__cssRules=p(a.textContent));return a.__cssRules||null}function xa(a){return!!a.parent&&a.parent.type===q}function A(a,b,c,e){if(a){var d=!1,f=a.type;if(e&&f===ha){var g=a.selector.match(ua);g&&(window.matchMedia(g[1]).matches||(d=!0))}f===ka?b(a):c&&f===q?c(a):f===ja&&(d=!0);if((a=a.rules)&&!d)for(d=0,f=a.length,g=void 0;d<f&&(g=a[d]);d++)A(g,b,c,e)}} -function C(a,b,c,e){var d=document.createElement("style");b&&d.setAttribute("scope",b);d.textContent=a;ya(d,c,e);return d}var D=null;function za(a){a=document.createComment(" Shady DOM styles for "+a+" ");var b=document.head;b.insertBefore(a,(D?D.nextSibling:null)||b.firstChild);return D=a}function ya(a,b,c){b=b||document.head;b.insertBefore(a,c&&c.nextSibling||b.firstChild);D?a.compareDocumentPosition(D)===Node.DOCUMENT_POSITION_PRECEDING&&(D=a):D=a} -function Aa(a,b){for(var c=0,e=a.length;b<e;b++)if("("===a[b])c++;else if(")"===a[b]&&0===--c)return b;return-1}function Ba(a,b){var c=a.indexOf("var(");if(-1===c)return b(a,"","","");var e=Aa(a,c+3),d=a.substring(c+4,e);c=a.substring(0,c);a=Ba(a.substring(e+1),b);e=d.indexOf(",");return-1===e?b(c,d.trim(),"",a):b(c,d.substring(0,e).trim(),d.substring(e+1).trim(),a)}function E(a,b){r?a.setAttribute("class",b):window.ShadyDOM.nativeMethods.setAttribute.call(a,"class",b)} -var F=window.ShadyDOM&&window.ShadyDOM.wrap||function(a){return a};function G(a){var b=a.localName,c="";b?-1<b.indexOf("-")||(c=b,b=a.getAttribute&&a.getAttribute("is")||""):(b=a.is,c=a.extends);return{is:b,s:c}}function Ca(a){for(var b=[],c="",e=0;0<=e&&e<a.length;e++)if("("===a[e]){var d=Aa(a,e);c+=a.slice(e,d+1);e=d}else","===a[e]?(b.push(c),c=""):c+=a[e];c&&b.push(c);return b} -function H(a){if(void 0!==w)return w;if(void 0===a.__cssBuild){var b=a.getAttribute("css-build");if(b)a.__cssBuild=b;else{a:{b="template"===a.localName?a.content.firstChild:a.firstChild;if(b instanceof Comment&&(b=b.textContent.trim().split(":"),"css-build"===b[0])){b=b[1];break a}b=""}if(""!==b){var c="template"===a.localName?a.content.firstChild:a.firstChild;c.parentNode.removeChild(c)}a.__cssBuild=b}}return a.__cssBuild||""} -function Da(a){a=void 0===a?"":a;return""!==a&&v?r?"shadow"===a:"shady"===a:!1};function I(){}function Ea(a,b){J(K,a,function(a){L(a,b||"")})}function J(a,b,c){b.nodeType===Node.ELEMENT_NODE&&c(b);var e;"template"===b.localName?e=(b.content||b._content||b).childNodes:e=b.children||b.childNodes;if(e)for(b=0;b<e.length;b++)J(a,e[b],c)} -function L(a,b,c){if(b)if(a.classList)c?(a.classList.remove("style-scope"),a.classList.remove(b)):(a.classList.add("style-scope"),a.classList.add(b));else if(a.getAttribute){var e=a.getAttribute("class");c?e&&(b=e.replace("style-scope","").replace(b,""),E(a,b)):E(a,(e?e+" ":"")+"style-scope "+b)}}function Fa(a,b,c){J(K,a,function(a){L(a,b,!0);L(a,c)})}function Ga(a,b){J(K,a,function(a){L(a,b||"",!0)})} -function M(a,b,c,e,d){var f=K;d=void 0===d?"":d;""===d&&(r||"shady"===(void 0===e?"":e)?d=z(b,c):(a=G(a),d=Ha(f,b,a.is,a.s,c)+"\n\n"));return d.trim()}function Ha(a,b,c,e,d){var f=Ia(c,e);c=c?"."+c:"";return z(b,function(b){b.c||(b.selector=b.g=Ja(a,b,a.b,c,f),b.c=!0);d&&d(b,c,f)})}function Ia(a,b){return b?"[is="+a+"]":a}function Ja(a,b,c,e,d){var f=Ca(b.selector);if(!xa(b)){b=0;for(var g=f.length,h=void 0;b<g&&(h=f[b]);b++)f[b]=c.call(a,h,e,d)}return f.filter(function(a){return!!a}).join(",")} -function Ka(a){return a.replace(La,function(a,c,e){-1<e.indexOf("+")?e=e.replace(/\+/g,"___"):-1<e.indexOf("___")&&(e=e.replace(/___/g,"+"));return":"+c+"("+e+")"})}function Ma(a){for(var b=[],c;c=a.match(Na);){var e=c.index,d=Aa(a,e);if(-1===d)throw Error(c.input+" selector missing ')'");c=a.slice(e,d+1);a=a.replace(c,"\ue000");b.push(c)}return{A:a,matches:b}}function Oa(a,b){var c=a.split("\ue000");return b.reduce(function(a,b,f){return a+b+c[f+1]},c[0])} -I.prototype.b=function(a,b,c){var e=!1;a=a.trim();var d=La.test(a);d&&(a=a.replace(La,function(a,b,c){return":"+b+"("+c.replace(/\s/g,"")+")"}),a=Ka(a));var f=Na.test(a);if(f){var g=Ma(a);a=g.A;g=g.matches}a=a.replace(Pa,":host $1");a=a.replace(Qa,function(a,d,f){e||(a=Ra(f,d,b,c),e=e||a.stop,d=a.G,f=a.value);return d+f});f&&(a=Oa(a,g));d&&(a=Ka(a));return a=a.replace(Sa,function(a,b,c,d){return'[dir="'+c+'"] '+b+d+", "+b+'[dir="'+c+'"]'+d})}; -function Ra(a,b,c,e){var d=a.indexOf("::slotted");0<=a.indexOf(":host")?a=Ta(a,e):0!==d&&(a=c?Ua(a,c):a);c=!1;0<=d&&(b="",c=!0);if(c){var f=!0;c&&(a=a.replace(Va,function(a,b){return" > "+b}))}return{value:a,G:b,stop:f}}function Ua(a,b){a=a.split(/(\[.+?\])/);for(var c=[],e=0;e<a.length;e++)if(1===e%2)c.push(a[e]);else{var d=a[e];if(""!==d||e!==a.length-1)d=d.split(":"),d[0]+=b,c.push(d.join(":"))}return c.join("")} -function Ta(a,b){var c=a.match(Wa);return(c=c&&c[2].trim()||"")?c[0].match(Xa)?a.replace(Wa,function(a,c,f){return b+f}):c.split(Xa)[0]===b?c:"should_not_match":a.replace(":host",b)}function Ya(a){":root"===a.selector&&(a.selector="html")}I.prototype.c=function(a){return a.match(":host")?"":a.match("::slotted")?this.b(a,":not(.style-scope)"):Ua(a.trim(),":not(.style-scope)")};aa.Object.defineProperties(I.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"style-scope"}}}); -var La=/:(nth[-\w]+)\(([^)]+)\)/,Qa=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=[])+)/g,Xa=/[[.:#*]/,Pa=/^(::slotted)/,Wa=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Va=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Sa=/(.*):dir\((?:(ltr|rtl))\)(.*)/,Na=/:(?:matches|any|-(?:webkit|moz)-any)/,K=new I;function N(a,b,c,e,d){this.o=a||null;this.b=b||null;this.w=c||[];this.i=null;this.cssBuild=d||"";this.s=e||"";this.a=this.j=this.m=null}function O(a){return a?a.__styleInfo:null}function Za(a,b){return a.__styleInfo=b}N.prototype.c=function(){return this.o};N.prototype._getStyleRules=N.prototype.c;function $a(a){var b=this.matches||this.matchesSelector||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector;return b&&b.call(this,a)}var ab=navigator.userAgent.match("Trident");function bb(){}function cb(a){var b={},c=[],e=0;A(a,function(a){P(a);a.index=e++;a=a.f.cssText;for(var c;c=sa.exec(a);){var d=c[1];":"!==c[2]&&(b[d]=!0)}},function(a){c.push(a)});a.b=c;a=[];for(var d in b)a.push(d);return a} -function P(a){if(!a.f){var b={},c={};R(a,c)&&(b.l=c,a.rules=null);b.cssText=a.parsedCssText.replace(va,"").replace(x,"");a.f=b}}function R(a,b){var c=a.f;if(c){if(c.l)return Object.assign(b,c.l),!0}else{c=a.parsedCssText;for(var e;a=x.exec(c);){e=(a[2]||a[3]).trim();if("inherit"!==e||"unset"!==e)b[a[1].trim()]=e;e=!0}return e}} -function S(a,b,c){b&&(b=0<=b.indexOf(";")?db(a,b,c):Ba(b,function(b,d,f,g){if(!d)return b+g;(d=S(a,c[d],c))&&"initial"!==d?"apply-shim-inherit"===d&&(d="inherit"):d=S(a,c[f]||f,c)||f;return b+(d||"")+g}));return b&&b.trim()||""} -function db(a,b,c){b=b.split(";");for(var e=0,d,f;e<b.length;e++)if(d=b[e]){y.lastIndex=0;if(f=y.exec(d))d=S(a,c[f[1]],c);else if(f=d.indexOf(":"),-1!==f){var g=d.substring(f);g=g.trim();g=S(a,g,c)||g;d=d.substring(0,f)+g}b[e]=d&&d.lastIndexOf(";")===d.length-1?d.slice(0,-1):d||""}return b.join(";")} -function eb(a,b){var c={},e=[];A(a,function(a){a.f||P(a);var d=a.g||a.parsedSelector;b&&a.f.l&&d&&$a.call(b,d)&&(R(a,c),a=a.index,d=parseInt(a/32,10),e[d]=(e[d]||0)|1<<a%32)},null,!0);return{l:c,key:e}} -function fb(a,b,c,e){b.f||P(b);if(b.f.l){var d=G(a);a=d.is;d=d.s;d=a?Ia(a,d):"html";var f=b.parsedSelector,g=":host > *"===f||"html"===f,h=0===f.indexOf(":host")&&!g;"shady"===c&&(g=f===d+" > *."+d||-1!==f.indexOf("html"),h=!g&&0===f.indexOf(d));if(g||h)c=d,h&&(b.g||(b.g=Ja(K,b,K.b,a?"."+a:"",d)),c=b.g||d),e({A:c,K:h,T:g})}}function gb(a,b,c){var e={},d={};A(b,function(b){fb(a,b,c,function(c){$a.call(a._element||a,c.A)&&(c.K?R(b,e):R(b,d))})},null,!0);return{M:d,J:e}} -function hb(a,b,c,e){var d=G(b),f=Ia(d.is,d.s),g=new RegExp("(?:^|[^.#[:])"+(b.extends?"\\"+f.slice(0,-1)+"\\]":f)+"($|[.:[\\s>+~])"),h=O(b);d=h.o;h=h.cssBuild;var l=ib(d,e);return M(b,d,function(b){var d="";b.f||P(b);b.f.cssText&&(d=db(a,b.f.cssText,c));b.cssText=d;if(!r&&!xa(b)&&b.cssText){var h=d=b.cssText;null==b.C&&(b.C=ta.test(d));if(b.C)if(null==b.u){b.u=[];for(var m in l)h=l[m],h=h(d),d!==h&&(d=h,b.u.push(m))}else{for(m=0;m<b.u.length;++m)h=l[b.u[m]],d=h(d);h=d}b.cssText=h;b.g=b.g||b.selector; -d="."+e;m=Ca(b.g);h=0;for(var Ab=m.length,Q=void 0;h<Ab&&(Q=m[h]);h++)m[h]=Q.match(g)?Q.replace(f,d):d+" "+Q;b.selector=m.join(",")}},h)}function ib(a,b){a=a.b;var c={};if(!r&&a)for(var e=0,d=a[e];e<a.length;d=a[++e]){var f=d,g=b;f.h=new RegExp("\\b"+f.keyframesName+"(?!\\B|-)","g");f.a=f.keyframesName+"-"+g;f.g=f.g||f.selector;f.selector=f.g.replace(f.keyframesName,f.a);c[d.keyframesName]=jb(d)}return c}function jb(a){return function(b){return b.replace(a.h,a.a)}} -function kb(a,b){var c=T,e=B(a);a.textContent=z(e,function(a){var d=a.cssText=a.parsedCssText;a.f&&a.f.cssText&&(d=d.replace(ma,"").replace(na,""),a.cssText=db(c,d,b))})}aa.Object.defineProperties(bb.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"x-scope"}}});var T=new bb;var U={},V=window.customElements;if(V&&!r&&!u){var lb=V.define;V.define=function(a,b,c){U[a]||(U[a]=za(a));lb.call(V,a,b,c)}};function mb(){this.cache={}}mb.prototype.store=function(a,b,c,e){var d=this.cache[a]||[];d.push({l:b,styleElement:c,j:e});100<d.length&&d.shift();this.cache[a]=d};function nb(){}var ob=new RegExp(K.a+"\\s*([^\\s]*)");function pb(a){return(a=(a.classList&&a.classList.value?a.classList.value:a.getAttribute("class")||"").match(ob))?a[1]:""}function qb(a){var b=F(a).getRootNode();return b===a||b===a.ownerDocument?"":(a=b.host)?G(a).is:""} -function rb(a){for(var b=0;b<a.length;b++){var c=a[b];if(c.target!==document.documentElement&&c.target!==document.head)for(var e=0;e<c.addedNodes.length;e++){var d=c.addedNodes[e];if(d.nodeType===Node.ELEMENT_NODE){var f=d.getRootNode(),g=pb(d);if(g&&f===d.ownerDocument&&("style"!==d.localName&&"template"!==d.localName||""===H(d)))Ga(d,g);else if(f instanceof ShadowRoot)for(f=qb(d),f!==g&&Fa(d,g,f),d=window.ShadyDOM.nativeMethods.querySelectorAll.call(d,":not(."+K.a+")"),g=0;g<d.length;g++){f=d[g]; -var h=qb(f);h&&L(f,h)}}}}} -if(!(r||window.ShadyDOM&&window.ShadyDOM.handlesDynamicScoping)){var sb=new MutationObserver(rb),tb=function(a){sb.observe(a,{childList:!0,subtree:!0})};if(window.customElements&&!window.customElements.polyfillWrapFlushCallback)tb(document);else{var ub=function(){tb(document.body)};window.HTMLImports?window.HTMLImports.whenReady(ub):requestAnimationFrame(function(){if("loading"===document.readyState){var a=function(){ub();document.removeEventListener("readystatechange",a)};document.addEventListener("readystatechange", -a)}else ub()})}nb=function(){rb(sb.takeRecords())}}var vb=nb;var W={};var wb=Promise.resolve();function xb(a){if(a=W[a])a._applyShimCurrentVersion=a._applyShimCurrentVersion||0,a._applyShimValidatingVersion=a._applyShimValidatingVersion||0,a._applyShimNextVersion=(a._applyShimNextVersion||0)+1}function yb(a){return a._applyShimCurrentVersion===a._applyShimNextVersion}function zb(a){a._applyShimValidatingVersion=a._applyShimNextVersion;a._validating||(a._validating=!0,wb.then(function(){a._applyShimCurrentVersion=a._applyShimNextVersion;a._validating=!1}))};var Bb={},Cb=new mb;function X(){this.B={};this.c=document.documentElement;var a=new n;a.rules=[];this.h=Za(this.c,new N(a));this.v=!1;this.b=this.a=null}k=X.prototype;k.flush=function(){vb()};k.I=function(a){return B(a)};k.R=function(a){return z(a)};k.prepareTemplate=function(a,b,c){this.prepareTemplateDom(a,b);this.prepareTemplateStyles(a,b,c)}; -k.prepareTemplateStyles=function(a,b,c){if(!a._prepared&&!u){r||U[b]||(U[b]=za(b));a._prepared=!0;a.name=b;a.extends=c;W[b]=a;var e=H(a),d=Da(e);c={is:b,extends:c};for(var f=[],g=a.content.querySelectorAll("style"),h=0;h<g.length;h++){var l=g[h];if(l.hasAttribute("shady-unscoped")){if(!r){var m=l.textContent;wa.has(m)||(wa.add(m),m=l.cloneNode(!0),document.head.appendChild(m));l.parentNode.removeChild(l)}}else f.push(l.textContent),l.parentNode.removeChild(l)}f=f.join("").trim()+(Bb[b]||"");Y(this); -if(!d){if(g=!e)g=y.test(f)||x.test(f),y.lastIndex=0,x.lastIndex=0;h=p(f);g&&v&&this.a&&this.a.transformRules(h,b);a._styleAst=h}g=[];v||(g=cb(a._styleAst));if(!g.length||v)h=r?a.content:null,b=U[b]||null,e=M(c,a._styleAst,null,e,d?f:""),e=e.length?C(e,c.is,h,b):null,a._style=e;a.a=g}};k.L=function(a,b){Bb[b]=a.join(" ")};k.prepareTemplateDom=function(a,b){if(!u){var c=H(a);r||"shady"===c||a._domPrepared||(a._domPrepared=!0,Ea(a.content,b))}}; -function Db(a){var b=G(a),c=b.is;b=b.s;var e=U[c]||null,d=W[c];if(d){c=d._styleAst;var f=d.a;d=H(d);b=new N(c,e,f,b,d);Za(a,b);return b}}function Eb(a){!a.b&&window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface&&(a.b=window.ShadyCSS.CustomStyleInterface,a.b.transformCallback=function(b){a.D(b)},a.b.validateCallback=function(){requestAnimationFrame(function(){(a.b.enqueued||a.v)&&a.flushCustomStyles()})})} -function Y(a){!a.a&&window.ShadyCSS&&window.ShadyCSS.ApplyShim&&(a.a=window.ShadyCSS.ApplyShim,a.a.invalidCallback=xb);Eb(a)} -k.flushCustomStyles=function(){if(!u&&(Y(this),this.b)){var a=this.b.processStyles();if(this.b.enqueued&&!Da(this.h.cssBuild)){if(v){if(!this.h.cssBuild)for(var b=0;b<a.length;b++){var c=this.b.getStyleForCustomStyle(a[b]);if(c&&v&&this.a){var e=B(c);Y(this);this.a.transformRules(e);c.textContent=z(e)}}}else{Fb(this,this.c,this.h);for(b=0;b<a.length;b++)(c=this.b.getStyleForCustomStyle(a[b]))&&kb(c,this.h.m);this.v&&this.styleDocument()}this.b.enqueued=!1}}}; -k.styleElement=function(a,b){if(u){if(b){O(a)||Za(a,new N(null));var c=O(a);c.i=c.i||{};Object.assign(c.i,b);Gb(this,a,c)}}else if(c=O(a)||Db(a))if(a!==this.c&&(this.v=!0),b&&(c.i=c.i||{},Object.assign(c.i,b)),v)Gb(this,a,c);else if(this.flush(),Fb(this,a,c),c.w&&c.w.length){b=G(a).is;var e;a:{if(e=Cb.cache[b])for(var d=e.length-1;0<=d;d--){var f=e[d];b:{var g=c.w;for(var h=0;h<g.length;h++){var l=g[h];if(f.l[l]!==c.m[l]){g=!1;break b}}g=!0}if(g){e=f;break a}}e=void 0}g=e?e.styleElement:null;d=c.j; -(f=e&&e.j)||(f=this.B[b]=(this.B[b]||0)+1,f=b+"-"+f);c.j=f;f=c.j;h=T;h=g?g.textContent||"":hb(h,a,c.m,f);l=O(a);var m=l.a;m&&!r&&m!==g&&(m._useCount--,0>=m._useCount&&m.parentNode&&m.parentNode.removeChild(m));r?l.a?(l.a.textContent=h,g=l.a):h&&(g=C(h,f,a.shadowRoot,l.b)):g?g.parentNode||(ab&&-1<h.indexOf("@media")&&(g.textContent=h),ya(g,null,l.b)):h&&(g=C(h,f,null,l.b));g&&(g._useCount=g._useCount||0,l.a!=g&&g._useCount++,l.a=g);f=g;r||(g=c.j,l=h=a.getAttribute("class")||"",d&&(l=h.replace(new RegExp("\\s*x-scope\\s*"+ -d+"\\s*","g")," ")),l+=(l?" ":"")+"x-scope "+g,h!==l&&E(a,l));e||Cb.store(b,c.m,f,c.j)}}; -function Gb(a,b,c){var e=G(b).is;if(c.i){var d=c.i,f;for(f in d)null===f?b.style.removeProperty(f):b.style.setProperty(f,d[f])}d=W[e];if(!(!d&&b!==a.c||d&&""!==H(d))&&d&&d._style&&!yb(d)){if(yb(d)||d._applyShimValidatingVersion!==d._applyShimNextVersion)Y(a),a.a&&a.a.transformRules(d._styleAst,e),d._style.textContent=M(b,c.o),zb(d);r&&(a=b.shadowRoot)&&(a=a.querySelector("style"))&&(a.textContent=M(b,c.o));c.o=d._styleAst}} -function Hb(a,b){return(b=F(b).getRootNode().host)?O(b)||Db(b)?b:Hb(a,b):a.c}function Fb(a,b,c){var e=Hb(a,b),d=O(e),f=d.m;e===a.c||f||(Fb(a,e,d),f=d.m);a=Object.create(f||null);e=gb(b,c.o,c.cssBuild);b=eb(d.o,b).l;Object.assign(a,e.J,b,e.M);b=c.i;for(var g in b)if((d=b[g])||0===d)a[g]=d;g=T;b=Object.getOwnPropertyNames(a);for(d=0;d<b.length;d++)e=b[d],a[e]=S(g,a[e],a);c.m=a}k.styleDocument=function(a){this.styleSubtree(this.c,a)}; -k.styleSubtree=function(a,b){var c=F(a),e=c.shadowRoot;(e||a===this.c)&&this.styleElement(a,b);if(a=e&&(e.children||e.childNodes))for(c=0;c<a.length;c++)this.styleSubtree(a[c]);else if(c=c.children||c.childNodes)for(a=0;a<c.length;a++)this.styleSubtree(c[a])}; -k.D=function(a){var b=this,c=H(a);c!==this.h.cssBuild&&(this.h.cssBuild=c);if(!Da(c)){var e=B(a);A(e,function(a){if(r)Ya(a);else{var d=K;a.selector=a.parsedSelector;Ya(a);a.selector=a.g=Ja(d,a,d.c,void 0,void 0)}v&&""===c&&(Y(b),b.a&&b.a.transformRule(a))});v?a.textContent=z(e):this.h.o.rules.push(e)}};k.getComputedStyleValue=function(a,b){var c;v||(c=(O(a)||O(Hb(this,a))).m[b]);return(c=c||window.getComputedStyle(a).getPropertyValue(b))?c.trim():""}; -k.P=function(a,b){var c=F(a).getRootNode();b=b?b.split(/\s/):[];c=c.host&&c.host.localName;if(!c){var e=a.getAttribute("class");if(e){e=e.split(/\s/);for(var d=0;d<e.length;d++)if(e[d]===K.a){c=e[d+1];break}}}c&&b.push(K.a,c);v||(c=O(a))&&c.j&&b.push(T.a,c.j);E(a,b.join(" "))};k.F=function(a){return O(a)};k.O=function(a,b){L(a,b)};k.S=function(a,b){L(a,b,!0)};k.N=function(a){return qb(a)};k.H=function(a){return pb(a)};X.prototype.flush=X.prototype.flush;X.prototype.prepareTemplate=X.prototype.prepareTemplate; -X.prototype.styleElement=X.prototype.styleElement;X.prototype.styleDocument=X.prototype.styleDocument;X.prototype.styleSubtree=X.prototype.styleSubtree;X.prototype.getComputedStyleValue=X.prototype.getComputedStyleValue;X.prototype.setElementClass=X.prototype.P;X.prototype._styleInfoForNode=X.prototype.F;X.prototype.transformCustomStyleForDocument=X.prototype.D;X.prototype.getStyleAst=X.prototype.I;X.prototype.styleAstToString=X.prototype.R;X.prototype.flushCustomStyles=X.prototype.flushCustomStyles; -X.prototype.scopeNode=X.prototype.O;X.prototype.unscopeNode=X.prototype.S;X.prototype.scopeForNode=X.prototype.N;X.prototype.currentScopeForNode=X.prototype.H;X.prototype.prepareAdoptedCssText=X.prototype.L;Object.defineProperties(X.prototype,{nativeShadow:{get:function(){return r}},nativeCss:{get:function(){return v}}});var Z=new X,Ib,Jb;window.ShadyCSS&&(Ib=window.ShadyCSS.ApplyShim,Jb=window.ShadyCSS.CustomStyleInterface); -window.ShadyCSS={ScopingShim:Z,prepareTemplate:function(a,b,c){Z.flushCustomStyles();Z.prepareTemplate(a,b,c)},prepareTemplateDom:function(a,b){Z.prepareTemplateDom(a,b)},prepareTemplateStyles:function(a,b,c){Z.flushCustomStyles();Z.prepareTemplateStyles(a,b,c)},styleSubtree:function(a,b){Z.flushCustomStyles();Z.styleSubtree(a,b)},styleElement:function(a){Z.flushCustomStyles();Z.styleElement(a)},styleDocument:function(a){Z.flushCustomStyles();Z.styleDocument(a)},flushCustomStyles:function(){Z.flushCustomStyles()}, -getComputedStyleValue:function(a,b){return Z.getComputedStyleValue(a,b)},nativeCss:v,nativeShadow:r,cssBuild:w,disableRuntime:u};Ib&&(window.ShadyCSS.ApplyShim=Ib);Jb&&(window.ShadyCSS.CustomStyleInterface=Jb);}).call(this); - -//# sourceMappingURL=scoping-shim.min.js.map diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/apply-shim-utils.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/apply-shim-utils.js deleted file mode 100644 index c5c27a2bd4a..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/apply-shim-utils.js +++ /dev/null @@ -1,149 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; -import templateMap from './template-map.js'; -import {StyleNode} from './css-parse.js'; // eslint-disable-line no-unused-vars - -/* - * Utilities for handling invalidating apply-shim mixins for a given template. - * - * The invalidation strategy involves keeping track of the "current" version of a template's mixins, and updating that count when a mixin is invalidated. - * The template - */ - -/** @const {string} */ -const CURRENT_VERSION = '_applyShimCurrentVersion'; - -/** @const {string} */ -const NEXT_VERSION = '_applyShimNextVersion'; - -/** @const {string} */ -const VALIDATING_VERSION = '_applyShimValidatingVersion'; - -/** - * @const {Promise<void>} - */ -const promise = Promise.resolve(); - -/** - * @param {string} elementName - */ -export function invalidate(elementName){ - let template = templateMap[elementName]; - if (template) { - invalidateTemplate(template); - } -} - -/** - * This function can be called multiple times to mark a template invalid - * and signal that the style inside must be regenerated. - * - * Use `startValidatingTemplate` to begin an asynchronous validation cycle. - * During that cycle, call `templateIsValidating` to see if the template must - * be revalidated - * @param {HTMLTemplateElement} template - */ -export function invalidateTemplate(template) { - // default the current version to 0 - template[CURRENT_VERSION] = template[CURRENT_VERSION] || 0; - // ensure the "validating for" flag exists - template[VALIDATING_VERSION] = template[VALIDATING_VERSION] || 0; - // increment the next version - template[NEXT_VERSION] = (template[NEXT_VERSION] || 0) + 1; -} - -/** - * @param {string} elementName - * @return {boolean} - */ -export function isValid(elementName) { - let template = templateMap[elementName]; - if (template) { - return templateIsValid(template); - } - return true; -} - -/** - * @param {HTMLTemplateElement} template - * @return {boolean} - */ -export function templateIsValid(template) { - return template[CURRENT_VERSION] === template[NEXT_VERSION]; -} - -/** - * @param {string} elementName - * @return {boolean} - */ -export function isValidating(elementName) { - let template = templateMap[elementName]; - if (template) { - return templateIsValidating(template); - } - return false; -} - -/** - * Returns true if the template is currently invalid and `startValidating` has been called since the last invalidation. - * If false, the template must be validated. - * @param {HTMLTemplateElement} template - * @return {boolean} - */ -export function templateIsValidating(template) { - return !templateIsValid(template) && template[VALIDATING_VERSION] === template[NEXT_VERSION]; -} - -/** - * 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. - * @param {string} elementName -*/ -export function startValidating(elementName) { - let template = templateMap[elementName]; - startValidatingTemplate(template); -} - -/** - * Begin an asynchronous invalidation cycle. - * This should be called after every validation of a template - * - * After one microtask, the template will be marked as valid until the next call to `invalidateTemplate` - * @param {HTMLTemplateElement} template - */ -export function startValidatingTemplate(template) { - // remember that the current "next version" is the reason for this validation cycle - template[VALIDATING_VERSION] = template[NEXT_VERSION]; - // however, there only needs to be one async task to clear the counters - if (!template._validating) { - template._validating = true; - promise.then(function() { - // sync the current version to let future invalidations cause a refresh cycle - template[CURRENT_VERSION] = template[NEXT_VERSION]; - template._validating = false; - }); - } -} - -/** - * @return {boolean} - */ -export function elementsAreInvalid() { - for (let elementName in templateMap) { - let template = templateMap[elementName]; - if (!templateIsValid(template)) { - return true; - } - } - return false; -} diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/apply-shim.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/apply-shim.js deleted file mode 100644 index e4bc9cdf11e..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/apply-shim.js +++ /dev/null @@ -1,525 +0,0 @@ -/** -@license -Copyright (c) 2017 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. - -*/ - -'use strict'; - -import {forEachRule, processVariableAndFallback, rulesForStyle, toCssText, gatherStyleText} from './style-util.js'; -import {MIXIN_MATCH, VAR_ASSIGN} from './common-regex.js'; -import {detectMixin} from './common-utils.js'; -import {StyleNode} from './css-parse.js'; // eslint-disable-line no-unused-vars - -const APPLY_NAME_CLEAN = /;\s*/m; -const INITIAL_INHERIT = /^\s*(initial)|(inherit)\s*$/; -const IMPORTANT = /\s*!important/; - -// separator used between mixin-name and mixin-property-name when producing properties -// NOTE: plain '-' may cause collisions in user styles -const MIXIN_VAR_SEP = '_-_'; - -/** - * @typedef {!Object<string, string>} - */ -let PropertyEntry; // eslint-disable-line no-unused-vars - -/** - * @typedef {!Object<string, boolean>} - */ -let DependantsEntry; // eslint-disable-line no-unused-vars - -/** @typedef {{ - * properties: PropertyEntry, - * dependants: DependantsEntry - * }} - */ -let MixinMapEntry; // eslint-disable-line no-unused-vars - -// map of mixin to property names -// --foo: {border: 2px} -> {properties: {(--foo, ['border'])}, dependants: {'element-name': proto}} -class MixinMap { - constructor() { - /** @type {!Object<string, !MixinMapEntry>} */ - this._map = {}; - } - /** - * @param {string} name - * @param {!PropertyEntry} props - */ - set(name, props) { - name = name.trim(); - this._map[name] = { - properties: props, - dependants: {} - } - } - /** - * @param {string} name - * @return {MixinMapEntry} - */ - get(name) { - name = name.trim(); - return this._map[name] || null; - } -} - -/** - * Callback for when an element is marked invalid - * @type {?function(string)} - */ -let invalidCallback = null; - -/** @unrestricted */ -class ApplyShim { - constructor() { - /** @type {?string} */ - this._currentElement = null; - /** @type {HTMLMetaElement} */ - this._measureElement = null; - this._map = new MixinMap(); - } - /** - * return true if `cssText` contains a mixin definition or consumption - * @param {string} cssText - * @return {boolean} - */ - detectMixin(cssText) { - return detectMixin(cssText); - } - - /** - * Gather styles into one style for easier processing - * @param {!HTMLTemplateElement} template - * @return {HTMLStyleElement} - */ - gatherStyles(template) { - const styleText = gatherStyleText(template.content); - if (styleText) { - const style = /** @type {!HTMLStyleElement} */(document.createElement('style')); - style.textContent = styleText; - template.content.insertBefore(style, template.content.firstChild); - return style; - } - return null; - } - /** - * @param {!HTMLTemplateElement} template - * @param {string} elementName - * @return {StyleNode} - */ - transformTemplate(template, elementName) { - if (template._gatheredStyle === undefined) { - template._gatheredStyle = this.gatherStyles(template); - } - /** @type {HTMLStyleElement} */ - const style = template._gatheredStyle; - return style ? this.transformStyle(style, elementName) : null; - } - /** - * @param {!HTMLStyleElement} style - * @param {string} elementName - * @return {StyleNode} - */ - transformStyle(style, elementName = '') { - let ast = rulesForStyle(style); - this.transformRules(ast, elementName); - style.textContent = toCssText(ast); - return ast; - } - /** - * @param {!HTMLStyleElement} style - * @return {StyleNode} - */ - transformCustomStyle(style) { - let ast = rulesForStyle(style); - forEachRule(ast, (rule) => { - if (rule['selector'] === ':root') { - rule['selector'] = 'html'; - } - this.transformRule(rule); - }) - style.textContent = toCssText(ast); - return ast; - } - /** - * @param {StyleNode} rules - * @param {string} elementName - */ - transformRules(rules, elementName) { - this._currentElement = elementName; - forEachRule(rules, (r) => { - this.transformRule(r); - }); - this._currentElement = null; - } - /** - * @param {!StyleNode} rule - */ - transformRule(rule) { - rule['cssText'] = this.transformCssText(rule['parsedCssText'], rule); - // :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 > *'; - } - } - /** - * @param {string} cssText - * @param {!StyleNode} rule - * @return {string} - */ - transformCssText(cssText, rule) { - // produce variables - cssText = cssText.replace(VAR_ASSIGN, (matchText, propertyName, valueProperty, valueMixin) => - this._produceCssProperties(matchText, propertyName, valueProperty, valueMixin, rule)); - // consume mixins - return this._consumeCssProperties(cssText, rule); - } - /** - * @param {string} property - * @return {string} - */ - _getInitialValueForProperty(property) { - if (!this._measureElement) { - this._measureElement = /** @type {HTMLMetaElement} */(document.createElement('meta')); - this._measureElement.setAttribute('apply-shim-measure', ''); - this._measureElement.style.all = 'initial'; - document.head.appendChild(this._measureElement); - } - return window.getComputedStyle(this._measureElement).getPropertyValue(property); - } - /** - * Walk over all rules before this rule to find fallbacks for mixins - * - * @param {!StyleNode} startRule - * @return {!Object} - */ - _fallbacksFromPreviousRules(startRule) { - // find the "top" rule - let topRule = startRule; - while (topRule['parent']) { - topRule = topRule['parent']; - } - const fallbacks = {}; - let seenStartRule = false; - forEachRule(topRule, (r) => { - // stop when we hit the input rule - seenStartRule = seenStartRule || r === startRule; - if (seenStartRule) { - return; - } - // NOTE: Only matching selectors are "safe" for this fallback processing - // It would be prohibitive to run `matchesSelector()` on each selector, - // so we cheat and only check if the same selector string is used, which - // guarantees things like specificity matching - if (r['selector'] === startRule['selector']) { - Object.assign(fallbacks, this._cssTextToMap(r['parsedCssText'])); - } - }); - return fallbacks; - } - /** - * replace mixin consumption with variable consumption - * @param {string} text - * @param {!StyleNode=} rule - * @return {string} - */ - _consumeCssProperties(text, rule) { - /** @type {Array} */ - let m = null; - // 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 = rule ? this._fallbacksFromPreviousRules(rule) : {}; - Object.assign(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}`; - // 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) - * - * @param {string} mixinName - * @param {Object} fallbacks - * @return {string} - */ - _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._currentElement) { - mixinEntry.dependants[this._currentElement] = true; - } - let p, parts, f; - const properties = mixinEntry.properties; - for (p in properties) { - f = fallbacks && fallbacks[p]; - parts = [p, ': var(', mixinName, MIXIN_VAR_SEP, p]; - if (f) { - parts.push(',', f.replace(IMPORTANT, '')); - } - parts.push(')'); - if (IMPORTANT.test(properties[p])) { - parts.push(' !important'); - } - vars.push(parts.join('')); - } - } - return vars.join('; '); - } - - /** - * @param {string} property - * @param {string} value - * @return {string} - */ - _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 = this._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') - * @param {string} text - * @param {boolean=} replaceInitialOrInherit - * @return {!Object<string, string>} - */ - _cssTextToMap(text, replaceInitialOrInherit = false) { - 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 = sp.slice(1).join(':'); - if (replaceInitialOrInherit) { - value = this._replaceInitialOrInherit(property, value); - } - out[property] = value; - } - } - } - return out; - } - - /** - * @param {MixinMapEntry} mixinEntry - */ - _invalidateMixinEntry(mixinEntry) { - if (!invalidCallback) { - return; - } - for (let elementName in mixinEntry.dependants) { - if (elementName !== this._currentElement) { - invalidCallback(elementName); - } - } - } - - /** - * @param {string} matchText - * @param {string} propertyName - * @param {?string} valueProperty - * @param {?string} valueMixin - * @param {!StyleNode} rule - * @return {string} - */ - _produceCssProperties(matchText, propertyName, valueProperty, valueMixin, rule) { - // 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, rule); - let prefix = matchText.slice(0, matchText.indexOf('--')); - // `initial` and `inherit` as properties in a map should be replaced because - // these keywords are eagerly evaluated when the mixin becomes CSS Custom Properties, - // and would set the variable value, rather than carry the keyword to the `var()` usage. - let mixinValues = this._cssTextToMap(mixinAsProperties, true); - 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('; ')};`; - } -} - -/* exports */ -/* eslint-disable no-self-assign */ -ApplyShim.prototype['detectMixin'] = ApplyShim.prototype.detectMixin; -ApplyShim.prototype['transformStyle'] = ApplyShim.prototype.transformStyle; -ApplyShim.prototype['transformCustomStyle'] = ApplyShim.prototype.transformCustomStyle; -ApplyShim.prototype['transformRules'] = ApplyShim.prototype.transformRules; -ApplyShim.prototype['transformRule'] = ApplyShim.prototype.transformRule; -ApplyShim.prototype['transformTemplate'] = ApplyShim.prototype.transformTemplate; -ApplyShim.prototype['_separator'] = MIXIN_VAR_SEP; -/* eslint-enable no-self-assign */ -Object.defineProperty(ApplyShim.prototype, 'invalidCallback', { - /** @return {?function(string)} */ - get() { - return invalidCallback; - }, - /** @param {?function(string)} cb */ - set(cb) { - invalidCallback = cb; - } -}); - -export default ApplyShim; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/common-regex.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/common-regex.js deleted file mode 100644 index 126fc15c141..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/common-regex.js +++ /dev/null @@ -1,19 +0,0 @@ -/** -@license -Copyright (c) 2017 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 -*/ - -export const VAR_ASSIGN = /(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gi; -export const MIXIN_MATCH = /(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi; -export const VAR_CONSUMED = /(--[\w-]+)\s*([:,;)]|$)/gi; -export const ANIMATION_MATCH = /(animation\s*:)|(animation-name\s*:)/; -export const MEDIA_MATCH = /@media\s(.*)/; -export const IS_VAR = /^--/; -export const BRACKETED = /\{[^}]*\}/g; -export const HOST_PREFIX = '(?:^|[^.#[:])'; -export const HOST_SUFFIX = '($|[.:[\\s>+~])'; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/common-utils.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/common-utils.js deleted file mode 100644 index 863250be2f4..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/common-utils.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -import { MIXIN_MATCH, VAR_ASSIGN } from './common-regex.js'; - -/** - * @param {Element} element - * @param {Object=} properties - */ -export function 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]); - } - } -} - -/** - * @param {Element} element - * @param {string} property - * @return {string} - */ -export function getComputedStyleValue(element, property) { - /** - * @const {string} - */ - const value = window.getComputedStyle(element).getPropertyValue(property); - if (!value) { - return ''; - } else { - return value.trim(); - } -} - -/** - * return true if `cssText` contains a mixin definition or consumption - * @param {string} cssText - * @return {boolean} - */ -export function 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; -} diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/css-parse.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/css-parse.js deleted file mode 100644 index 8a8fb1cd9ea..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/css-parse.js +++ /dev/null @@ -1,264 +0,0 @@ -/** -@license -Copyright (c) 2017 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 =). -*/ - -'use strict'; - -/** @unrestricted */ -class StyleNode { - constructor() { - /** @type {number} */ - this['start'] = 0; - /** @type {number} */ - this['end'] = 0; - /** @type {StyleNode} */ - this['previous'] = null; - /** @type {StyleNode} */ - this['parent'] = null; - /** @type {Array<StyleNode>} */ - this['rules'] = null; - /** @type {string} */ - this['parsedCssText'] = ''; - /** @type {string} */ - this['cssText'] = ''; - /** @type {boolean} */ - this['atRule'] = false; - /** @type {number} */ - this['type'] = 0; - /** @type {string} */ - this['keyframesName'] = ''; - /** @type {string} */ - this['selector'] = ''; - /** @type {string} */ - this['parsedSelector'] = ''; - } -} - -export {StyleNode} - -// given a string of css, return a simple rule tree -/** - * @param {string} text - * @return {StyleNode} - */ -export function parse(text) { - text = clean(text); - return parseCss(lex(text), text); -} - -// remove stuff we don't care about that may hinder parsing -/** - * @param {string} cssText - * @return {string} - */ -function clean(cssText) { - return cssText.replace(RX.comments, '').replace(RX.port, ''); -} - -// super simple {...} lexer that returns a node tree -/** - * @param {string} text - * @return {StyleNode} - */ -function lex(text) { - let root = new StyleNode(); - root['start'] = 0; - root['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] || null; - n = new StyleNode(); - n['start'] = i + 1; - n['parent'] = p; - n['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 -/** - * @param {StyleNode} node - * @param {string} text - * @return {StyleNode} - */ -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` - * @param {string} s - * @return {string} - */ -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. - * @param {StyleNode} node - * @param {boolean=} preserveProperties - * @param {string=} text - * @return {string} - */ -export function stringify(node, preserveProperties, 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; -} - -/** - * @param {Array<StyleNode>} rules - * @return {boolean} - */ -function _hasMixinRules(rules) { - let r = rules[0]; - return Boolean(r) && Boolean(r['selector']) && r['selector'].indexOf(VAR_START) === 0; -} - -/** - * @param {string} cssText - * @return {string} - */ -function removeCustomProps(cssText) { - cssText = removeCustomPropAssignment(cssText); - return removeCustomPropApply(cssText); -} - -/** - * @param {string} cssText - * @return {string} - */ -export function removeCustomPropAssignment(cssText) { - return cssText - .replace(RX.customProp, '') - .replace(RX.mixinProp, ''); -} - -/** - * @param {string} cssText - * @return {string} - */ -function removeCustomPropApply(cssText) { - return cssText - .replace(RX.mixinApply, '') - .replace(RX.varApply, ''); -} - -/** @enum {number} */ -export const types = { - STYLE_RULE: 1, - KEYFRAMES_RULE: 7, - MEDIA_RULE: 4, - MIXIN_RULE: 1000 -} - -const OPEN_BRACE = '{'; -const CLOSE_BRACE = '}'; - -// helper regexp's -const 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 -} - -const VAR_START = '--'; -const MEDIA_START = '@media'; -const AT_START = '@'; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/custom-style-interface.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/custom-style-interface.js deleted file mode 100644 index 257433bfbbc..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/custom-style-interface.js +++ /dev/null @@ -1,164 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -import documentWait from './document-wait.js'; - -/** - * @typedef {HTMLStyleElement | {getStyle: function():HTMLStyleElement}} - */ -export let CustomStyleProvider; - -const SEEN_MARKER = '__seenByShadyCSS'; -const CACHED_STYLE = '__shadyCSSCachedStyle'; - -/** @type {?function(!HTMLStyleElement)} */ -let transformFn = null; - -/** @type {?function()} */ -let validateFn = null; - -/** -This interface is provided to add document-level <style> elements to ShadyCSS for processing. -These styles must be processed by ShadyCSS to simulate ShadowRoot upper-bound encapsulation from outside styles -In addition, these styles may also need to be processed for @apply rules and CSS Custom Properties - -To add document-level styles to ShadyCSS, one can call `ShadyCSS.addDocumentStyle(styleElement)` or `ShadyCSS.addDocumentStyle({getStyle: () => styleElement})` - -In addition, if the process used to discover document-level styles can be synchronously flushed, one should set `ShadyCSS.documentStyleFlush`. -This function will be called when calculating styles. - -An example usage of the document-level styling api can be found in `examples/document-style-lib.js` - -@unrestricted -*/ -export default class CustomStyleInterface { - constructor() { - /** @type {!Array<!CustomStyleProvider>} */ - this['customStyles'] = []; - this['enqueued'] = false; - // NOTE(dfreedm): use quotes here to prevent closure inlining to `function(){}`; - documentWait(() => { - if (window['ShadyCSS']['flushCustomStyles']) { - window['ShadyCSS']['flushCustomStyles'](); - } - }) - } - /** - * Queue a validation for new custom styles to batch style recalculations - */ - enqueueDocumentValidation() { - if (this['enqueued'] || !validateFn) { - return; - } - this['enqueued'] = true; - documentWait(validateFn); - } - /** - * @param {!HTMLStyleElement} style - */ - addCustomStyle(style) { - if (!style[SEEN_MARKER]) { - style[SEEN_MARKER] = true; - this['customStyles'].push(style); - this.enqueueDocumentValidation(); - } - } - /** - * @param {!CustomStyleProvider} customStyle - * @return {HTMLStyleElement} - */ - getStyleForCustomStyle(customStyle) { - if (customStyle[CACHED_STYLE]) { - return customStyle[CACHED_STYLE]; - } - let style; - if (customStyle['getStyle']) { - style = customStyle['getStyle'](); - } else { - style = customStyle; - } - return style; - } - /** - * @return {!Array<!CustomStyleProvider>} - */ - processStyles() { - const cs = this['customStyles']; - for (let i = 0; i < cs.length; i++) { - const customStyle = cs[i]; - if (customStyle[CACHED_STYLE]) { - continue; - } - const style = this.getStyleForCustomStyle(customStyle); - if (style) { - // HTMLImports polyfill may have cloned the style into the main document, - // which is referenced with __appliedElement. - const styleToTransform = /** @type {!HTMLStyleElement} */(style['__appliedElement'] || style); - if (transformFn) { - transformFn(styleToTransform); - } - customStyle[CACHED_STYLE] = styleToTransform; - } - } - return cs; - } -} - -/* eslint-disable no-self-assign */ -CustomStyleInterface.prototype['addCustomStyle'] = CustomStyleInterface.prototype.addCustomStyle; -CustomStyleInterface.prototype['getStyleForCustomStyle'] = CustomStyleInterface.prototype.getStyleForCustomStyle; -CustomStyleInterface.prototype['processStyles'] = CustomStyleInterface.prototype.processStyles; -/* eslint-enable no-self-assign */ - -Object.defineProperties(CustomStyleInterface.prototype, { - 'transformCallback': { - /** @return {?function(!HTMLStyleElement)} */ - get() { - return transformFn; - }, - /** @param {?function(!HTMLStyleElement)} fn */ - set(fn) { - transformFn = fn; - } - }, - 'validateCallback': { - /** @return {?function()} */ - get() { - return validateFn; - }, - /** - * @param {?function()} fn - * @this {CustomStyleInterface} - */ - set(fn) { - let needsEnqueue = false; - if (!validateFn) { - needsEnqueue = true; - } - validateFn = fn; - if (needsEnqueue) { - this.enqueueDocumentValidation(); - } - }, - } -}) - -/** @typedef {{ - * customStyles: !Array<!CustomStyleProvider>, - * addCustomStyle: function(!CustomStyleProvider), - * getStyleForCustomStyle: function(!CustomStyleProvider): HTMLStyleElement, - * findStyles: function(), - * transformCallback: ?function(!HTMLStyleElement), - * validateCallback: ?function() - * }} - */ -export const CustomStyleInterfaceInterface = {}; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/document-wait.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/document-wait.js deleted file mode 100644 index 398ca056820..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/document-wait.js +++ /dev/null @@ -1,45 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -/** @type {Promise<void>} */ -let readyPromise = null; - -/** @type {?function(?function())} */ -let whenReady = window['HTMLImports'] && window['HTMLImports']['whenReady'] || null; - -/** @type {function()} */ -let resolveFn; - -/** - * @param {?function()} callback - */ -export default function documentWait(callback) { - requestAnimationFrame(function() { - if (whenReady) { - whenReady(callback) - } else { - if (!readyPromise) { - readyPromise = new Promise((resolve) => {resolveFn = resolve}); - if (document.readyState === 'complete') { - resolveFn(); - } else { - document.addEventListener('readystatechange', () => { - if (document.readyState === 'complete') { - resolveFn(); - } - }); - } - } - readyPromise.then(function(){ callback && callback(); }); - } - }); -} diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/document-watcher.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/document-watcher.js deleted file mode 100644 index 9cf34f0541e..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/document-watcher.js +++ /dev/null @@ -1,198 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -import {nativeShadow} from './style-settings.js'; -import StyleTransformer from './style-transformer.js'; -import {getIsExtends, elementHasBuiltCss, wrap} from './style-util.js'; - -export let flush = function() {}; - -/** - * @param {!Element} element - * @return {string} - */ -function getClasses(element) { - if (element.classList && element.classList.value) { - return element.classList.value; - } else { - // NOTE: className is patched to remove scoping classes in ShadyDOM - // use getAttribute('class') instead, which is unpatched - return element.getAttribute('class') || ''; - } -} - -const scopeRegExp = new RegExp(`${StyleTransformer.SCOPE_NAME}\\s*([^\\s]*)`); - -/** - * @param {!Element} element - * @return {string} - */ -export function getCurrentScope(element) { - const match = getClasses(element).match(scopeRegExp); - if (match) { - return match[1]; - } else { - return ''; - } -} - -/** - * @param {!Node} node - */ -export function getOwnerScope(node) { - const ownerRoot = wrap(node).getRootNode(); - if (ownerRoot === node || ownerRoot === node.ownerDocument) { - return ''; - } - const host = /** @type {!ShadowRoot} */(ownerRoot).host; - if (!host) { - // this may actually be a document fragment - return ''; - } - return getIsExtends(host).is; -} - -/** - * @param {!Element} element - */ -export function ensureCorrectScope(element) { - const currentScope = getCurrentScope(element); - const ownerRoot = wrap(element).getRootNode(); - if (ownerRoot === element) { - return; - } - if (currentScope && ownerRoot === element.ownerDocument) { - // node was scoped, but now is in document - StyleTransformer.domRemoveScope(element, currentScope); - } else if (ownerRoot instanceof ShadowRoot) { - const ownerScope = getOwnerScope(element); - if (ownerScope !== currentScope) { - // node was scoped, but not by its current owner - StyleTransformer.domReplaceScope(element, currentScope, ownerScope); - } - } -} - -/** - * @param {!HTMLElement|!HTMLDocument} element - */ -export function ensureCorrectSubtreeScoping(element) { - // find unscoped subtree nodes - const unscopedNodes = window['ShadyDOM']['nativeMethods']['querySelectorAll'].call( - element, `:not(.${StyleTransformer.SCOPE_NAME})`); - - for (let j = 0; j < unscopedNodes.length; j++) { - // it's possible, during large batch inserts, that nodes that aren't - // scoped within the current scope were added. - // To make sure that any unscoped nodes that were inserted in the current batch are correctly styled, - // query all unscoped nodes and force their style-scope to be applied. - // This could happen if a sub-element appended an unscoped node in its shadowroot and this function - // runs on a parent element of the host of that unscoped node: - // parent-element -> element -> unscoped node - // Here unscoped node should have the style-scope element, not parent-element. - const unscopedNode = unscopedNodes[j]; - const scopeForPreviouslyUnscopedNode = getOwnerScope(unscopedNode); - if (scopeForPreviouslyUnscopedNode) { - StyleTransformer.element(unscopedNode, scopeForPreviouslyUnscopedNode); - } - } -} - -/** - * @param {HTMLElement} el - * @return {boolean} - */ -function isElementWithBuiltCss(el) { - if (el.localName === 'style' || el.localName === 'template') { - return elementHasBuiltCss(el); - } - return false; -} - -/** - * @param {Array<MutationRecord|null>|null} mxns - */ -function 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 (n.nodeType !== Node.ELEMENT_NODE) { - continue; - } - n = /** @type {HTMLElement} */(n); // eslint-disable-line no-self-assign - let root = n.getRootNode(); - let currentScope = getCurrentScope(n); - // node was scoped, but now is in document - // If this element has built css, we must not remove scoping as this node - // will be used as a template or style without re - applying scoping as an optimization - if (currentScope && root === n.ownerDocument && !isElementWithBuiltCss(n)) { - StyleTransformer.domRemoveScope(n, currentScope); - } else if (root instanceof ShadowRoot) { - const newScope = getOwnerScope(n); - // rescope current node and subtree if necessary - if (newScope !== currentScope) { - StyleTransformer.domReplaceScope(n, currentScope, newScope); - } - // make sure all the subtree elements are scoped correctly - ensureCorrectSubtreeScoping(n); - } - } - } -} - -// if native Shadow DOM is being used, or ShadyDOM handles dynamic scoiping, do not activate the MutationObserver -if (!nativeShadow && !(window['ShadyDOM'] && window['ShadyDOM']['handlesDynamicScoping'])) { - let observer = new MutationObserver(handler); - let start = (node) => { - observer.observe(node, {childList: true, subtree: true}); - } - let nativeCustomElements = (window['customElements'] && - !window['customElements']['polyfillWrapFlushCallback']); - // 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()); - } -} diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/scoping-shim.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/scoping-shim.js deleted file mode 100644 index 4deeece6ed7..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/scoping-shim.js +++ /dev/null @@ -1,607 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -import {parse, StyleNode} from './css-parse.js'; -import {nativeShadow, nativeCssVariables, disableRuntime} from './style-settings.js'; -import StyleTransformer from './style-transformer.js'; -import * as StyleUtil from './style-util.js'; -import StyleProperties from './style-properties.js'; -import {ensureStylePlaceholder, getStylePlaceholder} from './style-placeholder.js'; -import StyleInfo from './style-info.js'; -import StyleCache from './style-cache.js'; -import {flush as watcherFlush, getOwnerScope, getCurrentScope} from './document-watcher.js'; -import templateMap from './template-map.js'; -import * as ApplyShimUtils from './apply-shim-utils.js'; -import {updateNativeProperties, detectMixin} from './common-utils.js'; -import {CustomStyleInterfaceInterface} from './custom-style-interface.js'; // eslint-disable-line no-unused-vars - -/** @type {!Object<string, string>} */ -const adoptedCssTextMap = {}; - -/** - * @const {StyleCache} - */ -const styleCache = new StyleCache(); - -export default class ScopingShim { - constructor() { - this._scopeCounter = {}; - this._documentOwner = /** @type {!HTMLElement} */(document.documentElement); - let ast = new StyleNode(); - ast['rules'] = []; - this._documentOwnerStyleInfo = StyleInfo.set(this._documentOwner, new StyleInfo(ast)); - this._elementsHaveApplied = false; - /** @type {?Object} */ - this._applyShim = null; - /** @type {?CustomStyleInterfaceInterface} */ - this._customStyleInterface = null; - } - flush() { - watcherFlush(); - } - _generateScopeSelector(name) { - let id = this._scopeCounter[name] = (this._scopeCounter[name] || 0) + 1; - return `${name}-${id}`; - } - getStyleAst(style) { - return StyleUtil.rulesForStyle(style); - } - styleAstToString(ast) { - return StyleUtil.toCssText(ast); - } - _gatherStyles(template) { - return StyleUtil.gatherStyleText(template.content); - } - /** - * Prepare the styling and template for the given element type - * - * @param {!HTMLTemplateElement} template - * @param {string} elementName - * @param {string=} typeExtension - */ - prepareTemplate(template, elementName, typeExtension) { - this.prepareTemplateDom(template, elementName); - this.prepareTemplateStyles(template, elementName, typeExtension); - } - /** - * Prepare styling for the given element type - * @param {!HTMLTemplateElement} template - * @param {string} elementName - * @param {string=} typeExtension - */ - prepareTemplateStyles(template, elementName, typeExtension) { - if (template._prepared || disableRuntime) { - return; - } - // style placeholders are only used when ShadyDOM is active - if (!nativeShadow) { - ensureStylePlaceholder(elementName); - } - template._prepared = true; - template.name = elementName; - template.extends = typeExtension; - templateMap[elementName] = template; - let cssBuild = StyleUtil.getCssBuild(template); - const optimalBuild = StyleUtil.isOptimalCssBuild(cssBuild); - let info = { - is: elementName, - extends: typeExtension, - }; - let cssText = this._gatherStyles(template) + (adoptedCssTextMap[elementName] || ''); - // check if the styling has mixin definitions or uses - this._ensure(); - if (!optimalBuild) { - let hasMixins = !cssBuild && detectMixin(cssText); - let ast = parse(cssText); - // only run the applyshim transforms if there is a mixin involved - if (hasMixins && nativeCssVariables && this._applyShim) { - this._applyShim['transformRules'](ast, elementName); - } - template['_styleAst'] = ast; - } - let ownPropertyNames = []; - if (!nativeCssVariables) { - ownPropertyNames = StyleProperties.decorateStyles(template['_styleAst']); - } - if (!ownPropertyNames.length || nativeCssVariables) { - let root = nativeShadow ? template.content : null; - let placeholder = getStylePlaceholder(elementName); - let style = this._generateStaticStyle(info, template['_styleAst'], root, placeholder, cssBuild, optimalBuild ? cssText : ''); - template._style = style; - } - template._ownPropertyNames = ownPropertyNames; - } - - /** - * @param {!Array<string>} cssTextArray - * @param {string} elementName - */ - prepareAdoptedCssText(cssTextArray, elementName) { - adoptedCssTextMap[elementName] = cssTextArray.join(' '); - } - /** - * Prepare template for the given element type - * @param {!HTMLTemplateElement} template - * @param {string} elementName - */ - prepareTemplateDom(template, elementName) { - if (disableRuntime) { - return; - } - const cssBuild = StyleUtil.getCssBuild(template); - if (!nativeShadow && cssBuild !== 'shady' && !template._domPrepared) { - template._domPrepared = true; - StyleTransformer.domAddScope(template.content, elementName); - } - } - /** - * @param {!{is: string, extends: (string|undefined)}} info - * @param {!StyleNode} rules - * @param {DocumentFragment} shadowroot - * @param {Node} placeholder - * @param {string} cssBuild - * @param {string=} cssText - * @return {?HTMLStyleElement} - */ - _generateStaticStyle(info, rules, shadowroot, placeholder, cssBuild, cssText) { - cssText = StyleTransformer.elementStyles(info, rules, null, cssBuild, cssText); - if (cssText.length) { - return StyleUtil.applyCss(cssText, info.is, shadowroot, placeholder); - } - return null; - } - _prepareHost(host) { - const {is, typeExtension} = StyleUtil.getIsExtends(host); - const placeholder = getStylePlaceholder(is); - const template = templateMap[is]; - if (!template) { - return; - } - const ast = template['_styleAst']; - const ownStylePropertyNames = template._ownPropertyNames; - const cssBuild = StyleUtil.getCssBuild(template); - const styleInfo = new StyleInfo( - ast, - placeholder, - ownStylePropertyNames, - is, - typeExtension, - cssBuild - ); - StyleInfo.set(host, styleInfo); - return styleInfo; - } - _ensureApplyShim() { - if (this._applyShim) { - return; - } else if (window.ShadyCSS && window.ShadyCSS.ApplyShim) { - this._applyShim = /** @type {!Object} */ (window.ShadyCSS.ApplyShim); - this._applyShim['invalidCallback'] = ApplyShimUtils.invalidate; - } - } - _ensureCustomStyleInterface() { - if (this._customStyleInterface) { - return; - } else if (window.ShadyCSS && window.ShadyCSS.CustomStyleInterface) { - this._customStyleInterface = /** @type {!CustomStyleInterfaceInterface} */(window.ShadyCSS.CustomStyleInterface); - /** @type {function(!HTMLStyleElement)} */ - this._customStyleInterface['transformCallback'] = (style) => {this.transformCustomStyleForDocument(style)}; - this._customStyleInterface['validateCallback'] = () => { - requestAnimationFrame(() => { - if (this._customStyleInterface['enqueued'] || this._elementsHaveApplied) { - this.flushCustomStyles(); - } - }) - }; - } - } - _ensure() { - this._ensureApplyShim(); - this._ensureCustomStyleInterface(); - } - /** - * Flush and apply custom styles to document - */ - flushCustomStyles() { - if (disableRuntime) { - return; - } - this._ensure(); - if (!this._customStyleInterface) { - return; - } - let customStyles = this._customStyleInterface['processStyles'](); - // early return if custom-styles don't need validation - if (!this._customStyleInterface['enqueued']) { - return; - } - // bail if custom styles are built optimally - if (StyleUtil.isOptimalCssBuild(this._documentOwnerStyleInfo.cssBuild)) { - return; - } - if (!nativeCssVariables) { - this._updateProperties(this._documentOwner, this._documentOwnerStyleInfo); - this._applyCustomStyles(customStyles); - if (this._elementsHaveApplied) { - // if custom elements have upgraded and there are no native css variables, we must recalculate the whole tree - this.styleDocument(); - } - } else if (!this._documentOwnerStyleInfo.cssBuild) { - this._revalidateCustomStyleApplyShim(customStyles); - } - this._customStyleInterface['enqueued'] = false; - } - /** - * Apply styles for the given element - * - * @param {!HTMLElement} host - * @param {Object=} overrideProps - */ - styleElement(host, overrideProps) { - if (disableRuntime) { - if (overrideProps) { - if (!StyleInfo.get(host)) { - StyleInfo.set(host, new StyleInfo(null)); - } - const styleInfo = /** @type {!StyleInfo} */(StyleInfo.get(host)); - this._mixOverrideStyleProps(styleInfo, overrideProps); - this.styleElementNativeVariables(host, styleInfo); - } - return; - } - const styleInfo = StyleInfo.get(host) || this._prepareHost(host); - // if there is no style info at this point, bail - if (!styleInfo) { - return; - } - // Only trip the `elementsHaveApplied` flag if a node other that the root document has `applyStyle` called - if (!this._isRootOwner(host)) { - this._elementsHaveApplied = true; - } - if (overrideProps) { - this._mixOverrideStyleProps(styleInfo, overrideProps); - } - if (!nativeCssVariables) { - this.styleElementShimVariables(host, styleInfo); - } else { - this.styleElementNativeVariables(host, styleInfo); - } - } - /** - * @param {!StyleInfo} styleInfo - * @param {Object} overrideProps - */ - _mixOverrideStyleProps(styleInfo, overrideProps) { - styleInfo.overrideStyleProperties = - styleInfo.overrideStyleProperties || {}; - Object.assign(styleInfo.overrideStyleProperties, overrideProps); - } - /** - * @param {!HTMLElement} host - * @param {!StyleInfo} styleInfo - */ - styleElementShimVariables(host, styleInfo) { - this.flush(); - this._updateProperties(host, styleInfo); - if (styleInfo.ownStylePropertyNames && styleInfo.ownStylePropertyNames.length) { - this._applyStyleProperties(host, styleInfo); - } - } - /** - * @param {!HTMLElement} host - * @param {!StyleInfo} styleInfo - */ - styleElementNativeVariables(host, styleInfo) { - const { is } = StyleUtil.getIsExtends(host); - if (styleInfo.overrideStyleProperties) { - updateNativeProperties(host, styleInfo.overrideStyleProperties); - } - const template = templateMap[is]; - // bail early if there is no shadowroot for this element - if (!template && !this._isRootOwner(host)) { - return; - } - // bail early if the template was built with polymer-css-build - if (template && StyleUtil.elementHasBuiltCss(template)) { - return; - } - if (template && template._style && !ApplyShimUtils.templateIsValid(template)) { - // update template - if (!ApplyShimUtils.templateIsValidating(template)) { - this._ensure(); - this._applyShim && this._applyShim['transformRules'](template['_styleAst'], is); - template._style.textContent = StyleTransformer.elementStyles(host, styleInfo.styleRules); - ApplyShimUtils.startValidatingTemplate(template); - } - // update instance if native shadowdom - if (nativeShadow) { - let root = host.shadowRoot; - if (root) { - let style = root.querySelector('style'); - if (style) { - style.textContent = StyleTransformer.elementStyles(host, styleInfo.styleRules); - } - } - } - styleInfo.styleRules = template['_styleAst']; - } - } - _styleOwnerForNode(node) { - let root = StyleUtil.wrap(node).getRootNode(); - let host = root.host; - if (host) { - if (StyleInfo.get(host) || this._prepareHost(host)) { - return host; - } else { - return this._styleOwnerForNode(host); - } - } - return this._documentOwner; - } - _isRootOwner(node) { - return (node === this._documentOwner); - } - _applyStyleProperties(host, styleInfo) { - let is = StyleUtil.getIsExtends(host).is; - 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.applyElementStyle(host, styleInfo.styleProperties, styleInfo.scopeSelector, cachedStyle); - if (!nativeShadow) { - StyleProperties.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; - // style owner has not updated properties yet - // go up the chain and force property update, - // except if the owner is the document - if (owner !== this._documentOwner && !ownerProperties) { - this._updateProperties(owner, ownerStyleInfo); - ownerProperties = ownerStyleInfo.styleProperties; - } - let props = Object.create(ownerProperties || null); - let hostAndRootProps = StyleProperties.hostAndRootPropertiesForScope(host, styleInfo.styleRules, styleInfo.cssBuild); - let propertyData = StyleProperties.propertyDataFromStyles(ownerStyleInfo.styleRules, host); - let propertiesMatchingHost = propertyData.properties - Object.assign( - props, - hostAndRootProps.hostProps, - propertiesMatchingHost, - hostAndRootProps.rootProps - ); - this._mixinOverrideStyles(props, styleInfo.overrideStyleProperties); - StyleProperties.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; - } - } - } - /** - * Update styles of the whole document - * - * @param {Object=} properties - */ - styleDocument(properties) { - this.styleSubtree(this._documentOwner, properties); - } - /** - * Update styles of a subtree - * - * @param {!HTMLElement} host - * @param {Object=} properties - */ - styleSubtree(host, properties) { - const wrappedHost = StyleUtil.wrap(host); - let root = wrappedHost.shadowRoot; - if (root || this._isRootOwner(host)) { - this.styleElement(host, properties); - } - // process the shadowdom children of `host` - let shadowChildren = - root && (/** @type {!ParentNode} */ (root).children || root.childNodes); - if (shadowChildren) { - for (let i = 0; i < shadowChildren.length; i++) { - let c = /** @type {!HTMLElement} */(shadowChildren[i]); - this.styleSubtree(c); - } - } else { - // process the lightdom children of `host` - let children = wrappedHost.children || wrappedHost.childNodes; - if (children) { - for (let i = 0; i < children.length; i++) { - let c = /** @type {!HTMLElement} */(children[i]); - this.styleSubtree(c); - } - } - } - } - /* Custom Style operations */ - _revalidateCustomStyleApplyShim(customStyles) { - for (let i = 0; i < customStyles.length; i++) { - let c = customStyles[i]; - let s = this._customStyleInterface['getStyleForCustomStyle'](c); - if (s) { - this._revalidateApplyShim(s); - } - } - } - _applyCustomStyles(customStyles) { - for (let i = 0; i < customStyles.length; i++) { - let c = customStyles[i]; - let s = this._customStyleInterface['getStyleForCustomStyle'](c); - if (s) { - StyleProperties.applyCustomStyle(s, this._documentOwnerStyleInfo.styleProperties); - } - } - } - transformCustomStyleForDocument(style) { - const cssBuild = StyleUtil.getCssBuild(style); - if (cssBuild !== this._documentOwnerStyleInfo.cssBuild) { - this._documentOwnerStyleInfo.cssBuild = cssBuild; - } - if (StyleUtil.isOptimalCssBuild(cssBuild)) { - return; - } - let ast = StyleUtil.rulesForStyle(style); - StyleUtil.forEachRule(ast, (rule) => { - if (nativeShadow) { - StyleTransformer.normalizeRootSelector(rule); - } else { - StyleTransformer.documentRule(rule); - } - if (nativeCssVariables && cssBuild === '') { - this._ensure(); - this._applyShim && this._applyShim['transformRule'](rule); - } - }); - if (nativeCssVariables) { - style.textContent = StyleUtil.toCssText(ast); - } else { - this._documentOwnerStyleInfo.styleRules['rules'].push(ast); - } - } - _revalidateApplyShim(style) { - if (nativeCssVariables && this._applyShim) { - let ast = StyleUtil.rulesForStyle(style); - this._ensure(); - this._applyShim['transformRules'](ast); - style.textContent = StyleUtil.toCssText(ast); - } - } - getComputedStyleValue(element, property) { - let value; - if (!nativeCssVariables) { - // 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 ? 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 = StyleUtil.wrap(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.SCOPE_NAME) { - scopeName = k$[i+1]; - break; - } - } - } - } - if (scopeName) { - classes.push(StyleTransformer.SCOPE_NAME, scopeName); - } - if (!nativeCssVariables) { - let styleInfo = StyleInfo.get(element); - if (styleInfo && styleInfo.scopeSelector) { - classes.push(StyleProperties.XSCOPE_NAME, styleInfo.scopeSelector); - } - } - StyleUtil.setElementClassRaw(element, classes.join(' ')); - } - _styleInfoForNode(node) { - return StyleInfo.get(node); - } - /** - * @param {!Element} node - * @param {string} scope - */ - scopeNode(node, scope) { - StyleTransformer.element(node, scope); - } - /** - * @param {!Element} node - * @param {string} scope - */ - unscopeNode(node, scope) { - StyleTransformer.element(node, scope, true); - } - /** - * @param {!Node} node - * @return {string} - */ - scopeForNode(node) { - return getOwnerScope(node); - } - /** - * @param {!Element} node - * @return {string} - */ - currentScopeForNode(node) { - return getCurrentScope(node); - } -} - -/* exports */ -/* eslint-disable no-self-assign */ -ScopingShim.prototype['flush'] = ScopingShim.prototype.flush; -ScopingShim.prototype['prepareTemplate'] = ScopingShim.prototype.prepareTemplate; -ScopingShim.prototype['styleElement'] = ScopingShim.prototype.styleElement; -ScopingShim.prototype['styleDocument'] = ScopingShim.prototype.styleDocument; -ScopingShim.prototype['styleSubtree'] = ScopingShim.prototype.styleSubtree; -ScopingShim.prototype['getComputedStyleValue'] = ScopingShim.prototype.getComputedStyleValue; -ScopingShim.prototype['setElementClass'] = ScopingShim.prototype.setElementClass; -ScopingShim.prototype['_styleInfoForNode'] = ScopingShim.prototype._styleInfoForNode; -ScopingShim.prototype['transformCustomStyleForDocument'] = ScopingShim.prototype.transformCustomStyleForDocument; -ScopingShim.prototype['getStyleAst'] = ScopingShim.prototype.getStyleAst; -ScopingShim.prototype['styleAstToString'] = ScopingShim.prototype.styleAstToString; -ScopingShim.prototype['flushCustomStyles'] = ScopingShim.prototype.flushCustomStyles; -ScopingShim.prototype['scopeNode'] = ScopingShim.prototype.scopeNode; -ScopingShim.prototype['unscopeNode'] = ScopingShim.prototype.unscopeNode; -ScopingShim.prototype['scopeForNode'] = ScopingShim.prototype.scopeForNode; -ScopingShim.prototype['currentScopeForNode'] = ScopingShim.prototype.currentScopeForNode; -ScopingShim.prototype['prepareAdoptedCssText'] = ScopingShim.prototype.prepareAdoptedCssText; -/* eslint-enable no-self-assign */ -Object.defineProperties(ScopingShim.prototype, { - 'nativeShadow': { - get() { - return nativeShadow; - } - }, - 'nativeCss': { - get() { - return nativeCssVariables; - } - } -}); diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-cache.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-cache.js deleted file mode 100644 index 0006a0bce77..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-cache.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -export default class StyleCache { - constructor(typeMax = 100) { - // map element name -> [{properties, styleElement, scopeSelector}] - this.cache = {}; - /** @type {number} */ - 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; - } - } - } -} diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-info.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-info.js deleted file mode 100644 index deab329395a..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-info.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -import {StyleNode} from './css-parse.js'; // eslint-disable-line no-unused-vars - -/** @const {string} */ -const infoKey = '__styleInfo'; - -export default class StyleInfo { - /** - * @param {Element} node - * @return {StyleInfo} - */ - static get(node) { - if (node) { - return node[infoKey]; - } else { - return null; - } - } - /** - * @param {!Element} node - * @param {StyleInfo} styleInfo - * @return {StyleInfo} - */ - static set(node, styleInfo) { - node[infoKey] = styleInfo; - return styleInfo; - } - /** - * @param {StyleNode} ast - * @param {Node=} placeholder - * @param {Array<string>=} ownStylePropertyNames - * @param {string=} elementName - * @param {string=} typeExtension - * @param {string=} cssBuild - */ - constructor(ast, placeholder, ownStylePropertyNames, elementName, typeExtension, cssBuild) { - /** @type {StyleNode} */ - this.styleRules = ast || null; - /** @type {Node} */ - this.placeholder = placeholder || null; - /** @type {!Array<string>} */ - this.ownStylePropertyNames = ownStylePropertyNames || []; - /** @type {Object} */ - this.overrideStyleProperties = null; - /** @type {string} */ - this.elementName = elementName || ''; - /** @type {string} */ - this.cssBuild = cssBuild || ''; - /** @type {string} */ - this.typeExtension = typeExtension || ''; - /** @type {Object<string, string>} */ - this.styleProperties = null; - /** @type {?string} */ - this.scopeSelector = null; - /** @type {HTMLStyleElement} */ - this.customStyle = null; - } - _getStyleRules() { - return this.styleRules; - } -} - -/* eslint-disable-next-line no-self-assign */ -StyleInfo.prototype['_getStyleRules'] = StyleInfo.prototype._getStyleRules; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-placeholder.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-placeholder.js deleted file mode 100644 index d003379f9e0..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-placeholder.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -import {applyStylePlaceHolder} from './style-util.js'; -import {nativeShadow, disableRuntime} from './style-settings.js'; - -/** @type {!Object<string, !Node>} */ -const placeholderMap = {}; - -/** - * @param {string} elementName - * @return {Node} - */ -export function getStylePlaceholder(elementName) { - return placeholderMap[elementName] || null; -} - -/** - * @param {string} elementName - */ -export function ensureStylePlaceholder(elementName) { - if (!placeholderMap[elementName]) { - placeholderMap[elementName] = applyStylePlaceHolder(elementName); - } -} - -/** - * @const {CustomElementRegistry} - */ -const ce = window['customElements']; -if (ce && !nativeShadow && !disableRuntime) { - /** - * @const {function(this:CustomElementRegistry, string,function(new:HTMLElement),{extends: string}=)} - */ - const origDefine = ce['define']; - /** - * @param {string} name - * @param {function(new:HTMLElement)} clazz - * @param {{extends: string}=} options - */ - const wrappedDefine = (name, clazz, options) => { - ensureStylePlaceholder(name); - origDefine.call(/** @type {!CustomElementRegistry} */(ce), name, clazz, options); - }; - ce['define'] = wrappedDefine; -}
\ No newline at end of file diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-properties.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-properties.js deleted file mode 100644 index ecaa38915e3..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-properties.js +++ /dev/null @@ -1,608 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -import {removeCustomPropAssignment, StyleNode} from './css-parse.js'; // eslint-disable-line no-unused-vars -import {nativeShadow} from './style-settings.js'; -import StyleTransformer from './style-transformer.js'; -import * as StyleUtil from './style-util.js'; -import * as RX from './common-regex.js'; -import StyleInfo from './style-info.js'; - -// TODO: dedupe with shady -/** - * @param {string} selector - * @return {boolean} - * @this {Element} - */ -const matchesSelector = function(selector) { - const method = this.matches || this.matchesSelector || - this.mozMatchesSelector || this.msMatchesSelector || - this.oMatchesSelector || this.webkitMatchesSelector; - return method && method.call(this, selector); -}; - -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 - * - * @param {StyleNode} rules - * @return {Array<string>} - */ - decorateStyles(rules) { - let self = this, props = {}, keyframes = [], ruleIndex = 0; - StyleUtil.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 = RX.VAR_ASSIGN; - let cssText = rule['parsedCssText']; - let value; - let any; - while ((m = rx.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 = StyleUtil.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<parts.length; i++) { - if ((p = parts[i])) { - RX.MIXIN_MATCH.lastIndex = 0; - m = RX.MIXIN_MATCH.exec(p); - if (m) { - p = this.valueForProperty(props[m[1]], props); - } else { - let colon = p.indexOf(':'); - if (colon !== -1) { - let pp = p.substring(colon); - pp = pp.trim(); - pp = this.valueForProperty(pp, props) || pp; - p = p.substring(0, colon) + pp; - } - } - parts[i] = (p && p.lastIndexOf(';') === p.length - 1) ? - // strip trailing ; - p.slice(0, -1) : - p || ''; - } - } - return parts.join(';'); - } - - applyProperties(rule, props) { - let output = ''; - // dynamically added sheets may not be decorated so ensure they are. - if (!rule.propertyInfo) { - this.decorateRule(rule); - } - if (rule.propertyInfo.cssText) { - output = this.valueForProperties(rule.propertyInfo.cssText, props); - } - rule['cssText'] = output; - } - - // Apply keyframe transformations to the cssText of a given rule. The - // keyframeTransforms object is a map of keyframe names to transformer - // functions which take in cssText and spit out transformed cssText. - applyKeyframeTransforms(rule, keyframeTransforms) { - let input = rule['cssText']; - let output = rule['cssText']; - if (rule.hasAnimations == null) { - // Cache whether or not the rule has any animations to begin with: - rule.hasAnimations = RX.ANIMATION_MATCH.test(input); - } - // If there are no animations referenced, we can skip transforms: - if (rule.hasAnimations) { - let transform; - // If we haven't transformed this rule before, we iterate over all - // transforms: - if (rule.keyframeNamesToTransform == null) { - rule.keyframeNamesToTransform = []; - for (let keyframe in keyframeTransforms) { - transform = keyframeTransforms[keyframe]; - output = transform(input); - // If the transform actually changed the CSS text, we cache the - // transform name for future use: - if (input !== output) { - input = output; - rule.keyframeNamesToTransform.push(keyframe); - } - } - } else { - // If we already have a list of keyframe names that apply to this - // rule, we apply only those keyframe name transforms: - for (let i = 0; i < rule.keyframeNamesToTransform.length; ++i) { - transform = keyframeTransforms[rule.keyframeNamesToTransform[i]]; - input = transform(input); - } - output = input; - } - } - rule['cssText'] = output; - } - - // Test if the rules in these styles matches the given `element` and if so, - // collect any custom properties into `props`. - /** - * @param {StyleNode} rules - * @param {Element} element - */ - propertyDataFromStyles(rules, element) { - let props = {}; - // generates a unique key for these matches - let o = []; - // note: active rules excludes non-matching @media rules - StyleUtil.forEachRule(rules, (rule) => { - // TODO(sorvell): we could trim the set of rules at declaration - // time to only include ones that have properties - if (!rule.propertyInfo) { - this.decorateRule(rule); - } - // match element against transformedSelector: selector may contain - // unwanted uniquification and parsedSelector does not directly match - // for :host selectors. - let selectorToMatch = rule.transformedSelector || rule['parsedSelector']; - if (element && rule.propertyInfo.properties && selectorToMatch) { - if (matchesSelector.call(element, selectorToMatch)) { - this.collectProperties(rule, props); - // produce numeric key for these matches for lookup - addToBitMask(rule.index, o); - } - } - }, null, true); - return {properties: props, key: o}; - } - - /** - * @param {Element} scope - * @param {StyleNode} rule - * @param {string} cssBuild - * @param {function(Object)} callback - */ - whenHostOrRootRule(scope, rule, cssBuild, callback) { - if (!rule.propertyInfo) { - this.decorateRule(rule); - } - if (!rule.propertyInfo.properties) { - return; - } - let {is, typeExtension} = StyleUtil.getIsExtends(scope); - let hostScope = is ? - StyleTransformer._calcHostScope(is, typeExtension) : - 'html'; - let parsedSelector = rule['parsedSelector']; - let isRoot = (parsedSelector === ':host > *' || 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 (!isRoot && !isHost) { - return; - } - let selectorToMatch = hostScope; - if (isHost) { - // need to transform :host because `:host` does not work with `matches` - if (!rule.transformedSelector) { - // transform :host into a matchable selector - rule.transformedSelector = - StyleTransformer._transformRuleCss( - rule, - StyleTransformer._transformComplexSelector, - StyleTransformer._calcElementScope(is), - hostScope - ); - } - selectorToMatch = rule.transformedSelector || hostScope; - } - callback({ - selector: selectorToMatch, - isHost: isHost, - isRoot: isRoot - }); - } -/** - * @param {Element} scope - * @param {StyleNode} rules - * @param {string} cssBuild - * @return {Object} - */ - hostAndRootPropertiesForScope(scope, rules, cssBuild) { - let hostProps = {}, rootProps = {}; - // note: active rules excludes non-matching @media rules - StyleUtil.forEachRule(rules, (rule) => { - // if scope is StyleDefaults, use _element for matchesSelector - this.whenHostOrRootRule(scope, rule, cssBuild, (info) => { - let element = scope._element || scope; - if (matchesSelector.call(element, info.selector)) { - if (info.isHost) { - this.collectProperties(rule, hostProps); - } else { - this.collectProperties(rule, rootProps); - } - } - }); - }, null, true); - return {rootProps: rootProps, hostProps: hostProps}; - } - - /** - * @param {Element} element - * @param {Object} properties - * @param {string} scopeSelector - */ - transformStyles(element, properties, scopeSelector) { - let self = this; - let {is, typeExtension} = StyleUtil.getIsExtends(element); - let hostSelector = StyleTransformer - ._calcHostScope(is, typeExtension); - let rxHostSelector = element.extends ? - '\\' + hostSelector.slice(0, -1) + '\\]' : - hostSelector; - let hostRx = new RegExp(RX.HOST_PREFIX + rxHostSelector + - RX.HOST_SUFFIX); - let {styleRules: rules, cssBuild} = StyleInfo.get(element); - let keyframeTransforms = - this._elementKeyframeTransforms(element, rules, scopeSelector); - return StyleTransformer.elementStyles(element, rules, function(rule) { - self.applyProperties(rule, properties); - if (!nativeShadow && - !StyleUtil.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); - } - }, cssBuild); - } - - /** - * @param {Element} element - * @param {StyleNode} rules - * @param {string} scopeSelector - * @return {Object} - */ - _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. - /** - * @param {StyleNode} keyframesRule - * @return {function(string):string} - */ - _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 - * - * @param {StyleNode} rule - * @param {string} scopeId - */ - _scopeKeyframes(rule, scopeId) { - // Animation names are of the form [\w-], so ensure that the name regex does not partially apply - // to similarly named keyframe names by checking for a word boundary at the beginning and - // a non-word boundary or `-` at the end. - rule.keyframesNameRx = new RegExp(`\\b${rule['keyframesName']}(?!\\B|-)`, '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`). - /** - * @param {StyleNode} rule - * @param {RegExp} hostRx - * @param {string} hostSelector - * @param {string} scopeId - */ - _scopeSelector(rule, hostRx, hostSelector, scopeId) { - rule.transformedSelector = rule.transformedSelector || rule['selector']; - let selector = rule.transformedSelector; - let scope = '.' + scopeId; - let parts = StyleUtil.splitSelectorList(selector); - for (let i=0, l=parts.length, p; (i<l) && (p=parts[i]); i++) { - parts[i] = p.match(hostRx) ? - p.replace(hostSelector, scope) : - scope + ' ' + p; - } - rule['selector'] = parts.join(','); - } - - /** - * @param {Element} element - * @param {string} selector - * @param {string} old - */ - applyElementScopeSelector(element, selector, old) { - let c = element.getAttribute('class') || ''; - let v = c; - if (old) { - v = c.replace( - new RegExp('\\s*' + XSCOPE_NAME + '\\s*' + old + '\\s*', 'g'), ' '); - } - v += (v ? ' ' : '') + XSCOPE_NAME + ' ' + selector; - if (c !== v) { - StyleUtil.setElementClassRaw(element, v); - } - } - - /** - * @param {HTMLElement} element - * @param {Object} properties - * @param {string} selector - * @param {HTMLStyleElement} style - * @return {HTMLStyleElement} - */ - applyElementStyle(element, properties, selector, style) { - // calculate cssText to apply - let cssText = style ? style.textContent || '' : - this.transformStyles(element, properties, selector); - // if shady and we have a cached style that is not style, decrement - let styleInfo = StyleInfo.get(element); - let s = styleInfo.customStyle; - if (s && !nativeShadow && (s !== style)) { - s['_useCount']--; - if (s['_useCount'] <= 0 && s.parentNode) { - s.parentNode.removeChild(s); - } - } - // apply styling always under native or if we generated style - // or the cached style is not in document(!) - if (nativeShadow) { - // update existing style only under native - if (styleInfo.customStyle) { - styleInfo.customStyle.textContent = cssText; - style = styleInfo.customStyle; - // otherwise, if we have css to apply, do so - } else if (cssText) { - // apply css after the scope style of the element to help with - // style precedence rules. - style = StyleUtil.applyCss(cssText, selector, element.shadowRoot, - styleInfo.placeholder); - } - } else { - // shady and no cache hit - if (!style) { - // apply css after the scope style of the element to help with - // style precedence rules. - if (cssText) { - style = StyleUtil.applyCss(cssText, selector, null, - styleInfo.placeholder); - } - // shady and cache hit but not in document - } else if (!style.parentNode) { - if (IS_IE && cssText.indexOf('@media') > -1) { - // @media rules may be stale in IE 10 and 11 - // refresh the text content of the style to revalidate them. - style.textContent = cssText; - } - StyleUtil.applyStyle(style, null, styleInfo.placeholder); - } - } - // ensure this style is our custom style and increment its use count. - if (style) { - style['_useCount'] = style['_useCount'] || 0; - // increment use count if we changed styles - if (styleInfo.customStyle != style) { - style['_useCount']++; - } - styleInfo.customStyle = style; - } - return style; - } - - /** - * @param {Element} style - * @param {Object} properties - */ - applyCustomStyle(style, properties) { - let rules = StyleUtil.rulesForStyle(/** @type {HTMLStyleElement} */(style)); - let self = this; - style.textContent = StyleUtil.toCssText(rules, function(/** StyleNode */rule) { - let css = rule['cssText'] = rule['parsedCssText']; - if (rule.propertyInfo && rule.propertyInfo.cssText) { - // remove property assignments - // so next function isn't confused - // NOTE: we have 3 categories of css: - // (1) normal properties, - // (2) custom property assignments (--foo: red;), - // (3) custom property usage: border: var(--foo); @apply(--foo); - // In elements, 1 and 3 are separated for efficiency; here they - // are not and this makes this case unique. - css = removeCustomPropAssignment(/** @type {string} */(css)); - // replace with reified properties, scenario is same as mixin - rule['cssText'] = self.valueForProperties(css, properties); - } - }); - } -} - -/** - * @param {number} n - * @param {Array<number>} bits - */ -function addToBitMask(n, bits) { - let o = parseInt(n / 32, 10); - let v = 1 << (n % 32); - bits[o] = (bits[o] || 0) | v; -} - -export default new StyleProperties();
\ No newline at end of file diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-settings.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-settings.js deleted file mode 100644 index c8fdd4ba9ce..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-settings.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -export const nativeShadow = !(window['ShadyDOM'] && window['ShadyDOM']['inUse']); -let nativeCssVariables_; - -/** - * @param {(ShadyCSSOptions | ShadyCSSInterface)=} settings - */ -function calcCssVariables(settings) { - if (settings && settings['shimcssproperties']) { - nativeCssVariables_ = false; - } else { - // 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 - // However, shim css custom properties are only supported with ShadyDOM enabled, - // so fall back on native if we do not detect ShadyDOM - // Edge 15: custom properties used in ::before and ::after will also be used in the parent element - // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12414257/ - nativeCssVariables_ = nativeShadow || Boolean(!navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/) && - window.CSS && CSS.supports && CSS.supports('box-shadow', '0 0 0 var(--foo)')); - } -} - -/** @type {string | undefined} */ -export let cssBuild; -if (window.ShadyCSS && window.ShadyCSS.cssBuild !== undefined) { - cssBuild = window.ShadyCSS.cssBuild; -} - -/** @type {boolean} */ -export const disableRuntime = Boolean(window.ShadyCSS && window.ShadyCSS.disableRuntime); - -if (window.ShadyCSS && window.ShadyCSS.nativeCss !== undefined) { - nativeCssVariables_ = window.ShadyCSS.nativeCss; -} else if (window.ShadyCSS) { - calcCssVariables(window.ShadyCSS); - // reset window variable to let ShadyCSS API take its place - window.ShadyCSS = undefined; -} else { - calcCssVariables(window['WebComponents'] && window['WebComponents']['flags']); -} - -// Hack for type error under new type inference which doesn't like that -// nativeCssVariables is updated in a function and assigns the type -// `function(): ?` instead of `boolean`. -export const nativeCssVariables = /** @type {boolean} */(nativeCssVariables_);
\ No newline at end of file diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-transformer.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-transformer.js deleted file mode 100644 index 6803a8bc2c1..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-transformer.js +++ /dev/null @@ -1,487 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -import {StyleNode} from './css-parse.js'; // eslint-disable-line no-unused-vars -import * as StyleUtil from './style-util.js'; -import {nativeShadow} from './style-settings.js'; - -/* 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. - * @param {!Node} node - * @param {string} scope - * @param {boolean=} shouldRemoveScope - * @deprecated - */ - dom(node, scope, shouldRemoveScope) { - const fn = (node) => { - this.element(node, scope || '', shouldRemoveScope); - }; - this._transformDom(node, fn); - } - - /** - * Given a node and scope name, add a scoping class to each node in the tree. - * @param {!Node} node - * @param {string} scope - */ - domAddScope(node, scope) { - const fn = (node) => { - this.element(node, scope || ''); - }; - this._transformDom(node, fn); - } - - /** - * @param {!Node} startNode - * @param {!function(!Node)} transformer - */ - _transformDom(startNode, transformer) { - if (startNode.nodeType === Node.ELEMENT_NODE) { - transformer(startNode) - } - let c$; - if (startNode.localName === 'template') { - const template = /** @type {!HTMLTemplateElement} */ (startNode); - // In case the template is in svg context, fall back to the node - // since it won't be an HTMLTemplateElement with a .content property - c$ = (template.content || template._content || template).childNodes; - } else { - c$ = /** @type {!ParentNode} */ (startNode).children || - startNode.childNodes; - } - if (c$) { - for (let i = 0; i < c$.length; i++) { - this._transformDom(c$[i], transformer); - } - } - } - - /** - * @param {?} element - * @param {?} scope - * @param {?=} shouldRemoveScope - */ - element(element, scope, shouldRemoveScope) { - // note: if using classes, we add both the general 'style-scope' class - // as well as the specific scope. This enables easy filtering of all - // `style-scope` elements - if (scope) { - // note: svg on IE does not have classList so fallback to class - if (element.classList) { - if (shouldRemoveScope) { - element.classList.remove(SCOPE_NAME); - element.classList.remove(scope); - } else { - element.classList.add(SCOPE_NAME); - element.classList.add(scope); - } - } else if (element.getAttribute) { - let c = element.getAttribute(CLASS); - if (shouldRemoveScope) { - if (c) { - let newValue = c.replace(SCOPE_NAME, '').replace(scope, ''); - StyleUtil.setElementClassRaw(element, newValue); - } - } else { - let newValue = (c ? c + ' ' : '') + SCOPE_NAME + ' ' + scope; - StyleUtil.setElementClassRaw(element, newValue); - } - } - } - } - - /** - * Given a node, replace the scoping class to each subnode in the tree. - * @param {!Node} node - * @param {string} oldScope - * @param {string} newScope - */ - domReplaceScope(node, oldScope, newScope) { - const fn = (node) => { - this.element(node, oldScope, true); - this.element(node, newScope); - }; - this._transformDom(node, fn); - } - /** - * Given a node, remove the scoping class to each subnode in the tree. - * @param {!Node} node - * @param {string} oldScope - */ - domRemoveScope(node, oldScope) { - const fn = (node) => { - this.element(node, oldScope || '', true); - }; - this._transformDom(node, fn); - } - - /** - * @param {?} element - * @param {?} styleRules - * @param {?=} callback - * @param {string=} cssBuild - * @param {string=} cssText - * @return {string} - */ - elementStyles(element, styleRules, callback, cssBuild = '', cssText = '') { - // no need to shim selectors if settings.useNativeShadow, also - // a shady css build will already have transformed selectors - // NOTE: This method may be called as part of static or property shimming. - // When there is a targeted build it will not be called for static shimming, - // but when the property shim is used it is called and should opt out of - // static shimming work when a proper build exists. - if (cssText === '') { - if (nativeShadow || cssBuild === 'shady') { - cssText = StyleUtil.toCssText(styleRules, callback); - } else { - let {is, typeExtension} = StyleUtil.getIsExtends(element); - cssText = this.css(styleRules, is, typeExtension, callback) + '\n\n'; - } - } - return cssText.trim(); - } - - // Given a string of cssText and a scoping string (scope), returns - // a string of scoped css where each selector is transformed to include - // a class created from the scope. ShadowDOM selectors are also transformed - // (e.g. :host) to use the scoping selector. - css(rules, scope, ext, callback) { - let hostScope = this._calcHostScope(scope, ext); - scope = this._calcElementScope(scope); - let self = this; - return StyleUtil.toCssText(rules, function(/** StyleNode */rule) { - if (!rule.isScoped) { - self.rule(rule, scope, hostScope); - rule.isScoped = true; - } - if (callback) { - callback(rule, scope, hostScope); - } - }); - } - - _calcElementScope(scope) { - if (scope) { - return CSS_CLASS_PREFIX + scope; - } else { - return ''; - } - } - - _calcHostScope(scope, ext) { - return ext ? `[is=${scope}]` : scope; - } - - rule(rule, scope, hostScope) { - this._transformRule(rule, this._transformComplexSelector, - scope, hostScope); - } - - /** - * transforms a css rule to a scoped rule. - * - * @param {StyleNode} rule - * @param {Function} transformer - * @param {string=} scope - * @param {string=} hostScope - */ - _transformRule(rule, transformer, scope, hostScope) { - // NOTE: save transformedSelector for subsequent matching of elements - // against selectors (e.g. when calculating style properties) - rule['selector'] = rule.transformedSelector = - this._transformRuleCss(rule, transformer, scope, hostScope); - } - - /** - * @param {StyleNode} rule - * @param {Function} transformer - * @param {string=} scope - * @param {string=} hostScope - */ - _transformRuleCss(rule, transformer, scope, hostScope) { - let p$ = StyleUtil.splitSelectorList(rule['selector']); - // we want to skip transformation of rules that appear in keyframes, - // because they are keyframe selectors, not element selectors. - if (!StyleUtil.isKeyframesSelector(rule)) { - for (let i=0, l=p$.length, p; (i<l) && (p=p$[i]); i++) { - p$[i] = transformer.call(this, p, scope, hostScope); - } - } - return p$.filter((part) => Boolean(part)).join(COMPLEX_SELECTOR_SEP); - } - - /** - * @param {string} selector - * @return {string} - */ - _twiddleNthPlus(selector) { - return selector.replace(NTH, (m, type, inside) => { - if (inside.indexOf('+') > -1) { - inside = inside.replace(/\+/g, '___'); - } else if (inside.indexOf('___') > -1) { - inside = inside.replace(/___/g, '+'); - } - return `:${type}(${inside})`; - }); - } - - /** - * Preserve `:matches()` selectors by replacing them with MATCHES_REPLACMENT - * and returning an array of `:matches()` selectors. - * Use `_replacesMatchesPseudo` to replace the `:matches()` parts - * - * @param {string} selector - * @return {{selector: string, matches: !Array<string>}} - */ - _preserveMatchesPseudo(selector) { - /** @type {!Array<string>} */ - const matches = []; - let match; - while ((match = selector.match(MATCHES))) { - const start = match.index; - const end = StyleUtil.findMatchingParen(selector, start); - if (end === -1) { - throw new Error(`${match.input} selector missing ')'`) - } - const part = selector.slice(start, end + 1); - selector = selector.replace(part, MATCHES_REPLACEMENT); - matches.push(part); - } - return {selector, matches}; - } - - /** - * Replace MATCHES_REPLACMENT character with the given set of `:matches()` - * selectors. - * - * @param {string} selector - * @param {!Array<string>} matches - * @return {string} - */ - _replaceMatchesPseudo(selector, matches) { - const parts = selector.split(MATCHES_REPLACEMENT); - return matches.reduce((acc, cur, idx) => acc + cur + parts[idx + 1], parts[0]); - } - -/** - * @param {string} selector - * @param {string} scope - * @param {string=} hostScope - */ - _transformComplexSelector(selector, scope, hostScope) { - let stop = false; - selector = selector.trim(); - // Remove spaces inside of selectors like `:nth-of-type` because it confuses SIMPLE_SELECTOR_SEP - let isNth = NTH.test(selector); - if (isNth) { - selector = selector.replace(NTH, (m, type, inner) => `:${type}(${inner.replace(/\s/g, '')})`) - selector = this._twiddleNthPlus(selector); - } - // Preserve selectors like `:-webkit-any` so that SIMPLE_SELECTOR_SEP does - // not get confused by spaces inside the pseudo selector - const isMatches = MATCHES.test(selector); - /** @type {!Array<string>} */ - let matches; - if (isMatches) { - ({selector, matches} = this._preserveMatchesPseudo(selector)); - } - 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; - }); - // replace `:matches()` selectors - if (isMatches) { - selector = this._replaceMatchesPseudo(selector, matches); - } - if (isNth) { - selector = this._twiddleNthPlus(selector); - } - selector = selector.replace(DIR_PAREN, (m, before, dir, after) => - `[dir="${dir}"] ${before}${after}, ${before}[dir="${dir}"]${after}`); - 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}`); - } - } - return {value: selector, combinator, stop}; - } - - _transformSimpleSelector(selector, scope) { - const attributes = selector.split(/(\[.+?\])/); - - const output = []; - for (let i = 0; i < attributes.length; i++) { - // Do not attempt to transform any attribute selector content - if ((i % 2) === 1) { - output.push(attributes[i]); - } else { - const part = attributes[i]; - - if (!(part === '' && i === attributes.length - 1)) { - let p$ = part.split(PSEUDO_PREFIX); - p$[0] += scope; - output.push(p$.join(PSEUDO_PREFIX)); - } - } - } - - return output.join(''); - } - - // :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); - } - } - - /** - * @param {StyleNode} rule - */ - documentRule(rule) { - // reset selector in case this is redone. - rule['selector'] = rule['parsedSelector']; - this.normalizeRootSelector(rule); - this._transformRule(rule, this._transformDocumentSelector); - } - - /** - * @param {StyleNode} rule - */ - normalizeRootSelector(rule) { - if (rule['selector'] === ROOT) { - rule['selector'] = 'html'; - } - } - -/** - * @param {string} selector - */ - _transformDocumentSelector(selector) { - if (selector.match(HOST)) { - // remove ':host' type selectors in document rules - return ''; - } else if (selector.match(SLOTTED)) { - return this._transformComplexSelector(selector, SCOPE_DOC_SELECTOR) - } else { - return this._transformSimpleSelector(selector.trim(), SCOPE_DOC_SELECTOR); - } - } -} - -const NTH = /:(nth[-\w]+)\(([^)]+)\)/; -const SCOPE_DOC_SELECTOR = `:not(.${SCOPE_NAME})`; -const COMPLEX_SELECTOR_SEP = ','; -const SIMPLE_SELECTOR_SEP = /(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=[])+)/g; -const SIMPLE_SELECTOR_PREFIX = /[[.:#*]/; -const HOST = ':host'; -const ROOT = ':root'; -const SLOTTED = '::slotted'; -const 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 -const HOST_PAREN = /(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/; -// similar to HOST_PAREN -const SLOTTED_PAREN = /(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/; -const DIR_PAREN = /(.*):dir\((?:(ltr|rtl))\)(.*)/; -const CSS_CLASS_PREFIX = '.'; -const PSEUDO_PREFIX = ':'; -const CLASS = 'class'; -const SELECTOR_NO_MATCH = 'should_not_match'; -const MATCHES = /:(?:matches|any|-(?:webkit|moz)-any)/; -const MATCHES_REPLACEMENT = '\u{e000}'; - -export default new StyleTransformer() diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-util.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-util.js deleted file mode 100644 index 1e58c5b5b90..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/style-util.js +++ /dev/null @@ -1,414 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -import {nativeShadow, nativeCssVariables, cssBuild} from './style-settings.js'; -import {parse, stringify, types, StyleNode} from './css-parse.js'; // eslint-disable-line no-unused-vars -import {MEDIA_MATCH} from './common-regex.js'; -import {processUnscopedStyle, isUnscopedStyle} from './unscoped-style-handler.js'; - -/** - * @param {string|StyleNode} rules - * @param {function(StyleNode)=} callback - * @return {string} - */ -export function toCssText (rules, callback) { - if (!rules) { - return ''; - } - if (typeof rules === 'string') { - rules = parse(rules); - } - if (callback) { - forEachRule(rules, callback); - } - return stringify(rules, nativeCssVariables); -} - -/** - * @param {HTMLStyleElement} style - * @return {StyleNode} - */ -export function rulesForStyle(style) { - if (!style['__cssRules'] && style.textContent) { - style['__cssRules'] = parse(style.textContent); - } - return style['__cssRules'] || null; -} - -// 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). -/** - * @param {StyleNode} rule - * @return {boolean} - */ -export function isKeyframesSelector(rule) { - return Boolean(rule['parent']) && - rule['parent']['type'] === types.KEYFRAMES_RULE; -} - -/** - * @param {StyleNode} node - * @param {Function=} styleRuleCallback - * @param {Function=} keyframesRuleCallback - * @param {boolean=} onlyActiveRules - */ -export function forEachRule(node, styleRuleCallback, keyframesRuleCallback, onlyActiveRules) { - if (!node) { - return; - } - let skipRules = false; - let type = node['type']; - if (onlyActiveRules) { - if (type === types.MEDIA_RULE) { - let matchMedia = node['selector'].match(MEDIA_MATCH); - if (matchMedia) { - // if rule is a non matching @media rule, skip subrules - if (!window.matchMedia(matchMedia[1]).matches) { - skipRules = true; - } - } - } - } - if (type === types.STYLE_RULE) { - styleRuleCallback(node); - } else if (keyframesRuleCallback && - type === types.KEYFRAMES_RULE) { - keyframesRuleCallback(node); - } else if (type === types.MIXIN_RULE) { - skipRules = true; - } - let r$ = node['rules']; - if (r$ && !skipRules) { - for (let i=0, l=r$.length, r; (i<l) && (r=r$[i]); i++) { - forEachRule(r, styleRuleCallback, keyframesRuleCallback, onlyActiveRules); - } - } -} - -// add a string of cssText to the document. -/** - * @param {string} cssText - * @param {string} moniker - * @param {Node} target - * @param {Node} contextNode - * @return {HTMLStyleElement} - */ -export function applyCss(cssText, moniker, target, contextNode) { - let style = createScopeStyle(cssText, moniker); - applyStyle(style, target, contextNode); - return style; -} - -/** - * @param {string} cssText - * @param {string} moniker - * @return {HTMLStyleElement} - */ -export function createScopeStyle(cssText, moniker) { - let style = /** @type {HTMLStyleElement} */(document.createElement('style')); - if (moniker) { - style.setAttribute('scope', moniker); - } - style.textContent = cssText; - return style; -} - -/** - * Track the position of the last added style for placing placeholders - * @type {Node} - */ -let lastHeadApplyNode = null; - -// insert a comment node as a styling position placeholder. -/** - * @param {string} moniker - * @return {!Comment} - */ -export function applyStylePlaceHolder(moniker) { - let placeHolder = document.createComment(' Shady DOM styles for ' + - moniker + ' '); - let after = lastHeadApplyNode ? - lastHeadApplyNode['nextSibling'] : null; - let scope = document.head; - scope.insertBefore(placeHolder, after || scope.firstChild); - lastHeadApplyNode = placeHolder; - return placeHolder; -} - -/** - * @param {HTMLStyleElement} style - * @param {?Node} target - * @param {?Node} contextNode - */ -export function applyStyle(style, target, contextNode) { - target = target || document.head; - let after = (contextNode && contextNode.nextSibling) || - target.firstChild; - target.insertBefore(style, after); - if (!lastHeadApplyNode) { - lastHeadApplyNode = style; - } else { - // only update lastHeadApplyNode if the new style is inserted after the old lastHeadApplyNode - let position = style.compareDocumentPosition(lastHeadApplyNode); - if (position === Node.DOCUMENT_POSITION_PRECEDING) { - lastHeadApplyNode = style; - } - } -} - -/** - * @param {string} buildType - * @return {boolean} - */ -export function isTargetedBuild(buildType) { - return nativeShadow ? buildType === 'shadow' : buildType === 'shady'; -} - -/** - * Walk from text[start] matching parens and - * returns position of the outer end paren - * @param {string} text - * @param {number} start - * @return {number} - */ -export function findMatchingParen(text, start) { - let level = 0; - for (let i=start, l=text.length; i < l; i++) { - if (text[i] === '(') { - level++; - } else if (text[i] === ')') { - if (--level === 0) { - return i; - } - } - } - return -1; -} - -/** - * @param {string} str - * @param {function(string, string, string, string)} callback - */ -export function processVariableAndFallback(str, callback) { - // find 'var(' - let start = str.indexOf('var('); - if (start === -1) { - // no var?, everything is prefix - return callback(str, '', '', ''); - } - //${prefix}var(${inner})${suffix} - let end = findMatchingParen(str, start + 3); - let inner = str.substring(start + 4, end); - let prefix = str.substring(0, start); - // suffix may have other variables - let suffix = processVariableAndFallback(str.substring(end + 1), callback); - let comma = inner.indexOf(','); - // value and fallback args should be trimmed to match in property lookup - if (comma === -1) { - // variable, no fallback - return callback(prefix, inner.trim(), '', suffix); - } - // var(${value},${fallback}) - let value = inner.substring(0, comma).trim(); - let fallback = inner.substring(comma + 1).trim(); - return callback(prefix, value, fallback, suffix); -} - -/** - * @param {Element} element - * @param {string} value - */ -export function setElementClassRaw(element, value) { - // use native setAttribute provided by ShadyDOM when setAttribute is patched - if (nativeShadow) { - element.setAttribute('class', value); - } else { - window['ShadyDOM']['nativeMethods']['setAttribute'].call(element, 'class', value); - } -} - -/** - * @type {function(*):*} - */ -export const wrap = window['ShadyDOM'] && window['ShadyDOM']['wrap'] || ((node) => node); - -/** - * @param {Element | {is: string, extends: string}} element - * @return {{is: string, typeExtension: string}} - */ -export function getIsExtends(element) { - let localName = element['localName']; - let is = '', typeExtension = ''; - /* - NOTE: technically, this can be wrong for certain svg elements - with `-` in the name like `<font-face>` - */ - if (localName) { - if (localName.indexOf('-') > -1) { - is = localName; - } else { - typeExtension = localName; - is = (element.getAttribute && element.getAttribute('is')) || ''; - } - } else { - is = /** @type {?} */(element).is; - typeExtension = /** @type {?} */(element).extends; - } - return {is, typeExtension}; -} - -/** - * @param {Element|DocumentFragment} element - * @return {string} - */ -export function gatherStyleText(element) { - /** @type {!Array<string>} */ - const styleTextParts = []; - const styles = /** @type {!NodeList<!HTMLStyleElement>} */(element.querySelectorAll('style')); - for (let i = 0; i < styles.length; i++) { - const style = styles[i]; - if (isUnscopedStyle(style)) { - if (!nativeShadow) { - processUnscopedStyle(style); - style.parentNode.removeChild(style); - } - } else { - styleTextParts.push(style.textContent); - style.parentNode.removeChild(style); - } - } - return styleTextParts.join('').trim(); -} - -/** - * Split a selector separated by commas into an array in a smart way - * @param {string} selector - * @return {!Array<string>} - */ -export function splitSelectorList(selector) { - const parts = []; - let part = ''; - for (let i = 0; i >= 0 && i < selector.length; i++) { - // A selector with parentheses will be one complete part - if (selector[i] === '(') { - // find the matching paren - const end = findMatchingParen(selector, i); - // push the paren block into the part - part += selector.slice(i, end + 1); - // move the index to after the paren block - i = end; - } else if (selector[i] === ',') { - parts.push(part); - part = ''; - } else { - part += selector[i]; - } - } - // catch any pieces after the last comma - if (part) { - parts.push(part); - } - return parts; -} - -const CSS_BUILD_ATTR = 'css-build'; - -/** - * Return the polymer-css-build "build type" applied to this element - * - * @param {!HTMLElement} element - * @return {string} Can be "", "shady", or "shadow" - */ -export function getCssBuild(element) { - if (cssBuild !== undefined) { - return /** @type {string} */(cssBuild); - } - if (element.__cssBuild === undefined) { - // try attribute first, as it is the common case - const attrValue = element.getAttribute(CSS_BUILD_ATTR); - if (attrValue) { - element.__cssBuild = attrValue; - } else { - const buildComment = getBuildComment(element); - if (buildComment !== '') { - // remove build comment so it is not needlessly copied into every element instance - removeBuildComment(element); - } - element.__cssBuild = buildComment; - } - } - return element.__cssBuild || ''; -} - -/** - * Check if the given element, either a <template> or <style>, has been processed - * by polymer-css-build. - * - * If so, then we can make a number of optimizations: - * - polymer-css-build will decompose mixins into individual CSS Custom Properties, - * so the ApplyShim can be skipped entirely. - * - Under native ShadowDOM, the style text can just be copied into each instance - * without modification - * - If the build is "shady" and ShadyDOM is in use, the styling does not need - * scoping beyond the shimming of CSS Custom Properties - * - * @param {!HTMLElement} element - * @return {boolean} - */ -export function elementHasBuiltCss(element) { - return getCssBuild(element) !== ''; -} - -/** - * For templates made with tagged template literals, polymer-css-build will - * insert a comment of the form `<!--css-build:shadow-->` - * - * @param {!HTMLElement} element - * @return {string} - */ -export function getBuildComment(element) { - const buildComment = element.localName === 'template' ? - /** @type {!HTMLTemplateElement} */ (element).content.firstChild : - element.firstChild; - if (buildComment instanceof Comment) { - const commentParts = buildComment.textContent.trim().split(':'); - if (commentParts[0] === CSS_BUILD_ATTR) { - return commentParts[1]; - } - } - return ''; -} - -/** - * Check if the css build status is optimal, and do no unneeded work. - * - * @param {string=} cssBuild CSS build status - * @return {boolean} css build is optimal or not - */ -export function isOptimalCssBuild(cssBuild = '') { - // CSS custom property shim always requires work - if (cssBuild === '' || !nativeCssVariables) { - return false; - } - return nativeShadow ? cssBuild === 'shadow' : cssBuild === 'shady'; -} - -/** - * @param {!HTMLElement} element - */ -function removeBuildComment(element) { - const buildComment = element.localName === 'template' ? - /** @type {!HTMLTemplateElement} */ (element).content.firstChild : - element.firstChild; - buildComment.parentNode.removeChild(buildComment); -} diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/template-map.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/template-map.js deleted file mode 100644 index d3eb8409a13..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/template-map.js +++ /dev/null @@ -1,17 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -/** - * @const {!Object<string, !HTMLTemplateElement>} - */ -const templateMap = {}; -export default templateMap; diff --git a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/unscoped-style-handler.js b/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/unscoped-style-handler.js deleted file mode 100644 index 95e994fae95..00000000000 --- a/chromium/third_party/polymer/v3_0/components-chromium/shadycss/src/unscoped-style-handler.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -@license -Copyright (c) 2017 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'; - -/** @type {!Set<string>} */ -const styleTextSet = new Set(); - -export const scopingAttribute = 'shady-unscoped'; - -/** - * Add a specifically-marked style to the document directly, and only one copy of that style. - * - * @param {!HTMLStyleElement} style - * @return {undefined} - */ -export function processUnscopedStyle(style) { - const text = style.textContent; - if (!styleTextSet.has(text)) { - styleTextSet.add(text); - const newStyle = style.cloneNode(true); - document.head.appendChild(newStyle); - } -} - -/** - * Check if a style is supposed to be unscoped - * @param {!HTMLStyleElement} style - * @return {boolean} true if the style has the unscoping attribute - */ -export function isUnscopedStyle(style) { - return style.hasAttribute(scopingAttribute); -}
\ No newline at end of file diff --git a/chromium/third_party/polymer/v3_0/minify_polymer.py b/chromium/third_party/polymer/v3_0/minify_polymer.py new file mode 100644 index 00000000000..462b0bc9cbf --- /dev/null +++ b/chromium/third_party/polymer/v3_0/minify_polymer.py @@ -0,0 +1,75 @@ +# Copyrigh 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Minifies Polymer 3, since it does not come already minified from NPM.""" + +import os +import shutil +import sys +import tempfile + +_HERE_PATH = os.path.dirname(__file__) +_SRC_PATH = os.path.normpath(os.path.join(_HERE_PATH, '..', '..', '..')) +sys.path.append(os.path.join(_SRC_PATH, 'third_party', 'node')) +import node +import node_modules + + +def main(): + polymer_dir = os.path.join(_HERE_PATH, 'components-chromium', 'polymer') + + # Final JS bundle. + polymer_js = os.path.join(polymer_dir, 'polymer_bundled.min.js') + + # Copy the top-level Polymer file that holds all dependencies. This file is + # not distributed via NPM, it only exists within third_party/polymer + # repository. + shutil.copy( + os.path.join(polymer_dir, '..', '..', 'polymer.js'), polymer_dir); + + # Move the entire checkout to a temp location. + tmp_dir = os.path.join(_HERE_PATH, 'components-chromium', 'polymer_temp') + if os.path.exists(tmp_dir): + shutil.rmtree(tmp_dir) + shutil.move(polymer_dir, tmp_dir) + + tmp_out_dir = os.path.join(tmp_dir, 'out') + os.makedirs(tmp_out_dir) + + try: + # Combine everything to a single JS bundle file. + bundled_js = os.path.join(tmp_out_dir, 'polymer_bundled.js') + path_to_rollup = os.path.join('node_modules', 'rollup', 'bin', 'rollup'); + + node.RunNode([ + path_to_rollup, + # See https://github.com/rollup/rollup/issues/1955 + '--silent', + '--format', 'esm', + '--input', os.path.join(tmp_dir, 'polymer.js'), + '--file', bundled_js, + ]) + + # Minify the JS bundle. + minified_js = os.path.join(tmp_out_dir, 'polymer_bundled.min.js') + node.RunNode([ + node_modules.PathToUglify(), bundled_js, + # TODO(dpapad): Figure out a way to deduplicate LICENSE headers. + #'--comments', '"/Copyright|license|LICENSE/"', + '--output', minified_js]) + + # Copy generated JS bundle back to the original location. + os.makedirs(polymer_dir) + shutil.move(minified_js, polymer_js) + + # Copy a few more files. + shutil.move(os.path.join(tmp_dir, 'LICENSE.txt'), polymer_dir) + finally: + # Delete component-chromium/shadycss since it ends up in the bundle. + shutil.rmtree(os.path.join(_HERE_PATH, 'components-chromium', 'shadycss')) + shutil.rmtree(tmp_dir) + + +if __name__ == '__main__': + main() diff --git a/chromium/third_party/polymer/v3_0/package-lock.json b/chromium/third_party/polymer/v3_0/package-lock.json index 8b8fa5af843..3edb5c33830 100644 --- a/chromium/third_party/polymer/v3_0/package-lock.json +++ b/chromium/third_party/polymer/v3_0/package-lock.json @@ -14,7 +14,7 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-a11y-announcer/-/iron-a11y-announcer-3.0.2.tgz", "integrity": "sha512-LqnMF39mXyxSSRbTHRzGbcJS8nU0NVTo2raBOgOlpxw5yfGJUVcwaTJ/qy5NtWCZLRfa4suycf0oAkuUjHTXHQ==", "requires": { - "@polymer/polymer": "3.2.0" + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-a11y-keys": { @@ -22,8 +22,8 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-a11y-keys/-/iron-a11y-keys-3.0.1.tgz", "integrity": "sha512-zmTi8xHeY4ZMJLAitW2hAmW5zXZ35hVy/eHQUFadAlOccuBK3oRRmoPRQRaZgpyJrCVFDAQRXXzzJtUDil/0CA==", "requires": { - "@polymer/iron-a11y-keys-behavior": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-a11y-keys-behavior": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-a11y-keys-behavior": { @@ -31,7 +31,7 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-a11y-keys-behavior/-/iron-a11y-keys-behavior-3.0.1.tgz", "integrity": "sha512-lnrjKq3ysbBPT/74l0Fj0U9H9C35Tpw2C/tpJ8a+5g8Y3YJs1WSZYnEl1yOkw6sEyaxOq/1DkzH0+60gGu5/PQ==", "requires": { - "@polymer/polymer": "3.2.0" + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-autogrow-textarea": { @@ -39,10 +39,10 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-autogrow-textarea/-/iron-autogrow-textarea-3.0.1.tgz", "integrity": "sha512-FgSL7APrOSL9Vu812sBCFlQ17hvnJsBAV2C2e1UAiaHhB+dyfLq8gGdGUpqVWuGJ50q4Y/49QwCNnLf85AdVYA==", "requires": { - "@polymer/iron-behaviors": "3.0.1", - "@polymer/iron-flex-layout": "3.0.1", - "@polymer/iron-validatable-behavior": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-behaviors": "^3.0.0-pre.26", + "@polymer/iron-flex-layout": "^3.0.0-pre.26", + "@polymer/iron-validatable-behavior": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-behaviors": { @@ -50,8 +50,8 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-behaviors/-/iron-behaviors-3.0.1.tgz", "integrity": "sha512-IMEwcv1lhf1HSQxuyWOUIL0lOBwmeaoSTpgCJeP9IBYnuB1SPQngmfRuHKgK6/m9LQ9F9miC7p3HeQQUdKAE0w==", "requires": { - "@polymer/iron-a11y-keys-behavior": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-a11y-keys-behavior": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-checked-element-behavior": { @@ -59,9 +59,9 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-checked-element-behavior/-/iron-checked-element-behavior-3.0.1.tgz", "integrity": "sha512-aDr0cbCNVq49q+pOqa6CZutFh+wWpwPMLpEth9swx+GkAj+gCURhuQkaUYhIo5f2egDbEioR1aeHMnPlU9dQZA==", "requires": { - "@polymer/iron-form-element-behavior": "3.0.1", - "@polymer/iron-validatable-behavior": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-form-element-behavior": "^3.0.0-pre.26", + "@polymer/iron-validatable-behavior": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-collapse": { @@ -69,8 +69,8 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-collapse/-/iron-collapse-3.0.1.tgz", "integrity": "sha512-yg6q5ZyckQR9VL9VmLrSTkSFXWy9AcJC8KtnD5cg0EHRPbakE8I9S/gVAgeP4nMWV2a/BjLLC4IBygcCMDhAGw==", "requires": { - "@polymer/iron-resizable-behavior": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-resizable-behavior": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-dropdown": { @@ -78,10 +78,10 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-dropdown/-/iron-dropdown-3.0.1.tgz", "integrity": "sha512-22yLhepfcKjuQMfFmRHi/9MPKTqkzgRrmWWW0P5uqK++xle53k2QBO5VYUAYiCN3ZcxIi9lEhZ9YWGeQj2JBig==", "requires": { - "@polymer/iron-behaviors": "3.0.1", - "@polymer/iron-overlay-behavior": "3.0.2", - "@polymer/neon-animation": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-behaviors": "^3.0.0-pre.26", + "@polymer/iron-overlay-behavior": "^3.0.0-pre.27", + "@polymer/neon-animation": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-fit-behavior": { @@ -89,7 +89,7 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-fit-behavior/-/iron-fit-behavior-3.0.1.tgz", "integrity": "sha512-/M0B1L30k31vmwNBaGuZcxzUAhJSHoGccb/DF0CDKI/hT8UlkTvcyemaWdOpmHHLgY52ceKIkRwA3AeXrKyvaQ==", "requires": { - "@polymer/polymer": "3.2.0" + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-flex-layout": { @@ -97,7 +97,7 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-flex-layout/-/iron-flex-layout-3.0.1.tgz", "integrity": "sha512-7gB869czArF+HZcPTVSgvA7tXYFze9EKckvM95NB7SqYF+NnsQyhoXgKnpFwGyo95lUjUW9TFDLUwDXnCYFtkw==", "requires": { - "@polymer/polymer": "3.2.0" + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-form-element-behavior": { @@ -105,7 +105,7 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-form-element-behavior/-/iron-form-element-behavior-3.0.1.tgz", "integrity": "sha512-G/e2KXyL5AY7mMjmomHkGpgS0uAf4ovNpKhkuUTRnMuMJuf589bKqE85KN4ovE1Tzhv2hJoh/igyD6ekHiYU1A==", "requires": { - "@polymer/polymer": "3.2.0" + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-icon": { @@ -113,9 +113,9 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-icon/-/iron-icon-3.0.1.tgz", "integrity": "sha512-QLPwirk+UPZNaLnMew9VludXA4CWUCenRewgEcGYwdzVgDPCDbXxy6vRJjmweZobMQv/oVLppT2JZtJFnPxX6g==", "requires": { - "@polymer/iron-flex-layout": "3.0.1", - "@polymer/iron-meta": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-flex-layout": "^3.0.0-pre.26", + "@polymer/iron-meta": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-iconset-svg": { @@ -123,8 +123,8 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-iconset-svg/-/iron-iconset-svg-3.0.1.tgz", "integrity": "sha512-XNwURbNHRw6u2fJe05O5fMYye6GSgDlDqCO+q6K1zAnKIrpgZwf2vTkBd5uCcZwsN0FyCB3mvNZx4jkh85dRDw==", "requires": { - "@polymer/iron-meta": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-meta": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-input": { @@ -132,9 +132,9 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-input/-/iron-input-3.0.1.tgz", "integrity": "sha512-WLx13kEcbH9GKbj9+pWR6pbJkA5kxn3796ynx6eQd2rueMyUfVTR3GzOvadBKsciUuIuzrxpBWZ2+3UcueVUQQ==", "requires": { - "@polymer/iron-a11y-announcer": "3.0.2", - "@polymer/iron-validatable-behavior": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-a11y-announcer": "^3.0.0-pre.26", + "@polymer/iron-validatable-behavior": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-list": { @@ -142,10 +142,10 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-list/-/iron-list-3.0.2.tgz", "integrity": "sha512-A6GMTx/4mWxGn3BC6weaXqRC7B0coNjgEoxwVbEcDNwovqntv0aWs5sT9+PI4zvV/syWL5rAESyJDvOxTatoEw==", "requires": { - "@polymer/iron-a11y-keys-behavior": "3.0.1", - "@polymer/iron-resizable-behavior": "3.0.1", - "@polymer/iron-scroll-target-behavior": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-a11y-keys-behavior": "^3.0.0-pre.26", + "@polymer/iron-resizable-behavior": "^3.0.0-pre.26", + "@polymer/iron-scroll-target-behavior": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-location": { @@ -153,7 +153,7 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-location/-/iron-location-3.0.1.tgz", "integrity": "sha512-almb+p/fdSi4bxG+vyXjY51fDZxHMxwiug51Lfvr86wZRXN/u21Y6BapxG5n9f0hPSy9fimjIAvaYmozi7VjyQ==", "requires": { - "@polymer/polymer": "3.2.0" + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-media-query": { @@ -161,7 +161,7 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-media-query/-/iron-media-query-3.0.1.tgz", "integrity": "sha512-czUX1pm1zfmfcZtq5J57XFkcobBv08Y50exp0/3v8Bos5VL/jv2tU0RwiTfDBxUMhjicGbgwEBFQPY2V5DMzyw==", "requires": { - "@polymer/polymer": "3.2.0" + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-meta": { @@ -169,7 +169,7 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-meta/-/iron-meta-3.0.1.tgz", "integrity": "sha512-pWguPugiLYmWFV9UWxLWzZ6gm4wBwQdDy4VULKwdHCqR7OP7u98h+XDdGZsSlDPv6qoryV/e3tGHlTIT0mbzJA==", "requires": { - "@polymer/polymer": "3.2.0" + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-overlay-behavior": { @@ -177,10 +177,10 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-overlay-behavior/-/iron-overlay-behavior-3.0.2.tgz", "integrity": "sha512-j1qmt6mJHCwpe1mKOvqK5kcCUPQr5LSrlqpgRDbUuLgUfNJ/vGTipjrkBlfbEUagm5FEQdc1VLPLSQP6WVuP9g==", "requires": { - "@polymer/iron-a11y-keys-behavior": "3.0.1", - "@polymer/iron-fit-behavior": "3.0.1", - "@polymer/iron-resizable-behavior": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-a11y-keys-behavior": "^3.0.0-pre.26", + "@polymer/iron-fit-behavior": "^3.0.0-pre.26", + "@polymer/iron-resizable-behavior": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-pages": { @@ -188,9 +188,9 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-pages/-/iron-pages-3.0.1.tgz", "integrity": "sha512-PQe8S1JKHPcsIvFOaQP+9+AXmqUIL9fPqC6xT63OAZQxYCeZJDKgT9GKBx+VRryYBUlj2FLEXkUVpG+PTotdjg==", "requires": { - "@polymer/iron-resizable-behavior": "3.0.1", - "@polymer/iron-selector": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-resizable-behavior": "^3.0.0-pre.26", + "@polymer/iron-selector": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-range-behavior": { @@ -198,7 +198,7 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-range-behavior/-/iron-range-behavior-3.0.1.tgz", "integrity": "sha512-+jtL9v45M/T1RJleWyQaNH84S9/mIIR+AjNbYIttbKGp1eG+98j8MDWe7LXNtg79V2LQnE/+VS82cBeELyGVeg==", "requires": { - "@polymer/polymer": "3.2.0" + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-resizable-behavior": { @@ -206,7 +206,7 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-resizable-behavior/-/iron-resizable-behavior-3.0.1.tgz", "integrity": "sha512-FyHxRxFspVoRaeZSWpT3y0C9awomb4tXXolIJcZ7RvXhMP632V5lez+ch5G5SwK0LpnAPkg35eB0LPMFv+YMMQ==", "requires": { - "@polymer/polymer": "3.2.0" + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-scroll-target-behavior": { @@ -214,7 +214,7 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-scroll-target-behavior/-/iron-scroll-target-behavior-3.0.1.tgz", "integrity": "sha512-xg1WanG25BIkQE8rhuReqY9zx1K5M7F+YAIYpswEp5eyDIaZ1Y3vUmVeQ3KG+hiSugzI1M752azXN7kvyhOBcQ==", "requires": { - "@polymer/polymer": "3.2.0" + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-scroll-threshold": { @@ -222,8 +222,8 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-scroll-threshold/-/iron-scroll-threshold-3.0.1.tgz", "integrity": "sha512-Zm06AP1CDfa19b5yTvLRjBfDA85zMh4XunL2/Fz5n2faZcP5zr5tIBtXsAqz4ug9I3Uau7rjzkyL7Cc0ni8sUA==", "requires": { - "@polymer/iron-scroll-target-behavior": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-scroll-target-behavior": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-selector": { @@ -231,7 +231,7 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-selector/-/iron-selector-3.0.1.tgz", "integrity": "sha512-sBVk2uas6prW0glUe2xEJJYlvxmYzM40Au9OKbfDK2Qekou/fLKcBRyIYI39kuI8zWRaip8f3CI8qXcUHnKb1A==", "requires": { - "@polymer/polymer": "3.2.0" + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-test-helpers": { @@ -239,7 +239,7 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-test-helpers/-/iron-test-helpers-3.0.1.tgz", "integrity": "sha512-2R7dnGcW2eg95i7LhYWWUO4AlAk6qXsPnKoyeN2R1t0km0ECMx0jjwqeLwCo8/7LwuVPZSiarI4DK7jyU7fJLQ==", "requires": { - "@polymer/polymer": "3.2.0" + "@polymer/polymer": "^3.0.0" } }, "@polymer/iron-validatable-behavior": { @@ -247,8 +247,8 @@ "resolved": "https://registry.npmjs.org/@polymer/iron-validatable-behavior/-/iron-validatable-behavior-3.0.1.tgz", "integrity": "sha512-wwpYh6wOa4fNI+jH5EYKC7TVPYQ2OfgQqocWat7GsNWcsblKYhLYbwsvEY5nO0n2xKqNfZzDLrUom5INJN7msQ==", "requires": { - "@polymer/iron-meta": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-meta": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/neon-animation": { @@ -256,9 +256,9 @@ "resolved": "https://registry.npmjs.org/@polymer/neon-animation/-/neon-animation-3.0.1.tgz", "integrity": "sha512-cDDc0llpVCe0ATbDS3clDthI54Bc8YwZIeTGGmBJleKOvbRTUC5+ssJmRL+VwVh+VM5FlnQlx760ppftY3uprg==", "requires": { - "@polymer/iron-resizable-behavior": "3.0.1", - "@polymer/iron-selector": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-resizable-behavior": "^3.0.0-pre.26", + "@polymer/iron-selector": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/paper-behaviors": { @@ -266,21 +266,10 @@ "resolved": "https://registry.npmjs.org/@polymer/paper-behaviors/-/paper-behaviors-3.0.1.tgz", "integrity": "sha512-6knhj69fPJejv8qR0kCSUY+Q0XjaUf0OSnkjRjmTJPAwSrRYtgqE+l6P1FfA+py1X/cUjgne9EF5rMZAKJIg1g==", "requires": { - "@polymer/iron-behaviors": "3.0.1", - "@polymer/iron-checked-element-behavior": "3.0.1", - "@polymer/paper-ripple": "3.0.1", - "@polymer/polymer": "3.2.0" - } - }, - "@polymer/paper-button": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@polymer/paper-button/-/paper-button-3.0.1.tgz", - "integrity": "sha512-JRNBc+Oj9EWnmyLr7FcCr8T1KAnEHPh6mosln9BUdkM+qYaYsudSICh3cjTIbnj6AuF5OJidoLkM1dlyj0j6Zg==", - "requires": { - "@polymer/iron-flex-layout": "3.0.1", - "@polymer/paper-behaviors": "3.0.1", - "@polymer/paper-styles": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-behaviors": "^3.0.0-pre.26", + "@polymer/iron-checked-element-behavior": "^3.0.0-pre.26", + "@polymer/paper-ripple": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/paper-input": { @@ -288,13 +277,13 @@ "resolved": "https://registry.npmjs.org/@polymer/paper-input/-/paper-input-3.0.2.tgz", "integrity": "sha512-EoyJLsUCo7zLQp63jG7+qbRcN7ynT0p9MktDeH+dnl29UqFD4Ovj2/O5cSgq3lA3dYrei4vHF11Qmdmk7iab7Q==", "requires": { - "@polymer/iron-a11y-keys-behavior": "3.0.1", - "@polymer/iron-autogrow-textarea": "3.0.1", - "@polymer/iron-behaviors": "3.0.1", - "@polymer/iron-form-element-behavior": "3.0.1", - "@polymer/iron-input": "3.0.1", - "@polymer/paper-styles": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-a11y-keys-behavior": "^3.0.0-pre.26", + "@polymer/iron-autogrow-textarea": "^3.0.0-pre.26", + "@polymer/iron-behaviors": "^3.0.0-pre.26", + "@polymer/iron-form-element-behavior": "^3.0.0-pre.26", + "@polymer/iron-input": "^3.0.0-pre.26", + "@polymer/paper-styles": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/paper-progress": { @@ -302,10 +291,10 @@ "resolved": "https://registry.npmjs.org/@polymer/paper-progress/-/paper-progress-3.0.1.tgz", "integrity": "sha512-5nguG+tmnyoaWKVNG8Smtno2uLSPBgEsT3f20JY8yJTjUBYWaqa8E3l5RLkTRXgA4x9OnvLb8/CdlQWXQIogBg==", "requires": { - "@polymer/iron-flex-layout": "3.0.1", - "@polymer/iron-range-behavior": "3.0.1", - "@polymer/paper-styles": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-flex-layout": "^3.0.0-pre.26", + "@polymer/iron-range-behavior": "^3.0.0-pre.26", + "@polymer/paper-styles": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/paper-ripple": { @@ -313,8 +302,8 @@ "resolved": "https://registry.npmjs.org/@polymer/paper-ripple/-/paper-ripple-3.0.1.tgz", "integrity": "sha512-dgOe12GyCF1VZBLUQqnzGWlf3xb255FajNCVB1VFj/AtskYtoamnafa7m3a+1vs+C8qbg4Benn5KwgxVDSW4cg==", "requires": { - "@polymer/iron-a11y-keys-behavior": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/iron-a11y-keys-behavior": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/paper-spinner": { @@ -322,8 +311,8 @@ "resolved": "https://registry.npmjs.org/@polymer/paper-spinner/-/paper-spinner-3.0.2.tgz", "integrity": "sha512-XUzu8/4NH+pnNZUTI2MxtOKFAr0EOsW7eGhTg3VBhTh7DDW/q3ewzwYRWnqNJokX9BEnxKMiXXaIeTEBq4k2dw==", "requires": { - "@polymer/paper-styles": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/paper-styles": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/paper-styles": { @@ -331,9 +320,9 @@ "resolved": "https://registry.npmjs.org/@polymer/paper-styles/-/paper-styles-3.0.1.tgz", "integrity": "sha512-y6hmObLqlCx602TQiSBKHqjwkE7xmDiFkoxdYGaNjtv4xcysOTdVJsDR/R9UHwIaxJ7gHlthMSykir1nv78++g==", "requires": { - "@polymer/font-roboto": "3.0.2", - "@polymer/iron-flex-layout": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/font-roboto": "^3.0.1", + "@polymer/iron-flex-layout": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/paper-tooltip": { @@ -341,8 +330,8 @@ "resolved": "https://registry.npmjs.org/@polymer/paper-tooltip/-/paper-tooltip-3.0.1.tgz", "integrity": "sha512-yiUk09opTEnE1lK+tb501ENb+yQBi4p++Ep0eGJAHesVYKVMPNgPphVKkIizkDaU+n0SE+zXfTsRbYyOMDYXSg==", "requires": { - "@polymer/paper-styles": "3.0.1", - "@polymer/polymer": "3.2.0" + "@polymer/paper-styles": "^3.0.0-pre.26", + "@polymer/polymer": "^3.0.0" } }, "@polymer/polymer": { @@ -350,13 +339,38 @@ "resolved": "https://registry.npmjs.org/@polymer/polymer/-/polymer-3.2.0.tgz", "integrity": "sha512-L6uV1oM6T6xbwbVx6t3biG5T2VSSB03LxnIrUd9M2pr6RkHVPFHJ37pC5MUwBAEhkGFJif7eks7fdMMSGZTeEQ==", "requires": { - "@webcomponents/shadycss": "1.9.1" + "@webcomponents/shadycss": "^1.8.0" } }, + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==" + }, + "@types/node": { + "version": "12.0.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.3.tgz", + "integrity": "sha512-zkOxCS/fA+3SsdA+9Yun0iANxzhQRiNwTvJSr6N95JhuJ/x27z9G2URx1Jpt3zYFfCGUXZGL5UDxt5eyLE7wgw==" + }, "@webcomponents/shadycss": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/@webcomponents/shadycss/-/shadycss-1.9.1.tgz", "integrity": "sha512-IaZOnWOKXHghqk/WfPNDRIgDBi3RsVPY2IFAw6tYiL9UBGvQRy5R6uC+Fk7qTZsReTJ0xh5MTT8yAcb3MUR4mQ==" + }, + "acorn": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.1.1.tgz", + "integrity": "sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==" + }, + "rollup": { + "version": "1.12.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.12.4.tgz", + "integrity": "sha512-sHg0F05oTMJzM592MWU8irsPx8LIFMKSCnEkcp6vp/gnj+oJ9GJEBW9hl8jUqy2L6Q2uUxFzPgvoExLbfuSODA==", + "requires": { + "@types/estree": "0.0.39", + "@types/node": "^12.0.2", + "acorn": "^6.1.1" + } } } } diff --git a/chromium/third_party/polymer/v3_0/package.json b/chromium/third_party/polymer/v3_0/package.json index 430cfa5f5c7..73bbc377a88 100644 --- a/chromium/third_party/polymer/v3_0/package.json +++ b/chromium/third_party/polymer/v3_0/package.json @@ -3,41 +3,41 @@ "version": "1.0.0", "author": "dpapad@chromium.org", "dependencies": { - "@polymer/font-roboto": "^3.0.2", - "@polymer/iron-a11y-announcer": "^3.0.2", - "@polymer/iron-a11y-keys": "^3.0.1", - "@polymer/iron-a11y-keys-behavior": "^3.0.1", - "@polymer/iron-behaviors": "^3.0.1", - "@polymer/iron-collapse": "^3.0.1", - "@polymer/iron-dropdown": "^3.0.1", - "@polymer/iron-fit-behavior": "^3.0.1", - "@polymer/iron-flex-layout": "^3.0.1", - "@polymer/iron-icon": "^3.0.1", - "@polymer/iron-iconset-svg": "^3.0.1", - "@polymer/iron-input": "^3.0.1", - "@polymer/iron-list": "^3.0.2", - "@polymer/iron-location": "^3.0.1", - "@polymer/iron-media-query": "^3.0.1", - "@polymer/iron-meta": "^3.0.1", - "@polymer/iron-overlay-behavior": "^3.0.2", - "@polymer/iron-pages": "^3.0.1", - "@polymer/iron-range-behavior": "^3.0.1", - "@polymer/iron-resizable-behavior": "^3.0.1", - "@polymer/iron-scroll-target-behavior": "^3.0.1", - "@polymer/iron-scroll-threshold": "^3.0.1", - "@polymer/iron-selector": "^3.0.1", - "@polymer/iron-test-helpers": "^3.0.1", - "@polymer/iron-validatable-behavior": "^3.0.1", - "@polymer/neon-animation": "^3.0.1", - "@polymer/paper-behaviors": "^3.0.1", - "@polymer/paper-button": "^3.0.1", - "@polymer/paper-input": "^3.0.2", - "@polymer/paper-progress": "^3.0.1", - "@polymer/paper-ripple": "^3.0.1", - "@polymer/paper-spinner": "^3.0.2", - "@polymer/paper-styles": "^3.0.1", - "@polymer/paper-tooltip": "^3.0.1", - "@polymer/polymer": "^3.2.0", - "@webcomponents/shadycss": "^1.9.1" + "@polymer/font-roboto": "3.0.2", + "@polymer/iron-a11y-announcer": "3.0.2", + "@polymer/iron-a11y-keys": "3.0.1", + "@polymer/iron-a11y-keys-behavior": "3.0.1", + "@polymer/iron-behaviors": "3.0.1", + "@polymer/iron-collapse": "3.0.1", + "@polymer/iron-dropdown": "3.0.1", + "@polymer/iron-fit-behavior": "3.0.1", + "@polymer/iron-flex-layout": "3.0.1", + "@polymer/iron-icon": "3.0.1", + "@polymer/iron-iconset-svg": "3.0.1", + "@polymer/iron-input": "3.0.1", + "@polymer/iron-list": "3.0.2", + "@polymer/iron-location": "3.0.1", + "@polymer/iron-media-query": "3.0.1", + "@polymer/iron-meta": "3.0.1", + "@polymer/iron-overlay-behavior": "3.0.2", + "@polymer/iron-pages": "3.0.1", + "@polymer/iron-range-behavior": "3.0.1", + "@polymer/iron-resizable-behavior": "3.0.1", + "@polymer/iron-scroll-target-behavior": "3.0.1", + "@polymer/iron-scroll-threshold": "3.0.1", + "@polymer/iron-selector": "3.0.1", + "@polymer/iron-test-helpers": "3.0.1", + "@polymer/iron-validatable-behavior": "3.0.1", + "@polymer/neon-animation": "3.0.1", + "@polymer/paper-behaviors": "3.0.1", + "@polymer/paper-input": "3.0.2", + "@polymer/paper-progress": "3.0.1", + "@polymer/paper-ripple": "3.0.1", + "@polymer/paper-spinner": "3.0.2", + "@polymer/paper-styles": "3.0.1", + "@polymer/paper-tooltip": "3.0.1", + "@polymer/polymer": "3.2.0", + "@webcomponents/shadycss": "1.9.1", + "rollup": "1.12.4" } } diff --git a/chromium/third_party/polymer/v3_0/polymer.js b/chromium/third_party/polymer/v3_0/polymer.js new file mode 100644 index 00000000000..776eb5adf2a --- /dev/null +++ b/chromium/third_party/polymer/v3_0/polymer.js @@ -0,0 +1,26 @@ +/** +@license +Copyright (c) 2019 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 +*/ + +export {afterNextRender, beforeNextRender} from './lib/utils/render-status.js'; +export {animationFrame, idlePeriod, microTask} from './lib/utils/async.js'; +import * as gestures from './lib/utils/gestures.js'; +export {gestures}; +export {Base} from './polymer-legacy.js'; +export {dashToCamelCase} from './lib/utils/case-map.js'; +export {Debouncer, enqueueDebouncer} from './lib/utils/debounce.js'; +export {dom, flush} from './lib/legacy/polymer.dom.js'; +export {html} from './lib/utils/html-tag.js'; +export {matches, translate} from './lib/utils/path.js'; +export {OptionalMutableDataBehavior} from './lib/legacy/mutable-data-behavior.js'; +export {Polymer} from './lib/legacy/polymer-fn.js'; +export {PolymerElement} from './polymer-element.js'; +export {TemplateInstanceBase} from './lib/utils/templatize.js'; +export {Templatizer} from './lib/legacy/templatizer-behavior.js'; +export {useShadow} from './lib/utils/settings.js'; diff --git a/chromium/third_party/polymer/v3_0/reproduce.sh b/chromium/third_party/polymer/v3_0/reproduce.sh index bbf9fd95550..d75b5955128 100755 --- a/chromium/third_party/polymer/v3_0/reproduce.sh +++ b/chromium/third_party/polymer/v3_0/reproduce.sh @@ -48,6 +48,18 @@ find components-chromium/polymer/ -mindepth 3 -maxdepth 3 -name '*.js' \ # Apply additional chrome specific patches. patch -p1 --forward -r - < chromium.patch +echo 'Minifying Polymer 3, since it comes non-minified from NPM.' +python minify_polymer.py + +echo 'Updating paper/iron elements to point to the minified file.' +# Replace all paths that point to within polymer/ to point to the bundle. +find components-chromium/ -name '*.js' -exec sed -i \ + 's/\/polymer\/[a-zA-Z\/\.-]\+/\/polymer\/polymer_bundled.min.js/' {} + + +# Undo any changes in paper-ripple, since Chromium's implementation is a fork of +# the original paper-ripple. +git checkout -- components-chromium/paper-ripple/* + new=$(git status --porcelain components-chromium | grep '^??' | \ cut -d' ' -f2 | egrep '\.(js|css)$' || true) @@ -70,8 +82,13 @@ if [[ ! -z "${new}${deleted}" ]]; then echo fi -# TODO css_strip_prefixes.py -# TODO rgbify_hex_vars.py +echo 'Stripping unnecessary prefixed CSS rules...' +python ../v1_0/css_strip_prefixes.py --file_extension=js + +echo 'Generating -rgb versions of --google-* vars in paper-style/colors.js...' +python ../v1_0/rgbify_hex_vars.py --filter-prefix=google --replace \ + components-chromium/paper-styles/color.js + # TODO create components summary # TODO generate gn # TODO find unused elements? diff --git a/chromium/third_party/polymer/v3_0/rsync_exclude.txt b/chromium/third_party/polymer/v3_0/rsync_exclude.txt index 1b00b5c7245..5777fbb9a6a 100644 --- a/chromium/third_party/polymer/v3_0/rsync_exclude.txt +++ b/chromium/third_party/polymer/v3_0/rsync_exclude.txt @@ -40,7 +40,12 @@ iron-checked-element-behavior/* # iron-form-element-behavior iron-form-element-behavior/* +# iron-test-helpers +iron-test-helpers/iron-test-helpers.js +iron-test-helpers/test-helpers.js + # paper-behaviors +paper-behaviors/paper-button-behavior.js paper-behaviors/paper-checked-element-behavior.js # paper-input @@ -75,3 +80,5 @@ neon-animation/animations/slide-up-animation.js neon-animation/animations/transform-animation.js neon-animation/neon-animation.js neon-animation/neon-animations.js +neon-animation/neon-shared-element-animatable-behavior.js +neon-animation/neon-shared-element-animation-behavior.js |