first commit

This commit is contained in:
becarta
2025-05-16 00:17:42 +02:00
parent ea5c866137
commit bacf566ec9
6020 changed files with 1715262 additions and 0 deletions

7
node_modules/@lit/reactive-element/node/css-tag.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),n=new WeakMap;class o{constructor(t,e,n){if(this._$cssResult$=!0,n!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const s=this.t;if(e&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=n.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n.set(s,t))}return t}toString(){return this.cssText}}const r=t=>new o("string"==typeof t?t:t+"",void 0,s),i=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,s,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[n+1]),t[0]);return new o(n,t,s)},S=(s,n)=>{e?s.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):n.forEach((e=>{const n=document.createElement("style"),o=t.litNonce;void 0!==o&&n.setAttribute("nonce",o),n.textContent=e.cssText,s.appendChild(n)}))},c=e||void 0===t.CSSStyleSheet?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r(e)})(t):t;export{o as CSSResult,S as adoptStyles,i as css,c as getCompatibleStyle,e as supportsAdoptingStyleSheets,r as unsafeCSS};
//# sourceMappingURL=css-tag.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
export{decorateProperty,legacyPrototypeMethod,standardPrototypeMethod}from"./decorators/base.js";export{customElement}from"./decorators/custom-element.js";export{property}from"./decorators/property.js";export{state}from"./decorators/state.js";export{eventOptions}from"./decorators/event-options.js";export{query}from"./decorators/query.js";export{queryAll}from"./decorators/query-all.js";export{queryAsync}from"./decorators/query-async.js";export{queryAssignedElements}from"./decorators/query-assigned-elements.js";export{queryAssignedNodes}from"./decorators/query-assigned-nodes.js";
//# sourceMappingURL=decorators.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"decorators.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}

View File

@@ -0,0 +1,7 @@
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const e=(e,t,o)=>{Object.defineProperty(t,o,e)},t=(e,t)=>({kind:"method",placement:"prototype",key:t.key,descriptor:e}),o=({finisher:e,descriptor:t})=>(o,n)=>{var r;if(void 0===n){const n=null!==(r=o.originalKey)&&void 0!==r?r:o.key,i=null!=t?{kind:"method",placement:"prototype",key:n,descriptor:t(o.key)}:{...o,key:n};return null!=e&&(i.finisher=function(t){e(t,n)}),i}{const r=o.constructor;void 0!==t&&Object.defineProperty(o,n,t(n)),null==e||e(r,n)}};export{o as decorateProperty,e as legacyPrototypeMethod,t as standardPrototypeMethod};
//# sourceMappingURL=base.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"base.js","sources":["../../src/decorators/base.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {ReactiveElement} from '../reactive-element.js';\n\n/**\n * Generates a public interface type that removes private and protected fields.\n * This allows accepting otherwise compatible versions of the type (e.g. from\n * multiple copies of the same package in `node_modules`).\n */\nexport type Interface<T> = {\n [K in keyof T]: T[K];\n};\n\nexport type Constructor<T> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n};\n\n// From the TC39 Decorators proposal\nexport interface ClassDescriptor {\n kind: 'class';\n elements: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => void | Constructor<T>;\n}\n\n// From the TC39 Decorators proposal\nexport interface ClassElement {\n kind: 'field' | 'method';\n key: PropertyKey;\n placement: 'static' | 'prototype' | 'own';\n initializer?: Function;\n extras?: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => void | Constructor<T>;\n descriptor?: PropertyDescriptor;\n}\n\nexport const legacyPrototypeMethod = (\n descriptor: PropertyDescriptor,\n proto: Object,\n name: PropertyKey\n) => {\n Object.defineProperty(proto, name, descriptor);\n};\n\nexport const standardPrototypeMethod = (\n descriptor: PropertyDescriptor,\n element: ClassElement\n) => ({\n kind: 'method',\n placement: 'prototype',\n key: element.key,\n descriptor,\n});\n\n/**\n * Helper for decorating a property that is compatible with both TypeScript\n * and Babel decorators. The optional `finisher` can be used to perform work on\n * the class. The optional `descriptor` should return a PropertyDescriptor\n * to install for the given property.\n *\n * @param finisher {function} Optional finisher method; receives the element\n * constructor and property key as arguments and has no return value.\n * @param descriptor {function} Optional descriptor method; receives the\n * property key as an argument and returns a property descriptor to define for\n * the given property.\n * @returns {ClassElement|void}\n */\nexport const decorateProperty =\n ({\n finisher,\n descriptor,\n }: {\n finisher?:\n | ((ctor: typeof ReactiveElement, property: PropertyKey) => void)\n | null;\n descriptor?: (property: PropertyKey) => PropertyDescriptor;\n }) =>\n (\n protoOrDescriptor: Interface<ReactiveElement> | ClassElement,\n name?: PropertyKey\n // Note TypeScript requires the return type to be `void|any`\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): void | any => {\n // TypeScript / Babel legacy mode\n if (name !== undefined) {\n const ctor = (protoOrDescriptor as ReactiveElement)\n .constructor as typeof ReactiveElement;\n if (descriptor !== undefined) {\n Object.defineProperty(protoOrDescriptor, name, descriptor(name));\n }\n finisher?.(ctor, name!);\n // Babel standard mode\n } else {\n // Note, the @property decorator saves `key` as `originalKey`\n // so try to use it here.\n const key =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (protoOrDescriptor as any).originalKey ??\n (protoOrDescriptor as ClassElement).key;\n const info: ClassElement =\n descriptor != undefined\n ? {\n kind: 'method',\n placement: 'prototype',\n key,\n descriptor: descriptor((protoOrDescriptor as ClassElement).key),\n }\n : {...(protoOrDescriptor as ClassElement), key};\n if (finisher != undefined) {\n info.finisher = function <ReactiveElement>(\n ctor: Constructor<ReactiveElement>\n ) {\n finisher(ctor as unknown as typeof ReactiveElement, key);\n };\n }\n return info;\n }\n };\n"],"names":["legacyPrototypeMethod","descriptor","proto","name","Object","defineProperty","standardPrototypeMethod","element","kind","placement","key","decorateProperty","finisher","protoOrDescriptor","undefined","_a","originalKey","info","ctor","constructor"],"mappings":";;;;;AAwCa,MAAAA,EAAwB,CACnCC,EACAC,EACAC,KAEAC,OAAOC,eAAeH,EAAOC,EAAMF,EAAW,EAGnCK,EAA0B,CACrCL,EACAM,KACI,CACJC,KAAM,SACNC,UAAW,YACXC,IAAKH,EAAQG,IACbT,eAgBWU,EACX,EACEC,WACAX,gBAOF,CACEY,EACAV,WAKA,QAAaW,IAATX,EAQG,CAGL,MAAMO,UAEJK,EAACF,EAA0BG,2BAC1BH,EAAmCH,IAChCO,EACUH,MAAdb,EACI,CACEO,KAAM,SACNC,UAAW,YACXC,MACAT,WAAYA,EAAYY,EAAmCH,MAE7D,IAAKG,EAAoCH,OAQ/C,OAPgBI,MAAZF,IACFK,EAAKL,SAAW,SACdM,GAEAN,EAASM,EAA2CR,EACtD,GAEKO,CACR,CAhCuB,CACtB,MAAMC,EAAQL,EACXM,iBACgBL,IAAfb,GACFG,OAAOC,eAAeQ,EAAmBV,EAAMF,EAAWE,IAE5DS,SAAAA,EAAWM,EAAMf,EAElB,CAwBA"}

View File

@@ -0,0 +1,7 @@
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const e=e=>n=>"function"==typeof n?((e,n)=>(customElements.define(e,n),n))(e,n):((e,n)=>{const{kind:t,elements:s}=n;return{kind:t,elements:s,finisher(n){customElements.define(e,n)}}})(e,n);export{e as customElement};
//# sourceMappingURL=custom-element.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"custom-element.js","sources":["../../src/decorators/custom-element.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\nimport {Constructor, ClassDescriptor} from './base.js';\n\n/**\n * Allow for custom element classes with private constructors\n */\ntype CustomElementClass = Omit<typeof HTMLElement, 'new'>;\n\nconst legacyCustomElement = (tagName: string, clazz: CustomElementClass) => {\n customElements.define(tagName, clazz as CustomElementConstructor);\n // Cast as any because TS doesn't recognize the return type as being a\n // subtype of the decorated class when clazz is typed as\n // `Constructor<HTMLElement>` for some reason.\n // `Constructor<HTMLElement>` is helpful to make sure the decorator is\n // applied to elements however.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return clazz as any;\n};\n\nconst standardCustomElement = (\n tagName: string,\n descriptor: ClassDescriptor\n) => {\n const {kind, elements} = descriptor;\n return {\n kind,\n elements,\n // This callback is called once the class is otherwise fully defined\n finisher(clazz: Constructor<HTMLElement>) {\n customElements.define(tagName, clazz);\n },\n };\n};\n\n/**\n * Class decorator factory that defines the decorated class as a custom element.\n *\n * ```js\n * @customElement('my-element')\n * class MyElement extends LitElement {\n * render() {\n * return html``;\n * }\n * }\n * ```\n * @category Decorator\n * @param tagName The tag name of the custom element to define.\n */\nexport const customElement =\n (tagName: string) =>\n (classOrDescriptor: CustomElementClass | ClassDescriptor) =>\n typeof classOrDescriptor === 'function'\n ? legacyCustomElement(tagName, classOrDescriptor)\n : standardCustomElement(tagName, classOrDescriptor as ClassDescriptor);\n"],"names":["customElement","tagName","classOrDescriptor","clazz","customElements","define","legacyCustomElement","descriptor","kind","elements","finisher","standardCustomElement"],"mappings":";;;;;AAmBA,MAwCaA,EACVC,GACAC,GAC8B,mBAAtBA,EA3CiB,EAACD,EAAiBE,KAC5CC,eAAeC,OAAOJ,EAASE,GAOxBA,GAoCDG,CAAoBL,EAASC,GAjCP,EAC5BD,EACAM,KAEA,MAAMC,KAACA,EAAIC,SAAEA,GAAYF,EACzB,MAAO,CACLC,OACAC,WAEAC,SAASP,GACPC,eAAeC,OAAOJ,EAASE,EAChC,EACF,EAsBKQ,CAAsBV,EAASC"}

View File

@@ -0,0 +1,7 @@
import{decorateProperty as r}from"./base.js";
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function e(e){return r({finisher:(r,t)=>{Object.assign(r.prototype[t],e)}})}export{e as eventOptions};
//# sourceMappingURL=event-options.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"event-options.js","sources":["../../src/decorators/event-options.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {ReactiveElement} from '../reactive-element.js';\nimport {decorateProperty} from './base.js';\n\n/**\n * Adds event listener options to a method used as an event listener in a\n * lit-html template.\n *\n * @param options An object that specifies event listener options as accepted by\n * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.\n *\n * Current browsers support the `capture`, `passive`, and `once` options. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters\n *\n * ```ts\n * class MyElement {\n * clicked = false;\n *\n * render() {\n * return html`\n * <div @click=${this._onClick}>\n * <button></button>\n * </div>\n * `;\n * }\n *\n * @eventOptions({capture: true})\n * _onClick(e) {\n * this.clicked = true;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function eventOptions(options: AddEventListenerOptions) {\n return decorateProperty({\n finisher: (ctor: typeof ReactiveElement, name: PropertyKey) => {\n Object.assign(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ctor.prototype[name as keyof ReactiveElement] as any,\n options\n );\n },\n });\n}\n"],"names":["eventOptions","options","decorateProperty","finisher","ctor","name","Object","assign","prototype"],"mappings":";;;;;GA8CM,SAAUA,EAAaC,GAC3B,OAAOC,EAAiB,CACtBC,SAAU,CAACC,EAA8BC,KACvCC,OAAOC,OAELH,EAAKI,UAAUH,GACfJ,EACD,GAGP"}

View File

@@ -0,0 +1,7 @@
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const i=(i,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(n){n.createProperty(e.key,i)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(n){n.createProperty(e.key,i)}},e=(i,e,n)=>{e.constructor.createProperty(n,i)};function n(n){return(t,o)=>void 0!==o?e(n,t,o):i(n,t)}export{n as property};
//# sourceMappingURL=property.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
import{decorateProperty as r}from"./base.js";
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function e(e){return r({descriptor:r=>({get(){var r,o;return null!==(o=null===(r=this.renderRoot)||void 0===r?void 0:r.querySelectorAll(e))&&void 0!==o?o:[]},enumerable:!0,configurable:!0})})}export{e as queryAll};
//# sourceMappingURL=query-all.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"query-all.js","sources":["../../src/decorators/query-all.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {ReactiveElement} from '../reactive-element.js';\nimport {decorateProperty} from './base.js';\n\n/**\n * A property decorator that converts a class property into a getter\n * that executes a querySelectorAll on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See:\n * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll\n *\n * ```ts\n * class MyElement {\n * @queryAll('div')\n * divs: NodeListOf<HTMLDivElement>;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAll(selector: string) {\n return decorateProperty({\n descriptor: (_name: PropertyKey) => ({\n get(this: ReactiveElement) {\n return this.renderRoot?.querySelectorAll(selector) ?? [];\n },\n enumerable: true,\n configurable: true,\n }),\n });\n}\n"],"names":["queryAll","selector","decorateProperty","descriptor","_name","get","_b","_a","this","renderRoot","querySelectorAll","enumerable","configurable"],"mappings":";;;;;GAwCM,SAAUA,EAASC,GACvB,OAAOC,EAAiB,CACtBC,WAAaC,IAAwB,CACnCC,cACE,OAAsD,QAA/CC,EAAe,QAAfC,EAAAC,KAAKC,kBAAU,IAAAF,OAAA,EAAAA,EAAEG,iBAAiBT,UAAa,IAAAK,EAAAA,EAAA,EACvD,EACDK,YAAY,EACZC,cAAc,KAGpB"}

View File

@@ -0,0 +1,7 @@
import{decorateProperty as o}from"./base.js";
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/var l;const n=null!=(null===(l=globalThis.HTMLSlotElement)||void 0===l?void 0:l.prototype.assignedElements)?(o,l)=>o.assignedElements(l):(o,l)=>o.assignedNodes(l).filter((o=>o.nodeType===Node.ELEMENT_NODE));function e(l){const{slot:e,selector:t}=null!=l?l:{};return o({descriptor:o=>({get(){var o;const r="slot"+(e?`[name=${e}]`:":not([name])"),s=null===(o=this.renderRoot)||void 0===o?void 0:o.querySelector(r),i=null!=s?n(s,l):[];return t?i.filter((o=>o.matches(t))):i},enumerable:!0,configurable:!0})})}export{e as queryAssignedElements};
//# sourceMappingURL=query-assigned-elements.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"query-assigned-elements.js","sources":["../../src/decorators/query-assigned-elements.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {decorateProperty} from './base.js';\n\nimport type {ReactiveElement} from '../reactive-element.js';\nimport type {QueryAssignedNodesOptions} from './query-assigned-nodes.js';\n\nconst NODE_MODE = false;\nconst global = NODE_MODE ? globalThis : window;\n\n/**\n * A tiny module scoped polyfill for HTMLSlotElement.assignedElements.\n */\nconst slotAssignedElements =\n global.HTMLSlotElement?.prototype.assignedElements != null\n ? (slot: HTMLSlotElement, opts?: AssignedNodesOptions) =>\n slot.assignedElements(opts)\n : (slot: HTMLSlotElement, opts?: AssignedNodesOptions) =>\n slot\n .assignedNodes(opts)\n .filter(\n (node): node is Element => node.nodeType === Node.ELEMENT_NODE\n );\n\n/**\n * Options for the {@linkcode queryAssignedElements} decorator. Extends the\n * options that can be passed into\n * [HTMLSlotElement.assignedElements](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedElements).\n */\nexport interface QueryAssignedElementsOptions\n extends QueryAssignedNodesOptions {\n /**\n * CSS selector used to filter the elements returned. For example, a selector\n * of `\".item\"` will only include elements with the `item` class.\n */\n selector?: string;\n}\n\n/**\n * A property decorator that converts a class property into a getter that\n * returns the `assignedElements` of the given `slot`. Provides a declarative\n * way to use\n * [`HTMLSlotElement.assignedElements`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedElements).\n *\n * Can be passed an optional {@linkcode QueryAssignedElementsOptions} object.\n *\n * Example usage:\n * ```ts\n * class MyElement {\n * @queryAssignedElements({ slot: 'list' })\n * listItems!: Array<HTMLElement>;\n * @queryAssignedElements()\n * unnamedSlotEls!: Array<HTMLElement>;\n *\n * render() {\n * return html`\n * <slot name=\"list\"></slot>\n * <slot></slot>\n * `;\n * }\n * }\n * ```\n *\n * Note, the type of this property should be annotated as `Array<HTMLElement>`.\n *\n * @category Decorator\n */\nexport function queryAssignedElements(options?: QueryAssignedElementsOptions) {\n const {slot, selector} = options ?? {};\n return decorateProperty({\n descriptor: (_name: PropertyKey) => ({\n get(this: ReactiveElement) {\n const slotSelector = `slot${slot ? `[name=${slot}]` : ':not([name])'}`;\n const slotEl =\n this.renderRoot?.querySelector<HTMLSlotElement>(slotSelector);\n const elements =\n slotEl != null ? slotAssignedElements(slotEl, options) : [];\n if (selector) {\n return elements.filter((node) => node.matches(selector));\n }\n return elements;\n },\n enumerable: true,\n configurable: true,\n }),\n });\n}\n"],"names":["slotAssignedElements","_a","globalThis","HTMLSlotElement","prototype","assignedElements","slot","opts","assignedNodes","filter","node","nodeType","Node","ELEMENT_NODE","queryAssignedElements","options","selector","decorateProperty","descriptor","_name","get","slotSelector","slotEl","this","renderRoot","querySelector","elements","matches","enumerable","configurable"],"mappings":";;;;;SAmBA,MAKMA,EACkD,OAAhC,QAAtBC,EANyBC,WAMlBC,uBAAe,IAAAF,OAAA,EAAAA,EAAEG,UAAUC,kBAC9B,CAACC,EAAuBC,IACtBD,EAAKD,iBAAiBE,GACxB,CAACD,EAAuBC,IACtBD,EACGE,cAAcD,GACdE,QACEC,GAA0BA,EAAKC,WAAaC,KAAKC,eA8CxD,SAAUC,EAAsBC,GACpC,MAAMT,KAACA,EAAIU,SAAEA,GAAYD,QAAAA,EAAW,GACpC,OAAOE,EAAiB,CACtBC,WAAaC,IAAwB,CACnCC,YACE,MAAMC,EAAe,QAAOf,EAAO,SAASA,KAAU,gBAChDgB,EACW,QAAfrB,EAAAsB,KAAKC,kBAAU,IAAAvB,OAAA,EAAAA,EAAEwB,cAA+BJ,GAC5CK,EACM,MAAVJ,EAAiBtB,EAAqBsB,EAAQP,GAAW,GAC3D,OAAIC,EACKU,EAASjB,QAAQC,GAASA,EAAKiB,QAAQX,KAEzCU,CACR,EACDE,YAAY,EACZC,cAAc,KAGpB"}

View File

@@ -0,0 +1,7 @@
import{decorateProperty as e}from"./base.js";import{queryAssignedElements as t}from"./query-assigned-elements.js";
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function o(o,n,r){let l,s=o;return"object"==typeof o?(s=o.slot,l=o):l={flatten:n},r?t({slot:s,flatten:n,selector:r}):e({descriptor:e=>({get(){var e,t;const o="slot"+(s?`[name=${s}]`:":not([name])"),n=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(o);return null!==(t=null==n?void 0:n.assignedNodes(l))&&void 0!==t?t:[]},enumerable:!0,configurable:!0})})}export{o as queryAssignedNodes};
//# sourceMappingURL=query-assigned-nodes.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
import{decorateProperty as r}from"./base.js";
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function e(e){return r({descriptor:r=>({async get(){var r;return await this.updateComplete,null===(r=this.renderRoot)||void 0===r?void 0:r.querySelector(e)},enumerable:!0,configurable:!0})})}export{e as queryAsync};
//# sourceMappingURL=query-async.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"query-async.js","sources":["../../src/decorators/query-async.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {ReactiveElement} from '../reactive-element.js';\nimport {decorateProperty} from './base.js';\n\n// Note, in the future, we may extend this decorator to support the use case\n// where the queried element may need to do work to become ready to interact\n// with (e.g. load some implementation code). If so, we might elect to\n// add a second argument defining a function that can be run to make the\n// queried element loaded/updated/ready.\n/**\n * A property decorator that converts a class property into a getter that\n * returns a promise that resolves to the result of a querySelector on the\n * element's renderRoot done after the element's `updateComplete` promise\n * resolves. When the queried property may change with element state, this\n * decorator can be used instead of requiring users to await the\n * `updateComplete` before accessing the property.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * ```ts\n * class MyElement {\n * @queryAsync('#first')\n * first: Promise<HTMLDivElement>;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n *\n * // external usage\n * async doSomethingWithFirst() {\n * (await aMyElement.first).doSomething();\n * }\n * ```\n * @category Decorator\n */\nexport function queryAsync(selector: string) {\n return decorateProperty({\n descriptor: (_name: PropertyKey) => ({\n async get(this: ReactiveElement) {\n await this.updateComplete;\n return this.renderRoot?.querySelector(selector);\n },\n enumerable: true,\n configurable: true,\n }),\n });\n}\n"],"names":["queryAsync","selector","decorateProperty","descriptor","_name","async","this","updateComplete","_a","renderRoot","querySelector","enumerable","configurable"],"mappings":";;;;;;AAqDM,SAAUA,EAAWC,GACzB,OAAOC,EAAiB,CACtBC,WAAaC,IAAwB,CACnCC,kBAEE,aADMC,KAAKC,uBACJC,EAAAF,KAAKG,iCAAYC,cAAcT,EACvC,EACDU,YAAY,EACZC,cAAc,KAGpB"}

View File

@@ -0,0 +1,7 @@
import{decorateProperty as o}from"./base.js";
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function i(i,n){return o({descriptor:o=>{const t={get(){var o,n;return null!==(n=null===(o=this.renderRoot)||void 0===o?void 0:o.querySelector(i))&&void 0!==n?n:null},enumerable:!0,configurable:!0};if(n){const n="symbol"==typeof o?Symbol():"__"+o;t.get=function(){var o,t;return void 0===this[n]&&(this[n]=null!==(t=null===(o=this.renderRoot)||void 0===o?void 0:o.querySelector(i))&&void 0!==t?t:null),this[n]}}return t}})}export{i as query};
//# sourceMappingURL=query.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"query.js","sources":["../../src/decorators/query.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {ReactiveElement} from '../reactive-element.js';\nimport {decorateProperty} from './base.js';\n\n/**\n * A property decorator that converts a class property into a getter that\n * executes a querySelector on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n * @param cache An optional boolean which when true performs the DOM query only\n * once and caches the result.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * ```ts\n * class MyElement {\n * @query('#first')\n * first: HTMLDivElement;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function query(selector: string, cache?: boolean) {\n return decorateProperty({\n descriptor: (name: PropertyKey) => {\n const descriptor = {\n get(this: ReactiveElement) {\n return this.renderRoot?.querySelector(selector) ?? null;\n },\n enumerable: true,\n configurable: true,\n };\n if (cache) {\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n descriptor.get = function (this: ReactiveElement) {\n if (\n (this as unknown as {[key: string]: Element | null})[\n key as string\n ] === undefined\n ) {\n (this as unknown as {[key: string]: Element | null})[\n key as string\n ] = this.renderRoot?.querySelector(selector) ?? null;\n }\n return (this as unknown as {[key: string]: Element | null})[\n key as string\n ];\n };\n }\n return descriptor;\n },\n });\n}\n"],"names":["query","selector","cache","decorateProperty","descriptor","name","get","_b","_a","this","renderRoot","querySelector","enumerable","configurable","key","Symbol","undefined"],"mappings":";;;;;GAyCgB,SAAAA,EAAMC,EAAkBC,GACtC,OAAOC,EAAiB,CACtBC,WAAaC,IACX,MAAMD,EAAa,CACjBE,cACE,OAAmD,QAA5CC,EAAe,QAAfC,EAAAC,KAAKC,kBAAU,IAAAF,OAAA,EAAAA,EAAEG,cAAcV,UAAa,IAAAM,EAAAA,EAAA,IACpD,EACDK,YAAY,EACZC,cAAc,GAEhB,GAAIX,EAAO,CACT,MAAMY,EAAsB,iBAATT,EAAoBU,SAAW,KAAKV,EACvDD,EAAWE,IAAM,mBAUf,YANQU,IAFLP,KACCK,KAGDL,KACCK,GAC0C,QAAxCP,EAAe,UAAfE,KAAKC,kBAAU,IAAAF,OAAA,EAAAA,EAAEG,cAAcV,UAAS,IAAAM,EAAAA,EAAI,MAE1CE,KACNK,EAEJ,CACD,CACD,OAAOV,CAAU,GAGvB"}

View File

@@ -0,0 +1,7 @@
import{property as r}from"./property.js";
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function t(t){return r({...t,state:!0})}export{t as state};
//# sourceMappingURL=state.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"state.js","sources":["../../src/decorators/state.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {property} from './property.js';\n\nexport interface InternalPropertyDeclaration<Type = unknown> {\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n}\n\n/**\n * Declares a private or protected reactive property that still triggers\n * updates to the element when it changes. It does not reflect from the\n * corresponding attribute.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they're solely for properties internal to the element. These\n * properties may be renamed by optimization tools like closure compiler.\n * @category Decorator\n */\nexport function state(options?: InternalPropertyDeclaration) {\n return property({\n ...options,\n state: true,\n });\n}\n"],"names":["state","options","property"],"mappings":";;;;;GAkCM,SAAUA,EAAMC,GACpB,OAAOC,EAAS,IACXD,EACHD,OAAO,GAEX"}

View File

@@ -0,0 +1,133 @@
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const global = globalThis ;
/**
* Whether the current browser supports `adoptedStyleSheets`.
*/
const supportsAdoptingStyleSheets = global.ShadowRoot &&
(global.ShadyCSS === undefined || global.ShadyCSS.nativeShadow) &&
'adoptedStyleSheets' in Document.prototype &&
'replace' in CSSStyleSheet.prototype;
const constructionToken = Symbol();
const cssTagCache = new WeakMap();
/**
* A container for a string of CSS text, that may be used to create a CSSStyleSheet.
*
* CSSResult is the return value of `css`-tagged template literals and
* `unsafeCSS()`. In order to ensure that CSSResults are only created via the
* `css` tag and `unsafeCSS()`, CSSResult cannot be constructed directly.
*/
class CSSResult {
constructor(cssText, strings, safeToken) {
// This property needs to remain unminified.
this['_$cssResult$'] = true;
if (safeToken !== constructionToken) {
throw new Error('CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');
}
this.cssText = cssText;
this._strings = strings;
}
// This is a getter so that it's lazy. In practice, this means stylesheets
// are not created until the first element instance is made.
get styleSheet() {
// If `supportsAdoptingStyleSheets` is true then we assume CSSStyleSheet is
// constructable.
let styleSheet = this._styleSheet;
const strings = this._strings;
if (supportsAdoptingStyleSheets && styleSheet === undefined) {
const cacheable = strings !== undefined && strings.length === 1;
if (cacheable) {
styleSheet = cssTagCache.get(strings);
}
if (styleSheet === undefined) {
(this._styleSheet = styleSheet = new CSSStyleSheet()).replaceSync(this.cssText);
if (cacheable) {
cssTagCache.set(strings, styleSheet);
}
}
}
return styleSheet;
}
toString() {
return this.cssText;
}
}
const textFromCSSResult = (value) => {
// This property needs to remain unminified.
if (value['_$cssResult$'] === true) {
return value.cssText;
}
else if (typeof value === 'number') {
return value;
}
else {
throw new Error(`Value passed to 'css' function must be a 'css' function result: ` +
`${value}. Use 'unsafeCSS' to pass non-literal values, but take care ` +
`to ensure page security.`);
}
};
/**
* Wrap a value for interpolation in a {@linkcode css} tagged template literal.
*
* This is unsafe because untrusted CSS text can be used to phone home
* or exfiltrate data to an attacker controlled site. Take care to only use
* this with trusted input.
*/
const unsafeCSS = (value) => new CSSResult(typeof value === 'string' ? value : String(value), undefined, constructionToken);
/**
* A template literal tag which can be used with LitElement's
* {@linkcode LitElement.styles} property to set element styles.
*
* For security reasons, only literal string values and number may be used in
* embedded expressions. To incorporate non-literal values {@linkcode unsafeCSS}
* may be used inside an expression.
*/
const css = (strings, ...values) => {
const cssText = strings.length === 1
? strings[0]
: values.reduce((acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1], strings[0]);
return new CSSResult(cssText, strings, constructionToken);
};
/**
* Applies the given styles to a `shadowRoot`. When Shadow DOM is
* available but `adoptedStyleSheets` is not, styles are appended to the
* `shadowRoot` to [mimic spec behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).
* Note, when shimming is used, any styles that are subsequently placed into
* the shadowRoot should be placed *before* any shimmed adopted styles. This
* will match spec behavior that gives adopted sheets precedence over styles in
* shadowRoot.
*/
const adoptStyles = (renderRoot, styles) => {
if (supportsAdoptingStyleSheets) {
renderRoot.adoptedStyleSheets = styles.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet);
}
else {
styles.forEach((s) => {
const style = document.createElement('style');
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const nonce = global['litNonce'];
if (nonce !== undefined) {
style.setAttribute('nonce', nonce);
}
style.textContent = s.cssText;
renderRoot.appendChild(style);
});
}
};
const cssResultFromStyleSheet = (sheet) => {
let cssText = '';
for (const rule of sheet.cssRules) {
cssText += rule.cssText;
}
return unsafeCSS(cssText);
};
const getCompatibleStyle = supportsAdoptingStyleSheets ||
(global.CSSStyleSheet === undefined)
? (s) => s
: (s) => s instanceof CSSStyleSheet ? cssResultFromStyleSheet(s) : s;
export { CSSResult, adoptStyles, css, getCompatibleStyle, supportsAdoptingStyleSheets, unsafeCSS };
//# sourceMappingURL=css-tag.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
export { decorateProperty, legacyPrototypeMethod, standardPrototypeMethod } from './decorators/base.js';
export { customElement } from './decorators/custom-element.js';
export { property } from './decorators/property.js';
export { state } from './decorators/state.js';
export { eventOptions } from './decorators/event-options.js';
export { query } from './decorators/query.js';
export { queryAll } from './decorators/query-all.js';
export { queryAsync } from './decorators/query-async.js';
export { queryAssignedElements } from './decorators/query-assigned-elements.js';
export { queryAssignedNodes } from './decorators/query-assigned-nodes.js';
//# sourceMappingURL=decorators.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"decorators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}

View File

@@ -0,0 +1,67 @@
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const legacyPrototypeMethod = (descriptor, proto, name) => {
Object.defineProperty(proto, name, descriptor);
};
const standardPrototypeMethod = (descriptor, element) => ({
kind: 'method',
placement: 'prototype',
key: element.key,
descriptor,
});
/**
* Helper for decorating a property that is compatible with both TypeScript
* and Babel decorators. The optional `finisher` can be used to perform work on
* the class. The optional `descriptor` should return a PropertyDescriptor
* to install for the given property.
*
* @param finisher {function} Optional finisher method; receives the element
* constructor and property key as arguments and has no return value.
* @param descriptor {function} Optional descriptor method; receives the
* property key as an argument and returns a property descriptor to define for
* the given property.
* @returns {ClassElement|void}
*/
const decorateProperty = ({ finisher, descriptor, }) => (protoOrDescriptor, name
// Note TypeScript requires the return type to be `void|any`
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) => {
var _a;
// TypeScript / Babel legacy mode
if (name !== undefined) {
const ctor = protoOrDescriptor
.constructor;
if (descriptor !== undefined) {
Object.defineProperty(protoOrDescriptor, name, descriptor(name));
}
finisher === null || finisher === void 0 ? void 0 : finisher(ctor, name);
// Babel standard mode
}
else {
// Note, the @property decorator saves `key` as `originalKey`
// so try to use it here.
const key =
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(_a = protoOrDescriptor.originalKey) !== null && _a !== void 0 ? _a : protoOrDescriptor.key;
const info = descriptor != undefined
? {
kind: 'method',
placement: 'prototype',
key,
descriptor: descriptor(protoOrDescriptor.key),
}
: { ...protoOrDescriptor, key };
if (finisher != undefined) {
info.finisher = function (ctor) {
finisher(ctor, key);
};
}
return info;
}
};
export { decorateProperty, legacyPrototypeMethod, standardPrototypeMethod };
//# sourceMappingURL=base.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,46 @@
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const legacyCustomElement = (tagName, clazz) => {
customElements.define(tagName, clazz);
// Cast as any because TS doesn't recognize the return type as being a
// subtype of the decorated class when clazz is typed as
// `Constructor<HTMLElement>` for some reason.
// `Constructor<HTMLElement>` is helpful to make sure the decorator is
// applied to elements however.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return clazz;
};
const standardCustomElement = (tagName, descriptor) => {
const { kind, elements } = descriptor;
return {
kind,
elements,
// This callback is called once the class is otherwise fully defined
finisher(clazz) {
customElements.define(tagName, clazz);
},
};
};
/**
* Class decorator factory that defines the decorated class as a custom element.
*
* ```js
* @customElement('my-element')
* class MyElement extends LitElement {
* render() {
* return html``;
* }
* }
* ```
* @category Decorator
* @param tagName The tag name of the custom element to define.
*/
const customElement = (tagName) => (classOrDescriptor) => typeof classOrDescriptor === 'function'
? legacyCustomElement(tagName, classOrDescriptor)
: standardCustomElement(tagName, classOrDescriptor);
export { customElement };
//# sourceMappingURL=custom-element.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"custom-element.js","sources":["../../../src/decorators/custom-element.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\nimport {Constructor, ClassDescriptor} from './base.js';\n\n/**\n * Allow for custom element classes with private constructors\n */\ntype CustomElementClass = Omit<typeof HTMLElement, 'new'>;\n\nconst legacyCustomElement = (tagName: string, clazz: CustomElementClass) => {\n customElements.define(tagName, clazz as CustomElementConstructor);\n // Cast as any because TS doesn't recognize the return type as being a\n // subtype of the decorated class when clazz is typed as\n // `Constructor<HTMLElement>` for some reason.\n // `Constructor<HTMLElement>` is helpful to make sure the decorator is\n // applied to elements however.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return clazz as any;\n};\n\nconst standardCustomElement = (\n tagName: string,\n descriptor: ClassDescriptor\n) => {\n const {kind, elements} = descriptor;\n return {\n kind,\n elements,\n // This callback is called once the class is otherwise fully defined\n finisher(clazz: Constructor<HTMLElement>) {\n customElements.define(tagName, clazz);\n },\n };\n};\n\n/**\n * Class decorator factory that defines the decorated class as a custom element.\n *\n * ```js\n * @customElement('my-element')\n * class MyElement extends LitElement {\n * render() {\n * return html``;\n * }\n * }\n * ```\n * @category Decorator\n * @param tagName The tag name of the custom element to define.\n */\nexport const customElement =\n (tagName: string) =>\n (classOrDescriptor: CustomElementClass | ClassDescriptor) =>\n typeof classOrDescriptor === 'function'\n ? legacyCustomElement(tagName, classOrDescriptor)\n : standardCustomElement(tagName, classOrDescriptor as ClassDescriptor);\n"],"names":[],"mappings":"AAAA;;;;AAIG;AAeH,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAE,KAAyB,KAAI;AACzE,IAAA,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,KAAiC,CAAC,CAAC;;;;;;;AAOlE,IAAA,OAAO,KAAY,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAC5B,OAAe,EACf,UAA2B,KACzB;AACF,IAAA,MAAM,EAAC,IAAI,EAAE,QAAQ,EAAC,GAAG,UAAU,CAAC;IACpC,OAAO;QACL,IAAI;QACJ,QAAQ;;AAER,QAAA,QAAQ,CAAC,KAA+B,EAAA;AACtC,YAAA,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SACvC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;;;;AAaG;AACU,MAAA,aAAa,GACxB,CAAC,OAAe,KAChB,CAAC,iBAAuD,KACtD,OAAO,iBAAiB,KAAK,UAAU;AACrC,MAAE,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,CAAC;AACjD,MAAE,qBAAqB,CAAC,OAAO,EAAE,iBAAoC;;;;"}

View File

@@ -0,0 +1,49 @@
import { decorateProperty } from './base.js';
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* Adds event listener options to a method used as an event listener in a
* lit-html template.
*
* @param options An object that specifies event listener options as accepted by
* `EventTarget#addEventListener` and `EventTarget#removeEventListener`.
*
* Current browsers support the `capture`, `passive`, and `once` options. See:
* https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters
*
* ```ts
* class MyElement {
* clicked = false;
*
* render() {
* return html`
* <div @click=${this._onClick}>
* <button></button>
* </div>
* `;
* }
*
* @eventOptions({capture: true})
* _onClick(e) {
* this.clicked = true;
* }
* }
* ```
* @category Decorator
*/
function eventOptions(options) {
return decorateProperty({
finisher: (ctor, name) => {
Object.assign(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
ctor.prototype[name], options);
},
});
}
export { eventOptions };
//# sourceMappingURL=event-options.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"event-options.js","sources":["../../../src/decorators/event-options.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {ReactiveElement} from '../reactive-element.js';\nimport {decorateProperty} from './base.js';\n\n/**\n * Adds event listener options to a method used as an event listener in a\n * lit-html template.\n *\n * @param options An object that specifies event listener options as accepted by\n * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.\n *\n * Current browsers support the `capture`, `passive`, and `once` options. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters\n *\n * ```ts\n * class MyElement {\n * clicked = false;\n *\n * render() {\n * return html`\n * <div @click=${this._onClick}>\n * <button></button>\n * </div>\n * `;\n * }\n *\n * @eventOptions({capture: true})\n * _onClick(e) {\n * this.clicked = true;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function eventOptions(options: AddEventListenerOptions) {\n return decorateProperty({\n finisher: (ctor: typeof ReactiveElement, name: PropertyKey) => {\n Object.assign(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ctor.prototype[name as keyof ReactiveElement] as any,\n options\n );\n },\n });\n}\n"],"names":[],"mappings":";;AAAA;;;;AAIG;AAYH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BG;AACG,SAAU,YAAY,CAAC,OAAgC,EAAA;AAC3D,IAAA,OAAO,gBAAgB,CAAC;AACtB,QAAA,QAAQ,EAAE,CAAC,IAA4B,EAAE,IAAiB,KAAI;AAC5D,YAAA,MAAM,CAAC,MAAM;;YAEX,IAAI,CAAC,SAAS,CAAC,IAA6B,CAAQ,EACpD,OAAO,CACR,CAAC;SACH;AACF,KAAA,CAAC,CAAC;AACL;;;;"}

View File

@@ -0,0 +1,94 @@
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const standardProperty = (options, element) => {
// When decorating an accessor, pass it through and add property metadata.
// Note, the `hasOwnProperty` check in `createProperty` ensures we don't
// stomp over the user's accessor.
if (element.kind === 'method' &&
element.descriptor &&
!('value' in element.descriptor)) {
return {
...element,
finisher(clazz) {
clazz.createProperty(element.key, options);
},
};
}
else {
// createProperty() takes care of defining the property, but we still
// must return some kind of descriptor, so return a descriptor for an
// unused prototype field. The finisher calls createProperty().
return {
kind: 'field',
key: Symbol(),
placement: 'own',
descriptor: {},
// store the original key so subsequent decorators have access to it.
originalKey: element.key,
// When @babel/plugin-proposal-decorators implements initializers,
// do this instead of the initializer below. See:
// https://github.com/babel/babel/issues/9260 extras: [
// {
// kind: 'initializer',
// placement: 'own',
// initializer: descriptor.initializer,
// }
// ],
initializer() {
if (typeof element.initializer === 'function') {
this[element.key] = element.initializer.call(this);
}
},
finisher(clazz) {
clazz.createProperty(element.key, options);
},
};
}
};
const legacyProperty = (options, proto, name) => {
proto.constructor.createProperty(name, options);
};
/**
* A property decorator which creates a reactive property that reflects a
* corresponding attribute value. When a decorated property is set
* the element will update and render. A {@linkcode PropertyDeclaration} may
* optionally be supplied to configure property features.
*
* This decorator should only be used for public fields. As public fields,
* properties should be considered as primarily settable by element users,
* either via attribute or the property itself.
*
* Generally, properties that are changed by the element should be private or
* protected fields and should use the {@linkcode state} decorator.
*
* However, sometimes element code does need to set a public property. This
* should typically only be done in response to user interaction, and an event
* should be fired informing the user; for example, a checkbox sets its
* `checked` property when clicked and fires a `changed` event. Mutating public
* properties should typically not be done for non-primitive (object or array)
* properties. In other cases when an element needs to manage state, a private
* property decorated via the {@linkcode state} decorator should be used. When
* needed, state properties can be initialized via public properties to
* facilitate complex interactions.
*
* ```ts
* class MyElement {
* @property({ type: Boolean })
* clicked = false;
* }
* ```
* @category Decorator
* @ExportDecoratedItems
*/
function property(options) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (protoOrDescriptor, name) => name !== undefined
? legacyProperty(options, protoOrDescriptor, name)
: standardProperty(options, protoOrDescriptor);
}
export { property };
//# sourceMappingURL=property.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,46 @@
import { decorateProperty } from './base.js';
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* A property decorator that converts a class property into a getter
* that executes a querySelectorAll on the element's renderRoot.
*
* @param selector A DOMString containing one or more selectors to match.
*
* See:
* https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll
*
* ```ts
* class MyElement {
* @queryAll('div')
* divs: NodeListOf<HTMLDivElement>;
*
* render() {
* return html`
* <div id="first"></div>
* <div id="second"></div>
* `;
* }
* }
* ```
* @category Decorator
*/
function queryAll(selector) {
return decorateProperty({
descriptor: (_name) => ({
get() {
var _a, _b;
return (_b = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(selector)) !== null && _b !== void 0 ? _b : [];
},
enumerable: true,
configurable: true,
}),
});
}
export { queryAll };
//# sourceMappingURL=query-all.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"query-all.js","sources":["../../../src/decorators/query-all.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {ReactiveElement} from '../reactive-element.js';\nimport {decorateProperty} from './base.js';\n\n/**\n * A property decorator that converts a class property into a getter\n * that executes a querySelectorAll on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See:\n * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll\n *\n * ```ts\n * class MyElement {\n * @queryAll('div')\n * divs: NodeListOf<HTMLDivElement>;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAll(selector: string) {\n return decorateProperty({\n descriptor: (_name: PropertyKey) => ({\n get(this: ReactiveElement) {\n return this.renderRoot?.querySelectorAll(selector) ?? [];\n },\n enumerable: true,\n configurable: true,\n }),\n });\n}\n"],"names":[],"mappings":";;AAAA;;;;AAIG;AAYH;;;;;;;;;;;;;;;;;;;;;;;AAuBG;AACG,SAAU,QAAQ,CAAC,QAAgB,EAAA;AACvC,IAAA,OAAO,gBAAgB,CAAC;AACtB,QAAA,UAAU,EAAE,CAAC,KAAkB,MAAM;YACnC,GAAG,GAAA;;AACD,gBAAA,OAAO,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAI,CAAC,UAAU,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,gBAAgB,CAAC,QAAQ,CAAC,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,EAAE,CAAC;aAC1D;AACD,YAAA,UAAU,EAAE,IAAI;AAChB,YAAA,YAAY,EAAE,IAAI;SACnB,CAAC;AACH,KAAA,CAAC,CAAC;AACL;;;;"}

View File

@@ -0,0 +1,68 @@
import { decorateProperty } from './base.js';
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var _a;
const global = globalThis ;
/**
* A tiny module scoped polyfill for HTMLSlotElement.assignedElements.
*/
const slotAssignedElements = ((_a = global.HTMLSlotElement) === null || _a === void 0 ? void 0 : _a.prototype.assignedElements) != null
? (slot, opts) => slot.assignedElements(opts)
: (slot, opts) => slot
.assignedNodes(opts)
.filter((node) => node.nodeType === Node.ELEMENT_NODE);
/**
* A property decorator that converts a class property into a getter that
* returns the `assignedElements` of the given `slot`. Provides a declarative
* way to use
* [`HTMLSlotElement.assignedElements`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedElements).
*
* Can be passed an optional {@linkcode QueryAssignedElementsOptions} object.
*
* Example usage:
* ```ts
* class MyElement {
* @queryAssignedElements({ slot: 'list' })
* listItems!: Array<HTMLElement>;
* @queryAssignedElements()
* unnamedSlotEls!: Array<HTMLElement>;
*
* render() {
* return html`
* <slot name="list"></slot>
* <slot></slot>
* `;
* }
* }
* ```
*
* Note, the type of this property should be annotated as `Array<HTMLElement>`.
*
* @category Decorator
*/
function queryAssignedElements(options) {
const { slot, selector } = options !== null && options !== void 0 ? options : {};
return decorateProperty({
descriptor: (_name) => ({
get() {
var _a;
const slotSelector = `slot${slot ? `[name=${slot}]` : ':not([name])'}`;
const slotEl = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(slotSelector);
const elements = slotEl != null ? slotAssignedElements(slotEl, options) : [];
if (selector) {
return elements.filter((node) => node.matches(selector));
}
return elements;
},
enumerable: true,
configurable: true,
}),
});
}
export { queryAssignedElements };
//# sourceMappingURL=query-assigned-elements.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"query-assigned-elements.js","sources":["../../../src/decorators/query-assigned-elements.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {decorateProperty} from './base.js';\n\nimport type {ReactiveElement} from '../reactive-element.js';\nimport type {QueryAssignedNodesOptions} from './query-assigned-nodes.js';\n\nconst NODE_MODE = false;\nconst global = NODE_MODE ? globalThis : window;\n\n/**\n * A tiny module scoped polyfill for HTMLSlotElement.assignedElements.\n */\nconst slotAssignedElements =\n global.HTMLSlotElement?.prototype.assignedElements != null\n ? (slot: HTMLSlotElement, opts?: AssignedNodesOptions) =>\n slot.assignedElements(opts)\n : (slot: HTMLSlotElement, opts?: AssignedNodesOptions) =>\n slot\n .assignedNodes(opts)\n .filter(\n (node): node is Element => node.nodeType === Node.ELEMENT_NODE\n );\n\n/**\n * Options for the {@linkcode queryAssignedElements} decorator. Extends the\n * options that can be passed into\n * [HTMLSlotElement.assignedElements](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedElements).\n */\nexport interface QueryAssignedElementsOptions\n extends QueryAssignedNodesOptions {\n /**\n * CSS selector used to filter the elements returned. For example, a selector\n * of `\".item\"` will only include elements with the `item` class.\n */\n selector?: string;\n}\n\n/**\n * A property decorator that converts a class property into a getter that\n * returns the `assignedElements` of the given `slot`. Provides a declarative\n * way to use\n * [`HTMLSlotElement.assignedElements`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedElements).\n *\n * Can be passed an optional {@linkcode QueryAssignedElementsOptions} object.\n *\n * Example usage:\n * ```ts\n * class MyElement {\n * @queryAssignedElements({ slot: 'list' })\n * listItems!: Array<HTMLElement>;\n * @queryAssignedElements()\n * unnamedSlotEls!: Array<HTMLElement>;\n *\n * render() {\n * return html`\n * <slot name=\"list\"></slot>\n * <slot></slot>\n * `;\n * }\n * }\n * ```\n *\n * Note, the type of this property should be annotated as `Array<HTMLElement>`.\n *\n * @category Decorator\n */\nexport function queryAssignedElements(options?: QueryAssignedElementsOptions) {\n const {slot, selector} = options ?? {};\n return decorateProperty({\n descriptor: (_name: PropertyKey) => ({\n get(this: ReactiveElement) {\n const slotSelector = `slot${slot ? `[name=${slot}]` : ':not([name])'}`;\n const slotEl =\n this.renderRoot?.querySelector<HTMLSlotElement>(slotSelector);\n const elements =\n slotEl != null ? slotAssignedElements(slotEl, options) : [];\n if (selector) {\n return elements.filter((node) => node.matches(selector));\n }\n return elements;\n },\n enumerable: true,\n configurable: true,\n }),\n });\n}\n"],"names":[],"mappings":";;AAAA;;;;AAIG;;AAeH,MAAM,MAAM,GAAe,UAAU,CAAS,CAAC;AAE/C;;AAEG;AACH,MAAM,oBAAoB,GACxB,CAAA,CAAA,EAAA,GAAA,MAAM,CAAC,eAAe,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,SAAS,CAAC,gBAAgB,KAAI,IAAI;AACxD,MAAE,CAAC,IAAqB,EAAE,IAA2B,KACjD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;MAC7B,CAAC,IAAqB,EAAE,IAA2B,KACjD,IAAI;SACD,aAAa,CAAC,IAAI,CAAC;AACnB,SAAA,MAAM,CACL,CAAC,IAAI,KAAsB,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY,CAC/D,CAAC;AAgBZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACG,SAAU,qBAAqB,CAAC,OAAsC,EAAA;AAC1E,IAAA,MAAM,EAAC,IAAI,EAAE,QAAQ,EAAC,GAAG,OAAO,KAAA,IAAA,IAAP,OAAO,KAAA,KAAA,CAAA,GAAP,OAAO,GAAI,EAAE,CAAC;AACvC,IAAA,OAAO,gBAAgB,CAAC;AACtB,QAAA,UAAU,EAAE,CAAC,KAAkB,MAAM;YACnC,GAAG,GAAA;;AACD,gBAAA,MAAM,YAAY,GAAG,CAAO,IAAA,EAAA,IAAI,GAAG,CAAS,MAAA,EAAA,IAAI,GAAG,GAAG,cAAc,EAAE,CAAC;gBACvE,MAAM,MAAM,GACV,CAAA,EAAA,GAAA,IAAI,CAAC,UAAU,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,aAAa,CAAkB,YAAY,CAAC,CAAC;AAChE,gBAAA,MAAM,QAAQ,GACZ,MAAM,IAAI,IAAI,GAAG,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;AAC9D,gBAAA,IAAI,QAAQ,EAAE;AACZ,oBAAA,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC1D,iBAAA;AACD,gBAAA,OAAO,QAAQ,CAAC;aACjB;AACD,YAAA,UAAU,EAAE,IAAI;AAChB,YAAA,YAAY,EAAE,IAAI;SACnB,CAAC;AACH,KAAA,CAAC,CAAC;AACL;;;;"}

View File

@@ -0,0 +1,44 @@
import { decorateProperty } from './base.js';
import { queryAssignedElements } from './query-assigned-elements.js';
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function queryAssignedNodes(slotOrOptions, flatten, selector) {
// Normalize the overloaded arguments.
let slot = slotOrOptions;
let assignedNodesOptions;
if (typeof slotOrOptions === 'object') {
slot = slotOrOptions.slot;
assignedNodesOptions = slotOrOptions;
}
else {
assignedNodesOptions = { flatten };
}
// For backwards compatibility, queryAssignedNodes with a selector behaves
// exactly like queryAssignedElements with a selector.
if (selector) {
return queryAssignedElements({
slot: slot,
flatten,
selector,
});
}
return decorateProperty({
descriptor: (_name) => ({
get() {
var _a, _b;
const slotSelector = `slot${slot ? `[name=${slot}]` : ':not([name])'}`;
const slotEl = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(slotSelector);
return (_b = slotEl === null || slotEl === void 0 ? void 0 : slotEl.assignedNodes(assignedNodesOptions)) !== null && _b !== void 0 ? _b : [];
},
enumerable: true,
configurable: true,
}),
});
}
export { queryAssignedNodes };
//# sourceMappingURL=query-assigned-nodes.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,60 @@
import { decorateProperty } from './base.js';
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
// Note, in the future, we may extend this decorator to support the use case
// where the queried element may need to do work to become ready to interact
// with (e.g. load some implementation code). If so, we might elect to
// add a second argument defining a function that can be run to make the
// queried element loaded/updated/ready.
/**
* A property decorator that converts a class property into a getter that
* returns a promise that resolves to the result of a querySelector on the
* element's renderRoot done after the element's `updateComplete` promise
* resolves. When the queried property may change with element state, this
* decorator can be used instead of requiring users to await the
* `updateComplete` before accessing the property.
*
* @param selector A DOMString containing one or more selectors to match.
*
* See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
*
* ```ts
* class MyElement {
* @queryAsync('#first')
* first: Promise<HTMLDivElement>;
*
* render() {
* return html`
* <div id="first"></div>
* <div id="second"></div>
* `;
* }
* }
*
* // external usage
* async doSomethingWithFirst() {
* (await aMyElement.first).doSomething();
* }
* ```
* @category Decorator
*/
function queryAsync(selector) {
return decorateProperty({
descriptor: (_name) => ({
async get() {
var _a;
await this.updateComplete;
return (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(selector);
},
enumerable: true,
configurable: true,
}),
});
}
export { queryAsync };
//# sourceMappingURL=query-async.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"query-async.js","sources":["../../../src/decorators/query-async.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {ReactiveElement} from '../reactive-element.js';\nimport {decorateProperty} from './base.js';\n\n// Note, in the future, we may extend this decorator to support the use case\n// where the queried element may need to do work to become ready to interact\n// with (e.g. load some implementation code). If so, we might elect to\n// add a second argument defining a function that can be run to make the\n// queried element loaded/updated/ready.\n/**\n * A property decorator that converts a class property into a getter that\n * returns a promise that resolves to the result of a querySelector on the\n * element's renderRoot done after the element's `updateComplete` promise\n * resolves. When the queried property may change with element state, this\n * decorator can be used instead of requiring users to await the\n * `updateComplete` before accessing the property.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * ```ts\n * class MyElement {\n * @queryAsync('#first')\n * first: Promise<HTMLDivElement>;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n *\n * // external usage\n * async doSomethingWithFirst() {\n * (await aMyElement.first).doSomething();\n * }\n * ```\n * @category Decorator\n */\nexport function queryAsync(selector: string) {\n return decorateProperty({\n descriptor: (_name: PropertyKey) => ({\n async get(this: ReactiveElement) {\n await this.updateComplete;\n return this.renderRoot?.querySelector(selector);\n },\n enumerable: true,\n configurable: true,\n }),\n });\n}\n"],"names":[],"mappings":";;AAAA;;;;AAIG;AAYH;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;AACG,SAAU,UAAU,CAAC,QAAgB,EAAA;AACzC,IAAA,OAAO,gBAAgB,CAAC;AACtB,QAAA,UAAU,EAAE,CAAC,KAAkB,MAAM;AACnC,YAAA,MAAM,GAAG,GAAA;;gBACP,MAAM,IAAI,CAAC,cAAc,CAAC;gBAC1B,OAAO,CAAA,EAAA,GAAA,IAAI,CAAC,UAAU,0CAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;aACjD;AACD,YAAA,UAAU,EAAE,IAAI;AAChB,YAAA,YAAY,EAAE,IAAI;SACnB,CAAC;AACH,KAAA,CAAC,CAAC;AACL;;;;"}

View File

@@ -0,0 +1,60 @@
import { decorateProperty } from './base.js';
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* A property decorator that converts a class property into a getter that
* executes a querySelector on the element's renderRoot.
*
* @param selector A DOMString containing one or more selectors to match.
* @param cache An optional boolean which when true performs the DOM query only
* once and caches the result.
*
* See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
*
* ```ts
* class MyElement {
* @query('#first')
* first: HTMLDivElement;
*
* render() {
* return html`
* <div id="first"></div>
* <div id="second"></div>
* `;
* }
* }
* ```
* @category Decorator
*/
function query(selector, cache) {
return decorateProperty({
descriptor: (name) => {
const descriptor = {
get() {
var _a, _b;
return (_b = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(selector)) !== null && _b !== void 0 ? _b : null;
},
enumerable: true,
configurable: true,
};
if (cache) {
const key = typeof name === 'symbol' ? Symbol() : `__${name}`;
descriptor.get = function () {
var _a, _b;
if (this[key] === undefined) {
this[key] = (_b = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(selector)) !== null && _b !== void 0 ? _b : null;
}
return this[key];
};
}
return descriptor;
},
});
}
export { query };
//# sourceMappingURL=query.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"query.js","sources":["../../../src/decorators/query.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {ReactiveElement} from '../reactive-element.js';\nimport {decorateProperty} from './base.js';\n\n/**\n * A property decorator that converts a class property into a getter that\n * executes a querySelector on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n * @param cache An optional boolean which when true performs the DOM query only\n * once and caches the result.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * ```ts\n * class MyElement {\n * @query('#first')\n * first: HTMLDivElement;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function query(selector: string, cache?: boolean) {\n return decorateProperty({\n descriptor: (name: PropertyKey) => {\n const descriptor = {\n get(this: ReactiveElement) {\n return this.renderRoot?.querySelector(selector) ?? null;\n },\n enumerable: true,\n configurable: true,\n };\n if (cache) {\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n descriptor.get = function (this: ReactiveElement) {\n if (\n (this as unknown as {[key: string]: Element | null})[\n key as string\n ] === undefined\n ) {\n (this as unknown as {[key: string]: Element | null})[\n key as string\n ] = this.renderRoot?.querySelector(selector) ?? null;\n }\n return (this as unknown as {[key: string]: Element | null})[\n key as string\n ];\n };\n }\n return descriptor;\n },\n });\n}\n"],"names":[],"mappings":";;AAAA;;;;AAIG;AAYH;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;AACa,SAAA,KAAK,CAAC,QAAgB,EAAE,KAAe,EAAA;AACrD,IAAA,OAAO,gBAAgB,CAAC;AACtB,QAAA,UAAU,EAAE,CAAC,IAAiB,KAAI;AAChC,YAAA,MAAM,UAAU,GAAG;gBACjB,GAAG,GAAA;;AACD,oBAAA,OAAO,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAI,CAAC,UAAU,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,aAAa,CAAC,QAAQ,CAAC,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,IAAI,CAAC;iBACzD;AACD,gBAAA,UAAU,EAAE,IAAI;AAChB,gBAAA,YAAY,EAAE,IAAI;aACnB,CAAC;AACF,YAAA,IAAI,KAAK,EAAE;AACT,gBAAA,MAAM,GAAG,GAAG,OAAO,IAAI,KAAK,QAAQ,GAAG,MAAM,EAAE,GAAG,CAAK,EAAA,EAAA,IAAI,EAAE,CAAC;gBAC9D,UAAU,CAAC,GAAG,GAAG,YAAA;;AACf,oBAAA,IACG,IAAmD,CAClD,GAAa,CACd,KAAK,SAAS,EACf;AACC,wBAAA,IAAmD,CAClD,GAAa,CACd,GAAG,CAAA,EAAA,GAAA,MAAA,IAAI,CAAC,UAAU,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,aAAa,CAAC,QAAQ,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,IAAI,CAAC;AACtD,qBAAA;AACD,oBAAA,OAAQ,IAAmD,CACzD,GAAa,CACd,CAAC;AACJ,iBAAC,CAAC;AACH,aAAA;AACD,YAAA,OAAO,UAAU,CAAC;SACnB;AACF,KAAA,CAAC,CAAC;AACL;;;;"}

View File

@@ -0,0 +1,26 @@
import { property } from './property.js';
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* Declares a private or protected reactive property that still triggers
* updates to the element when it changes. It does not reflect from the
* corresponding attribute.
*
* Properties declared this way must not be used from HTML or HTML templating
* systems, they're solely for properties internal to the element. These
* properties may be renamed by optimization tools like closure compiler.
* @category Decorator
*/
function state(options) {
return property({
...options,
state: true,
});
}
export { state };
//# sourceMappingURL=state.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"state.js","sources":["../../../src/decorators/state.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {property} from './property.js';\n\nexport interface InternalPropertyDeclaration<Type = unknown> {\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n}\n\n/**\n * Declares a private or protected reactive property that still triggers\n * updates to the element when it changes. It does not reflect from the\n * corresponding attribute.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they're solely for properties internal to the element. These\n * properties may be renamed by optimization tools like closure compiler.\n * @category Decorator\n */\nexport function state(options?: InternalPropertyDeclaration) {\n return property({\n ...options,\n state: true,\n });\n}\n"],"names":[],"mappings":";;AAAA;;;;AAIG;AAoBH;;;;;;;;;AASG;AACG,SAAU,KAAK,CAAC,OAAqC,EAAA;AACzD,IAAA,OAAO,QAAQ,CAAC;AACd,QAAA,GAAG,OAAO;AACV,QAAA,KAAK,EAAE,IAAI;AACZ,KAAA,CAAC,CAAC;AACL;;;;"}

View File

@@ -0,0 +1,2 @@
//# sourceMappingURL=reactive-controller.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"reactive-controller.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
//# sourceMappingURL=reactive-controller.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"reactive-controller.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long