@rxdi/lit-html 0.7.157 → 0.7.159

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,33 +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 that
9
- * returns the `assignedNodes` of the given named `slot`. Note, the type of
10
- * this property should be annotated as `NodeListOf<HTMLElement>`.
11
- *
12
- * @param slotName A string name of the slot.
13
- * @param flatten A boolean which when true flattens the assigned nodes,
14
- * meaning any assigned nodes that are slot elements are replaced with their
15
- * assigned nodes.
16
- * @param selector A string which filters the results to elements that match
17
- * the given css selector.
18
- *
19
- * ```ts
20
- * class MyElement {
21
- * @queryAssignedNodes('list', true, '.item')
22
- * listItems;
23
- *
24
- * render() {
25
- * return html`
26
- * <slot name="list"></slot>
27
- * `;
28
- * }
29
- * }
30
- * ```
31
- * @category Decorator
32
- */
33
- export declare function queryAssignedNodes(slotName?: string, flatten?: boolean, selector?: string): (protoOrDescriptor: ReactiveElement | import("./base").ClassElement, name?: PropertyKey) => any;
@@ -1,55 +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.queryAssignedNodes = void 0;
9
- const base_1 = require("./base");
10
- /**
11
- * A property decorator that converts a class property into a getter that
12
- * returns the `assignedNodes` of the given named `slot`. Note, the type of
13
- * this property should be annotated as `NodeListOf<HTMLElement>`.
14
- *
15
- * @param slotName A string name of the slot.
16
- * @param flatten A boolean which when true flattens the assigned nodes,
17
- * meaning any assigned nodes that are slot elements are replaced with their
18
- * assigned nodes.
19
- * @param selector A string which filters the results to elements that match
20
- * the given css selector.
21
- *
22
- * ```ts
23
- * class MyElement {
24
- * @queryAssignedNodes('list', true, '.item')
25
- * listItems;
26
- *
27
- * render() {
28
- * return html`
29
- * <slot name="list"></slot>
30
- * `;
31
- * }
32
- * }
33
- * ```
34
- * @category Decorator
35
- */
36
- function queryAssignedNodes(slotName = '', flatten = false, selector = '') {
37
- return (0, base_1.decorateProperty)({
38
- descriptor: (_name) => ({
39
- get() {
40
- var _a, _b, _c;
41
- const slotSelector = `slot${slotName ? `[name=${slotName}]` : ':not([name])'}`;
42
- const slot = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(slotSelector);
43
- let nodes = (_c = (_b = slot) === null || _b === void 0 ? void 0 : _b.assignedNodes({ flatten })) !== null && _c !== void 0 ? _c : [];
44
- if (selector) {
45
- nodes = nodes.filter((node) => node.nodeType === Node.ELEMENT_NODE &&
46
- node.matches(selector));
47
- }
48
- return nodes;
49
- },
50
- enumerable: true,
51
- configurable: true,
52
- }),
53
- });
54
- }
55
- exports.queryAssignedNodes = queryAssignedNodes;
@@ -1,39 +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 that
9
- * returns a promise that resolves to the result of a querySelector on the
10
- * element's renderRoot done after the element's `updateComplete` promise
11
- * resolves. When the queried property may change with element state, this
12
- * decorator can be used instead of requiring users to await the
13
- * `updateComplete` before accessing the property.
14
- *
15
- * @param selector A DOMString containing one or more selectors to match.
16
- *
17
- * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
18
- *
19
- * ```ts
20
- * class MyElement {
21
- * @queryAsync('#first')
22
- * first;
23
- *
24
- * render() {
25
- * return html`
26
- * <div id="first"></div>
27
- * <div id="second"></div>
28
- * `;
29
- * }
30
- * }
31
- *
32
- * // external usage
33
- * async doSomethingWithFirst() {
34
- * (await aMyElement.first).doSomething();
35
- * }
36
- * ```
37
- * @category Decorator
38
- */
39
- export declare function queryAsync(selector: string): (protoOrDescriptor: ReactiveElement | import("./base").ClassElement, name?: PropertyKey) => any;
@@ -1,71 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright 2017 Google LLC
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
- return new (P || (P = Promise))(function (resolve, reject) {
10
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
- step((generator = generator.apply(thisArg, _arguments || [])).next());
14
- });
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.queryAsync = void 0;
18
- const base_1 = require("./base");
19
- // Note, in the future, we may extend this decorator to support the use case
20
- // where the queried element may need to do work to become ready to interact
21
- // with (e.g. load some implementation code). If so, we might elect to
22
- // add a second argument defining a function that can be run to make the
23
- // queried element loaded/updated/ready.
24
- /**
25
- * A property decorator that converts a class property into a getter that
26
- * returns a promise that resolves to the result of a querySelector on the
27
- * element's renderRoot done after the element's `updateComplete` promise
28
- * resolves. When the queried property may change with element state, this
29
- * decorator can be used instead of requiring users to await the
30
- * `updateComplete` before accessing the property.
31
- *
32
- * @param selector A DOMString containing one or more selectors to match.
33
- *
34
- * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
35
- *
36
- * ```ts
37
- * class MyElement {
38
- * @queryAsync('#first')
39
- * first;
40
- *
41
- * render() {
42
- * return html`
43
- * <div id="first"></div>
44
- * <div id="second"></div>
45
- * `;
46
- * }
47
- * }
48
- *
49
- * // external usage
50
- * async doSomethingWithFirst() {
51
- * (await aMyElement.first).doSomething();
52
- * }
53
- * ```
54
- * @category Decorator
55
- */
56
- function queryAsync(selector) {
57
- return (0, base_1.decorateProperty)({
58
- descriptor: (_name) => ({
59
- get() {
60
- var _a;
61
- return __awaiter(this, void 0, void 0, function* () {
62
- yield this.updateComplete;
63
- return (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(selector);
64
- });
65
- },
66
- enumerable: true,
67
- configurable: true,
68
- }),
69
- });
70
- }
71
- exports.queryAsync = queryAsync;
@@ -1,32 +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 that
9
- * executes a querySelector on the element's renderRoot.
10
- *
11
- * @param selector A DOMString containing one or more selectors to match.
12
- * @param cache An optional boolean which when true performs the DOM query only
13
- * once and caches the result.
14
- *
15
- * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
16
- *
17
- * ```ts
18
- * class MyElement {
19
- * @query('#first')
20
- * first;
21
- *
22
- * render() {
23
- * return html`
24
- * <div id="first"></div>
25
- * <div id="second"></div>
26
- * `;
27
- * }
28
- * }
29
- * ```
30
- * @category Decorator
31
- */
32
- export declare function query(selector: string, cache?: boolean): (protoOrDescriptor: ReactiveElement | import("./base").ClassElement, name?: PropertyKey) => any;
@@ -1,60 +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.query = void 0;
9
- const base_1 = require("./base");
10
- /**
11
- * A property decorator that converts a class property into a getter that
12
- * executes a querySelector on the element's renderRoot.
13
- *
14
- * @param selector A DOMString containing one or more selectors to match.
15
- * @param cache An optional boolean which when true performs the DOM query only
16
- * once and caches the result.
17
- *
18
- * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
19
- *
20
- * ```ts
21
- * class MyElement {
22
- * @query('#first')
23
- * first;
24
- *
25
- * render() {
26
- * return html`
27
- * <div id="first"></div>
28
- * <div id="second"></div>
29
- * `;
30
- * }
31
- * }
32
- * ```
33
- * @category Decorator
34
- */
35
- function query(selector, cache) {
36
- return (0, base_1.decorateProperty)({
37
- descriptor: (name) => {
38
- const descriptor = {
39
- get() {
40
- var _a, _b;
41
- return (_b = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(selector)) !== null && _b !== void 0 ? _b : null;
42
- },
43
- enumerable: true,
44
- configurable: true,
45
- };
46
- if (cache) {
47
- const key = typeof name === 'symbol' ? Symbol() : `__${name}`;
48
- descriptor.get = function () {
49
- var _a, _b;
50
- if (this[key] === undefined) {
51
- this[key] = (_b = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(selector)) !== null && _b !== void 0 ? _b : null;
52
- }
53
- return this[key];
54
- };
55
- }
56
- return descriptor;
57
- },
58
- });
59
- }
60
- exports.query = query;
@@ -1,24 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- export interface InternalPropertyDeclaration<Type = unknown> {
7
- /**
8
- * A function that indicates if a property should be considered changed when
9
- * it is set. The function should take the `newValue` and `oldValue` and
10
- * return `true` if an update should be requested.
11
- */
12
- hasChanged?(value: Type, oldValue: Type): boolean;
13
- }
14
- /**
15
- * Declares a private or protected reactive property that still triggers
16
- * updates to the element when it changes. It does not reflect from the
17
- * corresponding attribute.
18
- *
19
- * Properties declared this way must not be used from HTML or HTML templating
20
- * systems, they're solely for properties internal to the element. These
21
- * properties may be renamed by optimization tools like closure compiler.
22
- * @category Decorator
23
- */
24
- export declare function state(options?: InternalPropertyDeclaration): (protoOrDescriptor: Object | import("./base").ClassElement, name?: PropertyKey) => any;
@@ -1,29 +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.state = void 0;
9
- /*
10
- * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all
11
- * property decorators (but not class decorators) in this file that have
12
- * an @ExportDecoratedItems annotation must be defined as a regular function,
13
- * not an arrow function.
14
- */
15
- const property_1 = require("./property");
16
- /**
17
- * Declares a private or protected reactive property that still triggers
18
- * updates to the element when it changes. It does not reflect from the
19
- * corresponding attribute.
20
- *
21
- * Properties declared this way must not be used from HTML or HTML templating
22
- * systems, they're solely for properties internal to the element. These
23
- * properties may be renamed by optimization tools like closure compiler.
24
- * @category Decorator
25
- */
26
- function state(options) {
27
- return (0, property_1.property)(Object.assign(Object.assign({}, options), { state: true }));
28
- }
29
- exports.state = state;
@@ -1,5 +0,0 @@
1
- export * from './css-tag';
2
- export * from './decorators';
3
- import './polyfill-support';
4
- export * from './reactive-controller';
5
- export * from './reactive-element';
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./css-tag"), exports);
14
- __exportStar(require("./decorators"), exports);
15
- require("./polyfill-support");
16
- __exportStar(require("./reactive-controller"), exports);
17
- __exportStar(require("./reactive-element"), exports);
@@ -1,40 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- /**
7
- * ReactiveElement patch to support browsers without native web components.
8
- *
9
- * This module should be used in addition to loading the web components
10
- * polyfills via @webcomponents/webcomponentjs. When using those polyfills
11
- * support for polyfilled Shadow DOM is automatic via the ShadyDOM polyfill, but
12
- * support for Shadow DOM like css scoping is opt-in. This module uses ShadyCSS
13
- * to scope styles defined via the `static styles` property.
14
- *
15
- * @packageDocumentation
16
- */
17
- interface RenderOptions {
18
- readonly renderBefore?: ChildNode | null;
19
- scope?: string;
20
- }
21
- declare const SCOPED = "__scoped";
22
- declare type CSSResults = Array<{
23
- cssText: string;
24
- } | CSSStyleSheet>;
25
- interface PatchableReactiveElementConstructor {
26
- [SCOPED]: boolean;
27
- elementStyles: CSSResults;
28
- shadowRootOptions: ShadowRootInit;
29
- _$handlesPrepareStyles?: boolean;
30
- }
31
- interface PatchableReactiveElement extends HTMLElement {
32
- new (...args: any[]): PatchableReactiveElement;
33
- constructor: PatchableReactiveElementConstructor;
34
- connectedCallback(): void;
35
- hasUpdated: boolean;
36
- _$didUpdate(changedProperties: unknown): void;
37
- createRenderRoot(): Element | ShadowRoot;
38
- renderOptions: RenderOptions;
39
- }
40
- declare var DEV_MODE: boolean;
@@ -1,89 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- var _a;
7
- var _b;
8
- const SCOPED = '__scoped';
9
- // Note, explicitly use `var` here so that this can be re-defined when
10
- // bundled.
11
- // eslint-disable-next-line no-var
12
- var DEV_MODE = true;
13
- (_a = globalThis[_b = `reactiveElementPolyfillSupport${DEV_MODE ? `DevMode` : ``}`]) !== null && _a !== void 0 ? _a : (globalThis[_b] = ({ ReactiveElement, }) => {
14
- // polyfill-support is only needed if ShadyCSS or the ApplyShim is in use
15
- // We test at the point of patching, which makes it safe to load
16
- // webcomponentsjs and polyfill-support in either order
17
- if (window.ShadyCSS === undefined ||
18
- (window.ShadyCSS.nativeShadow && !window.ShadyCSS.ApplyShim)) {
19
- return;
20
- }
21
- // console.log(
22
- // '%c Making ReactiveElement compatible with ShadyDOM/CSS.',
23
- // 'color: lightgreen; font-style: italic'
24
- // );
25
- const elementProto = ReactiveElement.prototype;
26
- // In noPatch mode, patch the ReactiveElement prototype so that no
27
- // ReactiveElements must be wrapped.
28
- if (window.ShadyDOM &&
29
- window.ShadyDOM.inUse &&
30
- window.ShadyDOM.noPatch === true) {
31
- window.ShadyDOM.patchElementProto(elementProto);
32
- }
33
- /**
34
- * Patch to apply adoptedStyleSheets via ShadyCSS
35
- */
36
- const createRenderRoot = elementProto.createRenderRoot;
37
- elementProto.createRenderRoot = function () {
38
- var _a, _b, _c;
39
- // Pass the scope to render options so that it gets to lit-html for proper
40
- // scoping via ShadyCSS.
41
- const name = this.localName;
42
- // If using native Shadow DOM must adoptStyles normally,
43
- // otherwise do nothing.
44
- if (window.ShadyCSS.nativeShadow) {
45
- return createRenderRoot.call(this);
46
- }
47
- else {
48
- if (!this.constructor.hasOwnProperty(SCOPED)) {
49
- this.constructor[SCOPED] =
50
- true;
51
- // Use ShadyCSS's `prepareAdoptedCssText` to shim adoptedStyleSheets.
52
- const css = this.constructor.elementStyles.map((v) => v instanceof CSSStyleSheet
53
- ? Array.from(v.cssRules).reduce((a, r) => (a += r.cssText), '')
54
- : v.cssText);
55
- (_b = (_a = window.ShadyCSS) === null || _a === void 0 ? void 0 : _a.ScopingShim) === null || _b === void 0 ? void 0 : _b.prepareAdoptedCssText(css, name);
56
- if (this.constructor._$handlesPrepareStyles === undefined) {
57
- window.ShadyCSS.prepareTemplateStyles(document.createElement('template'), name);
58
- }
59
- }
60
- return ((_c = this.shadowRoot) !== null && _c !== void 0 ? _c : this.attachShadow(this.constructor
61
- .shadowRootOptions));
62
- }
63
- };
64
- /**
65
- * Patch connectedCallback to apply ShadyCSS custom properties shimming.
66
- */
67
- const connectedCallback = elementProto.connectedCallback;
68
- elementProto.connectedCallback = function () {
69
- connectedCallback.call(this);
70
- // Note, must do first update separately so that we're ensured
71
- // that rendering has completed before calling this.
72
- if (this.hasUpdated) {
73
- window.ShadyCSS.styleElement(this);
74
- }
75
- };
76
- /**
77
- * Patch update to apply ShadyCSS custom properties shimming for first
78
- * update.
79
- */
80
- const didUpdate = elementProto._$didUpdate;
81
- elementProto._$didUpdate = function (changedProperties) {
82
- // Note, must do first update here so rendering has completed before
83
- // calling this and styles are correct by updated/firstUpdated.
84
- if (!this.hasUpdated) {
85
- window.ShadyCSS.styleElement(this);
86
- }
87
- didUpdate.call(this, changedProperties);
88
- };
89
- });
@@ -1,76 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2021 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- /**
7
- * An object that can host Reactive Controllers and call their lifecycle
8
- * callbacks.
9
- */
10
- export interface ReactiveControllerHost {
11
- /**
12
- * Adds a controller to the host, which sets up the controller's lifecycle
13
- * methods to be called with the host's lifecycle.
14
- */
15
- addController(controller: ReactiveController): void;
16
- /**
17
- * Removes a controller from the host.
18
- */
19
- removeController(controller: ReactiveController): void;
20
- /**
21
- * Requests a host update which is processed asynchronously. The update can
22
- * be waited on via the `updateComplete` property.
23
- */
24
- requestUpdate(): void;
25
- /**
26
- * Returns a Promise that resolves when the host has completed updating.
27
- * The Promise value is a boolean that is `true` if the element completed the
28
- * update without triggering another update. The Promise result is `false` if
29
- * a property was set inside `updated()`. If the Promise is rejected, an
30
- * exception was thrown during the update.
31
- *
32
- * @return A promise of a boolean that indicates if the update resolved
33
- * without triggering another update.
34
- */
35
- readonly updateComplete: Promise<boolean>;
36
- }
37
- /**
38
- * A Reactive Controller is an object that enables sub-component code
39
- * organization and reuse by aggregating the state, behavior, and lifecycle
40
- * hooks related to a single feature.
41
- *
42
- * Controllers are added to a host component, or other object that implements
43
- * the `ReactiveControllerHost` interface, via the `addController()` method.
44
- * They can hook their host components's lifecycle by implementing one or more
45
- * of the lifecycle callbacks, or initiate an update of the host component by
46
- * calling `requestUpdate()` on the host.
47
- */
48
- export interface ReactiveController {
49
- /**
50
- * Called when the host is connected to the component tree. For custom
51
- * element hosts, this corresponds to the `connectedCallback()` lifecycle,
52
- * which is only called when the component is connected to the document.
53
- */
54
- hostConnected?(): void;
55
- /**
56
- * Called when the host is disconnected from the component tree. For custom
57
- * element hosts, this corresponds to the `disconnectedCallback()` lifecycle,
58
- * which is called the host or an ancestor component is disconnected from the
59
- * document.
60
- */
61
- hostDisconnected?(): void;
62
- /**
63
- * Called during the client-side host update, just before the host calls
64
- * its own update.
65
- *
66
- * Code in `update()` can depend on the DOM as it is not called in
67
- * server-side rendering.
68
- */
69
- hostUpdate?(): void;
70
- /**
71
- * Called after a host update, just before the host calls firstUpdated and
72
- * updated. It is not called in server-side rendering.
73
- *
74
- */
75
- hostUpdated?(): void;
76
- }
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright 2021 Google LLC
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });