diff --git a/.devcontainer/configuration.yaml b/.devcontainer/configuration.yaml
new file mode 100644
index 0000000..9b01ded
--- /dev/null
+++ b/.devcontainer/configuration.yaml
@@ -0,0 +1,4 @@
+default_config:
+lovelace:
+ mode: yaml
+demo:
\ No newline at end of file
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 0000000..6d4e99a
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,32 @@
+// See https://aka.ms/vscode-remote/devcontainer.json for format details.
+{
+ "name": "Radial Menu Element Development",
+ "image": "ludeeus/devcontainer:monster-stable",
+ "context": "..",
+ "appPort": ["5000:5000", "9123:8123"],
+ "postCreateCommand": "npm install",
+ "runArgs": [
+ "-v",
+ "${env:HOME}${env:USERPROFILE}/.ssh:/tmp/.ssh" // This is added so you can push from inside the container
+ ],
+ "extensions": [
+ "github.vscode-pull-request-github",
+ "eamodio.gitlens",
+ "dbaeumer.vscode-eslint",
+ "esbenp.prettier-vscode",
+ "bierner.lit-html",
+ "runem.lit-plugin",
+ "auchenberg.vscode-browser-preview",
+ "davidanson.vscode-markdownlint",
+ "redhat.vscode-yaml"
+ ],
+ "settings": {
+ "files.eol": "\n",
+ "editor.tabSize": 4,
+ "terminal.integrated.shell.linux": "/bin/bash",
+ "editor.formatOnPaste": false,
+ "editor.formatOnSave": true,
+ "editor.formatOnType": true,
+ "files.trimTrailingWhitespace": true
+ }
+}
diff --git a/.devcontainer/ui-lovelace.yaml b/.devcontainer/ui-lovelace.yaml
new file mode 100644
index 0000000..476f3b6
--- /dev/null
+++ b/.devcontainer/ui-lovelace.yaml
@@ -0,0 +1,41 @@
+resources:
+ - url: http://127.0.0.1:5000/radial-menu.js
+ type: module
+views:
+ - cards:
+ - type: custom:radial-menu
+ icon: mdi:home
+ name: Home
+ default_open: true
+ default_dismiss: false
+ hold_action:
+ action: url
+ url: https://www.home-assistant.io
+ items:
+ - entity: light.bed_light
+ icon: mdi:flash
+ name: Bedroom Light
+ tap_action:
+ action: toggle
+ haptic: true
+ hold_action:
+ action: more-info
+ - entity: alarm_control_panel.ha_alarm
+ icon: mdi:alarm-light
+ name: Alarm Panel
+ tap_action:
+ action: more-info
+ - icon: mdi:alarm
+ name: Timer
+ tap_action:
+ action: call-service
+ service: timer.start
+ service_data:
+ entity_id: timer.laundry
+ haptic: true
+ hold_action:
+ action: call-service
+ service: timer.pause
+ service_data:
+ entity_id: timer.laundry
+ haptic: true
diff --git a/.eslintrc.js b/.eslintrc.js
new file mode 100644
index 0000000..fc69b8b
--- /dev/null
+++ b/.eslintrc.js
@@ -0,0 +1,16 @@
+module.exports = {
+ parser: '@typescript-eslint/parser', // Specifies the ESLint parser
+ extends: [
+ 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
+ 'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
+ 'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
+ ],
+ parserOptions: {
+ ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
+ sourceType: 'module', // Allows for the use of imports
+ experimentalDecorators: true,
+ },
+ rules: {
+ "@typescript-eslint/camelcase": 0
+ }
+};
diff --git a/.eslintrc.yaml b/.eslintrc.yaml
deleted file mode 100644
index 6b60ded..0000000
--- a/.eslintrc.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-extends: airbnb-base
-parser: "@typescript-eslint/parser"
-rules:
- no-else-return: 0
- no-underscore-dangle: 0
- nonblock-statement-body-position: 0
- curly: 0
- no-return-assign: 0
- consistent-return: 0
- no-mixed-operators: 0
- class-methods-use-this: 0
- no-nested-ternary: 0
- camelcase: 0
- no-unused-vars: 0
-globals:
- window: true
- Event: true
- customElements: true
diff --git a/.gitignore b/.gitignore
index e8ecf85..acfea94 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
/node_modules/
-.rpt2_cache/
\ No newline at end of file
+/.rpt2_cache/
+package-lock.json
\ No newline at end of file
diff --git a/.prettierrc.js b/.prettierrc.js
new file mode 100644
index 0000000..4121004
--- /dev/null
+++ b/.prettierrc.js
@@ -0,0 +1,7 @@
+module.exports = {
+ semi: true,
+ trailingComma: 'all',
+ singleQuote: true,
+ printWidth: 120,
+ tabWidth: 2,
+};
diff --git a/babel.config.js b/babel.config.js
deleted file mode 100644
index bc267c0..0000000
--- a/babel.config.js
+++ /dev/null
@@ -1,6 +0,0 @@
-const plugins = [
- '@babel/plugin-proposal-class-properties',
- ['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }],
-];
-
-module.exports = { plugins };
\ No newline at end of file
diff --git a/dist/radial-menu.js b/dist/radial-menu.js
index a5c02a9..4b05d8d 100644
--- a/dist/radial-menu.js
+++ b/dist/radial-menu.js
@@ -1,25 +1,18 @@
-/*! *****************************************************************************
-Copyright (c) Microsoft Corporation. All rights reserved.
-Licensed under the Apache License, Version 2.0 (the "License"); you may not use
-this file except in compliance with the License. You may obtain a copy of the
-License at http://www.apache.org/licenses/LICENSE-2.0
-
-THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
-WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
-MERCHANTABLITY OR NON-INFRINGEMENT.
-
-See the Apache Version 2.0 License for specific language governing permissions
-and limitations under the License.
-***************************************************************************** */
-
-function __decorate(decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
-}
-
+/*! *****************************************************************************
+Copyright (c) Microsoft Corporation. All rights reserved.
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at http://www.apache.org/licenses/LICENSE-2.0
+
+THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
+WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
+MERCHANTABLITY OR NON-INFRINGEMENT.
+
+See the Apache Version 2.0 License for specific language governing permissions
+and limitations under the License.
+***************************************************************************** */
+function t(t,e,n,i){var s,o=arguments.length,r=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(o<3?s(r):o>3?s(e,n,r):s(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -32,38 +25,7 @@ function __decorate(decorators, target, key, desc) {
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
- */
-const directives = new WeakMap();
-/**
- * Brands a function as a directive so that lit-html will call the function
- * during template rendering, rather than passing as a value.
- *
- * @param f The directive factory function. Must be a function that returns a
- * function of the signature `(part: Part) => void`. The returned function will
- * be called with the part object
- *
- * @example
- *
- * ```
- * import {directive, html} from 'lit-html';
- *
- * const immutable = directive((v) => (part) => {
- * if (part.value !== v) {
- * part.setValue(v)
- * }
- * });
- * ```
- */
-// tslint:disable-next-line:no-any
-const directive = (f) => ((...args) => {
- const d = f(...args);
- directives.set(d, true);
- return d;
-});
-const isDirective = (o) => {
- return typeof o === 'function' && directives.has(o);
-};
-
+ */}const e=new WeakMap,n=t=>"function"==typeof t&&e.has(t),i=void 0!==window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,s=(t,e,n=null)=>{for(;e!==n;){const n=e.nextSibling;t.removeChild(e),e=n}},o={},r={},a=`{{lit-${String(Math.random()).slice(2)}}}`,c=`\x3c!--${a}--\x3e`,l=new RegExp(`${a}|${c}`),d="$lit$";class u{constructor(t,e){this.parts=[],this.element=e;const n=[],i=[],s=document.createTreeWalker(e.content,133,null,!1);let o=0,r=-1,c=0;const{strings:u,values:{length:p}}=t;for(;c
0;){const e=u[c],n=f.exec(e)[2],i=n.toLowerCase()+d,s=t.getAttribute(i);t.removeAttribute(i);const o=s.split(l);this.parts.push({type:"attribute",index:r,name:n,strings:o}),c+=o.length-1}}"TEMPLATE"===t.tagName&&(i.push(t),s.currentNode=t.content)}else if(3===t.nodeType){const e=t.data;if(e.indexOf(a)>=0){const i=t.parentNode,s=e.split(l),o=s.length-1;for(let e=0;e{const n=t.length-e.length;return n>=0&&t.slice(n)===e},p=t=>-1!==t.index,m=()=>document.createComment(""),f=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -77,48 +39,7 @@ const isDirective = (o) => {
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
-/**
- * True if the custom elements polyfill is in use.
- */
-const isCEPolyfill = window.customElements !== undefined &&
- window.customElements.polyfillWrapFlushCallback !==
- undefined;
-/**
- * Removes nodes, starting from `startNode` (inclusive) to `endNode`
- * (exclusive), from `container`.
- */
-const removeNodes = (container, startNode, endNode = null) => {
- let node = startNode;
- while (node !== endNode) {
- const n = node.nextSibling;
- container.removeChild(node);
- node = n;
- }
-};
-
-/**
- * @license
- * Copyright (c) 2018 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
- */
-/**
- * A sentinel value that signals that a value was handled by a directive and
- * should not be written to the DOM.
- */
-const noChange = {};
-/**
- * A sentinel value that signals a NodePart to fully clear its content.
- */
-const nothing = {};
-
+class g{constructor(t,e,n){this.__parts=[],this.template=t,this.processor=e,this.options=n}update(t){let e=0;for(const n of this.__parts)void 0!==n&&n.setValue(t[e]),e++;for(const t of this.__parts)void 0!==t&&t.commit()}_clone(){const t=i?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),e=[],n=this.template.parts,s=document.createTreeWalker(t,133,null,!1);let o,r=0,a=0,c=s.nextNode();for(;r`;
-const markerRegex = new RegExp(`${marker}|${nodeMarker}`);
-/**
- * Suffix appended to all bound attribute names.
- */
-const boundAttributeSuffix = '$lit$';
-/**
- * An updateable Template that tracks the location of dynamic parts.
- */
-class Template {
- constructor(result, element) {
- this.parts = [];
- this.element = element;
- let index = -1;
- let partIndex = 0;
- const nodesToRemove = [];
- const _prepareTemplate = (template) => {
- const content = template.content;
- // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be
- // null
- const walker = document.createTreeWalker(content, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);
- // Keeps track of the last index associated with a part. We try to delete
- // unnecessary nodes, but we never want to associate two different parts
- // to the same index. They must have a constant node between.
- let lastPartIndex = 0;
- while (walker.nextNode()) {
- index++;
- const node = walker.currentNode;
- if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {
- if (node.hasAttributes()) {
- const attributes = node.attributes;
- // Per
- // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,
- // attributes are not guaranteed to be returned in document order.
- // In particular, Edge/IE can return them out of order, so we cannot
- // assume a correspondance between part index and attribute index.
- let count = 0;
- for (let i = 0; i < attributes.length; i++) {
- if (attributes[i].value.indexOf(marker) >= 0) {
- count++;
- }
- }
- while (count-- > 0) {
- // Get the template literal section leading up to the first
- // expression in this attribute
- const stringForPart = result.strings[partIndex];
- // Find the attribute name
- const name = lastAttributeNameRegex.exec(stringForPart)[2];
- // Find the corresponding attribute
- // All bound attributes have had a suffix added in
- // TemplateResult#getHTML to opt out of special attribute
- // handling. To look up the attribute value we also need to add
- // the suffix.
- const attributeLookupName = name.toLowerCase() + boundAttributeSuffix;
- const attributeValue = node.getAttribute(attributeLookupName);
- const strings = attributeValue.split(markerRegex);
- this.parts.push({ type: 'attribute', index, name, strings });
- node.removeAttribute(attributeLookupName);
- partIndex += strings.length - 1;
- }
- }
- if (node.tagName === 'TEMPLATE') {
- _prepareTemplate(node);
- }
- }
- else if (node.nodeType === 3 /* Node.TEXT_NODE */) {
- const data = node.data;
- if (data.indexOf(marker) >= 0) {
- const parent = node.parentNode;
- const strings = data.split(markerRegex);
- const lastIndex = strings.length - 1;
- // Generate a new text node for each literal section
- // These nodes are also used as the markers for node parts
- for (let i = 0; i < lastIndex; i++) {
- parent.insertBefore((strings[i] === '') ? createMarker() :
- document.createTextNode(strings[i]), node);
- this.parts.push({ type: 'node', index: ++index });
- }
- // If there's no text, we must insert a comment to mark our place.
- // Else, we can trust it will stick around after cloning.
- if (strings[lastIndex] === '') {
- parent.insertBefore(createMarker(), node);
- nodesToRemove.push(node);
- }
- else {
- node.data = strings[lastIndex];
- }
- // We have a part for each match found
- partIndex += lastIndex;
- }
- }
- else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {
- if (node.data === marker) {
- const parent = node.parentNode;
- // Add a new marker node to be the startNode of the Part if any of
- // the following are true:
- // * We don't have a previousSibling
- // * The previousSibling is already the start of a previous part
- if (node.previousSibling === null || index === lastPartIndex) {
- index++;
- parent.insertBefore(createMarker(), node);
- }
- lastPartIndex = index;
- this.parts.push({ type: 'node', index });
- // If we don't have a nextSibling, keep this node so we have an end.
- // Else, we can remove it to save future costs.
- if (node.nextSibling === null) {
- node.data = '';
- }
- else {
- nodesToRemove.push(node);
- index--;
- }
- partIndex++;
- }
- else {
- let i = -1;
- while ((i = node.data.indexOf(marker, i + 1)) !==
- -1) {
- // Comment node has a binding marker inside, make an inactive part
- // The binding won't work, but subsequent bindings will
- // TODO (justinfagnani): consider whether it's even worth it to
- // make bindings in comments work
- this.parts.push({ type: 'node', index: -1 });
- }
- }
- }
- }
- };
- _prepareTemplate(element);
- // Remove text binding nodes after the walk to not disturb the TreeWalker
- for (const n of nodesToRemove) {
- n.parentNode.removeChild(n);
- }
- }
-}
-const isTemplatePartActive = (part) => part.index !== -1;
-// Allows `document.createComment('')` to be renamed for a
-// small manual size-savings.
-const createMarker = () => document.createComment('');
-/**
- * This regex extracts the attribute name preceding an attribute-position
- * expression. It does this by matching the syntax allowed for attributes
- * against the string literal directly preceding the expression, assuming that
- * the expression is in an attribute-value position.
- *
- * See attributes in the HTML spec:
- * https://www.w3.org/TR/html5/syntax.html#attributes-0
- *
- * "\0-\x1F\x7F-\x9F" are Unicode control characters
- *
- * " \x09\x0a\x0c\x0d" are HTML space characters:
- * https://www.w3.org/TR/html5/infrastructure.html#space-character
- *
- * So an attribute is:
- * * The name: any character except a control character, space character, ('),
- * ("), ">", "=", or "/"
- * * Followed by zero or more space characters
- * * Followed by "="
- * * Followed by zero or more space characters
- * * Followed by:
- * * Any character except space, ('), ("), "<", ">", "=", (`), or
- * * (") then any non-("), or
- * * (') then any non-(')
- */
-const lastAttributeNameRegex = /([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F \x09\x0a\x0c\x0d"'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;
-
+ */const _=` ${a} `;class y{constructor(t,e,n,i){this.strings=t,this.values=e,this.type=n,this.processor=i}getHTML(){const t=this.strings.length-1;let e="",n=!1;for(let i=0;i-1||n)&&-1===t.indexOf("--\x3e",s+1);const o=f.exec(t);e+=null===o?t+(n?_:c):t.substr(0,o.index)+o[1]+o[2]+d+o[3]+a}return e+=this.strings[t]}getTemplateElement(){const t=document.createElement("template");return t.innerHTML=this.getHTML(),t}}
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -320,91 +65,7 @@ const lastAttributeNameRegex = /([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F \x09\x0
* 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
- */
-/**
- * An instance of a `Template` that can be attached to the DOM and updated
- * with new values.
- */
-class TemplateInstance {
- constructor(template, processor, options) {
- this._parts = [];
- this.template = template;
- this.processor = processor;
- this.options = options;
- }
- update(values) {
- let i = 0;
- for (const part of this._parts) {
- if (part !== undefined) {
- part.setValue(values[i]);
- }
- i++;
- }
- for (const part of this._parts) {
- if (part !== undefined) {
- part.commit();
- }
- }
- }
- _clone() {
- // When using the Custom Elements polyfill, clone the node, rather than
- // importing it, to keep the fragment in the template's document. This
- // leaves the fragment inert so custom elements won't upgrade and
- // potentially modify their contents by creating a polyfilled ShadowRoot
- // while we traverse the tree.
- const fragment = isCEPolyfill ?
- this.template.element.content.cloneNode(true) :
- document.importNode(this.template.element.content, true);
- const parts = this.template.parts;
- let partIndex = 0;
- let nodeIndex = 0;
- const _prepareInstance = (fragment) => {
- // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be
- // null
- const walker = document.createTreeWalker(fragment, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);
- let node = walker.nextNode();
- // Loop through all the nodes and parts of a template
- while (partIndex < parts.length && node !== null) {
- const part = parts[partIndex];
- // Consecutive Parts may have the same node index, in the case of
- // multiple bound attributes on an element. So each iteration we either
- // increment the nodeIndex, if we aren't on a node with a part, or the
- // partIndex if we are. By not incrementing the nodeIndex when we find a
- // part, we allow for the next part to be associated with the current
- // node if neccessasry.
- if (!isTemplatePartActive(part)) {
- this._parts.push(undefined);
- partIndex++;
- }
- else if (nodeIndex === part.index) {
- if (part.type === 'node') {
- const part = this.processor.handleTextExpression(this.options);
- part.insertAfterNode(node.previousSibling);
- this._parts.push(part);
- }
- else {
- this._parts.push(...this.processor.handleAttributeExpressions(node, part.name, part.strings, this.options));
- }
- partIndex++;
- }
- else {
- nodeIndex++;
- if (node.nodeName === 'TEMPLATE') {
- _prepareInstance(node.content);
- }
- node = walker.nextNode();
- }
- }
- };
- _prepareInstance(fragment);
- if (isCEPolyfill) {
- document.adoptNode(fragment);
- customElements.upgrade(fragment);
- }
- return fragment;
- }
-}
-
+ */const v=t=>null===t||!("object"==typeof t||"function"==typeof t),b=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class w{constructor(t,e,n){this.dirty=!0,this.element=t,this.name=e,this.strings=n,this.parts=[];for(let t=0;tthis.handleEvent(t)}setValue(t){this.__pendingValue=t}commit(){for(;n(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=o,t(this)}if(this.__pendingValue===o)return;const t=this.__pendingValue,e=this.value,i=null==t||null!=e&&(t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive),s=null!=t&&(null==e||i);i&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),s&&(this.__options=T(t),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=t,this.__pendingValue=o}handleEvent(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}const T=t=>t&&(N?{capture:t.capture,passive:t.passive,once:t.once}:t.capture);
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -417,58 +78,7 @@ class TemplateInstance {
* 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 return type of `html`, which holds a Template and the values from
- * interpolated expressions.
- */
-class TemplateResult {
- constructor(strings, values, type, processor) {
- this.strings = strings;
- this.values = values;
- this.type = type;
- this.processor = processor;
- }
- /**
- * Returns a string of HTML used to create a `` element.
- */
- getHTML() {
- const endIndex = this.strings.length - 1;
- let html = '';
- for (let i = 0; i < endIndex; i++) {
- const s = this.strings[i];
- // This exec() call does two things:
- // 1) Appends a suffix to the bound attribute name to opt out of special
- // attribute value parsing that IE11 and Edge do, like for style and
- // many SVG attributes. The Template class also appends the same suffix
- // when looking up attributes to create Parts.
- // 2) Adds an unquoted-attribute-safe marker for the first expression in
- // an attribute. Subsequent attribute expressions will use node markers,
- // and this is safe since attributes with multiple expressions are
- // guaranteed to be quoted.
- const match = lastAttributeNameRegex.exec(s);
- if (match) {
- // We're starting a new bound attribute.
- // Add the safe attribute suffix, and use unquoted-attribute-safe
- // marker.
- html += s.substr(0, match.index) + match[1] + match[2] +
- boundAttributeSuffix + match[3] + marker;
- }
- else {
- // We're either in a bound node, or trailing bound attribute.
- // Either way, nodeMarker is safe to use.
- html += s + nodeMarker;
- }
- }
- return html + this.strings[endIndex];
- }
- getTemplateElement() {
- const template = document.createElement('template');
- template.innerHTML = this.getHTML();
- return template;
- }
-}
-
+ */const A=new class{handleAttributeExpressions(t,e,n,i){const s=e[0];if("."===s){return new M(t,e.slice(1),n).parts}return"@"===s?[new E(t,e.slice(1),i.eventContext)]:"?"===s?[new P(t,e.slice(1),n)]:new w(t,e,n).parts}handleTextExpression(t){return new x(t)}};
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -481,418 +91,7 @@ class TemplateResult {
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
- */
-const isPrimitive = (value) => {
- return (value === null ||
- !(typeof value === 'object' || typeof value === 'function'));
-};
-/**
- * Sets attribute values for AttributeParts, so that the value is only set once
- * even if there are multiple parts for an attribute.
- */
-class AttributeCommitter {
- constructor(element, name, strings) {
- this.dirty = true;
- this.element = element;
- this.name = name;
- this.strings = strings;
- this.parts = [];
- for (let i = 0; i < strings.length - 1; i++) {
- this.parts[i] = this._createPart();
- }
- }
- /**
- * Creates a single part. Override this to create a differnt type of part.
- */
- _createPart() {
- return new AttributePart(this);
- }
- _getValue() {
- const strings = this.strings;
- const l = strings.length - 1;
- let text = '';
- for (let i = 0; i < l; i++) {
- text += strings[i];
- const part = this.parts[i];
- if (part !== undefined) {
- const v = part.value;
- if (v != null &&
- (Array.isArray(v) ||
- // tslint:disable-next-line:no-any
- typeof v !== 'string' && v[Symbol.iterator])) {
- for (const t of v) {
- text += typeof t === 'string' ? t : String(t);
- }
- }
- else {
- text += typeof v === 'string' ? v : String(v);
- }
- }
- }
- text += strings[l];
- return text;
- }
- commit() {
- if (this.dirty) {
- this.dirty = false;
- this.element.setAttribute(this.name, this._getValue());
- }
- }
-}
-class AttributePart {
- constructor(comitter) {
- this.value = undefined;
- this.committer = comitter;
- }
- setValue(value) {
- if (value !== noChange && (!isPrimitive(value) || value !== this.value)) {
- this.value = value;
- // If the value is a not a directive, dirty the committer so that it'll
- // call setAttribute. If the value is a directive, it'll dirty the
- // committer if it calls setValue().
- if (!isDirective(value)) {
- this.committer.dirty = true;
- }
- }
- }
- commit() {
- while (isDirective(this.value)) {
- const directive = this.value;
- this.value = noChange;
- directive(this);
- }
- if (this.value === noChange) {
- return;
- }
- this.committer.commit();
- }
-}
-class NodePart {
- constructor(options) {
- this.value = undefined;
- this._pendingValue = undefined;
- this.options = options;
- }
- /**
- * Inserts this part into a container.
- *
- * This part must be empty, as its contents are not automatically moved.
- */
- appendInto(container) {
- this.startNode = container.appendChild(createMarker());
- this.endNode = container.appendChild(createMarker());
- }
- /**
- * Inserts this part between `ref` and `ref`'s next sibling. Both `ref` and
- * its next sibling must be static, unchanging nodes such as those that appear
- * in a literal section of a template.
- *
- * This part must be empty, as its contents are not automatically moved.
- */
- insertAfterNode(ref) {
- this.startNode = ref;
- this.endNode = ref.nextSibling;
- }
- /**
- * Appends this part into a parent part.
- *
- * This part must be empty, as its contents are not automatically moved.
- */
- appendIntoPart(part) {
- part._insert(this.startNode = createMarker());
- part._insert(this.endNode = createMarker());
- }
- /**
- * Appends this part after `ref`
- *
- * This part must be empty, as its contents are not automatically moved.
- */
- insertAfterPart(ref) {
- ref._insert(this.startNode = createMarker());
- this.endNode = ref.endNode;
- ref.endNode = this.startNode;
- }
- setValue(value) {
- this._pendingValue = value;
- }
- commit() {
- while (isDirective(this._pendingValue)) {
- const directive = this._pendingValue;
- this._pendingValue = noChange;
- directive(this);
- }
- const value = this._pendingValue;
- if (value === noChange) {
- return;
- }
- if (isPrimitive(value)) {
- if (value !== this.value) {
- this._commitText(value);
- }
- }
- else if (value instanceof TemplateResult) {
- this._commitTemplateResult(value);
- }
- else if (value instanceof Node) {
- this._commitNode(value);
- }
- else if (Array.isArray(value) ||
- // tslint:disable-next-line:no-any
- value[Symbol.iterator]) {
- this._commitIterable(value);
- }
- else if (value === nothing) {
- this.value = nothing;
- this.clear();
- }
- else {
- // Fallback, will render the string representation
- this._commitText(value);
- }
- }
- _insert(node) {
- this.endNode.parentNode.insertBefore(node, this.endNode);
- }
- _commitNode(value) {
- if (this.value === value) {
- return;
- }
- this.clear();
- this._insert(value);
- this.value = value;
- }
- _commitText(value) {
- const node = this.startNode.nextSibling;
- value = value == null ? '' : value;
- if (node === this.endNode.previousSibling &&
- node.nodeType === 3 /* Node.TEXT_NODE */) {
- // If we only have a single text node between the markers, we can just
- // set its value, rather than replacing it.
- // TODO(justinfagnani): Can we just check if this.value is primitive?
- node.data = value;
- }
- else {
- this._commitNode(document.createTextNode(typeof value === 'string' ? value : String(value)));
- }
- this.value = value;
- }
- _commitTemplateResult(value) {
- const template = this.options.templateFactory(value);
- if (this.value instanceof TemplateInstance &&
- this.value.template === template) {
- this.value.update(value.values);
- }
- else {
- // Make sure we propagate the template processor from the TemplateResult
- // so that we use its syntax extension, etc. The template factory comes
- // from the render function options so that it can control template
- // caching and preprocessing.
- const instance = new TemplateInstance(template, value.processor, this.options);
- const fragment = instance._clone();
- instance.update(value.values);
- this._commitNode(fragment);
- this.value = instance;
- }
- }
- _commitIterable(value) {
- // For an Iterable, we create a new InstancePart per item, then set its
- // value to the item. This is a little bit of overhead for every item in
- // an Iterable, but it lets us recurse easily and efficiently update Arrays
- // of TemplateResults that will be commonly returned from expressions like:
- // array.map((i) => html`${i}`), by reusing existing TemplateInstances.
- // If _value is an array, then the previous render was of an
- // iterable and _value will contain the NodeParts from the previous
- // render. If _value is not an array, clear this part and make a new
- // array for NodeParts.
- if (!Array.isArray(this.value)) {
- this.value = [];
- this.clear();
- }
- // Lets us keep track of how many items we stamped so we can clear leftover
- // items from a previous render
- const itemParts = this.value;
- let partIndex = 0;
- let itemPart;
- for (const item of value) {
- // Try to reuse an existing part
- itemPart = itemParts[partIndex];
- // If no existing part, create a new one
- if (itemPart === undefined) {
- itemPart = new NodePart(this.options);
- itemParts.push(itemPart);
- if (partIndex === 0) {
- itemPart.appendIntoPart(this);
- }
- else {
- itemPart.insertAfterPart(itemParts[partIndex - 1]);
- }
- }
- itemPart.setValue(item);
- itemPart.commit();
- partIndex++;
- }
- if (partIndex < itemParts.length) {
- // Truncate the parts array so _value reflects the current state
- itemParts.length = partIndex;
- this.clear(itemPart && itemPart.endNode);
- }
- }
- clear(startNode = this.startNode) {
- removeNodes(this.startNode.parentNode, startNode.nextSibling, this.endNode);
- }
-}
-/**
- * Implements a boolean attribute, roughly as defined in the HTML
- * specification.
- *
- * If the value is truthy, then the attribute is present with a value of
- * ''. If the value is falsey, the attribute is removed.
- */
-class BooleanAttributePart {
- constructor(element, name, strings) {
- this.value = undefined;
- this._pendingValue = undefined;
- if (strings.length !== 2 || strings[0] !== '' || strings[1] !== '') {
- throw new Error('Boolean attributes can only contain a single expression');
- }
- this.element = element;
- this.name = name;
- this.strings = strings;
- }
- setValue(value) {
- this._pendingValue = value;
- }
- commit() {
- while (isDirective(this._pendingValue)) {
- const directive = this._pendingValue;
- this._pendingValue = noChange;
- directive(this);
- }
- if (this._pendingValue === noChange) {
- return;
- }
- const value = !!this._pendingValue;
- if (this.value !== value) {
- if (value) {
- this.element.setAttribute(this.name, '');
- }
- else {
- this.element.removeAttribute(this.name);
- }
- }
- this.value = value;
- this._pendingValue = noChange;
- }
-}
-/**
- * Sets attribute values for PropertyParts, so that the value is only set once
- * even if there are multiple parts for a property.
- *
- * If an expression controls the whole property value, then the value is simply
- * assigned to the property under control. If there are string literals or
- * multiple expressions, then the strings are expressions are interpolated into
- * a string first.
- */
-class PropertyCommitter extends AttributeCommitter {
- constructor(element, name, strings) {
- super(element, name, strings);
- this.single =
- (strings.length === 2 && strings[0] === '' && strings[1] === '');
- }
- _createPart() {
- return new PropertyPart(this);
- }
- _getValue() {
- if (this.single) {
- return this.parts[0].value;
- }
- return super._getValue();
- }
- commit() {
- if (this.dirty) {
- this.dirty = false;
- // tslint:disable-next-line:no-any
- this.element[this.name] = this._getValue();
- }
- }
-}
-class PropertyPart extends AttributePart {
-}
-// Detect event listener options support. If the `capture` property is read
-// from the options object, then options are supported. If not, then the thrid
-// argument to add/removeEventListener is interpreted as the boolean capture
-// value so we should only pass the `capture` property.
-let eventOptionsSupported = false;
-try {
- const options = {
- get capture() {
- eventOptionsSupported = true;
- return false;
- }
- };
- // tslint:disable-next-line:no-any
- window.addEventListener('test', options, options);
- // tslint:disable-next-line:no-any
- window.removeEventListener('test', options, options);
-}
-catch (_e) {
-}
-class EventPart {
- constructor(element, eventName, eventContext) {
- this.value = undefined;
- this._pendingValue = undefined;
- this.element = element;
- this.eventName = eventName;
- this.eventContext = eventContext;
- this._boundHandleEvent = (e) => this.handleEvent(e);
- }
- setValue(value) {
- this._pendingValue = value;
- }
- commit() {
- while (isDirective(this._pendingValue)) {
- const directive = this._pendingValue;
- this._pendingValue = noChange;
- directive(this);
- }
- if (this._pendingValue === noChange) {
- return;
- }
- const newListener = this._pendingValue;
- const oldListener = this.value;
- const shouldRemoveListener = newListener == null ||
- oldListener != null &&
- (newListener.capture !== oldListener.capture ||
- newListener.once !== oldListener.once ||
- newListener.passive !== oldListener.passive);
- const shouldAddListener = newListener != null && (oldListener == null || shouldRemoveListener);
- if (shouldRemoveListener) {
- this.element.removeEventListener(this.eventName, this._boundHandleEvent, this._options);
- }
- if (shouldAddListener) {
- this._options = getOptions(newListener);
- this.element.addEventListener(this.eventName, this._boundHandleEvent, this._options);
- }
- this.value = newListener;
- this._pendingValue = noChange;
- }
- handleEvent(event) {
- if (typeof this.value === 'function') {
- this.value.call(this.eventContext || this.element, event);
- }
- else {
- this.value.handleEvent(event);
- }
- }
-}
-// We copy options because of the inconsistent behavior of browsers when reading
-// the third argument of add/removeEventListener. IE11 doesn't support options
-// at all. Chrome 41 only reads `capture` if the argument is an object.
-const getOptions = (o) => o &&
- (eventOptionsSupported ?
- { capture: o.capture, passive: o.passive, once: o.once } :
- o.capture);
-
+ */function k(t){let e=D.get(t.type);void 0===e&&(e={stringsArray:new WeakMap,keyString:new Map},D.set(t.type,e));let n=e.stringsArray.get(t.strings);if(void 0!==n)return n;const i=t.strings.join(a);return void 0===(n=e.keyString.get(i))&&(n=new u(t,t.getTemplateElement()),e.keyString.set(i,n)),e.stringsArray.set(t.strings,n),n}const D=new Map,O=new WeakMap;
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -906,44 +105,6 @@ const getOptions = (o) => o &&
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
-/**
- * Creates Parts when a template is instantiated.
- */
-class DefaultTemplateProcessor {
- /**
- * Create parts for an attribute-position binding, given the event, attribute
- * name, and string literals.
- *
- * @param element The element containing the binding
- * @param name The attribute name
- * @param strings The string literals. There are always at least two strings,
- * event for fully-controlled bindings with a single expression.
- */
- handleAttributeExpressions(element, name, strings, options) {
- const prefix = name[0];
- if (prefix === '.') {
- const comitter = new PropertyCommitter(element, name.slice(1), strings);
- return comitter.parts;
- }
- if (prefix === '@') {
- return [new EventPart(element, name.slice(1), options.eventContext)];
- }
- if (prefix === '?') {
- return [new BooleanAttributePart(element, name.slice(1), strings)];
- }
- const comitter = new AttributeCommitter(element, name, strings);
- return comitter.parts;
- }
- /**
- * Create parts for a text-position binding.
- * @param templateFactory
- */
- handleTextExpression(options) {
- return new NodePart(options);
- }
-}
-const defaultTemplateProcessor = new DefaultTemplateProcessor();
-
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -957,40 +118,7 @@ const defaultTemplateProcessor = new DefaultTemplateProcessor();
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
-/**
- * The default TemplateFactory which caches Templates keyed on
- * result.type and result.strings.
- */
-function templateFactory(result) {
- let templateCache = templateCaches.get(result.type);
- if (templateCache === undefined) {
- templateCache = {
- stringsArray: new WeakMap(),
- keyString: new Map()
- };
- templateCaches.set(result.type, templateCache);
- }
- let template = templateCache.stringsArray.get(result.strings);
- if (template !== undefined) {
- return template;
- }
- // If the TemplateStringsArray is new, generate a key from the strings
- // This key is shared between all templates with identical content
- const key = result.strings.join(marker);
- // Check if we already have a Template for this key
- template = templateCache.keyString.get(key);
- if (template === undefined) {
- // If we have not seen this key before, create a new Template
- template = new Template(result, result.getTemplateElement());
- // Cache the Template for this key
- templateCache.keyString.set(key, template);
- }
- // Cache all future queries for this TemplateStringsArray
- templateCache.stringsArray.set(result.strings, template);
- return template;
-}
-const templateCaches = new Map();
-
+(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.1.2");const V=(t,...e)=>new y(t,e,"html",A),H=133;
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -1003,34 +131,7 @@ const templateCaches = new Map();
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
- */
-const parts = new WeakMap();
-/**
- * Renders a template to a container.
- *
- * To update a container with new values, reevaluate the template literal and
- * call `render` with the new result.
- *
- * @param result a TemplateResult created by evaluating a template tag like
- * `html` or `svg`.
- * @param container A DOM parent to render to. The entire contents are either
- * replaced, or efficiently updated if the same result type was previous
- * rendered there.
- * @param options RenderOptions for the entire render tree rendered to this
- * container. Render options must *not* change between renders to the same
- * container, as those changes will not effect previously rendered DOM.
- */
-const render = (result, container, options) => {
- let part = parts.get(container);
- if (part === undefined) {
- removeNodes(container, container.firstChild);
- parts.set(container, part = new NodePart(Object.assign({ templateFactory }, options)));
- part.appendInto(container);
- }
- part.setValue(result);
- part.commit();
-};
-
+ */function $(t,e){const{element:{content:n},parts:i}=t,s=document.createTreeWalker(n,H,null,!1);let o=R(i),r=i[o],a=-1,c=0;const l=[];let d=null;for(;s.nextNode();){a++;const t=s.currentNode;for(t.previousSibling===d&&(d=null),e.has(t)&&(l.push(t),null===d&&(d=t)),null!==d&&c++;void 0!==r&&r.index===a;)r.index=null!==d?-1:r.index-c,r=i[o=R(i,o)]}l.forEach(t=>t.parentNode.removeChild(t))}const Y=t=>{let e=11===t.nodeType?0:1;const n=document.createTreeWalker(t,H,null,!1);for(;n.nextNode();)e++;return e},R=(t,e=-1)=>{for(let n=e+1;n {
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
-// IMPORTANT: do not change the property name or the assignment expression.
-// This line will be used in regexes to search for lit-html usage.
-// TODO(justinfagnani): inject version number at build time
-(window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.0.0');
-/**
- * Interprets a template literal as an HTML template that can efficiently
- * render to and update a container.
- */
-const html = (strings, ...values) => new TemplateResult(strings, values, 'html', defaultTemplateProcessor);
-
+const U=(t,e)=>`${t}--${e}`;let L=!0;void 0===window.ShadyCSS?L=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),L=!1);const j=t=>e=>{const n=U(e.type,t);let i=D.get(n);void 0===i&&(i={stringsArray:new WeakMap,keyString:new Map},D.set(n,i));let s=i.stringsArray.get(e.strings);if(void 0!==s)return s;const o=e.strings.join(a);if(void 0===(s=i.keyString.get(o))){const n=e.getTemplateElement();L&&window.ShadyCSS.prepareTemplateDom(n,t),s=new u(e,n),i.keyString.set(o,s)}return i.stringsArray.set(e.strings,s),s},I=["html","svg"],F=new Set,z=(t,e,n)=>{F.add(t);const i=n?n.element:document.createElement("template"),s=e.querySelectorAll("style"),{length:o}=s;if(0===o)return void window.ShadyCSS.prepareTemplateStyles(i,t);const r=document.createElement("style");for(let t=0;t{I.forEach(e=>{const n=D.get(U(e,t));void 0!==n&&n.keyString.forEach(t=>{const{element:{content:e}}=t,n=new Set;Array.from(e.querySelectorAll("style")).forEach(t=>{n.add(t)}),$(t,n)})})})(t);const a=i.content;n?function(t,e,n=null){const{element:{content:i},parts:s}=t;if(null==n)return void i.appendChild(e);const o=document.createTreeWalker(i,H,null,!1);let r=R(s),a=0,c=-1;for(;o.nextNode();){for(c++,o.currentNode===n&&(a=Y(e),n.parentNode.insertBefore(e,n));-1!==r&&s[r].index===c;){if(a>0){for(;-1!==r;)s[r].index+=a,r=R(s,r);return}r=R(s,r)}}}(n,r,a.firstChild):a.insertBefore(r,a.firstChild),window.ShadyCSS.prepareTemplateStyles(i,t);const c=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==c)e.insertBefore(c.cloneNode(!0),e.firstChild);else if(n){a.insertBefore(r,a.firstChild);const t=new Set;t.add(r),$(n,t)}};window.JSCompiler_renameProperty=(t,e)=>t;const q={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return null!==t;case Number:return null===t?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},B=(t,e)=>e!==t&&(e==e||t==t),W={attribute:!0,type:String,converter:q,reflect:!1,hasChanged:B},J=Promise.resolve(!0),Z=1,X=4,G=8,K=16,Q=32,tt="finalized";class et extends HTMLElement{constructor(){super(),this._updateState=0,this._instanceProperties=void 0,this._updatePromise=J,this._hasConnectedResolver=void 0,this._changedProperties=new Map,this._reflectingProperties=void 0,this.initialize()}static get observedAttributes(){this.finalize();const t=[];return this._classProperties.forEach((e,n)=>{const i=this._attributeNameForProperty(n,e);void 0!==i&&(this._attributeToPropertyMap.set(i,n),t.push(i))}),t}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const t=Object.getPrototypeOf(this)._classProperties;void 0!==t&&t.forEach((t,e)=>this._classProperties.set(e,t))}}static createProperty(t,e=W){if(this._ensureClassProperties(),this._classProperties.set(t,e),e.noAccessor||this.prototype.hasOwnProperty(t))return;const n="symbol"==typeof t?Symbol():`__${t}`;Object.defineProperty(this.prototype,t,{get(){return this[n]},set(e){const i=this[t];this[n]=e,this._requestUpdate(t,i)},configurable:!0,enumerable:!0})}static finalize(){const t=Object.getPrototypeOf(this);if(t.hasOwnProperty(tt)||t.finalize(),this[tt]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const t=this.properties,e=[...Object.getOwnPropertyNames(t),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]];for(const n of e)this.createProperty(n,t[n])}}static _attributeNameForProperty(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}static _valueHasChanged(t,e,n=B){return n(t,e)}static _propertyValueFromAttribute(t,e){const n=e.type,i=e.converter||q,s="function"==typeof i?i:i.fromAttribute;return s?s(t,n):t}static _propertyValueToAttribute(t,e){if(void 0===e.reflect)return;const n=e.type,i=e.converter;return(i&&i.toAttribute||q.toAttribute)(t,n)}initialize(){this._saveInstanceProperties(),this._requestUpdate()}_saveInstanceProperties(){this.constructor._classProperties.forEach((t,e)=>{if(this.hasOwnProperty(e)){const t=this[e];delete this[e],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(e,t)}})}_applyInstanceProperties(){this._instanceProperties.forEach((t,e)=>this[e]=t),this._instanceProperties=void 0}connectedCallback(){this._updateState=this._updateState|Q,this._hasConnectedResolver&&(this._hasConnectedResolver(),this._hasConnectedResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(t,e,n){e!==n&&this._attributeToProperty(t,n)}_propertyToAttribute(t,e,n=W){const i=this.constructor,s=i._attributeNameForProperty(t,n);if(void 0!==s){const t=i._propertyValueToAttribute(e,n);if(void 0===t)return;this._updateState=this._updateState|G,null==t?this.removeAttribute(s):this.setAttribute(s,t),this._updateState=this._updateState&~G}}_attributeToProperty(t,e){if(this._updateState&G)return;const n=this.constructor,i=n._attributeToPropertyMap.get(t);if(void 0!==i){const t=n._classProperties.get(i)||W;this._updateState=this._updateState|K,this[i]=n._propertyValueFromAttribute(e,t),this._updateState=this._updateState&~K}}_requestUpdate(t,e){let n=!0;if(void 0!==t){const i=this.constructor,s=i._classProperties.get(t)||W;i._valueHasChanged(this[t],e,s.hasChanged)?(this._changedProperties.has(t)||this._changedProperties.set(t,e),!0!==s.reflect||this._updateState&K||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(t,s))):n=!1}!this._hasRequestedUpdate&&n&&this._enqueueUpdate()}requestUpdate(t,e){return this._requestUpdate(t,e),this.updateComplete}async _enqueueUpdate(){let t,e;this._updateState=this._updateState|X;const n=this._updatePromise;this._updatePromise=new Promise((n,i)=>{t=n,e=i});try{await n}catch(t){}this._hasConnected||await new Promise(t=>this._hasConnectedResolver=t);try{const t=this.performUpdate();null!=t&&await t}catch(t){e(t)}t(!this._hasRequestedUpdate)}get _hasConnected(){return this._updateState&Q}get _hasRequestedUpdate(){return this._updateState&X}get hasUpdated(){return this._updateState&Z}performUpdate(){this._instanceProperties&&this._applyInstanceProperties();let t=!1;const e=this._changedProperties;try{(t=this.shouldUpdate(e))&&this.update(e)}catch(e){throw t=!1,e}finally{this._markUpdated()}t&&(this._updateState&Z||(this._updateState=this._updateState|Z,this.firstUpdated(e)),this.updated(e))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~X}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(t){return!0}update(t){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((t,e)=>this._propertyToAttribute(e,this[e],t)),this._reflectingProperties=void 0)}updated(t){}firstUpdated(t){}}et[tt]=!0;
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -1067,1080 +159,7 @@ const html = (strings, ...values) => new TemplateResult(strings, values, 'html',
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
-const walkerNodeFilter = 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */;
-/**
- * Removes the list of nodes from a Template safely. In addition to removing
- * nodes from the Template, the Template part indices are updated to match
- * the mutated Template DOM.
- *
- * As the template is walked the removal state is tracked and
- * part indices are adjusted as needed.
- *
- * div
- * div#1 (remove) <-- start removing (removing node is div#1)
- * div
- * div#2 (remove) <-- continue removing (removing node is still div#1)
- * div
- * div <-- stop removing since previous sibling is the removing node (div#1,
- * removed 4 nodes)
- */
-function removeNodesFromTemplate(template, nodesToRemove) {
- const { element: { content }, parts } = template;
- const walker = document.createTreeWalker(content, walkerNodeFilter, null, false);
- let partIndex = nextActiveIndexInTemplateParts(parts);
- let part = parts[partIndex];
- let nodeIndex = -1;
- let removeCount = 0;
- const nodesToRemoveInTemplate = [];
- let currentRemovingNode = null;
- while (walker.nextNode()) {
- nodeIndex++;
- const node = walker.currentNode;
- // End removal if stepped past the removing node
- if (node.previousSibling === currentRemovingNode) {
- currentRemovingNode = null;
- }
- // A node to remove was found in the template
- if (nodesToRemove.has(node)) {
- nodesToRemoveInTemplate.push(node);
- // Track node we're removing
- if (currentRemovingNode === null) {
- currentRemovingNode = node;
- }
- }
- // When removing, increment count by which to adjust subsequent part indices
- if (currentRemovingNode !== null) {
- removeCount++;
- }
- while (part !== undefined && part.index === nodeIndex) {
- // If part is in a removed node deactivate it by setting index to -1 or
- // adjust the index as needed.
- part.index = currentRemovingNode !== null ? -1 : part.index - removeCount;
- // go to the next active part.
- partIndex = nextActiveIndexInTemplateParts(parts, partIndex);
- part = parts[partIndex];
- }
- }
- nodesToRemoveInTemplate.forEach((n) => n.parentNode.removeChild(n));
-}
-const countNodes = (node) => {
- let count = (node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */) ? 0 : 1;
- const walker = document.createTreeWalker(node, walkerNodeFilter, null, false);
- while (walker.nextNode()) {
- count++;
- }
- return count;
-};
-const nextActiveIndexInTemplateParts = (parts, startIndex = -1) => {
- for (let i = startIndex + 1; i < parts.length; i++) {
- const part = parts[i];
- if (isTemplatePartActive(part)) {
- return i;
- }
- }
- return -1;
-};
-/**
- * Inserts the given node into the Template, optionally before the given
- * refNode. In addition to inserting the node into the Template, the Template
- * part indices are updated to match the mutated Template DOM.
- */
-function insertNodeIntoTemplate(template, node, refNode = null) {
- const { element: { content }, parts } = template;
- // If there's no refNode, then put node at end of template.
- // No part indices need to be shifted in this case.
- if (refNode === null || refNode === undefined) {
- content.appendChild(node);
- return;
- }
- const walker = document.createTreeWalker(content, walkerNodeFilter, null, false);
- let partIndex = nextActiveIndexInTemplateParts(parts);
- let insertCount = 0;
- let walkerIndex = -1;
- while (walker.nextNode()) {
- walkerIndex++;
- const walkerNode = walker.currentNode;
- if (walkerNode === refNode) {
- insertCount = countNodes(node);
- refNode.parentNode.insertBefore(node, refNode);
- }
- while (partIndex !== -1 && parts[partIndex].index === walkerIndex) {
- // If we've inserted the node, simply adjust all subsequent parts
- if (insertCount > 0) {
- while (partIndex !== -1) {
- parts[partIndex].index += insertCount;
- partIndex = nextActiveIndexInTemplateParts(parts, partIndex);
- }
- return;
- }
- partIndex = nextActiveIndexInTemplateParts(parts, partIndex);
- }
- }
-}
-
-/**
- * @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
- */
-// Get a key to lookup in `templateCaches`.
-const getTemplateCacheKey = (type, scopeName) => `${type}--${scopeName}`;
-let compatibleShadyCSSVersion = true;
-if (typeof window.ShadyCSS === 'undefined') {
- compatibleShadyCSSVersion = false;
-}
-else if (typeof window.ShadyCSS.prepareTemplateDom === 'undefined') {
- console.warn(`Incompatible ShadyCSS version detected.` +
- `Please update to at least @webcomponents/webcomponentsjs@2.0.2 and` +
- `@webcomponents/shadycss@1.3.1.`);
- compatibleShadyCSSVersion = false;
-}
-/**
- * Template factory which scopes template DOM using ShadyCSS.
- * @param scopeName {string}
- */
-const shadyTemplateFactory = (scopeName) => (result) => {
- const cacheKey = getTemplateCacheKey(result.type, scopeName);
- let templateCache = templateCaches.get(cacheKey);
- if (templateCache === undefined) {
- templateCache = {
- stringsArray: new WeakMap(),
- keyString: new Map()
- };
- templateCaches.set(cacheKey, templateCache);
- }
- let template = templateCache.stringsArray.get(result.strings);
- if (template !== undefined) {
- return template;
- }
- const key = result.strings.join(marker);
- template = templateCache.keyString.get(key);
- if (template === undefined) {
- const element = result.getTemplateElement();
- if (compatibleShadyCSSVersion) {
- window.ShadyCSS.prepareTemplateDom(element, scopeName);
- }
- template = new Template(result, element);
- templateCache.keyString.set(key, template);
- }
- templateCache.stringsArray.set(result.strings, template);
- return template;
-};
-const TEMPLATE_TYPES = ['html', 'svg'];
-/**
- * Removes all style elements from Templates for the given scopeName.
- */
-const removeStylesFromLitTemplates = (scopeName) => {
- TEMPLATE_TYPES.forEach((type) => {
- const templates = templateCaches.get(getTemplateCacheKey(type, scopeName));
- if (templates !== undefined) {
- templates.keyString.forEach((template) => {
- const { element: { content } } = template;
- // IE 11 doesn't support the iterable param Set constructor
- const styles = new Set();
- Array.from(content.querySelectorAll('style')).forEach((s) => {
- styles.add(s);
- });
- removeNodesFromTemplate(template, styles);
- });
- }
- });
-};
-const shadyRenderSet = new Set();
-/**
- * For the given scope name, ensures that ShadyCSS style scoping is performed.
- * This is done just once per scope name so the fragment and template cannot
- * be modified.
- * (1) extracts styles from the rendered fragment and hands them to ShadyCSS
- * to be scoped and appended to the document
- * (2) removes style elements from all lit-html Templates for this scope name.
- *
- * Note,