@pacem/pacem-core 1.0.0-bessel → 1.0.0-binet
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.
- package/dist/browser/pacem-core.js +870 -9
- package/dist/browser/pacem-core.js.map +1 -1
- package/dist/browser/pacem-core.min.js +2 -2
- package/dist/bundle/pacem-core.min.mjs +6 -6
- package/dist/bundle/pacem-core.mjs +467 -1
- package/dist/bundle/pacem-core.mjs.map +2 -2
- package/dist/docs/pacem-core.json +40109 -0
- package/dist/esm/adapter.js +2 -1
- package/dist/esm/command.js +6 -1
- package/dist/esm/comparers.js +1 -1
- package/dist/esm/converters.js +6 -1
- package/dist/esm/decorators-next.js +1 -1
- package/dist/esm/decorators.js +94 -1
- package/dist/esm/defaults.js +2 -1
- package/dist/esm/events.js +41 -1
- package/dist/esm/eventtarget.js +11 -1
- package/dist/esm/expression.js +37 -1
- package/dist/esm/index-animations.js +1 -1
- package/dist/esm/index-behaviors.js +1 -1
- package/dist/esm/index-components.js +1 -1
- package/dist/esm/index-iife.js +1 -1
- package/dist/esm/index-logging.js +1 -1
- package/dist/esm/index-net.js +1 -1
- package/dist/esm/index-root.js +1 -1
- package/dist/esm/index-ui.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/logger.js +8 -1
- package/dist/esm/prefix.js +2 -1
- package/dist/esm/promise.js +11 -1
- package/dist/esm/regex.js +3 -1
- package/dist/esm/storage.js +14 -1
- package/dist/esm/template.js +2 -1
- package/dist/esm/transforms.js +53 -1
- package/dist/esm/types.js +6 -1
- package/dist/esm/utils-customelement.js +165 -6
- package/dist/esm/utils-customevent.js +27 -1
- package/dist/esm/utils.js +89 -1
- package/package.json +2 -1
- package/typings/index.d.ts +1089 -10
package/typings/index.d.ts
CHANGED
|
@@ -7,28 +7,52 @@ import { Point } from '@pacem/pacem-foundation';
|
|
|
7
7
|
import { Rect } from '@pacem/pacem-foundation';
|
|
8
8
|
import { Strings } from '@pacem/pacem-foundation';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Abstract base class for the `@CustomElement` animation items (color/number/point animations) that can be
|
|
12
|
+
* hosted within a {@link PacemStoryboardElement}. Implements {@link Timeline}.
|
|
13
|
+
*/
|
|
10
14
|
declare abstract class AnimationElement extends PacemItemElement implements Timeline {
|
|
15
|
+
/** Gets or sets the element whose property is animated. */
|
|
11
16
|
target: Element;
|
|
17
|
+
/** Gets or sets the name of the animated property on `target`. */
|
|
12
18
|
property: string;
|
|
19
|
+
/** Gets or sets the delay before the animation starts, in milliseconds. */
|
|
13
20
|
delay: number;
|
|
21
|
+
/** Gets or sets the animation duration, in milliseconds. */
|
|
14
22
|
duration: number;
|
|
23
|
+
/** Gets or sets the easing function applied to the animation progress; accepts any key of {@link Easings} and defaults to linear. */
|
|
15
24
|
easing: Easing;
|
|
25
|
+
/** Gets or sets the number of times the animation repeats. */
|
|
16
26
|
iterations: number;
|
|
27
|
+
/** Gets or sets the playback direction of the animation. */
|
|
17
28
|
direction: PlaybackDirection;
|
|
29
|
+
/** Gets or sets the starting value of the animated property. */
|
|
18
30
|
abstract from: any;
|
|
31
|
+
/** Gets or sets the ending value of the animated property. */
|
|
19
32
|
abstract to: any;
|
|
33
|
+
/** Starts (or restarts) the animation and returns a promise resolved once it completes. */
|
|
20
34
|
abstract startAnimation(): Promise<void>;
|
|
35
|
+
/** Cancels the running animation. */
|
|
21
36
|
abstract cancelAnimation(): void;
|
|
22
37
|
}
|
|
23
38
|
|
|
39
|
+
/**
|
|
40
|
+
* `end` event dispatched once a tween/animation completes.
|
|
41
|
+
*/
|
|
24
42
|
declare class AnimationEndEvent extends CustomEvent<{}> {
|
|
25
43
|
constructor();
|
|
26
44
|
}
|
|
27
45
|
|
|
46
|
+
/**
|
|
47
|
+
* `step` event dispatched on every animation frame of a running tween, carrying the current progress and value.
|
|
48
|
+
*/
|
|
28
49
|
declare class AnimationEvent_2 extends CustomTypedEvent<AnimationEventArgs> {
|
|
29
50
|
constructor(args: AnimationEventArgs);
|
|
30
51
|
}
|
|
31
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Plain data shape carried by {@link AnimationEvent}: the normalized progress and the current interpolated value.
|
|
55
|
+
*/
|
|
32
56
|
declare type AnimationEventArgs = {
|
|
33
57
|
time: number;
|
|
34
58
|
value: number;
|
|
@@ -48,6 +72,9 @@ export declare namespace Animations {
|
|
|
48
72
|
}
|
|
49
73
|
}
|
|
50
74
|
|
|
75
|
+
/**
|
|
76
|
+
* `start` event dispatched when a tween/animation begins.
|
|
77
|
+
*/
|
|
51
78
|
declare class AnimationStartEvent extends CustomEvent<{}> {
|
|
52
79
|
constructor();
|
|
53
80
|
}
|
|
@@ -65,19 +92,30 @@ declare interface AriaAttributes {
|
|
|
65
92
|
};
|
|
66
93
|
}
|
|
67
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Dispatched by elements registered with the {@link CustomElement} decorator whenever one of their
|
|
97
|
+
* observed attributes changes, mirroring the native `attributeChangedCallback` as a DOM event.
|
|
98
|
+
*/
|
|
68
99
|
export declare class AttributeChangeEvent extends CustomTypedEvent<AttributeChangeEventArgs> {
|
|
69
100
|
constructor(args: AttributeChangeEventArgs);
|
|
70
101
|
}
|
|
71
102
|
|
|
103
|
+
/** Payload carried by an {@link AttributeChangeEvent}. */
|
|
72
104
|
export declare interface AttributeChangeEventArgs {
|
|
105
|
+
/** Name of the attribute that changed (as written in markup, i.e. kebab-case). */
|
|
73
106
|
attributeName: string;
|
|
107
|
+
/** Attribute's previous string value, if any. */
|
|
74
108
|
oldValue?: string;
|
|
109
|
+
/** Attribute's new string value. */
|
|
75
110
|
currentValue: string;
|
|
111
|
+
/** `true` when this is the attribute's first observed value (element not fully initialized yet). */
|
|
76
112
|
firstChange?: boolean;
|
|
77
113
|
}
|
|
78
114
|
|
|
115
|
+
/** Event name dispatched whenever an observed attribute changes; see {@link AttributeChangeEvent}. */
|
|
79
116
|
export declare const AttributeChangeEventName: string;
|
|
80
117
|
|
|
118
|
+
/** Ready-to-use event listener that calls both `evt.preventDefault()` and `evt.stopPropagation()`. */
|
|
81
119
|
export declare const avoidHandler: (evt: Event) => void;
|
|
82
120
|
|
|
83
121
|
export declare namespace Behaviors {
|
|
@@ -86,15 +124,23 @@ export declare namespace Behaviors {
|
|
|
86
124
|
}
|
|
87
125
|
}
|
|
88
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Bubbling, cancelable event representing a generic UI command (e.g. a button's `command`/`command-argument`
|
|
129
|
+
* attributes), letting ancestor elements handle named actions without wiring a dedicated listener per command.
|
|
130
|
+
*/
|
|
89
131
|
export declare class CommandEvent extends CustomTypedEvent<CommandEventArgs> {
|
|
90
132
|
constructor(args: CommandEventArgs);
|
|
91
133
|
}
|
|
92
134
|
|
|
135
|
+
/** Payload carried by a {@link CommandEvent}. */
|
|
93
136
|
export declare type CommandEventArgs = {
|
|
137
|
+
/** Name identifying the command being invoked. */
|
|
94
138
|
commandName: string;
|
|
139
|
+
/** Optional argument accompanying the command. */
|
|
95
140
|
commandArgument: any;
|
|
96
141
|
};
|
|
97
142
|
|
|
143
|
+
/** Event name dispatched to signal a generic, named command invocation; see {@link CommandEvent}. */
|
|
98
144
|
export declare const CommandEventName: string;
|
|
99
145
|
|
|
100
146
|
export declare namespace Components {
|
|
@@ -186,6 +232,15 @@ export declare namespace Components {
|
|
|
186
232
|
}
|
|
187
233
|
}
|
|
188
234
|
|
|
235
|
+
/**
|
|
236
|
+
* Method decorator that serializes calls to an async (promise-returning) method on a per-instance basis:
|
|
237
|
+
* while an invocation is in flight, further calls are queued (their arguments buffered) instead of running
|
|
238
|
+
* concurrently, and each queued call gets its own promise that resolves/rejects once it eventually runs.
|
|
239
|
+
* Once the in-flight call settles, the oldest buffered call (if any) is dequeued and executed next.
|
|
240
|
+
* Methods that don't return a promise-like value are simply invoked synchronously with no queuing.
|
|
241
|
+
*
|
|
242
|
+
* @returns A method decorator to apply to an async instance method.
|
|
243
|
+
*/
|
|
189
244
|
export declare function Concurrent(): (target: any, key: string, descriptor?: PropertyDescriptor) => void;
|
|
190
245
|
|
|
191
246
|
/** To be replaced when Cookie Store API types will be included in TypeScript. */
|
|
@@ -201,6 +256,7 @@ export declare type CookieData = {
|
|
|
201
256
|
secure?: boolean;
|
|
202
257
|
};
|
|
203
258
|
|
|
259
|
+
/** Minimal shape of the (currently non-standard) `window.cookieStore` API, used by {@link Utils.Cookies} when available. */
|
|
204
260
|
export declare type CookieStoreLike = {
|
|
205
261
|
delete(c: string | CookieData): Promise<void>;
|
|
206
262
|
get(c: string): Promise<CookieData>;
|
|
@@ -210,12 +266,39 @@ export declare type CookieStoreLike = {
|
|
|
210
266
|
removeEventListener: (type: 'change', handler: EventListener) => void;
|
|
211
267
|
};
|
|
212
268
|
|
|
269
|
+
/** Dispatched by an {@link Iterative} container whenever its `index` changes. */
|
|
213
270
|
export declare class CurrentIndexChangeEvent extends CustomTypedEvent<IndexChangeEventArgs> {
|
|
214
271
|
constructor(args: IndexChangeEventArgs);
|
|
215
272
|
}
|
|
216
273
|
|
|
274
|
+
/**
|
|
275
|
+
* Class decorator that turns a class extending `HTMLElement` (typically {@link PacemEventTarget}) into a
|
|
276
|
+
* fully-fledged Pacem custom element: it registers the tag with the custom elements registry and wraps
|
|
277
|
+
* the standard `connectedCallback`/`disconnectedCallback`/`attributeChangedCallback`/`propertyChangedCallback`
|
|
278
|
+
* lifecycle hooks (calling through to any hooks already defined on the class) so that:
|
|
279
|
+
*
|
|
280
|
+
* - `observedAttributes` is computed automatically from the class's {@link Watch}-decorated properties
|
|
281
|
+
* (in kebab-case), merged with any statically-declared `observedAttributes`.
|
|
282
|
+
* - On first connection, `config.template`/`config.templateUrl` (if provided) is fetched, parsed and
|
|
283
|
+
* injected — into a Shadow Root when `config.shadow` is `true`, otherwise as light-DOM children,
|
|
284
|
+
* splicing any pre-existing light-DOM content into a `<pacem-content>` placeholder if present.
|
|
285
|
+
* - Attribute changes are converted to property values via each watched property's {@link PropertyConverter},
|
|
286
|
+
* and dispatched as an {@link AttributeChangeEvent}.
|
|
287
|
+
* - Property changes are dispatched as a {@link PropertyChangeEvent} (unless the property's `@Watch`
|
|
288
|
+
* config sets `emit: false`) and, when `reflectBack` is enabled, written back onto the corresponding
|
|
289
|
+
* attribute via the converter's `convertBack`.
|
|
290
|
+
* - Binding expression attributes (`{{ ... }}`) are parsed and kept live: dependent properties are
|
|
291
|
+
* re-evaluated whenever one of the expression's upstream properties fires a {@link PropertyChangeEvent}.
|
|
292
|
+
* - Once the template (and all descendant templated custom elements) have finished rendering, the
|
|
293
|
+
* `cloak` attribute is removed and `viewActivatedCallback` fires — this is the right place for logic
|
|
294
|
+
* that depends on the element's full DOM (light or shadow) being in place.
|
|
295
|
+
*
|
|
296
|
+
* @param config Tag name, optional native `customElements.define` options, and optional template/templateUrl/shadow settings.
|
|
297
|
+
* @returns A class decorator to apply to the custom element's class declaration.
|
|
298
|
+
*/
|
|
217
299
|
export declare const CustomElement: (config: CustomElementConfig) => (target: Type<any>) => void;
|
|
218
300
|
|
|
301
|
+
/** Configuration options accepted by the {@link CustomElement} class decorator. */
|
|
219
302
|
export declare type CustomElementConfig = {
|
|
220
303
|
tagName: string;
|
|
221
304
|
options?: {
|
|
@@ -229,6 +312,7 @@ export declare type CustomElementConfig = {
|
|
|
229
312
|
shadow?: boolean;
|
|
230
313
|
};
|
|
231
314
|
|
|
315
|
+
/** Minimal shape of the (native or polyfilled) `CustomElementRegistry` used by {@link Utils.customElements} to define and look up custom elements. */
|
|
232
316
|
declare interface CustomElementRegistry_2 {
|
|
233
317
|
define(name: string, type: Type<any>, options?: {
|
|
234
318
|
[key: string]: string;
|
|
@@ -238,10 +322,31 @@ declare interface CustomElementRegistry_2 {
|
|
|
238
322
|
}
|
|
239
323
|
export { CustomElementRegistry_2 as CustomElementRegistry }
|
|
240
324
|
|
|
325
|
+
/**
|
|
326
|
+
* Static grab-bag of low-level helpers underpinning the {@link CustomElement}/{@link Watch} decorators
|
|
327
|
+
* and the binding-expression engine: attached-property storage (a per-instance, non-enumerable "bag"
|
|
328
|
+
* used instead of expando properties), attribute/property name conversion, DOM tree traversal, host/
|
|
329
|
+
* scope resolution for templated content, and binding-attribute parsing.
|
|
330
|
+
*/
|
|
241
331
|
export declare class CustomElementUtils {
|
|
332
|
+
/** `true` when the platform's `customElements` registry is the Custom Elements polyfill rather than a native implementation. */
|
|
242
333
|
static get polyfilling(): boolean;
|
|
334
|
+
/** Converts a camelCase property name to its kebab-case attribute-name equivalent (e.g. `myProp` → `my-prop`). */
|
|
243
335
|
static camelToKebab(camelCased: string): string;
|
|
336
|
+
/** Converts a kebab-case attribute name to its camelCase property-name equivalent (e.g. `my-prop` → `myProp`). */
|
|
244
337
|
static kebabToCamel(kebabCased: string): string;
|
|
338
|
+
/** Waits for the specified alement to be ready. */
|
|
339
|
+
static waitForReady(element: PacemEventTarget): Promise<void>;
|
|
340
|
+
/** Waits for the specified element to be ready, then executes the provided callback. */
|
|
341
|
+
static whenReady(element: PacemEventTarget, callback: () => void): void;
|
|
342
|
+
/**
|
|
343
|
+
* Retrieves the `@Watch`-decorated property descriptors declared on a custom element class (or an
|
|
344
|
+
* instance thereof), walking up the prototype chain when `includeInherited` is `true` (the default).
|
|
345
|
+
* Properties whose name starts with `_` are treated as private and excluded.
|
|
346
|
+
* @param target Element class, or an element instance (its constructor is used).
|
|
347
|
+
* @param includeInherited Whether to include properties declared on base classes. Defaults to `true`.
|
|
348
|
+
* @returns The watched property descriptors, base classes first.
|
|
349
|
+
*/
|
|
245
350
|
static getWatchedProperties(target: Type<any>, includeInherited?: boolean): {
|
|
246
351
|
name: string;
|
|
247
352
|
config: WatchConfig;
|
|
@@ -250,20 +355,59 @@ export declare class CustomElementUtils {
|
|
|
250
355
|
name: string;
|
|
251
356
|
config: WatchConfig;
|
|
252
357
|
}[];
|
|
358
|
+
/** Retrieves a single `@Watch`-decorated property descriptor by name; see {@link getWatchedProperties}. */
|
|
253
359
|
static getWatchedProperty(target: HTMLElement, name: string): {
|
|
254
360
|
name: string;
|
|
255
361
|
config: WatchConfig;
|
|
256
362
|
};
|
|
363
|
+
/**
|
|
364
|
+
* Loads a `<script>` tag once (deduplicated by `src`, cached via {@link import}), resolving when it fires `load`.
|
|
365
|
+
* @param src Script URL.
|
|
366
|
+
* @param integrity Optional Subresource Integrity hash.
|
|
367
|
+
* @param crossorigin Whether to set `crossorigin` on the tag.
|
|
368
|
+
*/
|
|
257
369
|
static importjs(src: string, integrity?: string, crossorigin?: boolean): Promise<HTMLElement>;
|
|
370
|
+
/**
|
|
371
|
+
* Loads a `<link rel="stylesheet">` tag once (deduplicated by `src`, cached via {@link import}), resolving when it fires `load`.
|
|
372
|
+
* @param src Stylesheet URL.
|
|
373
|
+
* @param integrity Optional Subresource Integrity hash.
|
|
374
|
+
* @param crossorigin Whether to set `crossorigin="anonymous"` on the tag.
|
|
375
|
+
*/
|
|
258
376
|
static importcss(src: string, integrity?: string, crossorigin?: boolean): Promise<HTMLElement>;
|
|
377
|
+
/**
|
|
378
|
+
* Creates (or reuses an already-present, matching) element of `tagName` with the given attributes and
|
|
379
|
+
* appends it to the DOM, returning a promise that resolves once it loads (or rejects on error). Results
|
|
380
|
+
* are cached per `key` (under `Utils.core.imports`) so repeated calls with the same key are a no-op.
|
|
381
|
+
* @param key Cache/dedupe key (typically the resource URL).
|
|
382
|
+
* @param tagName Tag name of the element to create (e.g. `'script'`, `'link'`).
|
|
383
|
+
* @param attrs Attributes to set on the element, also used to build a matching CSS selector to detect a pre-existing element.
|
|
384
|
+
* @param appendTo Node to append the newly created element to, if none was found. Defaults to `document.body`.
|
|
385
|
+
*/
|
|
259
386
|
static import(key: string, tagName: string, attrs: {
|
|
260
387
|
[name: string]: any;
|
|
261
388
|
}, appendTo?: Node): Promise<HTMLElement>;
|
|
389
|
+
/** Theming-related helpers. */
|
|
262
390
|
static Theme: {
|
|
391
|
+
/** Downloads the web fonts referenced by the current theme's `--{@link PCSS}-font-*` CSS custom properties, resolving once at least one font face is ready (or after a short timeout). */
|
|
263
392
|
importWebFonts(): Promise<any>;
|
|
264
393
|
};
|
|
394
|
+
/**
|
|
395
|
+
* Stores an arbitrary value "attached" to `target` under `name`, in a private, non-enumerable bag
|
|
396
|
+
* (rather than as a plain expando property) so it doesn't show up in `for...in`/`Object.keys`/JSON
|
|
397
|
+
* serialization. Setting `value` to `null`/`undefined` removes the entry. See {@link getAttachedPropertyValue}.
|
|
398
|
+
* @param target Object to attach the value to.
|
|
399
|
+
* @param name Key under which the value is stored.
|
|
400
|
+
* @param value Value to store, or `null`/`undefined` to remove the entry.
|
|
401
|
+
*/
|
|
265
402
|
static setAttachedPropertyValue(target: any, name: string, value: any): void;
|
|
403
|
+
/** Removes a value previously stored via {@link setAttachedPropertyValue}. */
|
|
266
404
|
static deleteAttachedPropertyValue(target: any, name: string): void;
|
|
405
|
+
/**
|
|
406
|
+
* Reads a value previously stored via {@link setAttachedPropertyValue}.
|
|
407
|
+
* @param target Object the value is attached to.
|
|
408
|
+
* @param name Key the value is stored under.
|
|
409
|
+
* @param ensureValue If provided and no value is currently stored, this value is stored and returned (lazy-initialization).
|
|
410
|
+
*/
|
|
267
411
|
static getAttachedPropertyValue(target: any, name: string, ensureValue?: any): any;
|
|
268
412
|
/**
|
|
269
413
|
* Resolves a dotted path into actual values.
|
|
@@ -284,19 +428,60 @@ export declare class CustomElementUtils {
|
|
|
284
428
|
property: string;
|
|
285
429
|
};
|
|
286
430
|
};
|
|
431
|
+
/**
|
|
432
|
+
* Writes `value` at the given dotted `path`, rooted at `element` (see {@link resolvePath}), triggering
|
|
433
|
+
* the appropriate `propertychange` notification. For paths nested more than one level deep (and not
|
|
434
|
+
* targeting an `HTMLElement`, which fires change notifications autonomously), the whole root property
|
|
435
|
+
* is cloned, mutated and reassigned so that a `propertychange` fires with meaningful old/new values -
|
|
436
|
+
* a plain nested assignment wouldn't otherwise be observed. Repeater-bound `item` paths are special-cased
|
|
437
|
+
* to update the owning {@link Repeater}'s `datasource` array in place.
|
|
438
|
+
* @param element Root element the path is resolved against.
|
|
439
|
+
* @param path Dotted path (e.g. `'foo.bar[0].baz'`) to the target property.
|
|
440
|
+
* @param value New value to assign.
|
|
441
|
+
*/
|
|
287
442
|
static set(element: Node, path: string, value: any): void;
|
|
443
|
+
/** Reads the value at the given dotted `path`, rooted at `element`; see {@link resolvePath}. */
|
|
288
444
|
static get(element: Node, path: string): any;
|
|
289
445
|
/**
|
|
290
446
|
* Works for unit-test contexts.
|
|
291
447
|
* @param element
|
|
292
448
|
*/
|
|
293
449
|
private static _findScopeContextLegacy;
|
|
450
|
+
/**
|
|
451
|
+
* Finds the `Document` or `ShadowRoot` that `element` belongs to - used as the root for resolving
|
|
452
|
+
* scoped binding expressions (e.g. `$document`/`$host` lookups). Falls back to the previously-attached
|
|
453
|
+
* scope value (see `INSTANCE_SCOPE_VAR`, set on `connectedCallback`) when `element` is currently
|
|
454
|
+
* disconnected, and to a legacy manual-walk implementation as a last resort (needed under Jasmine tests,
|
|
455
|
+
* where `element.isConnected` never reports `true`).
|
|
456
|
+
* @param element Element to resolve the containing document/shadow-root scope for.
|
|
457
|
+
*/
|
|
294
458
|
static findScopeContext(element: HTMLElement): Document | ShadowRoot;
|
|
459
|
+
/**
|
|
460
|
+
* Walks up from `element` (crossing shadow-root boundaries via the host element) looking for the
|
|
461
|
+
* first ancestor matching `predicate`.
|
|
462
|
+
* @param element Element to start the upward search from.
|
|
463
|
+
* @param predicate Test invoked (as `this`-bound and argument-passed) against each ancestor.
|
|
464
|
+
* @returns The first matching ancestor, or `undefined` if none matches.
|
|
465
|
+
*/
|
|
295
466
|
static findAncestor(element: Element, predicate: (Node: any) => boolean): any;
|
|
467
|
+
/** Finds the nearest ancestor "shell" element - matching `.{@link PCSS}-body` - or falls back to `document.body`; see {@link findAncestor}. */
|
|
296
468
|
static findAncestorShell(element: Element): HTMLElement;
|
|
469
|
+
/** Finds the nearest ancestor that is an instance of `ctor`; see {@link findAncestor}. */
|
|
297
470
|
static findAncestorOfType<TNode extends Node>(element: Element, ctor: Type<TNode>): TNode;
|
|
471
|
+
/**
|
|
472
|
+
* Collects the descendants of `element` matching `predicate`, via a `TreeWalker` over element nodes.
|
|
473
|
+
* @param element Root element to search from (exclusive - the walker starts on its descendants).
|
|
474
|
+
* @param predicate Test invoked against each descendant element.
|
|
475
|
+
* @param firstOnly When `true`, stops and returns as soon as one match is found.
|
|
476
|
+
*/
|
|
298
477
|
static findDescendants(element: Element, predicate: (Node: any) => boolean, firstOnly?: boolean): Node[];
|
|
478
|
+
/** Finds the first descendant of `element` matching `predicate`, or `undefined` if none matches; see {@link findDescendants}. */
|
|
299
479
|
static findFirstDescendant(element: Element, predicate: (Node: any) => boolean): Node;
|
|
480
|
+
/**
|
|
481
|
+
* Queries the whole document for elements matching `selector`, additionally filtered by `filter`.
|
|
482
|
+
* @param selector CSS selector to query for. Defaults to `'[pacem]'` (every Pacem custom element, which all carry that attribute once connected).
|
|
483
|
+
* @param filter Extra predicate applied to each matched element. Defaults to accepting everything.
|
|
484
|
+
*/
|
|
300
485
|
static findAll<T extends Element>(selector?: string, filter?: (e: Element) => boolean): T[];
|
|
301
486
|
/**
|
|
302
487
|
* To be used back again when Edge will allow Comment subclassing
|
|
@@ -314,11 +499,43 @@ export declare class CustomElementUtils {
|
|
|
314
499
|
* @param upLevels
|
|
315
500
|
*/
|
|
316
501
|
static findPreviousSiblingOrAncestor(element: Element, predicate: (Node: any) => boolean, upLevels?: number): Node;
|
|
502
|
+
/**
|
|
503
|
+
* Tags every element/document-fragment node inside `template`'s content (that isn't already tagged)
|
|
504
|
+
* with `host` under `INSTANCE_HOST_VAR`, so that once cloned and inserted into the DOM, binding
|
|
505
|
+
* expressions in that fragment can resolve back to the custom element instance ("host") that owns
|
|
506
|
+
* this template. See {@link findHostContext}.
|
|
507
|
+
* @param host The custom element instance whose template this is.
|
|
508
|
+
* @param template Template whose content's descendants should be tagged.
|
|
509
|
+
*/
|
|
317
510
|
static assignHostContext(host: any, template: HTMLTemplateElement): void;
|
|
511
|
+
/**
|
|
512
|
+
* Walks up from `element` looking for the nearest ancestor (inclusive) tagged with a host reference
|
|
513
|
+
* via {@link assignHostContext}; this is the custom element instance whose template produced `element`,
|
|
514
|
+
* used to resolve `$host`/scope references in binding expressions. Returns `undefined` (with a console
|
|
515
|
+
* warning) if `element` is disconnected or isn't part of any templated component.
|
|
516
|
+
* @param element Element to resolve the owning host for.
|
|
517
|
+
*/
|
|
318
518
|
static findHostContext(element: HTMLElement): HTMLElement;
|
|
519
|
+
/** Tests whether an attribute's raw string value has binding-expression syntax (`{{ ... }}`). */
|
|
319
520
|
static isBindingAttribute(attr: string): boolean;
|
|
521
|
+
/** Strips the `{{ }}` delimiters off a binding attribute's raw value, returning the bare expression text. Throws if `attr` isn't a valid binding attribute; see {@link isBindingAttribute}. */
|
|
320
522
|
static extractBindingAttributeExpression(attr: string): string;
|
|
523
|
+
/**
|
|
524
|
+
* Parses a `{{ ... }}` binding attribute value into an {@link Expression}, recognizing the optional
|
|
525
|
+
* trailing `, twoway` / `, once` modifier and stamping it onto the expression's dependencies (`twoway`
|
|
526
|
+
* only applies when the expression has exactly one dependency that itself allows two-way binding).
|
|
527
|
+
* @param attr Raw binding attribute value, including the `{{ }}` delimiters.
|
|
528
|
+
* @param element Element the expression is evaluated/bound against (used to resolve scope references).
|
|
529
|
+
*/
|
|
321
530
|
static parseBindingAttribute(attr: string, element: HTMLElement): Expression;
|
|
531
|
+
/**
|
|
532
|
+
* Defines an own property `name` on `o` with `attributes`, unless `o` already has an own property
|
|
533
|
+
* descriptor for that name (in which case the existing descriptor is returned untouched).
|
|
534
|
+
* @param o Object to define the property on.
|
|
535
|
+
* @param name Property name.
|
|
536
|
+
* @param attributes Property descriptor to apply if the property isn't already defined.
|
|
537
|
+
* @returns The (possibly pre-existing) property descriptor.
|
|
538
|
+
*/
|
|
322
539
|
static ensureMember(o: any, name: string, attributes: PropertyDescriptor): PropertyDescriptor;
|
|
323
540
|
/**
|
|
324
541
|
* Strips all the observed attributes of an element and its descendants, in order to seal that dom branch and to avoid bindings evaluation.
|
|
@@ -332,9 +549,27 @@ export declare class CustomElementUtils {
|
|
|
332
549
|
static freezeObservedAttributes(element: Element): void;
|
|
333
550
|
}
|
|
334
551
|
|
|
552
|
+
/** Static helpers for inspecting and normalizing native/custom events (coordinates, keyboard modifiers, type checks). */
|
|
335
553
|
export declare class CustomEventUtils {
|
|
554
|
+
/**
|
|
555
|
+
* Type-guarding check for whether `evt` is an instance of the given event `type`.
|
|
556
|
+
* @param evt Event to test.
|
|
557
|
+
* @param type Event constructor to test against.
|
|
558
|
+
* @returns `true` (narrowing `evt` to `TEvent`) if `evt instanceof type`.
|
|
559
|
+
*/
|
|
336
560
|
static isInstanceOf<TEvent extends Event>(evt: Event, type: Type<TEvent>): evt is TEvent;
|
|
561
|
+
/**
|
|
562
|
+
* Extracts page/client/screen coordinates from a mouse or (single-)touch event, using the first
|
|
563
|
+
* active touch (`touches[0]`, falling back to `changedTouches[0]`) for `TouchEvent`s.
|
|
564
|
+
* @param evt Source mouse/touch event, or an already-extracted {@link UIEventLike}.
|
|
565
|
+
* @returns The event's position in all three coordinate systems.
|
|
566
|
+
*/
|
|
337
567
|
static getEventCoordinates(evt: MouseEvent | TouchEvent | UIEventLike): EventCoordinates;
|
|
568
|
+
/**
|
|
569
|
+
* Extracts the keyboard-modifier flags (and, for mouse events, the pressed button as `which`) from a native event.
|
|
570
|
+
* @param evt Source keyboard/mouse/touch event, or an already-extracted {@link KeyEventLike}.
|
|
571
|
+
* @returns The captured modifier flags.
|
|
572
|
+
*/
|
|
338
573
|
static getEventKeyModifiers(evt: KeyboardEvent | MouseEvent | TouchEvent | KeyEventLike): EventKeyModifiers;
|
|
339
574
|
/**
|
|
340
575
|
* Matches the provided event against keyboard modifiers and returns 'true' if all the matches are satisfied.
|
|
@@ -343,6 +578,13 @@ export declare class CustomEventUtils {
|
|
|
343
578
|
*/
|
|
344
579
|
static matchModifiers(evt: KeyboardEvent | MouseEvent | TouchEvent | KeyEventLike, modifiers: string[]): any;
|
|
345
580
|
static matchModifiers(evt: KeyboardEvent | MouseEvent | TouchEvent | KeyEventLike, ...modifiers: EventKeyModifier[]): any;
|
|
581
|
+
/**
|
|
582
|
+
* Works around a legacy Edge/ChakraCore bug (see {@link https://github.com/Microsoft/ChakraCore/issues/3952})
|
|
583
|
+
* where an instance built via `super(...)` from a `CustomEvent` subclass constructor doesn't correctly
|
|
584
|
+
* pass `instanceof` checks against that subclass; forcibly resets its prototype when so.
|
|
585
|
+
* @param evt Event instance to fix up.
|
|
586
|
+
* @param type The subclass constructor `evt` is supposed to be an instance of.
|
|
587
|
+
*/
|
|
346
588
|
static fixEdgeCustomEventSubClassInstance<TEvent extends Event>(evt: TEvent, type: Function): void;
|
|
347
589
|
}
|
|
348
590
|
|
|
@@ -350,10 +592,27 @@ declare class CustomItemCommandEvent extends ItemEvent<any> {
|
|
|
350
592
|
constructor(evt: CommandEvent);
|
|
351
593
|
}
|
|
352
594
|
|
|
595
|
+
/**
|
|
596
|
+
* Base class for framework custom events whose `detail` payload is strongly typed as `TDetail`.
|
|
597
|
+
* Thin wrapper around the native `CustomEvent<TDetail>` that also works around an old Edge bug
|
|
598
|
+
* (see {@link CustomEventUtils.fixEdgeCustomEventSubClassInstance}) affecting `CustomEvent` subclasses.
|
|
599
|
+
*/
|
|
353
600
|
export declare abstract class CustomTypedEvent<TDetail> extends CustomEvent<TDetail> {
|
|
601
|
+
/**
|
|
602
|
+
* @param type Event name.
|
|
603
|
+
* @param detail Strongly-typed payload, exposed as `event.detail`.
|
|
604
|
+
* @param eventInit Standard `CustomEvent` initialization options (`bubbles`, `cancelable`, `composed`).
|
|
605
|
+
*/
|
|
354
606
|
constructor(type: string, detail: TDetail, eventInit?: CustomEventInit<TDetail>);
|
|
355
607
|
}
|
|
356
608
|
|
|
609
|
+
/**
|
|
610
|
+
* Base class for UI-originated custom events: like {@link CustomTypedEvent}, but additionally captures
|
|
611
|
+
* the mouse/touch/keyboard modifiers and coordinates of the originating native event (when supplied),
|
|
612
|
+
* exposing them through the {@link UIEventLike} surface (`which`, `altKey`, `pageX`, `clientY`, ...).
|
|
613
|
+
* Useful for events that are re-dispatched/synthesized (e.g. drag & drop) from an original pointer or
|
|
614
|
+
* keyboard event, so that consumers can still inspect that original event's modifiers/position.
|
|
615
|
+
*/
|
|
357
616
|
export declare abstract class CustomUIEvent<TDetail> extends CustomEvent<TDetail> implements UIEventLike {
|
|
358
617
|
#private;
|
|
359
618
|
constructor(type: string, detail: TDetail);
|
|
@@ -376,10 +635,26 @@ export declare abstract class CustomUIEvent<TDetail> extends CustomEvent<TDetail
|
|
|
376
635
|
get screenY(): number;
|
|
377
636
|
}
|
|
378
637
|
|
|
638
|
+
/**
|
|
639
|
+
* Method decorator that debounces calls to an instance method: repeated calls within the debounce window
|
|
640
|
+
* cancel the previously scheduled invocation and reschedule it, so only the last call in a rapid burst
|
|
641
|
+
* actually runs (with its own arguments), after the window elapses.
|
|
642
|
+
*
|
|
643
|
+
* @param msecs Debounce delay in milliseconds, or `true` to debounce to the next animation frame (`requestAnimationFrame`) instead of a fixed delay. Defaults to `50`.
|
|
644
|
+
* @param keyFactory Computes the per-instance timer key from the method name and call arguments; override to scope debouncing per argument (e.g. debounce separately per id) instead of per method. Defaults to a single shared key per method.
|
|
645
|
+
* @returns A method decorator to apply to the instance method to debounce.
|
|
646
|
+
*/
|
|
379
647
|
export declare function Debounce(msecs?: true | number, keyFactory?: (key: String, ...args: any[]) => string): (target: any, key: string, descriptor?: PropertyDescriptor) => void;
|
|
380
648
|
|
|
649
|
+
/**
|
|
650
|
+
* Recursively clones plain objects, arrays, `Date`s and `RegExp`s, preserving reference cycles/shared
|
|
651
|
+
* references within a single `clone` call (via an internal `WeakMap`). DOM `Element`s, `FileSystemHandle`s
|
|
652
|
+
* and `File`s are returned as-is (not cloned) - they aren't meaningfully deep-cloneable and are typically
|
|
653
|
+
* meant to be referenced, not duplicated.
|
|
654
|
+
*/
|
|
381
655
|
export declare class DeepCloner {
|
|
382
656
|
private constructor();
|
|
657
|
+
/** Deep-clones `obj`; see {@link DeepCloner} for what gets cloned vs. passed through by reference. */
|
|
383
658
|
static clone(obj: any): any;
|
|
384
659
|
private _clone;
|
|
385
660
|
}
|
|
@@ -391,22 +666,33 @@ export declare class DeepCloner {
|
|
|
391
666
|
*/
|
|
392
667
|
export declare const DefaultComparer: PropertyComparer<any>;
|
|
393
668
|
|
|
669
|
+
/** Framework-wide default settings. */
|
|
394
670
|
export declare const Defaults: {
|
|
395
671
|
USE_SHADOW_ROOT: boolean;
|
|
396
672
|
};
|
|
397
673
|
|
|
674
|
+
/**
|
|
675
|
+
* A `PromiseLike<T>` whose resolution is externalized: unlike a plain `Promise`, the executor isn't
|
|
676
|
+
* passed a callback up front - instead, `resolve`/`reject` are exposed for the caller to invoke later,
|
|
677
|
+
* via the {@link defer} static factory. Useful when the completion of an operation is driven by code
|
|
678
|
+
* that doesn't naturally live inside a `Promise` executor (e.g. event callbacks, decorator plumbing).
|
|
679
|
+
*/
|
|
398
680
|
export declare class DeferPromise<T> implements PromiseLike<T> {
|
|
399
681
|
private promise;
|
|
400
682
|
private deferred;
|
|
401
683
|
constructor();
|
|
684
|
+
/** Standard `PromiseLike.then`, delegating to the underlying native `Promise`. */
|
|
402
685
|
then<TResult1 = T, TResult2 = never>(onCompleted?: ((v: T) => TResult1 | PromiseLike<TResult1>), onFailed?: (v?: any) => TResult2 | PromiseLike<TResult2>): PromiseLike<TResult1 | TResult2>;
|
|
403
686
|
/**
|
|
404
687
|
* Occurs whenever the promise concludes (either after completion or error).
|
|
405
688
|
* @param {Function } callback
|
|
406
689
|
*/
|
|
407
690
|
finally(callback: (v?: T | any) => void | PromiseLike<void>): this;
|
|
691
|
+
/** Registers a fulfillment-only callback (fluent, chainable alternative to `then(callback)`). */
|
|
408
692
|
success(callback: (v?: T) => T | PromiseLike<T>): this;
|
|
693
|
+
/** Registers a rejection-only callback (fluent, chainable alternative to `then(null, callback)`). */
|
|
409
694
|
error(callback: (v?: any) => void | PromiseLike<void>): this;
|
|
695
|
+
/** Creates a new deferred promise and returns its controller: `{ resolve, reject, promise }`. */
|
|
410
696
|
static defer<T>(): {
|
|
411
697
|
resolve: (v?: T) => void | PromiseLike<void>;
|
|
412
698
|
reject: (v?: any) => void | PromiseLike<void>;
|
|
@@ -419,6 +705,7 @@ declare enum DockMode {
|
|
|
419
705
|
Bottom = "bottom"
|
|
420
706
|
}
|
|
421
707
|
|
|
708
|
+
/** Options accepted by the URL-based overload of {@link Utils.download}. */
|
|
422
709
|
declare type DownloadOptions = {
|
|
423
710
|
filename?: string;
|
|
424
711
|
mime?: string;
|
|
@@ -437,10 +724,16 @@ declare enum DragDataMode {
|
|
|
437
724
|
Copy = "copy"
|
|
438
725
|
}
|
|
439
726
|
|
|
727
|
+
/**
|
|
728
|
+
* Custom UI event dispatched throughout the drag & drop lifecycle (see {@link DragDropEventType}).
|
|
729
|
+
*/
|
|
440
730
|
declare class DragDropEvent extends CustomUIEvent<DragDropEventArgsClass | DragDropInitEventArgsClass> {
|
|
441
731
|
constructor(type: DragDropEventType, args: DragDropEventArgsClass | DragDropInitEventArgsClass, eventInit?: EventInit, evt?: MouseEvent | TouchEvent);
|
|
442
732
|
}
|
|
443
733
|
|
|
734
|
+
/**
|
|
735
|
+
* Plain data shape backing the drag & drop event-args classes.
|
|
736
|
+
*/
|
|
444
737
|
declare type DragDropEventArgs = {
|
|
445
738
|
element: HTMLElement | SVGElement;
|
|
446
739
|
placeholder: HTMLElement | SVGElement;
|
|
@@ -453,6 +746,9 @@ declare type DragDropEventArgs = {
|
|
|
453
746
|
target?: Element;
|
|
454
747
|
};
|
|
455
748
|
|
|
749
|
+
/**
|
|
750
|
+
* Base class shared by the drag & drop event-args classes; wraps a {@link DragDropEventArgs} builder and exposes its common, read-only facets.
|
|
751
|
+
*/
|
|
456
752
|
declare abstract class DragDropEventArgsBaseClass {
|
|
457
753
|
private _builder;
|
|
458
754
|
protected constructor(_builder: DragDropEventArgs);
|
|
@@ -468,12 +764,18 @@ declare abstract class DragDropEventArgsBaseClass {
|
|
|
468
764
|
get delta(): Point;
|
|
469
765
|
}
|
|
470
766
|
|
|
767
|
+
/**
|
|
768
|
+
* Read-only event args dispatched with the drag/drop lifecycle events other than `draginit` (start, drag, drop, over, out, end).
|
|
769
|
+
*/
|
|
471
770
|
declare class DragDropEventArgsClass extends DragDropEventArgsBaseClass {
|
|
472
771
|
private _placeholder;
|
|
473
772
|
private _data;
|
|
474
773
|
private constructor();
|
|
774
|
+
/** @readonly Gets the element used as a dragging placeholder. */
|
|
475
775
|
get placeholder(): HTMLElement | SVGElement;
|
|
776
|
+
/** @readonly Gets the logical payload being dragged. */
|
|
476
777
|
get data(): any;
|
|
778
|
+
/** Builds a new {@link DragDropEventArgsClass} out of a plain {@link DragDropEventArgs} builder. */
|
|
477
779
|
static fromArgs(builder: DragDropEventArgs): DragDropEventArgsClass;
|
|
478
780
|
}
|
|
479
781
|
|
|
@@ -494,10 +796,17 @@ declare enum DragDropEventType {
|
|
|
494
796
|
End = "dragend"
|
|
495
797
|
}
|
|
496
798
|
|
|
799
|
+
/**
|
|
800
|
+
* Event args dispatched with the {@link DragDropEventType.Init} event, mutable so listeners can override
|
|
801
|
+
* the `placeholder` and `data` before the drag actually starts.
|
|
802
|
+
*/
|
|
497
803
|
declare class DragDropInitEventArgsClass extends DragDropEventArgsBaseClass {
|
|
498
804
|
private constructor();
|
|
805
|
+
/** Gets or sets the element to be used as a dragging placeholder. */
|
|
499
806
|
placeholder: HTMLElement | SVGElement;
|
|
807
|
+
/** Gets or sets the logical payload being dragged. */
|
|
500
808
|
data: any;
|
|
809
|
+
/** Builds a new {@link DragDropInitEventArgsClass} out of a plain {@link DragDropEventArgs} builder. */
|
|
501
810
|
static fromArgs(builder: DragDropEventArgs): DragDropInitEventArgsClass;
|
|
502
811
|
}
|
|
503
812
|
|
|
@@ -520,7 +829,9 @@ declare interface DragDropper {
|
|
|
520
829
|
* Element to be used as a dragging placeholder. If not null, will override the floater obtained via the `mode` property.
|
|
521
830
|
*/
|
|
522
831
|
floater: Element;
|
|
832
|
+
/** Gets or sets the meaning of a drop action (e.g. insert as a child, or none). */
|
|
523
833
|
dropBehavior: DropBehavior;
|
|
834
|
+
/** Gets or sets what happens when a dragged element is released outside of any valid drop target. */
|
|
524
835
|
spillBehavior: DropTargetMissedBehavior;
|
|
525
836
|
}
|
|
526
837
|
|
|
@@ -540,20 +851,32 @@ declare enum DropTargetMissedBehavior {
|
|
|
540
851
|
None = "none"
|
|
541
852
|
}
|
|
542
853
|
|
|
854
|
+
/**
|
|
855
|
+
* A normalized-time easing function (`[0,1] -> [0,1]`, roughly) that also carries its CSS `cubic-bezier`/`linear` equivalent under the `css` property.
|
|
856
|
+
*/
|
|
543
857
|
declare type Easing = (any: any) => any & {
|
|
544
858
|
css: string;
|
|
545
859
|
};
|
|
546
860
|
|
|
861
|
+
/**
|
|
862
|
+
* Collection of ready-made {@link Easing} functions, each paired with its CSS timing-function equivalent.
|
|
863
|
+
*/
|
|
547
864
|
declare const Easings: any;
|
|
548
865
|
|
|
866
|
+
/** A pattern that can never match any string (`/a^/`); useful as a safe no-op default for optional matcher parameters. */
|
|
549
867
|
export declare const EMPTY_MATCHER: RegExp;
|
|
550
868
|
|
|
869
|
+
/** A pointer position expressed in the three coordinate systems normally exposed by mouse/touch events. */
|
|
551
870
|
export declare interface EventCoordinates {
|
|
871
|
+
/** Position relative to the whole document, including any scrolled-away area. */
|
|
552
872
|
readonly page: Point;
|
|
873
|
+
/** Position relative to the viewport. */
|
|
553
874
|
readonly client: Point;
|
|
875
|
+
/** Position relative to the physical screen. */
|
|
554
876
|
readonly screen: Point;
|
|
555
877
|
}
|
|
556
878
|
|
|
879
|
+
/** String tokens accepted by {@link CustomEventUtils.matchModifiers} to describe a keyboard/mouse modifier. */
|
|
557
880
|
export declare enum EventKeyModifier {
|
|
558
881
|
AltKey = "Alt",
|
|
559
882
|
CtrlKey = "Ctrl",
|
|
@@ -561,9 +884,20 @@ export declare enum EventKeyModifier {
|
|
|
561
884
|
MetaKey = "Cmd"
|
|
562
885
|
}
|
|
563
886
|
|
|
887
|
+
/** Snapshot of the keyboard-modifier state captured off an original native event; see {@link CustomEventUtils.getEventKeyModifiers}. */
|
|
564
888
|
export declare interface EventKeyModifiers extends KeyEventLike {
|
|
565
889
|
}
|
|
566
890
|
|
|
891
|
+
/**
|
|
892
|
+
* A parsed, compiled binding expression (the content of a `{{ ... }}` attribute value). Parsing
|
|
893
|
+
* (see {@link parse}) rewrites special tokens found in the source text - `:host.`, `^item`/`^^item`/...,
|
|
894
|
+
* `^index`/`^^index`/..., `#id`, `::hostProp` - into references resolvable at evaluation time, and
|
|
895
|
+
* records each of them as a {@link PropertyDependency} so the owning element can be notified (via
|
|
896
|
+
* {@link PropertyChangeEvent}) and re-evaluate the expression whenever a dependency changes - this is
|
|
897
|
+
* what powers the two-way/live data binding wired up by the {@link CustomElement} decorator.
|
|
898
|
+
* Expressions with no dependencies are flagged `independent` (effectively a constant) and can be
|
|
899
|
+
* evaluated immediately without waiting for the DOM/scope to be ready.
|
|
900
|
+
*/
|
|
567
901
|
export declare class Expression {
|
|
568
902
|
private _fnBody;
|
|
569
903
|
private _voidBody;
|
|
@@ -572,47 +906,89 @@ export declare class Expression {
|
|
|
572
906
|
private _args;
|
|
573
907
|
private _dependencies;
|
|
574
908
|
private _fn;
|
|
909
|
+
/** The resolved property dependencies (element + property + path) this expression re-evaluates on change. Empty for {@link independent} expressions. */
|
|
575
910
|
get dependencies(): PropertyDependency[];
|
|
911
|
+
/** The compiled function body used by {@link evaluate}/{@link evaluateAsync} (a `return <expr>;` statement, guarded by a try/catch). */
|
|
576
912
|
get functionBody(): string;
|
|
913
|
+
/** The compiled function body used by {@link evaluatePlus} (a bare, non-`return`ing statement, guarded by a try/catch) - suited for expressions run for their side effects, e.g. `on-*` event handlers. */
|
|
577
914
|
get voidBody(): string;
|
|
915
|
+
/**
|
|
916
|
+
* `true` when this expression couldn't be resolved against a scope yet (the element wasn't connected
|
|
917
|
+
* to a document/shadow-root at parse time) - a shared, inert placeholder singleton returned by
|
|
918
|
+
* {@link parse} in that case; evaluating it is a no-op. Callers should re-parse once the element is ready.
|
|
919
|
+
*/
|
|
578
920
|
get pending(): boolean;
|
|
921
|
+
/** `true` when the expression has no dependencies (a constant) and can be evaluated immediately, without a resolved scope. */
|
|
579
922
|
get independent(): boolean;
|
|
923
|
+
/** Evaluates the expression and returns its result, swallowing any runtime error (returning `undefined`). */
|
|
580
924
|
evaluate(): any;
|
|
925
|
+
/** Promise-wrapped variant of {@link evaluate} (resolves synchronously with the same result - kept for call-site uniformity with genuinely async evaluation paths). */
|
|
581
926
|
evaluateAsync(): PromiseLike<any>;
|
|
927
|
+
/**
|
|
928
|
+
* Executes the expression for its side effects (using {@link voidBody}, so no value is returned),
|
|
929
|
+
* with extra named variables merged into scope alongside the expression's own dependencies -
|
|
930
|
+
* used to expose e.g. `$event` to `on-*` event handler expressions.
|
|
931
|
+
* @param args Extra name/value pairs made available to the expression, in addition to its resolved dependencies.
|
|
932
|
+
*/
|
|
582
933
|
evaluatePlus(args?: {
|
|
583
934
|
[key: string]: any;
|
|
584
935
|
}): any;
|
|
585
936
|
private static _pendingExpression;
|
|
586
937
|
private static _getPendingExpressionSingleton;
|
|
938
|
+
/**
|
|
939
|
+
* Parses a binding expression's source text (the bare content of a `{{ ... }}` attribute, without the
|
|
940
|
+
* delimiters - see {@link CustomElementUtils.extractBindingAttributeExpression}) into an {@link Expression},
|
|
941
|
+
* resolving its special tokens against `element`'s scope (see {@link CustomElementUtils.findScopeContext}).
|
|
942
|
+
* Throws if the expression matches the unsafe-code guard (`new`, `window.`, `document.`, `eval(`).
|
|
943
|
+
* @param expression Bare expression source text.
|
|
944
|
+
* @param element Element the expression is bound to; provides the scope special tokens (`:host.`, `#id`, `^item`, ...) resolve against.
|
|
945
|
+
* @returns A constant expression if it has no dependencies; a shared pending placeholder if `element` isn't attached to a scope yet; otherwise a fully resolved expression.
|
|
946
|
+
*/
|
|
587
947
|
static parse(expression: string, element: HTMLElement): Expression;
|
|
588
948
|
}
|
|
589
949
|
|
|
950
|
+
/** Describes an element capable of issuing an HTTP request and exposing its outcome (e.g. `PacemFetchElement`); dispatches {@link FetchResultEventName}/{@link FetchSuccessEventName}/{@link FetchErrorEventName} as appropriate and notifies property changes for `result`. */
|
|
590
951
|
declare interface Fetcher extends NotifyPropertyChange {
|
|
952
|
+
/** Target URL of the request. */
|
|
591
953
|
url: string;
|
|
954
|
+
/** HTTP method to use. */
|
|
592
955
|
method: HttpMethod;
|
|
956
|
+
/** Query/body parameters, name/value pairs. */
|
|
593
957
|
parameters: {
|
|
594
958
|
[key: string]: string;
|
|
595
959
|
};
|
|
960
|
+
/** Extra request headers, name/value pairs. */
|
|
596
961
|
headers: {
|
|
597
962
|
[key: string]: string;
|
|
598
963
|
};
|
|
964
|
+
/** The (parsed) outcome of the last successful fetch, if any. */
|
|
599
965
|
result: any;
|
|
966
|
+
/** Issues the request. @returns A promise resolving with the raw `Response`. */
|
|
600
967
|
fetch: () => PromiseLike<GlobalResponse>;
|
|
601
968
|
}
|
|
602
969
|
|
|
970
|
+
/** Static helpers for working with fetch `Response`s. */
|
|
603
971
|
declare class Fetcher {
|
|
972
|
+
/** Tests whether a response carries no body (HTTP 204, or an explicit `Content-Length: 0`). */
|
|
604
973
|
static isEmpty(r: GlobalResponse): boolean;
|
|
605
974
|
}
|
|
606
975
|
|
|
976
|
+
/** Event name dispatched when a {@link Fetcher}'s request fails. */
|
|
607
977
|
declare const FetchErrorEventName = "error";
|
|
608
978
|
|
|
979
|
+
/** Event name dispatched with the raw fetch result payload; see {@link Fetcher.result}. */
|
|
609
980
|
declare const FetchResultEventName = "fetchresult";
|
|
610
981
|
|
|
982
|
+
/** Event name dispatched when a {@link Fetcher}'s request completes successfully. */
|
|
611
983
|
declare const FetchSuccessEventName = "success";
|
|
612
984
|
|
|
613
985
|
declare type GlobalResponse = Response;
|
|
614
986
|
|
|
615
|
-
/**
|
|
987
|
+
/**
|
|
988
|
+
* Legacy `XMLHttpRequest`-based HTTP client, superseded by the standard `fetch` API and {@link Fetcher}.
|
|
989
|
+
* Kept for backward compatibility.
|
|
990
|
+
* @deprecated
|
|
991
|
+
*/
|
|
616
992
|
declare class Http {
|
|
617
993
|
constructor();
|
|
618
994
|
/** Gets or sets the Bearer authorization token. */
|
|
@@ -641,6 +1017,7 @@ declare class Http {
|
|
|
641
1017
|
}): DeferPromise<Response_2>;
|
|
642
1018
|
}
|
|
643
1019
|
|
|
1020
|
+
/** HTTP verbs accepted by {@link Fetcher.method} / {@link Http}. */
|
|
644
1021
|
declare enum HttpMethod {
|
|
645
1022
|
Get = "GET",
|
|
646
1023
|
Post = "POST",
|
|
@@ -653,15 +1030,21 @@ declare enum HttpMethod {
|
|
|
653
1030
|
Trace = "TRACE"
|
|
654
1031
|
}
|
|
655
1032
|
|
|
1033
|
+
/** Payload carried by a {@link CurrentIndexChangeEvent}. */
|
|
656
1034
|
export declare type IndexChangeEventArgs = {
|
|
1035
|
+
/** The newly selected index. */
|
|
657
1036
|
currentIndex: number;
|
|
1037
|
+
/** The previously selected index. */
|
|
658
1038
|
previousIndex: number;
|
|
659
1039
|
};
|
|
660
1040
|
|
|
1041
|
+
/** Key used to attach, on an element instance, the list of attribute names currently holding a pending (not-yet-evaluable) binding expression. */
|
|
661
1042
|
export declare const INSTANCE_BINDINGS_VAR = "pacem:custom-element:bindings";
|
|
662
1043
|
|
|
1044
|
+
/** Key used to attach, on a templated node, a reference to the custom element instance ("host") whose template produced it — used to resolve binding expression scope. */
|
|
663
1045
|
export declare const INSTANCE_HOST_VAR = "pacem:custom-element:host";
|
|
664
1046
|
|
|
1047
|
+
/** Key used to attach, on an element instance, its binding-expression evaluation scope object. */
|
|
665
1048
|
export declare const INSTANCE_SCOPE_VAR = "pacem:custom-element:scope";
|
|
666
1049
|
|
|
667
1050
|
declare function isItemsContainer(object: any): object is ItemsContainer<any>;
|
|
@@ -683,9 +1066,13 @@ declare class ItemRegisterEvent<TItem extends PacemItemElement> extends CustomTy
|
|
|
683
1066
|
|
|
684
1067
|
declare const ItemRegisterEventName = "itemregister";
|
|
685
1068
|
|
|
1069
|
+
/** An element that holds and tracks a collection of `TItem` items (e.g. a set of child controls), notifying property changes as they're registered/unregistered. */
|
|
686
1070
|
export declare interface ItemsContainer<TItem> extends NotifyPropertyChange {
|
|
1071
|
+
/** The currently registered items. */
|
|
687
1072
|
items: TItem[];
|
|
1073
|
+
/** Adds `item` to the collection. @returns `true` if the item was newly registered. */
|
|
688
1074
|
register(item: TItem): boolean;
|
|
1075
|
+
/** Removes `item` from the collection. @returns `true` if the item was found and removed. */
|
|
689
1076
|
unregister(item: TItem): boolean;
|
|
690
1077
|
}
|
|
691
1078
|
|
|
@@ -695,14 +1082,30 @@ declare class ItemUnregisterEvent<TItem extends PacemItemElement> extends Custom
|
|
|
695
1082
|
|
|
696
1083
|
declare const ItemUnregisterEventName = "itemunregister";
|
|
697
1084
|
|
|
1085
|
+
/** An {@link ItemsContainer} that additionally tracks a "current" position (`index`) within its items (e.g. a carousel or tab strip); see {@link CurrentIndexChangeEvent}. */
|
|
698
1086
|
export declare interface Iterative<TItem> extends ItemsContainer<TItem> {
|
|
1087
|
+
/** The currently selected/active item's position within {@link ItemsContainer.items}. */
|
|
699
1088
|
index: number;
|
|
700
1089
|
}
|
|
701
1090
|
|
|
1091
|
+
/**
|
|
1092
|
+
* A `JSON.stringify`/`JSON.parse` superset able to round-trip values plain JSON can't represent: circular/
|
|
1093
|
+
* shared object references (`$#ref_N` markers), `RegExp` instances, DOM `Element`s (serialized by `id`
|
|
1094
|
+
* and revived via `document.getElementById`, so they must have one), and - depending on
|
|
1095
|
+
* {@link JsonSerializationOptions.functions} - functions themselves. The source object is deep-cloned
|
|
1096
|
+
* first (via {@link DeepCloner}) so serialization never mutates the input.
|
|
1097
|
+
*/
|
|
702
1098
|
export declare class Json {
|
|
703
1099
|
private _options?;
|
|
704
1100
|
private constructor();
|
|
1101
|
+
/**
|
|
1102
|
+
* Serializes `obj` to a JSON string, extended to support circular/shared references, `RegExp`s,
|
|
1103
|
+
* `Element`s (by `id`) and, per `options`, functions.
|
|
1104
|
+
* @param obj Value to serialize.
|
|
1105
|
+
* @param options Controls how function-valued properties are handled.
|
|
1106
|
+
*/
|
|
705
1107
|
static serialize(obj: any, options?: JsonSerializationOptions): string;
|
|
1108
|
+
/** Deserializes a string produced by {@link serialize}, restoring references, `RegExp`s, `Element`s and functions. */
|
|
706
1109
|
static deserialize(json: string): any;
|
|
707
1110
|
private _serialize;
|
|
708
1111
|
private _deserialize;
|
|
@@ -720,21 +1123,32 @@ export declare enum JsonFunctionConversion {
|
|
|
720
1123
|
Plain = "plain"
|
|
721
1124
|
}
|
|
722
1125
|
|
|
1126
|
+
/** Options accepted by {@link Json.serialize}. */
|
|
723
1127
|
export declare interface JsonSerializationOptions {
|
|
1128
|
+
/** How to handle function-valued properties encountered while serializing; see {@link JsonFunctionConversion}. Defaults to {@link JsonFunctionConversion.Ignore}. */
|
|
724
1129
|
functions?: JsonFunctionConversion;
|
|
725
1130
|
}
|
|
726
1131
|
|
|
727
1132
|
declare const KeyboardShortcutExecuteEventName = "execute";
|
|
728
1133
|
|
|
1134
|
+
/** Minimal shape of the keyboard-modifier flags found on keyboard/mouse/touch events. */
|
|
729
1135
|
export declare interface KeyEventLike {
|
|
730
1136
|
readonly altKey: boolean;
|
|
731
1137
|
readonly ctrlKey: boolean;
|
|
732
1138
|
readonly shiftKey: boolean;
|
|
733
1139
|
readonly metaKey: boolean;
|
|
1140
|
+
/** Key code (`KeyboardEvent.which`) or, for mouse events, the pressed button (`MouseEvent.button`). */
|
|
734
1141
|
readonly which?: number;
|
|
735
1142
|
}
|
|
736
1143
|
|
|
1144
|
+
/** Minimal logging sink interface; assigned to an element's `logger` property (see {@link PacemEventTarget.logger}) to receive its diagnostic output. */
|
|
737
1145
|
declare interface Logger {
|
|
1146
|
+
/**
|
|
1147
|
+
* Records a log entry.
|
|
1148
|
+
* @param level Severity of the entry.
|
|
1149
|
+
* @param message Text content of the entry.
|
|
1150
|
+
* @param category Optional grouping/source label (e.g. the emitting element's tag/id).
|
|
1151
|
+
*/
|
|
738
1152
|
log(level: LogLevel, message: string, category?: string): any;
|
|
739
1153
|
}
|
|
740
1154
|
|
|
@@ -745,12 +1159,19 @@ export declare namespace Logging {
|
|
|
745
1159
|
}
|
|
746
1160
|
}
|
|
747
1161
|
|
|
1162
|
+
/** Severity levels accepted by {@link Logger.log}, and used by {@link PacemEventTarget.log}. */
|
|
748
1163
|
declare enum LogLevel {
|
|
1164
|
+
/** Fine-grained diagnostic detail. */
|
|
749
1165
|
Trace = "trace",
|
|
1166
|
+
/** Development-time diagnostic detail. */
|
|
750
1167
|
Debug = "debug",
|
|
1168
|
+
/** Recoverable but noteworthy condition. */
|
|
751
1169
|
Warn = "warn",
|
|
1170
|
+
/** Unrecoverable or unexpected failure. */
|
|
752
1171
|
Error = "error",
|
|
1172
|
+
/** General informational message. */
|
|
753
1173
|
Info = "info",
|
|
1174
|
+
/** Generic/default-severity message. */
|
|
754
1175
|
Log = "log"
|
|
755
1176
|
}
|
|
756
1177
|
|
|
@@ -769,25 +1190,33 @@ export declare namespace Net {
|
|
|
769
1190
|
}
|
|
770
1191
|
}
|
|
771
1192
|
|
|
1193
|
+
/** Marker interface for an `EventTarget` capable of dispatching {@link PropertyChangeEvent}s (i.e. hosts one or more `@Watch`-decorated properties). */
|
|
772
1194
|
export declare interface NotifyPropertyChange extends EventTarget {
|
|
773
1195
|
}
|
|
774
1196
|
|
|
1197
|
+
/** Implemented by an element that augments a {@link Fetcher} with OAuth-flavored credentials/headers to attach to its requests. */
|
|
775
1198
|
declare interface OAuthFetchable {
|
|
1199
|
+
/** The {@link Fetcher} this OAuth configuration applies to, if resolved. */
|
|
776
1200
|
readonly fetcher?: Fetcher;
|
|
1201
|
+
/** `RequestInit.credentials` mode to use for the fetch (e.g. `'include'`). */
|
|
777
1202
|
fetchCredentials: RequestCredentials;
|
|
1203
|
+
/** Extra headers (typically an `Authorization` bearer token) to merge into the request. */
|
|
778
1204
|
fetchHeaders: {
|
|
779
1205
|
[key: string]: string;
|
|
780
1206
|
};
|
|
781
1207
|
}
|
|
782
1208
|
|
|
1209
|
+
/** Implemented by elements that need to react to the standard Custom Elements `adoptedCallback` lifecycle hook. */
|
|
783
1210
|
export declare interface OnAdopted {
|
|
784
1211
|
adoptedCallback(): void;
|
|
785
1212
|
}
|
|
786
1213
|
|
|
1214
|
+
/** Implemented by elements that need to react to the standard Custom Elements `attributeChangedCallback` lifecycle hook. */
|
|
787
1215
|
export declare interface OnAttributeChanged {
|
|
788
1216
|
attributeChangedCallback(attrName?: string, oldVal?: string, newVal?: string): void;
|
|
789
1217
|
}
|
|
790
1218
|
|
|
1219
|
+
/** Implemented by elements that need to react to the standard Custom Elements `connectedCallback` lifecycle hook. */
|
|
791
1220
|
export declare interface OnConnected {
|
|
792
1221
|
connectedCallback(): void;
|
|
793
1222
|
}
|
|
@@ -796,6 +1225,7 @@ declare interface OnDestroy {
|
|
|
796
1225
|
destroyCallback(): void;
|
|
797
1226
|
}
|
|
798
1227
|
|
|
1228
|
+
/** Implemented by elements that need to react to the standard Custom Elements `disconnectedCallback` lifecycle hook. */
|
|
799
1229
|
export declare interface OnDisconnected {
|
|
800
1230
|
disconnectedCallback(): void;
|
|
801
1231
|
}
|
|
@@ -804,10 +1234,12 @@ declare interface OnInitialize {
|
|
|
804
1234
|
initializeCallback(): void;
|
|
805
1235
|
}
|
|
806
1236
|
|
|
1237
|
+
/** Implemented by elements that need to react whenever one of their `@Watch`-decorated properties changes value. */
|
|
807
1238
|
export declare interface OnPropertyChanged {
|
|
808
1239
|
propertyChangedCallback(name?: string, oldVal?: any, newVal?: any, firstChange?: boolean): void;
|
|
809
1240
|
}
|
|
810
1241
|
|
|
1242
|
+
/** Implemented by elements that need to react once their template content (and that of their descendants) has been fully rendered and activated; see the `viewActivatedCallback` hook wired up by the {@link CustomElement} decorator. */
|
|
811
1243
|
export declare interface OnViewActivated {
|
|
812
1244
|
viewActivatedCallback(): void;
|
|
813
1245
|
}
|
|
@@ -815,6 +1247,7 @@ export declare interface OnViewActivated {
|
|
|
815
1247
|
/** the overall customelement prefix */
|
|
816
1248
|
export declare const P: any;
|
|
817
1249
|
|
|
1250
|
+
/** Base class for pluggable adapters that drive the focus/navigation behavior of a {@link PacemIterativeElement}. */
|
|
818
1251
|
declare abstract class PacemAdapter<TIterative extends Iterative<TItem>, TItem> extends PacemElement implements OnInitialize, OnDestroy {
|
|
819
1252
|
private _element;
|
|
820
1253
|
/** Gets the adapted element. */
|
|
@@ -864,6 +1297,10 @@ declare abstract class PacemAdapter<TIterative extends Iterative<TItem>, TItem>
|
|
|
864
1297
|
* @param ndx index to be checked
|
|
865
1298
|
*/
|
|
866
1299
|
isNext(ndx: number): boolean;
|
|
1300
|
+
/**
|
|
1301
|
+
* Sets the master's index to the closest available item to the provided one.
|
|
1302
|
+
* @param ndx Desired index
|
|
1303
|
+
*/
|
|
867
1304
|
select(ndx: number): void;
|
|
868
1305
|
/**
|
|
869
1306
|
* Sets the new iterative's index to the closest available previous item.
|
|
@@ -879,25 +1316,44 @@ declare abstract class PacemAdapter<TIterative extends Iterative<TItem>, TItem>
|
|
|
879
1316
|
next(loop: boolean): void;
|
|
880
1317
|
}
|
|
881
1318
|
|
|
1319
|
+
/** Removes itself from the DOM as soon as it gets connected; handy to strip out placeholder markup at runtime. */
|
|
882
1320
|
declare class PacemAnnihilatorElement extends HTMLElement {
|
|
883
1321
|
constructor();
|
|
884
1322
|
connectedCallback(): void;
|
|
885
1323
|
}
|
|
886
1324
|
|
|
1325
|
+
/** Warns the user (native `beforeunload` prompt or router-driven confirm dialog) before leaving the page. */
|
|
887
1326
|
declare class PacemBeforeunloadElement extends PacemEventTarget {
|
|
1327
|
+
/** Gets or sets the confirmation message to display. */
|
|
888
1328
|
message: string;
|
|
1329
|
+
/** Gets or sets whether the warning is currently armed. */
|
|
889
1330
|
active: boolean;
|
|
890
1331
|
private _unloadingHandler;
|
|
891
1332
|
viewActivatedCallback(): void;
|
|
892
1333
|
disconnectedCallback(): void;
|
|
893
1334
|
}
|
|
894
1335
|
|
|
1336
|
+
/**
|
|
1337
|
+
* Base class for the "behavior" custom elements (drag & drop, swipe, rotate, rescale, ...) that attach
|
|
1338
|
+
* gesture-driven functionality to a set of registered elements without rendering anything of their own.
|
|
1339
|
+
*/
|
|
895
1340
|
declare abstract class PacemBehavior extends PacemEventTarget {
|
|
896
1341
|
#private;
|
|
1342
|
+
/** Hooks up the behavior-specific event listeners/markup on a newly registered element. */
|
|
897
1343
|
protected abstract decorate(element: Element): any;
|
|
1344
|
+
/** Tears down whatever {@link decorate} set up on a previously registered element. */
|
|
898
1345
|
protected abstract undecorate(element: Element): any;
|
|
1346
|
+
/**
|
|
1347
|
+
* Registers an element with this behavior, decorating it if it wasn't already registered.
|
|
1348
|
+
* @param element Element to register.
|
|
1349
|
+
*/
|
|
899
1350
|
register(element: Element): void;
|
|
1351
|
+
/**
|
|
1352
|
+
* Unregisters a previously registered element, undecorating it.
|
|
1353
|
+
* @param element Element to unregister.
|
|
1354
|
+
*/
|
|
900
1355
|
unregister(element: Element): void;
|
|
1356
|
+
/** @readonly Determines whether the given element is currently registered with this behavior. */
|
|
901
1357
|
protected has(element: Element): boolean;
|
|
902
1358
|
}
|
|
903
1359
|
|
|
@@ -906,16 +1362,24 @@ declare class PacemBodyProxyElement extends PacemTransferProxyElement {
|
|
|
906
1362
|
protected get proxy(): HTMLElement;
|
|
907
1363
|
}
|
|
908
1364
|
|
|
1365
|
+
/** Wraps a {@link BroadcastChannel}, sending/receiving messages to/from other same-origin browsing contexts. */
|
|
909
1366
|
declare class PacemBroadcastChannelProxyElement extends PacemEventTarget {
|
|
910
1367
|
#private;
|
|
1368
|
+
/** Gets or sets the message to be sent through the channel. */
|
|
911
1369
|
message: any;
|
|
912
|
-
/** @readonly */
|
|
1370
|
+
/** @readonly Gets the last message received through the channel. */
|
|
913
1371
|
result: any;
|
|
1372
|
+
/** Gets or sets the name of the channel to open. */
|
|
914
1373
|
channelName: string;
|
|
1374
|
+
/** Gets or sets whether to automatically send `message` as soon as it changes (default `true`). */
|
|
915
1375
|
autosend: boolean;
|
|
916
1376
|
viewActivatedCallback(): void;
|
|
917
1377
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
918
1378
|
disconnectedCallback(): void;
|
|
1379
|
+
/**
|
|
1380
|
+
* Posts a message through the channel.
|
|
1381
|
+
* @param message Message to send; defaults to the current `message` property
|
|
1382
|
+
*/
|
|
919
1383
|
send(message?: any): void;
|
|
920
1384
|
private _messageHandler;
|
|
921
1385
|
private _errorHandler;
|
|
@@ -923,19 +1387,26 @@ declare class PacemBroadcastChannelProxyElement extends PacemEventTarget {
|
|
|
923
1387
|
private _disposeChannel;
|
|
924
1388
|
}
|
|
925
1389
|
|
|
1390
|
+
/** Detects the name and version of the current (or a provided) browser user agent. */
|
|
926
1391
|
declare class PacemBrowserDetectElement extends PacemEventTarget {
|
|
927
1392
|
#private;
|
|
928
1393
|
viewActivatedCallback(): void;
|
|
929
1394
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1395
|
+
/** Gets or sets the user agent string to detect; defaults to `navigator.userAgent`. */
|
|
930
1396
|
userAgent: string;
|
|
1397
|
+
/** @readonly Gets the detected browser name. */
|
|
931
1398
|
get browser(): string;
|
|
1399
|
+
/** @readonly Gets the detected browser version. */
|
|
932
1400
|
get version(): string;
|
|
933
1401
|
private _detect;
|
|
934
1402
|
}
|
|
935
1403
|
|
|
1404
|
+
/** Animates a CSS color `target[property]` from `from` to `to` (interpolated in HSLA space) over `duration`. */
|
|
936
1405
|
declare class PacemColorAnimationElement extends TweenAnimationElement<string> {
|
|
937
1406
|
#private;
|
|
1407
|
+
/** Gets or sets the starting color (any CSS-parsable color string). */
|
|
938
1408
|
from: string;
|
|
1409
|
+
/** Gets or sets the ending color (any CSS-parsable color string). */
|
|
939
1410
|
to: string;
|
|
940
1411
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
941
1412
|
viewActivatedCallback(): void;
|
|
@@ -944,11 +1415,14 @@ declare class PacemColorAnimationElement extends TweenAnimationElement<string> {
|
|
|
944
1415
|
private _precomputeTo;
|
|
945
1416
|
private _precomputeColor;
|
|
946
1417
|
private _parseColor;
|
|
1418
|
+
/** @inheritdoc */
|
|
947
1419
|
protected tweenInterpolationCallback(time: number, progress: number): string;
|
|
948
1420
|
}
|
|
949
1421
|
|
|
1422
|
+
/** Base class for elements whose (sanitized) inner content is driven by a `content` property, restoring the original markup on disconnect. */
|
|
950
1423
|
declare abstract class PacemContentElement extends PacemElement {
|
|
951
1424
|
protected abstract sanitize(html: string | Node): string | Node;
|
|
1425
|
+
/** Gets or sets the (HTML string or Node) content to render, passed through `sanitize` first. */
|
|
952
1426
|
content: string | Node;
|
|
953
1427
|
private _original;
|
|
954
1428
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -978,10 +1452,13 @@ declare abstract class PacemCrossItemsContainerElement<TItem extends PacemItemEl
|
|
|
978
1452
|
unregister(item: TItem): boolean;
|
|
979
1453
|
}
|
|
980
1454
|
|
|
1455
|
+
/** Holds an arbitrary data model, optionally persisting it to local storage and debouncing/throttling change notifications. */
|
|
981
1456
|
declare class PacemDataElement extends PacemEventTarget {
|
|
982
1457
|
private storage;
|
|
983
1458
|
constructor(storage?: Storage_2);
|
|
1459
|
+
/** Gets or sets the data model held by this element. */
|
|
984
1460
|
model: any;
|
|
1461
|
+
/** Gets or sets the storage key under which `model` is persisted. */
|
|
985
1462
|
persistAs: string;
|
|
986
1463
|
/** Debounces the model change */
|
|
987
1464
|
debounce: number;
|
|
@@ -1010,14 +1487,20 @@ declare class PacemDockElement extends PacemEventTarget {
|
|
|
1010
1487
|
}
|
|
1011
1488
|
|
|
1012
1489
|
/**
|
|
1013
|
-
* Pacem Drag & Drop element adapter
|
|
1490
|
+
* Pacem Drag & Drop element adapter: implements {@link DragDropper} on top of {@link PacemBehavior} to make
|
|
1491
|
+
* registered elements draggable and, optionally, sortable/droppable onto {@link dropTargets}.
|
|
1014
1492
|
*/
|
|
1015
1493
|
declare class PacemDragDropElement extends PacemBehavior implements DragDropper {
|
|
1016
1494
|
private _startHandler;
|
|
1495
|
+
/** Wires up the `mousedown`/`touchstart` listeners that arm the drag gesture on the given element. */
|
|
1017
1496
|
protected decorate(element: Element): void;
|
|
1497
|
+
/** Removes the listeners set up by {@link decorate}. */
|
|
1018
1498
|
protected undecorate(element: Element): void;
|
|
1499
|
+
/** Registers a listener for a {@link DragDropEventType} lifecycle event. */
|
|
1019
1500
|
addEventListener(type: DragDropEventType, listener: (evt: DragDropEvent) => void, useCapture?: boolean): void;
|
|
1501
|
+
/** Unregisters a listener previously added for a {@link DragDropEventType} lifecycle event. */
|
|
1020
1502
|
removeEventListener(type: DragDropEventType, listener: (evt: DragDropEvent) => void, useCapture?: boolean): void;
|
|
1503
|
+
/** Dispatches a {@link DragDropEvent}, clearing internal per-element bookkeeping once the drag ends. */
|
|
1021
1504
|
dispatchEvent(evt: DragDropEvent): boolean;
|
|
1022
1505
|
/** Gets or sets the amount of milliseconds to wait, while pressing on the draggable object, until the object itself must be considered "locked to drag". */
|
|
1023
1506
|
lockTimeout: number;
|
|
@@ -1035,6 +1518,7 @@ declare class PacemDragDropElement extends PacemBehavior implements DragDropper
|
|
|
1035
1518
|
handleSelector: string;
|
|
1036
1519
|
}
|
|
1037
1520
|
|
|
1521
|
+
/** Common base class for Pacem custom elements: adds ARIA support, CSS class/part/style bags, visibility, tab order and behaviors. */
|
|
1038
1522
|
declare class PacemElement extends PacemEventTarget implements Wai {
|
|
1039
1523
|
#private;
|
|
1040
1524
|
constructor(role?: string, aria?: {
|
|
@@ -1048,19 +1532,27 @@ declare class PacemElement extends PacemEventTarget implements Wai {
|
|
|
1048
1532
|
disconnectedCallback(): void;
|
|
1049
1533
|
private _tabIndex;
|
|
1050
1534
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1535
|
+
/** Gets or sets the CSS classes to toggle on this element, either as a string array or a `{ [className]: boolean }` map. */
|
|
1051
1536
|
cssClass: {
|
|
1052
1537
|
[key: string]: boolean;
|
|
1053
1538
|
} | string[];
|
|
1539
|
+
/** Gets or sets the CSS shadow parts (`::part()`) to toggle on this element, either as a string array or a `{ [partName]: boolean }` map. */
|
|
1054
1540
|
cssPart: {
|
|
1055
1541
|
[key: string]: boolean;
|
|
1056
1542
|
} | string[];
|
|
1543
|
+
/** Gets or sets inline CSS custom properties/values to apply to this element's style. */
|
|
1057
1544
|
css: {
|
|
1058
1545
|
[key: string]: string;
|
|
1059
1546
|
};
|
|
1547
|
+
/** Gets or sets whether the element is hidden (animated out, then marked `hidden` and `aria-hidden`). */
|
|
1060
1548
|
hide: boolean;
|
|
1549
|
+
/** Gets or sets the tooltip text, mapped to both `title` and `aria-label`. */
|
|
1061
1550
|
tooltip: string;
|
|
1551
|
+
/** Gets or sets the tab order; mirrors `tabIndex` while the element is enabled. */
|
|
1062
1552
|
tabOrder: number;
|
|
1553
|
+
/** Gets or sets the culture (mapped to the `lang` attribute); assigning it also refreshes data bindings. */
|
|
1063
1554
|
culture: string;
|
|
1555
|
+
/** Gets or sets the list of behaviors to attach to this element. */
|
|
1064
1556
|
behaviors: PacemBehavior[];
|
|
1065
1557
|
}
|
|
1066
1558
|
|
|
@@ -1071,9 +1563,13 @@ declare class PacemElementProxyElement extends PacemTransferProxyElement {
|
|
|
1071
1563
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1072
1564
|
}
|
|
1073
1565
|
|
|
1566
|
+
/** Listens for an arbitrary DOM event on a `target` element (or `window`) and re-dispatches it as its own `emit` event. */
|
|
1074
1567
|
declare class PacemEventProxyElement extends PacemEventTarget {
|
|
1568
|
+
/** Gets or sets the element (or `window`, via the special `"$window"` value) to listen on. */
|
|
1075
1569
|
target: HTMLElement | Window;
|
|
1570
|
+
/** Gets or sets the name of the DOM event to listen for. */
|
|
1076
1571
|
event: string;
|
|
1572
|
+
/** Gets or sets whether to listen in the capture phase. */
|
|
1077
1573
|
capture: boolean;
|
|
1078
1574
|
viewActivatedCallback(): void;
|
|
1079
1575
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -1083,6 +1579,16 @@ declare class PacemEventProxyElement extends PacemEventTarget {
|
|
|
1083
1579
|
private _emitHandler;
|
|
1084
1580
|
}
|
|
1085
1581
|
|
|
1582
|
+
/**
|
|
1583
|
+
* Base class for (almost) every Pacem custom element. Extends `HTMLElement` with the framework's
|
|
1584
|
+
* common lifecycle/event plumbing: `on-{event-type}` attribute handlers (see {@link emit}), a
|
|
1585
|
+
* {@link disabled} property that suppresses both outgoing (`dispatchEvent`) and incoming
|
|
1586
|
+
* (`emitHandler`) events, an optional {@link logger} sink, and an {@link isReady} flag toggled once
|
|
1587
|
+
* `viewActivatedCallback` has fired (see the {@link CustomElement} decorator for when that happens).
|
|
1588
|
+
* Concrete elements are expected to be decorated with `@CustomElement` and typically override
|
|
1589
|
+
* `propertyChangedCallback`/`viewActivatedCallback`/`connectedCallback`/`disconnectedCallback`,
|
|
1590
|
+
* calling `super.xxxCallback()` first/last as documented on each.
|
|
1591
|
+
*/
|
|
1086
1592
|
export declare abstract class PacemEventTarget extends HTMLElement implements NotifyPropertyChange, OnPropertyChanged, OnConnected, OnViewActivated, OnDisconnected {
|
|
1087
1593
|
constructor();
|
|
1088
1594
|
/**
|
|
@@ -1091,6 +1597,12 @@ export declare abstract class PacemEventTarget extends HTMLElement implements No
|
|
|
1091
1597
|
*/
|
|
1092
1598
|
protected emit(evt: Event): void;
|
|
1093
1599
|
private _emitCore;
|
|
1600
|
+
/**
|
|
1601
|
+
* Emits (see {@link emit}) either an existing `Event`, or a new one synthesized from a `type` name
|
|
1602
|
+
* and optional `detail` payload (as a `CustomEvent` when `detail` is provided, a plain `Event` otherwise).
|
|
1603
|
+
* @param evt The event to emit, or the type name of a new event to synthesize.
|
|
1604
|
+
* @param detail Optional payload for a synthesized `CustomEvent`; ignored when `evt` is already an `Event`.
|
|
1605
|
+
*/
|
|
1094
1606
|
handle(evt: Event): any;
|
|
1095
1607
|
handle(type: string, detail?: any): any;
|
|
1096
1608
|
private _isReady;
|
|
@@ -1113,7 +1625,9 @@ export declare abstract class PacemEventTarget extends HTMLElement implements No
|
|
|
1113
1625
|
*/
|
|
1114
1626
|
dispatchEvent(evt: Event): boolean;
|
|
1115
1627
|
protected emitHandler: (evt: Event) => void;
|
|
1628
|
+
/** Gets or sets whether the element is disabled: while `true`, {@link dispatchEvent} is a no-op and {@link emitHandler} ignores incoming events. Reflected back onto the `disabled` attribute. */
|
|
1116
1629
|
disabled: boolean;
|
|
1630
|
+
/** Gets or sets the {@link Logger} sink (resolved from a `logger="#elementId"` selector attribute) that {@link log} writes to, if any. */
|
|
1117
1631
|
logger: Logger;
|
|
1118
1632
|
/**
|
|
1119
1633
|
* Logs a message if a logger is available.
|
|
@@ -1126,28 +1640,42 @@ export declare abstract class PacemEventTarget extends HTMLElement implements No
|
|
|
1126
1640
|
protected refreshBindings(): void;
|
|
1127
1641
|
}
|
|
1128
1642
|
|
|
1643
|
+
/** Declarative wrapper around the `fetch()` API, debouncing/aborting requests as its properties change and exposing the parsed `result`. */
|
|
1129
1644
|
declare class PacemFetchElement extends PacemEventTarget implements Fetcher {
|
|
1130
1645
|
#private;
|
|
1646
|
+
/** Gets or sets the request URL, optionally templated (e.g. `/api/{id}`) against `parameters`. */
|
|
1131
1647
|
url: string;
|
|
1648
|
+
/** Gets or sets the HTTP method (default `GET`). */
|
|
1132
1649
|
method: HttpMethod;
|
|
1650
|
+
/** Gets or sets the request parameters: appended as querystring on `GET`, or serialized as body otherwise. */
|
|
1133
1651
|
parameters: {
|
|
1134
1652
|
[key: string]: string;
|
|
1135
1653
|
};
|
|
1654
|
+
/** Gets or sets additional request headers. */
|
|
1136
1655
|
headers: {
|
|
1137
1656
|
[key: string]: string;
|
|
1138
1657
|
};
|
|
1658
|
+
/** Gets or sets the request's `credentials` mode. */
|
|
1139
1659
|
credentials: 'omit' | 'same-origin' | 'include';
|
|
1660
|
+
/** Gets or sets the request's `mode`. */
|
|
1140
1661
|
mode: 'cors' | 'no-cors' | 'navigate' | 'same-origin';
|
|
1662
|
+
/** Gets or sets the request's `cache` mode. */
|
|
1141
1663
|
cache: RequestCache;
|
|
1664
|
+
/** @readonly Gets whether a request is currently in flight. */
|
|
1142
1665
|
fetching: boolean;
|
|
1143
1666
|
/** Gets or sets whether to trigger a fetch whenever a significant property has changed (default: true). */
|
|
1144
1667
|
autofetch: boolean;
|
|
1668
|
+
/** Gets or sets how to parse the response body (`object`, `text`, `blob` or `image`; default `object`). */
|
|
1145
1669
|
as: 'object' | 'text' | 'blob' | 'image';
|
|
1670
|
+
/** Gets or sets the request payload encoding (`json` or `raw`, i.e. urlencoded; default `json`). */
|
|
1146
1671
|
type: 'json' | 'raw';
|
|
1672
|
+
/** Gets or sets the debounce delay (in milliseconds) applied before auto-triggered fetches (default `100`). */
|
|
1147
1673
|
debounce: number;
|
|
1674
|
+
/** Gets or sets whether to throttle (rather than debounce) auto-triggered fetches. */
|
|
1148
1675
|
throttle: boolean;
|
|
1149
1676
|
/** Gets or sets whether to compare parameter and header single values prior to trigger a new fetch execution (default false). */
|
|
1150
1677
|
diffByValues: boolean;
|
|
1678
|
+
/** @readonly Gets the parsed result of the last successful fetch. */
|
|
1151
1679
|
result: any;
|
|
1152
1680
|
private _handle;
|
|
1153
1681
|
viewActivatedCallback(): void;
|
|
@@ -1159,37 +1687,49 @@ declare class PacemFetchElement extends PacemEventTarget implements Fetcher {
|
|
|
1159
1687
|
private _acceptFetchResult;
|
|
1160
1688
|
}
|
|
1161
1689
|
|
|
1690
|
+
/** Keeps track of an undo/redo-capable history of an arbitrary state. */
|
|
1162
1691
|
declare class PacemHistoryElement extends PacemEventTarget {
|
|
1163
1692
|
#private;
|
|
1693
|
+
/** Gets or sets the current state; assigning a new value pushes it onto the history stack. */
|
|
1164
1694
|
state: any;
|
|
1695
|
+
/** Gets or sets the maximum number of states retained in the history stack. */
|
|
1165
1696
|
maxlength: number;
|
|
1166
|
-
/** @readonly*/
|
|
1697
|
+
/** @readonly Gets whether `undo()` can currently be invoked. */
|
|
1167
1698
|
canUndo: boolean;
|
|
1168
|
-
/** @readonly*/
|
|
1699
|
+
/** @readonly Gets whether `redo()` can currently be invoked. */
|
|
1169
1700
|
canRedo: boolean;
|
|
1170
1701
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1171
1702
|
viewActivatedCallback(): void;
|
|
1172
1703
|
private _handleStateChange;
|
|
1704
|
+
/** Moves the state forward one step, if `canRedo` is `true`. */
|
|
1173
1705
|
redo(): void;
|
|
1706
|
+
/** Clears the history stack, keeping only the current state. */
|
|
1174
1707
|
reset(): void;
|
|
1708
|
+
/** Moves the state back one step, if `canUndo` is `true`. */
|
|
1175
1709
|
undo(): void;
|
|
1176
1710
|
private _synchronize;
|
|
1177
1711
|
}
|
|
1178
1712
|
|
|
1713
|
+
/** Sets (or removes) an attribute on the document's root `<html>` element. */
|
|
1179
1714
|
declare class PacemHtmlProxyElement extends PacemEventTarget {
|
|
1715
|
+
/** Gets or sets the name of the `<html>` attribute to manage. */
|
|
1180
1716
|
attr: string;
|
|
1717
|
+
/** Gets or sets the value to assign to the attribute; an empty value removes it. */
|
|
1181
1718
|
value: string;
|
|
1182
1719
|
private _html;
|
|
1183
1720
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1184
1721
|
private _update;
|
|
1185
1722
|
}
|
|
1186
1723
|
|
|
1724
|
+
/** Conditionally shows or clears its own inner content, restoring the original markup whenever `match` becomes truthy again. */
|
|
1187
1725
|
declare class PacemIfElement extends HTMLElement {
|
|
1188
1726
|
#private;
|
|
1189
1727
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1728
|
+
/** Gets or sets whether the original content is shown (`true`) or cleared (`false`). */
|
|
1190
1729
|
match: boolean;
|
|
1191
1730
|
}
|
|
1192
1731
|
|
|
1732
|
+
/** Base class for elements that register themselves against an ancestor {@link PacemItemsContainerElement}. */
|
|
1193
1733
|
declare abstract class PacemItemElement extends PacemElement {
|
|
1194
1734
|
private _container;
|
|
1195
1735
|
protected get container(): ItemsContainer<any>;
|
|
@@ -1199,6 +1739,7 @@ declare abstract class PacemItemElement extends PacemElement {
|
|
|
1199
1739
|
disconnectedCallback(): void;
|
|
1200
1740
|
}
|
|
1201
1741
|
|
|
1742
|
+
/** Base class for container elements holding a registry of {@link PacemItemElement} children. */
|
|
1202
1743
|
declare abstract class PacemItemsContainerElement<TItem extends PacemItemElement> extends PacemElement implements ItemsContainer<TItem> {
|
|
1203
1744
|
constructor(role?: string, aria?: {
|
|
1204
1745
|
[name: string]: string;
|
|
@@ -1218,14 +1759,18 @@ declare abstract class PacemItemsContainerElement<TItem extends PacemItemElement
|
|
|
1218
1759
|
unregister(item: TItem): boolean;
|
|
1219
1760
|
}
|
|
1220
1761
|
|
|
1762
|
+
/** Base class for items belonging to a {@link PacemIterativeElement}, forwarding their property changes to the master's `adapter`. */
|
|
1221
1763
|
declare abstract class PacemIterableElement extends PacemItemElement {
|
|
1222
1764
|
/** @overrides */
|
|
1223
1765
|
protected findContainer(): any;
|
|
1224
1766
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1225
1767
|
}
|
|
1226
1768
|
|
|
1769
|
+
/** Base class for container elements whose items are driven by a pluggable {@link PacemAdapter}, tracking a `current` `index`. */
|
|
1227
1770
|
declare abstract class PacemIterativeElement<TItem extends PacemIterableElement> extends PacemItemsContainerElement<TItem> implements Iterative<TItem> {
|
|
1771
|
+
/** Gets or sets the adapter that drives the behavior/UI of this iterative element. */
|
|
1228
1772
|
adapter: PacemAdapter<PacemIterativeElement<TItem>, TItem>;
|
|
1773
|
+
/** Gets or sets the index of the currently focused/selected item. */
|
|
1229
1774
|
index: number;
|
|
1230
1775
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1231
1776
|
viewActivatedCallback(): void;
|
|
@@ -1233,9 +1778,12 @@ declare abstract class PacemIterativeElement<TItem extends PacemIterableElement>
|
|
|
1233
1778
|
disconnectedCallback(): void;
|
|
1234
1779
|
}
|
|
1235
1780
|
|
|
1781
|
+
/** Sets (or removes) an attribute on the closest ancestor shell element, e.g. to drive layout-wide CSS state. */
|
|
1236
1782
|
declare class PacemLayoutProxyElement extends PacemEventTarget {
|
|
1237
1783
|
#private;
|
|
1784
|
+
/** Gets or sets the name of the shell attribute to manage. */
|
|
1238
1785
|
attr: string;
|
|
1786
|
+
/** Gets or sets the value to assign to the attribute; `"false"` removes it, `"true"` sets it empty. */
|
|
1239
1787
|
value: string;
|
|
1240
1788
|
connectedCallback(): void;
|
|
1241
1789
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -1243,22 +1791,32 @@ declare class PacemLayoutProxyElement extends PacemEventTarget {
|
|
|
1243
1791
|
private _update;
|
|
1244
1792
|
}
|
|
1245
1793
|
|
|
1794
|
+
/** Creates, updates or removes a `<meta>` element in the document `<head>`, keyed by either `name` or `itemprop`. */
|
|
1246
1795
|
declare class PacemMetaProxyElement extends PacemEventTarget {
|
|
1796
|
+
/** Gets or sets the `name` attribute used to look up the target `<meta>` element. */
|
|
1247
1797
|
name: string;
|
|
1798
|
+
/** Gets or sets the `itemprop` attribute used to look up the target `<meta>` element (used when `name` is not set). */
|
|
1248
1799
|
itemprop: string;
|
|
1800
|
+
/** Gets or sets the `content` attribute value; an empty value removes the element. */
|
|
1249
1801
|
content: string;
|
|
1250
1802
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1251
1803
|
viewActivatedCallback(): void;
|
|
1252
1804
|
private _update;
|
|
1253
1805
|
}
|
|
1254
1806
|
|
|
1807
|
+
/** Animates a numeric `target[property]` from `from` to `to` over `duration`. */
|
|
1255
1808
|
declare class PacemNumberAnimationElement extends TweenAnimationElement<number> {
|
|
1809
|
+
/** Gets or sets the starting value. */
|
|
1256
1810
|
from: number;
|
|
1811
|
+
/** Gets or sets the ending value. */
|
|
1257
1812
|
to: number;
|
|
1813
|
+
/** @inheritdoc */
|
|
1258
1814
|
protected tweenInterpolationCallback(time: number, progress: number): number;
|
|
1259
1815
|
}
|
|
1260
1816
|
|
|
1817
|
+
/** Tracks the browser's network connectivity (`navigator.onLine`), updating `online` on `online`/`offline` events. */
|
|
1261
1818
|
declare class PacemOnlineStatusElement extends PacemEventTarget {
|
|
1819
|
+
/** @readonly Gets whether the browser currently reports itself as online. */
|
|
1262
1820
|
online: boolean;
|
|
1263
1821
|
connectedCallback(): void;
|
|
1264
1822
|
viewActivatedCallback(): void;
|
|
@@ -1266,16 +1824,23 @@ declare class PacemOnlineStatusElement extends PacemEventTarget {
|
|
|
1266
1824
|
private _onlineHandler;
|
|
1267
1825
|
}
|
|
1268
1826
|
|
|
1827
|
+
/** Plain generic-purpose container element, useful as a databinding/behaviors host wherever a `<div>` would do. */
|
|
1269
1828
|
declare class PacemPanelElement extends PacemSafeContentElement {
|
|
1270
1829
|
}
|
|
1271
1830
|
|
|
1831
|
+
/** Animates a {@link Point} `target[property]` from `from` to `to` over `duration`. */
|
|
1272
1832
|
declare class PacemPointAnimationElement extends TweenAnimationElement<Point> {
|
|
1833
|
+
/** Gets or sets the starting point. */
|
|
1273
1834
|
from: Point;
|
|
1835
|
+
/** Gets or sets the ending point. */
|
|
1274
1836
|
to: Point;
|
|
1837
|
+
/** @inheritdoc */
|
|
1275
1838
|
protected tweenInterpolationCallback(time: number, progress: number): Point;
|
|
1276
1839
|
}
|
|
1277
1840
|
|
|
1278
1841
|
/**
|
|
1842
|
+
* Repeats its `<template>` content once per `datasource` item, keeping the rendered items in sync as the datasource changes.
|
|
1843
|
+
* @example
|
|
1279
1844
|
* <pacem-repeater datasource="[{id:'first', items:['a','b','c']}, ...]">
|
|
1280
1845
|
* <ol>
|
|
1281
1846
|
* <li>
|
|
@@ -1291,15 +1856,18 @@ declare class PacemPointAnimationElement extends TweenAnimationElement<Point> {
|
|
|
1291
1856
|
* </pacem-repeater>
|
|
1292
1857
|
*/
|
|
1293
1858
|
declare class PacemRepeaterElement extends PacemEventTarget implements Repeater {
|
|
1859
|
+
/** Gets or sets the collection of items to render, one per `<template>` instance. */
|
|
1294
1860
|
datasource: any[];
|
|
1295
1861
|
private _childItems;
|
|
1296
1862
|
private _itemTemplate;
|
|
1297
1863
|
private _childTemplatePlaceholder;
|
|
1298
1864
|
private _fragment;
|
|
1865
|
+
/** Removes the rendered item at the given index. */
|
|
1299
1866
|
removeItem(index: number): void;
|
|
1300
1867
|
private _setItem;
|
|
1301
1868
|
private _removeItems;
|
|
1302
1869
|
private _setupItem;
|
|
1870
|
+
/** Forces a full re-render of the items against the current `datasource`. */
|
|
1303
1871
|
databind(): void;
|
|
1304
1872
|
private _databind;
|
|
1305
1873
|
private _onCommand;
|
|
@@ -1310,14 +1878,26 @@ declare class PacemRepeaterElement extends PacemEventTarget implements Repeater
|
|
|
1310
1878
|
propertyChangedCallback(name: string, old: any, val: any, first: boolean): void;
|
|
1311
1879
|
}
|
|
1312
1880
|
|
|
1881
|
+
/**
|
|
1882
|
+
* Pacem Rescale element adapter: implements {@link Rescaler} on top of {@link PacemBehavior}, decorating
|
|
1883
|
+
* registered elements with draggable resize handles (see {@link RescaleHandle}).
|
|
1884
|
+
*/
|
|
1313
1885
|
declare class PacemRescaleElement extends PacemBehavior implements Rescaler {
|
|
1886
|
+
/** Adds the resize-handle frame (see {@link RescaleHandle}) around the given element. */
|
|
1314
1887
|
protected decorate(element: Element): void;
|
|
1888
|
+
/** Removes the resize-handle frame set up by {@link decorate}. */
|
|
1315
1889
|
protected undecorate(element: Element): void;
|
|
1890
|
+
/** Gets or sets the resize handles enabled on the registered elements. */
|
|
1316
1891
|
handles: RescaleHandle[];
|
|
1892
|
+
/** Gets or sets the minimum allowed width, in pixels. */
|
|
1317
1893
|
minWidth: number;
|
|
1894
|
+
/** Gets or sets the maximum allowed width, in pixels. */
|
|
1318
1895
|
maxWidth: number;
|
|
1896
|
+
/** Gets or sets the minimum allowed height, in pixels. */
|
|
1319
1897
|
minHeight: number;
|
|
1898
|
+
/** Gets or sets the maximum allowed height, in pixels. */
|
|
1320
1899
|
maxHeight: number;
|
|
1900
|
+
/** Gets or sets whether the width/height ratio must be preserved while resizing. */
|
|
1321
1901
|
keepProportions: boolean;
|
|
1322
1902
|
viewActivatedCallback(): void;
|
|
1323
1903
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -1328,8 +1908,11 @@ declare class PacemRescaleElement extends PacemBehavior implements Rescaler {
|
|
|
1328
1908
|
private _startHandler;
|
|
1329
1909
|
}
|
|
1330
1910
|
|
|
1911
|
+
/** Observes size (and, optionally, position) changes of itself or a `target` element, firing a `resize` event accordingly. */
|
|
1331
1912
|
declare class PacemResizeElement extends PacemEventTarget {
|
|
1913
|
+
/** Gets or sets the element to observe; defaults to this element itself. */
|
|
1332
1914
|
target: Element;
|
|
1915
|
+
/** Gets or sets whether to also track position changes via a per-frame poll (costlier than the native `ResizeObserver`-only path). */
|
|
1333
1916
|
watchPosition: boolean;
|
|
1334
1917
|
private get _target();
|
|
1335
1918
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -1345,32 +1928,56 @@ declare class PacemResizeElement extends PacemEventTarget {
|
|
|
1345
1928
|
private _checkSizeHandler;
|
|
1346
1929
|
private _assignSizeDebounced;
|
|
1347
1930
|
private _checkSize;
|
|
1931
|
+
/** @readonly Gets the last measured size (and position, if `watchPosition` is set) of the observed target. */
|
|
1348
1932
|
get currentSize(): ResizeEventArgs;
|
|
1349
1933
|
private _dispatchResize;
|
|
1350
1934
|
connectedCallback(): void;
|
|
1351
1935
|
disconnectedCallback(): void;
|
|
1352
1936
|
}
|
|
1353
1937
|
|
|
1938
|
+
/**
|
|
1939
|
+
* Pacem Rotate element adapter: implements {@link Rotator} on top of {@link PacemBehavior} to make
|
|
1940
|
+
* registered elements rotatable around a pivot point via mouse/touch drag.
|
|
1941
|
+
*/
|
|
1354
1942
|
declare class PacemRotateElement extends PacemBehavior implements Rotator {
|
|
1943
|
+
/** Wires up the `mousedown`/`touchstart` listeners that arm the rotate gesture on the given element. */
|
|
1355
1944
|
protected decorate(element: Element): void;
|
|
1945
|
+
/** Removes the listeners set up by {@link decorate}. */
|
|
1356
1946
|
protected undecorate(element: Element): void;
|
|
1947
|
+
/** Gets or sets the step constrained amount, in radians; when greater than zero, rotation snaps to multiples of it. */
|
|
1357
1948
|
step: number;
|
|
1949
|
+
/** Gets or sets the minimum allowed rotation, in radians. */
|
|
1358
1950
|
minRotation: number;
|
|
1951
|
+
/** Gets or sets the maximum allowed rotation, in radians. */
|
|
1359
1952
|
maxRotation: number;
|
|
1953
|
+
/** Gets or sets the pivot point the element rotates around; defaults to the element's own center. */
|
|
1360
1954
|
center: Point;
|
|
1361
1955
|
private _startHandler;
|
|
1362
1956
|
}
|
|
1363
1957
|
|
|
1958
|
+
/** Client-side router: parses/generates paths against a template and drives the browser History API. */
|
|
1364
1959
|
declare class PacemRouterElement extends PacemEventTarget {
|
|
1365
1960
|
#private;
|
|
1961
|
+
/** Gets or sets the route template, e.g. `/{controller}/{action}/{id?}`. */
|
|
1366
1962
|
template: string;
|
|
1963
|
+
/** Gets or sets the current parsed state, derived from `path` against `template`. */
|
|
1367
1964
|
state: RouterState;
|
|
1965
|
+
/** Gets or sets the current path; assigning a new value triggers a `navigate`. */
|
|
1368
1966
|
path: string;
|
|
1369
1967
|
/** Whether to restore the scroll position of a page visited via the back/forward buttons, and scroll newly-visited pages to top. Default `true`; set to `false` to fall back to the browser's own (native) scroll restoration. */
|
|
1370
1968
|
scrollRestoration: boolean;
|
|
1969
|
+
/**
|
|
1970
|
+
* Merges the provided partial state into the current one and returns the resulting parsed {@link RouterState}, without navigating.
|
|
1971
|
+
* @param state Piece of new state to be merged
|
|
1972
|
+
*/
|
|
1371
1973
|
parseState(state?: {
|
|
1372
1974
|
[key: string]: string;
|
|
1373
1975
|
}): RouterState;
|
|
1976
|
+
/**
|
|
1977
|
+
* Navigates to the provided path or partial state, pushing (or replacing) a new browser history entry.
|
|
1978
|
+
* @param path Absolute/relative path, or a partial state object to be merged into the current one
|
|
1979
|
+
* @param title Optional document title to set upon navigation
|
|
1980
|
+
*/
|
|
1374
1981
|
navigate(path: string, title?: string): any;
|
|
1375
1982
|
navigate(state: {
|
|
1376
1983
|
[key: string]: string;
|
|
@@ -1391,6 +1998,7 @@ declare class PacemRouterElement extends PacemEventTarget {
|
|
|
1391
1998
|
private _parseState;
|
|
1392
1999
|
}
|
|
1393
2000
|
|
|
2001
|
+
/** {@link PacemContentElement} variant that strips out `<script>` blocks (and, for `Node` content, `<script>` elements) before rendering `content`. */
|
|
1394
2002
|
declare class PacemSafeContentElement extends PacemContentElement {
|
|
1395
2003
|
private _sanitizeLegacy;
|
|
1396
2004
|
protected sanitize(html: string | Node): string | Node;
|
|
@@ -1409,19 +2017,30 @@ declare class PacemScrollAwareElement extends PacemEventTarget {
|
|
|
1409
2017
|
};
|
|
1410
2018
|
}
|
|
1411
2019
|
|
|
2020
|
+
/** Registers a service worker and manages its (optional) Push API subscription. */
|
|
1412
2021
|
declare class PacemServiceWorkerProxyElement extends PacemEventTarget {
|
|
1413
|
-
/** @readonly */
|
|
2022
|
+
/** @readonly Gets the active service worker registration, once available. */
|
|
1414
2023
|
registration: ServiceWorkerRegistration;
|
|
1415
|
-
/** @readonly */
|
|
2024
|
+
/** @readonly Gets the current push subscription, once available. */
|
|
1416
2025
|
pushSubscription: PushSubscription;
|
|
2026
|
+
/** Gets or sets the URL of the service worker script to register. */
|
|
1417
2027
|
src: string;
|
|
2028
|
+
/** Gets or sets the VAPID public key (base64url) used when subscribing to push notifications. */
|
|
1418
2029
|
publicKey: string;
|
|
1419
2030
|
viewActivatedCallback(): void;
|
|
1420
2031
|
disconnectedCallback(): void;
|
|
1421
2032
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1422
2033
|
private _tryUnregister;
|
|
1423
2034
|
private _tryRegister;
|
|
2035
|
+
/**
|
|
2036
|
+
* Unsubscribes from push notifications.
|
|
2037
|
+
* @param subscription Subscription to cancel; defaults to the current `pushSubscription`
|
|
2038
|
+
*/
|
|
1424
2039
|
unsubscribe(subscription?: PushSubscription): Promise<boolean>;
|
|
2040
|
+
/**
|
|
2041
|
+
* Subscribes to push notifications through the registered service worker.
|
|
2042
|
+
* @param publicKey VAPID public key (base64url or raw bytes); defaults to `publicKey`
|
|
2043
|
+
*/
|
|
1425
2044
|
subscribe(publicKey?: string | Uint8Array<ArrayBuffer>): Promise<PushSubscription>;
|
|
1426
2045
|
}
|
|
1427
2046
|
|
|
@@ -1430,8 +2049,11 @@ declare class PacemShellProxyElement extends PacemTransferProxyElement {
|
|
|
1430
2049
|
protected get proxy(): HTMLElement;
|
|
1431
2050
|
}
|
|
1432
2051
|
|
|
2052
|
+
/** Listens for a keyboard shortcut (optionally chorded, e.g. `"ctrl+k, s"`) on a target and fires an `execute` event when matched. */
|
|
1433
2053
|
declare class PacemShortcutElement extends PacemEventTarget {
|
|
2054
|
+
/** Gets or sets the key combination to listen for (e.g. `"ctrl+s"`, or a comma-separated sequence like `"ctrl+k, s"`). */
|
|
1434
2055
|
combination: string;
|
|
2056
|
+
/** Gets or sets the event target to listen on; defaults to `window`. */
|
|
1435
2057
|
target: EventTarget;
|
|
1436
2058
|
viewActivatedCallback(): void;
|
|
1437
2059
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -1442,33 +2064,49 @@ declare class PacemShortcutElement extends PacemEventTarget {
|
|
|
1442
2064
|
private _shortcutHandler;
|
|
1443
2065
|
}
|
|
1444
2066
|
|
|
2067
|
+
/** Sets its own `textContent` to the `text` property, escaping any markup. */
|
|
1445
2068
|
declare class PacemSpanElement extends PacemSafeContentElement {
|
|
1446
2069
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1447
2070
|
viewActivatedCallback(): void;
|
|
2071
|
+
/** Gets or sets the plain text to display as this element's content. */
|
|
1448
2072
|
text: string;
|
|
1449
2073
|
}
|
|
1450
2074
|
|
|
2075
|
+
/**
|
|
2076
|
+
* Groups one or more {@link Timeline}s (either {@link AnimationElement} child items or an explicit
|
|
2077
|
+
* `datasource`) and starts/cancels them together, optionally on view activation via `autostart`.
|
|
2078
|
+
*/
|
|
1451
2079
|
declare class PacemStoryboardElement extends PacemItemsContainerElement<AnimationElement> {
|
|
2080
|
+
/** @inheritdoc */
|
|
1452
2081
|
validate(item: AnimationElement): boolean;
|
|
2082
|
+
/** Gets or sets whether the storyboard starts animating automatically once its view is activated. */
|
|
1453
2083
|
autostart: boolean;
|
|
1454
2084
|
/**
|
|
1455
2085
|
* Extends or contracts the computed duration
|
|
1456
2086
|
* */
|
|
1457
2087
|
duration: number;
|
|
2088
|
+
/** Gets or sets the {@link Timeline}s to animate, as an alternative to declaring {@link AnimationElement} child items. */
|
|
1458
2089
|
datasource: Timeline[];
|
|
2090
|
+
/** @readonly Gets the effective set of {@link Timeline}s in use, resolved from either `datasource` or the child `items`. */
|
|
1459
2091
|
private _adaptedDatasource;
|
|
1460
2092
|
viewActivatedCallback(): void;
|
|
1461
2093
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1462
2094
|
private _buildDatasourceFromItems;
|
|
1463
2095
|
private _buildDatasourceFromDatasource;
|
|
1464
2096
|
private _animate;
|
|
2097
|
+
/** Cancels every running {@link Timeline} in this storyboard. */
|
|
1465
2098
|
cancelAnimation(): void;
|
|
2099
|
+
/** Starts (or restarts) every {@link Timeline} in this storyboard. */
|
|
1466
2100
|
startAnimation(): Promise<any>;
|
|
1467
2101
|
}
|
|
1468
2102
|
|
|
2103
|
+
/** Injects a `<style>` element into the document `<head>`, populated either inline (`cssText`) or by fetching `src`. */
|
|
1469
2104
|
declare class PacemStyleProxyElement extends PacemEventTarget {
|
|
2105
|
+
/** Gets or sets the URL of the CSS stylesheet to fetch and inject. */
|
|
1470
2106
|
src: string;
|
|
2107
|
+
/** Gets or sets the CSS text to inject directly (used when `src` is not set). */
|
|
1471
2108
|
cssText: string;
|
|
2109
|
+
/** @readonly Gets whether the injected stylesheet (and its web fonts, if any) has finished loading. */
|
|
1472
2110
|
cssReady: boolean;
|
|
1473
2111
|
private _style;
|
|
1474
2112
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -1478,15 +2116,23 @@ declare class PacemStyleProxyElement extends PacemEventTarget {
|
|
|
1478
2116
|
private _fetch;
|
|
1479
2117
|
}
|
|
1480
2118
|
|
|
2119
|
+
/**
|
|
2120
|
+
* Pacem Swipe element adapter: implements {@link Swiper} on top of {@link PacemBehavior} to make
|
|
2121
|
+
* registered elements draggable along one axis, with snap points and fling/bounce-back detection.
|
|
2122
|
+
*/
|
|
1481
2123
|
declare class PacemSwipeElement extends PacemBehavior implements Swiper {
|
|
1482
2124
|
#private;
|
|
1483
2125
|
/** No return point distance on the horizontal axis (defaults to half the device screen width). */
|
|
1484
2126
|
snaps: number[];
|
|
2127
|
+
/** Gets or sets the axis along which registered elements can be swiped. */
|
|
1485
2128
|
direction: 'horizontal' | 'vertical';
|
|
2129
|
+
/** Gets or sets the fine-tuning options (see {@link SwipeOptions}). */
|
|
1486
2130
|
options: Partial<SwipeOptions>;
|
|
1487
2131
|
/** Handle selector to be matched when starting the drag gesture. */
|
|
1488
2132
|
handleSelector: string;
|
|
2133
|
+
/** Wires up the `pointerdown` listener that arms the swipe gesture on the given element. */
|
|
1489
2134
|
protected decorate(element: Element): void;
|
|
2135
|
+
/** Removes the listener set up by {@link decorate}. */
|
|
1490
2136
|
protected undecorate(element: Element): void;
|
|
1491
2137
|
viewActivatedCallback(): void;
|
|
1492
2138
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -1497,13 +2143,16 @@ declare class PacemSwipeElement extends PacemBehavior implements Swiper {
|
|
|
1497
2143
|
private _undoHandler;
|
|
1498
2144
|
}
|
|
1499
2145
|
|
|
2146
|
+
/** Redirects consumers (e.g. {@link PacemRepeaterElement}) to an external `<template>` element, firing a `templatechange` event when it changes. */
|
|
1500
2147
|
declare class PacemTemplateProxyElement extends /*PacemEventTarget*/ TemplateElement {
|
|
2148
|
+
/** Gets or sets the external `<template>` element this proxy points to. */
|
|
1501
2149
|
target: HTMLTemplateElement;
|
|
1502
2150
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1503
2151
|
addEventListener(type: 'templatechange', listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1504
2152
|
removeEventListener(type: 'templatechange', listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1505
2153
|
}
|
|
1506
2154
|
|
|
2155
|
+
/** Renders the `text` property as its own plain-text content, replacing any existing child markup. */
|
|
1507
2156
|
declare class PacemTextElement extends HTMLElement implements OnPropertyChanged, OnConnected {
|
|
1508
2157
|
constructor();
|
|
1509
2158
|
private _text;
|
|
@@ -1515,8 +2164,10 @@ declare class PacemTextElement extends HTMLElement implements OnPropertyChanged,
|
|
|
1515
2164
|
text: string;
|
|
1516
2165
|
}
|
|
1517
2166
|
|
|
2167
|
+
/** Fires a `tick` event on a regular interval, as long as it's enabled and `interval` is greater than zero. */
|
|
1518
2168
|
declare class PacemTimerElement extends PacemEventTarget {
|
|
1519
2169
|
constructor();
|
|
2170
|
+
/** Gets or sets the tick interval, in milliseconds. */
|
|
1520
2171
|
interval: number;
|
|
1521
2172
|
private _handle;
|
|
1522
2173
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -1525,13 +2176,16 @@ declare class PacemTimerElement extends PacemEventTarget {
|
|
|
1525
2176
|
private _restart;
|
|
1526
2177
|
}
|
|
1527
2178
|
|
|
2179
|
+
/** Sets `document.title` to `value` whenever it changes. */
|
|
1528
2180
|
declare class PacemTitleProxyElement extends PacemEventTarget {
|
|
2181
|
+
/** Gets or sets the text to assign to `document.title`. */
|
|
1529
2182
|
value: string;
|
|
1530
2183
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1531
2184
|
viewActivatedCallback(): void;
|
|
1532
2185
|
private _update;
|
|
1533
2186
|
}
|
|
1534
2187
|
|
|
2188
|
+
/** Base class for elements that move their own content to another DOM location, restoring nothing on disconnect. */
|
|
1535
2189
|
declare abstract class PacemTransferProxyElement extends PacemEventTarget {
|
|
1536
2190
|
protected abstract get proxy(): HTMLElement;
|
|
1537
2191
|
private _dom;
|
|
@@ -1542,21 +2196,31 @@ declare abstract class PacemTransferProxyElement extends PacemEventTarget {
|
|
|
1542
2196
|
disconnectedCallback(): void;
|
|
1543
2197
|
}
|
|
1544
2198
|
|
|
2199
|
+
/** Animates a numeric `value` from `from` to `to` over `duration`, dispatching animation lifecycle events along the way. */
|
|
1545
2200
|
declare class PacemTweenElement extends PacemEventTarget {
|
|
1546
2201
|
private _tweener;
|
|
1547
2202
|
constructor(_tweener?: TweenService);
|
|
2203
|
+
/** Gets or sets the easing function; defaults to a linear tween. */
|
|
1548
2204
|
easing: (time: number) => number;
|
|
2205
|
+
/** Gets or sets the starting value. */
|
|
1549
2206
|
from: number;
|
|
2207
|
+
/** Gets or sets the ending value. */
|
|
1550
2208
|
to: number;
|
|
2209
|
+
/** Gets or sets the animation duration, in milliseconds (default `1000`). */
|
|
1551
2210
|
duration: number;
|
|
2211
|
+
/** Gets or sets the delay before the animation starts, in milliseconds. */
|
|
1552
2212
|
delay: number;
|
|
2213
|
+
/** Gets or sets whether the animation is running; setting it to `true` starts (or restarts) the tween. */
|
|
1553
2214
|
start: boolean;
|
|
2215
|
+
/** @readonly Gets the current animated value. */
|
|
1554
2216
|
value: number;
|
|
1555
2217
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
2218
|
+
/** Starts the animation programmatically and returns a promise resolved once it completes. */
|
|
1556
2219
|
run(): Promise<void>;
|
|
1557
2220
|
private _animate;
|
|
1558
2221
|
}
|
|
1559
2222
|
|
|
2223
|
+
/** {@link PacemContentElement} variant that renders `content` verbatim, without any sanitization. */
|
|
1560
2224
|
declare class PacemUnsafeContentElement extends PacemContentElement {
|
|
1561
2225
|
protected sanitize(html: string): string | Node;
|
|
1562
2226
|
}
|
|
@@ -1570,15 +2234,23 @@ declare class PacemViewportAwareElement extends PacemEventTarget {
|
|
|
1570
2234
|
disconnectedCallback(): void;
|
|
1571
2235
|
}
|
|
1572
2236
|
|
|
2237
|
+
/** Wraps a {@link Worker}, sending/receiving messages to/from a web worker script. */
|
|
1573
2238
|
declare class PacemWebWorkerProxyElement extends PacemEventTarget {
|
|
2239
|
+
/** Gets or sets the message to be posted to the worker. */
|
|
1574
2240
|
message: any;
|
|
1575
|
-
/** @readonly */
|
|
2241
|
+
/** @readonly Gets the last message received from the worker. */
|
|
1576
2242
|
result: any;
|
|
2243
|
+
/** Gets or sets the URL of the worker script to instantiate. */
|
|
1577
2244
|
src: string;
|
|
2245
|
+
/** Gets or sets whether to automatically send `message` as soon as it changes (default `true`). */
|
|
1578
2246
|
autosend: boolean;
|
|
1579
2247
|
viewActivatedCallback(): void;
|
|
1580
2248
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1581
2249
|
disconnectedCallback(): void;
|
|
2250
|
+
/**
|
|
2251
|
+
* Posts a message to the worker.
|
|
2252
|
+
* @param message Message to send; defaults to the current `message` property
|
|
2253
|
+
*/
|
|
1582
2254
|
send(message?: any): void;
|
|
1583
2255
|
private _messageHandler;
|
|
1584
2256
|
private _errorHandler;
|
|
@@ -1587,25 +2259,45 @@ declare class PacemWebWorkerProxyElement extends PacemEventTarget {
|
|
|
1587
2259
|
private _disposeWorker;
|
|
1588
2260
|
}
|
|
1589
2261
|
|
|
2262
|
+
/** The prefix used for CSS custom properties and classes (e.g. `--{PCSS}-font-main`); configurable independently of the element tag prefix {@link P} via `window.Pacem.Configuration.css`, defaults to {@link P}. */
|
|
1590
2263
|
export declare const PCSS: any;
|
|
1591
2264
|
|
|
2265
|
+
/** Ready-to-use event listener that only calls `evt.preventDefault()`; handy as an `addEventListener` callback without allocating a closure. */
|
|
1592
2266
|
export declare const preventDefaultHandler: (evt: Event) => void;
|
|
1593
2267
|
|
|
2268
|
+
/**
|
|
2269
|
+
* Dispatched whenever a property decorated with {@link Watch} changes value (unless that decorator's
|
|
2270
|
+
* `emit` option is set to `false`). This is the mechanism data-bound expressions listen to in order to
|
|
2271
|
+
* re-evaluate themselves when one of their dependencies changes.
|
|
2272
|
+
*/
|
|
1594
2273
|
export declare class PropertyChangeEvent extends CustomTypedEvent<PropertyChangeEventArgs> {
|
|
1595
2274
|
constructor(args: PropertyChangeEventArgs);
|
|
1596
2275
|
}
|
|
1597
2276
|
|
|
2277
|
+
/** Payload carried by a {@link PropertyChangeEvent}. */
|
|
1598
2278
|
export declare interface PropertyChangeEventArgs {
|
|
2279
|
+
/** Name of the property that changed (camelCase). */
|
|
1599
2280
|
propertyName: string;
|
|
2281
|
+
/** Property's previous value, if any. */
|
|
1600
2282
|
oldValue?: any;
|
|
2283
|
+
/** Property's new value. */
|
|
1601
2284
|
currentValue: any;
|
|
2285
|
+
/** `true` when this is the property's first observed value (element not fully initialized yet). */
|
|
1602
2286
|
firstChange?: boolean;
|
|
1603
2287
|
}
|
|
1604
2288
|
|
|
2289
|
+
/** Event name dispatched whenever a `@Watch`-decorated property changes value; see {@link PropertyChangeEvent}. */
|
|
1605
2290
|
export declare const PropertyChangeEventName: string;
|
|
1606
2291
|
|
|
2292
|
+
/** Signature of a function testing two values of type `T` for equality (used by the {@link Watch} decorator to decide whether a property actually changed). */
|
|
1607
2293
|
export declare type PropertyComparer<T> = (old: T, val: T) => boolean;
|
|
1608
2294
|
|
|
2295
|
+
/**
|
|
2296
|
+
* Bridges an element's string attribute value and its typed property value, used by the {@link Watch}
|
|
2297
|
+
* decorator (and the {@link CustomElement} decorator that wires up attribute observation) to convert
|
|
2298
|
+
* attribute strings to property values and, optionally, reflect property values back to attributes.
|
|
2299
|
+
* See {@link PropertyConverters} for the built-in implementations.
|
|
2300
|
+
*/
|
|
1609
2301
|
export declare interface PropertyConverter {
|
|
1610
2302
|
/** You can assume `attr` not null, cause it will be processed only in that case. */
|
|
1611
2303
|
readonly convert: (attr: string, element?: HTMLElement) => any;
|
|
@@ -1615,6 +2307,11 @@ export declare interface PropertyConverter {
|
|
|
1615
2307
|
readonly retryConversionWhenReady?: boolean;
|
|
1616
2308
|
}
|
|
1617
2309
|
|
|
2310
|
+
/**
|
|
2311
|
+
* Built-in {@link PropertyConverter} implementations, keyed by the type they convert to/from. Passed as
|
|
2312
|
+
* the `converter` option of a {@link Watch}-decorated property (e.g. `@Watch({ converter: PropertyConverters.Number })`)
|
|
2313
|
+
* to control how that property's attribute string is parsed and, on change, reflected back.
|
|
2314
|
+
*/
|
|
1618
2315
|
export declare const PropertyConverters: {
|
|
1619
2316
|
None: PropertyConverter;
|
|
1620
2317
|
String: PropertyConverter;
|
|
@@ -1632,10 +2329,12 @@ export declare const PropertyConverters: {
|
|
|
1632
2329
|
Size: PropertyConverter;
|
|
1633
2330
|
};
|
|
1634
2331
|
|
|
2332
|
+
/** A map of binding-dependent property names to their {@link PropertyDependency} descriptor. */
|
|
1635
2333
|
export declare type PropertyDependencies = {
|
|
1636
2334
|
[name: string]: PropertyDependency;
|
|
1637
2335
|
};
|
|
1638
2336
|
|
|
2337
|
+
/** Describes a single data-binding dependency: one property of one element that a bound expression relies upon. */
|
|
1639
2338
|
export declare type PropertyDependency = {
|
|
1640
2339
|
/** Element to depend upon */
|
|
1641
2340
|
element: Node;
|
|
@@ -1648,6 +2347,7 @@ export declare type PropertyDependency = {
|
|
|
1648
2347
|
twowayAllowed: boolean;
|
|
1649
2348
|
};
|
|
1650
2349
|
|
|
2350
|
+
/** Static regular-expression helpers. */
|
|
1651
2351
|
export declare class Regex {
|
|
1652
2352
|
/**
|
|
1653
2353
|
* Splits an input string into segments based on a matching pattern.
|
|
@@ -1657,16 +2357,19 @@ export declare class Regex {
|
|
|
1657
2357
|
static split(input: string, pattern: RegExp): RegexMatchSegment[];
|
|
1658
2358
|
}
|
|
1659
2359
|
|
|
2360
|
+
/** One chunk produced by {@link Regex.split}: either a literal, non-matching substring or a matched one. */
|
|
1660
2361
|
export declare type RegexMatchSegment = {
|
|
1661
2362
|
value: string;
|
|
1662
2363
|
match: boolean;
|
|
1663
2364
|
index: number;
|
|
1664
2365
|
};
|
|
1665
2366
|
|
|
2367
|
+
/** Minimal shape of an element that repeats a template once per item of a `datasource` array (e.g. `PacemRepeaterElement`). */
|
|
1666
2368
|
export declare interface Repeater extends HTMLElement {
|
|
1667
2369
|
datasource: any[];
|
|
1668
2370
|
}
|
|
1669
2371
|
|
|
2372
|
+
/** Static lookup helpers for locating the {@link RepeaterItem} context a given element belongs to. */
|
|
1670
2373
|
export declare class Repeater {
|
|
1671
2374
|
/**
|
|
1672
2375
|
* Seeks for a PacemRepeaterItem element upwards through the DOM tree, given a starting element and the number of nesting levels.
|
|
@@ -1676,15 +2379,37 @@ export declare class Repeater {
|
|
|
1676
2379
|
static findItemContext(element: Element, upLevels?: number, logFn?: (message?: string) => void): RepeaterItem;
|
|
1677
2380
|
}
|
|
1678
2381
|
|
|
2382
|
+
/**
|
|
2383
|
+
* Base class tracking a single rendered repetition of a {@link Repeater}'s template: it associates a
|
|
2384
|
+
* DOM placeholder node with the `item`/`index` scope values that template's binding expressions
|
|
2385
|
+
* evaluate against, and is itself attached to that placeholder (see {@link getRepeaterItem}) so
|
|
2386
|
+
* descendant elements can find their way back to it via {@link findUpwards}.
|
|
2387
|
+
*/
|
|
1679
2388
|
export declare abstract class RepeaterItem {
|
|
1680
2389
|
private _placeholder;
|
|
2390
|
+
/**
|
|
2391
|
+
* Seeks upwards from `element` (previous siblings, then parent, repeated) for the nearest ancestor
|
|
2392
|
+
* placeholder tagged as a {@link RepeaterItem}, skipping `upLevels` matches before returning one -
|
|
2393
|
+
* this is how deeply-nested repeaters resolve which repetition (of which ancestor repeater) an
|
|
2394
|
+
* expression's `^item`/`^^item`/... token refers to.
|
|
2395
|
+
* @param element Element to start the upward search from.
|
|
2396
|
+
* @param upLevels 0-based number of matching ancestors to skip before returning one (`0` = nearest).
|
|
2397
|
+
* @param logFn Called with a warning message if no match is found and `element` is connected to the DOM.
|
|
2398
|
+
*/
|
|
1681
2399
|
static findUpwards(element: Element, upLevels?: number, logFn?: (message?: string) => void): RepeaterItem;
|
|
2400
|
+
/** Tests whether `node` is the placeholder of some {@link RepeaterItem}. */
|
|
1682
2401
|
static isRepeaterItem(node: Node): boolean;
|
|
2402
|
+
/** Retrieves the {@link RepeaterItem} attached to `node`, if `node` is a repeater-item placeholder; see {@link isRepeaterItem}. */
|
|
1683
2403
|
static getRepeaterItem(node: Node): RepeaterItem;
|
|
2404
|
+
/** @param _placeholder DOM node (typically a comment) that stands in for this repetition and gets tagged so {@link getRepeaterItem} can retrieve this instance back from it. */
|
|
1684
2405
|
constructor(_placeholder: Node);
|
|
2406
|
+
/** The data item this repetition renders. */
|
|
1685
2407
|
abstract item: any;
|
|
2408
|
+
/** The 0-based position of this repetition within its {@link Repeater}'s `datasource`. */
|
|
1686
2409
|
abstract index: number;
|
|
2410
|
+
/** The {@link Repeater} element this repetition belongs to. */
|
|
1687
2411
|
abstract readonly repeater: Repeater;
|
|
2412
|
+
/** The DOM placeholder node standing in for this repetition. */
|
|
1688
2413
|
get placeholder(): Node;
|
|
1689
2414
|
}
|
|
1690
2415
|
|
|
@@ -1731,7 +2456,8 @@ declare class RepeaterItemRemoveEvent extends RepeaterItemEvent {
|
|
|
1731
2456
|
|
|
1732
2457
|
declare const RepeaterItemRemoveEventName = "repeateritemremove";
|
|
1733
2458
|
|
|
1734
|
-
/** @
|
|
2459
|
+
/** Options accepted by {@link Http.request}.
|
|
2460
|
+
* @deprecated */
|
|
1735
2461
|
declare type RequestOptions = {
|
|
1736
2462
|
data?: 'string' | {
|
|
1737
2463
|
[key: string]: string;
|
|
@@ -1743,10 +2469,16 @@ declare type RequestOptions = {
|
|
|
1743
2469
|
progress?: (pct: number) => void;
|
|
1744
2470
|
};
|
|
1745
2471
|
|
|
2472
|
+
/**
|
|
2473
|
+
* Custom UI event dispatched throughout the rescale gesture lifecycle (see {@link RescaleEventType}).
|
|
2474
|
+
*/
|
|
1746
2475
|
declare class RescaleEvent extends CustomUIEvent<RescaleEventArgsClass> {
|
|
1747
2476
|
constructor(type: RescaleEventType, args: RescaleEventArgsClass, eventInit?: EventInit, evt?: MouseEvent | TouchEvent);
|
|
1748
2477
|
}
|
|
1749
2478
|
|
|
2479
|
+
/**
|
|
2480
|
+
* Plain data shape backing {@link RescaleEventArgsClass}.
|
|
2481
|
+
*/
|
|
1750
2482
|
declare type RescaleEventArgs = {
|
|
1751
2483
|
element: HTMLElement | SVGElement;
|
|
1752
2484
|
origin: Point;
|
|
@@ -1756,39 +2488,73 @@ declare type RescaleEventArgs = {
|
|
|
1756
2488
|
targetRect?: Rect;
|
|
1757
2489
|
};
|
|
1758
2490
|
|
|
2491
|
+
/**
|
|
2492
|
+
* Read-only event args dispatched with the rescale gesture lifecycle events.
|
|
2493
|
+
*/
|
|
1759
2494
|
declare class RescaleEventArgsClass {
|
|
1760
2495
|
private _builder;
|
|
1761
2496
|
private constructor();
|
|
2497
|
+
/** @readonly Gets the current pointer position. */
|
|
1762
2498
|
get currentPosition(): Point;
|
|
2499
|
+
/** @readonly Gets the rectangle the element is being resized to. */
|
|
1763
2500
|
get targetRect(): Rect;
|
|
2501
|
+
/** @readonly Gets the element being resized. */
|
|
1764
2502
|
get element(): HTMLElement | SVGElement;
|
|
2503
|
+
/** @readonly Gets the handle being dragged (see {@link RescaleHandle}). */
|
|
1765
2504
|
get handle(): string;
|
|
2505
|
+
/** Builds a new {@link RescaleEventArgsClass} out of a plain {@link RescaleEventArgs} builder. */
|
|
1766
2506
|
static fromArgs(builder: RescaleEventArgs): RescaleEventArgsClass;
|
|
1767
2507
|
}
|
|
1768
2508
|
|
|
2509
|
+
/**
|
|
2510
|
+
* Enumerates the events dispatched throughout the rescale gesture lifecycle.
|
|
2511
|
+
*/
|
|
1769
2512
|
declare enum RescaleEventType {
|
|
2513
|
+
/** First rescaling act. */
|
|
1770
2514
|
Start = "rescalestart",
|
|
2515
|
+
/** Any rescaling act. */
|
|
1771
2516
|
Rescale = "rescale",
|
|
2517
|
+
/** Terminating the rescaling activities. */
|
|
1772
2518
|
End = "rescaleend"
|
|
1773
2519
|
}
|
|
1774
2520
|
|
|
2521
|
+
/**
|
|
2522
|
+
* Enumerates the resize handles a {@link Rescaler} can expose around a rescalable element.
|
|
2523
|
+
*/
|
|
1775
2524
|
declare enum RescaleHandle {
|
|
2525
|
+
/** All four sides/corners are enabled. */
|
|
1776
2526
|
All = "all",
|
|
2527
|
+
/** The top edge (and its corners) is enabled. */
|
|
1777
2528
|
Top = "top",
|
|
2529
|
+
/** The left edge (and its corners) is enabled. */
|
|
1778
2530
|
Left = "left",
|
|
2531
|
+
/** The right edge (and its corners) is enabled. */
|
|
1779
2532
|
Right = "right",
|
|
2533
|
+
/** The bottom edge (and its corners) is enabled. */
|
|
1780
2534
|
Bottom = "bottom"
|
|
1781
2535
|
}
|
|
1782
2536
|
|
|
2537
|
+
/**
|
|
2538
|
+
* Interface to be implemented in order to create a proper rescale adapter.
|
|
2539
|
+
*/
|
|
1783
2540
|
declare interface Rescaler {
|
|
2541
|
+
/** Gets or sets the resize handles enabled on the rescalable element(s). */
|
|
1784
2542
|
handles: RescaleHandle[];
|
|
2543
|
+
/** Gets or sets the minimum allowed width, in pixels. */
|
|
1785
2544
|
minWidth: number;
|
|
2545
|
+
/** Gets or sets the maximum allowed width, in pixels. */
|
|
1786
2546
|
maxWidth: number;
|
|
2547
|
+
/** Gets or sets the maximum allowed height, in pixels. */
|
|
1787
2548
|
maxHeight: number;
|
|
2549
|
+
/** Gets or sets the minimum allowed height, in pixels. */
|
|
1788
2550
|
minHeight: number;
|
|
2551
|
+
/** Gets or sets whether the width/height ratio must be preserved while resizing. */
|
|
1789
2552
|
keepProportions: boolean;
|
|
2553
|
+
/** Registers a listener for a rescale lifecycle event. */
|
|
1790
2554
|
addEventListener(evt: RescaleEventType, listener: (evt: RescaleEvent) => void, useCapture?: boolean): void;
|
|
2555
|
+
/** Unregisters a listener previously added for a rescale lifecycle event. */
|
|
1791
2556
|
removeEventListener(evt: RescaleEventType, listener: (evt: RescaleEvent) => void, useCapture?: boolean): void;
|
|
2557
|
+
/** Dispatches a rescale lifecycle event. */
|
|
1792
2558
|
dispatchEvent(evt: RescaleEvent): boolean;
|
|
1793
2559
|
}
|
|
1794
2560
|
|
|
@@ -1805,8 +2571,10 @@ declare type ResizeEventArgs = {
|
|
|
1805
2571
|
|
|
1806
2572
|
declare const ResizeEventName = "resize";
|
|
1807
2573
|
|
|
1808
|
-
/** @
|
|
2574
|
+
/** Wraps a completed `XMLHttpRequest` produced by {@link Http.request}, exposing its status, headers and body in convenient forms.
|
|
2575
|
+
* @deprecated */
|
|
1809
2576
|
declare class Response_2 {
|
|
2577
|
+
/** @param req The completed `XMLHttpRequest`. @param processTime Elapsed request time, in milliseconds. */
|
|
1810
2578
|
constructor(req: XMLHttpRequest, processTime: number);
|
|
1811
2579
|
private _processTime;
|
|
1812
2580
|
private _status;
|
|
@@ -1815,17 +2583,26 @@ declare class Response_2 {
|
|
|
1815
2583
|
private _type;
|
|
1816
2584
|
private _allHeadersRaw;
|
|
1817
2585
|
private _headers;
|
|
2586
|
+
/** Elapsed request time, in milliseconds. */
|
|
1818
2587
|
get processTime(): number;
|
|
2588
|
+
/** Response headers, parsed into a name/value map (lazily, on first access). */
|
|
1819
2589
|
get headers(): {
|
|
1820
2590
|
[key: string]: string;
|
|
1821
2591
|
};
|
|
2592
|
+
/** The `Content-Length` response header, parsed as a number. */
|
|
1822
2593
|
get size(): number;
|
|
2594
|
+
/** The `Content-Type` response header. */
|
|
1823
2595
|
get mime(): string;
|
|
2596
|
+
/** The `Date` response header, parsed into a `Date`. */
|
|
1824
2597
|
get date(): Date;
|
|
1825
2598
|
private _parseHeaders;
|
|
2599
|
+
/** HTTP status code. */
|
|
1826
2600
|
get status(): number;
|
|
2601
|
+
/** Raw response body as text. */
|
|
1827
2602
|
get text(): string;
|
|
2603
|
+
/** Response body, typed per `XMLHttpRequest.responseType` (see {@link type}). */
|
|
1828
2604
|
get content(): any;
|
|
2605
|
+
/** The `XMLHttpRequest.responseType` used for this request. */
|
|
1829
2606
|
get type(): string;
|
|
1830
2607
|
/**
|
|
1831
2608
|
* Short-hand utility for getting or parsing json content (if any).
|
|
@@ -1833,10 +2610,16 @@ declare class Response_2 {
|
|
|
1833
2610
|
get json(): any;
|
|
1834
2611
|
}
|
|
1835
2612
|
|
|
2613
|
+
/**
|
|
2614
|
+
* Custom UI event dispatched throughout the rotate gesture lifecycle (see {@link RotateEventType}).
|
|
2615
|
+
*/
|
|
1836
2616
|
declare class RotateEvent extends CustomUIEvent<RotateEventArgsClass> {
|
|
1837
2617
|
constructor(type: RotateEventType, args: RotateEventArgsClass, eventInit?: EventInit, evt?: MouseEvent | TouchEvent);
|
|
1838
2618
|
}
|
|
1839
2619
|
|
|
2620
|
+
/**
|
|
2621
|
+
* Plain data shape backing {@link RotateEventArgsClass}.
|
|
2622
|
+
*/
|
|
1840
2623
|
declare type RotateEventArgs = {
|
|
1841
2624
|
element: HTMLElement | SVGElement;
|
|
1842
2625
|
origin: Point;
|
|
@@ -1849,23 +2632,41 @@ declare type RotateEventArgs = {
|
|
|
1849
2632
|
rotation: number;
|
|
1850
2633
|
};
|
|
1851
2634
|
|
|
2635
|
+
/**
|
|
2636
|
+
* Read-only event args dispatched with the rotate gesture lifecycle events.
|
|
2637
|
+
*/
|
|
1852
2638
|
declare class RotateEventArgsClass {
|
|
1853
2639
|
private _builder;
|
|
1854
2640
|
private constructor();
|
|
2641
|
+
/** @readonly Gets the current pointer position. */
|
|
1855
2642
|
get currentPosition(): Point;
|
|
2643
|
+
/** @readonly Gets the current rotation, in radians. */
|
|
1856
2644
|
get rotation(): number;
|
|
2645
|
+
/** @readonly Gets the element being rotated. */
|
|
1857
2646
|
get element(): HTMLElement | SVGElement;
|
|
2647
|
+
/** @readonly Gets the pivot point the element is rotating around. */
|
|
1858
2648
|
get center(): Point;
|
|
2649
|
+
/** Builds a new {@link RotateEventArgsClass} out of a plain {@link RotateEventArgs} builder. */
|
|
1859
2650
|
static fromArgs(builder: RotateEventArgs): RotateEventArgsClass;
|
|
1860
2651
|
}
|
|
1861
2652
|
|
|
2653
|
+
/**
|
|
2654
|
+
* Enumerates the events dispatched throughout the rotate gesture lifecycle.
|
|
2655
|
+
*/
|
|
1862
2656
|
declare enum RotateEventType {
|
|
2657
|
+
/** First rotating act. */
|
|
1863
2658
|
Start = "rotatestart",
|
|
2659
|
+
/** Any rotating act. */
|
|
1864
2660
|
Rotate = "rotate",
|
|
2661
|
+
/** Terminating the rotating activities. */
|
|
1865
2662
|
End = "rotateend"
|
|
1866
2663
|
}
|
|
1867
2664
|
|
|
2665
|
+
/**
|
|
2666
|
+
* Interface to be implemented in order to create a proper rotate adapter.
|
|
2667
|
+
*/
|
|
1868
2668
|
declare interface Rotator {
|
|
2669
|
+
/** Gets or sets the pivot point the element rotates around; defaults to the element's own center. */
|
|
1869
2670
|
center?: Point;
|
|
1870
2671
|
/** Gets or sets the minimum allowed rotation in radians */
|
|
1871
2672
|
minRotation?: number;
|
|
@@ -1873,35 +2674,47 @@ declare interface Rotator {
|
|
|
1873
2674
|
maxRotation?: number;
|
|
1874
2675
|
/** Gets or sets the step constrained amount in radians */
|
|
1875
2676
|
step?: number;
|
|
2677
|
+
/** Registers a listener for a rotate lifecycle event. */
|
|
1876
2678
|
addEventListener(evt: RotateEventType, listener: (evt: RotateEvent) => void, useCapture?: boolean): void;
|
|
2679
|
+
/** Unregisters a listener previously added for a rotate lifecycle event. */
|
|
1877
2680
|
removeEventListener(evt: RotateEventType, listener: (evt: RotateEvent) => void, useCapture?: boolean): void;
|
|
2681
|
+
/** Dispatches a rotate lifecycle event. */
|
|
1878
2682
|
dispatchEvent(evt: RotateEvent): boolean;
|
|
1879
2683
|
}
|
|
1880
2684
|
|
|
2685
|
+
/** Metadata describing one named `{segment}` of a route template, as parsed by `Utils.URIs.parseRoute`. */
|
|
1881
2686
|
declare type RouteMetadata = {
|
|
1882
2687
|
name: string;
|
|
1883
2688
|
optional: boolean;
|
|
1884
2689
|
index: number;
|
|
1885
2690
|
};
|
|
1886
2691
|
|
|
2692
|
+
/** Dispatched by a router once it has navigated to a new `path` (not cancelable — the navigation already happened). */
|
|
1887
2693
|
export declare class RouterNavigateEvent extends CustomTypedEvent<RouterNavigateEventArgs> {
|
|
2694
|
+
/** @param path Either the destination path alone, or the full navigation args (path, title, referrer). */
|
|
1888
2695
|
constructor(path: string | RouterNavigateEventArgs);
|
|
1889
2696
|
}
|
|
1890
2697
|
|
|
2698
|
+
/** Payload carried by a {@link RouterNavigateEvent}. */
|
|
1891
2699
|
export declare type RouterNavigateEventArgs = {
|
|
1892
2700
|
path: string;
|
|
1893
2701
|
title?: string;
|
|
1894
2702
|
referrer?: string;
|
|
1895
2703
|
};
|
|
1896
2704
|
|
|
2705
|
+
/** Event name dispatched by a router *after* a navigation has been committed; see {@link RouterNavigateEvent}. */
|
|
1897
2706
|
export declare const RouterNavigateEventName = "navigate";
|
|
1898
2707
|
|
|
2708
|
+
/** Dispatched by a router right before navigating to `path`; cancelable, so a listener can call `preventDefault()` to abort the navigation. */
|
|
1899
2709
|
export declare class RouterNavigatingEvent extends CustomTypedEvent<string> {
|
|
2710
|
+
/** @param path Destination path about to be navigated to. */
|
|
1900
2711
|
constructor(path: string);
|
|
1901
2712
|
}
|
|
1902
2713
|
|
|
2714
|
+
/** Event name dispatched by a router *before* a navigation is committed; see {@link RouterNavigatingEvent}. Cancelable: calling `preventDefault()` aborts the navigation. */
|
|
1903
2715
|
export declare const RouterNavigatingEventName = "navigating";
|
|
1904
2716
|
|
|
2717
|
+
/** Parsed representation of a router's current location: path segments (declared as route metadata) become named properties, alongside the fixed `$path`/`$pathname`/`$query`/`$hash`/`$scrollY` keys. */
|
|
1905
2718
|
export declare type RouterState = {
|
|
1906
2719
|
[key: string]: string;
|
|
1907
2720
|
} & {
|
|
@@ -1938,14 +2751,24 @@ declare interface StateEventArgs<T> {
|
|
|
1938
2751
|
|
|
1939
2752
|
declare type StateEventType = 'push' | 'undo' | 'reset' | 'redo';
|
|
1940
2753
|
|
|
2754
|
+
/** Error thrown by {@link Http.request} when a request fails outright or completes with a non-2xx status. */
|
|
1941
2755
|
declare class StatusCodeError extends Error {
|
|
1942
2756
|
private statusCode;
|
|
2757
|
+
/** @param statusCode HTTP status code (`500` for network-level failures). @param statusText Status text / error message. */
|
|
1943
2758
|
constructor(statusCode: number, statusText: string);
|
|
2759
|
+
/** The HTTP status code that caused this error. */
|
|
1944
2760
|
get status(): number;
|
|
1945
2761
|
}
|
|
1946
2762
|
|
|
2763
|
+
/** Ready-to-use event listener that only calls `evt.stopPropagation()`; handy as an `addEventListener` callback without allocating a closure. */
|
|
1947
2764
|
export declare const stopPropagationHandler: (evt: Event) => void;
|
|
1948
2765
|
|
|
2766
|
+
/**
|
|
2767
|
+
* JSON-serializing wrapper around `sessionStorage`/`localStorage` that transparently supports per-key
|
|
2768
|
+
* expiration: values stored with a `duration` are stamped with an expiry timestamp and evicted lazily
|
|
2769
|
+
* (checked on the next {@link getPropertyValue} call for that key, not via a timer). Session storage and
|
|
2770
|
+
* local storage are treated as a single logical namespace - storing a key in one clears any same-named entry in the other.
|
|
2771
|
+
*/
|
|
1949
2772
|
declare class Storage_2 {
|
|
1950
2773
|
private _getStorage;
|
|
1951
2774
|
private _parseValue;
|
|
@@ -1963,16 +2786,29 @@ declare class Storage_2 {
|
|
|
1963
2786
|
* @param duration Storage timeout in seconds
|
|
1964
2787
|
*/
|
|
1965
2788
|
setPropertyValue(name: string, value: any, duration: number): any;
|
|
2789
|
+
/**
|
|
2790
|
+
* Retrieves a previously stored value by `name`, checking session storage first, then local storage.
|
|
2791
|
+
* Returns `null` if not found, or if found but past its expiration.
|
|
2792
|
+
* @param name The unique key.
|
|
2793
|
+
*/
|
|
1966
2794
|
getPropertyValue(name: string): any;
|
|
2795
|
+
/** Clears both session and local storage entirely. */
|
|
1967
2796
|
clear(): void;
|
|
2797
|
+
/** Removes a single entry by `name` from both session and local storage. */
|
|
1968
2798
|
removeProperty(name: string): void;
|
|
1969
2799
|
}
|
|
1970
2800
|
export { Storage_2 as Storage }
|
|
1971
2801
|
|
|
2802
|
+
/**
|
|
2803
|
+
* Custom typed event dispatched throughout the swipe gesture lifecycle (see {@link SwipeEventType}).
|
|
2804
|
+
*/
|
|
1972
2805
|
declare class SwipeEvent extends CustomTypedEvent<SwipeEventArgsClass> {
|
|
1973
2806
|
constructor(type: SwipeEventType, args: SwipeEventArgsClass, eventInit?: EventInit);
|
|
1974
2807
|
}
|
|
1975
2808
|
|
|
2809
|
+
/**
|
|
2810
|
+
* Plain data shape backing {@link SwipeEventArgsClass}.
|
|
2811
|
+
*/
|
|
1976
2812
|
declare type SwipeEventArgs = {
|
|
1977
2813
|
horizontalspeed?: number;
|
|
1978
2814
|
verticalspeed?: number;
|
|
@@ -1988,10 +2824,14 @@ declare type SwipeEventArgs = {
|
|
|
1988
2824
|
vertical?: boolean;
|
|
1989
2825
|
};
|
|
1990
2826
|
|
|
2827
|
+
/**
|
|
2828
|
+
* Read-only event args dispatched with the swipe gesture lifecycle events.
|
|
2829
|
+
*/
|
|
1991
2830
|
declare class SwipeEventArgsClass {
|
|
1992
2831
|
#private;
|
|
1993
2832
|
private _builder;
|
|
1994
2833
|
private constructor();
|
|
2834
|
+
/** @readonly Gets the resolved swipe direction (`'up'`, `'down'`, `'left'` or `'right'`). */
|
|
1995
2835
|
get direction(): "down" | "left" | "right" | "up";
|
|
1996
2836
|
/** Speed in pixels/second, with sign. */
|
|
1997
2837
|
get speed(): number;
|
|
@@ -2002,24 +2842,43 @@ declare class SwipeEventArgsClass {
|
|
|
2002
2842
|
get predictedDelta(): number;
|
|
2003
2843
|
/** Seconds to reach the final predicted position. */
|
|
2004
2844
|
get predictedDuration(): number;
|
|
2845
|
+
/** @readonly Gets the element being swiped. */
|
|
2005
2846
|
get element(): HTMLElement | SVGElement;
|
|
2847
|
+
/** Builds a new {@link SwipeEventArgsClass} out of a plain {@link SwipeEventArgs} builder. */
|
|
2006
2848
|
static fromArgs(builder: SwipeEventArgs): SwipeEventArgsClass;
|
|
2007
2849
|
}
|
|
2008
2850
|
|
|
2851
|
+
/**
|
|
2852
|
+
* Enumerates the events dispatched throughout the swipe gesture lifecycle.
|
|
2853
|
+
*/
|
|
2009
2854
|
declare enum SwipeEventType {
|
|
2855
|
+
/** Dispatched when the swipe gesture ends (release). */
|
|
2010
2856
|
Swipe = "swipe",
|
|
2857
|
+
/** Dispatched while the pointer is dragging the element around. */
|
|
2011
2858
|
Pan = "pan",
|
|
2859
|
+
/** Dispatched when the swipe ends and its resolved direction is leftward. */
|
|
2012
2860
|
SwipeLeft = "swipeleft",
|
|
2861
|
+
/** Dispatched when the swipe ends and its resolved direction is rightward. */
|
|
2013
2862
|
SwipeRight = "swiperight",
|
|
2863
|
+
/** Dispatched when the swipe ends and its resolved direction is upward. */
|
|
2014
2864
|
SwipeUp = "swipeup",
|
|
2865
|
+
/** Dispatched when the swipe ends and its resolved direction is downward. */
|
|
2015
2866
|
SwipeDown = "swipedown",
|
|
2867
|
+
/** Dispatched when the snap/bounce-back animation following a swipe completes. */
|
|
2016
2868
|
SwipeAnimationEnd = "swipeanimationend",
|
|
2869
|
+
/** Dispatched when the snap/bounce-back animation following a leftward swipe completes. */
|
|
2017
2870
|
SwipeLeftAnimationEnd = "swipeleftanimationend",
|
|
2871
|
+
/** Dispatched when the snap/bounce-back animation following a rightward swipe completes. */
|
|
2018
2872
|
SwipeRightAnimationEnd = "swiperightanimationend",
|
|
2873
|
+
/** Dispatched when the snap/bounce-back animation following an upward swipe completes. */
|
|
2019
2874
|
SwipeUpAnimationEnd = "swipeupanimationend",
|
|
2875
|
+
/** Dispatched when the snap/bounce-back animation following a downward swipe completes. */
|
|
2020
2876
|
SwipeDownAnimationEnd = "swipedownanimationend"
|
|
2021
2877
|
}
|
|
2022
2878
|
|
|
2879
|
+
/**
|
|
2880
|
+
* Fine-tuning options for the {@link PacemSwipeElement} swipe/pan gesture.
|
|
2881
|
+
*/
|
|
2023
2882
|
declare type SwipeOptions = {
|
|
2024
2883
|
/** Inertia on release. */
|
|
2025
2884
|
inertia: number;
|
|
@@ -2038,64 +2897,141 @@ declare type SwipeOptions = {
|
|
|
2038
2897
|
bouncy: boolean;
|
|
2039
2898
|
};
|
|
2040
2899
|
|
|
2900
|
+
/**
|
|
2901
|
+
* Interface to be implemented in order to create a proper swipe adapter.
|
|
2902
|
+
*/
|
|
2041
2903
|
declare interface Swiper {
|
|
2042
2904
|
/** Anchoring targets. */
|
|
2043
2905
|
readonly snaps: number[];
|
|
2044
2906
|
/** Swipe direction. */
|
|
2045
2907
|
readonly direction: 'vertical' | 'horizontal';
|
|
2908
|
+
/** Registers a listener for a swipe lifecycle event. */
|
|
2046
2909
|
addEventListener(evt: SwipeEventType, listener: (evt: SwipeEvent) => void, useCapture?: boolean): void;
|
|
2910
|
+
/** Unregisters a listener previously added for a swipe lifecycle event. */
|
|
2047
2911
|
removeEventListener(evt: SwipeEventType, listener: (evt: SwipeEvent) => void, useCapture?: boolean): void;
|
|
2912
|
+
/** Dispatches a swipe lifecycle event. */
|
|
2048
2913
|
dispatchEvent(evt: SwipeEvent): boolean;
|
|
2049
2914
|
}
|
|
2050
2915
|
|
|
2916
|
+
/** Marker base class for elements that behave like `<template>` (e.g. a custom template-proxy element), so template-detection logic can treat them the same as a native `HTMLTemplateElement`. */
|
|
2051
2917
|
export declare abstract class TemplateElement extends HTMLElement {
|
|
2052
2918
|
}
|
|
2053
2919
|
|
|
2920
|
+
/**
|
|
2921
|
+
* Method decorator that throttles calls to an instance method: the first call in a window runs immediately;
|
|
2922
|
+
* further calls arriving before the window elapses are not dropped but coalesced — only the most recent
|
|
2923
|
+
* set of arguments is remembered and, once the window elapses, one trailing call runs with those arguments
|
|
2924
|
+
* (mirroring a classic "leading + trailing" throttle).
|
|
2925
|
+
*
|
|
2926
|
+
* @param msecs Throttle window in milliseconds, or `true` to use a single animation frame (`requestAnimationFrame`) as the window. Defaults to `50`.
|
|
2927
|
+
* @param keyFactory Computes the per-instance timer key from the method name and call arguments; override to scope throttling per argument instead of per method. Defaults to a single shared key per method.
|
|
2928
|
+
* @returns A method decorator to apply to the instance method to throttle.
|
|
2929
|
+
*/
|
|
2054
2930
|
export declare function Throttle(msecs?: true | number, keyFactory?: (key: String, ...args: any[]) => string): (target: any, key: string, descriptor?: PropertyDescriptor) => void;
|
|
2055
2931
|
|
|
2932
|
+
/**
|
|
2933
|
+
* Contract for a single animatable timeline entry (e.g. an {@link AnimationElement}) that a storyboard/host can start and cancel.
|
|
2934
|
+
*/
|
|
2056
2935
|
declare interface Timeline {
|
|
2936
|
+
/** Gets or sets the element whose property is animated. */
|
|
2057
2937
|
target: Element;
|
|
2938
|
+
/** Gets or sets the name of the animated property on `target`. */
|
|
2058
2939
|
property: string;
|
|
2940
|
+
/** Gets or sets the delay before the animation starts, in milliseconds. */
|
|
2059
2941
|
delay: number;
|
|
2942
|
+
/** Gets or sets the animation duration, in milliseconds. */
|
|
2060
2943
|
duration: number;
|
|
2944
|
+
/** Gets or sets the easing function applied to the animation progress. */
|
|
2061
2945
|
easing: Easing;
|
|
2946
|
+
/** Gets or sets the number of times the animation repeats. */
|
|
2062
2947
|
iterations: number;
|
|
2948
|
+
/** Gets or sets the playback direction of the animation. */
|
|
2063
2949
|
direction: PlaybackDirection;
|
|
2950
|
+
/** Starts (or restarts) the animation. */
|
|
2064
2951
|
startAnimation(): any;
|
|
2952
|
+
/** Cancels the running animation. */
|
|
2065
2953
|
cancelAnimation(): any;
|
|
2066
2954
|
}
|
|
2067
2955
|
|
|
2956
|
+
/**
|
|
2957
|
+
* `requestAnimationFrame`-driven timer that invokes a callback at (approximately) a given frame rate.
|
|
2958
|
+
* Instances are created via the static {@link Timer.run} factory rather than `new`.
|
|
2959
|
+
*/
|
|
2068
2960
|
declare class Timer {
|
|
2069
2961
|
#private;
|
|
2070
2962
|
private constructor();
|
|
2071
2963
|
private _run;
|
|
2964
|
+
/**
|
|
2965
|
+
* Creates and starts a new {@link Timer}.
|
|
2966
|
+
* @param callback Invoked on every tick with the current frame timestamp.
|
|
2967
|
+
* @param fps Target frame rate, in frames per second (default `60`).
|
|
2968
|
+
*/
|
|
2072
2969
|
static run(callback: (time?: number) => void, fps?: number): Timer;
|
|
2970
|
+
/** Stops the timer, cancelling any pending animation frame. */
|
|
2073
2971
|
stop(): void;
|
|
2074
2972
|
}
|
|
2075
2973
|
|
|
2974
|
+
/**
|
|
2975
|
+
* Method decorator that registers a static/instance method as a globally-named {@link TransformFunction},
|
|
2976
|
+
* making it callable by name from template binding expressions (e.g. `{{ ^value | myTransform }}`).
|
|
2977
|
+
* The registration is global (attached under `Utils.core`, dot-segmented by `name`), not per-instance.
|
|
2978
|
+
*
|
|
2979
|
+
* @param name Dot-separated registration path (e.g. `'strings.upper'`); segments before the last create/reuse nested namespaces under `Utils.core`. Defaults to the decorated method's own name when omitted.
|
|
2980
|
+
* @returns A method decorator to apply to the transform function.
|
|
2981
|
+
*/
|
|
2076
2982
|
declare function Transformer_2(name?: string): (target: any, key: string, descriptor?: PropertyDescriptor) => void;
|
|
2077
2983
|
export { Transformer_2 as Transformer }
|
|
2078
2984
|
|
|
2985
|
+
/** Signature of a function registered via the {@link Transformer} decorator: a named, globally reusable value-transforming function usable in template expressions. */
|
|
2079
2986
|
export declare type TransformFunction = (value?: any, ...args: any[]) => any;
|
|
2080
2987
|
|
|
2988
|
+
/**
|
|
2989
|
+
* Base class for animation elements that interpolate their `from`/`to` value via {@link TweenService}.
|
|
2990
|
+
* Concrete subclasses only need to supply {@link tweenInterpolationCallback} to map normalized progress to a value of type `T`.
|
|
2991
|
+
*/
|
|
2081
2992
|
declare abstract class TweenAnimationElement<T> extends AnimationElement {
|
|
2082
2993
|
#private;
|
|
2083
2994
|
private _tweener;
|
|
2084
2995
|
constructor(_tweener?: TweenService);
|
|
2996
|
+
/** @readonly Gets the {@link TweenService} instance driving this animation. */
|
|
2085
2997
|
protected get tweener(): TweenService;
|
|
2998
|
+
/** Gets or sets the starting value of type `T`. */
|
|
2086
2999
|
abstract from: T;
|
|
3000
|
+
/** Gets or sets the ending value of type `T`. */
|
|
2087
3001
|
abstract to: T;
|
|
3002
|
+
/** Starts (or restarts) the tween and returns a promise resolved once it completes. */
|
|
2088
3003
|
startAnimation(): Promise<void>;
|
|
3004
|
+
/** Cancels the running tween. */
|
|
2089
3005
|
cancelAnimation(): void;
|
|
3006
|
+
/**
|
|
3007
|
+
* Maps the tween's normalized time/progress to the interpolated value of type `T` to assign to `target[property]`.
|
|
3008
|
+
* @param time Normalized elapsed time, in `[0,1]`.
|
|
3009
|
+
* @param progress Eased progress (i.e. `time` run through {@link easing}).
|
|
3010
|
+
*/
|
|
2090
3011
|
protected abstract tweenInterpolationCallback(time: number, progress: number): T;
|
|
2091
3012
|
}
|
|
2092
3013
|
|
|
3014
|
+
/**
|
|
3015
|
+
* Runs `requestAnimationFrame`-driven numeric tweens between two values, invoking a callback on each frame.
|
|
3016
|
+
*/
|
|
2093
3017
|
declare class TweenService {
|
|
3018
|
+
/**
|
|
3019
|
+
* Tweens a numeric value from `from` to `to` over `duration` milliseconds, invoking `callback` on every animation frame.
|
|
3020
|
+
* @param from Starting value.
|
|
3021
|
+
* @param to Ending value.
|
|
3022
|
+
* @param duration Tween duration, in milliseconds.
|
|
3023
|
+
* @param delay Delay before the tween starts, in milliseconds (default `0`).
|
|
3024
|
+
* @param easing Easing function applied to the normalized `[0,1]` time (defaults to {@link Easings.linear}).
|
|
3025
|
+
* @param callback Invoked on every frame (and once more with `time === 1.0`) with the normalized time and the current value.
|
|
3026
|
+
* @returns A promise resolved when the tween completes.
|
|
3027
|
+
*/
|
|
2094
3028
|
run(from: number, to: number, duration: number, delay?: number, easing?: (time: number) => number, callback?: (time: number, value: number) => void): Promise<void>;
|
|
2095
3029
|
}
|
|
2096
3030
|
|
|
3031
|
+
/** Runtime value (aliasing the built-in `Function`) usable where a constructor reference is needed as a value, paired with the {@link Type} interface for typing it. */
|
|
2097
3032
|
export declare const Type: FunctionConstructor;
|
|
2098
3033
|
|
|
3034
|
+
/** A constructor reference for a class producing instances of `T`. */
|
|
2099
3035
|
export declare interface Type<T> extends Function {
|
|
2100
3036
|
new (...args: any[]): T;
|
|
2101
3037
|
}
|
|
@@ -2130,6 +3066,7 @@ export declare namespace UI {
|
|
|
2130
3066
|
}
|
|
2131
3067
|
}
|
|
2132
3068
|
|
|
3069
|
+
/** Minimal shape of a native UI event: keyboard modifiers plus pointer coordinates in all three coordinate systems. Implemented by {@link CustomUIEvent}. */
|
|
2133
3070
|
export declare interface UIEventLike extends KeyEventLike {
|
|
2134
3071
|
readonly clientX: number;
|
|
2135
3072
|
readonly clientY: number;
|
|
@@ -2139,13 +3076,26 @@ export declare interface UIEventLike extends KeyEventLike {
|
|
|
2139
3076
|
readonly screenY: number;
|
|
2140
3077
|
}
|
|
2141
3078
|
|
|
3079
|
+
/**
|
|
3080
|
+
* The framework's static utility grab-bag: general helpers plus namespaced sub-modules (`Json`, `Dates`,
|
|
3081
|
+
* `Css`, `Strings`, `Blobs`, `Images`, `Browsers`, `Cookies`, `URIs`) re-exposing (and in some cases
|
|
3082
|
+
* extending) functionality from `@pacem/pacem-foundation`. Also the home of `Utils.core`, the global
|
|
3083
|
+
* registry object used for cross-cutting framework state (e.g. registered {@link Transformer}s).
|
|
3084
|
+
*/
|
|
2142
3085
|
export declare class Utils {
|
|
3086
|
+
/** The framework's global scratch/registry object (`window[id]`, where `id` defaults to `'pacem'` and is configurable via `window.Pacem.Configuration.core`); created on first access. Used e.g. to store {@link Transformer}-registered transform functions. */
|
|
2143
3087
|
static get core(): any;
|
|
3088
|
+
/** The platform's (native or polyfilled) `customElements` registry. */
|
|
2144
3089
|
static get customElements(): any;
|
|
3090
|
+
/** Generates a unique numeric-ish id string. */
|
|
2145
3091
|
static uniqueId(): number;
|
|
3092
|
+
/** Generates a unique short code string. */
|
|
2146
3093
|
static uniqueCode(): string;
|
|
3094
|
+
/** Generates a random string of the given `length`. */
|
|
2147
3095
|
static randomString(length: number): string;
|
|
3096
|
+
/** Parses a date-like value (ISO string, `Date`, or timestamp) into a `Date`. */
|
|
2148
3097
|
static parseDate(input: string | Date | number): Date;
|
|
3098
|
+
/** Writes `input` to the system clipboard, using the async Clipboard API when available and falling back to `document.execCommand('copy')` otherwise. */
|
|
2149
3099
|
static copyToClipboard(input: string): Promise<void>;
|
|
2150
3100
|
static Json: {
|
|
2151
3101
|
stringify: typeof Json.serialize;
|
|
@@ -2166,19 +3116,30 @@ export declare class Utils {
|
|
|
2166
3116
|
addDays: typeof Dates.addDays;
|
|
2167
3117
|
daysBetween: typeof Dates.daysBetween;
|
|
2168
3118
|
};
|
|
3119
|
+
/**
|
|
3120
|
+
* Computes a CSS `filter` value that tints black/grayscale content towards the given color (via a
|
|
3121
|
+
* `brightness`/`sepia`/`hue-rotate`/`saturate`/`brightness` chain), and either applies it directly to
|
|
3122
|
+
* `element.style.filter` or returns it as a string.
|
|
3123
|
+
* @param element When provided, the filter is applied directly to this element's `style.filter` instead of being returned.
|
|
3124
|
+
* @param rgb Target color, as a CSS color string or an `[r, g, b]` tuple.
|
|
3125
|
+
*/
|
|
2169
3126
|
static colorize(element: HTMLElement, rgb: string | [number, number, number]): void;
|
|
2170
3127
|
static colorize(rgb: string | [number, number, number]): string;
|
|
3128
|
+
/** Escapes `input` for safe use as a CSS identifier/selector fragment. */
|
|
2171
3129
|
static cssEscape(input: string): string;
|
|
2172
3130
|
static Css: {
|
|
2173
3131
|
colorize: typeof Utils.colorize;
|
|
2174
3132
|
escape: typeof Utils.cssEscape;
|
|
3133
|
+
/** Reads a CSS custom property's current value off the document root (`:root`/`html`). */
|
|
2175
3134
|
getVariableValue(name: string): string;
|
|
3135
|
+
/** Sets a CSS custom property's value on the document root (`:root`/`html`). */
|
|
2176
3136
|
setVariable(name: string, value: string): void;
|
|
2177
3137
|
/**
|
|
2178
3138
|
* Naive O(n^2) implementation for an actual css class presence (definition) in the current DOM.
|
|
2179
3139
|
* @param name CSS class name
|
|
2180
3140
|
*/
|
|
2181
3141
|
isClassDefined(name: string): boolean;
|
|
3142
|
+
/** Parses an element's (or style declaration's) computed `transform: matrix(...)` CSS value into its 2D affine matrix components; identity if unset. */
|
|
2182
3143
|
deserializeTransform(element: Element | CSSStyleDeclaration): Matrix2D;
|
|
2183
3144
|
};
|
|
2184
3145
|
static leftPad: typeof Strings.leftPad;
|
|
@@ -2188,6 +3149,7 @@ export declare class Utils {
|
|
|
2188
3149
|
leftPad: typeof Strings.leftPad;
|
|
2189
3150
|
format: typeof Strings.format;
|
|
2190
3151
|
diff: typeof Strings.diff;
|
|
3152
|
+
/** Strips HTML markup from `html`, returning its plain-text content. */
|
|
2191
3153
|
stripHTML: (html: string) => string;
|
|
2192
3154
|
};
|
|
2193
3155
|
static Blobs: {
|
|
@@ -2200,10 +3162,15 @@ export declare class Utils {
|
|
|
2200
3162
|
load: typeof Imaging.loadImage;
|
|
2201
3163
|
resize: typeof Imaging.resizeImage;
|
|
2202
3164
|
};
|
|
3165
|
+
/** Loads an image from `src` and resolves with the `HTMLImageElement` once ready (or rejects on error). */
|
|
2203
3166
|
static loadImage(src: string): Promise<HTMLImageElement>;
|
|
3167
|
+
/** Converts a `Blob` to a `data:` URL string. */
|
|
2204
3168
|
static blobToDataURL(blob: Blob): Promise<string>;
|
|
3169
|
+
/** Converts a `data:` URL string back into a `Blob`. */
|
|
2205
3170
|
static dataURLToBlob(dataURL: string): Blob;
|
|
3171
|
+
/** Reads a `Blob`'s content as text, using the given `encoding` (default UTF-8). */
|
|
2206
3172
|
static blobToText(blob: Blob, encoding?: string): Promise<string>;
|
|
3173
|
+
/** Wraps `content` in a `Blob` of the given MIME `type` (default `'text/plain'`). */
|
|
2207
3174
|
static textToBlob(content: string, type?: string): Blob;
|
|
2208
3175
|
/** @deprecated Use {Utils.Images.resize}, instead.
|
|
2209
3176
|
* Resizes an image when exceeding the provided size constraints.
|
|
@@ -2220,6 +3187,7 @@ export declare class Utils {
|
|
|
2220
3187
|
* @param ctx
|
|
2221
3188
|
*/
|
|
2222
3189
|
static cropImage(url: string, width?: number, height?: number, quality?: number): PromiseLike<string>;
|
|
3190
|
+
/** Returns the list of vendor-prefixed `getUserMedia` implementations available on `navigator`, if any. */
|
|
2223
3191
|
static getUserMediaFunctions(): any[];
|
|
2224
3192
|
/**
|
|
2225
3193
|
* Crops the snapshot of a drawable element onto a provided canvas context. It gets centered in the area and cropped (`cover`-like behavior).
|
|
@@ -2238,10 +3206,22 @@ export declare class Utils {
|
|
|
2238
3206
|
* @param quality Quality ratio between 0..1
|
|
2239
3207
|
*/
|
|
2240
3208
|
static snapshotElement(el: HTMLElement | SVGElement, background?: string, type?: string, quality?: number): Promise<Blob>;
|
|
3209
|
+
/**
|
|
3210
|
+
* Triggers a client-side file download, either of an in-memory `Blob` or by fetching a `url` first
|
|
3211
|
+
* (in which case the filename is inferred, when not given, from the `Content-Disposition` response
|
|
3212
|
+
* header, falling back to `'download'`).
|
|
3213
|
+
* @param content In-memory content to download.
|
|
3214
|
+
* @param url URL to fetch and download the response body of.
|
|
3215
|
+
* @param filename Suggested file name.
|
|
3216
|
+
* @param options When downloading from a `url`: filename, MIME type override, and fetch `credentials`/`headers`.
|
|
3217
|
+
* @param mime MIME type hint used when downloading a raw `Blob`. Defaults to `'application/download'`.
|
|
3218
|
+
*/
|
|
2241
3219
|
static download(content: Blob, filename?: string, mime?: string): Promise<void>;
|
|
2242
3220
|
static download(url: string, filename?: string, mime?: string): Promise<void>;
|
|
2243
3221
|
static download(url: string, options: DownloadOptions): Promise<void>;
|
|
3222
|
+
/** Whether the document (including module scripts) has fully finished loading (`document.readyState === 'complete'`). */
|
|
2244
3223
|
static isDOMReady(): boolean;
|
|
3224
|
+
/** Registers `listener` to run once the document (and its resources, e.g. images) has fully loaded (the `window` `'load'` event). */
|
|
2245
3225
|
static onDOMReady(listener: EventListenerOrEventListenerObject): void;
|
|
2246
3226
|
/**
|
|
2247
3227
|
* Moves all the source element children to the target element and returns them as an array of nodes.
|
|
@@ -2255,25 +3235,41 @@ export declare class Utils {
|
|
|
2255
3235
|
* @param target Target element.
|
|
2256
3236
|
*/
|
|
2257
3237
|
static moveItems(nodes: Node[] | NodeList, target: Element): Node[];
|
|
3238
|
+
/** Cross-browser `Element.matches(selector)`, falling back to vendor-prefixed variants. */
|
|
2258
3239
|
static is(el: any, selector: string): boolean;
|
|
3240
|
+
/** Resolves the effective language for `el`: its own `lang` attribute, else the document's, else the browser's. */
|
|
2259
3241
|
static lang(el: HTMLElement): string;
|
|
3242
|
+
/** JSON-stringifies `obj` (via {@link Json}), or passes through `null`/`undefined` unchanged. */
|
|
2260
3243
|
static jsonSortStringify(obj: {}): string;
|
|
2261
3244
|
static Browsers: {
|
|
2262
3245
|
detect: typeof detect;
|
|
2263
3246
|
};
|
|
3247
|
+
/** Parses a `document.cookie`-style string (or `document.cookie` itself, by default) into a name/value map. */
|
|
2264
3248
|
static cookies(cookie?: string): Record<string, string>;
|
|
3249
|
+
/** Cookie helpers, preferring the native `cookieStore` API when available and falling back to `document.cookie` parsing otherwise. */
|
|
2265
3250
|
static Cookies: {
|
|
3251
|
+
/** Retrieves all cookies (or just `cookieName`, if given) as {@link CookieData} entries. */
|
|
2266
3252
|
getAll: (cookieName?: string) => Promise<CookieData[]>;
|
|
3253
|
+
/** Serializes a {@link CookieData} descriptor into a `document.cookie`-assignable string (including `domain`/`path`/`max-age`/`expires`/`Partitioned`/`SameSite`/`Secure` attributes, as provided). */
|
|
2267
3254
|
stringify: (data: CookieData) => string;
|
|
2268
3255
|
};
|
|
3256
|
+
/** Tests whether `el` is currently visible (via the `checkVisibility` API when available, falling back to a CSS-visibility/size heuristic). */
|
|
2269
3257
|
static isVisible(el: HTMLElement | SVGElement): boolean;
|
|
3258
|
+
/** Tests whether `el` has `className` set, using `classList` when available (with a regex-based fallback). */
|
|
2270
3259
|
static hasClass(el: HTMLElement | SVGElement, className: string): boolean;
|
|
3260
|
+
/** Adds one or more (space-separated) classes to `el`, using `classList` when available. */
|
|
2271
3261
|
static addClass(el: HTMLElement | SVGElement, className: string): void;
|
|
3262
|
+
/** Removes one or more (space-separated) classes from `el`, using `classList` when available. */
|
|
2272
3263
|
static removeClass(el: HTMLElement | SVGElement, className: string): void;
|
|
3264
|
+
/** Adds or removes `className` on `el` depending on `on`; see {@link addClass}/{@link removeClass}. */
|
|
2273
3265
|
static toggleClass(el: HTMLElement | SVGElement, className: string, on: boolean): void;
|
|
3266
|
+
/** Tests whether `el`'s `part` attribute (CSS Shadow Parts) contains `partName`. */
|
|
2274
3267
|
static hasPart(el: HTMLElement | SVGElement, partName: string): boolean;
|
|
3268
|
+
/** Adds one or more (space-separated) shadow-part names to `el`'s `part` attribute. */
|
|
2275
3269
|
static addPart(el: HTMLElement | SVGElement, partName: string): void;
|
|
3270
|
+
/** Removes one or more (space-separated) shadow-part names from `el`'s `part` attribute. */
|
|
2276
3271
|
static removePart(el: HTMLElement | SVGElement, partName: string): void;
|
|
3272
|
+
/** Adds or removes `partName` on `el`'s `part` attribute depending on `on`; see {@link addPart}/{@link removePart}. */
|
|
2277
3273
|
static togglePart(el: HTMLElement | SVGElement, partName: string, on: boolean): void;
|
|
2278
3274
|
/**
|
|
2279
3275
|
* Retrieve the bounding box of the provided element as of its rendered appearance on the stage (takes transformations into account).
|
|
@@ -2290,7 +3286,9 @@ export declare class Utils {
|
|
|
2290
3286
|
* @param el The element.
|
|
2291
3287
|
*/
|
|
2292
3288
|
static offsetRect(el: Element): Rect;
|
|
3289
|
+
/** Sums `offsetTop` up the `offsetParent` chain, giving `el`'s vertical position relative to the document rather than just its nearest positioned ancestor. */
|
|
2293
3290
|
static naturalOffsetTop(el: HTMLElement): number;
|
|
3291
|
+
/** Sums `offsetTop` up the `offsetParent` chain (note: mirrors {@link naturalOffsetTop}'s calculation, not `offsetLeft`), giving `el`'s horizontal position relative to the document. */
|
|
2294
3292
|
static naturalOffsetLeft(el: HTMLElement): number;
|
|
2295
3293
|
/**
|
|
2296
3294
|
* Retrieve the natural bounding box of the provided element (does not takes transformations into account).
|
|
@@ -2309,12 +3307,23 @@ export declare class Utils {
|
|
|
2309
3307
|
static naturalOffsetRect(el: HTMLElement): Rect;
|
|
2310
3308
|
static deserializeTransform(element: Element): Matrix2D;
|
|
2311
3309
|
static deserializeTransform(style: CSSStyleDeclaration): Matrix2D;
|
|
3310
|
+
/** Sets the window's vertical scroll position, keeping the current horizontal position. */
|
|
2312
3311
|
static set scrollTop(y: number);
|
|
3312
|
+
/** Sets the window's horizontal scroll position, keeping the current vertical position. */
|
|
2313
3313
|
static set scrollLeft(x: number);
|
|
3314
|
+
/**
|
|
3315
|
+
* Scrolls the window to a given position.
|
|
3316
|
+
* @param y Vertical position to scroll to (horizontal position is left unchanged), when only two arguments are supplied.
|
|
3317
|
+
* @param x Horizontal position to scroll to, when `y` is also supplied as a number.
|
|
3318
|
+
* @param smooth Whether to animate the scroll (`true`, default) or jump instantly (`false`).
|
|
3319
|
+
*/
|
|
2314
3320
|
static scrollTo(y: number, smooth?: boolean): void;
|
|
2315
3321
|
static scrollTo(x: number, y: number, smooth?: boolean): void;
|
|
3322
|
+
/** The window's current vertical scroll position, with fallbacks for older browsers. */
|
|
2316
3323
|
static get scrollTop(): number;
|
|
3324
|
+
/** The window's current horizontal scroll position, with fallbacks for older browsers. */
|
|
2317
3325
|
static get scrollLeft(): number;
|
|
3326
|
+
/** The window's current viewport size (`{ width, height }`), with fallbacks for older browsers. */
|
|
2318
3327
|
static get windowSize(): {
|
|
2319
3328
|
width: number;
|
|
2320
3329
|
height: number;
|
|
@@ -2349,9 +3358,13 @@ export declare class Utils {
|
|
|
2349
3358
|
static accelerateCallback(callback: (token: {
|
|
2350
3359
|
cancel: boolean;
|
|
2351
3360
|
}) => void, interval?: number, pace?: number, min?: number): void;
|
|
3361
|
+
/** Tests whether `obj` is "empty" (per {@link NullChecker.isEmpty}: `null`/`undefined`/`''`/an empty array or object), excluding DOM `Node`s (which are never considered empty here). */
|
|
2352
3362
|
static isEmpty(obj: any): boolean;
|
|
3363
|
+
/** Type-guarding test for `obj` being `null` or `undefined`. */
|
|
2353
3364
|
static isNull(obj: any): obj is null | undefined;
|
|
3365
|
+
/** Type-guarding test for `val` being an array. */
|
|
2354
3366
|
static isArray(val: any): val is any[];
|
|
3367
|
+
/** Tests whether `val` is `null`/`undefined` or "empty"; see {@link isNull}/{@link isEmpty}. */
|
|
2355
3368
|
static isNullOrEmpty(val: any): boolean;
|
|
2356
3369
|
/**
|
|
2357
3370
|
* It is a `valueOf()` based comparison.
|
|
@@ -2366,9 +3379,11 @@ export declare class Utils {
|
|
|
2366
3379
|
<T extends {}, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
|
|
2367
3380
|
(target: object, ...sources: any[]): any;
|
|
2368
3381
|
};
|
|
3382
|
+
/** Deep-clones `obj`; see {@link DeepCloner}. */
|
|
2369
3383
|
static clone<T>(obj: T): T;
|
|
2370
3384
|
/** Legacy alias for Promise.resolve(). */
|
|
2371
3385
|
static fromResult<T>(v: T): Promise<T>;
|
|
3386
|
+
/** Runs `task` on the next animation frame and wraps its result in a `Promise`. */
|
|
2372
3387
|
static fromResultAsync<T>(task: () => T): Promise<T>;
|
|
2373
3388
|
/**
|
|
2374
3389
|
* Creates an immutable (readonly) copy of an object while preserving the referential values (shallow immutability).
|
|
@@ -2384,16 +3399,36 @@ export declare class Utils {
|
|
|
2384
3399
|
* @param obj Input array to be frozen
|
|
2385
3400
|
*/
|
|
2386
3401
|
static readonlyCopy<T>(array: T[]): ReadonlyArray<T>;
|
|
3402
|
+
/** URL/route parsing and formatting helpers, chiefly backing the router (`{segment}`/`{segment?}` template resolution, query-string parsing, route metadata). */
|
|
2387
3403
|
static URIs: {
|
|
3404
|
+
/**
|
|
3405
|
+
* Substitutes each `{name}`/`{name?}` template segment in `url` with the matching entry of `parameters`
|
|
3406
|
+
* (URL-encoded), then strips out any remaining unmatched *optional* segments.
|
|
3407
|
+
* @param url URL/route template containing `{name}`/`{name?}` segments.
|
|
3408
|
+
* @param parameters Values to substitute, keyed by segment name.
|
|
3409
|
+
* @param removeMatchedParameters When `true`, consumed entries are deleted from `parameters`.
|
|
3410
|
+
*/
|
|
2388
3411
|
format: (url: string, parameters: {
|
|
2389
3412
|
[name: string]: string;
|
|
2390
3413
|
}, removeMatchedParameters?: boolean) => string;
|
|
3414
|
+
/**
|
|
3415
|
+
* Appends `parameters` to `url`'s query string (or hash fragment, when `hash` is `true`), URL-encoding
|
|
3416
|
+
* names and values, and correctly choosing `?`/`&` (or `#`/`&`) as the joining separator.
|
|
3417
|
+
* @param url Base URL.
|
|
3418
|
+
* @param parameters Values to append, keyed by parameter name.
|
|
3419
|
+
* @param removeNullEntries When `true`, entries whose value is `null`/`undefined` are omitted instead of appended as empty.
|
|
3420
|
+
* @param hash When `true`, appends to the URL's hash fragment instead of its query string.
|
|
3421
|
+
*/
|
|
2391
3422
|
appendQuery: (url: string, parameters: {
|
|
2392
3423
|
[name: string]: string;
|
|
2393
3424
|
}, removeNullEntries?: boolean, hash?: boolean) => string;
|
|
3425
|
+
/** Parses a query string (or a `Location`'s `.search`, defaulting to `window.location`) into a name/value map. */
|
|
2394
3426
|
parseQuery: (query?: string | Location) => Record<string, string>;
|
|
3427
|
+
/** Tests whether `url` contains at least one non-optional `{name}` template segment (as opposed to only `{name?}` ones). */
|
|
2395
3428
|
hasMandatoryTemplateSegments: (url: any) => boolean;
|
|
3429
|
+
/** Parses a route template's `{name}`/`{name?}` segments into an ordered list of {@link RouteMetadata} descriptors, consumed by {@link parseState}. */
|
|
2396
3430
|
parseRoute: (pathTemplate: string) => RouteMetadata[];
|
|
3431
|
+
/** Splits `url` into its `protocol`, `domain`, `path`, `query` (including leading `?`) and `hash` (including leading `#`) parts, or `null` if it can't be parsed. */
|
|
2397
3432
|
split: (url: string) => {
|
|
2398
3433
|
protocol?: string;
|
|
2399
3434
|
domain?: string;
|
|
@@ -2401,6 +3436,16 @@ export declare class Utils {
|
|
|
2401
3436
|
query?: string;
|
|
2402
3437
|
hash?: string;
|
|
2403
3438
|
};
|
|
3439
|
+
/**
|
|
3440
|
+
* Builds a {@link RouterState} for `url`, extracting named route segments per `metadata` (see
|
|
3441
|
+
* {@link parseRoute}) as top-level properties, alongside the standard `$path`/`$pathname`/`$querystring`/
|
|
3442
|
+
* `$query`/`$hash` keys. Throws if a non-optional route segment declared in `metadata` isn't present in `path`.
|
|
3443
|
+
* @param metadata Route segment descriptors, as produced by {@link parseRoute}.
|
|
3444
|
+
* @param url Full URL/path being navigated to.
|
|
3445
|
+
* @param path Path component override; parsed out of `url` via {@link split} when omitted.
|
|
3446
|
+
* @param query Query-string override (including leading `?`); parsed out of `url` when omitted.
|
|
3447
|
+
* @param hash Hash-fragment override (including leading `#`); parsed out of `url` when omitted.
|
|
3448
|
+
*/
|
|
2404
3449
|
parseState: (metadata: RouteMetadata[], url: string, path?: string, query?: string, hash?: string) => RouterState;
|
|
2405
3450
|
};
|
|
2406
3451
|
/**
|
|
@@ -2409,16 +3454,50 @@ export declare class Utils {
|
|
|
2409
3454
|
static getApiResult(json: any): any;
|
|
2410
3455
|
}
|
|
2411
3456
|
|
|
3457
|
+
/**
|
|
3458
|
+
* Property decorator that turns a class field into a lazily-resolved, cached reference to a descendant
|
|
3459
|
+
* element matching `selector`. Resolution happens on first read (via `shadowRoot.querySelectorAll` when
|
|
3460
|
+
* available, falling back to the element itself), and only nodes whose `INSTANCE_HOST_VAR` points back
|
|
3461
|
+
* at `this` are considered — this keeps the lookup scoped to the current element's own template output,
|
|
3462
|
+
* skipping over descendants that belong to a nested custom element's own template. The cache is reset
|
|
3463
|
+
* whenever the host element reconnects to the DOM (`connectedCallback`, see the {@link CustomElement} decorator).
|
|
3464
|
+
*
|
|
3465
|
+
* @param selector CSS selector identifying the child element to bind to.
|
|
3466
|
+
* @returns A property decorator to apply to the view-child field (read-only; no setter is defined).
|
|
3467
|
+
*/
|
|
2412
3468
|
export declare function ViewChild(selector: string): (target: any, prop: string, descriptor?: PropertyDescriptor) => void;
|
|
2413
3469
|
|
|
2414
3470
|
declare interface Wai {
|
|
2415
3471
|
readonly aria: Aria;
|
|
2416
3472
|
}
|
|
2417
3473
|
|
|
3474
|
+
/**
|
|
3475
|
+
* Property decorator that turns a plain class field (or accessor) into a Pacem "watched" property:
|
|
3476
|
+
* a property whose changes are detected (via reference/value comparison, see {@link DefaultComparer}),
|
|
3477
|
+
* optionally converted from/to its corresponding attribute string via a {@link PropertyConverter}
|
|
3478
|
+
* (see {@link PropertyConverters}), and notified through `propertyChangedCallback` plus a
|
|
3479
|
+
* {@link PropertyChangeEvent} (unless `config.emit` is `false`).
|
|
3480
|
+
*
|
|
3481
|
+
* Must be paired with the {@link CustomElement} class decorator, which is what actually reads the list
|
|
3482
|
+
* of watched properties (via `WATCH_PROPS_VAR`) to compute `observedAttributes` and wire up attribute/
|
|
3483
|
+
* property change plumbing — `@Watch` alone, on a class not decorated with `@CustomElement`, only sets
|
|
3484
|
+
* up the getter/setter and change notification, with no attribute involvement.
|
|
3485
|
+
*
|
|
3486
|
+
* Array-valued properties are additionally instrumented: their mutating methods (`push`, `pop`, `splice`,
|
|
3487
|
+
* `shift`, `unshift`, `copyWithin`) are patched so in-place mutations also trigger a change notification.
|
|
3488
|
+
*
|
|
3489
|
+
* @param config Optional behavior: `converter` (attribute↔property conversion, default `PropertyConverters.None`),
|
|
3490
|
+
* `emit` (whether to dispatch a {@link PropertyChangeEvent}, default `true`), `debounce` (delay the
|
|
3491
|
+
* change notification, either by a fixed number of milliseconds or `true` for one animation frame),
|
|
3492
|
+
* and `reflectBack` (write the property value back onto the attribute on change, default `false`).
|
|
3493
|
+
* @returns A property decorator to apply to the watched field/accessor.
|
|
3494
|
+
*/
|
|
2418
3495
|
export declare function Watch(config?: WatchConfig): (target: any, prop: string, descriptor?: PropertyDescriptor) => void;
|
|
2419
3496
|
|
|
3497
|
+
/** Key used to attach, on an element's constructor, the list of its `@Watch`-decorated (watched) property descriptors. */
|
|
2420
3498
|
export declare const WATCH_PROPS_VAR: string;
|
|
2421
3499
|
|
|
3500
|
+
/** Configuration options accepted by the {@link Watch} property decorator, controlling conversion, change notification and attribute reflection. */
|
|
2422
3501
|
export declare type WatchConfig = {
|
|
2423
3502
|
/** Whether to debounce the property change for a while or not (numeric to specify milliseconds) */
|
|
2424
3503
|
debounce?: boolean | number;
|