@rxdi/lit-html 0.7.157 → 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,653 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- /**
7
- * Use this module if you want to create your own base class extending
8
- * [[ReactiveElement]].
9
- * @packageDocumentation
10
- */
11
- import { CSSResultGroup, CSSResultOrNative } from './css-tag';
12
- import type { ReactiveController, ReactiveControllerHost } from './reactive-controller';
13
- export * from './css-tag';
14
- export type { ReactiveController, ReactiveControllerHost, } from './reactive-controller';
15
- /**
16
- * Converts property values to and from attribute values.
17
- */
18
- export interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {
19
- /**
20
- * Called to convert an attribute value to a property
21
- * value.
22
- */
23
- fromAttribute?(value: string | null, type?: TypeHint): Type;
24
- /**
25
- * Called to convert a property value to an attribute
26
- * value.
27
- *
28
- * It returns unknown instead of string, to be compatible with
29
- * https://github.com/WICG/trusted-types (and similar efforts).
30
- */
31
- toAttribute?(value: Type, type?: TypeHint): unknown;
32
- }
33
- declare type AttributeConverter<Type = unknown, TypeHint = unknown> = ComplexAttributeConverter<Type> | ((value: string | null, type?: TypeHint) => Type);
34
- /**
35
- * Defines options for a property accessor.
36
- */
37
- export interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {
38
- /**
39
- * When set to `true`, indicates the property is internal private state. The
40
- * property should not be set by users. When using TypeScript, this property
41
- * should be marked as `private` or `protected`, and it is also a common
42
- * practice to use a leading `_` in the name. The property is not added to
43
- * `observedAttributes`.
44
- */
45
- readonly state?: boolean;
46
- /**
47
- * Indicates how and whether the property becomes an observed attribute.
48
- * If the value is `false`, the property is not added to `observedAttributes`.
49
- * If true or absent, the lowercased property name is observed (e.g. `fooBar`
50
- * becomes `foobar`). If a string, the string value is observed (e.g
51
- * `attribute: 'foo-bar'`).
52
- */
53
- readonly attribute?: boolean | string;
54
- /**
55
- * Indicates the type of the property. This is used only as a hint for the
56
- * `converter` to determine how to convert the attribute
57
- * to/from a property.
58
- */
59
- readonly type?: TypeHint;
60
- /**
61
- * Indicates how to convert the attribute to/from a property. If this value
62
- * is a function, it is used to convert the attribute value a the property
63
- * value. If it's an object, it can have keys for `fromAttribute` and
64
- * `toAttribute`. If no `toAttribute` function is provided and
65
- * `reflect` is set to `true`, the property value is set directly to the
66
- * attribute. A default `converter` is used if none is provided; it supports
67
- * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,
68
- * when a property changes and the converter is used to update the attribute,
69
- * the property is never updated again as a result of the attribute changing,
70
- * and vice versa.
71
- */
72
- readonly converter?: AttributeConverter<Type, TypeHint>;
73
- /**
74
- * Indicates if the property should reflect to an attribute.
75
- * If `true`, when the property is set, the attribute is set using the
76
- * attribute name determined according to the rules for the `attribute`
77
- * property option and the value of the property converted using the rules
78
- * from the `converter` property option.
79
- */
80
- readonly reflect?: boolean;
81
- /**
82
- * A function that indicates if a property should be considered changed when
83
- * it is set. The function should take the `newValue` and `oldValue` and
84
- * return `true` if an update should be requested.
85
- */
86
- hasChanged?(value: Type, oldValue: Type): boolean;
87
- /**
88
- * Indicates whether an accessor will be created for this property. By
89
- * default, an accessor will be generated for this property that requests an
90
- * update when set. If this flag is `true`, no accessor will be created, and
91
- * it will be the user's responsibility to call
92
- * `this.requestUpdate(propertyName, oldValue)` to request an update when
93
- * the property changes.
94
- */
95
- readonly noAccessor?: boolean;
96
- }
97
- /**
98
- * Map of properties to PropertyDeclaration options. For each property an
99
- * accessor is made, and the property is processed according to the
100
- * PropertyDeclaration options.
101
- */
102
- export interface PropertyDeclarations {
103
- readonly [key: string]: PropertyDeclaration;
104
- }
105
- declare type PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;
106
- /**
107
- * Map of changed properties with old values. Takes an optional generic
108
- * interface corresponding to the declared element properties.
109
- */
110
- export declare type PropertyValues<T = any> = keyof T extends PropertyKey ? Map<keyof T, unknown> : never;
111
- export declare const defaultConverter: ComplexAttributeConverter;
112
- export interface HasChanged {
113
- (value: unknown, old: unknown): boolean;
114
- }
115
- /**
116
- * Change function that returns true if `value` is different from `oldValue`.
117
- * This method is used as the default for a property's `hasChanged` function.
118
- */
119
- export declare const notEqual: HasChanged;
120
- /**
121
- * The Closure JS Compiler doesn't currently have good support for static
122
- * property semantics where "this" is dynamic (e.g.
123
- * https://github.com/google/closure-compiler/issues/3177 and others) so we use
124
- * this hack to bypass any rewriting by the compiler.
125
- */
126
- declare const finalized = "finalized";
127
- /**
128
- * A string representing one of the supported dev mode warning categories.
129
- */
130
- export declare type WarningKind = 'change-in-update' | 'migration';
131
- export declare type Initializer = (element: ReactiveElement) => void;
132
- /**
133
- * Base element class which manages element properties and attributes. When
134
- * properties change, the `update` method is asynchronously called. This method
135
- * should be supplied by subclassers to render updates as desired.
136
- * @noInheritDoc
137
- */
138
- export declare abstract class ReactiveElement extends HTMLElement implements ReactiveControllerHost {
139
- /**
140
- * Read or set all the enabled warning categories for this class.
141
- *
142
- * This property is only used in development builds.
143
- *
144
- * @nocollapse
145
- * @category dev-mode
146
- */
147
- static enabledWarnings?: WarningKind[];
148
- /**
149
- * Enable the given warning category for this class.
150
- *
151
- * This method only exists in development builds, so it should be accessed
152
- * with a guard like:
153
- *
154
- * ```ts
155
- * // Enable for all ReactiveElement subclasses
156
- * ReactiveElement.enableWarning.?('migration');
157
- *
158
- * // Enable for only MyElement and subclasses
159
- * MyElement.enableWarning.?('migration');
160
- * ```
161
- *
162
- * @nocollapse
163
- * @category dev-mode
164
- */
165
- static enableWarning?: (warningKind: WarningKind) => void;
166
- /**
167
- * Disable the given warning category for this class.
168
- *
169
- * This method only exists in development builds, so it should be accessed
170
- * with a guard like:
171
- *
172
- * ```ts
173
- * // Disable for all ReactiveElement subclasses
174
- * ReactiveElement.disableWarning.?('migration');
175
- *
176
- * // Disable for only MyElement and subclasses
177
- * MyElement.disableWarning.?('migration');
178
- * ```
179
- *
180
- * @nocollapse
181
- * @category dev-mode
182
- */
183
- static disableWarning?: (warningKind: WarningKind) => void;
184
- /**
185
- * Adds an initializer function to the class that is called during instance
186
- * construction.
187
- *
188
- * This is useful for code that runs against a `ReactiveElement`
189
- * subclass, such as a decorator, that needs to do work for each
190
- * instance, such as setting up a `ReactiveController`.
191
- *
192
- * ```ts
193
- * const myDecorator = (target: typeof ReactiveElement, key: string) => {
194
- * target.addInitializer((instance: ReactiveElement) => {
195
- * // This is run during construction of the element
196
- * new MyController(instance);
197
- * });
198
- * }
199
- * ```
200
- *
201
- * Decorating a field will then cause each instance to run an initializer
202
- * that adds a controller:
203
- *
204
- * ```ts
205
- * class MyElement extends LitElement {
206
- * @myDecorator foo;
207
- * }
208
- * ```
209
- *
210
- * Initializers are stored per-constructor. Adding an initializer to a
211
- * subclass does not add it to a superclass. Since initializers are run in
212
- * constructors, initializers will run in order of the class hierarchy,
213
- * starting with superclasses and progressing to the instance's class.
214
- *
215
- * @nocollapse
216
- */
217
- static addInitializer(initializer: Initializer): void;
218
- static _initializers?: Initializer[];
219
- /**
220
- * Maps attribute names to properties; for example `foobar` attribute to
221
- * `fooBar` property. Created lazily on user subclasses when finalizing the
222
- * class.
223
- * @nocollapse
224
- */
225
- private static __attributeToPropertyMap;
226
- /**
227
- * Marks class as having finished creating properties.
228
- */
229
- protected static [finalized]: boolean;
230
- /**
231
- * Memoized list of all element properties, including any superclass properties.
232
- * Created lazily on user subclasses when finalizing the class.
233
- * @nocollapse
234
- * @category properties
235
- */
236
- static elementProperties: PropertyDeclarationMap;
237
- /**
238
- * User-supplied object that maps property names to `PropertyDeclaration`
239
- * objects containing options for configuring reactive properties. When
240
- * a reactive property is set the element will update and render.
241
- *
242
- * By default properties are public fields, and as such, they should be
243
- * considered as primarily settable by element users, either via attribute or
244
- * the property itself.
245
- *
246
- * Generally, properties that are changed by the element should be private or
247
- * protected fields and should use the `state: true` option. Properties
248
- * marked as `state` do not reflect from the corresponding attribute
249
- *
250
- * However, sometimes element code does need to set a public property. This
251
- * should typically only be done in response to user interaction, and an event
252
- * should be fired informing the user; for example, a checkbox sets its
253
- * `checked` property when clicked and fires a `changed` event. Mutating
254
- * public properties should typically not be done for non-primitive (object or
255
- * array) properties. In other cases when an element needs to manage state, a
256
- * private property set with the `state: true` option should be used. When
257
- * needed, state properties can be initialized via public properties to
258
- * facilitate complex interactions.
259
- * @nocollapse
260
- * @category properties
261
- */
262
- static properties: PropertyDeclarations;
263
- /**
264
- * Memoized list of all element styles.
265
- * Created lazily on user subclasses when finalizing the class.
266
- * @nocollapse
267
- * @category styles
268
- */
269
- static elementStyles: Array<CSSResultOrNative>;
270
- /**
271
- * Array of styles to apply to the element. The styles should be defined
272
- * using the [[`css`]] tag function, via constructible stylesheets, or
273
- * imported from native CSS module scripts.
274
- *
275
- * Note on Content Security Policy:
276
- *
277
- * Element styles are implemented with `<style>` tags when the browser doesn't
278
- * support adopted StyleSheets. To use such `<style>` tags with the style-src
279
- * CSP directive, the style-src value must either include 'unsafe-inline' or
280
- * 'nonce-<base64-value>' with <base64-value> replaced be a server-generated
281
- * nonce.
282
- *
283
- * To provide a nonce to use on generated <style> elements, set
284
- * `window.litNonce` to a server-generated nonce in your page's HTML, before
285
- * loading application code:
286
- *
287
- * ```html
288
- * <script>
289
- * // Generated and unique per request:
290
- * window.litNonce = 'a1b2c3d4';
291
- * </script>
292
- * ```
293
- * @nocollapse
294
- * @category styles
295
- */
296
- static styles?: CSSResultGroup;
297
- /**
298
- * Returns a list of attributes corresponding to the registered properties.
299
- * @nocollapse
300
- * @category attributes
301
- */
302
- static get observedAttributes(): string[];
303
- /**
304
- * Creates a property accessor on the element prototype if one does not exist
305
- * and stores a `PropertyDeclaration` for the property with the given options.
306
- * The property setter calls the property's `hasChanged` property option
307
- * or uses a strict identity check to determine whether or not to request
308
- * an update.
309
- *
310
- * This method may be overridden to customize properties; however,
311
- * when doing so, it's important to call `super.createProperty` to ensure
312
- * the property is setup correctly. This method calls
313
- * `getPropertyDescriptor` internally to get a descriptor to install.
314
- * To customize what properties do when they are get or set, override
315
- * `getPropertyDescriptor`. To customize the options for a property,
316
- * implement `createProperty` like this:
317
- *
318
- * ```ts
319
- * static createProperty(name, options) {
320
- * options = Object.assign(options, {myOption: true});
321
- * super.createProperty(name, options);
322
- * }
323
- * ```
324
- *
325
- * @nocollapse
326
- * @category properties
327
- */
328
- static createProperty(name: PropertyKey, options?: PropertyDeclaration): void;
329
- /**
330
- * Returns a property descriptor to be defined on the given named property.
331
- * If no descriptor is returned, the property will not become an accessor.
332
- * For example,
333
- *
334
- * ```ts
335
- * class MyElement extends LitElement {
336
- * static getPropertyDescriptor(name, key, options) {
337
- * const defaultDescriptor =
338
- * super.getPropertyDescriptor(name, key, options);
339
- * const setter = defaultDescriptor.set;
340
- * return {
341
- * get: defaultDescriptor.get,
342
- * set(value) {
343
- * setter.call(this, value);
344
- * // custom action.
345
- * },
346
- * configurable: true,
347
- * enumerable: true
348
- * }
349
- * }
350
- * }
351
- * ```
352
- *
353
- * @nocollapse
354
- * @category properties
355
- */
356
- protected static getPropertyDescriptor(name: PropertyKey, key: string | symbol, options: PropertyDeclaration): {
357
- get(): any;
358
- set(this: ReactiveElement, value: unknown): void;
359
- configurable: boolean;
360
- enumerable: boolean;
361
- };
362
- /**
363
- * Returns the property options associated with the given property.
364
- * These options are defined with a `PropertyDeclaration` via the `properties`
365
- * object or the `@property` decorator and are registered in
366
- * `createProperty(...)`.
367
- *
368
- * Note, this method should be considered "final" and not overridden. To
369
- * customize the options for a given property, override [[`createProperty`]].
370
- *
371
- * @nocollapse
372
- * @final
373
- * @category properties
374
- */
375
- protected static getPropertyOptions(name: PropertyKey): PropertyDeclaration<unknown, unknown>;
376
- /**
377
- * Creates property accessors for registered properties, sets up element
378
- * styling, and ensures any superclasses are also finalized. Returns true if
379
- * the element was finalized.
380
- * @nocollapse
381
- */
382
- protected static finalize(): boolean;
383
- /**
384
- * Options used when calling `attachShadow`. Set this property to customize
385
- * the options for the shadowRoot; for example, to create a closed
386
- * shadowRoot: `{mode: 'closed'}`.
387
- *
388
- * Note, these options are used in `createRenderRoot`. If this method
389
- * is customized, options should be respected if possible.
390
- * @nocollapse
391
- * @category rendering
392
- */
393
- static shadowRootOptions: ShadowRootInit;
394
- /**
395
- * Takes the styles the user supplied via the `static styles` property and
396
- * returns the array of styles to apply to the element.
397
- * Override this method to integrate into a style management system.
398
- *
399
- * Styles are deduplicated preserving the _last_ instance in the list. This
400
- * is a performance optimization to avoid duplicated styles that can occur
401
- * especially when composing via subclassing. The last item is kept to try
402
- * to preserve the cascade order with the assumption that it's most important
403
- * that last added styles override previous styles.
404
- *
405
- * @nocollapse
406
- * @category styles
407
- */
408
- protected static finalizeStyles(styles?: CSSResultGroup): Array<CSSResultOrNative>;
409
- /**
410
- * Node or ShadowRoot into which element DOM should be rendered. Defaults
411
- * to an open shadowRoot.
412
- * @category rendering
413
- */
414
- readonly renderRoot: HTMLElement | ShadowRoot;
415
- /**
416
- * Returns the property name for the given attribute `name`.
417
- * @nocollapse
418
- */
419
- private static __attributeNameForProperty;
420
- private __instanceProperties?;
421
- private __updatePromise;
422
- /**
423
- * True if there is a pending update as a result of calling `requestUpdate()`.
424
- * Should only be read.
425
- * @category updates
426
- */
427
- isUpdatePending: boolean;
428
- /**
429
- * Is set to `true` after the first update. The element code cannot assume
430
- * that `renderRoot` exists before the element `hasUpdated`.
431
- * @category updates
432
- */
433
- hasUpdated: boolean;
434
- /**
435
- * Map with keys of properties that should be reflected when updated.
436
- */
437
- private __reflectingProperties?;
438
- /**
439
- * Name of currently reflecting property
440
- */
441
- private __reflectingProperty;
442
- /**
443
- * Set of controllers.
444
- */
445
- private __controllers?;
446
- constructor();
447
- /**
448
- * Registers a `ReactiveController` to participate in the element's reactive
449
- * update cycle. The element automatically calls into any registered
450
- * controllers during its lifecycle callbacks.
451
- *
452
- * If the element is connected when `addController()` is called, the
453
- * controller's `hostConnected()` callback will be immediately called.
454
- * @category controllers
455
- */
456
- addController(controller: ReactiveController): void;
457
- /**
458
- * Removes a `ReactiveController` from the element.
459
- * @category controllers
460
- */
461
- removeController(controller: ReactiveController): void;
462
- /**
463
- * Fixes any properties set on the instance before upgrade time.
464
- * Otherwise these would shadow the accessor and break these properties.
465
- * The properties are stored in a Map which is played back after the
466
- * constructor runs. Note, on very old versions of Safari (<=9) or Chrome
467
- * (<=41), properties created for native platform properties like (`id` or
468
- * `name`) may not have default values set in the element constructor. On
469
- * these browsers native properties appear on instances and therefore their
470
- * default value will overwrite any element default (e.g. if the element sets
471
- * this.id = 'id' in the constructor, the 'id' will become '' since this is
472
- * the native platform default).
473
- */
474
- private __saveInstanceProperties;
475
- /**
476
- * Returns the node into which the element should render and by default
477
- * creates and returns an open shadowRoot. Implement to customize where the
478
- * element's DOM is rendered. For example, to render into the element's
479
- * childNodes, return `this`.
480
- *
481
- * @return Returns a node into which to render.
482
- * @category rendering
483
- */
484
- protected createRenderRoot(): Element | ShadowRoot;
485
- /**
486
- * On first connection, creates the element's renderRoot, sets up
487
- * element styling, and enables updating.
488
- * @category lifecycle
489
- */
490
- connectedCallback(): void;
491
- /**
492
- * Note, this method should be considered final and not overridden. It is
493
- * overridden on the element instance with a function that triggers the first
494
- * update.
495
- * @category updates
496
- */
497
- protected enableUpdating(_requestedUpdate: boolean): void;
498
- /**
499
- * Allows for `super.disconnectedCallback()` in extensions while
500
- * reserving the possibility of making non-breaking feature additions
501
- * when disconnecting at some point in the future.
502
- * @category lifecycle
503
- */
504
- disconnectedCallback(): void;
505
- /**
506
- * Synchronizes property values when attributes change.
507
- * @category attributes
508
- */
509
- attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
510
- private __propertyToAttribute;
511
- /**
512
- * Requests an update which is processed asynchronously. This should be called
513
- * when an element should update based on some state not triggered by setting
514
- * a reactive property. In this case, pass no arguments. It should also be
515
- * called when manually implementing a property setter. In this case, pass the
516
- * property `name` and `oldValue` to ensure that any configured property
517
- * options are honored.
518
- *
519
- * @param name name of requesting property
520
- * @param oldValue old value of requesting property
521
- * @param options property options to use instead of the previously
522
- * configured options
523
- * @category updates
524
- */
525
- requestUpdate(name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration): void;
526
- /**
527
- * Sets up the element to asynchronously update.
528
- */
529
- private __enqueueUpdate;
530
- /**
531
- * Schedules an element update. You can override this method to change the
532
- * timing of updates by returning a Promise. The update will await the
533
- * returned Promise, and you should resolve the Promise to allow the update
534
- * to proceed. If this method is overridden, `super.scheduleUpdate()`
535
- * must be called.
536
- *
537
- * For instance, to schedule updates to occur just before the next frame:
538
- *
539
- * ```ts
540
- * override protected async scheduleUpdate(): Promise<unknown> {
541
- * await new Promise((resolve) => requestAnimationFrame(() => resolve()));
542
- * super.scheduleUpdate();
543
- * }
544
- * ```
545
- * @category updates
546
- */
547
- protected scheduleUpdate(): void | Promise<unknown>;
548
- /**
549
- * Performs an element update. Note, if an exception is thrown during the
550
- * update, `firstUpdated` and `updated` will not be called.
551
- *
552
- * Call `performUpdate()` to immediately process a pending update. This should
553
- * generally not be needed, but it can be done in rare cases when you need to
554
- * update synchronously.
555
- *
556
- * Note: To ensure `performUpdate()` synchronously completes a pending update,
557
- * it should not be overridden. In LitElement 2.x it was suggested to override
558
- * `performUpdate()` to also customizing update scheduling. Instead, you should now
559
- * override `scheduleUpdate()`. For backwards compatibility with LitElement 2.x,
560
- * scheduling updates via `performUpdate()` continues to work, but will make
561
- * also calling `performUpdate()` to synchronously process updates difficult.
562
- *
563
- * @category updates
564
- */
565
- protected performUpdate(): void | Promise<unknown>;
566
- /**
567
- * @category updates
568
- */
569
- willUpdate(_changedProperties: PropertyValues): void;
570
- private __markUpdated;
571
- /**
572
- * Returns a Promise that resolves when the element has completed updating.
573
- * The Promise value is a boolean that is `true` if the element completed the
574
- * update without triggering another update. The Promise result is `false` if
575
- * a property was set inside `updated()`. If the Promise is rejected, an
576
- * exception was thrown during the update.
577
- *
578
- * To await additional asynchronous work, override the `getUpdateComplete`
579
- * method. For example, it is sometimes useful to await a rendered element
580
- * before fulfilling this Promise. To do this, first await
581
- * `super.getUpdateComplete()`, then any subsequent state.
582
- *
583
- * @return A promise of a boolean that resolves to true if the update completed
584
- * without triggering another update.
585
- * @category updates
586
- */
587
- get updateComplete(): Promise<boolean>;
588
- /**
589
- * Override point for the `updateComplete` promise.
590
- *
591
- * It is not safe to override the `updateComplete` getter directly due to a
592
- * limitation in TypeScript which means it is not possible to call a
593
- * superclass getter (e.g. `super.updateComplete.then(...)`) when the target
594
- * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).
595
- * This method should be overridden instead. For example:
596
- *
597
- * ```ts
598
- * class MyElement extends LitElement {
599
- * override async getUpdateComplete() {
600
- * const result = await super.getUpdateComplete();
601
- * await this._myChild.updateComplete;
602
- * return result;
603
- * }
604
- * }
605
- * ```
606
- *
607
- * @return A promise of a boolean that resolves to true if the update completed
608
- * without triggering another update.
609
- * @category updates
610
- */
611
- protected getUpdateComplete(): Promise<boolean>;
612
- /**
613
- * Controls whether or not `update()` should be called when the element requests
614
- * an update. By default, this method always returns `true`, but this can be
615
- * customized to control when to update.
616
- *
617
- * @param _changedProperties Map of changed properties with old values
618
- * @category updates
619
- */
620
- protected shouldUpdate(_changedProperties: PropertyValues): boolean;
621
- /**
622
- * Updates the element. This method reflects property values to attributes.
623
- * It can be overridden to render and keep updated element DOM.
624
- * Setting properties inside this method will *not* trigger
625
- * another update.
626
- *
627
- * @param _changedProperties Map of changed properties with old values
628
- * @category updates
629
- */
630
- protected update(_changedProperties: PropertyValues): void;
631
- /**
632
- * Invoked whenever the element is updated. Implement to perform
633
- * post-updating tasks via DOM APIs, for example, focusing an element.
634
- *
635
- * Setting properties inside this method will trigger the element to update
636
- * again after this update cycle completes.
637
- *
638
- * @param _changedProperties Map of changed properties with old values
639
- * @category updates
640
- */
641
- protected updated(_changedProperties: PropertyValues): void;
642
- /**
643
- * Invoked when the element is first updated. Implement to perform one time
644
- * work on the element after update.
645
- *
646
- * Setting properties inside this method will trigger the element to update
647
- * again after this update cycle completes.
648
- *
649
- * @param _changedProperties Map of changed properties with old values
650
- * @category updates
651
- */
652
- protected firstUpdated(_changedProperties: PropertyValues): void;
653
- }