@rxdi/lit-html 0.7.156 → 0.7.158

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/async.d.ts +3 -3
  2. package/dist/async.js +4 -4
  3. package/dist/decorators/component.decorator.d.ts +1 -2
  4. package/dist/decorators/component.decorator.js +3 -3
  5. package/dist/index.d.ts +28 -17
  6. package/dist/index.js +28 -17
  7. package/package.json +4 -2
  8. package/dist/lit-element/decorators.d.ts +0 -14
  9. package/dist/lit-element/decorators.js +0 -32
  10. package/dist/lit-element/experimental-hydrate-support.d.ts +0 -6
  11. package/dist/lit-element/experimental-hydrate-support.js +0 -65
  12. package/dist/lit-element/index.d.ts +0 -7
  13. package/dist/lit-element/index.js +0 -25
  14. package/dist/lit-element/lit-element.d.ts +0 -157
  15. package/dist/lit-element/lit-element.js +0 -258
  16. package/dist/lit-element/polyfill-support.d.ts +0 -24
  17. package/dist/lit-element/polyfill-support.js +0 -58
  18. package/dist/lit-element/private-ssr-support.d.ts +0 -21
  19. package/dist/lit-element/private-ssr-support.js +0 -25
  20. package/dist/lit-html/async-directive.d.ts +0 -170
  21. package/dist/lit-html/async-directive.js +0 -250
  22. package/dist/lit-html/directive-helpers.d.ts +0 -105
  23. package/dist/lit-html/directive-helpers.js +0 -192
  24. package/dist/lit-html/directive.d.ts +0 -65
  25. package/dist/lit-html/directive.js +0 -52
  26. package/dist/lit-html/directives/async-append.d.ts +0 -38
  27. package/dist/lit-html/directives/async-append.js +0 -55
  28. package/dist/lit-html/directives/async-replace.d.ts +0 -39
  29. package/dist/lit-html/directives/async-replace.js +0 -112
  30. package/dist/lit-html/directives/cache.d.ts +0 -34
  31. package/dist/lit-html/directives/cache.js +0 -80
  32. package/dist/lit-html/directives/class-map.d.ts +0 -44
  33. package/dist/lit-html/directives/class-map.js +0 -92
  34. package/dist/lit-html/directives/guard.d.ts +0 -59
  35. package/dist/lit-html/directives/guard.js +0 -82
  36. package/dist/lit-html/directives/if-defined.d.ts +0 -13
  37. package/dist/lit-html/directives/if-defined.js +0 -17
  38. package/dist/lit-html/directives/live.d.ts +0 -42
  39. package/dist/lit-html/directives/live.js +0 -79
  40. package/dist/lit-html/directives/private-async-helpers.d.ts +0 -57
  41. package/dist/lit-html/directives/private-async-helpers.js +0 -117
  42. package/dist/lit-html/directives/ref.d.ts +0 -65
  43. package/dist/lit-html/directives/ref.js +0 -113
  44. package/dist/lit-html/directives/repeat.d.ts +0 -63
  45. package/dist/lit-html/directives/repeat.js +0 -416
  46. package/dist/lit-html/directives/style-map.d.ts +0 -46
  47. package/dist/lit-html/directives/style-map.js +0 -102
  48. package/dist/lit-html/directives/template-content.d.ts +0 -25
  49. package/dist/lit-html/directives/template-content.js +0 -33
  50. package/dist/lit-html/directives/unsafe-html.d.ts +0 -26
  51. package/dist/lit-html/directives/unsafe-html.js +0 -64
  52. package/dist/lit-html/directives/unsafe-svg.d.ts +0 -26
  53. package/dist/lit-html/directives/unsafe-svg.js +0 -26
  54. package/dist/lit-html/directives/until.d.ts +0 -43
  55. package/dist/lit-html/directives/until.js +0 -137
  56. package/dist/lit-html/experimental-hydrate.d.ts +0 -50
  57. package/dist/lit-html/experimental-hydrate.js +0 -322
  58. package/dist/lit-html/lit-html.d.ts +0 -335
  59. package/dist/lit-html/lit-html.js +0 -1259
  60. package/dist/lit-html/polyfill-support.d.ts +0 -67
  61. package/dist/lit-html/polyfill-support.js +0 -185
  62. package/dist/lit-html/private-ssr-support.d.ts +0 -52
  63. package/dist/lit-html/private-ssr-support.js +0 -54
  64. package/dist/lit-html/static.d.ts +0 -58
  65. package/dist/lit-html/static.js +0 -114
  66. package/dist/reactive-element/css-tag.d.ts +0 -64
  67. package/dist/reactive-element/css-tag.js +0 -125
  68. package/dist/reactive-element/decorators/base.d.ts +0 -47
  69. package/dist/reactive-element/decorators/base.js +0 -70
  70. package/dist/reactive-element/decorators/custom-element.d.ts +0 -26
  71. package/dist/reactive-element/decorators/custom-element.js +0 -47
  72. package/dist/reactive-element/decorators/event-options.d.ts +0 -37
  73. package/dist/reactive-element/decorators/event-options.js +0 -47
  74. package/dist/reactive-element/decorators/index.d.ts +0 -14
  75. package/dist/reactive-element/decorators/index.js +0 -32
  76. package/dist/reactive-element/decorators/property.d.ts +0 -40
  77. package/dist/reactive-element/decorators/property.js +0 -92
  78. package/dist/reactive-element/decorators/query-all.d.ts +0 -31
  79. package/dist/reactive-element/decorators/query-all.js +0 -46
  80. package/dist/reactive-element/decorators/query-assigned-nodes.d.ts +0 -33
  81. package/dist/reactive-element/decorators/query-assigned-nodes.js +0 -55
  82. package/dist/reactive-element/decorators/query-async.d.ts +0 -39
  83. package/dist/reactive-element/decorators/query-async.js +0 -71
  84. package/dist/reactive-element/decorators/query.d.ts +0 -32
  85. package/dist/reactive-element/decorators/query.js +0 -60
  86. package/dist/reactive-element/decorators/state.d.ts +0 -24
  87. package/dist/reactive-element/decorators/state.js +0 -29
  88. package/dist/reactive-element/index.d.ts +0 -5
  89. package/dist/reactive-element/index.js +0 -17
  90. package/dist/reactive-element/polyfill-support.d.ts +0 -40
  91. package/dist/reactive-element/polyfill-support.js +0 -89
  92. package/dist/reactive-element/reactive-controller.d.ts +0 -76
  93. package/dist/reactive-element/reactive-controller.js +0 -7
  94. package/dist/reactive-element/reactive-element.d.ts +0 -653
  95. package/dist/reactive-element/reactive-element.js +0 -979
@@ -1,125 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright 2019 Google LLC
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.getCompatibleStyle = exports.adoptStyles = exports.css = exports.unsafeCSS = exports.CSSResult = exports.supportsAdoptingStyleSheets = void 0;
9
- /**
10
- * Whether the current browser supports `adoptedStyleSheets`.
11
- */
12
- exports.supportsAdoptingStyleSheets = window.ShadowRoot &&
13
- (window.ShadyCSS === undefined || window.ShadyCSS.nativeShadow) &&
14
- 'adoptedStyleSheets' in Document.prototype &&
15
- 'replace' in CSSStyleSheet.prototype;
16
- const constructionToken = Symbol();
17
- const styleSheetCache = new Map();
18
- /**
19
- * A container for a string of CSS text, that may be used to create a CSSStyleSheet.
20
- *
21
- * CSSResult is the return value of `css`-tagged template literals and
22
- * `unsafeCSS()`. In order to ensure that CSSResults are only created via the
23
- * `css` tag and `unsafeCSS()`, CSSResult cannot be constructed directly.
24
- */
25
- class CSSResult {
26
- constructor(cssText, safeToken) {
27
- // This property needs to remain unminified.
28
- this['_$cssResult$'] = true;
29
- if (safeToken !== constructionToken) {
30
- throw new Error('CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');
31
- }
32
- this.cssText = cssText;
33
- }
34
- // Note, this is a getter so that it's lazy. In practice, this means
35
- // stylesheets are not created until the first element instance is made.
36
- get styleSheet() {
37
- // Note, if `supportsAdoptingStyleSheets` is true then we assume
38
- // CSSStyleSheet is constructable.
39
- let styleSheet = styleSheetCache.get(this.cssText);
40
- if (exports.supportsAdoptingStyleSheets && styleSheet === undefined) {
41
- styleSheetCache.set(this.cssText, (styleSheet = new CSSStyleSheet()));
42
- styleSheet.replaceSync(this.cssText);
43
- }
44
- return styleSheet;
45
- }
46
- toString() {
47
- return this.cssText;
48
- }
49
- }
50
- exports.CSSResult = CSSResult;
51
- const textFromCSSResult = (value) => {
52
- // This property needs to remain unminified.
53
- if (value['_$cssResult$'] === true) {
54
- return value.cssText;
55
- }
56
- else if (typeof value === 'number') {
57
- return value;
58
- }
59
- else {
60
- throw new Error(`Value passed to 'css' function must be a 'css' function result: ` +
61
- `${value}. Use 'unsafeCSS' to pass non-literal values, but take care ` +
62
- `to ensure page security.`);
63
- }
64
- };
65
- /**
66
- * Wrap a value for interpolation in a [[`css`]] tagged template literal.
67
- *
68
- * This is unsafe because untrusted CSS text can be used to phone home
69
- * or exfiltrate data to an attacker controlled site. Take care to only use
70
- * this with trusted input.
71
- */
72
- const unsafeCSS = (value) => new CSSResult(typeof value === 'string' ? value : String(value), constructionToken);
73
- exports.unsafeCSS = unsafeCSS;
74
- /**
75
- * A template literal tag which can be used with LitElement's
76
- * [[LitElement.styles | `styles`]] property to set element styles.
77
- *
78
- * For security reasons, only literal string values and number may be used in
79
- * embedded expressions. To incorporate non-literal values [[`unsafeCSS`]] may
80
- * be used inside an expression.
81
- */
82
- const css = (strings, ...values) => {
83
- const cssText = strings.length === 1
84
- ? strings[0]
85
- : values.reduce((acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1], strings[0]);
86
- return new CSSResult(cssText, constructionToken);
87
- };
88
- exports.css = css;
89
- /**
90
- * Applies the given styles to a `shadowRoot`. When Shadow DOM is
91
- * available but `adoptedStyleSheets` is not, styles are appended to the
92
- * `shadowRoot` to [mimic spec behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).
93
- * Note, when shimming is used, any styles that are subsequently placed into
94
- * the shadowRoot should be placed *before* any shimmed adopted styles. This
95
- * will match spec behavior that gives adopted sheets precedence over styles in
96
- * shadowRoot.
97
- */
98
- const adoptStyles = (renderRoot, styles) => {
99
- if (exports.supportsAdoptingStyleSheets) {
100
- renderRoot.adoptedStyleSheets = styles.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet);
101
- }
102
- else {
103
- styles.forEach((s) => {
104
- const style = document.createElement('style');
105
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
106
- const nonce = window['litNonce'];
107
- if (nonce !== undefined) {
108
- style.setAttribute('nonce', nonce);
109
- }
110
- style.textContent = s.cssText;
111
- renderRoot.appendChild(style);
112
- });
113
- }
114
- };
115
- exports.adoptStyles = adoptStyles;
116
- const cssResultFromStyleSheet = (sheet) => {
117
- let cssText = '';
118
- for (const rule of sheet.cssRules) {
119
- cssText += rule.cssText;
120
- }
121
- return (0, exports.unsafeCSS)(cssText);
122
- };
123
- exports.getCompatibleStyle = exports.supportsAdoptingStyleSheets
124
- ? (s) => s
125
- : (s) => s instanceof CSSStyleSheet ? cssResultFromStyleSheet(s) : s;
@@ -1,47 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- import { ReactiveElement } from '../reactive-element';
7
- export declare type Constructor<T> = {
8
- new (...args: any[]): T;
9
- };
10
- export interface ClassDescriptor {
11
- kind: 'class';
12
- elements: ClassElement[];
13
- finisher?: <T>(clazz: Constructor<T>) => void | Constructor<T>;
14
- }
15
- export interface ClassElement {
16
- kind: 'field' | 'method';
17
- key: PropertyKey;
18
- placement: 'static' | 'prototype' | 'own';
19
- initializer?: Function;
20
- extras?: ClassElement[];
21
- finisher?: <T>(clazz: Constructor<T>) => void | Constructor<T>;
22
- descriptor?: PropertyDescriptor;
23
- }
24
- export declare const legacyPrototypeMethod: (descriptor: PropertyDescriptor, proto: Object, name: PropertyKey) => void;
25
- export declare const standardPrototypeMethod: (descriptor: PropertyDescriptor, element: ClassElement) => {
26
- kind: string;
27
- placement: string;
28
- key: PropertyKey;
29
- descriptor: PropertyDescriptor;
30
- };
31
- /**
32
- * Helper for decorating a property that is compatible with both TypeScript
33
- * and Babel decorators. The optional `finisher` can be used to perform work on
34
- * the class. The optional `descriptor` should return a PropertyDescriptor
35
- * to install for the given property.
36
- *
37
- * @param finisher {function} Optional finisher method; receives the element
38
- * constructor and property key as arguments and has no return value.
39
- * @param descriptor {function} Optional descriptor method; receives the
40
- * property key as an argument and returns a property descriptor to define for
41
- * the given property.
42
- * @returns {ClassElement|void}
43
- */
44
- export declare const decorateProperty: ({ finisher, descriptor, }: {
45
- finisher?: (ctor: typeof ReactiveElement, property: PropertyKey) => void;
46
- descriptor?: (property: PropertyKey) => PropertyDescriptor;
47
- }) => (protoOrDescriptor: ReactiveElement | ClassElement, name?: PropertyKey) => void | any;
@@ -1,70 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright 2017 Google LLC
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.decorateProperty = exports.standardPrototypeMethod = exports.legacyPrototypeMethod = void 0;
9
- const legacyPrototypeMethod = (descriptor, proto, name) => {
10
- Object.defineProperty(proto, name, descriptor);
11
- };
12
- exports.legacyPrototypeMethod = legacyPrototypeMethod;
13
- const standardPrototypeMethod = (descriptor, element) => ({
14
- kind: 'method',
15
- placement: 'prototype',
16
- key: element.key,
17
- descriptor,
18
- });
19
- exports.standardPrototypeMethod = standardPrototypeMethod;
20
- /**
21
- * Helper for decorating a property that is compatible with both TypeScript
22
- * and Babel decorators. The optional `finisher` can be used to perform work on
23
- * the class. The optional `descriptor` should return a PropertyDescriptor
24
- * to install for the given property.
25
- *
26
- * @param finisher {function} Optional finisher method; receives the element
27
- * constructor and property key as arguments and has no return value.
28
- * @param descriptor {function} Optional descriptor method; receives the
29
- * property key as an argument and returns a property descriptor to define for
30
- * the given property.
31
- * @returns {ClassElement|void}
32
- */
33
- const decorateProperty = ({ finisher, descriptor, }) => (protoOrDescriptor, name
34
- // Note TypeScript requires the return type to be `void|any`
35
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
- ) => {
37
- var _a;
38
- // TypeScript / Babel legacy mode
39
- if (name !== undefined) {
40
- const ctor = protoOrDescriptor
41
- .constructor;
42
- if (descriptor !== undefined) {
43
- Object.defineProperty(protoOrDescriptor, name, descriptor(name));
44
- }
45
- finisher === null || finisher === void 0 ? void 0 : finisher(ctor, name);
46
- // Babel standard mode
47
- }
48
- else {
49
- // Note, the @property decorator saves `key` as `originalKey`
50
- // so try to use it here.
51
- const key =
52
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
- (_a = protoOrDescriptor.originalKey) !== null && _a !== void 0 ? _a : protoOrDescriptor.key;
54
- const info = descriptor != undefined
55
- ? {
56
- kind: 'method',
57
- placement: 'prototype',
58
- key,
59
- descriptor: descriptor(protoOrDescriptor.key),
60
- }
61
- : Object.assign(Object.assign({}, protoOrDescriptor), { key });
62
- if (finisher != undefined) {
63
- info.finisher = function (ctor) {
64
- finisher(ctor, key);
65
- };
66
- }
67
- return info;
68
- }
69
- };
70
- exports.decorateProperty = decorateProperty;
@@ -1,26 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- import { ClassDescriptor } from './base';
7
- /**
8
- * Allow for custom element classes with private constructors
9
- */
10
- declare type CustomElementClass = Omit<typeof HTMLElement, 'new'>;
11
- /**
12
- * Class decorator factory that defines the decorated class as a custom element.
13
- *
14
- * ```js
15
- * @customElement('my-element')
16
- * class MyElement extends LitElement {
17
- * render() {
18
- * return html``;
19
- * }
20
- * }
21
- * ```
22
- * @category Decorator
23
- * @param tagName The tag name of the custom element to define.
24
- */
25
- export declare const customElement: (tagName: string) => (classOrDescriptor: CustomElementClass | ClassDescriptor) => any;
26
- export {};
@@ -1,47 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright 2017 Google LLC
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.customElement = void 0;
9
- const legacyCustomElement = (tagName, clazz) => {
10
- window.customElements.define(tagName, clazz);
11
- // Cast as any because TS doesn't recognize the return type as being a
12
- // subtype of the decorated class when clazz is typed as
13
- // `Constructor<HTMLElement>` for some reason.
14
- // `Constructor<HTMLElement>` is helpful to make sure the decorator is
15
- // applied to elements however.
16
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
- return clazz;
18
- };
19
- const standardCustomElement = (tagName, descriptor) => {
20
- const { kind, elements } = descriptor;
21
- return {
22
- kind,
23
- elements,
24
- // This callback is called once the class is otherwise fully defined
25
- finisher(clazz) {
26
- window.customElements.define(tagName, clazz);
27
- },
28
- };
29
- };
30
- /**
31
- * Class decorator factory that defines the decorated class as a custom element.
32
- *
33
- * ```js
34
- * @customElement('my-element')
35
- * class MyElement extends LitElement {
36
- * render() {
37
- * return html``;
38
- * }
39
- * }
40
- * ```
41
- * @category Decorator
42
- * @param tagName The tag name of the custom element to define.
43
- */
44
- const customElement = (tagName) => (classOrDescriptor) => typeof classOrDescriptor === 'function'
45
- ? legacyCustomElement(tagName, classOrDescriptor)
46
- : standardCustomElement(tagName, classOrDescriptor);
47
- exports.customElement = customElement;
@@ -1,37 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- import { ReactiveElement } from '../reactive-element';
7
- /**
8
- * Adds event listener options to a method used as an event listener in a
9
- * lit-html template.
10
- *
11
- * @param options An object that specifies event listener options as accepted by
12
- * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.
13
- *
14
- * Current browsers support the `capture`, `passive`, and `once` options. See:
15
- * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters
16
- *
17
- * ```ts
18
- * class MyElement {
19
- * clicked = false;
20
- *
21
- * render() {
22
- * return html`
23
- * <div @click=${this._onClick}`>
24
- * <button></button>
25
- * </div>
26
- * `;
27
- * }
28
- *
29
- * @eventOptions({capture: true})
30
- * _onClick(e) {
31
- * this.clicked = true;
32
- * }
33
- * }
34
- * ```
35
- * @category Decorator
36
- */
37
- export declare function eventOptions(options: AddEventListenerOptions): (protoOrDescriptor: ReactiveElement | import("./base").ClassElement, name?: PropertyKey) => any;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright 2017 Google LLC
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.eventOptions = void 0;
9
- const base_1 = require("./base");
10
- /**
11
- * Adds event listener options to a method used as an event listener in a
12
- * lit-html template.
13
- *
14
- * @param options An object that specifies event listener options as accepted by
15
- * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.
16
- *
17
- * Current browsers support the `capture`, `passive`, and `once` options. See:
18
- * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters
19
- *
20
- * ```ts
21
- * class MyElement {
22
- * clicked = false;
23
- *
24
- * render() {
25
- * return html`
26
- * <div @click=${this._onClick}`>
27
- * <button></button>
28
- * </div>
29
- * `;
30
- * }
31
- *
32
- * @eventOptions({capture: true})
33
- * _onClick(e) {
34
- * this.clicked = true;
35
- * }
36
- * }
37
- * ```
38
- * @category Decorator
39
- */
40
- function eventOptions(options) {
41
- return (0, base_1.decorateProperty)({
42
- finisher: (ctor, name) => {
43
- Object.assign(ctor.prototype[name], options);
44
- },
45
- });
46
- }
47
- exports.eventOptions = eventOptions;
@@ -1,14 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- export * from './base';
7
- export * from './custom-element';
8
- export * from './property';
9
- export * from './state';
10
- export * from './event-options';
11
- export * from './query';
12
- export * from './query-all';
13
- export * from './query-async';
14
- export * from './query-assigned-nodes';
@@ -1,32 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright 2017 Google LLC
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
- if (k2 === undefined) k2 = k;
9
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
- };
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- /*
19
- * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all
20
- * property decorators (but not class decorators) in this file that have
21
- * an @ExportDecoratedItems annotation must be defined as a regular function,
22
- * not an arrow function.
23
- */
24
- __exportStar(require("./base"), exports);
25
- __exportStar(require("./custom-element"), exports);
26
- __exportStar(require("./property"), exports);
27
- __exportStar(require("./state"), exports);
28
- __exportStar(require("./event-options"), exports);
29
- __exportStar(require("./query"), exports);
30
- __exportStar(require("./query-all"), exports);
31
- __exportStar(require("./query-async"), exports);
32
- __exportStar(require("./query-assigned-nodes"), exports);
@@ -1,40 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- import { PropertyDeclaration } from '../reactive-element';
7
- import { ClassElement } from './base';
8
- /**
9
- * A property decorator which creates a reactive property that reflects a
10
- * corresponding attribute value. When a decorated property is set
11
- * the element will update and render. A [[`PropertyDeclaration`]] may
12
- * optionally be supplied to configure property features.
13
- *
14
- * This decorator should only be used for public fields. As public fields,
15
- * properties should be considered as primarily settable by element users,
16
- * either via attribute or the property itself.
17
- *
18
- * Generally, properties that are changed by the element should be private or
19
- * protected fields and should use the [[`state`]] decorator.
20
- *
21
- * However, sometimes element code does need to set a public property. This
22
- * should typically only be done in response to user interaction, and an event
23
- * should be fired informing the user; for example, a checkbox sets its
24
- * `checked` property when clicked and fires a `changed` event. Mutating public
25
- * properties should typically not be done for non-primitive (object or array)
26
- * properties. In other cases when an element needs to manage state, a private
27
- * property decorated via the [[`state`]] decorator should be used. When needed,
28
- * state properties can be initialized via public properties to facilitate
29
- * complex interactions.
30
- *
31
- * ```ts
32
- * class MyElement {
33
- * @property({ type: Boolean })
34
- * clicked = false;
35
- * }
36
- * ```
37
- * @category Decorator
38
- * @ExportDecoratedItems
39
- */
40
- export declare function property(options?: PropertyDeclaration): (protoOrDescriptor: Object | ClassElement, name?: PropertyKey) => any;
@@ -1,92 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright 2017 Google LLC
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.property = void 0;
9
- const standardProperty = (options, element) => {
10
- // When decorating an accessor, pass it through and add property metadata.
11
- // Note, the `hasOwnProperty` check in `createProperty` ensures we don't
12
- // stomp over the user's accessor.
13
- if (element.kind === 'method' &&
14
- element.descriptor &&
15
- !('value' in element.descriptor)) {
16
- return Object.assign(Object.assign({}, element), { finisher(clazz) {
17
- clazz.createProperty(element.key, options);
18
- } });
19
- }
20
- else {
21
- // createProperty() takes care of defining the property, but we still
22
- // must return some kind of descriptor, so return a descriptor for an
23
- // unused prototype field. The finisher calls createProperty().
24
- return {
25
- kind: 'field',
26
- key: Symbol(),
27
- placement: 'own',
28
- descriptor: {},
29
- // store the original key so subsequent decorators have access to it.
30
- originalKey: element.key,
31
- // When @babel/plugin-proposal-decorators implements initializers,
32
- // do this instead of the initializer below. See:
33
- // https://github.com/babel/babel/issues/9260 extras: [
34
- // {
35
- // kind: 'initializer',
36
- // placement: 'own',
37
- // initializer: descriptor.initializer,
38
- // }
39
- // ],
40
- initializer() {
41
- if (typeof element.initializer === 'function') {
42
- this[element.key] = element.initializer.call(this);
43
- }
44
- },
45
- finisher(clazz) {
46
- clazz.createProperty(element.key, options);
47
- },
48
- };
49
- }
50
- };
51
- const legacyProperty = (options, proto, name) => {
52
- proto.constructor.createProperty(name, options);
53
- };
54
- /**
55
- * A property decorator which creates a reactive property that reflects a
56
- * corresponding attribute value. When a decorated property is set
57
- * the element will update and render. A [[`PropertyDeclaration`]] may
58
- * optionally be supplied to configure property features.
59
- *
60
- * This decorator should only be used for public fields. As public fields,
61
- * properties should be considered as primarily settable by element users,
62
- * either via attribute or the property itself.
63
- *
64
- * Generally, properties that are changed by the element should be private or
65
- * protected fields and should use the [[`state`]] decorator.
66
- *
67
- * However, sometimes element code does need to set a public property. This
68
- * should typically only be done in response to user interaction, and an event
69
- * should be fired informing the user; for example, a checkbox sets its
70
- * `checked` property when clicked and fires a `changed` event. Mutating public
71
- * properties should typically not be done for non-primitive (object or array)
72
- * properties. In other cases when an element needs to manage state, a private
73
- * property decorated via the [[`state`]] decorator should be used. When needed,
74
- * state properties can be initialized via public properties to facilitate
75
- * complex interactions.
76
- *
77
- * ```ts
78
- * class MyElement {
79
- * @property({ type: Boolean })
80
- * clicked = false;
81
- * }
82
- * ```
83
- * @category Decorator
84
- * @ExportDecoratedItems
85
- */
86
- function property(options) {
87
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
88
- return (protoOrDescriptor, name) => name !== undefined
89
- ? legacyProperty(options, protoOrDescriptor, name)
90
- : standardProperty(options, protoOrDescriptor);
91
- }
92
- exports.property = property;
@@ -1,31 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- import { ReactiveElement } from '../reactive-element';
7
- /**
8
- * A property decorator that converts a class property into a getter
9
- * that executes a querySelectorAll on the element's renderRoot.
10
- *
11
- * @param selector A DOMString containing one or more selectors to match.
12
- *
13
- * See:
14
- * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll
15
- *
16
- * ```ts
17
- * class MyElement {
18
- * @queryAll('div')
19
- * divs;
20
- *
21
- * render() {
22
- * return html`
23
- * <div id="first"></div>
24
- * <div id="second"></div>
25
- * `;
26
- * }
27
- * }
28
- * ```
29
- * @category Decorator
30
- */
31
- export declare function queryAll(selector: string): (protoOrDescriptor: ReactiveElement | import("./base").ClassElement, name?: PropertyKey) => any;
@@ -1,46 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright 2017 Google LLC
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.queryAll = void 0;
9
- const base_1 = require("./base");
10
- /**
11
- * A property decorator that converts a class property into a getter
12
- * that executes a querySelectorAll on the element's renderRoot.
13
- *
14
- * @param selector A DOMString containing one or more selectors to match.
15
- *
16
- * See:
17
- * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll
18
- *
19
- * ```ts
20
- * class MyElement {
21
- * @queryAll('div')
22
- * divs;
23
- *
24
- * render() {
25
- * return html`
26
- * <div id="first"></div>
27
- * <div id="second"></div>
28
- * `;
29
- * }
30
- * }
31
- * ```
32
- * @category Decorator
33
- */
34
- function queryAll(selector) {
35
- return (0, base_1.decorateProperty)({
36
- descriptor: (_name) => ({
37
- get() {
38
- var _a, _b;
39
- return (_b = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(selector)) !== null && _b !== void 0 ? _b : [];
40
- },
41
- enumerable: true,
42
- configurable: true,
43
- }),
44
- });
45
- }
46
- exports.queryAll = queryAll;