first commit
This commit is contained in:
28
node_modules/lit-html/LICENSE
generated
vendored
Normal file
28
node_modules/lit-html/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2017 Google LLC. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
58
node_modules/lit-html/README.md
generated
vendored
Normal file
58
node_modules/lit-html/README.md
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
# lit-html 2.0
|
||||
|
||||
Efficient, Expressive, Extensible HTML templates in JavaScript
|
||||
|
||||
[](https://github.com/lit/lit/actions?query=workflow%3ATests)
|
||||
[](https://www.npmjs.com/package/lit-html)
|
||||
[](https://lit.dev/discord/)
|
||||
[](https://github.com/web-padawan/awesome-lit)
|
||||
|
||||
lit-html is the template system that powers the [Lit](https://lit.dev) library for building fast web components. When using `lit-html` to develop web components, most users should import lit-html via the [`lit`](https://www.npmjs.com/package/lit) package rather than installing and importing from `lit-html` directly.
|
||||
|
||||
## About this release
|
||||
|
||||
This is a stable release of `lit-html` 2.0 (part of the Lit 2.0 release). If upgrading from previous versions of `lit-html`, please note the minor breaking changes from lit-html 1.0 in the [Upgrade Guide](https://lit.dev/docs/releases/upgrade/).
|
||||
|
||||
## Documentation
|
||||
|
||||
Full documentation is available at [lit.dev](https://lit.dev).
|
||||
|
||||
## Overview
|
||||
|
||||
`lit-html` lets you write [HTML templates](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template) in JavaScript with [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals).
|
||||
|
||||
lit-html templates are plain JavaScript and combine the familiarity of writing HTML with the power of JavaScript. lit-html takes care of efficiently rendering templates to DOM, including efficiently updating the DOM with new values.
|
||||
|
||||
```javascript
|
||||
import {html, render} from 'lit-html';
|
||||
|
||||
// This is a lit-html template function. It returns a lit-html template.
|
||||
const helloTemplate = (name) => html`<div>Hello ${name}!</div>`;
|
||||
|
||||
// This renders <div>Hello Steve!</div> to the document body
|
||||
render(helloTemplate('Steve'), document.body);
|
||||
|
||||
// This updates to <div>Hello Kevin!</div>, but only updates the ${name} part
|
||||
render(helloTemplate('Kevin'), document.body);
|
||||
```
|
||||
|
||||
`lit-html` provides two main exports:
|
||||
|
||||
- `html`: A JavaScript [template tag](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals) used to produce a `TemplateResult`, which is a container for a template, and the values that should populate the template.
|
||||
- `render()`: A function that renders a `TemplateResult` to a DOM container, such as an element or shadow root.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install lit-html
|
||||
```
|
||||
|
||||
Or use from `lit`:
|
||||
|
||||
```bash
|
||||
$ npm install lit
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Please see [CONTRIBUTING.md](../../CONTRIBUTING.md).
|
171
node_modules/lit-html/async-directive.d.ts
generated
vendored
Normal file
171
node_modules/lit-html/async-directive.d.ts
generated
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
/**
|
||||
* Overview:
|
||||
*
|
||||
* This module is designed to add support for an async `setValue` API and
|
||||
* `disconnected` callback to directives with the least impact on the core
|
||||
* runtime or payload when that feature is not used.
|
||||
*
|
||||
* The strategy is to introduce a `AsyncDirective` subclass of
|
||||
* `Directive` that climbs the "parent" tree in its constructor to note which
|
||||
* branches of lit-html's "logical tree" of data structures contain such
|
||||
* directives and thus need to be crawled when a subtree is being cleared (or
|
||||
* manually disconnected) in order to run the `disconnected` callback.
|
||||
*
|
||||
* The "nodes" of the logical tree include Parts, TemplateInstances (for when a
|
||||
* TemplateResult is committed to a value of a ChildPart), and Directives; these
|
||||
* all implement a common interface called `DisconnectableChild`. Each has a
|
||||
* `_$parent` reference which is set during construction in the core code, and a
|
||||
* `_$disconnectableChildren` field which is initially undefined.
|
||||
*
|
||||
* The sparse tree created by means of the `AsyncDirective` constructor
|
||||
* crawling up the `_$parent` tree and placing a `_$disconnectableChildren` Set
|
||||
* on each parent that includes each child that contains a
|
||||
* `AsyncDirective` directly or transitively via its children. In order to
|
||||
* notify connection state changes and disconnect (or reconnect) a tree, the
|
||||
* `_$notifyConnectionChanged` API is patched onto ChildParts as a directive
|
||||
* climbs the parent tree, which is called by the core when clearing a part if
|
||||
* it exists. When called, that method iterates over the sparse tree of
|
||||
* Set<DisconnectableChildren> built up by AsyncDirectives, and calls
|
||||
* `_$notifyDirectiveConnectionChanged` on any directives that are encountered
|
||||
* in that tree, running the required callbacks.
|
||||
*
|
||||
* A given "logical tree" of lit-html data-structures might look like this:
|
||||
*
|
||||
* ChildPart(N1) _$dC=[D2,T3]
|
||||
* ._directive
|
||||
* AsyncDirective(D2)
|
||||
* ._value // user value was TemplateResult
|
||||
* TemplateInstance(T3) _$dC=[A4,A6,N10,N12]
|
||||
* ._$parts[]
|
||||
* AttributePart(A4) _$dC=[D5]
|
||||
* ._directives[]
|
||||
* AsyncDirective(D5)
|
||||
* AttributePart(A6) _$dC=[D7,D8]
|
||||
* ._directives[]
|
||||
* AsyncDirective(D7)
|
||||
* Directive(D8) _$dC=[D9]
|
||||
* ._directive
|
||||
* AsyncDirective(D9)
|
||||
* ChildPart(N10) _$dC=[D11]
|
||||
* ._directive
|
||||
* AsyncDirective(D11)
|
||||
* ._value
|
||||
* string
|
||||
* ChildPart(N12) _$dC=[D13,N14,N16]
|
||||
* ._directive
|
||||
* AsyncDirective(D13)
|
||||
* ._value // user value was iterable
|
||||
* Array<ChildPart>
|
||||
* ChildPart(N14) _$dC=[D15]
|
||||
* ._value
|
||||
* string
|
||||
* ChildPart(N16) _$dC=[D17,T18]
|
||||
* ._directive
|
||||
* AsyncDirective(D17)
|
||||
* ._value // user value was TemplateResult
|
||||
* TemplateInstance(T18) _$dC=[A19,A21,N25]
|
||||
* ._$parts[]
|
||||
* AttributePart(A19) _$dC=[D20]
|
||||
* ._directives[]
|
||||
* AsyncDirective(D20)
|
||||
* AttributePart(A21) _$dC=[22,23]
|
||||
* ._directives[]
|
||||
* AsyncDirective(D22)
|
||||
* Directive(D23) _$dC=[D24]
|
||||
* ._directive
|
||||
* AsyncDirective(D24)
|
||||
* ChildPart(N25) _$dC=[D26]
|
||||
* ._directive
|
||||
* AsyncDirective(D26)
|
||||
* ._value
|
||||
* string
|
||||
*
|
||||
* Example 1: The directive in ChildPart(N12) updates and returns `nothing`. The
|
||||
* ChildPart will _clear() itself, and so we need to disconnect the "value" of
|
||||
* the ChildPart (but not its directive). In this case, when `_clear()` calls
|
||||
* `_$notifyConnectionChanged()`, we don't iterate all of the
|
||||
* _$disconnectableChildren, rather we do a value-specific disconnection: i.e.
|
||||
* since the _value was an Array<ChildPart> (because an iterable had been
|
||||
* committed), we iterate the array of ChildParts (N14, N16) and run
|
||||
* `setConnected` on them (which does recurse down the full tree of
|
||||
* `_$disconnectableChildren` below it, and also removes N14 and N16 from N12's
|
||||
* `_$disconnectableChildren`). Once the values have been disconnected, we then
|
||||
* check whether the ChildPart(N12)'s list of `_$disconnectableChildren` is empty
|
||||
* (and would remove it from its parent TemplateInstance(T3) if so), but since
|
||||
* it would still contain its directive D13, it stays in the disconnectable
|
||||
* tree.
|
||||
*
|
||||
* Example 2: In the course of Example 1, `setConnected` will reach
|
||||
* ChildPart(N16); in this case the entire part is being disconnected, so we
|
||||
* simply iterate all of N16's `_$disconnectableChildren` (D17,T18) and
|
||||
* recursively run `setConnected` on them. Note that we only remove children
|
||||
* from `_$disconnectableChildren` for the top-level values being disconnected
|
||||
* on a clear; doing this bookkeeping lower in the tree is wasteful since it's
|
||||
* all being thrown away.
|
||||
*
|
||||
* Example 3: If the LitElement containing the entire tree above becomes
|
||||
* disconnected, it will run `childPart.setConnected()` (which calls
|
||||
* `childPart._$notifyConnectionChanged()` if it exists); in this case, we
|
||||
* recursively run `setConnected()` over the entire tree, without removing any
|
||||
* children from `_$disconnectableChildren`, since this tree is required to
|
||||
* re-connect the tree, which does the same operation, simply passing
|
||||
* `isConnected: true` down the tree, signaling which callback to run.
|
||||
*/
|
||||
import { Disconnectable, Part } from './lit-html.js';
|
||||
import { Directive } from './directive.js';
|
||||
export * from './directive.js';
|
||||
/**
|
||||
* An abstract `Directive` base class whose `disconnected` method will be
|
||||
* called when the part containing the directive is cleared as a result of
|
||||
* re-rendering, or when the user calls `part.setConnected(false)` on
|
||||
* a part that was previously rendered containing the directive (as happens
|
||||
* when e.g. a LitElement disconnects from the DOM).
|
||||
*
|
||||
* If `part.setConnected(true)` is subsequently called on a
|
||||
* containing part, the directive's `reconnected` method will be called prior
|
||||
* to its next `update`/`render` callbacks. When implementing `disconnected`,
|
||||
* `reconnected` should also be implemented to be compatible with reconnection.
|
||||
*
|
||||
* Note that updates may occur while the directive is disconnected. As such,
|
||||
* directives should generally check the `this.isConnected` flag during
|
||||
* render/update to determine whether it is safe to subscribe to resources
|
||||
* that may prevent garbage collection.
|
||||
*/
|
||||
export declare abstract class AsyncDirective extends Directive {
|
||||
/**
|
||||
* The connection state for this Directive.
|
||||
*/
|
||||
isConnected: boolean;
|
||||
/**
|
||||
* Initialize the part with internal fields
|
||||
* @param part
|
||||
* @param parent
|
||||
* @param attributeIndex
|
||||
*/
|
||||
_$initialize(part: Part, parent: Disconnectable, attributeIndex: number | undefined): void;
|
||||
/**
|
||||
* Sets the value of the directive's Part outside the normal `update`/`render`
|
||||
* lifecycle of a directive.
|
||||
*
|
||||
* This method should not be called synchronously from a directive's `update`
|
||||
* or `render`.
|
||||
*
|
||||
* @param directive The directive to update
|
||||
* @param value The value to set
|
||||
*/
|
||||
setValue(value: unknown): void;
|
||||
/**
|
||||
* User callbacks for implementing logic to release any resources/subscriptions
|
||||
* that may have been retained by this directive. Since directives may also be
|
||||
* re-connected, `reconnected` should also be implemented to restore the
|
||||
* working state of the directive prior to the next render.
|
||||
*/
|
||||
protected disconnected(): void;
|
||||
protected reconnected(): void;
|
||||
}
|
||||
//# sourceMappingURL=async-directive.d.ts.map
|
1
node_modules/lit-html/async-directive.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/async-directive.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"async-directive.d.ts","sourceRoot":"","sources":["../src/async-directive.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgHG;AAEH,OAAO,EAA2B,cAAc,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AAE7E,OAAO,EAAC,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAC7D,cAAc,gBAAgB,CAAC;AA0J/B;;;;;;;;;;;;;;;;GAgBG;AACH,8BAAsB,cAAe,SAAQ,SAAS;IAMpD;;OAEG;IACH,WAAW,EAAG,OAAO,CAAC;IAItB;;;;;OAKG;IACM,YAAY,CACnB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,cAAc,EACtB,cAAc,EAAE,MAAM,GAAG,SAAS;IAqCpC;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO;IAevB;;;;;OAKG;IACH,SAAS,CAAC,YAAY;IACtB,SAAS,CAAC,WAAW;CACtB"}
|
7
node_modules/lit-html/async-directive.js
generated
vendored
Normal file
7
node_modules/lit-html/async-directive.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import{isSingleExpression as i}from"./directive-helpers.js";import{Directive as t,PartType as e}from"./directive.js";export{Directive,PartType,directive}from"./directive.js";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/const s=(i,t)=>{var e,o;const r=i._$AN;if(void 0===r)return!1;for(const i of r)null===(o=(e=i)._$AO)||void 0===o||o.call(e,t,!1),s(i,t);return!0},o=i=>{let t,e;do{if(void 0===(t=i._$AM))break;e=t._$AN,e.delete(i),i=t}while(0===(null==e?void 0:e.size))},r=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(void 0===e)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),l(t)}};function n(i){void 0!==this._$AN?(o(this),this._$AM=i,r(this)):this._$AM=i}function h(i,t=!1,e=0){const r=this._$AH,n=this._$AN;if(void 0!==n&&0!==n.size)if(t)if(Array.isArray(r))for(let i=e;i<r.length;i++)s(r[i],!1),o(r[i]);else null!=r&&(s(r,!1),o(r));else s(this,i)}const l=i=>{var t,s,o,r;i.type==e.CHILD&&(null!==(t=(o=i)._$AP)&&void 0!==t||(o._$AP=h),null!==(s=(r=i)._$AQ)&&void 0!==s||(r._$AQ=n))};class c extends t{constructor(){super(...arguments),this._$AN=void 0}_$AT(i,t,e){super._$AT(i,t,e),r(this),this.isConnected=i._$AU}_$AO(i,t=!0){var e,r;i!==this.isConnected&&(this.isConnected=i,i?null===(e=this.reconnected)||void 0===e||e.call(this):null===(r=this.disconnected)||void 0===r||r.call(this)),t&&(s(this,i),o(this))}setValue(t){if(i(this._$Ct))this._$Ct._$AI(t,this);else{const i=[...this._$Ct._$AH];i[this._$Ci]=t,this._$Ct._$AI(i,this,0)}}disconnected(){}reconnected(){}}export{c as AsyncDirective};
|
||||
//# sourceMappingURL=async-directive.js.map
|
1
node_modules/lit-html/async-directive.js.map
generated
vendored
Normal file
1
node_modules/lit-html/async-directive.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
171
node_modules/lit-html/development/async-directive.d.ts
generated
vendored
Normal file
171
node_modules/lit-html/development/async-directive.d.ts
generated
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
/**
|
||||
* Overview:
|
||||
*
|
||||
* This module is designed to add support for an async `setValue` API and
|
||||
* `disconnected` callback to directives with the least impact on the core
|
||||
* runtime or payload when that feature is not used.
|
||||
*
|
||||
* The strategy is to introduce a `AsyncDirective` subclass of
|
||||
* `Directive` that climbs the "parent" tree in its constructor to note which
|
||||
* branches of lit-html's "logical tree" of data structures contain such
|
||||
* directives and thus need to be crawled when a subtree is being cleared (or
|
||||
* manually disconnected) in order to run the `disconnected` callback.
|
||||
*
|
||||
* The "nodes" of the logical tree include Parts, TemplateInstances (for when a
|
||||
* TemplateResult is committed to a value of a ChildPart), and Directives; these
|
||||
* all implement a common interface called `DisconnectableChild`. Each has a
|
||||
* `_$parent` reference which is set during construction in the core code, and a
|
||||
* `_$disconnectableChildren` field which is initially undefined.
|
||||
*
|
||||
* The sparse tree created by means of the `AsyncDirective` constructor
|
||||
* crawling up the `_$parent` tree and placing a `_$disconnectableChildren` Set
|
||||
* on each parent that includes each child that contains a
|
||||
* `AsyncDirective` directly or transitively via its children. In order to
|
||||
* notify connection state changes and disconnect (or reconnect) a tree, the
|
||||
* `_$notifyConnectionChanged` API is patched onto ChildParts as a directive
|
||||
* climbs the parent tree, which is called by the core when clearing a part if
|
||||
* it exists. When called, that method iterates over the sparse tree of
|
||||
* Set<DisconnectableChildren> built up by AsyncDirectives, and calls
|
||||
* `_$notifyDirectiveConnectionChanged` on any directives that are encountered
|
||||
* in that tree, running the required callbacks.
|
||||
*
|
||||
* A given "logical tree" of lit-html data-structures might look like this:
|
||||
*
|
||||
* ChildPart(N1) _$dC=[D2,T3]
|
||||
* ._directive
|
||||
* AsyncDirective(D2)
|
||||
* ._value // user value was TemplateResult
|
||||
* TemplateInstance(T3) _$dC=[A4,A6,N10,N12]
|
||||
* ._$parts[]
|
||||
* AttributePart(A4) _$dC=[D5]
|
||||
* ._directives[]
|
||||
* AsyncDirective(D5)
|
||||
* AttributePart(A6) _$dC=[D7,D8]
|
||||
* ._directives[]
|
||||
* AsyncDirective(D7)
|
||||
* Directive(D8) _$dC=[D9]
|
||||
* ._directive
|
||||
* AsyncDirective(D9)
|
||||
* ChildPart(N10) _$dC=[D11]
|
||||
* ._directive
|
||||
* AsyncDirective(D11)
|
||||
* ._value
|
||||
* string
|
||||
* ChildPart(N12) _$dC=[D13,N14,N16]
|
||||
* ._directive
|
||||
* AsyncDirective(D13)
|
||||
* ._value // user value was iterable
|
||||
* Array<ChildPart>
|
||||
* ChildPart(N14) _$dC=[D15]
|
||||
* ._value
|
||||
* string
|
||||
* ChildPart(N16) _$dC=[D17,T18]
|
||||
* ._directive
|
||||
* AsyncDirective(D17)
|
||||
* ._value // user value was TemplateResult
|
||||
* TemplateInstance(T18) _$dC=[A19,A21,N25]
|
||||
* ._$parts[]
|
||||
* AttributePart(A19) _$dC=[D20]
|
||||
* ._directives[]
|
||||
* AsyncDirective(D20)
|
||||
* AttributePart(A21) _$dC=[22,23]
|
||||
* ._directives[]
|
||||
* AsyncDirective(D22)
|
||||
* Directive(D23) _$dC=[D24]
|
||||
* ._directive
|
||||
* AsyncDirective(D24)
|
||||
* ChildPart(N25) _$dC=[D26]
|
||||
* ._directive
|
||||
* AsyncDirective(D26)
|
||||
* ._value
|
||||
* string
|
||||
*
|
||||
* Example 1: The directive in ChildPart(N12) updates and returns `nothing`. The
|
||||
* ChildPart will _clear() itself, and so we need to disconnect the "value" of
|
||||
* the ChildPart (but not its directive). In this case, when `_clear()` calls
|
||||
* `_$notifyConnectionChanged()`, we don't iterate all of the
|
||||
* _$disconnectableChildren, rather we do a value-specific disconnection: i.e.
|
||||
* since the _value was an Array<ChildPart> (because an iterable had been
|
||||
* committed), we iterate the array of ChildParts (N14, N16) and run
|
||||
* `setConnected` on them (which does recurse down the full tree of
|
||||
* `_$disconnectableChildren` below it, and also removes N14 and N16 from N12's
|
||||
* `_$disconnectableChildren`). Once the values have been disconnected, we then
|
||||
* check whether the ChildPart(N12)'s list of `_$disconnectableChildren` is empty
|
||||
* (and would remove it from its parent TemplateInstance(T3) if so), but since
|
||||
* it would still contain its directive D13, it stays in the disconnectable
|
||||
* tree.
|
||||
*
|
||||
* Example 2: In the course of Example 1, `setConnected` will reach
|
||||
* ChildPart(N16); in this case the entire part is being disconnected, so we
|
||||
* simply iterate all of N16's `_$disconnectableChildren` (D17,T18) and
|
||||
* recursively run `setConnected` on them. Note that we only remove children
|
||||
* from `_$disconnectableChildren` for the top-level values being disconnected
|
||||
* on a clear; doing this bookkeeping lower in the tree is wasteful since it's
|
||||
* all being thrown away.
|
||||
*
|
||||
* Example 3: If the LitElement containing the entire tree above becomes
|
||||
* disconnected, it will run `childPart.setConnected()` (which calls
|
||||
* `childPart._$notifyConnectionChanged()` if it exists); in this case, we
|
||||
* recursively run `setConnected()` over the entire tree, without removing any
|
||||
* children from `_$disconnectableChildren`, since this tree is required to
|
||||
* re-connect the tree, which does the same operation, simply passing
|
||||
* `isConnected: true` down the tree, signaling which callback to run.
|
||||
*/
|
||||
import { Disconnectable, Part } from './lit-html.js';
|
||||
import { Directive } from './directive.js';
|
||||
export * from './directive.js';
|
||||
/**
|
||||
* An abstract `Directive` base class whose `disconnected` method will be
|
||||
* called when the part containing the directive is cleared as a result of
|
||||
* re-rendering, or when the user calls `part.setConnected(false)` on
|
||||
* a part that was previously rendered containing the directive (as happens
|
||||
* when e.g. a LitElement disconnects from the DOM).
|
||||
*
|
||||
* If `part.setConnected(true)` is subsequently called on a
|
||||
* containing part, the directive's `reconnected` method will be called prior
|
||||
* to its next `update`/`render` callbacks. When implementing `disconnected`,
|
||||
* `reconnected` should also be implemented to be compatible with reconnection.
|
||||
*
|
||||
* Note that updates may occur while the directive is disconnected. As such,
|
||||
* directives should generally check the `this.isConnected` flag during
|
||||
* render/update to determine whether it is safe to subscribe to resources
|
||||
* that may prevent garbage collection.
|
||||
*/
|
||||
export declare abstract class AsyncDirective extends Directive {
|
||||
/**
|
||||
* The connection state for this Directive.
|
||||
*/
|
||||
isConnected: boolean;
|
||||
/**
|
||||
* Initialize the part with internal fields
|
||||
* @param part
|
||||
* @param parent
|
||||
* @param attributeIndex
|
||||
*/
|
||||
_$initialize(part: Part, parent: Disconnectable, attributeIndex: number | undefined): void;
|
||||
/**
|
||||
* Sets the value of the directive's Part outside the normal `update`/`render`
|
||||
* lifecycle of a directive.
|
||||
*
|
||||
* This method should not be called synchronously from a directive's `update`
|
||||
* or `render`.
|
||||
*
|
||||
* @param directive The directive to update
|
||||
* @param value The value to set
|
||||
*/
|
||||
setValue(value: unknown): void;
|
||||
/**
|
||||
* User callbacks for implementing logic to release any resources/subscriptions
|
||||
* that may have been retained by this directive. Since directives may also be
|
||||
* re-connected, `reconnected` should also be implemented to restore the
|
||||
* working state of the directive prior to the next render.
|
||||
*/
|
||||
protected disconnected(): void;
|
||||
protected reconnected(): void;
|
||||
}
|
||||
//# sourceMappingURL=async-directive.d.ts.map
|
1
node_modules/lit-html/development/async-directive.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/async-directive.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"async-directive.d.ts","sourceRoot":"","sources":["../src/async-directive.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgHG;AAEH,OAAO,EAA2B,cAAc,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AAE7E,OAAO,EAAC,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AAC7D,cAAc,gBAAgB,CAAC;AA0J/B;;;;;;;;;;;;;;;;GAgBG;AACH,8BAAsB,cAAe,SAAQ,SAAS;IAMpD;;OAEG;IACH,WAAW,EAAG,OAAO,CAAC;IAItB;;;;;OAKG;IACM,YAAY,CACnB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,cAAc,EACtB,cAAc,EAAE,MAAM,GAAG,SAAS;IAqCpC;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO;IAevB;;;;;OAKG;IACH,SAAS,CAAC,YAAY;IACtB,SAAS,CAAC,WAAW;CACtB"}
|
246
node_modules/lit-html/development/async-directive.js
generated
vendored
Normal file
246
node_modules/lit-html/development/async-directive.js
generated
vendored
Normal file
@@ -0,0 +1,246 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { isSingleExpression } from './directive-helpers.js';
|
||||
import { Directive, PartType } from './directive.js';
|
||||
export * from './directive.js';
|
||||
const DEV_MODE = true;
|
||||
/**
|
||||
* Recursively walks down the tree of Parts/TemplateInstances/Directives to set
|
||||
* the connected state of directives and run `disconnected`/ `reconnected`
|
||||
* callbacks.
|
||||
*
|
||||
* @return True if there were children to disconnect; false otherwise
|
||||
*/
|
||||
const notifyChildrenConnectedChanged = (parent, isConnected) => {
|
||||
var _a, _b;
|
||||
const children = parent._$disconnectableChildren;
|
||||
if (children === undefined) {
|
||||
return false;
|
||||
}
|
||||
for (const obj of children) {
|
||||
// The existence of `_$notifyDirectiveConnectionChanged` is used as a "brand" to
|
||||
// disambiguate AsyncDirectives from other DisconnectableChildren
|
||||
// (as opposed to using an instanceof check to know when to call it); the
|
||||
// redundancy of "Directive" in the API name is to avoid conflicting with
|
||||
// `_$notifyConnectionChanged`, which exists `ChildParts` which are also in
|
||||
// this list
|
||||
// Disconnect Directive (and any nested directives contained within)
|
||||
// This property needs to remain unminified.
|
||||
(_b = (_a = obj)['_$notifyDirectiveConnectionChanged']) === null || _b === void 0 ? void 0 : _b.call(_a, isConnected, false);
|
||||
// Disconnect Part/TemplateInstance
|
||||
notifyChildrenConnectedChanged(obj, isConnected);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* Removes the given child from its parent list of disconnectable children, and
|
||||
* if the parent list becomes empty as a result, removes the parent from its
|
||||
* parent, and so forth up the tree when that causes subsequent parent lists to
|
||||
* become empty.
|
||||
*/
|
||||
const removeDisconnectableFromParent = (obj) => {
|
||||
let parent, children;
|
||||
do {
|
||||
if ((parent = obj._$parent) === undefined) {
|
||||
break;
|
||||
}
|
||||
children = parent._$disconnectableChildren;
|
||||
children.delete(obj);
|
||||
obj = parent;
|
||||
} while ((children === null || children === void 0 ? void 0 : children.size) === 0);
|
||||
};
|
||||
const addDisconnectableToParent = (obj) => {
|
||||
// Climb the parent tree, creating a sparse tree of children needing
|
||||
// disconnection
|
||||
for (let parent; (parent = obj._$parent); obj = parent) {
|
||||
let children = parent._$disconnectableChildren;
|
||||
if (children === undefined) {
|
||||
parent._$disconnectableChildren = children = new Set();
|
||||
}
|
||||
else if (children.has(obj)) {
|
||||
// Once we've reached a parent that already contains this child, we
|
||||
// can short-circuit
|
||||
break;
|
||||
}
|
||||
children.add(obj);
|
||||
installDisconnectAPI(parent);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Changes the parent reference of the ChildPart, and updates the sparse tree of
|
||||
* Disconnectable children accordingly.
|
||||
*
|
||||
* Note, this method will be patched onto ChildPart instances and called from
|
||||
* the core code when parts are moved between different parents.
|
||||
*/
|
||||
function reparentDisconnectables(newParent) {
|
||||
if (this._$disconnectableChildren !== undefined) {
|
||||
removeDisconnectableFromParent(this);
|
||||
this._$parent = newParent;
|
||||
addDisconnectableToParent(this);
|
||||
}
|
||||
else {
|
||||
this._$parent = newParent;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Sets the connected state on any directives contained within the committed
|
||||
* value of this part (i.e. within a TemplateInstance or iterable of
|
||||
* ChildParts) and runs their `disconnected`/`reconnected`s, as well as within
|
||||
* any directives stored on the ChildPart (when `valueOnly` is false).
|
||||
*
|
||||
* `isClearingValue` should be passed as `true` on a top-level part that is
|
||||
* clearing itself, and not as a result of recursively disconnecting directives
|
||||
* as part of a `clear` operation higher up the tree. This both ensures that any
|
||||
* directive on this ChildPart that produced a value that caused the clear
|
||||
* operation is not disconnected, and also serves as a performance optimization
|
||||
* to avoid needless bookkeeping when a subtree is going away; when clearing a
|
||||
* subtree, only the top-most part need to remove itself from the parent.
|
||||
*
|
||||
* `fromPartIndex` is passed only in the case of a partial `_clear` running as a
|
||||
* result of truncating an iterable.
|
||||
*
|
||||
* Note, this method will be patched onto ChildPart instances and called from the
|
||||
* core code when parts are cleared or the connection state is changed by the
|
||||
* user.
|
||||
*/
|
||||
function notifyChildPartConnectedChanged(isConnected, isClearingValue = false, fromPartIndex = 0) {
|
||||
const value = this._$committedValue;
|
||||
const children = this._$disconnectableChildren;
|
||||
if (children === undefined || children.size === 0) {
|
||||
return;
|
||||
}
|
||||
if (isClearingValue) {
|
||||
if (Array.isArray(value)) {
|
||||
// Iterable case: Any ChildParts created by the iterable should be
|
||||
// disconnected and removed from this ChildPart's disconnectable
|
||||
// children (starting at `fromPartIndex` in the case of truncation)
|
||||
for (let i = fromPartIndex; i < value.length; i++) {
|
||||
notifyChildrenConnectedChanged(value[i], false);
|
||||
removeDisconnectableFromParent(value[i]);
|
||||
}
|
||||
}
|
||||
else if (value != null) {
|
||||
// TemplateInstance case: If the value has disconnectable children (will
|
||||
// only be in the case that it is a TemplateInstance), we disconnect it
|
||||
// and remove it from this ChildPart's disconnectable children
|
||||
notifyChildrenConnectedChanged(value, false);
|
||||
removeDisconnectableFromParent(value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
notifyChildrenConnectedChanged(this, isConnected);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Patches disconnection API onto ChildParts.
|
||||
*/
|
||||
const installDisconnectAPI = (obj) => {
|
||||
var _a, _b;
|
||||
var _c, _d;
|
||||
if (obj.type == PartType.CHILD) {
|
||||
(_a = (_c = obj)._$notifyConnectionChanged) !== null && _a !== void 0 ? _a : (_c._$notifyConnectionChanged = notifyChildPartConnectedChanged);
|
||||
(_b = (_d = obj)._$reparentDisconnectables) !== null && _b !== void 0 ? _b : (_d._$reparentDisconnectables = reparentDisconnectables);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* An abstract `Directive` base class whose `disconnected` method will be
|
||||
* called when the part containing the directive is cleared as a result of
|
||||
* re-rendering, or when the user calls `part.setConnected(false)` on
|
||||
* a part that was previously rendered containing the directive (as happens
|
||||
* when e.g. a LitElement disconnects from the DOM).
|
||||
*
|
||||
* If `part.setConnected(true)` is subsequently called on a
|
||||
* containing part, the directive's `reconnected` method will be called prior
|
||||
* to its next `update`/`render` callbacks. When implementing `disconnected`,
|
||||
* `reconnected` should also be implemented to be compatible with reconnection.
|
||||
*
|
||||
* Note that updates may occur while the directive is disconnected. As such,
|
||||
* directives should generally check the `this.isConnected` flag during
|
||||
* render/update to determine whether it is safe to subscribe to resources
|
||||
* that may prevent garbage collection.
|
||||
*/
|
||||
export class AsyncDirective extends Directive {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
// @internal
|
||||
this._$disconnectableChildren = undefined;
|
||||
}
|
||||
/**
|
||||
* Initialize the part with internal fields
|
||||
* @param part
|
||||
* @param parent
|
||||
* @param attributeIndex
|
||||
*/
|
||||
_$initialize(part, parent, attributeIndex) {
|
||||
super._$initialize(part, parent, attributeIndex);
|
||||
addDisconnectableToParent(this);
|
||||
this.isConnected = part._$isConnected;
|
||||
}
|
||||
// This property needs to remain unminified.
|
||||
/**
|
||||
* Called from the core code when a directive is going away from a part (in
|
||||
* which case `shouldRemoveFromParent` should be true), and from the
|
||||
* `setChildrenConnected` helper function when recursively changing the
|
||||
* connection state of a tree (in which case `shouldRemoveFromParent` should
|
||||
* be false).
|
||||
*
|
||||
* @param isConnected
|
||||
* @param isClearingDirective - True when the directive itself is being
|
||||
* removed; false when the tree is being disconnected
|
||||
* @internal
|
||||
*/
|
||||
['_$notifyDirectiveConnectionChanged'](isConnected, isClearingDirective = true) {
|
||||
var _a, _b;
|
||||
if (isConnected !== this.isConnected) {
|
||||
this.isConnected = isConnected;
|
||||
if (isConnected) {
|
||||
(_a = this.reconnected) === null || _a === void 0 ? void 0 : _a.call(this);
|
||||
}
|
||||
else {
|
||||
(_b = this.disconnected) === null || _b === void 0 ? void 0 : _b.call(this);
|
||||
}
|
||||
}
|
||||
if (isClearingDirective) {
|
||||
notifyChildrenConnectedChanged(this, isConnected);
|
||||
removeDisconnectableFromParent(this);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Sets the value of the directive's Part outside the normal `update`/`render`
|
||||
* lifecycle of a directive.
|
||||
*
|
||||
* This method should not be called synchronously from a directive's `update`
|
||||
* or `render`.
|
||||
*
|
||||
* @param directive The directive to update
|
||||
* @param value The value to set
|
||||
*/
|
||||
setValue(value) {
|
||||
if (isSingleExpression(this.__part)) {
|
||||
this.__part._$setValue(value, this);
|
||||
}
|
||||
else {
|
||||
// this.__attributeIndex will be defined in this case, but
|
||||
// assert it in dev mode
|
||||
if (DEV_MODE && this.__attributeIndex === undefined) {
|
||||
throw new Error(`Expected this.__attributeIndex to be a number`);
|
||||
}
|
||||
const newValues = [...this.__part._$committedValue];
|
||||
newValues[this.__attributeIndex] = value;
|
||||
this.__part._$setValue(newValues, this, 0);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* User callbacks for implementing logic to release any resources/subscriptions
|
||||
* that may have been retained by this directive. Since directives may also be
|
||||
* re-connected, `reconnected` should also be implemented to restore the
|
||||
* working state of the directive prior to the next render.
|
||||
*/
|
||||
disconnected() { }
|
||||
reconnected() { }
|
||||
}
|
||||
//# sourceMappingURL=async-directive.js.map
|
1
node_modules/lit-html/development/async-directive.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/async-directive.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
114
node_modules/lit-html/development/directive-helpers.d.ts
generated
vendored
Normal file
114
node_modules/lit-html/development/directive-helpers.d.ts
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { Part, DirectiveParent, TemplateResult, CompiledTemplateResult } from './lit-html.js';
|
||||
import { DirectiveResult, DirectiveClass, PartInfo } from './directive.js';
|
||||
declare type Primitive = null | undefined | boolean | number | string | symbol | bigint;
|
||||
/**
|
||||
* Tests if a value is a primitive value.
|
||||
*
|
||||
* See https://tc39.github.io/ecma262/#sec-typeof-operator
|
||||
*/
|
||||
export declare const isPrimitive: (value: unknown) => value is Primitive;
|
||||
export declare const TemplateResultType: {
|
||||
readonly HTML: 1;
|
||||
readonly SVG: 2;
|
||||
};
|
||||
export declare type TemplateResultType = (typeof TemplateResultType)[keyof typeof TemplateResultType];
|
||||
declare type IsTemplateResult = {
|
||||
(val: unknown): val is TemplateResult | CompiledTemplateResult;
|
||||
<T extends TemplateResultType>(val: unknown, type: T): val is TemplateResult<T>;
|
||||
};
|
||||
/**
|
||||
* Tests if a value is a TemplateResult or a CompiledTemplateResult.
|
||||
*/
|
||||
export declare const isTemplateResult: IsTemplateResult;
|
||||
/**
|
||||
* Tests if a value is a CompiledTemplateResult.
|
||||
*/
|
||||
export declare const isCompiledTemplateResult: (value: unknown) => value is CompiledTemplateResult;
|
||||
/**
|
||||
* Tests if a value is a DirectiveResult.
|
||||
*/
|
||||
export declare const isDirectiveResult: (value: unknown) => value is DirectiveResult<DirectiveClass>;
|
||||
/**
|
||||
* Retrieves the Directive class for a DirectiveResult
|
||||
*/
|
||||
export declare const getDirectiveClass: (value: unknown) => DirectiveClass | undefined;
|
||||
/**
|
||||
* Tests whether a part has only a single-expression with no strings to
|
||||
* interpolate between.
|
||||
*
|
||||
* Only AttributePart and PropertyPart can have multiple expressions.
|
||||
* Multi-expression parts have a `strings` property and single-expression
|
||||
* parts do not.
|
||||
*/
|
||||
export declare const isSingleExpression: (part: PartInfo) => boolean;
|
||||
/**
|
||||
* Inserts a ChildPart into the given container ChildPart's DOM, either at the
|
||||
* end of the container ChildPart, or before the optional `refPart`.
|
||||
*
|
||||
* This does not add the part to the containerPart's committed value. That must
|
||||
* be done by callers.
|
||||
*
|
||||
* @param containerPart Part within which to add the new ChildPart
|
||||
* @param refPart Part before which to add the new ChildPart; when omitted the
|
||||
* part added to the end of the `containerPart`
|
||||
* @param part Part to insert, or undefined to create a new part
|
||||
*/
|
||||
export declare const insertPart: (containerPart: import("./lit-html.js").ChildPart, refPart?: import("./lit-html.js").ChildPart | undefined, part?: import("./lit-html.js").ChildPart | undefined) => import("./lit-html.js").ChildPart;
|
||||
/**
|
||||
* Sets the value of a Part.
|
||||
*
|
||||
* Note that this should only be used to set/update the value of user-created
|
||||
* parts (i.e. those created using `insertPart`); it should not be used
|
||||
* by directives to set the value of the directive's container part. Directives
|
||||
* should return a value from `update`/`render` to update their part state.
|
||||
*
|
||||
* For directives that require setting their part value asynchronously, they
|
||||
* should extend `AsyncDirective` and call `this.setValue()`.
|
||||
*
|
||||
* @param part Part to set
|
||||
* @param value Value to set
|
||||
* @param index For `AttributePart`s, the index to set
|
||||
* @param directiveParent Used internally; should not be set by user
|
||||
*/
|
||||
export declare const setChildPartValue: <T extends import("./lit-html.js").ChildPart>(part: T, value: unknown, directiveParent?: DirectiveParent) => T;
|
||||
/**
|
||||
* Sets the committed value of a ChildPart directly without triggering the
|
||||
* commit stage of the part.
|
||||
*
|
||||
* This is useful in cases where a directive needs to update the part such
|
||||
* that the next update detects a value change or not. When value is omitted,
|
||||
* the next update will be guaranteed to be detected as a change.
|
||||
*
|
||||
* @param part
|
||||
* @param value
|
||||
*/
|
||||
export declare const setCommittedValue: (part: Part, value?: unknown) => unknown;
|
||||
/**
|
||||
* Returns the committed value of a ChildPart.
|
||||
*
|
||||
* The committed value is used for change detection and efficient updates of
|
||||
* the part. It can differ from the value set by the template or directive in
|
||||
* cases where the template value is transformed before being committed.
|
||||
*
|
||||
* - `TemplateResult`s are committed as a `TemplateInstance`
|
||||
* - Iterables are committed as `Array<ChildPart>`
|
||||
* - All other types are committed as the template value or value returned or
|
||||
* set by a directive.
|
||||
*
|
||||
* @param part
|
||||
*/
|
||||
export declare const getCommittedValue: (part: import("./lit-html.js").ChildPart) => unknown;
|
||||
/**
|
||||
* Removes a ChildPart from the DOM, including any of its content.
|
||||
*
|
||||
* @param part The Part to remove
|
||||
*/
|
||||
export declare const removePart: (part: import("./lit-html.js").ChildPart) => void;
|
||||
export declare const clearPart: (part: import("./lit-html.js").ChildPart) => void;
|
||||
export {};
|
||||
//# sourceMappingURL=directive-helpers.d.ts.map
|
1
node_modules/lit-html/development/directive-helpers.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directive-helpers.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"directive-helpers.d.ts","sourceRoot":"","sources":["../src/directive-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,IAAI,EACJ,eAAe,EACf,cAAc,EACd,sBAAsB,EACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,cAAc,EACd,QAAQ,EAET,MAAM,gBAAgB,CAAC;AACxB,aAAK,SAAS,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAehF;;;;GAIG;AACH,eAAO,MAAM,WAAW,UAAW,OAAO,uBACkC,CAAC;AAE7E,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AAEX,oBAAY,kBAAkB,GAC5B,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE/D,aAAK,gBAAgB,GAAG;IACtB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,cAAc,GAAG,sBAAsB,CAAC;IAC/D,CAAC,CAAC,SAAS,kBAAkB,EAC3B,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,GACN,GAAG,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAOyB,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,wBAAwB,UAC5B,OAAO,oCAGf,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,UAAW,OAAO,6CAEe,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,iBAAiB,UAAW,OAAO,KAAG,cAAc,GAAG,SAEnB,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,SAAU,QAAQ,YACE,CAAC;AAIpD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,wMAqDtB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,gEAErB,OAAO,oBACG,eAAe,MAIjC,CAAC;AAMF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,SAAU,IAAI,UAAS,OAAO,YAC3B,CAAC;AAElC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,sDAA6C,CAAC;AAE5E;;;;GAIG;AACH,eAAO,MAAM,UAAU,mDAStB,CAAC;AAEF,eAAO,MAAM,SAAS,mDAErB,CAAC"}
|
183
node_modules/lit-html/development/directive-helpers.js
generated
vendored
Normal file
183
node_modules/lit-html/development/directive-helpers.js
generated
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
var _a, _b;
|
||||
import { _$LH, } from './lit-html.js';
|
||||
const { _ChildPart: ChildPart } = _$LH;
|
||||
const ENABLE_SHADYDOM_NOPATCH = true;
|
||||
const wrap = ENABLE_SHADYDOM_NOPATCH &&
|
||||
((_a = window.ShadyDOM) === null || _a === void 0 ? void 0 : _a.inUse) &&
|
||||
((_b = window.ShadyDOM) === null || _b === void 0 ? void 0 : _b.noPatch) === true
|
||||
? window.ShadyDOM.wrap
|
||||
: (node) => node;
|
||||
/**
|
||||
* Tests if a value is a primitive value.
|
||||
*
|
||||
* See https://tc39.github.io/ecma262/#sec-typeof-operator
|
||||
*/
|
||||
export const isPrimitive = (value) => value === null || (typeof value != 'object' && typeof value != 'function');
|
||||
export const TemplateResultType = {
|
||||
HTML: 1,
|
||||
SVG: 2,
|
||||
};
|
||||
/**
|
||||
* Tests if a value is a TemplateResult or a CompiledTemplateResult.
|
||||
*/
|
||||
export const isTemplateResult = (value, type) => type === undefined
|
||||
? // This property needs to remain unminified.
|
||||
(value === null || value === void 0 ? void 0 : value['_$litType$']) !== undefined
|
||||
: (value === null || value === void 0 ? void 0 : value['_$litType$']) === type;
|
||||
/**
|
||||
* Tests if a value is a CompiledTemplateResult.
|
||||
*/
|
||||
export const isCompiledTemplateResult = (value) => {
|
||||
var _a;
|
||||
return ((_a = value === null || value === void 0 ? void 0 : value['_$litType$']) === null || _a === void 0 ? void 0 : _a.h) != null;
|
||||
};
|
||||
/**
|
||||
* Tests if a value is a DirectiveResult.
|
||||
*/
|
||||
export const isDirectiveResult = (value) =>
|
||||
// This property needs to remain unminified.
|
||||
(value === null || value === void 0 ? void 0 : value['_$litDirective$']) !== undefined;
|
||||
/**
|
||||
* Retrieves the Directive class for a DirectiveResult
|
||||
*/
|
||||
export const getDirectiveClass = (value) =>
|
||||
// This property needs to remain unminified.
|
||||
value === null || value === void 0 ? void 0 : value['_$litDirective$'];
|
||||
/**
|
||||
* Tests whether a part has only a single-expression with no strings to
|
||||
* interpolate between.
|
||||
*
|
||||
* Only AttributePart and PropertyPart can have multiple expressions.
|
||||
* Multi-expression parts have a `strings` property and single-expression
|
||||
* parts do not.
|
||||
*/
|
||||
export const isSingleExpression = (part) => part.strings === undefined;
|
||||
const createMarker = () => document.createComment('');
|
||||
/**
|
||||
* Inserts a ChildPart into the given container ChildPart's DOM, either at the
|
||||
* end of the container ChildPart, or before the optional `refPart`.
|
||||
*
|
||||
* This does not add the part to the containerPart's committed value. That must
|
||||
* be done by callers.
|
||||
*
|
||||
* @param containerPart Part within which to add the new ChildPart
|
||||
* @param refPart Part before which to add the new ChildPart; when omitted the
|
||||
* part added to the end of the `containerPart`
|
||||
* @param part Part to insert, or undefined to create a new part
|
||||
*/
|
||||
export const insertPart = (containerPart, refPart, part) => {
|
||||
var _a;
|
||||
const container = wrap(containerPart._$startNode).parentNode;
|
||||
const refNode = refPart === undefined ? containerPart._$endNode : refPart._$startNode;
|
||||
if (part === undefined) {
|
||||
const startNode = wrap(container).insertBefore(createMarker(), refNode);
|
||||
const endNode = wrap(container).insertBefore(createMarker(), refNode);
|
||||
part = new ChildPart(startNode, endNode, containerPart, containerPart.options);
|
||||
}
|
||||
else {
|
||||
const endNode = wrap(part._$endNode).nextSibling;
|
||||
const oldParent = part._$parent;
|
||||
const parentChanged = oldParent !== containerPart;
|
||||
if (parentChanged) {
|
||||
(_a = part._$reparentDisconnectables) === null || _a === void 0 ? void 0 : _a.call(part, containerPart);
|
||||
// Note that although `_$reparentDisconnectables` updates the part's
|
||||
// `_$parent` reference after unlinking from its current parent, that
|
||||
// method only exists if Disconnectables are present, so we need to
|
||||
// unconditionally set it here
|
||||
part._$parent = containerPart;
|
||||
// Since the _$isConnected getter is somewhat costly, only
|
||||
// read it once we know the subtree has directives that need
|
||||
// to be notified
|
||||
let newConnectionState;
|
||||
if (part._$notifyConnectionChanged !== undefined &&
|
||||
(newConnectionState = containerPart._$isConnected) !==
|
||||
oldParent._$isConnected) {
|
||||
part._$notifyConnectionChanged(newConnectionState);
|
||||
}
|
||||
}
|
||||
if (endNode !== refNode || parentChanged) {
|
||||
let start = part._$startNode;
|
||||
while (start !== endNode) {
|
||||
const n = wrap(start).nextSibling;
|
||||
wrap(container).insertBefore(start, refNode);
|
||||
start = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
return part;
|
||||
};
|
||||
/**
|
||||
* Sets the value of a Part.
|
||||
*
|
||||
* Note that this should only be used to set/update the value of user-created
|
||||
* parts (i.e. those created using `insertPart`); it should not be used
|
||||
* by directives to set the value of the directive's container part. Directives
|
||||
* should return a value from `update`/`render` to update their part state.
|
||||
*
|
||||
* For directives that require setting their part value asynchronously, they
|
||||
* should extend `AsyncDirective` and call `this.setValue()`.
|
||||
*
|
||||
* @param part Part to set
|
||||
* @param value Value to set
|
||||
* @param index For `AttributePart`s, the index to set
|
||||
* @param directiveParent Used internally; should not be set by user
|
||||
*/
|
||||
export const setChildPartValue = (part, value, directiveParent = part) => {
|
||||
part._$setValue(value, directiveParent);
|
||||
return part;
|
||||
};
|
||||
// A sentinel value that can never appear as a part value except when set by
|
||||
// live(). Used to force a dirty-check to fail and cause a re-render.
|
||||
const RESET_VALUE = {};
|
||||
/**
|
||||
* Sets the committed value of a ChildPart directly without triggering the
|
||||
* commit stage of the part.
|
||||
*
|
||||
* This is useful in cases where a directive needs to update the part such
|
||||
* that the next update detects a value change or not. When value is omitted,
|
||||
* the next update will be guaranteed to be detected as a change.
|
||||
*
|
||||
* @param part
|
||||
* @param value
|
||||
*/
|
||||
export const setCommittedValue = (part, value = RESET_VALUE) => (part._$committedValue = value);
|
||||
/**
|
||||
* Returns the committed value of a ChildPart.
|
||||
*
|
||||
* The committed value is used for change detection and efficient updates of
|
||||
* the part. It can differ from the value set by the template or directive in
|
||||
* cases where the template value is transformed before being committed.
|
||||
*
|
||||
* - `TemplateResult`s are committed as a `TemplateInstance`
|
||||
* - Iterables are committed as `Array<ChildPart>`
|
||||
* - All other types are committed as the template value or value returned or
|
||||
* set by a directive.
|
||||
*
|
||||
* @param part
|
||||
*/
|
||||
export const getCommittedValue = (part) => part._$committedValue;
|
||||
/**
|
||||
* Removes a ChildPart from the DOM, including any of its content.
|
||||
*
|
||||
* @param part The Part to remove
|
||||
*/
|
||||
export const removePart = (part) => {
|
||||
var _a;
|
||||
(_a = part._$notifyConnectionChanged) === null || _a === void 0 ? void 0 : _a.call(part, false, true);
|
||||
let start = part._$startNode;
|
||||
const end = wrap(part._$endNode).nextSibling;
|
||||
while (start !== end) {
|
||||
const n = wrap(start).nextSibling;
|
||||
wrap(start).remove();
|
||||
start = n;
|
||||
}
|
||||
};
|
||||
export const clearPart = (part) => {
|
||||
part._$clear();
|
||||
};
|
||||
//# sourceMappingURL=directive-helpers.js.map
|
1
node_modules/lit-html/development/directive-helpers.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directive-helpers.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
66
node_modules/lit-html/development/directive.d.ts
generated
vendored
Normal file
66
node_modules/lit-html/development/directive.d.ts
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { Disconnectable, Part } from './lit-html.js';
|
||||
export { AttributePart, BooleanAttributePart, ChildPart, ElementPart, EventPart, Part, PropertyPart, } from './lit-html.js';
|
||||
export interface DirectiveClass {
|
||||
new (part: PartInfo): Directive;
|
||||
}
|
||||
/**
|
||||
* This utility type extracts the signature of a directive class's render()
|
||||
* method so we can use it for the type of the generated directive function.
|
||||
*/
|
||||
export declare type DirectiveParameters<C extends Directive> = Parameters<C['render']>;
|
||||
/**
|
||||
* A generated directive function doesn't evaluate the directive, but just
|
||||
* returns a DirectiveResult object that captures the arguments.
|
||||
*/
|
||||
export interface DirectiveResult<C extends DirectiveClass = DirectiveClass> {
|
||||
}
|
||||
export declare const PartType: {
|
||||
readonly ATTRIBUTE: 1;
|
||||
readonly CHILD: 2;
|
||||
readonly PROPERTY: 3;
|
||||
readonly BOOLEAN_ATTRIBUTE: 4;
|
||||
readonly EVENT: 5;
|
||||
readonly ELEMENT: 6;
|
||||
};
|
||||
export declare type PartType = (typeof PartType)[keyof typeof PartType];
|
||||
export interface ChildPartInfo {
|
||||
readonly type: typeof PartType.CHILD;
|
||||
}
|
||||
export interface AttributePartInfo {
|
||||
readonly type: typeof PartType.ATTRIBUTE | typeof PartType.PROPERTY | typeof PartType.BOOLEAN_ATTRIBUTE | typeof PartType.EVENT;
|
||||
readonly strings?: ReadonlyArray<string>;
|
||||
readonly name: string;
|
||||
readonly tagName: string;
|
||||
}
|
||||
export interface ElementPartInfo {
|
||||
readonly type: typeof PartType.ELEMENT;
|
||||
}
|
||||
/**
|
||||
* Information about the part a directive is bound to.
|
||||
*
|
||||
* This is useful for checking that a directive is attached to a valid part,
|
||||
* such as with directive that can only be used on attribute bindings.
|
||||
*/
|
||||
export declare type PartInfo = ChildPartInfo | AttributePartInfo | ElementPartInfo;
|
||||
/**
|
||||
* Creates a user-facing directive function from a Directive class. This
|
||||
* function has the same parameters as the directive's render() method.
|
||||
*/
|
||||
export declare const directive: <C extends DirectiveClass>(c: C) => (...values: Parameters<InstanceType<C>["render"]>) => DirectiveResult<C>;
|
||||
/**
|
||||
* Base class for creating custom directives. Users should extend this class,
|
||||
* implement `render` and/or `update`, and then pass their subclass to
|
||||
* `directive`.
|
||||
*/
|
||||
export declare abstract class Directive implements Disconnectable {
|
||||
constructor(_partInfo: PartInfo);
|
||||
get _$isConnected(): boolean;
|
||||
abstract render(...props: Array<unknown>): unknown;
|
||||
update(_part: Part, props: Array<unknown>): unknown;
|
||||
}
|
||||
//# sourceMappingURL=directive.d.ts.map
|
1
node_modules/lit-html/development/directive.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directive.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"directive.d.ts","sourceRoot":"","sources":["../src/directive.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,cAAc,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AAEnD,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,SAAS,EACT,IAAI,EACJ,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,cAAc;IAC7B,KAAK,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;CACjC;AAED;;;GAGG;AACH,oBAAY,mBAAmB,CAAC,CAAC,SAAS,SAAS,IAAI,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE/E;;;GAGG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc;CAOzE;AAED,eAAO,MAAM,QAAQ;;;;;;;CAOX,CAAC;AAEX,oBAAY,QAAQ,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAEhE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,OAAO,QAAQ,CAAC,KAAK,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EACT,OAAO,QAAQ,CAAC,SAAS,GACzB,OAAO,QAAQ,CAAC,QAAQ,GACxB,OAAO,QAAQ,CAAC,iBAAiB,GACjC,OAAO,QAAQ,CAAC,KAAK,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,OAAO,QAAQ,CAAC,OAAO,CAAC;CACxC;AAED;;;;;GAKG;AACH,oBAAY,QAAQ,GAAG,aAAa,GAAG,iBAAiB,GAAG,eAAe,CAAC;AAE3E;;;GAGG;AACH,eAAO,MAAM,SAAS,8GAMlB,CAAC;AAEL;;;;GAIG;AACH,8BAAsB,SAAU,YAAW,cAAc;gBAkB3C,SAAS,EAAE,QAAQ;IAG/B,IAAI,aAAa,YAEhB;IAiBD,QAAQ,CAAC,MAAM,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,OAAO;IAElD,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,OAAO;CAGpD"}
|
48
node_modules/lit-html/development/directive.js
generated
vendored
Normal file
48
node_modules/lit-html/development/directive.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
export const PartType = {
|
||||
ATTRIBUTE: 1,
|
||||
CHILD: 2,
|
||||
PROPERTY: 3,
|
||||
BOOLEAN_ATTRIBUTE: 4,
|
||||
EVENT: 5,
|
||||
ELEMENT: 6,
|
||||
};
|
||||
/**
|
||||
* Creates a user-facing directive function from a Directive class. This
|
||||
* function has the same parameters as the directive's render() method.
|
||||
*/
|
||||
export const directive = (c) => (...values) => ({
|
||||
// This property needs to remain unminified.
|
||||
['_$litDirective$']: c,
|
||||
values,
|
||||
});
|
||||
/**
|
||||
* Base class for creating custom directives. Users should extend this class,
|
||||
* implement `render` and/or `update`, and then pass their subclass to
|
||||
* `directive`.
|
||||
*/
|
||||
export class Directive {
|
||||
constructor(_partInfo) { }
|
||||
// See comment in Disconnectable interface for why this is a getter
|
||||
get _$isConnected() {
|
||||
return this._$parent._$isConnected;
|
||||
}
|
||||
/** @internal */
|
||||
_$initialize(part, parent, attributeIndex) {
|
||||
this.__part = part;
|
||||
this._$parent = parent;
|
||||
this.__attributeIndex = attributeIndex;
|
||||
}
|
||||
/** @internal */
|
||||
_$resolve(part, props) {
|
||||
return this.update(part, props);
|
||||
}
|
||||
update(_part, props) {
|
||||
return this.render(...props);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=directive.js.map
|
1
node_modules/lit-html/development/directive.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directive.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"directive.js","sourceRoot":"","sources":["../src/directive.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqCH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,SAAS,EAAE,CAAC;IACZ,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,iBAAiB,EAAE,CAAC;IACpB,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;CACF,CAAC;AA+BX;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GACpB,CAA2B,CAAI,EAAE,EAAE,CACnC,CAAC,GAAG,MAA4C,EAAsB,EAAE,CAAC,CAAC;IACxE,4CAA4C;IAC5C,CAAC,iBAAiB,CAAC,EAAE,CAAC;IACtB,MAAM;CACP,CAAC,CAAC;AAEL;;;;GAIG;AACH,MAAM,OAAgB,SAAS;IAkB7B,YAAY,SAAmB,IAAG,CAAC;IAEnC,mEAAmE;IACnE,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;IACrC,CAAC;IAED,gBAAgB;IAChB,YAAY,CACV,IAAU,EACV,MAAsB,EACtB,cAAkC;QAElC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC;QACvB,IAAI,CAAC,gBAAgB,GAAG,cAAc,CAAC;IACzC,CAAC;IACD,gBAAgB;IAChB,SAAS,CAAC,IAAU,EAAE,KAAqB;QACzC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAID,MAAM,CAAC,KAAW,EAAE,KAAqB;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC;IAC/B,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {Disconnectable, Part} from './lit-html.js';\n\nexport {\n AttributePart,\n BooleanAttributePart,\n ChildPart,\n ElementPart,\n EventPart,\n Part,\n PropertyPart,\n} from './lit-html.js';\n\nexport interface DirectiveClass {\n new (part: PartInfo): Directive;\n}\n\n/**\n * This utility type extracts the signature of a directive class's render()\n * method so we can use it for the type of the generated directive function.\n */\nexport type DirectiveParameters<C extends Directive> = Parameters<C['render']>;\n\n/**\n * A generated directive function doesn't evaluate the directive, but just\n * returns a DirectiveResult object that captures the arguments.\n */\nexport interface DirectiveResult<C extends DirectiveClass = DirectiveClass> {\n /**\n * This property needs to remain unminified.\n * @internal */\n ['_$litDirective$']: C;\n /** @internal */\n values: DirectiveParameters<InstanceType<C>>;\n}\n\nexport const PartType = {\n ATTRIBUTE: 1,\n CHILD: 2,\n PROPERTY: 3,\n BOOLEAN_ATTRIBUTE: 4,\n EVENT: 5,\n ELEMENT: 6,\n} as const;\n\nexport type PartType = (typeof PartType)[keyof typeof PartType];\n\nexport interface ChildPartInfo {\n readonly type: typeof PartType.CHILD;\n}\n\nexport interface AttributePartInfo {\n readonly type:\n | typeof PartType.ATTRIBUTE\n | typeof PartType.PROPERTY\n | typeof PartType.BOOLEAN_ATTRIBUTE\n | typeof PartType.EVENT;\n readonly strings?: ReadonlyArray<string>;\n readonly name: string;\n readonly tagName: string;\n}\n\nexport interface ElementPartInfo {\n readonly type: typeof PartType.ELEMENT;\n}\n\n/**\n * Information about the part a directive is bound to.\n *\n * This is useful for checking that a directive is attached to a valid part,\n * such as with directive that can only be used on attribute bindings.\n */\nexport type PartInfo = ChildPartInfo | AttributePartInfo | ElementPartInfo;\n\n/**\n * Creates a user-facing directive function from a Directive class. This\n * function has the same parameters as the directive's render() method.\n */\nexport const directive =\n <C extends DirectiveClass>(c: C) =>\n (...values: DirectiveParameters<InstanceType<C>>): DirectiveResult<C> => ({\n // This property needs to remain unminified.\n ['_$litDirective$']: c,\n values,\n });\n\n/**\n * Base class for creating custom directives. Users should extend this class,\n * implement `render` and/or `update`, and then pass their subclass to\n * `directive`.\n */\nexport abstract class Directive implements Disconnectable {\n //@internal\n __part!: Part;\n //@internal\n __attributeIndex: number | undefined;\n //@internal\n __directive?: Directive;\n\n //@internal\n _$parent!: Disconnectable;\n\n // These will only exist on the AsyncDirective subclass\n //@internal\n _$disconnectableChildren?: Set<Disconnectable>;\n // This property needs to remain unminified.\n //@internal\n ['_$notifyDirectiveConnectionChanged']?(isConnected: boolean): void;\n\n constructor(_partInfo: PartInfo) {}\n\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n\n /** @internal */\n _$initialize(\n part: Part,\n parent: Disconnectable,\n attributeIndex: number | undefined\n ) {\n this.__part = part;\n this._$parent = parent;\n this.__attributeIndex = attributeIndex;\n }\n /** @internal */\n _$resolve(part: Part, props: Array<unknown>): unknown {\n return this.update(part, props);\n }\n\n abstract render(...props: Array<unknown>): unknown;\n\n update(_part: Part, props: Array<unknown>): unknown {\n return this.render(...props);\n }\n}\n"]}
|
39
node_modules/lit-html/development/directives/async-append.d.ts
generated
vendored
Normal file
39
node_modules/lit-html/development/directives/async-append.d.ts
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { ChildPart } from '../lit-html.js';
|
||||
import { DirectiveParameters, PartInfo } from '../directive.js';
|
||||
import { AsyncReplaceDirective } from './async-replace.js';
|
||||
declare class AsyncAppendDirective extends AsyncReplaceDirective {
|
||||
private __childPart;
|
||||
constructor(partInfo: PartInfo);
|
||||
update(part: ChildPart, params: DirectiveParameters<this>): typeof import("../lit-html.js").noChange | undefined;
|
||||
protected commitValue(value: unknown, index: number): void;
|
||||
}
|
||||
/**
|
||||
* A directive that renders the items of an async iterable[1], appending new
|
||||
* values after previous values, similar to the built-in support for iterables.
|
||||
* This directive is usable only in child expressions.
|
||||
*
|
||||
* Async iterables are objects with a [Symbol.asyncIterator] method, which
|
||||
* returns an iterator who's `next()` method returns a Promise. When a new
|
||||
* value is available, the Promise resolves and the value is appended to the
|
||||
* Part controlled by the directive. If another value other than this
|
||||
* directive has been set on the Part, the iterable will no longer be listened
|
||||
* to and new values won't be written to the Part.
|
||||
*
|
||||
* [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
|
||||
*
|
||||
* @param value An async iterable
|
||||
* @param mapper An optional function that maps from (value, index) to another
|
||||
* value. Useful for generating templates for each item in the iterable.
|
||||
*/
|
||||
export declare const asyncAppend: (value: AsyncIterable<unknown>, _mapper?: ((v: unknown, index?: number | undefined) => unknown) | undefined) => import("../directive.js").DirectiveResult<typeof AsyncAppendDirective>;
|
||||
/**
|
||||
* The type of the class that powers this directive. Necessary for naming the
|
||||
* directive's return type.
|
||||
*/
|
||||
export type { AsyncAppendDirective };
|
||||
//# sourceMappingURL=async-append.d.ts.map
|
1
node_modules/lit-html/development/directives/async-append.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/async-append.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"async-append.d.ts","sourceRoot":"","sources":["../../src/directives/async-append.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAEL,mBAAmB,EACnB,QAAQ,EAET,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AAOzD,cAAM,oBAAqB,SAAQ,qBAAqB;IACtD,OAAO,CAAC,WAAW,CAAa;gBAGpB,QAAQ,EAAE,QAAQ;IAQrB,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,CAAC,IAAI,CAAC;cAM/C,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM;CAU7D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,WAAW,wLAAkC,CAAC;AAE3D;;;GAGG;AACH,YAAY,EAAC,oBAAoB,EAAC,CAAC"}
|
53
node_modules/lit-html/development/directives/async-append.js
generated
vendored
Normal file
53
node_modules/lit-html/development/directives/async-append.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { directive, PartType, } from '../directive.js';
|
||||
import { AsyncReplaceDirective } from './async-replace.js';
|
||||
import { clearPart, insertPart, setChildPartValue, } from '../directive-helpers.js';
|
||||
class AsyncAppendDirective extends AsyncReplaceDirective {
|
||||
// Override AsyncReplace to narrow the allowed part type to ChildPart only
|
||||
constructor(partInfo) {
|
||||
super(partInfo);
|
||||
if (partInfo.type !== PartType.CHILD) {
|
||||
throw new Error('asyncAppend can only be used in child expressions');
|
||||
}
|
||||
}
|
||||
// Override AsyncReplace to save the part since we need to append into it
|
||||
update(part, params) {
|
||||
this.__childPart = part;
|
||||
return super.update(part, params);
|
||||
}
|
||||
// Override AsyncReplace to append rather than replace
|
||||
commitValue(value, index) {
|
||||
// When we get the first value, clear the part. This lets the
|
||||
// previous value display until we can replace it.
|
||||
if (index === 0) {
|
||||
clearPart(this.__childPart);
|
||||
}
|
||||
// Create and insert a new part and set its value to the next value
|
||||
const newPart = insertPart(this.__childPart);
|
||||
setChildPartValue(newPart, value);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A directive that renders the items of an async iterable[1], appending new
|
||||
* values after previous values, similar to the built-in support for iterables.
|
||||
* This directive is usable only in child expressions.
|
||||
*
|
||||
* Async iterables are objects with a [Symbol.asyncIterator] method, which
|
||||
* returns an iterator who's `next()` method returns a Promise. When a new
|
||||
* value is available, the Promise resolves and the value is appended to the
|
||||
* Part controlled by the directive. If another value other than this
|
||||
* directive has been set on the Part, the iterable will no longer be listened
|
||||
* to and new values won't be written to the Part.
|
||||
*
|
||||
* [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
|
||||
*
|
||||
* @param value An async iterable
|
||||
* @param mapper An optional function that maps from (value, index) to another
|
||||
* value. Useful for generating templates for each item in the iterable.
|
||||
*/
|
||||
export const asyncAppend = directive(AsyncAppendDirective);
|
||||
//# sourceMappingURL=async-append.js.map
|
1
node_modules/lit-html/development/directives/async-append.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/async-append.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"async-append.js","sourceRoot":"","sources":["../../src/directives/async-append.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,SAAS,EAGT,QAAQ,GACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACL,SAAS,EACT,UAAU,EACV,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,oBAAqB,SAAQ,qBAAqB;IAGtD,0EAA0E;IAC1E,YAAY,QAAkB;QAC5B,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,KAAK,EAAE;YACpC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;SACtE;IACH,CAAC;IAED,yEAAyE;IAChE,MAAM,CAAC,IAAe,EAAE,MAAiC;QAChE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;IAED,sDAAsD;IACnC,WAAW,CAAC,KAAc,EAAE,KAAa;QAC1D,6DAA6D;QAC7D,kDAAkD;QAClD,IAAI,KAAK,KAAK,CAAC,EAAE;YACf,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAC7B;QACD,mEAAmE;QACnE,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC7C,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,oBAAoB,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {ChildPart} from '../lit-html.js';\nimport {\n directive,\n DirectiveParameters,\n PartInfo,\n PartType,\n} from '../directive.js';\nimport {AsyncReplaceDirective} from './async-replace.js';\nimport {\n clearPart,\n insertPart,\n setChildPartValue,\n} from '../directive-helpers.js';\n\nclass AsyncAppendDirective extends AsyncReplaceDirective {\n private __childPart!: ChildPart;\n\n // Override AsyncReplace to narrow the allowed part type to ChildPart only\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error('asyncAppend can only be used in child expressions');\n }\n }\n\n // Override AsyncReplace to save the part since we need to append into it\n override update(part: ChildPart, params: DirectiveParameters<this>) {\n this.__childPart = part;\n return super.update(part, params);\n }\n\n // Override AsyncReplace to append rather than replace\n protected override commitValue(value: unknown, index: number) {\n // When we get the first value, clear the part. This lets the\n // previous value display until we can replace it.\n if (index === 0) {\n clearPart(this.__childPart);\n }\n // Create and insert a new part and set its value to the next value\n const newPart = insertPart(this.__childPart);\n setChildPartValue(newPart, value);\n }\n}\n\n/**\n * A directive that renders the items of an async iterable[1], appending new\n * values after previous values, similar to the built-in support for iterables.\n * This directive is usable only in child expressions.\n *\n * Async iterables are objects with a [Symbol.asyncIterator] method, which\n * returns an iterator who's `next()` method returns a Promise. When a new\n * value is available, the Promise resolves and the value is appended to the\n * Part controlled by the directive. If another value other than this\n * directive has been set on the Part, the iterable will no longer be listened\n * to and new values won't be written to the Part.\n *\n * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of\n *\n * @param value An async iterable\n * @param mapper An optional function that maps from (value, index) to another\n * value. Useful for generating templates for each item in the iterable.\n */\nexport const asyncAppend = directive(AsyncAppendDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {AsyncAppendDirective};\n"]}
|
39
node_modules/lit-html/development/directives/async-replace.d.ts
generated
vendored
Normal file
39
node_modules/lit-html/development/directives/async-replace.d.ts
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { ChildPart, noChange } from '../lit-html.js';
|
||||
import { AsyncDirective, DirectiveParameters } from '../async-directive.js';
|
||||
declare type Mapper<T> = (v: T, index?: number) => unknown;
|
||||
export declare class AsyncReplaceDirective extends AsyncDirective {
|
||||
private __value?;
|
||||
private __weakThis;
|
||||
private __pauser;
|
||||
render<T>(value: AsyncIterable<T>, _mapper?: Mapper<T>): symbol;
|
||||
update(_part: ChildPart, [value, mapper]: DirectiveParameters<this>): typeof noChange | undefined;
|
||||
protected commitValue(value: unknown, _index: number): void;
|
||||
disconnected(): void;
|
||||
reconnected(): void;
|
||||
}
|
||||
/**
|
||||
* A directive that renders the items of an async iterable[1], replacing
|
||||
* previous values with new values, so that only one value is ever rendered
|
||||
* at a time. This directive may be used in any expression type.
|
||||
*
|
||||
* Async iterables are objects with a `[Symbol.asyncIterator]` method, which
|
||||
* returns an iterator who's `next()` method returns a Promise. When a new
|
||||
* value is available, the Promise resolves and the value is rendered to the
|
||||
* Part controlled by the directive. If another value other than this
|
||||
* directive has been set on the Part, the iterable will no longer be listened
|
||||
* to and new values won't be written to the Part.
|
||||
*
|
||||
* [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
|
||||
*
|
||||
* @param value An async iterable
|
||||
* @param mapper An optional function that maps from (value, index) to another
|
||||
* value. Useful for generating templates for each item in the iterable.
|
||||
*/
|
||||
export declare const asyncReplace: (value: AsyncIterable<unknown>, _mapper?: Mapper<unknown> | undefined) => import("../directive.js").DirectiveResult<typeof AsyncReplaceDirective>;
|
||||
export {};
|
||||
//# sourceMappingURL=async-replace.d.ts.map
|
1
node_modules/lit-html/development/directives/async-replace.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/async-replace.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"async-replace.d.ts","sourceRoot":"","sources":["../../src/directives/async-replace.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACL,cAAc,EAEd,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAG/B,aAAK,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;AAEnD,qBAAa,qBAAsB,SAAQ,cAAc;IACvD,OAAO,CAAC,OAAO,CAAC,CAAyB;IACzC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,QAAQ,CAAgB;IAIhC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAI7C,MAAM,CACb,KAAK,EAAE,SAAS,EAChB,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC;IAqD5C,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;IAI3C,YAAY;IAKZ,WAAW;CAIrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,YAAY,mJAAmC,CAAC"}
|
100
node_modules/lit-html/development/directives/async-replace.js
generated
vendored
Normal file
100
node_modules/lit-html/development/directives/async-replace.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { noChange } from '../lit-html.js';
|
||||
import { AsyncDirective, directive, } from '../async-directive.js';
|
||||
import { Pauser, PseudoWeakRef, forAwaitOf } from './private-async-helpers.js';
|
||||
export class AsyncReplaceDirective extends AsyncDirective {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.__weakThis = new PseudoWeakRef(this);
|
||||
this.__pauser = new Pauser();
|
||||
}
|
||||
// @ts-expect-error value not used, but we want a nice parameter for docs
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
render(value, _mapper) {
|
||||
return noChange;
|
||||
}
|
||||
update(_part, [value, mapper]) {
|
||||
// If our initial render occurs while disconnected, ensure that the pauser
|
||||
// and weakThis are in the disconnected state
|
||||
if (!this.isConnected) {
|
||||
this.disconnected();
|
||||
}
|
||||
// If we've already set up this particular iterable, we don't need
|
||||
// to do anything.
|
||||
if (value === this.__value) {
|
||||
return;
|
||||
}
|
||||
this.__value = value;
|
||||
let i = 0;
|
||||
const { __weakThis: weakThis, __pauser: pauser } = this;
|
||||
// Note, the callback avoids closing over `this` so that the directive
|
||||
// can be gc'ed before the promise resolves; instead `this` is retrieved
|
||||
// from `weakThis`, which can break the hard reference in the closure when
|
||||
// the directive disconnects
|
||||
forAwaitOf(value, async (v) => {
|
||||
// The while loop here handles the case that the connection state
|
||||
// thrashes, causing the pauser to resume and then get re-paused
|
||||
while (pauser.get()) {
|
||||
await pauser.get();
|
||||
}
|
||||
// If the callback gets here and there is no `this`, it means that the
|
||||
// directive has been disconnected and garbage collected and we don't
|
||||
// need to do anything else
|
||||
const _this = weakThis.deref();
|
||||
if (_this !== undefined) {
|
||||
// Check to make sure that value is the still the current value of
|
||||
// the part, and if not bail because a new value owns this part
|
||||
if (_this.__value !== value) {
|
||||
return false;
|
||||
}
|
||||
// As a convenience, because functional-programming-style
|
||||
// transforms of iterables and async iterables requires a library,
|
||||
// we accept a mapper function. This is especially convenient for
|
||||
// rendering a template for each item.
|
||||
if (mapper !== undefined) {
|
||||
v = mapper(v, i);
|
||||
}
|
||||
_this.commitValue(v, i);
|
||||
i++;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return noChange;
|
||||
}
|
||||
// Override point for AsyncAppend to append rather than replace
|
||||
commitValue(value, _index) {
|
||||
this.setValue(value);
|
||||
}
|
||||
disconnected() {
|
||||
this.__weakThis.disconnect();
|
||||
this.__pauser.pause();
|
||||
}
|
||||
reconnected() {
|
||||
this.__weakThis.reconnect(this);
|
||||
this.__pauser.resume();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A directive that renders the items of an async iterable[1], replacing
|
||||
* previous values with new values, so that only one value is ever rendered
|
||||
* at a time. This directive may be used in any expression type.
|
||||
*
|
||||
* Async iterables are objects with a `[Symbol.asyncIterator]` method, which
|
||||
* returns an iterator who's `next()` method returns a Promise. When a new
|
||||
* value is available, the Promise resolves and the value is rendered to the
|
||||
* Part controlled by the directive. If another value other than this
|
||||
* directive has been set on the Part, the iterable will no longer be listened
|
||||
* to and new values won't be written to the Part.
|
||||
*
|
||||
* [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
|
||||
*
|
||||
* @param value An async iterable
|
||||
* @param mapper An optional function that maps from (value, index) to another
|
||||
* value. Useful for generating templates for each item in the iterable.
|
||||
*/
|
||||
export const asyncReplace = directive(AsyncReplaceDirective);
|
||||
//# sourceMappingURL=async-replace.js.map
|
1
node_modules/lit-html/development/directives/async-replace.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/async-replace.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
35
node_modules/lit-html/development/directives/cache.d.ts
generated
vendored
Normal file
35
node_modules/lit-html/development/directives/cache.d.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { ChildPart } from '../lit-html.js';
|
||||
import { Directive, DirectiveParameters, PartInfo } from '../directive.js';
|
||||
declare class CacheDirective extends Directive {
|
||||
private _templateCache;
|
||||
private _value?;
|
||||
constructor(partInfo: PartInfo);
|
||||
render(v: unknown): unknown[];
|
||||
update(containerPart: ChildPart, [v]: DirectiveParameters<this>): unknown[];
|
||||
}
|
||||
/**
|
||||
* Enables fast switching between multiple templates by caching the DOM nodes
|
||||
* and TemplateInstances produced by the templates.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* let checked = false;
|
||||
*
|
||||
* html`
|
||||
* ${cache(checked ? html`input is checked` : html`input is not checked`)}
|
||||
* `
|
||||
* ```
|
||||
*/
|
||||
export declare const cache: (v: unknown) => import("../directive.js").DirectiveResult<typeof CacheDirective>;
|
||||
/**
|
||||
* The type of the class that powers this directive. Necessary for naming the
|
||||
* directive's return type.
|
||||
*/
|
||||
export type { CacheDirective };
|
||||
//# sourceMappingURL=cache.d.ts.map
|
1
node_modules/lit-html/development/directives/cache.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/cache.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/directives/cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,SAAS,EAKV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACT,MAAM,iBAAiB,CAAC;AAoBzB,cAAM,cAAe,SAAQ,SAAS;IACpC,OAAO,CAAC,cAAc,CAAiD;IACvE,OAAO,CAAC,MAAM,CAAC,CAA0C;gBAE7C,QAAQ,EAAE,QAAQ;IAI9B,MAAM,CAAC,CAAC,EAAE,OAAO;IAMR,MAAM,CAAC,aAAa,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC;CAiDzE;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,kFAA4B,CAAC;AAE/C;;;GAGG;AACH,YAAY,EAAC,cAAc,EAAC,CAAC"}
|
88
node_modules/lit-html/development/directives/cache.js
generated
vendored
Normal file
88
node_modules/lit-html/development/directives/cache.js
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { render, nothing, } from '../lit-html.js';
|
||||
import { directive, Directive, } from '../directive.js';
|
||||
import { clearPart, getCommittedValue, insertPart, isCompiledTemplateResult, isTemplateResult, setCommittedValue, } from '../directive-helpers.js';
|
||||
/**
|
||||
* The template strings array contents are not compatible between the two
|
||||
* template result types as the compiled template contains a prepared string;
|
||||
* only use the returned template strings array as a cache key.
|
||||
*/
|
||||
const getStringsFromTemplateResult = (result) => isCompiledTemplateResult(result) ? result['_$litType$'].h : result.strings;
|
||||
class CacheDirective extends Directive {
|
||||
constructor(partInfo) {
|
||||
super(partInfo);
|
||||
this._templateCache = new WeakMap();
|
||||
}
|
||||
render(v) {
|
||||
// Return an array of the value to induce lit-html to create a ChildPart
|
||||
// for the value that we can move into the cache.
|
||||
return [v];
|
||||
}
|
||||
update(containerPart, [v]) {
|
||||
const _valueKey = isTemplateResult(this._value)
|
||||
? getStringsFromTemplateResult(this._value)
|
||||
: null;
|
||||
const vKey = isTemplateResult(v) ? getStringsFromTemplateResult(v) : null;
|
||||
// If the previous value is a TemplateResult and the new value is not,
|
||||
// or is a different Template as the previous value, move the child part
|
||||
// into the cache.
|
||||
if (_valueKey !== null && (vKey === null || _valueKey !== vKey)) {
|
||||
// This is always an array because we return [v] in render()
|
||||
const partValue = getCommittedValue(containerPart);
|
||||
const childPart = partValue.pop();
|
||||
let cachedContainerPart = this._templateCache.get(_valueKey);
|
||||
if (cachedContainerPart === undefined) {
|
||||
const fragment = document.createDocumentFragment();
|
||||
cachedContainerPart = render(nothing, fragment);
|
||||
cachedContainerPart.setConnected(false);
|
||||
this._templateCache.set(_valueKey, cachedContainerPart);
|
||||
}
|
||||
// Move into cache
|
||||
setCommittedValue(cachedContainerPart, [childPart]);
|
||||
insertPart(cachedContainerPart, undefined, childPart);
|
||||
}
|
||||
// If the new value is a TemplateResult and the previous value is not,
|
||||
// or is a different Template as the previous value, restore the child
|
||||
// part from the cache.
|
||||
if (vKey !== null) {
|
||||
if (_valueKey === null || _valueKey !== vKey) {
|
||||
const cachedContainerPart = this._templateCache.get(vKey);
|
||||
if (cachedContainerPart !== undefined) {
|
||||
// Move the cached part back into the container part value
|
||||
const partValue = getCommittedValue(cachedContainerPart);
|
||||
const cachedPart = partValue.pop();
|
||||
// Move cached part back into DOM
|
||||
clearPart(containerPart);
|
||||
insertPart(containerPart, undefined, cachedPart);
|
||||
setCommittedValue(containerPart, [cachedPart]);
|
||||
}
|
||||
}
|
||||
// Because vKey is non null, v must be a TemplateResult.
|
||||
this._value = v;
|
||||
}
|
||||
else {
|
||||
this._value = undefined;
|
||||
}
|
||||
return this.render(v);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Enables fast switching between multiple templates by caching the DOM nodes
|
||||
* and TemplateInstances produced by the templates.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* let checked = false;
|
||||
*
|
||||
* html`
|
||||
* ${cache(checked ? html`input is checked` : html`input is not checked`)}
|
||||
* `
|
||||
* ```
|
||||
*/
|
||||
export const cache = directive(CacheDirective);
|
||||
//# sourceMappingURL=cache.js.map
|
1
node_modules/lit-html/development/directives/cache.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/cache.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
32
node_modules/lit-html/development/directives/choose.d.ts
generated
vendored
Normal file
32
node_modules/lit-html/development/directives/choose.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
/**
|
||||
* Chooses and evaluates a template function from a list based on matching
|
||||
* the given `value` to a case.
|
||||
*
|
||||
* Cases are structured as `[caseValue, func]`. `value` is matched to
|
||||
* `caseValue` by strict equality. The first match is selected. Case values
|
||||
* can be of any type including primitives, objects, and symbols.
|
||||
*
|
||||
* This is similar to a switch statement, but as an expression and without
|
||||
* fallthrough.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* render() {
|
||||
* return html`
|
||||
* ${choose(this.section, [
|
||||
* ['home', () => html`<h1>Home</h1>`],
|
||||
* ['about', () => html`<h1>About</h1>`]
|
||||
* ],
|
||||
* () => html`<h1>Error</h1>`)}
|
||||
* `;
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export declare const choose: <T, V>(value: T, cases: [T, () => V][], defaultCase?: (() => V) | undefined) => V | undefined;
|
||||
//# sourceMappingURL=choose.d.ts.map
|
1
node_modules/lit-html/development/directives/choose.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/choose.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"choose.d.ts","sourceRoot":"","sources":["../../src/directives/choose.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,MAAM,+FAalB,CAAC"}
|
41
node_modules/lit-html/development/directives/choose.js
generated
vendored
Normal file
41
node_modules/lit-html/development/directives/choose.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
/**
|
||||
* Chooses and evaluates a template function from a list based on matching
|
||||
* the given `value` to a case.
|
||||
*
|
||||
* Cases are structured as `[caseValue, func]`. `value` is matched to
|
||||
* `caseValue` by strict equality. The first match is selected. Case values
|
||||
* can be of any type including primitives, objects, and symbols.
|
||||
*
|
||||
* This is similar to a switch statement, but as an expression and without
|
||||
* fallthrough.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* render() {
|
||||
* return html`
|
||||
* ${choose(this.section, [
|
||||
* ['home', () => html`<h1>Home</h1>`],
|
||||
* ['about', () => html`<h1>About</h1>`]
|
||||
* ],
|
||||
* () => html`<h1>Error</h1>`)}
|
||||
* `;
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export const choose = (value, cases, defaultCase) => {
|
||||
for (const c of cases) {
|
||||
const caseValue = c[0];
|
||||
if (caseValue === value) {
|
||||
const fn = c[1];
|
||||
return fn();
|
||||
}
|
||||
}
|
||||
return defaultCase === null || defaultCase === void 0 ? void 0 : defaultCase();
|
||||
};
|
||||
//# sourceMappingURL=choose.js.map
|
1
node_modules/lit-html/development/directives/choose.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/choose.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"choose.js","sourceRoot":"","sources":["../../src/directives/choose.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,KAAQ,EACR,KAA0B,EAC1B,WAAqB,EACrB,EAAE;IACF,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE;QACrB,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,SAAS,KAAK,KAAK,EAAE;YACvB,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAChB,OAAO,EAAE,EAAE,CAAC;SACb;KACF;IACD,OAAO,WAAW,aAAX,WAAW,uBAAX,WAAW,EAAI,CAAC;AACzB,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Chooses and evaluates a template function from a list based on matching\n * the given `value` to a case.\n *\n * Cases are structured as `[caseValue, func]`. `value` is matched to\n * `caseValue` by strict equality. The first match is selected. Case values\n * can be of any type including primitives, objects, and symbols.\n *\n * This is similar to a switch statement, but as an expression and without\n * fallthrough.\n *\n * @example\n *\n * ```ts\n * render() {\n * return html`\n * ${choose(this.section, [\n * ['home', () => html`<h1>Home</h1>`],\n * ['about', () => html`<h1>About</h1>`]\n * ],\n * () => html`<h1>Error</h1>`)}\n * `;\n * }\n * ```\n */\nexport const choose = <T, V>(\n value: T,\n cases: Array<[T, () => V]>,\n defaultCase?: () => V\n) => {\n for (const c of cases) {\n const caseValue = c[0];\n if (caseValue === value) {\n const fn = c[1];\n return fn();\n }\n }\n return defaultCase?.();\n};\n"]}
|
45
node_modules/lit-html/development/directives/class-map.d.ts
generated
vendored
Normal file
45
node_modules/lit-html/development/directives/class-map.d.ts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { AttributePart, noChange } from '../lit-html.js';
|
||||
import { Directive, DirectiveParameters, PartInfo } from '../directive.js';
|
||||
/**
|
||||
* A key-value set of class names to truthy values.
|
||||
*/
|
||||
export interface ClassInfo {
|
||||
readonly [name: string]: string | boolean | number;
|
||||
}
|
||||
declare class ClassMapDirective extends Directive {
|
||||
/**
|
||||
* Stores the ClassInfo object applied to a given AttributePart.
|
||||
* Used to unset existing values when a new ClassInfo object is applied.
|
||||
*/
|
||||
private _previousClasses?;
|
||||
private _staticClasses?;
|
||||
constructor(partInfo: PartInfo);
|
||||
render(classInfo: ClassInfo): string;
|
||||
update(part: AttributePart, [classInfo]: DirectiveParameters<this>): string | typeof noChange;
|
||||
}
|
||||
/**
|
||||
* A directive that applies dynamic CSS classes.
|
||||
*
|
||||
* This must be used in the `class` attribute and must be the only part used in
|
||||
* the attribute. It takes each property in the `classInfo` argument and adds
|
||||
* the property name to the element's `classList` if the property value is
|
||||
* truthy; if the property value is falsey, the property name is removed from
|
||||
* the element's `class`.
|
||||
*
|
||||
* For example `{foo: bar}` applies the class `foo` if the value of `bar` is
|
||||
* truthy.
|
||||
*
|
||||
* @param classInfo
|
||||
*/
|
||||
export declare const classMap: (classInfo: ClassInfo) => import("../directive.js").DirectiveResult<typeof ClassMapDirective>;
|
||||
/**
|
||||
* The type of the class that powers this directive. Necessary for naming the
|
||||
* directive's return type.
|
||||
*/
|
||||
export type { ClassMapDirective };
|
||||
//# sourceMappingURL=class-map.d.ts.map
|
1
node_modules/lit-html/development/directives/class-map.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/class-map.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"class-map.d.ts","sourceRoot":"","sources":["../../src/directives/class-map.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAEL,SAAS,EACT,mBAAmB,EACnB,QAAQ,EAET,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;CACpD;AAED,cAAM,iBAAkB,SAAQ,SAAS;IACvC;;;OAGG;IACH,OAAO,CAAC,gBAAgB,CAAC,CAAc;IACvC,OAAO,CAAC,cAAc,CAAC,CAAc;gBAEzB,QAAQ,EAAE,QAAQ;IAc9B,MAAM,CAAC,SAAS,EAAE,SAAS;IAWlB,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,SAAS,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC;CAoD5E;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,+FAA+B,CAAC;AAErD;;;GAGG;AACH,YAAY,EAAC,iBAAiB,EAAC,CAAC"}
|
90
node_modules/lit-html/development/directives/class-map.js
generated
vendored
Normal file
90
node_modules/lit-html/development/directives/class-map.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { noChange } from '../lit-html.js';
|
||||
import { directive, Directive, PartType, } from '../directive.js';
|
||||
class ClassMapDirective extends Directive {
|
||||
constructor(partInfo) {
|
||||
var _a;
|
||||
super(partInfo);
|
||||
if (partInfo.type !== PartType.ATTRIBUTE ||
|
||||
partInfo.name !== 'class' ||
|
||||
((_a = partInfo.strings) === null || _a === void 0 ? void 0 : _a.length) > 2) {
|
||||
throw new Error('`classMap()` can only be used in the `class` attribute ' +
|
||||
'and must be the only part in the attribute.');
|
||||
}
|
||||
}
|
||||
render(classInfo) {
|
||||
// Add spaces to ensure separation from static classes
|
||||
return (' ' +
|
||||
Object.keys(classInfo)
|
||||
.filter((key) => classInfo[key])
|
||||
.join(' ') +
|
||||
' ');
|
||||
}
|
||||
update(part, [classInfo]) {
|
||||
var _a, _b;
|
||||
// Remember dynamic classes on the first render
|
||||
if (this._previousClasses === undefined) {
|
||||
this._previousClasses = new Set();
|
||||
if (part.strings !== undefined) {
|
||||
this._staticClasses = new Set(part.strings
|
||||
.join(' ')
|
||||
.split(/\s/)
|
||||
.filter((s) => s !== ''));
|
||||
}
|
||||
for (const name in classInfo) {
|
||||
if (classInfo[name] && !((_a = this._staticClasses) === null || _a === void 0 ? void 0 : _a.has(name))) {
|
||||
this._previousClasses.add(name);
|
||||
}
|
||||
}
|
||||
return this.render(classInfo);
|
||||
}
|
||||
const classList = part.element.classList;
|
||||
// Remove old classes that no longer apply
|
||||
// We use forEach() instead of for-of so that we don't require down-level
|
||||
// iteration.
|
||||
this._previousClasses.forEach((name) => {
|
||||
if (!(name in classInfo)) {
|
||||
classList.remove(name);
|
||||
this._previousClasses.delete(name);
|
||||
}
|
||||
});
|
||||
// Add or remove classes based on their classMap value
|
||||
for (const name in classInfo) {
|
||||
// We explicitly want a loose truthy check of `value` because it seems
|
||||
// more convenient that '' and 0 are skipped.
|
||||
const value = !!classInfo[name];
|
||||
if (value !== this._previousClasses.has(name) &&
|
||||
!((_b = this._staticClasses) === null || _b === void 0 ? void 0 : _b.has(name))) {
|
||||
if (value) {
|
||||
classList.add(name);
|
||||
this._previousClasses.add(name);
|
||||
}
|
||||
else {
|
||||
classList.remove(name);
|
||||
this._previousClasses.delete(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return noChange;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A directive that applies dynamic CSS classes.
|
||||
*
|
||||
* This must be used in the `class` attribute and must be the only part used in
|
||||
* the attribute. It takes each property in the `classInfo` argument and adds
|
||||
* the property name to the element's `classList` if the property value is
|
||||
* truthy; if the property value is falsey, the property name is removed from
|
||||
* the element's `class`.
|
||||
*
|
||||
* For example `{foo: bar}` applies the class `foo` if the value of `bar` is
|
||||
* truthy.
|
||||
*
|
||||
* @param classInfo
|
||||
*/
|
||||
export const classMap = directive(ClassMapDirective);
|
||||
//# sourceMappingURL=class-map.js.map
|
1
node_modules/lit-html/development/directives/class-map.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/class-map.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
60
node_modules/lit-html/development/directives/guard.d.ts
generated
vendored
Normal file
60
node_modules/lit-html/development/directives/guard.d.ts
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { Part } from '../lit-html.js';
|
||||
import { Directive, DirectiveParameters } from '../directive.js';
|
||||
declare class GuardDirective extends Directive {
|
||||
private _previousValue;
|
||||
render(_value: unknown, f: () => unknown): unknown;
|
||||
update(_part: Part, [value, f]: DirectiveParameters<this>): unknown;
|
||||
}
|
||||
/**
|
||||
* Prevents re-render of a template function until a single value or an array of
|
||||
* values changes.
|
||||
*
|
||||
* Values are checked against previous values with strict equality (`===`), and
|
||||
* so the check won't detect nested property changes inside objects or arrays.
|
||||
* Arrays values have each item checked against the previous value at the same
|
||||
* index with strict equality. Nested arrays are also checked only by strict
|
||||
* equality.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* html`
|
||||
* <div>
|
||||
* ${guard([user.id, company.id], () => html`...`)}
|
||||
* </div>
|
||||
* `
|
||||
* ```
|
||||
*
|
||||
* In this case, the template only rerenders if either `user.id` or `company.id`
|
||||
* changes.
|
||||
*
|
||||
* guard() is useful with immutable data patterns, by preventing expensive work
|
||||
* until data updates.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* html`
|
||||
* <div>
|
||||
* ${guard([immutableItems], () => immutableItems.map(i => html`${i}`))}
|
||||
* </div>
|
||||
* `
|
||||
* ```
|
||||
*
|
||||
* In this case, items are mapped over only when the array reference changes.
|
||||
*
|
||||
* @param value the value to check before re-rendering
|
||||
* @param f the template function
|
||||
*/
|
||||
export declare const guard: (_value: unknown, f: () => unknown) => import("../directive.js").DirectiveResult<typeof GuardDirective>;
|
||||
/**
|
||||
* The type of the class that powers this directive. Necessary for naming the
|
||||
* directive's return type.
|
||||
*/
|
||||
export type { GuardDirective };
|
||||
//# sourceMappingURL=guard.d.ts.map
|
1
node_modules/lit-html/development/directives/guard.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/guard.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../src/directives/guard.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAW,IAAI,EAAC,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAY,SAAS,EAAE,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AAK1E,cAAM,cAAe,SAAQ,SAAS;IACpC,OAAO,CAAC,cAAc,CAAyB;IAE/C,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,OAAO;IAI/B,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC;CAqBnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,KAAK,6BApEiB,OAAO,qEAoEI,CAAC;AAE/C;;;GAGG;AACH,YAAY,EAAC,cAAc,EAAC,CAAC"}
|
80
node_modules/lit-html/development/directives/guard.js
generated
vendored
Normal file
80
node_modules/lit-html/development/directives/guard.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { noChange } from '../lit-html.js';
|
||||
import { directive, Directive } from '../directive.js';
|
||||
// A sentinel that indicates guard() hasn't rendered anything yet
|
||||
const initialValue = {};
|
||||
class GuardDirective extends Directive {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._previousValue = initialValue;
|
||||
}
|
||||
render(_value, f) {
|
||||
return f();
|
||||
}
|
||||
update(_part, [value, f]) {
|
||||
if (Array.isArray(value)) {
|
||||
// Dirty-check arrays by item
|
||||
if (Array.isArray(this._previousValue) &&
|
||||
this._previousValue.length === value.length &&
|
||||
value.every((v, i) => v === this._previousValue[i])) {
|
||||
return noChange;
|
||||
}
|
||||
}
|
||||
else if (this._previousValue === value) {
|
||||
// Dirty-check non-arrays by identity
|
||||
return noChange;
|
||||
}
|
||||
// Copy the value if it's an array so that if it's mutated we don't forget
|
||||
// what the previous values were.
|
||||
this._previousValue = Array.isArray(value) ? Array.from(value) : value;
|
||||
const r = this.render(value, f);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Prevents re-render of a template function until a single value or an array of
|
||||
* values changes.
|
||||
*
|
||||
* Values are checked against previous values with strict equality (`===`), and
|
||||
* so the check won't detect nested property changes inside objects or arrays.
|
||||
* Arrays values have each item checked against the previous value at the same
|
||||
* index with strict equality. Nested arrays are also checked only by strict
|
||||
* equality.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* html`
|
||||
* <div>
|
||||
* ${guard([user.id, company.id], () => html`...`)}
|
||||
* </div>
|
||||
* `
|
||||
* ```
|
||||
*
|
||||
* In this case, the template only rerenders if either `user.id` or `company.id`
|
||||
* changes.
|
||||
*
|
||||
* guard() is useful with immutable data patterns, by preventing expensive work
|
||||
* until data updates.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* html`
|
||||
* <div>
|
||||
* ${guard([immutableItems], () => immutableItems.map(i => html`${i}`))}
|
||||
* </div>
|
||||
* `
|
||||
* ```
|
||||
*
|
||||
* In this case, items are mapped over only when the array reference changes.
|
||||
*
|
||||
* @param value the value to check before re-rendering
|
||||
* @param f the template function
|
||||
*/
|
||||
export const guard = directive(GuardDirective);
|
||||
//# sourceMappingURL=guard.js.map
|
1
node_modules/lit-html/development/directives/guard.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/guard.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"guard.js","sourceRoot":"","sources":["../../src/directives/guard.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,QAAQ,EAAO,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAC,SAAS,EAAE,SAAS,EAAsB,MAAM,iBAAiB,CAAC;AAE1E,iEAAiE;AACjE,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,MAAM,cAAe,SAAQ,SAAS;IAAtC;;QACU,mBAAc,GAAY,YAAY,CAAC;IA2BjD,CAAC;IAzBC,MAAM,CAAC,MAAe,EAAE,CAAgB;QACtC,OAAO,CAAC,EAAE,CAAC;IACb,CAAC;IAEQ,MAAM,CAAC,KAAW,EAAE,CAAC,KAAK,EAAE,CAAC,CAA4B;QAChE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,6BAA6B;YAC7B,IACE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC;gBAClC,IAAI,CAAC,cAAc,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;gBAC3C,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAM,IAAI,CAAC,cAAiC,CAAC,CAAC,CAAC,CAAC,EACvE;gBACA,OAAO,QAAQ,CAAC;aACjB;SACF;aAAM,IAAI,IAAI,CAAC,cAAc,KAAK,KAAK,EAAE;YACxC,qCAAqC;YACrC,OAAO,QAAQ,CAAC;SACjB;QAED,0EAA0E;QAC1E,iCAAiC;QACjC,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACvE,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAChC,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {noChange, Part} from '../lit-html.js';\nimport {directive, Directive, DirectiveParameters} from '../directive.js';\n\n// A sentinel that indicates guard() hasn't rendered anything yet\nconst initialValue = {};\n\nclass GuardDirective extends Directive {\n private _previousValue: unknown = initialValue;\n\n render(_value: unknown, f: () => unknown) {\n return f();\n }\n\n override update(_part: Part, [value, f]: DirectiveParameters<this>) {\n if (Array.isArray(value)) {\n // Dirty-check arrays by item\n if (\n Array.isArray(this._previousValue) &&\n this._previousValue.length === value.length &&\n value.every((v, i) => v === (this._previousValue as Array<unknown>)[i])\n ) {\n return noChange;\n }\n } else if (this._previousValue === value) {\n // Dirty-check non-arrays by identity\n return noChange;\n }\n\n // Copy the value if it's an array so that if it's mutated we don't forget\n // what the previous values were.\n this._previousValue = Array.isArray(value) ? Array.from(value) : value;\n const r = this.render(value, f);\n return r;\n }\n}\n\n/**\n * Prevents re-render of a template function until a single value or an array of\n * values changes.\n *\n * Values are checked against previous values with strict equality (`===`), and\n * so the check won't detect nested property changes inside objects or arrays.\n * Arrays values have each item checked against the previous value at the same\n * index with strict equality. Nested arrays are also checked only by strict\n * equality.\n *\n * Example:\n *\n * ```js\n * html`\n * <div>\n * ${guard([user.id, company.id], () => html`...`)}\n * </div>\n * `\n * ```\n *\n * In this case, the template only rerenders if either `user.id` or `company.id`\n * changes.\n *\n * guard() is useful with immutable data patterns, by preventing expensive work\n * until data updates.\n *\n * Example:\n *\n * ```js\n * html`\n * <div>\n * ${guard([immutableItems], () => immutableItems.map(i => html`${i}`))}\n * </div>\n * `\n * ```\n *\n * In this case, items are mapped over only when the array reference changes.\n *\n * @param value the value to check before re-rendering\n * @param f the template function\n */\nexport const guard = directive(GuardDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {GuardDirective};\n"]}
|
14
node_modules/lit-html/development/directives/if-defined.d.ts
generated
vendored
Normal file
14
node_modules/lit-html/development/directives/if-defined.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { nothing } from '../lit-html.js';
|
||||
/**
|
||||
* For AttributeParts, sets the attribute if the value is defined and removes
|
||||
* the attribute if the value is undefined.
|
||||
*
|
||||
* For other part types, this directive is a no-op.
|
||||
*/
|
||||
export declare const ifDefined: <T>(value: T) => typeof nothing | NonNullable<T>;
|
||||
//# sourceMappingURL=if-defined.d.ts.map
|
1
node_modules/lit-html/development/directives/if-defined.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/if-defined.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"if-defined.d.ts","sourceRoot":"","sources":["../../src/directives/if-defined.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,SAAS,kDAAoC,CAAC"}
|
14
node_modules/lit-html/development/directives/if-defined.js
generated
vendored
Normal file
14
node_modules/lit-html/development/directives/if-defined.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { nothing } from '../lit-html.js';
|
||||
/**
|
||||
* For AttributeParts, sets the attribute if the value is defined and removes
|
||||
* the attribute if the value is undefined.
|
||||
*
|
||||
* For other part types, this directive is a no-op.
|
||||
*/
|
||||
export const ifDefined = (value) => value !== null && value !== void 0 ? value : nothing;
|
||||
//# sourceMappingURL=if-defined.js.map
|
1
node_modules/lit-html/development/directives/if-defined.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/if-defined.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"if-defined.js","sourceRoot":"","sources":["../../src/directives/if-defined.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAI,KAAQ,EAAE,EAAE,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,OAAO,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {nothing} from '../lit-html.js';\n\n/**\n * For AttributeParts, sets the attribute if the value is defined and removes\n * the attribute if the value is undefined.\n *\n * For other part types, this directive is a no-op.\n */\nexport const ifDefined = <T>(value: T) => value ?? nothing;\n"]}
|
21
node_modules/lit-html/development/directives/join.d.ts
generated
vendored
Normal file
21
node_modules/lit-html/development/directives/join.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
/**
|
||||
* Returns an iterable containing the values in `items` interleaved with the
|
||||
* `joiner` value.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* render() {
|
||||
* return html`
|
||||
* ${join(items, html`<span class="separator">|</span>`)}
|
||||
* `;
|
||||
* }
|
||||
*/
|
||||
export declare function join<I, J>(items: Iterable<I> | undefined, joiner: (index: number) => J): Iterable<I | J>;
|
||||
export declare function join<I, J>(items: Iterable<I> | undefined, joiner: J): Iterable<I | J>;
|
||||
//# sourceMappingURL=join.d.ts.map
|
1
node_modules/lit-html/development/directives/join.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/join.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"join.d.ts","sourceRoot":"","sources":["../../src/directives/join.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,EACvB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,EAC9B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC,GAC3B,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACnB,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,EACvB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,EAC9B,MAAM,EAAE,CAAC,GACR,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC"}
|
19
node_modules/lit-html/development/directives/join.js
generated
vendored
Normal file
19
node_modules/lit-html/development/directives/join.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
export function* join(items, joiner) {
|
||||
const isFunction = typeof joiner === 'function';
|
||||
if (items !== undefined) {
|
||||
let i = -1;
|
||||
for (const value of items) {
|
||||
if (i > -1) {
|
||||
yield isFunction ? joiner(i) : joiner;
|
||||
}
|
||||
i++;
|
||||
yield value;
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=join.js.map
|
1
node_modules/lit-html/development/directives/join.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/join.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"join.js","sourceRoot":"","sources":["../../src/directives/join.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAuBH,MAAM,SAAS,CAAC,CAAC,IAAI,CAAO,KAA8B,EAAE,MAAS;IACnE,MAAM,UAAU,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC;IAChD,IAAI,KAAK,KAAK,SAAS,EAAE;QACvB,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACX,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE;YACzB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE;gBACV,MAAM,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;aACvC;YACD,CAAC,EAAE,CAAC;YACJ,MAAM,KAAK,CAAC;SACb;KACF;AACH,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Returns an iterable containing the values in `items` interleaved with the\n * `joiner` value.\n *\n * @example\n *\n * ```ts\n * render() {\n * return html`\n * ${join(items, html`<span class=\"separator\">|</span>`)}\n * `;\n * }\n */\nexport function join<I, J>(\n items: Iterable<I> | undefined,\n joiner: (index: number) => J\n): Iterable<I | J>;\nexport function join<I, J>(\n items: Iterable<I> | undefined,\n joiner: J\n): Iterable<I | J>;\nexport function* join<I, J>(items: Iterable<I> | undefined, joiner: J) {\n const isFunction = typeof joiner === 'function';\n if (items !== undefined) {\n let i = -1;\n for (const value of items) {\n if (i > -1) {\n yield isFunction ? joiner(i) : joiner;\n }\n i++;\n yield value;\n }\n }\n}\n"]}
|
27
node_modules/lit-html/development/directives/keyed.d.ts
generated
vendored
Normal file
27
node_modules/lit-html/development/directives/keyed.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { Directive, ChildPart, DirectiveParameters } from '../directive.js';
|
||||
declare class Keyed extends Directive {
|
||||
key: unknown;
|
||||
render(k: unknown, v: unknown): unknown;
|
||||
update(part: ChildPart, [k, v]: DirectiveParameters<this>): unknown;
|
||||
}
|
||||
/**
|
||||
* Associates a renderable value with a unique key. When the key changes, the
|
||||
* previous DOM is removed and disposed before rendering the next value, even
|
||||
* if the value - such as a template - is the same.
|
||||
*
|
||||
* This is useful for forcing re-renders of stateful components, or working
|
||||
* with code that expects new data to generate new HTML elements, such as some
|
||||
* animation techniques.
|
||||
*/
|
||||
export declare const keyed: (k: unknown, v: unknown) => import("../directive.js").DirectiveResult<typeof Keyed>;
|
||||
/**
|
||||
* The type of the class that powers this directive. Necessary for naming the
|
||||
* directive's return type.
|
||||
*/
|
||||
export type { Keyed };
|
||||
//# sourceMappingURL=keyed.d.ts.map
|
1
node_modules/lit-html/development/directives/keyed.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/keyed.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"keyed.d.ts","sourceRoot":"","sources":["../../src/directives/keyed.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAEL,SAAS,EACT,SAAS,EACT,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AAGzB,cAAM,KAAM,SAAQ,SAAS;IAC3B,GAAG,EAAE,OAAO,CAAW;IAEvB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO;IAKpB,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC;CAUnE;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,KAAK,qFAAmB,CAAC;AAEtC;;;GAGG;AACH,YAAY,EAAC,KAAK,EAAC,CAAC"}
|
39
node_modules/lit-html/development/directives/keyed.js
generated
vendored
Normal file
39
node_modules/lit-html/development/directives/keyed.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { nothing } from '../lit-html.js';
|
||||
import { directive, Directive, } from '../directive.js';
|
||||
import { setCommittedValue } from '../directive-helpers.js';
|
||||
class Keyed extends Directive {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.key = nothing;
|
||||
}
|
||||
render(k, v) {
|
||||
this.key = k;
|
||||
return v;
|
||||
}
|
||||
update(part, [k, v]) {
|
||||
if (k !== this.key) {
|
||||
// Clear the part before returning a value. The one-arg form of
|
||||
// setCommittedValue sets the value to a sentinel which forces a
|
||||
// commit the next render.
|
||||
setCommittedValue(part);
|
||||
this.key = k;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Associates a renderable value with a unique key. When the key changes, the
|
||||
* previous DOM is removed and disposed before rendering the next value, even
|
||||
* if the value - such as a template - is the same.
|
||||
*
|
||||
* This is useful for forcing re-renders of stateful components, or working
|
||||
* with code that expects new data to generate new HTML elements, such as some
|
||||
* animation techniques.
|
||||
*/
|
||||
export const keyed = directive(Keyed);
|
||||
//# sourceMappingURL=keyed.js.map
|
1
node_modules/lit-html/development/directives/keyed.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/keyed.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"keyed.js","sourceRoot":"","sources":["../../src/directives/keyed.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,SAAS,EACT,SAAS,GAGV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAE1D,MAAM,KAAM,SAAQ,SAAS;IAA7B;;QACE,QAAG,GAAY,OAAO,CAAC;IAiBzB,CAAC;IAfC,MAAM,CAAC,CAAU,EAAE,CAAU;QAC3B,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;QACb,OAAO,CAAC,CAAC;IACX,CAAC;IAEQ,MAAM,CAAC,IAAe,EAAE,CAAC,CAAC,EAAE,CAAC,CAA4B;QAChE,IAAI,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE;YAClB,+DAA+D;YAC/D,gEAAgE;YAChE,0BAA0B;YAC1B,iBAAiB,CAAC,IAAI,CAAC,CAAC;YACxB,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;SACd;QACD,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {nothing} from '../lit-html.js';\nimport {\n directive,\n Directive,\n ChildPart,\n DirectiveParameters,\n} from '../directive.js';\nimport {setCommittedValue} from '../directive-helpers.js';\n\nclass Keyed extends Directive {\n key: unknown = nothing;\n\n render(k: unknown, v: unknown) {\n this.key = k;\n return v;\n }\n\n override update(part: ChildPart, [k, v]: DirectiveParameters<this>) {\n if (k !== this.key) {\n // Clear the part before returning a value. The one-arg form of\n // setCommittedValue sets the value to a sentinel which forces a\n // commit the next render.\n setCommittedValue(part);\n this.key = k;\n }\n return v;\n }\n}\n\n/**\n * Associates a renderable value with a unique key. When the key changes, the\n * previous DOM is removed and disposed before rendering the next value, even\n * if the value - such as a template - is the same.\n *\n * This is useful for forcing re-renders of stateful components, or working\n * with code that expects new data to generate new HTML elements, such as some\n * animation techniques.\n */\nexport const keyed = directive(Keyed);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {Keyed};\n"]}
|
43
node_modules/lit-html/development/directives/live.d.ts
generated
vendored
Normal file
43
node_modules/lit-html/development/directives/live.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { AttributePart } from '../lit-html.js';
|
||||
import { Directive, DirectiveParameters, PartInfo } from '../directive.js';
|
||||
declare class LiveDirective extends Directive {
|
||||
constructor(partInfo: PartInfo);
|
||||
render(value: unknown): unknown;
|
||||
update(part: AttributePart, [value]: DirectiveParameters<this>): unknown;
|
||||
}
|
||||
/**
|
||||
* Checks binding values against live DOM values, instead of previously bound
|
||||
* values, when determining whether to update the value.
|
||||
*
|
||||
* This is useful for cases where the DOM value may change from outside of
|
||||
* lit-html, such as with a binding to an `<input>` element's `value` property,
|
||||
* a content editable elements text, or to a custom element that changes it's
|
||||
* own properties or attributes.
|
||||
*
|
||||
* In these cases if the DOM value changes, but the value set through lit-html
|
||||
* bindings hasn't, lit-html won't know to update the DOM value and will leave
|
||||
* it alone. If this is not what you want--if you want to overwrite the DOM
|
||||
* value with the bound value no matter what--use the `live()` directive:
|
||||
*
|
||||
* ```js
|
||||
* html`<input .value=${live(x)}>`
|
||||
* ```
|
||||
*
|
||||
* `live()` performs a strict equality check against the live DOM value, and if
|
||||
* the new value is equal to the live value, does nothing. This means that
|
||||
* `live()` should not be used when the binding will cause a type conversion. If
|
||||
* you use `live()` with an attribute binding, make sure that only strings are
|
||||
* passed in, or the binding will update every render.
|
||||
*/
|
||||
export declare const live: (value: unknown) => import("../directive.js").DirectiveResult<typeof LiveDirective>;
|
||||
/**
|
||||
* The type of the class that powers this directive. Necessary for naming the
|
||||
* directive's return type.
|
||||
*/
|
||||
export type { LiveDirective };
|
||||
//# sourceMappingURL=live.d.ts.map
|
1
node_modules/lit-html/development/directives/live.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/live.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../../src/directives/live.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,aAAa,EAAoB,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAEL,SAAS,EACT,mBAAmB,EACnB,QAAQ,EAET,MAAM,iBAAiB,CAAC;AAGzB,cAAM,aAAc,SAAQ,SAAS;gBACvB,QAAQ,EAAE,QAAQ;IAkB9B,MAAM,CAAC,KAAK,EAAE,OAAO;IAIZ,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC;CA0BxE;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,IAAI,qFAA2B,CAAC;AAE7C;;;GAGG;AACH,YAAY,EAAC,aAAa,EAAC,CAAC"}
|
77
node_modules/lit-html/development/directives/live.js
generated
vendored
Normal file
77
node_modules/lit-html/development/directives/live.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { noChange, nothing } from '../lit-html.js';
|
||||
import { directive, Directive, PartType, } from '../directive.js';
|
||||
import { isSingleExpression, setCommittedValue } from '../directive-helpers.js';
|
||||
class LiveDirective extends Directive {
|
||||
constructor(partInfo) {
|
||||
super(partInfo);
|
||||
if (!(partInfo.type === PartType.PROPERTY ||
|
||||
partInfo.type === PartType.ATTRIBUTE ||
|
||||
partInfo.type === PartType.BOOLEAN_ATTRIBUTE)) {
|
||||
throw new Error('The `live` directive is not allowed on child or event bindings');
|
||||
}
|
||||
if (!isSingleExpression(partInfo)) {
|
||||
throw new Error('`live` bindings can only contain a single expression');
|
||||
}
|
||||
}
|
||||
render(value) {
|
||||
return value;
|
||||
}
|
||||
update(part, [value]) {
|
||||
if (value === noChange || value === nothing) {
|
||||
return value;
|
||||
}
|
||||
const element = part.element;
|
||||
const name = part.name;
|
||||
if (part.type === PartType.PROPERTY) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
if (value === element[name]) {
|
||||
return noChange;
|
||||
}
|
||||
}
|
||||
else if (part.type === PartType.BOOLEAN_ATTRIBUTE) {
|
||||
if (!!value === element.hasAttribute(name)) {
|
||||
return noChange;
|
||||
}
|
||||
}
|
||||
else if (part.type === PartType.ATTRIBUTE) {
|
||||
if (element.getAttribute(name) === String(value)) {
|
||||
return noChange;
|
||||
}
|
||||
}
|
||||
// Resets the part's value, causing its dirty-check to fail so that it
|
||||
// always sets the value.
|
||||
setCommittedValue(part);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Checks binding values against live DOM values, instead of previously bound
|
||||
* values, when determining whether to update the value.
|
||||
*
|
||||
* This is useful for cases where the DOM value may change from outside of
|
||||
* lit-html, such as with a binding to an `<input>` element's `value` property,
|
||||
* a content editable elements text, or to a custom element that changes it's
|
||||
* own properties or attributes.
|
||||
*
|
||||
* In these cases if the DOM value changes, but the value set through lit-html
|
||||
* bindings hasn't, lit-html won't know to update the DOM value and will leave
|
||||
* it alone. If this is not what you want--if you want to overwrite the DOM
|
||||
* value with the bound value no matter what--use the `live()` directive:
|
||||
*
|
||||
* ```js
|
||||
* html`<input .value=${live(x)}>`
|
||||
* ```
|
||||
*
|
||||
* `live()` performs a strict equality check against the live DOM value, and if
|
||||
* the new value is equal to the live value, does nothing. This means that
|
||||
* `live()` should not be used when the binding will cause a type conversion. If
|
||||
* you use `live()` with an attribute binding, make sure that only strings are
|
||||
* passed in, or the binding will update every render.
|
||||
*/
|
||||
export const live = directive(LiveDirective);
|
||||
//# sourceMappingURL=live.js.map
|
1
node_modules/lit-html/development/directives/live.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/live.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"live.js","sourceRoot":"","sources":["../../src/directives/live.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAgB,QAAQ,EAAE,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAChE,OAAO,EACL,SAAS,EACT,SAAS,EAGT,QAAQ,GACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAE9E,MAAM,aAAc,SAAQ,SAAS;IACnC,YAAY,QAAkB;QAC5B,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IACE,CAAC,CACC,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,QAAQ;YACnC,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,SAAS;YACpC,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,iBAAiB,CAC7C,EACD;YACA,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;SACH;QACD,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE;YACjC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;SACzE;IACH,CAAC;IAED,MAAM,CAAC,KAAc;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IAEQ,MAAM,CAAC,IAAmB,EAAE,CAAC,KAAK,CAA4B;QACrE,IAAI,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,OAAO,EAAE;YAC3C,OAAO,KAAK,CAAC;SACd;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,QAAQ,EAAE;YACnC,8DAA8D;YAC9D,IAAI,KAAK,KAAM,OAAe,CAAC,IAAI,CAAC,EAAE;gBACpC,OAAO,QAAQ,CAAC;aACjB;SACF;aAAM,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,iBAAiB,EAAE;YACnD,IAAI,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;gBAC1C,OAAO,QAAQ,CAAC;aACjB;SACF;aAAM,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,SAAS,EAAE;YAC3C,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE;gBAChD,OAAO,QAAQ,CAAC;aACjB;SACF;QACD,sEAAsE;QACtE,yBAAyB;QACzB,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,SAAS,CAAC,aAAa,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {AttributePart, noChange, nothing} from '../lit-html.js';\nimport {\n directive,\n Directive,\n DirectiveParameters,\n PartInfo,\n PartType,\n} from '../directive.js';\nimport {isSingleExpression, setCommittedValue} from '../directive-helpers.js';\n\nclass LiveDirective extends Directive {\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (\n !(\n partInfo.type === PartType.PROPERTY ||\n partInfo.type === PartType.ATTRIBUTE ||\n partInfo.type === PartType.BOOLEAN_ATTRIBUTE\n )\n ) {\n throw new Error(\n 'The `live` directive is not allowed on child or event bindings'\n );\n }\n if (!isSingleExpression(partInfo)) {\n throw new Error('`live` bindings can only contain a single expression');\n }\n }\n\n render(value: unknown) {\n return value;\n }\n\n override update(part: AttributePart, [value]: DirectiveParameters<this>) {\n if (value === noChange || value === nothing) {\n return value;\n }\n const element = part.element;\n const name = part.name;\n\n if (part.type === PartType.PROPERTY) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (value === (element as any)[name]) {\n return noChange;\n }\n } else if (part.type === PartType.BOOLEAN_ATTRIBUTE) {\n if (!!value === element.hasAttribute(name)) {\n return noChange;\n }\n } else if (part.type === PartType.ATTRIBUTE) {\n if (element.getAttribute(name) === String(value)) {\n return noChange;\n }\n }\n // Resets the part's value, causing its dirty-check to fail so that it\n // always sets the value.\n setCommittedValue(part);\n return value;\n }\n}\n\n/**\n * Checks binding values against live DOM values, instead of previously bound\n * values, when determining whether to update the value.\n *\n * This is useful for cases where the DOM value may change from outside of\n * lit-html, such as with a binding to an `<input>` element's `value` property,\n * a content editable elements text, or to a custom element that changes it's\n * own properties or attributes.\n *\n * In these cases if the DOM value changes, but the value set through lit-html\n * bindings hasn't, lit-html won't know to update the DOM value and will leave\n * it alone. If this is not what you want--if you want to overwrite the DOM\n * value with the bound value no matter what--use the `live()` directive:\n *\n * ```js\n * html`<input .value=${live(x)}>`\n * ```\n *\n * `live()` performs a strict equality check against the live DOM value, and if\n * the new value is equal to the live value, does nothing. This means that\n * `live()` should not be used when the binding will cause a type conversion. If\n * you use `live()` with an attribute binding, make sure that only strings are\n * passed in, or the binding will update every render.\n */\nexport const live = directive(LiveDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {LiveDirective};\n"]}
|
23
node_modules/lit-html/development/directives/map.d.ts
generated
vendored
Normal file
23
node_modules/lit-html/development/directives/map.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
/**
|
||||
* Returns an iterable containing the result of calling `f(value)` on each
|
||||
* value in `items`.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* render() {
|
||||
* return html`
|
||||
* <ul>
|
||||
* ${map(items, (i) => html`<li>${i}</li>`)}
|
||||
* </ul>
|
||||
* `;
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export declare function map<T>(items: Iterable<T> | undefined, f: (value: T, index: number) => unknown): Generator<unknown, void, unknown>;
|
||||
//# sourceMappingURL=map.d.ts.map
|
1
node_modules/lit-html/development/directives/map.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/map.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/directives/map.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,wBAAiB,GAAG,CAAC,CAAC,EACpB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,EAC9B,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,qCAQxC"}
|
30
node_modules/lit-html/development/directives/map.js
generated
vendored
Normal file
30
node_modules/lit-html/development/directives/map.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
/**
|
||||
* Returns an iterable containing the result of calling `f(value)` on each
|
||||
* value in `items`.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* render() {
|
||||
* return html`
|
||||
* <ul>
|
||||
* ${map(items, (i) => html`<li>${i}</li>`)}
|
||||
* </ul>
|
||||
* `;
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export function* map(items, f) {
|
||||
if (items !== undefined) {
|
||||
let i = 0;
|
||||
for (const value of items) {
|
||||
yield f(value, i++);
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=map.js.map
|
1
node_modules/lit-html/development/directives/map.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/map.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"map.js","sourceRoot":"","sources":["../../src/directives/map.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,SAAS,CAAC,CAAC,GAAG,CAClB,KAA8B,EAC9B,CAAuC;IAEvC,IAAI,KAAK,KAAK,SAAS,EAAE;QACvB,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE;YACzB,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;SACrB;KACF;AACH,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Returns an iterable containing the result of calling `f(value)` on each\n * value in `items`.\n *\n * @example\n *\n * ```ts\n * render() {\n * return html`\n * <ul>\n * ${map(items, (i) => html`<li>${i}</li>`)}\n * </ul>\n * `;\n * }\n * ```\n */\nexport function* map<T>(\n items: Iterable<T> | undefined,\n f: (value: T, index: number) => unknown\n) {\n if (items !== undefined) {\n let i = 0;\n for (const value of items) {\n yield f(value, i++);\n }\n }\n}\n"]}
|
58
node_modules/lit-html/development/directives/private-async-helpers.d.ts
generated
vendored
Normal file
58
node_modules/lit-html/development/directives/private-async-helpers.d.ts
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
/**
|
||||
* Helper to iterate an AsyncIterable in its own closure.
|
||||
* @param iterable The iterable to iterate
|
||||
* @param callback The callback to call for each value. If the callback returns
|
||||
* `false`, the loop will be broken.
|
||||
*/
|
||||
export declare const forAwaitOf: <T>(iterable: AsyncIterable<T>, callback: (value: T) => Promise<boolean>) => Promise<void>;
|
||||
/**
|
||||
* Holds a reference to an instance that can be disconnected and reconnected,
|
||||
* so that a closure over the ref (e.g. in a then function to a promise) does
|
||||
* not strongly hold a ref to the instance. Approximates a WeakRef but must
|
||||
* be manually connected & disconnected to the backing instance.
|
||||
*/
|
||||
export declare class PseudoWeakRef<T> {
|
||||
private _ref?;
|
||||
constructor(ref: T);
|
||||
/**
|
||||
* Disassociates the ref with the backing instance.
|
||||
*/
|
||||
disconnect(): void;
|
||||
/**
|
||||
* Reassociates the ref with the backing instance.
|
||||
*/
|
||||
reconnect(ref: T): void;
|
||||
/**
|
||||
* Retrieves the backing instance (will be undefined when disconnected)
|
||||
*/
|
||||
deref(): T | undefined;
|
||||
}
|
||||
/**
|
||||
* A helper to pause and resume waiting on a condition in an async function
|
||||
*/
|
||||
export declare class Pauser {
|
||||
private _promise?;
|
||||
private _resolve?;
|
||||
/**
|
||||
* When paused, returns a promise to be awaited; when unpaused, returns
|
||||
* undefined. Note that in the microtask between the pauser being resumed
|
||||
* an an await of this promise resolving, the pauser could be paused again,
|
||||
* hence callers should check the promise in a loop when awaiting.
|
||||
* @returns A promise to be awaited when paused or undefined
|
||||
*/
|
||||
get(): Promise<void> | undefined;
|
||||
/**
|
||||
* Creates a promise to be awaited
|
||||
*/
|
||||
pause(): void;
|
||||
/**
|
||||
* Resolves the promise which may be awaited
|
||||
*/
|
||||
resume(): void;
|
||||
}
|
||||
//# sourceMappingURL=private-async-helpers.d.ts.map
|
1
node_modules/lit-html/development/directives/private-async-helpers.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/private-async-helpers.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"private-async-helpers.d.ts","sourceRoot":"","sources":["../../src/directives/private-async-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;;;GAKG;AACH,eAAO,MAAM,UAAU,0DAEG,QAAQ,OAAO,CAAC,kBAOzC,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,aAAa,CAAC,CAAC;IAC1B,OAAO,CAAC,IAAI,CAAC,CAAI;gBACL,GAAG,EAAE,CAAC;IAGlB;;OAEG;IACH,UAAU;IAGV;;OAEG;IACH,SAAS,CAAC,GAAG,EAAE,CAAC;IAGhB;;OAEG;IACH,KAAK;CAGN;AAED;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,CAA4B;IAC7C,OAAO,CAAC,QAAQ,CAAC,CAAyB;IAC1C;;;;;;OAMG;IACH,GAAG;IAGH;;OAEG;IACH,KAAK;IAGL;;OAEG;IACH,MAAM;CAIP"}
|
85
node_modules/lit-html/development/directives/private-async-helpers.js
generated
vendored
Normal file
85
node_modules/lit-html/development/directives/private-async-helpers.js
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
// Note, this module is not included in package exports so that it's private to
|
||||
// our first-party directives. If it ends up being useful, we can open it up and
|
||||
// export it.
|
||||
/**
|
||||
* Helper to iterate an AsyncIterable in its own closure.
|
||||
* @param iterable The iterable to iterate
|
||||
* @param callback The callback to call for each value. If the callback returns
|
||||
* `false`, the loop will be broken.
|
||||
*/
|
||||
export const forAwaitOf = async (iterable, callback) => {
|
||||
for await (const v of iterable) {
|
||||
if ((await callback(v)) === false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Holds a reference to an instance that can be disconnected and reconnected,
|
||||
* so that a closure over the ref (e.g. in a then function to a promise) does
|
||||
* not strongly hold a ref to the instance. Approximates a WeakRef but must
|
||||
* be manually connected & disconnected to the backing instance.
|
||||
*/
|
||||
export class PseudoWeakRef {
|
||||
constructor(ref) {
|
||||
this._ref = ref;
|
||||
}
|
||||
/**
|
||||
* Disassociates the ref with the backing instance.
|
||||
*/
|
||||
disconnect() {
|
||||
this._ref = undefined;
|
||||
}
|
||||
/**
|
||||
* Reassociates the ref with the backing instance.
|
||||
*/
|
||||
reconnect(ref) {
|
||||
this._ref = ref;
|
||||
}
|
||||
/**
|
||||
* Retrieves the backing instance (will be undefined when disconnected)
|
||||
*/
|
||||
deref() {
|
||||
return this._ref;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A helper to pause and resume waiting on a condition in an async function
|
||||
*/
|
||||
export class Pauser {
|
||||
constructor() {
|
||||
this._promise = undefined;
|
||||
this._resolve = undefined;
|
||||
}
|
||||
/**
|
||||
* When paused, returns a promise to be awaited; when unpaused, returns
|
||||
* undefined. Note that in the microtask between the pauser being resumed
|
||||
* an an await of this promise resolving, the pauser could be paused again,
|
||||
* hence callers should check the promise in a loop when awaiting.
|
||||
* @returns A promise to be awaited when paused or undefined
|
||||
*/
|
||||
get() {
|
||||
return this._promise;
|
||||
}
|
||||
/**
|
||||
* Creates a promise to be awaited
|
||||
*/
|
||||
pause() {
|
||||
var _a;
|
||||
(_a = this._promise) !== null && _a !== void 0 ? _a : (this._promise = new Promise((resolve) => (this._resolve = resolve)));
|
||||
}
|
||||
/**
|
||||
* Resolves the promise which may be awaited
|
||||
*/
|
||||
resume() {
|
||||
var _a;
|
||||
(_a = this._resolve) === null || _a === void 0 ? void 0 : _a.call(this);
|
||||
this._promise = this._resolve = undefined;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=private-async-helpers.js.map
|
1
node_modules/lit-html/development/directives/private-async-helpers.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/private-async-helpers.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"private-async-helpers.js","sourceRoot":"","sources":["../../src/directives/private-async-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+EAA+E;AAC/E,gFAAgF;AAChF,aAAa;AAEb;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAC7B,QAA0B,EAC1B,QAAwC,EACxC,EAAE;IACF,IAAI,KAAK,EAAE,MAAM,CAAC,IAAI,QAAQ,EAAE;QAC9B,IAAI,CAAC,MAAM,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE;YACjC,OAAO;SACR;KACF;AACH,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IAExB,YAAY,GAAM;QAChB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IACD;;OAEG;IACH,UAAU;QACR,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;IACxB,CAAC;IACD;;OAEG;IACH,SAAS,CAAC,GAAM;QACd,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IACD;;OAEG;IACH,KAAK;QACH,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,MAAM;IAAnB;QACU,aAAQ,GAAmB,SAAS,CAAC;QACrC,aAAQ,GAAgB,SAAS,CAAC;IAwB5C,CAAC;IAvBC;;;;;;OAMG;IACH,GAAG;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IACD;;OAEG;IACH,KAAK;;QACH,MAAA,IAAI,CAAC,QAAQ,oCAAb,IAAI,CAAC,QAAQ,GAAK,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,CAAC,EAAC;IACxE,CAAC;IACD;;OAEG;IACH,MAAM;;QACJ,MAAA,IAAI,CAAC,QAAQ,oDAAI,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;IAC5C,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// Note, this module is not included in package exports so that it's private to\n// our first-party directives. If it ends up being useful, we can open it up and\n// export it.\n\n/**\n * Helper to iterate an AsyncIterable in its own closure.\n * @param iterable The iterable to iterate\n * @param callback The callback to call for each value. If the callback returns\n * `false`, the loop will be broken.\n */\nexport const forAwaitOf = async <T>(\n iterable: AsyncIterable<T>,\n callback: (value: T) => Promise<boolean>\n) => {\n for await (const v of iterable) {\n if ((await callback(v)) === false) {\n return;\n }\n }\n};\n\n/**\n * Holds a reference to an instance that can be disconnected and reconnected,\n * so that a closure over the ref (e.g. in a then function to a promise) does\n * not strongly hold a ref to the instance. Approximates a WeakRef but must\n * be manually connected & disconnected to the backing instance.\n */\nexport class PseudoWeakRef<T> {\n private _ref?: T;\n constructor(ref: T) {\n this._ref = ref;\n }\n /**\n * Disassociates the ref with the backing instance.\n */\n disconnect() {\n this._ref = undefined;\n }\n /**\n * Reassociates the ref with the backing instance.\n */\n reconnect(ref: T) {\n this._ref = ref;\n }\n /**\n * Retrieves the backing instance (will be undefined when disconnected)\n */\n deref() {\n return this._ref;\n }\n}\n\n/**\n * A helper to pause and resume waiting on a condition in an async function\n */\nexport class Pauser {\n private _promise?: Promise<void> = undefined;\n private _resolve?: () => void = undefined;\n /**\n * When paused, returns a promise to be awaited; when unpaused, returns\n * undefined. Note that in the microtask between the pauser being resumed\n * an an await of this promise resolving, the pauser could be paused again,\n * hence callers should check the promise in a loop when awaiting.\n * @returns A promise to be awaited when paused or undefined\n */\n get() {\n return this._promise;\n }\n /**\n * Creates a promise to be awaited\n */\n pause() {\n this._promise ??= new Promise((resolve) => (this._resolve = resolve));\n }\n /**\n * Resolves the promise which may be awaited\n */\n resume() {\n this._resolve?.();\n this._promise = this._resolve = undefined;\n }\n}\n"]}
|
24
node_modules/lit-html/development/directives/range.d.ts
generated
vendored
Normal file
24
node_modules/lit-html/development/directives/range.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
/**
|
||||
* Returns an iterable of integers from `start` to `end` (exclusive)
|
||||
* incrementing by `step`.
|
||||
*
|
||||
* If `start` is omitted, the range starts at `0`. `step` defaults to `1`.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* render() {
|
||||
* return html`
|
||||
* ${map(range(8), () => html`<div class="cell"></div>`)}
|
||||
* `;
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export declare function range(end: number): Iterable<number>;
|
||||
export declare function range(start: number, end: number, step?: number): Iterable<number>;
|
||||
//# sourceMappingURL=range.d.ts.map
|
1
node_modules/lit-html/development/directives/range.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/range.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../../src/directives/range.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AACrD,wBAAgB,KAAK,CACnB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,MAAM,GACZ,QAAQ,CAAC,MAAM,CAAC,CAAC"}
|
13
node_modules/lit-html/development/directives/range.js
generated
vendored
Normal file
13
node_modules/lit-html/development/directives/range.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
export function* range(startOrEnd, end, step = 1) {
|
||||
const start = end === undefined ? 0 : startOrEnd;
|
||||
end !== null && end !== void 0 ? end : (end = startOrEnd);
|
||||
for (let i = start; step > 0 ? i < end : end < i; i += step) {
|
||||
yield i;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=range.js.map
|
1
node_modules/lit-html/development/directives/range.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/range.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"range.js","sourceRoot":"","sources":["../../src/directives/range.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwBH,MAAM,SAAS,CAAC,CAAC,KAAK,CAAC,UAAkB,EAAE,GAAY,EAAE,IAAI,GAAG,CAAC;IAC/D,MAAM,KAAK,GAAG,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;IACjD,GAAG,aAAH,GAAG,cAAH,GAAG,IAAH,GAAG,GAAK,UAAU,EAAC;IACnB,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE;QAC3D,MAAM,CAAC,CAAC;KACT;AACH,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Returns an iterable of integers from `start` to `end` (exclusive)\n * incrementing by `step`.\n *\n * If `start` is omitted, the range starts at `0`. `step` defaults to `1`.\n *\n * @example\n *\n * ```ts\n * render() {\n * return html`\n * ${map(range(8), () => html`<div class=\"cell\"></div>`)}\n * `;\n * }\n * ```\n */\nexport function range(end: number): Iterable<number>;\nexport function range(\n start: number,\n end: number,\n step?: number\n): Iterable<number>;\nexport function* range(startOrEnd: number, end?: number, step = 1) {\n const start = end === undefined ? 0 : startOrEnd;\n end ??= startOrEnd;\n for (let i = start; step > 0 ? i < end : end < i; i += step) {\n yield i;\n }\n}\n"]}
|
66
node_modules/lit-html/development/directives/ref.d.ts
generated
vendored
Normal file
66
node_modules/lit-html/development/directives/ref.d.ts
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { ElementPart } from '../lit-html.js';
|
||||
import { AsyncDirective } from '../async-directive.js';
|
||||
/**
|
||||
* Creates a new Ref object, which is container for a reference to an element.
|
||||
*/
|
||||
export declare const createRef: <T = Element>() => Ref<T>;
|
||||
/**
|
||||
* An object that holds a ref value.
|
||||
*/
|
||||
declare class Ref<T = Element> {
|
||||
/**
|
||||
* The current Element value of the ref, or else `undefined` if the ref is no
|
||||
* longer rendered.
|
||||
*/
|
||||
readonly value?: T;
|
||||
}
|
||||
export type { Ref };
|
||||
export declare type RefOrCallback<T = Element> = Ref<T> | ((el: T | undefined) => void);
|
||||
declare class RefDirective extends AsyncDirective {
|
||||
private _element?;
|
||||
private _ref?;
|
||||
private _context?;
|
||||
render(_ref?: RefOrCallback): symbol;
|
||||
update(part: ElementPart, [ref]: Parameters<this['render']>): symbol;
|
||||
private _updateRefValue;
|
||||
private get _lastElementForRef();
|
||||
disconnected(): void;
|
||||
reconnected(): void;
|
||||
}
|
||||
/**
|
||||
* Sets the value of a Ref object or calls a ref callback with the element it's
|
||||
* bound to.
|
||||
*
|
||||
* A Ref object acts as a container for a reference to an element. A ref
|
||||
* callback is a function that takes an element as its only argument.
|
||||
*
|
||||
* The ref directive sets the value of the Ref object or calls the ref callback
|
||||
* during rendering, if the referenced element changed.
|
||||
*
|
||||
* Note: If a ref callback is rendered to a different element position or is
|
||||
* removed in a subsequent render, it will first be called with `undefined`,
|
||||
* followed by another call with the new element it was rendered to (if any).
|
||||
*
|
||||
* ```js
|
||||
* // Using Ref object
|
||||
* const inputRef = createRef();
|
||||
* render(html`<input ${ref(inputRef)}>`, container);
|
||||
* inputRef.value.focus();
|
||||
*
|
||||
* // Using callback
|
||||
* const callback = (inputElement) => inputElement.focus();
|
||||
* render(html`<input ${ref(callback)}>`, container);
|
||||
* ```
|
||||
*/
|
||||
export declare const ref: (_ref?: RefOrCallback<Element> | undefined) => import("../directive.js").DirectiveResult<typeof RefDirective>;
|
||||
/**
|
||||
* The type of the class that powers this directive. Necessary for naming the
|
||||
* directive's return type.
|
||||
*/
|
||||
export type { RefDirective };
|
||||
//# sourceMappingURL=ref.d.ts.map
|
1
node_modules/lit-html/development/directives/ref.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/ref.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ref.d.ts","sourceRoot":"","sources":["../../src/directives/ref.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAU,WAAW,EAAC,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAY,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,SAAS,2BAAkC,CAAC;AAEzD;;GAEG;AACH,cAAM,GAAG,CAAC,CAAC,GAAG,OAAO;IACnB;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;CACpB;AAED,YAAY,EAAC,GAAG,EAAC,CAAC;AAgBlB,oBAAY,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,SAAS,KAAK,IAAI,CAAC,CAAC;AAEhF,cAAM,YAAa,SAAQ,cAAc;IACvC,OAAO,CAAC,QAAQ,CAAC,CAAU;IAC3B,OAAO,CAAC,IAAI,CAAC,CAAgB;IAC7B,OAAO,CAAC,QAAQ,CAAC,CAAS;IAE1B,MAAM,CAAC,IAAI,CAAC,EAAE,aAAa;IAIlB,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAiBpE,OAAO,CAAC,eAAe;IA+BvB,OAAO,KAAK,kBAAkB,GAM7B;IAEQ,YAAY;IAUZ,WAAW;CAKrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,GAAG,+GAA0B,CAAC;AAE3C;;;GAGG;AACH,YAAY,EAAC,YAAY,EAAC,CAAC"}
|
123
node_modules/lit-html/development/directives/ref.js
generated
vendored
Normal file
123
node_modules/lit-html/development/directives/ref.js
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { nothing } from '../lit-html.js';
|
||||
import { directive, AsyncDirective } from '../async-directive.js';
|
||||
/**
|
||||
* Creates a new Ref object, which is container for a reference to an element.
|
||||
*/
|
||||
export const createRef = () => new Ref();
|
||||
/**
|
||||
* An object that holds a ref value.
|
||||
*/
|
||||
class Ref {
|
||||
}
|
||||
// When callbacks are used for refs, this map tracks the last value the callback
|
||||
// was called with, for ensuring a directive doesn't clear the ref if the ref
|
||||
// has already been rendered to a new spot. It is double-keyed on both the
|
||||
// context (`options.host`) and the callback, since we auto-bind class methods
|
||||
// to `options.host`.
|
||||
const lastElementForContextAndCallback = new WeakMap();
|
||||
class RefDirective extends AsyncDirective {
|
||||
render(_ref) {
|
||||
return nothing;
|
||||
}
|
||||
update(part, [ref]) {
|
||||
var _a;
|
||||
const refChanged = ref !== this._ref;
|
||||
if (refChanged && this._ref !== undefined) {
|
||||
// The ref passed to the directive has changed;
|
||||
// unset the previous ref's value
|
||||
this._updateRefValue(undefined);
|
||||
}
|
||||
if (refChanged || this._lastElementForRef !== this._element) {
|
||||
// We either got a new ref or this is the first render;
|
||||
// store the ref/element & update the ref value
|
||||
this._ref = ref;
|
||||
this._context = (_a = part.options) === null || _a === void 0 ? void 0 : _a.host;
|
||||
this._updateRefValue((this._element = part.element));
|
||||
}
|
||||
return nothing;
|
||||
}
|
||||
_updateRefValue(element) {
|
||||
var _a;
|
||||
if (typeof this._ref === 'function') {
|
||||
// If the current ref was called with a previous value, call with
|
||||
// `undefined`; We do this to ensure callbacks are called in a consistent
|
||||
// way regardless of whether a ref might be moving up in the tree (in
|
||||
// which case it would otherwise be called with the new value before the
|
||||
// previous one unsets it) and down in the tree (where it would be unset
|
||||
// before being set). Note that element lookup is keyed by
|
||||
// both the context and the callback, since we allow passing unbound
|
||||
// functions that are called on options.host, and we want to treat
|
||||
// these as unique "instances" of a function.
|
||||
const context = (_a = this._context) !== null && _a !== void 0 ? _a : globalThis;
|
||||
let lastElementForCallback = lastElementForContextAndCallback.get(context);
|
||||
if (lastElementForCallback === undefined) {
|
||||
lastElementForCallback = new WeakMap();
|
||||
lastElementForContextAndCallback.set(context, lastElementForCallback);
|
||||
}
|
||||
if (lastElementForCallback.get(this._ref) !== undefined) {
|
||||
this._ref.call(this._context, undefined);
|
||||
}
|
||||
lastElementForCallback.set(this._ref, element);
|
||||
// Call the ref with the new element value
|
||||
if (element !== undefined) {
|
||||
this._ref.call(this._context, element);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this._ref.value = element;
|
||||
}
|
||||
}
|
||||
get _lastElementForRef() {
|
||||
var _a, _b, _c;
|
||||
return typeof this._ref === 'function'
|
||||
? (_b = lastElementForContextAndCallback
|
||||
.get((_a = this._context) !== null && _a !== void 0 ? _a : globalThis)) === null || _b === void 0 ? void 0 : _b.get(this._ref)
|
||||
: (_c = this._ref) === null || _c === void 0 ? void 0 : _c.value;
|
||||
}
|
||||
disconnected() {
|
||||
// Only clear the box if our element is still the one in it (i.e. another
|
||||
// directive instance hasn't rendered its element to it before us); that
|
||||
// only happens in the event of the directive being cleared (not via manual
|
||||
// disconnection)
|
||||
if (this._lastElementForRef === this._element) {
|
||||
this._updateRefValue(undefined);
|
||||
}
|
||||
}
|
||||
reconnected() {
|
||||
// If we were manually disconnected, we can safely put our element back in
|
||||
// the box, since no rendering could have occurred to change its state
|
||||
this._updateRefValue(this._element);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Sets the value of a Ref object or calls a ref callback with the element it's
|
||||
* bound to.
|
||||
*
|
||||
* A Ref object acts as a container for a reference to an element. A ref
|
||||
* callback is a function that takes an element as its only argument.
|
||||
*
|
||||
* The ref directive sets the value of the Ref object or calls the ref callback
|
||||
* during rendering, if the referenced element changed.
|
||||
*
|
||||
* Note: If a ref callback is rendered to a different element position or is
|
||||
* removed in a subsequent render, it will first be called with `undefined`,
|
||||
* followed by another call with the new element it was rendered to (if any).
|
||||
*
|
||||
* ```js
|
||||
* // Using Ref object
|
||||
* const inputRef = createRef();
|
||||
* render(html`<input ${ref(inputRef)}>`, container);
|
||||
* inputRef.value.focus();
|
||||
*
|
||||
* // Using callback
|
||||
* const callback = (inputElement) => inputElement.focus();
|
||||
* render(html`<input ${ref(callback)}>`, container);
|
||||
* ```
|
||||
*/
|
||||
export const ref = directive(RefDirective);
|
||||
//# sourceMappingURL=ref.js.map
|
1
node_modules/lit-html/development/directives/ref.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/ref.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
64
node_modules/lit-html/development/directives/repeat.d.ts
generated
vendored
Normal file
64
node_modules/lit-html/development/directives/repeat.d.ts
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { ChildPart, noChange } from '../lit-html.js';
|
||||
import { Directive, PartInfo } from '../directive.js';
|
||||
export declare type KeyFn<T> = (item: T, index: number) => unknown;
|
||||
export declare type ItemTemplate<T> = (item: T, index: number) => unknown;
|
||||
declare class RepeatDirective extends Directive {
|
||||
private _itemKeys?;
|
||||
constructor(partInfo: PartInfo);
|
||||
private _getValuesAndKeys;
|
||||
render<T>(items: Iterable<T>, template: ItemTemplate<T>): Array<unknown>;
|
||||
render<T>(items: Iterable<T>, keyFn: KeyFn<T> | ItemTemplate<T>, template: ItemTemplate<T>): Array<unknown>;
|
||||
update<T>(containerPart: ChildPart, [items, keyFnOrTemplate, template]: [
|
||||
Iterable<T>,
|
||||
KeyFn<T> | ItemTemplate<T>,
|
||||
ItemTemplate<T>
|
||||
]): unknown[] | typeof noChange;
|
||||
}
|
||||
export interface RepeatDirectiveFn {
|
||||
<T>(items: Iterable<T>, keyFnOrTemplate: KeyFn<T> | ItemTemplate<T>, template?: ItemTemplate<T>): unknown;
|
||||
<T>(items: Iterable<T>, template: ItemTemplate<T>): unknown;
|
||||
<T>(items: Iterable<T>, keyFn: KeyFn<T> | ItemTemplate<T>, template: ItemTemplate<T>): unknown;
|
||||
}
|
||||
/**
|
||||
* A directive that repeats a series of values (usually `TemplateResults`)
|
||||
* generated from an iterable, and updates those items efficiently when the
|
||||
* iterable changes based on user-provided `keys` associated with each item.
|
||||
*
|
||||
* Note that if a `keyFn` is provided, strict key-to-DOM mapping is maintained,
|
||||
* meaning previous DOM for a given key is moved into the new position if
|
||||
* needed, and DOM will never be reused with values for different keys (new DOM
|
||||
* will always be created for new keys). This is generally the most efficient
|
||||
* way to use `repeat` since it performs minimum unnecessary work for insertions
|
||||
* and removals.
|
||||
*
|
||||
* The `keyFn` takes two parameters, the item and its index, and returns a unique key value.
|
||||
*
|
||||
* ```js
|
||||
* html`
|
||||
* <ol>
|
||||
* ${repeat(this.items, (item) => item.id, (item, index) => {
|
||||
* return html`<li>${index}: ${item.name}</li>`;
|
||||
* })}
|
||||
* </ol>
|
||||
* `
|
||||
* ```
|
||||
*
|
||||
* **Important**: If providing a `keyFn`, keys *must* be unique for all items in a
|
||||
* given call to `repeat`. The behavior when two or more items have the same key
|
||||
* is undefined.
|
||||
*
|
||||
* If no `keyFn` is provided, this directive will perform similar to mapping
|
||||
* items to values, and DOM will be reused against potentially different items.
|
||||
*/
|
||||
export declare const repeat: RepeatDirectiveFn;
|
||||
/**
|
||||
* The type of the class that powers this directive. Necessary for naming the
|
||||
* directive's return type.
|
||||
*/
|
||||
export type { RepeatDirective };
|
||||
//# sourceMappingURL=repeat.d.ts.map
|
1
node_modules/lit-html/development/directives/repeat.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/repeat.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"repeat.d.ts","sourceRoot":"","sources":["../../src/directives/repeat.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAY,SAAS,EAAE,QAAQ,EAAW,MAAM,iBAAiB,CAAC;AASzE,oBAAY,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;AAC3D,oBAAY,YAAY,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;AAalE,cAAM,eAAgB,SAAQ,SAAS;IACrC,OAAO,CAAC,SAAS,CAAC,CAAY;gBAElB,QAAQ,EAAE,QAAQ;IAO9B,OAAO,CAAC,iBAAiB;IAyBzB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;IACxE,MAAM,CAAC,CAAC,EACN,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAClB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,EACjC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,GACxB,KAAK,CAAC,OAAO,CAAC;IASR,MAAM,CAAC,CAAC,EACf,aAAa,EAAE,SAAS,EACxB,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE;QAClC,QAAQ,CAAC,CAAC,CAAC;QACX,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;QAC1B,YAAY,CAAC,CAAC,CAAC;KAChB;CA4VJ;AAED,MAAM,WAAW,iBAAiB;IAChC,CAAC,CAAC,EACA,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAClB,eAAe,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,EAC3C,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,GACzB,OAAO,CAAC;IACX,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;IAC5D,CAAC,CAAC,EACA,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAClB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,EACjC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,GACxB,OAAO,CAAC;CACZ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,MAAM,mBAAkD,CAAC;AAEtE;;;GAGG;AACH,YAAY,EAAC,eAAe,EAAC,CAAC"}
|
414
node_modules/lit-html/development/directives/repeat.js
generated
vendored
Normal file
414
node_modules/lit-html/development/directives/repeat.js
generated
vendored
Normal file
@@ -0,0 +1,414 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { noChange } from '../lit-html.js';
|
||||
import { directive, Directive, PartType } from '../directive.js';
|
||||
import { insertPart, getCommittedValue, removePart, setCommittedValue, setChildPartValue, } from '../directive-helpers.js';
|
||||
// Helper for generating a map of array item to its index over a subset
|
||||
// of an array (used to lazily generate `newKeyToIndexMap` and
|
||||
// `oldKeyToIndexMap`)
|
||||
const generateMap = (list, start, end) => {
|
||||
const map = new Map();
|
||||
for (let i = start; i <= end; i++) {
|
||||
map.set(list[i], i);
|
||||
}
|
||||
return map;
|
||||
};
|
||||
class RepeatDirective extends Directive {
|
||||
constructor(partInfo) {
|
||||
super(partInfo);
|
||||
if (partInfo.type !== PartType.CHILD) {
|
||||
throw new Error('repeat() can only be used in text expressions');
|
||||
}
|
||||
}
|
||||
_getValuesAndKeys(items, keyFnOrTemplate, template) {
|
||||
let keyFn;
|
||||
if (template === undefined) {
|
||||
template = keyFnOrTemplate;
|
||||
}
|
||||
else if (keyFnOrTemplate !== undefined) {
|
||||
keyFn = keyFnOrTemplate;
|
||||
}
|
||||
const keys = [];
|
||||
const values = [];
|
||||
let index = 0;
|
||||
for (const item of items) {
|
||||
keys[index] = keyFn ? keyFn(item, index) : index;
|
||||
values[index] = template(item, index);
|
||||
index++;
|
||||
}
|
||||
return {
|
||||
values,
|
||||
keys,
|
||||
};
|
||||
}
|
||||
render(items, keyFnOrTemplate, template) {
|
||||
return this._getValuesAndKeys(items, keyFnOrTemplate, template).values;
|
||||
}
|
||||
update(containerPart, [items, keyFnOrTemplate, template]) {
|
||||
var _a;
|
||||
// Old part & key lists are retrieved from the last update (which may
|
||||
// be primed by hydration)
|
||||
const oldParts = getCommittedValue(containerPart);
|
||||
const { values: newValues, keys: newKeys } = this._getValuesAndKeys(items, keyFnOrTemplate, template);
|
||||
// We check that oldParts, the committed value, is an Array as an
|
||||
// indicator that the previous value came from a repeat() call. If
|
||||
// oldParts is not an Array then this is the first render and we return
|
||||
// an array for lit-html's array handling to render, and remember the
|
||||
// keys.
|
||||
if (!Array.isArray(oldParts)) {
|
||||
this._itemKeys = newKeys;
|
||||
return newValues;
|
||||
}
|
||||
// In SSR hydration it's possible for oldParts to be an array but for us
|
||||
// to not have item keys because the update() hasn't run yet. We set the
|
||||
// keys to an empty array. This will cause all oldKey/newKey comparisons
|
||||
// to fail and execution to fall to the last nested brach below which
|
||||
// reuses the oldPart.
|
||||
const oldKeys = ((_a = this._itemKeys) !== null && _a !== void 0 ? _a : (this._itemKeys = []));
|
||||
// New part list will be built up as we go (either reused from
|
||||
// old parts or created for new keys in this update). This is
|
||||
// saved in the above cache at the end of the update.
|
||||
const newParts = [];
|
||||
// Maps from key to index for current and previous update; these
|
||||
// are generated lazily only when needed as a performance
|
||||
// optimization, since they are only required for multiple
|
||||
// non-contiguous changes in the list, which are less common.
|
||||
let newKeyToIndexMap;
|
||||
let oldKeyToIndexMap;
|
||||
// Head and tail pointers to old parts and new values
|
||||
let oldHead = 0;
|
||||
let oldTail = oldParts.length - 1;
|
||||
let newHead = 0;
|
||||
let newTail = newValues.length - 1;
|
||||
// Overview of O(n) reconciliation algorithm (general approach
|
||||
// based on ideas found in ivi, vue, snabbdom, etc.):
|
||||
//
|
||||
// * We start with the list of old parts and new values (and
|
||||
// arrays of their respective keys), head/tail pointers into
|
||||
// each, and we build up the new list of parts by updating
|
||||
// (and when needed, moving) old parts or creating new ones.
|
||||
// The initial scenario might look like this (for brevity of
|
||||
// the diagrams, the numbers in the array reflect keys
|
||||
// associated with the old parts or new values, although keys
|
||||
// and parts/values are actually stored in parallel arrays
|
||||
// indexed using the same head/tail pointers):
|
||||
//
|
||||
// oldHead v v oldTail
|
||||
// oldKeys: [0, 1, 2, 3, 4, 5, 6]
|
||||
// newParts: [ , , , , , , ]
|
||||
// newKeys: [0, 2, 1, 4, 3, 7, 6] <- reflects the user's new
|
||||
// item order
|
||||
// newHead ^ ^ newTail
|
||||
//
|
||||
// * Iterate old & new lists from both sides, updating,
|
||||
// swapping, or removing parts at the head/tail locations
|
||||
// until neither head nor tail can move.
|
||||
//
|
||||
// * Example below: keys at head pointers match, so update old
|
||||
// part 0 in-place (no need to move it) and record part 0 in
|
||||
// the `newParts` list. The last thing we do is advance the
|
||||
// `oldHead` and `newHead` pointers (will be reflected in the
|
||||
// next diagram).
|
||||
//
|
||||
// oldHead v v oldTail
|
||||
// oldKeys: [0, 1, 2, 3, 4, 5, 6]
|
||||
// newParts: [0, , , , , , ] <- heads matched: update 0
|
||||
// newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead
|
||||
// & newHead
|
||||
// newHead ^ ^ newTail
|
||||
//
|
||||
// * Example below: head pointers don't match, but tail
|
||||
// pointers do, so update part 6 in place (no need to move
|
||||
// it), and record part 6 in the `newParts` list. Last,
|
||||
// advance the `oldTail` and `oldHead` pointers.
|
||||
//
|
||||
// oldHead v v oldTail
|
||||
// oldKeys: [0, 1, 2, 3, 4, 5, 6]
|
||||
// newParts: [0, , , , , , 6] <- tails matched: update 6
|
||||
// newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldTail
|
||||
// & newTail
|
||||
// newHead ^ ^ newTail
|
||||
//
|
||||
// * If neither head nor tail match; next check if one of the
|
||||
// old head/tail items was removed. We first need to generate
|
||||
// the reverse map of new keys to index (`newKeyToIndexMap`),
|
||||
// which is done once lazily as a performance optimization,
|
||||
// since we only hit this case if multiple non-contiguous
|
||||
// changes were made. Note that for contiguous removal
|
||||
// anywhere in the list, the head and tails would advance
|
||||
// from either end and pass each other before we get to this
|
||||
// case and removals would be handled in the final while loop
|
||||
// without needing to generate the map.
|
||||
//
|
||||
// * Example below: The key at `oldTail` was removed (no longer
|
||||
// in the `newKeyToIndexMap`), so remove that part from the
|
||||
// DOM and advance just the `oldTail` pointer.
|
||||
//
|
||||
// oldHead v v oldTail
|
||||
// oldKeys: [0, 1, 2, 3, 4, 5, 6]
|
||||
// newParts: [0, , , , , , 6] <- 5 not in new map: remove
|
||||
// newKeys: [0, 2, 1, 4, 3, 7, 6] 5 and advance oldTail
|
||||
// newHead ^ ^ newTail
|
||||
//
|
||||
// * Once head and tail cannot move, any mismatches are due to
|
||||
// either new or moved items; if a new key is in the previous
|
||||
// "old key to old index" map, move the old part to the new
|
||||
// location, otherwise create and insert a new part. Note
|
||||
// that when moving an old part we null its position in the
|
||||
// oldParts array if it lies between the head and tail so we
|
||||
// know to skip it when the pointers get there.
|
||||
//
|
||||
// * Example below: neither head nor tail match, and neither
|
||||
// were removed; so find the `newHead` key in the
|
||||
// `oldKeyToIndexMap`, and move that old part's DOM into the
|
||||
// next head position (before `oldParts[oldHead]`). Last,
|
||||
// null the part in the `oldPart` array since it was
|
||||
// somewhere in the remaining oldParts still to be scanned
|
||||
// (between the head and tail pointers) so that we know to
|
||||
// skip that old part on future iterations.
|
||||
//
|
||||
// oldHead v v oldTail
|
||||
// oldKeys: [0, 1, -, 3, 4, 5, 6]
|
||||
// newParts: [0, 2, , , , , 6] <- stuck: update & move 2
|
||||
// newKeys: [0, 2, 1, 4, 3, 7, 6] into place and advance
|
||||
// newHead
|
||||
// newHead ^ ^ newTail
|
||||
//
|
||||
// * Note that for moves/insertions like the one above, a part
|
||||
// inserted at the head pointer is inserted before the
|
||||
// current `oldParts[oldHead]`, and a part inserted at the
|
||||
// tail pointer is inserted before `newParts[newTail+1]`. The
|
||||
// seeming asymmetry lies in the fact that new parts are
|
||||
// moved into place outside in, so to the right of the head
|
||||
// pointer are old parts, and to the right of the tail
|
||||
// pointer are new parts.
|
||||
//
|
||||
// * We always restart back from the top of the algorithm,
|
||||
// allowing matching and simple updates in place to
|
||||
// continue...
|
||||
//
|
||||
// * Example below: the head pointers once again match, so
|
||||
// simply update part 1 and record it in the `newParts`
|
||||
// array. Last, advance both head pointers.
|
||||
//
|
||||
// oldHead v v oldTail
|
||||
// oldKeys: [0, 1, -, 3, 4, 5, 6]
|
||||
// newParts: [0, 2, 1, , , , 6] <- heads matched: update 1
|
||||
// newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead
|
||||
// & newHead
|
||||
// newHead ^ ^ newTail
|
||||
//
|
||||
// * As mentioned above, items that were moved as a result of
|
||||
// being stuck (the final else clause in the code below) are
|
||||
// marked with null, so we always advance old pointers over
|
||||
// these so we're comparing the next actual old value on
|
||||
// either end.
|
||||
//
|
||||
// * Example below: `oldHead` is null (already placed in
|
||||
// newParts), so advance `oldHead`.
|
||||
//
|
||||
// oldHead v v oldTail
|
||||
// oldKeys: [0, 1, -, 3, 4, 5, 6] <- old head already used:
|
||||
// newParts: [0, 2, 1, , , , 6] advance oldHead
|
||||
// newKeys: [0, 2, 1, 4, 3, 7, 6]
|
||||
// newHead ^ ^ newTail
|
||||
//
|
||||
// * Note it's not critical to mark old parts as null when they
|
||||
// are moved from head to tail or tail to head, since they
|
||||
// will be outside the pointer range and never visited again.
|
||||
//
|
||||
// * Example below: Here the old tail key matches the new head
|
||||
// key, so the part at the `oldTail` position and move its
|
||||
// DOM to the new head position (before `oldParts[oldHead]`).
|
||||
// Last, advance `oldTail` and `newHead` pointers.
|
||||
//
|
||||
// oldHead v v oldTail
|
||||
// oldKeys: [0, 1, -, 3, 4, 5, 6]
|
||||
// newParts: [0, 2, 1, 4, , , 6] <- old tail matches new
|
||||
// newKeys: [0, 2, 1, 4, 3, 7, 6] head: update & move 4,
|
||||
// advance oldTail & newHead
|
||||
// newHead ^ ^ newTail
|
||||
//
|
||||
// * Example below: Old and new head keys match, so update the
|
||||
// old head part in place, and advance the `oldHead` and
|
||||
// `newHead` pointers.
|
||||
//
|
||||
// oldHead v oldTail
|
||||
// oldKeys: [0, 1, -, 3, 4, 5, 6]
|
||||
// newParts: [0, 2, 1, 4, 3, ,6] <- heads match: update 3
|
||||
// newKeys: [0, 2, 1, 4, 3, 7, 6] and advance oldHead &
|
||||
// newHead
|
||||
// newHead ^ ^ newTail
|
||||
//
|
||||
// * Once the new or old pointers move past each other then all
|
||||
// we have left is additions (if old list exhausted) or
|
||||
// removals (if new list exhausted). Those are handled in the
|
||||
// final while loops at the end.
|
||||
//
|
||||
// * Example below: `oldHead` exceeded `oldTail`, so we're done
|
||||
// with the main loop. Create the remaining part and insert
|
||||
// it at the new head position, and the update is complete.
|
||||
//
|
||||
// (oldHead > oldTail)
|
||||
// oldKeys: [0, 1, -, 3, 4, 5, 6]
|
||||
// newParts: [0, 2, 1, 4, 3, 7 ,6] <- create and insert 7
|
||||
// newKeys: [0, 2, 1, 4, 3, 7, 6]
|
||||
// newHead ^ newTail
|
||||
//
|
||||
// * Note that the order of the if/else clauses is not
|
||||
// important to the algorithm, as long as the null checks
|
||||
// come first (to ensure we're always working on valid old
|
||||
// parts) and that the final else clause comes last (since
|
||||
// that's where the expensive moves occur). The order of
|
||||
// remaining clauses is is just a simple guess at which cases
|
||||
// will be most common.
|
||||
//
|
||||
// * Note, we could calculate the longest
|
||||
// increasing subsequence (LIS) of old items in new position,
|
||||
// and only move those not in the LIS set. However that costs
|
||||
// O(nlogn) time and adds a bit more code, and only helps
|
||||
// make rare types of mutations require fewer moves. The
|
||||
// above handles removes, adds, reversal, swaps, and single
|
||||
// moves of contiguous items in linear time, in the minimum
|
||||
// number of moves. As the number of multiple moves where LIS
|
||||
// might help approaches a random shuffle, the LIS
|
||||
// optimization becomes less helpful, so it seems not worth
|
||||
// the code at this point. Could reconsider if a compelling
|
||||
// case arises.
|
||||
while (oldHead <= oldTail && newHead <= newTail) {
|
||||
if (oldParts[oldHead] === null) {
|
||||
// `null` means old part at head has already been used
|
||||
// below; skip
|
||||
oldHead++;
|
||||
}
|
||||
else if (oldParts[oldTail] === null) {
|
||||
// `null` means old part at tail has already been used
|
||||
// below; skip
|
||||
oldTail--;
|
||||
}
|
||||
else if (oldKeys[oldHead] === newKeys[newHead]) {
|
||||
// Old head matches new head; update in place
|
||||
newParts[newHead] = setChildPartValue(oldParts[oldHead], newValues[newHead]);
|
||||
oldHead++;
|
||||
newHead++;
|
||||
}
|
||||
else if (oldKeys[oldTail] === newKeys[newTail]) {
|
||||
// Old tail matches new tail; update in place
|
||||
newParts[newTail] = setChildPartValue(oldParts[oldTail], newValues[newTail]);
|
||||
oldTail--;
|
||||
newTail--;
|
||||
}
|
||||
else if (oldKeys[oldHead] === newKeys[newTail]) {
|
||||
// Old head matches new tail; update and move to new tail
|
||||
newParts[newTail] = setChildPartValue(oldParts[oldHead], newValues[newTail]);
|
||||
insertPart(containerPart, newParts[newTail + 1], oldParts[oldHead]);
|
||||
oldHead++;
|
||||
newTail--;
|
||||
}
|
||||
else if (oldKeys[oldTail] === newKeys[newHead]) {
|
||||
// Old tail matches new head; update and move to new head
|
||||
newParts[newHead] = setChildPartValue(oldParts[oldTail], newValues[newHead]);
|
||||
insertPart(containerPart, oldParts[oldHead], oldParts[oldTail]);
|
||||
oldTail--;
|
||||
newHead++;
|
||||
}
|
||||
else {
|
||||
if (newKeyToIndexMap === undefined) {
|
||||
// Lazily generate key-to-index maps, used for removals &
|
||||
// moves below
|
||||
newKeyToIndexMap = generateMap(newKeys, newHead, newTail);
|
||||
oldKeyToIndexMap = generateMap(oldKeys, oldHead, oldTail);
|
||||
}
|
||||
if (!newKeyToIndexMap.has(oldKeys[oldHead])) {
|
||||
// Old head is no longer in new list; remove
|
||||
removePart(oldParts[oldHead]);
|
||||
oldHead++;
|
||||
}
|
||||
else if (!newKeyToIndexMap.has(oldKeys[oldTail])) {
|
||||
// Old tail is no longer in new list; remove
|
||||
removePart(oldParts[oldTail]);
|
||||
oldTail--;
|
||||
}
|
||||
else {
|
||||
// Any mismatches at this point are due to additions or
|
||||
// moves; see if we have an old part we can reuse and move
|
||||
// into place
|
||||
const oldIndex = oldKeyToIndexMap.get(newKeys[newHead]);
|
||||
const oldPart = oldIndex !== undefined ? oldParts[oldIndex] : null;
|
||||
if (oldPart === null) {
|
||||
// No old part for this value; create a new one and
|
||||
// insert it
|
||||
const newPart = insertPart(containerPart, oldParts[oldHead]);
|
||||
setChildPartValue(newPart, newValues[newHead]);
|
||||
newParts[newHead] = newPart;
|
||||
}
|
||||
else {
|
||||
// Reuse old part
|
||||
newParts[newHead] = setChildPartValue(oldPart, newValues[newHead]);
|
||||
insertPart(containerPart, oldParts[oldHead], oldPart);
|
||||
// This marks the old part as having been used, so that
|
||||
// it will be skipped in the first two checks above
|
||||
oldParts[oldIndex] = null;
|
||||
}
|
||||
newHead++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add parts for any remaining new values
|
||||
while (newHead <= newTail) {
|
||||
// For all remaining additions, we insert before last new
|
||||
// tail, since old pointers are no longer valid
|
||||
const newPart = insertPart(containerPart, newParts[newTail + 1]);
|
||||
setChildPartValue(newPart, newValues[newHead]);
|
||||
newParts[newHead++] = newPart;
|
||||
}
|
||||
// Remove any remaining unused old parts
|
||||
while (oldHead <= oldTail) {
|
||||
const oldPart = oldParts[oldHead++];
|
||||
if (oldPart !== null) {
|
||||
removePart(oldPart);
|
||||
}
|
||||
}
|
||||
// Save order of new parts for next round
|
||||
this._itemKeys = newKeys;
|
||||
// Directly set part value, bypassing it's dirty-checking
|
||||
setCommittedValue(containerPart, newParts);
|
||||
return noChange;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A directive that repeats a series of values (usually `TemplateResults`)
|
||||
* generated from an iterable, and updates those items efficiently when the
|
||||
* iterable changes based on user-provided `keys` associated with each item.
|
||||
*
|
||||
* Note that if a `keyFn` is provided, strict key-to-DOM mapping is maintained,
|
||||
* meaning previous DOM for a given key is moved into the new position if
|
||||
* needed, and DOM will never be reused with values for different keys (new DOM
|
||||
* will always be created for new keys). This is generally the most efficient
|
||||
* way to use `repeat` since it performs minimum unnecessary work for insertions
|
||||
* and removals.
|
||||
*
|
||||
* The `keyFn` takes two parameters, the item and its index, and returns a unique key value.
|
||||
*
|
||||
* ```js
|
||||
* html`
|
||||
* <ol>
|
||||
* ${repeat(this.items, (item) => item.id, (item, index) => {
|
||||
* return html`<li>${index}: ${item.name}</li>`;
|
||||
* })}
|
||||
* </ol>
|
||||
* `
|
||||
* ```
|
||||
*
|
||||
* **Important**: If providing a `keyFn`, keys *must* be unique for all items in a
|
||||
* given call to `repeat`. The behavior when two or more items have the same key
|
||||
* is undefined.
|
||||
*
|
||||
* If no `keyFn` is provided, this directive will perform similar to mapping
|
||||
* items to values, and DOM will be reused against potentially different items.
|
||||
*/
|
||||
export const repeat = directive(RepeatDirective);
|
||||
//# sourceMappingURL=repeat.js.map
|
1
node_modules/lit-html/development/directives/repeat.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/repeat.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
50
node_modules/lit-html/development/directives/style-map.d.ts
generated
vendored
Normal file
50
node_modules/lit-html/development/directives/style-map.d.ts
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { AttributePart, noChange } from '../lit-html.js';
|
||||
import { Directive, DirectiveParameters, PartInfo } from '../directive.js';
|
||||
/**
|
||||
* A key-value set of CSS properties and values.
|
||||
*
|
||||
* The key should be either a valid CSS property name string, like
|
||||
* `'background-color'`, or a valid JavaScript camel case property name
|
||||
* for CSSStyleDeclaration like `backgroundColor`.
|
||||
*/
|
||||
export interface StyleInfo {
|
||||
[name: string]: string | number | undefined | null;
|
||||
}
|
||||
declare class StyleMapDirective extends Directive {
|
||||
_previousStyleProperties?: Set<string>;
|
||||
constructor(partInfo: PartInfo);
|
||||
render(styleInfo: Readonly<StyleInfo>): string;
|
||||
update(part: AttributePart, [styleInfo]: DirectiveParameters<this>): string | typeof noChange;
|
||||
}
|
||||
/**
|
||||
* A directive that applies CSS properties to an element.
|
||||
*
|
||||
* `styleMap` can only be used in the `style` attribute and must be the only
|
||||
* expression in the attribute. It takes the property names in the
|
||||
* {@link StyleInfo styleInfo} object and adds the properties to the inline
|
||||
* style of the element.
|
||||
*
|
||||
* Property names with dashes (`-`) are assumed to be valid CSS
|
||||
* property names and set on the element's style object using `setProperty()`.
|
||||
* Names without dashes are assumed to be camelCased JavaScript property names
|
||||
* and set on the element's style object using property assignment, allowing the
|
||||
* style object to translate JavaScript-style names to CSS property names.
|
||||
*
|
||||
* For example `styleMap({backgroundColor: 'red', 'border-top': '5px', '--size':
|
||||
* '0'})` sets the `background-color`, `border-top` and `--size` properties.
|
||||
*
|
||||
* @param styleInfo
|
||||
* @see {@link https://lit.dev/docs/templates/directives/#stylemap styleMap code samples on Lit.dev}
|
||||
*/
|
||||
export declare const styleMap: (styleInfo: Readonly<StyleInfo>) => import("../directive.js").DirectiveResult<typeof StyleMapDirective>;
|
||||
/**
|
||||
* The type of the class that powers this directive. Necessary for naming the
|
||||
* directive's return type.
|
||||
*/
|
||||
export type { StyleMapDirective };
|
||||
//# sourceMappingURL=style-map.d.ts.map
|
1
node_modules/lit-html/development/directives/style-map.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/style-map.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"style-map.d.ts","sourceRoot":"","sources":["../../src/directives/style-map.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAEL,SAAS,EACT,mBAAmB,EACnB,QAAQ,EAET,MAAM,iBAAiB,CAAC;AAEzB;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;CACpD;AAQD,cAAM,iBAAkB,SAAQ,SAAS;IACvC,wBAAwB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;gBAE3B,QAAQ,EAAE,QAAQ;IAc9B,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC;IAsB5B,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,SAAS,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC;CAoD5E;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,QAAQ,yGAA+B,CAAC;AAErD;;;GAGG;AACH,YAAY,EAAC,iBAAiB,EAAC,CAAC"}
|
113
node_modules/lit-html/development/directives/style-map.js
generated
vendored
Normal file
113
node_modules/lit-html/development/directives/style-map.js
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { noChange } from '../lit-html.js';
|
||||
import { directive, Directive, PartType, } from '../directive.js';
|
||||
const important = 'important';
|
||||
// The leading space is important
|
||||
const importantFlag = ' !' + important;
|
||||
// How many characters to remove from a value, as a negative number
|
||||
const flagTrim = 0 - importantFlag.length;
|
||||
class StyleMapDirective extends Directive {
|
||||
constructor(partInfo) {
|
||||
var _a;
|
||||
super(partInfo);
|
||||
if (partInfo.type !== PartType.ATTRIBUTE ||
|
||||
partInfo.name !== 'style' ||
|
||||
((_a = partInfo.strings) === null || _a === void 0 ? void 0 : _a.length) > 2) {
|
||||
throw new Error('The `styleMap` directive must be used in the `style` attribute ' +
|
||||
'and must be the only part in the attribute.');
|
||||
}
|
||||
}
|
||||
render(styleInfo) {
|
||||
return Object.keys(styleInfo).reduce((style, prop) => {
|
||||
const value = styleInfo[prop];
|
||||
if (value == null) {
|
||||
return style;
|
||||
}
|
||||
// Convert property names from camel-case to dash-case, i.e.:
|
||||
// `backgroundColor` -> `background-color`
|
||||
// Vendor-prefixed names need an extra `-` appended to front:
|
||||
// `webkitAppearance` -> `-webkit-appearance`
|
||||
// Exception is any property name containing a dash, including
|
||||
// custom properties; we assume these are already dash-cased i.e.:
|
||||
// `--my-button-color` --> `--my-button-color`
|
||||
prop = prop.includes('-')
|
||||
? prop
|
||||
: prop
|
||||
.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, '-$&')
|
||||
.toLowerCase();
|
||||
return style + `${prop}:${value};`;
|
||||
}, '');
|
||||
}
|
||||
update(part, [styleInfo]) {
|
||||
const { style } = part.element;
|
||||
if (this._previousStyleProperties === undefined) {
|
||||
this._previousStyleProperties = new Set();
|
||||
for (const name in styleInfo) {
|
||||
this._previousStyleProperties.add(name);
|
||||
}
|
||||
return this.render(styleInfo);
|
||||
}
|
||||
// Remove old properties that no longer exist in styleInfo
|
||||
// We use forEach() instead of for-of so that re don't require down-level
|
||||
// iteration.
|
||||
this._previousStyleProperties.forEach((name) => {
|
||||
// If the name isn't in styleInfo or it's null/undefined
|
||||
if (styleInfo[name] == null) {
|
||||
this._previousStyleProperties.delete(name);
|
||||
if (name.includes('-')) {
|
||||
style.removeProperty(name);
|
||||
}
|
||||
else {
|
||||
// Note reset using empty string (vs null) as IE11 does not always
|
||||
// reset via null (https://developer.mozilla.org/en-US/docs/Web/API/ElementCSSInlineStyle/style#setting_styles)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
style[name] = '';
|
||||
}
|
||||
}
|
||||
});
|
||||
// Add or update properties
|
||||
for (const name in styleInfo) {
|
||||
const value = styleInfo[name];
|
||||
if (value != null) {
|
||||
this._previousStyleProperties.add(name);
|
||||
const isImportant = typeof value === 'string' && value.endsWith(importantFlag);
|
||||
if (name.includes('-') || isImportant) {
|
||||
style.setProperty(name, isImportant
|
||||
? value.slice(0, flagTrim)
|
||||
: value, isImportant ? important : '');
|
||||
}
|
||||
else {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
style[name] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return noChange;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A directive that applies CSS properties to an element.
|
||||
*
|
||||
* `styleMap` can only be used in the `style` attribute and must be the only
|
||||
* expression in the attribute. It takes the property names in the
|
||||
* {@link StyleInfo styleInfo} object and adds the properties to the inline
|
||||
* style of the element.
|
||||
*
|
||||
* Property names with dashes (`-`) are assumed to be valid CSS
|
||||
* property names and set on the element's style object using `setProperty()`.
|
||||
* Names without dashes are assumed to be camelCased JavaScript property names
|
||||
* and set on the element's style object using property assignment, allowing the
|
||||
* style object to translate JavaScript-style names to CSS property names.
|
||||
*
|
||||
* For example `styleMap({backgroundColor: 'red', 'border-top': '5px', '--size':
|
||||
* '0'})` sets the `background-color`, `border-top` and `--size` properties.
|
||||
*
|
||||
* @param styleInfo
|
||||
* @see {@link https://lit.dev/docs/templates/directives/#stylemap styleMap code samples on Lit.dev}
|
||||
*/
|
||||
export const styleMap = directive(StyleMapDirective);
|
||||
//# sourceMappingURL=style-map.js.map
|
1
node_modules/lit-html/development/directives/style-map.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/style-map.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
26
node_modules/lit-html/development/directives/template-content.d.ts
generated
vendored
Normal file
26
node_modules/lit-html/development/directives/template-content.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { noChange } from '../lit-html.js';
|
||||
import { Directive, PartInfo } from '../directive.js';
|
||||
declare class TemplateContentDirective extends Directive {
|
||||
private _previousTemplate?;
|
||||
constructor(partInfo: PartInfo);
|
||||
render(template: HTMLTemplateElement): DocumentFragment | typeof noChange;
|
||||
}
|
||||
/**
|
||||
* Renders the content of a template element as HTML.
|
||||
*
|
||||
* Note, the template should be developer controlled and not user controlled.
|
||||
* Rendering a user-controlled template with this directive
|
||||
* could lead to cross-site-scripting vulnerabilities.
|
||||
*/
|
||||
export declare const templateContent: (template: HTMLTemplateElement) => import("../directive.js").DirectiveResult<typeof TemplateContentDirective>;
|
||||
/**
|
||||
* The type of the class that powers this directive. Necessary for naming the
|
||||
* directive's return type.
|
||||
*/
|
||||
export type { TemplateContentDirective };
|
||||
//# sourceMappingURL=template-content.d.ts.map
|
1
node_modules/lit-html/development/directives/template-content.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/template-content.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"template-content.d.ts","sourceRoot":"","sources":["../../src/directives/template-content.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAY,SAAS,EAAE,QAAQ,EAAW,MAAM,iBAAiB,CAAC;AAEzE,cAAM,wBAAyB,SAAQ,SAAS;IAC9C,OAAO,CAAC,iBAAiB,CAAC,CAAsB;gBAEpC,QAAQ,EAAE,QAAQ;IAO9B,MAAM,CAAC,QAAQ,EAAE,mBAAmB;CAOrC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,+GAAsC,CAAC;AAEnE;;;GAGG;AACH,YAAY,EAAC,wBAAwB,EAAC,CAAC"}
|
31
node_modules/lit-html/development/directives/template-content.js
generated
vendored
Normal file
31
node_modules/lit-html/development/directives/template-content.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { noChange } from '../lit-html.js';
|
||||
import { directive, Directive, PartType } from '../directive.js';
|
||||
class TemplateContentDirective extends Directive {
|
||||
constructor(partInfo) {
|
||||
super(partInfo);
|
||||
if (partInfo.type !== PartType.CHILD) {
|
||||
throw new Error('templateContent can only be used in child bindings');
|
||||
}
|
||||
}
|
||||
render(template) {
|
||||
if (this._previousTemplate === template) {
|
||||
return noChange;
|
||||
}
|
||||
this._previousTemplate = template;
|
||||
return document.importNode(template.content, true);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Renders the content of a template element as HTML.
|
||||
*
|
||||
* Note, the template should be developer controlled and not user controlled.
|
||||
* Rendering a user-controlled template with this directive
|
||||
* could lead to cross-site-scripting vulnerabilities.
|
||||
*/
|
||||
export const templateContent = directive(TemplateContentDirective);
|
||||
//# sourceMappingURL=template-content.js.map
|
1
node_modules/lit-html/development/directives/template-content.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/template-content.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"template-content.js","sourceRoot":"","sources":["../../src/directives/template-content.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAC,SAAS,EAAE,SAAS,EAAY,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AAEzE,MAAM,wBAAyB,SAAQ,SAAS;IAG9C,YAAY,QAAkB;QAC5B,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,KAAK,EAAE;YACpC,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;SACvE;IACH,CAAC;IAED,MAAM,CAAC,QAA6B;QAClC,IAAI,IAAI,CAAC,iBAAiB,KAAK,QAAQ,EAAE;YACvC,OAAO,QAAQ,CAAC;SACjB;QACD,IAAI,CAAC,iBAAiB,GAAG,QAAQ,CAAC;QAClC,OAAO,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {noChange} from '../lit-html.js';\nimport {directive, Directive, PartInfo, PartType} from '../directive.js';\n\nclass TemplateContentDirective extends Directive {\n private _previousTemplate?: HTMLTemplateElement;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error('templateContent can only be used in child bindings');\n }\n }\n\n render(template: HTMLTemplateElement) {\n if (this._previousTemplate === template) {\n return noChange;\n }\n this._previousTemplate = template;\n return document.importNode(template.content, true);\n }\n}\n\n/**\n * Renders the content of a template element as HTML.\n *\n * Note, the template should be developer controlled and not user controlled.\n * Rendering a user-controlled template with this directive\n * could lead to cross-site-scripting vulnerabilities.\n */\nexport const templateContent = directive(TemplateContentDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {TemplateContentDirective};\n"]}
|
27
node_modules/lit-html/development/directives/unsafe-html.d.ts
generated
vendored
Normal file
27
node_modules/lit-html/development/directives/unsafe-html.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { nothing, TemplateResult, noChange } from '../lit-html.js';
|
||||
import { Directive, PartInfo } from '../directive.js';
|
||||
export declare class UnsafeHTMLDirective extends Directive {
|
||||
static directiveName: string;
|
||||
static resultType: number;
|
||||
private _value;
|
||||
private _templateResult?;
|
||||
constructor(partInfo: PartInfo);
|
||||
render(value: string | typeof nothing | typeof noChange | undefined | null): typeof noChange | typeof nothing | TemplateResult<1 | 2> | null | undefined;
|
||||
}
|
||||
/**
|
||||
* Renders the result as HTML, rather than text.
|
||||
*
|
||||
* The values `undefined`, `null`, and `nothing`, will all result in no content
|
||||
* (empty string) being rendered.
|
||||
*
|
||||
* Note, this is unsafe to use with any user-provided input that hasn't been
|
||||
* sanitized or escaped, as it may lead to cross-site-scripting
|
||||
* vulnerabilities.
|
||||
*/
|
||||
export declare const unsafeHTML: (value: string | typeof noChange | typeof nothing | null | undefined) => import("../directive.js").DirectiveResult<typeof UnsafeHTMLDirective>;
|
||||
//# sourceMappingURL=unsafe-html.d.ts.map
|
1
node_modules/lit-html/development/directives/unsafe-html.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/unsafe-html.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"unsafe-html.d.ts","sourceRoot":"","sources":["../../src/directives/unsafe-html.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAY,SAAS,EAAE,QAAQ,EAAW,MAAM,iBAAiB,CAAC;AAIzE,qBAAa,mBAAoB,SAAQ,SAAS;IAChD,MAAM,CAAC,aAAa,SAAgB;IACpC,MAAM,CAAC,UAAU,SAAe;IAEhC,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,eAAe,CAAC,CAAiB;gBAE7B,QAAQ,EAAE,QAAQ;IAW9B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,OAAO,GAAG,OAAO,QAAQ,GAAG,SAAS,GAAG,IAAI;CAkC3E;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,gJAAiC,CAAC"}
|
61
node_modules/lit-html/development/directives/unsafe-html.js
generated
vendored
Normal file
61
node_modules/lit-html/development/directives/unsafe-html.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { nothing, noChange } from '../lit-html.js';
|
||||
import { directive, Directive, PartType } from '../directive.js';
|
||||
const HTML_RESULT = 1;
|
||||
export class UnsafeHTMLDirective extends Directive {
|
||||
constructor(partInfo) {
|
||||
super(partInfo);
|
||||
this._value = nothing;
|
||||
if (partInfo.type !== PartType.CHILD) {
|
||||
throw new Error(`${this.constructor.directiveName}() can only be used in child bindings`);
|
||||
}
|
||||
}
|
||||
render(value) {
|
||||
if (value === nothing || value == null) {
|
||||
this._templateResult = undefined;
|
||||
return (this._value = value);
|
||||
}
|
||||
if (value === noChange) {
|
||||
return value;
|
||||
}
|
||||
if (typeof value != 'string') {
|
||||
throw new Error(`${this.constructor.directiveName}() called with a non-string value`);
|
||||
}
|
||||
if (value === this._value) {
|
||||
return this._templateResult;
|
||||
}
|
||||
this._value = value;
|
||||
const strings = [value];
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
strings.raw = strings;
|
||||
// WARNING: impersonating a TemplateResult like this is extremely
|
||||
// dangerous. Third-party directives should not do this.
|
||||
return (this._templateResult = {
|
||||
// Cast to a known set of integers that satisfy ResultType so that we
|
||||
// don't have to export ResultType and possibly encourage this pattern.
|
||||
// This property needs to remain unminified.
|
||||
['_$litType$']: this.constructor
|
||||
.resultType,
|
||||
strings,
|
||||
values: [],
|
||||
});
|
||||
}
|
||||
}
|
||||
UnsafeHTMLDirective.directiveName = 'unsafeHTML';
|
||||
UnsafeHTMLDirective.resultType = HTML_RESULT;
|
||||
/**
|
||||
* Renders the result as HTML, rather than text.
|
||||
*
|
||||
* The values `undefined`, `null`, and `nothing`, will all result in no content
|
||||
* (empty string) being rendered.
|
||||
*
|
||||
* Note, this is unsafe to use with any user-provided input that hasn't been
|
||||
* sanitized or escaped, as it may lead to cross-site-scripting
|
||||
* vulnerabilities.
|
||||
*/
|
||||
export const unsafeHTML = directive(UnsafeHTMLDirective);
|
||||
//# sourceMappingURL=unsafe-html.js.map
|
1
node_modules/lit-html/development/directives/unsafe-html.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/unsafe-html.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"unsafe-html.js","sourceRoot":"","sources":["../../src/directives/unsafe-html.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,EAAkB,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAC,SAAS,EAAE,SAAS,EAAY,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AAEzE,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAOhD,YAAY,QAAkB;QAC5B,KAAK,CAAC,QAAQ,CAAC,CAAC;QAJV,WAAM,GAAY,OAAO,CAAC;QAKhC,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,KAAK,EAAE;YACpC,MAAM,IAAI,KAAK,CACb,GACG,IAAI,CAAC,WAA0C,CAAC,aACnD,uCAAuC,CACxC,CAAC;SACH;IACH,CAAC;IAED,MAAM,CAAC,KAAmE;QACxE,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,IAAI,IAAI,EAAE;YACtC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;SAC9B;QACD,IAAI,KAAK,KAAK,QAAQ,EAAE;YACtB,OAAO,KAAK,CAAC;SACd;QACD,IAAI,OAAO,KAAK,IAAI,QAAQ,EAAE;YAC5B,MAAM,IAAI,KAAK,CACb,GACG,IAAI,CAAC,WAA0C,CAAC,aACnD,mCAAmC,CACpC,CAAC;SACH;QACD,IAAI,KAAK,KAAK,IAAI,CAAC,MAAM,EAAE;YACzB,OAAO,IAAI,CAAC,eAAe,CAAC;SAC7B;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,MAAM,OAAO,GAAG,CAAC,KAAK,CAAoC,CAAC;QAC3D,8DAA8D;QAC7D,OAAe,CAAC,GAAG,GAAG,OAAO,CAAC;QAC/B,iEAAiE;QACjE,wDAAwD;QACxD,OAAO,CAAC,IAAI,CAAC,eAAe,GAAG;YAC7B,qEAAqE;YACrE,uEAAuE;YACvE,4CAA4C;YAC5C,CAAC,YAAY,CAAC,EAAG,IAAI,CAAC,WAA0C;iBAC7D,UAAmB;YACtB,OAAO;YACP,MAAM,EAAE,EAAE;SACX,CAAC,CAAC;IACL,CAAC;;AAlDM,iCAAa,GAAG,YAAY,CAAC;AAC7B,8BAAU,GAAG,WAAW,CAAC;AAoDlC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC,mBAAmB,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {nothing, TemplateResult, noChange} from '../lit-html.js';\nimport {directive, Directive, PartInfo, PartType} from '../directive.js';\n\nconst HTML_RESULT = 1;\n\nexport class UnsafeHTMLDirective extends Directive {\n static directiveName = 'unsafeHTML';\n static resultType = HTML_RESULT;\n\n private _value: unknown = nothing;\n private _templateResult?: TemplateResult;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error(\n `${\n (this.constructor as typeof UnsafeHTMLDirective).directiveName\n }() can only be used in child bindings`\n );\n }\n }\n\n render(value: string | typeof nothing | typeof noChange | undefined | null) {\n if (value === nothing || value == null) {\n this._templateResult = undefined;\n return (this._value = value);\n }\n if (value === noChange) {\n return value;\n }\n if (typeof value != 'string') {\n throw new Error(\n `${\n (this.constructor as typeof UnsafeHTMLDirective).directiveName\n }() called with a non-string value`\n );\n }\n if (value === this._value) {\n return this._templateResult;\n }\n this._value = value;\n const strings = [value] as unknown as TemplateStringsArray;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (strings as any).raw = strings;\n // WARNING: impersonating a TemplateResult like this is extremely\n // dangerous. Third-party directives should not do this.\n return (this._templateResult = {\n // Cast to a known set of integers that satisfy ResultType so that we\n // don't have to export ResultType and possibly encourage this pattern.\n // This property needs to remain unminified.\n ['_$litType$']: (this.constructor as typeof UnsafeHTMLDirective)\n .resultType as 1 | 2,\n strings,\n values: [],\n });\n }\n}\n\n/**\n * Renders the result as HTML, rather than text.\n *\n * The values `undefined`, `null`, and `nothing`, will all result in no content\n * (empty string) being rendered.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nexport const unsafeHTML = directive(UnsafeHTMLDirective);\n"]}
|
27
node_modules/lit-html/development/directives/unsafe-svg.d.ts
generated
vendored
Normal file
27
node_modules/lit-html/development/directives/unsafe-svg.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { UnsafeHTMLDirective } from './unsafe-html.js';
|
||||
declare class UnsafeSVGDirective extends UnsafeHTMLDirective {
|
||||
static directiveName: string;
|
||||
static resultType: number;
|
||||
}
|
||||
/**
|
||||
* Renders the result as SVG, rather than text.
|
||||
*
|
||||
* The values `undefined`, `null`, and `nothing`, will all result in no content
|
||||
* (empty string) being rendered.
|
||||
*
|
||||
* Note, this is unsafe to use with any user-provided input that hasn't been
|
||||
* sanitized or escaped, as it may lead to cross-site-scripting
|
||||
* vulnerabilities.
|
||||
*/
|
||||
export declare const unsafeSVG: (value: string | typeof import("../lit-html.js").noChange | typeof import("../lit-html.js").nothing | null | undefined) => import("../directive.js").DirectiveResult<typeof UnsafeSVGDirective>;
|
||||
/**
|
||||
* The type of the class that powers this directive. Necessary for naming the
|
||||
* directive's return type.
|
||||
*/
|
||||
export type { UnsafeSVGDirective };
|
||||
//# sourceMappingURL=unsafe-svg.d.ts.map
|
1
node_modules/lit-html/development/directives/unsafe-svg.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/unsafe-svg.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"unsafe-svg.d.ts","sourceRoot":"","sources":["../../src/directives/unsafe-svg.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAIrD,cAAM,kBAAmB,SAAQ,mBAAmB;IAClD,OAAgB,aAAa,SAAe;IAC5C,OAAgB,UAAU,SAAc;CACzC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,iMAAgC,CAAC;AAEvD;;;GAGG;AACH,YAAY,EAAC,kBAAkB,EAAC,CAAC"}
|
24
node_modules/lit-html/development/directives/unsafe-svg.js
generated
vendored
Normal file
24
node_modules/lit-html/development/directives/unsafe-svg.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { directive } from '../directive.js';
|
||||
import { UnsafeHTMLDirective } from './unsafe-html.js';
|
||||
const SVG_RESULT = 2;
|
||||
class UnsafeSVGDirective extends UnsafeHTMLDirective {
|
||||
}
|
||||
UnsafeSVGDirective.directiveName = 'unsafeSVG';
|
||||
UnsafeSVGDirective.resultType = SVG_RESULT;
|
||||
/**
|
||||
* Renders the result as SVG, rather than text.
|
||||
*
|
||||
* The values `undefined`, `null`, and `nothing`, will all result in no content
|
||||
* (empty string) being rendered.
|
||||
*
|
||||
* Note, this is unsafe to use with any user-provided input that hasn't been
|
||||
* sanitized or escaped, as it may lead to cross-site-scripting
|
||||
* vulnerabilities.
|
||||
*/
|
||||
export const unsafeSVG = directive(UnsafeSVGDirective);
|
||||
//# sourceMappingURL=unsafe-svg.js.map
|
1
node_modules/lit-html/development/directives/unsafe-svg.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/unsafe-svg.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"unsafe-svg.js","sourceRoot":"","sources":["../../src/directives/unsafe-svg.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAErD,MAAM,UAAU,GAAG,CAAC,CAAC;AAErB,MAAM,kBAAmB,SAAQ,mBAAmB;;AAClC,gCAAa,GAAG,WAAW,CAAC;AAC5B,6BAAU,GAAG,UAAU,CAAC;AAG1C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {directive} from '../directive.js';\nimport {UnsafeHTMLDirective} from './unsafe-html.js';\n\nconst SVG_RESULT = 2;\n\nclass UnsafeSVGDirective extends UnsafeHTMLDirective {\n static override directiveName = 'unsafeSVG';\n static override resultType = SVG_RESULT;\n}\n\n/**\n * Renders the result as SVG, rather than text.\n *\n * The values `undefined`, `null`, and `nothing`, will all result in no content\n * (empty string) being rendered.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nexport const unsafeSVG = directive(UnsafeSVGDirective);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {UnsafeSVGDirective};\n"]}
|
44
node_modules/lit-html/development/directives/until.d.ts
generated
vendored
Normal file
44
node_modules/lit-html/development/directives/until.d.ts
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { Part } from '../lit-html.js';
|
||||
import { AsyncDirective } from '../async-directive.js';
|
||||
export declare class UntilDirective extends AsyncDirective {
|
||||
private __lastRenderedIndex;
|
||||
private __values;
|
||||
private __weakThis;
|
||||
private __pauser;
|
||||
render(...args: Array<unknown>): unknown;
|
||||
update(_part: Part, args: Array<unknown>): unknown;
|
||||
disconnected(): void;
|
||||
reconnected(): void;
|
||||
}
|
||||
/**
|
||||
* Renders one of a series of values, including Promises, to a Part.
|
||||
*
|
||||
* Values are rendered in priority order, with the first argument having the
|
||||
* highest priority and the last argument having the lowest priority. If a
|
||||
* value is a Promise, low-priority values will be rendered until it resolves.
|
||||
*
|
||||
* The priority of values can be used to create placeholder content for async
|
||||
* data. For example, a Promise with pending content can be the first,
|
||||
* highest-priority, argument, and a non_promise loading indicator template can
|
||||
* be used as the second, lower-priority, argument. The loading indicator will
|
||||
* render immediately, and the primary content will render when the Promise
|
||||
* resolves.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* const content = fetch('./content.txt').then(r => r.text());
|
||||
* html`${until(content, html`<span>Loading...</span>`)}`
|
||||
* ```
|
||||
*/
|
||||
export declare const until: (...values: unknown[]) => import("../directive.js").DirectiveResult<typeof UntilDirective>;
|
||||
/**
|
||||
* The type of the class that powers this directive. Necessary for naming the
|
||||
* directive's return type.
|
||||
*/
|
||||
//# sourceMappingURL=until.d.ts.map
|
1
node_modules/lit-html/development/directives/until.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/until.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"until.d.ts","sourceRoot":"","sources":["../../src/directives/until.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,IAAI,EAAW,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAY,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAShE,qBAAa,cAAe,SAAQ,cAAc;IAChD,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,QAAQ,CAAgB;IAEhC,MAAM,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC;IAIrB,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC;IAuExC,YAAY;IAKZ,WAAW;CAIrB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,KAAK,4FAA4B,CAAC;AAE/C;;;GAGG"}
|
124
node_modules/lit-html/development/directives/until.js
generated
vendored
Normal file
124
node_modules/lit-html/development/directives/until.js
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
import { noChange } from '../lit-html.js';
|
||||
import { isPrimitive } from '../directive-helpers.js';
|
||||
import { directive, AsyncDirective } from '../async-directive.js';
|
||||
import { Pauser, PseudoWeakRef } from './private-async-helpers.js';
|
||||
const isPromise = (x) => {
|
||||
return !isPrimitive(x) && typeof x.then === 'function';
|
||||
};
|
||||
// Effectively infinity, but a SMI.
|
||||
const _infinity = 0x3fffffff;
|
||||
export class UntilDirective extends AsyncDirective {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.__lastRenderedIndex = _infinity;
|
||||
this.__values = [];
|
||||
this.__weakThis = new PseudoWeakRef(this);
|
||||
this.__pauser = new Pauser();
|
||||
}
|
||||
render(...args) {
|
||||
var _a;
|
||||
return (_a = args.find((x) => !isPromise(x))) !== null && _a !== void 0 ? _a : noChange;
|
||||
}
|
||||
update(_part, args) {
|
||||
const previousValues = this.__values;
|
||||
let previousLength = previousValues.length;
|
||||
this.__values = args;
|
||||
const weakThis = this.__weakThis;
|
||||
const pauser = this.__pauser;
|
||||
// If our initial render occurs while disconnected, ensure that the pauser
|
||||
// and weakThis are in the disconnected state
|
||||
if (!this.isConnected) {
|
||||
this.disconnected();
|
||||
}
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
// If we've rendered a higher-priority value already, stop.
|
||||
if (i > this.__lastRenderedIndex) {
|
||||
break;
|
||||
}
|
||||
const value = args[i];
|
||||
// Render non-Promise values immediately
|
||||
if (!isPromise(value)) {
|
||||
this.__lastRenderedIndex = i;
|
||||
// Since a lower-priority value will never overwrite a higher-priority
|
||||
// synchronous value, we can stop processing now.
|
||||
return value;
|
||||
}
|
||||
// If this is a Promise we've already handled, skip it.
|
||||
if (i < previousLength && value === previousValues[i]) {
|
||||
continue;
|
||||
}
|
||||
// We have a Promise that we haven't seen before, so priorities may have
|
||||
// changed. Forget what we rendered before.
|
||||
this.__lastRenderedIndex = _infinity;
|
||||
previousLength = 0;
|
||||
// Note, the callback avoids closing over `this` so that the directive
|
||||
// can be gc'ed before the promise resolves; instead `this` is retrieved
|
||||
// from `weakThis`, which can break the hard reference in the closure when
|
||||
// the directive disconnects
|
||||
Promise.resolve(value).then(async (result) => {
|
||||
// If we're disconnected, wait until we're (maybe) reconnected
|
||||
// The while loop here handles the case that the connection state
|
||||
// thrashes, causing the pauser to resume and then get re-paused
|
||||
while (pauser.get()) {
|
||||
await pauser.get();
|
||||
}
|
||||
// If the callback gets here and there is no `this`, it means that the
|
||||
// directive has been disconnected and garbage collected and we don't
|
||||
// need to do anything else
|
||||
const _this = weakThis.deref();
|
||||
if (_this !== undefined) {
|
||||
const index = _this.__values.indexOf(value);
|
||||
// If state.values doesn't contain the value, we've re-rendered without
|
||||
// the value, so don't render it. Then, only render if the value is
|
||||
// higher-priority than what's already been rendered.
|
||||
if (index > -1 && index < _this.__lastRenderedIndex) {
|
||||
_this.__lastRenderedIndex = index;
|
||||
_this.setValue(result);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return noChange;
|
||||
}
|
||||
disconnected() {
|
||||
this.__weakThis.disconnect();
|
||||
this.__pauser.pause();
|
||||
}
|
||||
reconnected() {
|
||||
this.__weakThis.reconnect(this);
|
||||
this.__pauser.resume();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Renders one of a series of values, including Promises, to a Part.
|
||||
*
|
||||
* Values are rendered in priority order, with the first argument having the
|
||||
* highest priority and the last argument having the lowest priority. If a
|
||||
* value is a Promise, low-priority values will be rendered until it resolves.
|
||||
*
|
||||
* The priority of values can be used to create placeholder content for async
|
||||
* data. For example, a Promise with pending content can be the first,
|
||||
* highest-priority, argument, and a non_promise loading indicator template can
|
||||
* be used as the second, lower-priority, argument. The loading indicator will
|
||||
* render immediately, and the primary content will render when the Promise
|
||||
* resolves.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* const content = fetch('./content.txt').then(r => r.text());
|
||||
* html`${until(content, html`<span>Loading...</span>`)}`
|
||||
* ```
|
||||
*/
|
||||
export const until = directive(UntilDirective);
|
||||
/**
|
||||
* The type of the class that powers this directive. Necessary for naming the
|
||||
* directive's return type.
|
||||
*/
|
||||
// export type {UntilDirective};
|
||||
//# sourceMappingURL=until.js.map
|
1
node_modules/lit-html/development/directives/until.js.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/until.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
26
node_modules/lit-html/development/directives/when.d.ts
generated
vendored
Normal file
26
node_modules/lit-html/development/directives/when.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
/**
|
||||
* When `condition` is true, returns the result of calling `trueCase()`, else
|
||||
* returns the result of calling `falseCase()` if `falseCase` is defined.
|
||||
*
|
||||
* This is a convenience wrapper around a ternary expression that makes it a
|
||||
* little nicer to write an inline conditional without an else.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* render() {
|
||||
* return html`
|
||||
* ${when(this.user, () => html`User: ${this.user.username}`, () => html`Sign In...`)}
|
||||
* `;
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export declare function when<T, F>(condition: true, trueCase: () => T, falseCase?: () => F): T;
|
||||
export declare function when<T, F = undefined>(condition: false, trueCase: () => T, falseCase?: () => F): F;
|
||||
export declare function when<T, F = undefined>(condition: unknown, trueCase: () => T, falseCase?: () => F): T | F;
|
||||
//# sourceMappingURL=when.d.ts.map
|
1
node_modules/lit-html/development/directives/when.d.ts.map
generated
vendored
Normal file
1
node_modules/lit-html/development/directives/when.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"when.d.ts","sourceRoot":"","sources":["../../src/directives/when.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,EACvB,SAAS,EAAE,IAAI,EACf,QAAQ,EAAE,MAAM,CAAC,EACjB,SAAS,CAAC,EAAE,MAAM,CAAC,GAClB,CAAC,CAAC;AACL,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,EACnC,SAAS,EAAE,KAAK,EAChB,QAAQ,EAAE,MAAM,CAAC,EACjB,SAAS,CAAC,EAAE,MAAM,CAAC,GAClB,CAAC,CAAC;AACL,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,EACnC,SAAS,EAAE,OAAO,EAClB,QAAQ,EAAE,MAAM,CAAC,EACjB,SAAS,CAAC,EAAE,MAAM,CAAC,GAClB,CAAC,GAAG,CAAC,CAAC"}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user