@pacem/pacem-core 1.0.0-bernoulli → 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 +919 -32
- package/dist/browser/pacem-core.js.map +1 -1
- package/dist/browser/pacem-core.min.js +2 -3
- package/dist/bundle/pacem-core.min.mjs +6 -6
- package/dist/bundle/pacem-core.mjs +510 -22
- 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 +55 -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 +96 -1
- package/package.json +2 -1
- package/typings/index.d.ts +1105 -20
- package/dist/browser/pacem-core.min.js.map +0 -1
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 {
|
|
@@ -142,11 +188,6 @@ export declare namespace Components {
|
|
|
142
188
|
ResizeEventArgs,
|
|
143
189
|
ResizeEvent,
|
|
144
190
|
PacemResizeElement,
|
|
145
|
-
RouterNavigatingEventName,
|
|
146
|
-
RouterNavigateEventName,
|
|
147
|
-
RouterNavigateEventArgs,
|
|
148
|
-
RouterNavigateEvent,
|
|
149
|
-
RouterNavigatingEvent,
|
|
150
191
|
PacemRouterElement,
|
|
151
192
|
ScrollEventName,
|
|
152
193
|
ScrollEventArgs,
|
|
@@ -191,6 +232,15 @@ export declare namespace Components {
|
|
|
191
232
|
}
|
|
192
233
|
}
|
|
193
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
|
+
*/
|
|
194
244
|
export declare function Concurrent(): (target: any, key: string, descriptor?: PropertyDescriptor) => void;
|
|
195
245
|
|
|
196
246
|
/** To be replaced when Cookie Store API types will be included in TypeScript. */
|
|
@@ -206,6 +256,7 @@ export declare type CookieData = {
|
|
|
206
256
|
secure?: boolean;
|
|
207
257
|
};
|
|
208
258
|
|
|
259
|
+
/** Minimal shape of the (currently non-standard) `window.cookieStore` API, used by {@link Utils.Cookies} when available. */
|
|
209
260
|
export declare type CookieStoreLike = {
|
|
210
261
|
delete(c: string | CookieData): Promise<void>;
|
|
211
262
|
get(c: string): Promise<CookieData>;
|
|
@@ -215,12 +266,39 @@ export declare type CookieStoreLike = {
|
|
|
215
266
|
removeEventListener: (type: 'change', handler: EventListener) => void;
|
|
216
267
|
};
|
|
217
268
|
|
|
269
|
+
/** Dispatched by an {@link Iterative} container whenever its `index` changes. */
|
|
218
270
|
export declare class CurrentIndexChangeEvent extends CustomTypedEvent<IndexChangeEventArgs> {
|
|
219
271
|
constructor(args: IndexChangeEventArgs);
|
|
220
272
|
}
|
|
221
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
|
+
*/
|
|
222
299
|
export declare const CustomElement: (config: CustomElementConfig) => (target: Type<any>) => void;
|
|
223
300
|
|
|
301
|
+
/** Configuration options accepted by the {@link CustomElement} class decorator. */
|
|
224
302
|
export declare type CustomElementConfig = {
|
|
225
303
|
tagName: string;
|
|
226
304
|
options?: {
|
|
@@ -234,6 +312,7 @@ export declare type CustomElementConfig = {
|
|
|
234
312
|
shadow?: boolean;
|
|
235
313
|
};
|
|
236
314
|
|
|
315
|
+
/** Minimal shape of the (native or polyfilled) `CustomElementRegistry` used by {@link Utils.customElements} to define and look up custom elements. */
|
|
237
316
|
declare interface CustomElementRegistry_2 {
|
|
238
317
|
define(name: string, type: Type<any>, options?: {
|
|
239
318
|
[key: string]: string;
|
|
@@ -243,10 +322,31 @@ declare interface CustomElementRegistry_2 {
|
|
|
243
322
|
}
|
|
244
323
|
export { CustomElementRegistry_2 as CustomElementRegistry }
|
|
245
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
|
+
*/
|
|
246
331
|
export declare class CustomElementUtils {
|
|
332
|
+
/** `true` when the platform's `customElements` registry is the Custom Elements polyfill rather than a native implementation. */
|
|
247
333
|
static get polyfilling(): boolean;
|
|
334
|
+
/** Converts a camelCase property name to its kebab-case attribute-name equivalent (e.g. `myProp` → `my-prop`). */
|
|
248
335
|
static camelToKebab(camelCased: string): string;
|
|
336
|
+
/** Converts a kebab-case attribute name to its camelCase property-name equivalent (e.g. `my-prop` → `myProp`). */
|
|
249
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
|
+
*/
|
|
250
350
|
static getWatchedProperties(target: Type<any>, includeInherited?: boolean): {
|
|
251
351
|
name: string;
|
|
252
352
|
config: WatchConfig;
|
|
@@ -255,20 +355,59 @@ export declare class CustomElementUtils {
|
|
|
255
355
|
name: string;
|
|
256
356
|
config: WatchConfig;
|
|
257
357
|
}[];
|
|
358
|
+
/** Retrieves a single `@Watch`-decorated property descriptor by name; see {@link getWatchedProperties}. */
|
|
258
359
|
static getWatchedProperty(target: HTMLElement, name: string): {
|
|
259
360
|
name: string;
|
|
260
361
|
config: WatchConfig;
|
|
261
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
|
+
*/
|
|
262
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
|
+
*/
|
|
263
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
|
+
*/
|
|
264
386
|
static import(key: string, tagName: string, attrs: {
|
|
265
387
|
[name: string]: any;
|
|
266
388
|
}, appendTo?: Node): Promise<HTMLElement>;
|
|
389
|
+
/** Theming-related helpers. */
|
|
267
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). */
|
|
268
392
|
importWebFonts(): Promise<any>;
|
|
269
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
|
+
*/
|
|
270
402
|
static setAttachedPropertyValue(target: any, name: string, value: any): void;
|
|
403
|
+
/** Removes a value previously stored via {@link setAttachedPropertyValue}. */
|
|
271
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
|
+
*/
|
|
272
411
|
static getAttachedPropertyValue(target: any, name: string, ensureValue?: any): any;
|
|
273
412
|
/**
|
|
274
413
|
* Resolves a dotted path into actual values.
|
|
@@ -289,19 +428,60 @@ export declare class CustomElementUtils {
|
|
|
289
428
|
property: string;
|
|
290
429
|
};
|
|
291
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
|
+
*/
|
|
292
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}. */
|
|
293
444
|
static get(element: Node, path: string): any;
|
|
294
445
|
/**
|
|
295
446
|
* Works for unit-test contexts.
|
|
296
447
|
* @param element
|
|
297
448
|
*/
|
|
298
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
|
+
*/
|
|
299
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
|
+
*/
|
|
300
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}. */
|
|
301
468
|
static findAncestorShell(element: Element): HTMLElement;
|
|
469
|
+
/** Finds the nearest ancestor that is an instance of `ctor`; see {@link findAncestor}. */
|
|
302
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
|
+
*/
|
|
303
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}. */
|
|
304
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
|
+
*/
|
|
305
485
|
static findAll<T extends Element>(selector?: string, filter?: (e: Element) => boolean): T[];
|
|
306
486
|
/**
|
|
307
487
|
* To be used back again when Edge will allow Comment subclassing
|
|
@@ -319,11 +499,43 @@ export declare class CustomElementUtils {
|
|
|
319
499
|
* @param upLevels
|
|
320
500
|
*/
|
|
321
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
|
+
*/
|
|
322
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
|
+
*/
|
|
323
518
|
static findHostContext(element: HTMLElement): HTMLElement;
|
|
519
|
+
/** Tests whether an attribute's raw string value has binding-expression syntax (`{{ ... }}`). */
|
|
324
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}. */
|
|
325
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
|
+
*/
|
|
326
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
|
+
*/
|
|
327
539
|
static ensureMember(o: any, name: string, attributes: PropertyDescriptor): PropertyDescriptor;
|
|
328
540
|
/**
|
|
329
541
|
* Strips all the observed attributes of an element and its descendants, in order to seal that dom branch and to avoid bindings evaluation.
|
|
@@ -337,9 +549,27 @@ export declare class CustomElementUtils {
|
|
|
337
549
|
static freezeObservedAttributes(element: Element): void;
|
|
338
550
|
}
|
|
339
551
|
|
|
552
|
+
/** Static helpers for inspecting and normalizing native/custom events (coordinates, keyboard modifiers, type checks). */
|
|
340
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
|
+
*/
|
|
341
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
|
+
*/
|
|
342
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
|
+
*/
|
|
343
573
|
static getEventKeyModifiers(evt: KeyboardEvent | MouseEvent | TouchEvent | KeyEventLike): EventKeyModifiers;
|
|
344
574
|
/**
|
|
345
575
|
* Matches the provided event against keyboard modifiers and returns 'true' if all the matches are satisfied.
|
|
@@ -348,6 +578,13 @@ export declare class CustomEventUtils {
|
|
|
348
578
|
*/
|
|
349
579
|
static matchModifiers(evt: KeyboardEvent | MouseEvent | TouchEvent | KeyEventLike, modifiers: string[]): any;
|
|
350
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
|
+
*/
|
|
351
588
|
static fixEdgeCustomEventSubClassInstance<TEvent extends Event>(evt: TEvent, type: Function): void;
|
|
352
589
|
}
|
|
353
590
|
|
|
@@ -355,10 +592,27 @@ declare class CustomItemCommandEvent extends ItemEvent<any> {
|
|
|
355
592
|
constructor(evt: CommandEvent);
|
|
356
593
|
}
|
|
357
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
|
+
*/
|
|
358
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
|
+
*/
|
|
359
606
|
constructor(type: string, detail: TDetail, eventInit?: CustomEventInit<TDetail>);
|
|
360
607
|
}
|
|
361
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
|
+
*/
|
|
362
616
|
export declare abstract class CustomUIEvent<TDetail> extends CustomEvent<TDetail> implements UIEventLike {
|
|
363
617
|
#private;
|
|
364
618
|
constructor(type: string, detail: TDetail);
|
|
@@ -381,10 +635,26 @@ export declare abstract class CustomUIEvent<TDetail> extends CustomEvent<TDetail
|
|
|
381
635
|
get screenY(): number;
|
|
382
636
|
}
|
|
383
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
|
+
*/
|
|
384
647
|
export declare function Debounce(msecs?: true | number, keyFactory?: (key: String, ...args: any[]) => string): (target: any, key: string, descriptor?: PropertyDescriptor) => void;
|
|
385
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
|
+
*/
|
|
386
655
|
export declare class DeepCloner {
|
|
387
656
|
private constructor();
|
|
657
|
+
/** Deep-clones `obj`; see {@link DeepCloner} for what gets cloned vs. passed through by reference. */
|
|
388
658
|
static clone(obj: any): any;
|
|
389
659
|
private _clone;
|
|
390
660
|
}
|
|
@@ -396,22 +666,33 @@ export declare class DeepCloner {
|
|
|
396
666
|
*/
|
|
397
667
|
export declare const DefaultComparer: PropertyComparer<any>;
|
|
398
668
|
|
|
669
|
+
/** Framework-wide default settings. */
|
|
399
670
|
export declare const Defaults: {
|
|
400
671
|
USE_SHADOW_ROOT: boolean;
|
|
401
672
|
};
|
|
402
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
|
+
*/
|
|
403
680
|
export declare class DeferPromise<T> implements PromiseLike<T> {
|
|
404
681
|
private promise;
|
|
405
682
|
private deferred;
|
|
406
683
|
constructor();
|
|
684
|
+
/** Standard `PromiseLike.then`, delegating to the underlying native `Promise`. */
|
|
407
685
|
then<TResult1 = T, TResult2 = never>(onCompleted?: ((v: T) => TResult1 | PromiseLike<TResult1>), onFailed?: (v?: any) => TResult2 | PromiseLike<TResult2>): PromiseLike<TResult1 | TResult2>;
|
|
408
686
|
/**
|
|
409
687
|
* Occurs whenever the promise concludes (either after completion or error).
|
|
410
688
|
* @param {Function } callback
|
|
411
689
|
*/
|
|
412
690
|
finally(callback: (v?: T | any) => void | PromiseLike<void>): this;
|
|
691
|
+
/** Registers a fulfillment-only callback (fluent, chainable alternative to `then(callback)`). */
|
|
413
692
|
success(callback: (v?: T) => T | PromiseLike<T>): this;
|
|
693
|
+
/** Registers a rejection-only callback (fluent, chainable alternative to `then(null, callback)`). */
|
|
414
694
|
error(callback: (v?: any) => void | PromiseLike<void>): this;
|
|
695
|
+
/** Creates a new deferred promise and returns its controller: `{ resolve, reject, promise }`. */
|
|
415
696
|
static defer<T>(): {
|
|
416
697
|
resolve: (v?: T) => void | PromiseLike<void>;
|
|
417
698
|
reject: (v?: any) => void | PromiseLike<void>;
|
|
@@ -424,6 +705,7 @@ declare enum DockMode {
|
|
|
424
705
|
Bottom = "bottom"
|
|
425
706
|
}
|
|
426
707
|
|
|
708
|
+
/** Options accepted by the URL-based overload of {@link Utils.download}. */
|
|
427
709
|
declare type DownloadOptions = {
|
|
428
710
|
filename?: string;
|
|
429
711
|
mime?: string;
|
|
@@ -442,10 +724,16 @@ declare enum DragDataMode {
|
|
|
442
724
|
Copy = "copy"
|
|
443
725
|
}
|
|
444
726
|
|
|
727
|
+
/**
|
|
728
|
+
* Custom UI event dispatched throughout the drag & drop lifecycle (see {@link DragDropEventType}).
|
|
729
|
+
*/
|
|
445
730
|
declare class DragDropEvent extends CustomUIEvent<DragDropEventArgsClass | DragDropInitEventArgsClass> {
|
|
446
731
|
constructor(type: DragDropEventType, args: DragDropEventArgsClass | DragDropInitEventArgsClass, eventInit?: EventInit, evt?: MouseEvent | TouchEvent);
|
|
447
732
|
}
|
|
448
733
|
|
|
734
|
+
/**
|
|
735
|
+
* Plain data shape backing the drag & drop event-args classes.
|
|
736
|
+
*/
|
|
449
737
|
declare type DragDropEventArgs = {
|
|
450
738
|
element: HTMLElement | SVGElement;
|
|
451
739
|
placeholder: HTMLElement | SVGElement;
|
|
@@ -458,6 +746,9 @@ declare type DragDropEventArgs = {
|
|
|
458
746
|
target?: Element;
|
|
459
747
|
};
|
|
460
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
|
+
*/
|
|
461
752
|
declare abstract class DragDropEventArgsBaseClass {
|
|
462
753
|
private _builder;
|
|
463
754
|
protected constructor(_builder: DragDropEventArgs);
|
|
@@ -473,12 +764,18 @@ declare abstract class DragDropEventArgsBaseClass {
|
|
|
473
764
|
get delta(): Point;
|
|
474
765
|
}
|
|
475
766
|
|
|
767
|
+
/**
|
|
768
|
+
* Read-only event args dispatched with the drag/drop lifecycle events other than `draginit` (start, drag, drop, over, out, end).
|
|
769
|
+
*/
|
|
476
770
|
declare class DragDropEventArgsClass extends DragDropEventArgsBaseClass {
|
|
477
771
|
private _placeholder;
|
|
478
772
|
private _data;
|
|
479
773
|
private constructor();
|
|
774
|
+
/** @readonly Gets the element used as a dragging placeholder. */
|
|
480
775
|
get placeholder(): HTMLElement | SVGElement;
|
|
776
|
+
/** @readonly Gets the logical payload being dragged. */
|
|
481
777
|
get data(): any;
|
|
778
|
+
/** Builds a new {@link DragDropEventArgsClass} out of a plain {@link DragDropEventArgs} builder. */
|
|
482
779
|
static fromArgs(builder: DragDropEventArgs): DragDropEventArgsClass;
|
|
483
780
|
}
|
|
484
781
|
|
|
@@ -499,10 +796,17 @@ declare enum DragDropEventType {
|
|
|
499
796
|
End = "dragend"
|
|
500
797
|
}
|
|
501
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
|
+
*/
|
|
502
803
|
declare class DragDropInitEventArgsClass extends DragDropEventArgsBaseClass {
|
|
503
804
|
private constructor();
|
|
805
|
+
/** Gets or sets the element to be used as a dragging placeholder. */
|
|
504
806
|
placeholder: HTMLElement | SVGElement;
|
|
807
|
+
/** Gets or sets the logical payload being dragged. */
|
|
505
808
|
data: any;
|
|
809
|
+
/** Builds a new {@link DragDropInitEventArgsClass} out of a plain {@link DragDropEventArgs} builder. */
|
|
506
810
|
static fromArgs(builder: DragDropEventArgs): DragDropInitEventArgsClass;
|
|
507
811
|
}
|
|
508
812
|
|
|
@@ -525,7 +829,9 @@ declare interface DragDropper {
|
|
|
525
829
|
* Element to be used as a dragging placeholder. If not null, will override the floater obtained via the `mode` property.
|
|
526
830
|
*/
|
|
527
831
|
floater: Element;
|
|
832
|
+
/** Gets or sets the meaning of a drop action (e.g. insert as a child, or none). */
|
|
528
833
|
dropBehavior: DropBehavior;
|
|
834
|
+
/** Gets or sets what happens when a dragged element is released outside of any valid drop target. */
|
|
529
835
|
spillBehavior: DropTargetMissedBehavior;
|
|
530
836
|
}
|
|
531
837
|
|
|
@@ -545,20 +851,32 @@ declare enum DropTargetMissedBehavior {
|
|
|
545
851
|
None = "none"
|
|
546
852
|
}
|
|
547
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
|
+
*/
|
|
548
857
|
declare type Easing = (any: any) => any & {
|
|
549
858
|
css: string;
|
|
550
859
|
};
|
|
551
860
|
|
|
861
|
+
/**
|
|
862
|
+
* Collection of ready-made {@link Easing} functions, each paired with its CSS timing-function equivalent.
|
|
863
|
+
*/
|
|
552
864
|
declare const Easings: any;
|
|
553
865
|
|
|
866
|
+
/** A pattern that can never match any string (`/a^/`); useful as a safe no-op default for optional matcher parameters. */
|
|
554
867
|
export declare const EMPTY_MATCHER: RegExp;
|
|
555
868
|
|
|
869
|
+
/** A pointer position expressed in the three coordinate systems normally exposed by mouse/touch events. */
|
|
556
870
|
export declare interface EventCoordinates {
|
|
871
|
+
/** Position relative to the whole document, including any scrolled-away area. */
|
|
557
872
|
readonly page: Point;
|
|
873
|
+
/** Position relative to the viewport. */
|
|
558
874
|
readonly client: Point;
|
|
875
|
+
/** Position relative to the physical screen. */
|
|
559
876
|
readonly screen: Point;
|
|
560
877
|
}
|
|
561
878
|
|
|
879
|
+
/** String tokens accepted by {@link CustomEventUtils.matchModifiers} to describe a keyboard/mouse modifier. */
|
|
562
880
|
export declare enum EventKeyModifier {
|
|
563
881
|
AltKey = "Alt",
|
|
564
882
|
CtrlKey = "Ctrl",
|
|
@@ -566,9 +884,20 @@ export declare enum EventKeyModifier {
|
|
|
566
884
|
MetaKey = "Cmd"
|
|
567
885
|
}
|
|
568
886
|
|
|
887
|
+
/** Snapshot of the keyboard-modifier state captured off an original native event; see {@link CustomEventUtils.getEventKeyModifiers}. */
|
|
569
888
|
export declare interface EventKeyModifiers extends KeyEventLike {
|
|
570
889
|
}
|
|
571
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
|
+
*/
|
|
572
901
|
export declare class Expression {
|
|
573
902
|
private _fnBody;
|
|
574
903
|
private _voidBody;
|
|
@@ -577,47 +906,89 @@ export declare class Expression {
|
|
|
577
906
|
private _args;
|
|
578
907
|
private _dependencies;
|
|
579
908
|
private _fn;
|
|
909
|
+
/** The resolved property dependencies (element + property + path) this expression re-evaluates on change. Empty for {@link independent} expressions. */
|
|
580
910
|
get dependencies(): PropertyDependency[];
|
|
911
|
+
/** The compiled function body used by {@link evaluate}/{@link evaluateAsync} (a `return <expr>;` statement, guarded by a try/catch). */
|
|
581
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. */
|
|
582
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
|
+
*/
|
|
583
920
|
get pending(): boolean;
|
|
921
|
+
/** `true` when the expression has no dependencies (a constant) and can be evaluated immediately, without a resolved scope. */
|
|
584
922
|
get independent(): boolean;
|
|
923
|
+
/** Evaluates the expression and returns its result, swallowing any runtime error (returning `undefined`). */
|
|
585
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). */
|
|
586
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
|
+
*/
|
|
587
933
|
evaluatePlus(args?: {
|
|
588
934
|
[key: string]: any;
|
|
589
935
|
}): any;
|
|
590
936
|
private static _pendingExpression;
|
|
591
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
|
+
*/
|
|
592
947
|
static parse(expression: string, element: HTMLElement): Expression;
|
|
593
948
|
}
|
|
594
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`. */
|
|
595
951
|
declare interface Fetcher extends NotifyPropertyChange {
|
|
952
|
+
/** Target URL of the request. */
|
|
596
953
|
url: string;
|
|
954
|
+
/** HTTP method to use. */
|
|
597
955
|
method: HttpMethod;
|
|
956
|
+
/** Query/body parameters, name/value pairs. */
|
|
598
957
|
parameters: {
|
|
599
958
|
[key: string]: string;
|
|
600
959
|
};
|
|
960
|
+
/** Extra request headers, name/value pairs. */
|
|
601
961
|
headers: {
|
|
602
962
|
[key: string]: string;
|
|
603
963
|
};
|
|
964
|
+
/** The (parsed) outcome of the last successful fetch, if any. */
|
|
604
965
|
result: any;
|
|
966
|
+
/** Issues the request. @returns A promise resolving with the raw `Response`. */
|
|
605
967
|
fetch: () => PromiseLike<GlobalResponse>;
|
|
606
968
|
}
|
|
607
969
|
|
|
970
|
+
/** Static helpers for working with fetch `Response`s. */
|
|
608
971
|
declare class Fetcher {
|
|
972
|
+
/** Tests whether a response carries no body (HTTP 204, or an explicit `Content-Length: 0`). */
|
|
609
973
|
static isEmpty(r: GlobalResponse): boolean;
|
|
610
974
|
}
|
|
611
975
|
|
|
976
|
+
/** Event name dispatched when a {@link Fetcher}'s request fails. */
|
|
612
977
|
declare const FetchErrorEventName = "error";
|
|
613
978
|
|
|
979
|
+
/** Event name dispatched with the raw fetch result payload; see {@link Fetcher.result}. */
|
|
614
980
|
declare const FetchResultEventName = "fetchresult";
|
|
615
981
|
|
|
982
|
+
/** Event name dispatched when a {@link Fetcher}'s request completes successfully. */
|
|
616
983
|
declare const FetchSuccessEventName = "success";
|
|
617
984
|
|
|
618
985
|
declare type GlobalResponse = Response;
|
|
619
986
|
|
|
620
|
-
/**
|
|
987
|
+
/**
|
|
988
|
+
* Legacy `XMLHttpRequest`-based HTTP client, superseded by the standard `fetch` API and {@link Fetcher}.
|
|
989
|
+
* Kept for backward compatibility.
|
|
990
|
+
* @deprecated
|
|
991
|
+
*/
|
|
621
992
|
declare class Http {
|
|
622
993
|
constructor();
|
|
623
994
|
/** Gets or sets the Bearer authorization token. */
|
|
@@ -646,6 +1017,7 @@ declare class Http {
|
|
|
646
1017
|
}): DeferPromise<Response_2>;
|
|
647
1018
|
}
|
|
648
1019
|
|
|
1020
|
+
/** HTTP verbs accepted by {@link Fetcher.method} / {@link Http}. */
|
|
649
1021
|
declare enum HttpMethod {
|
|
650
1022
|
Get = "GET",
|
|
651
1023
|
Post = "POST",
|
|
@@ -658,15 +1030,21 @@ declare enum HttpMethod {
|
|
|
658
1030
|
Trace = "TRACE"
|
|
659
1031
|
}
|
|
660
1032
|
|
|
1033
|
+
/** Payload carried by a {@link CurrentIndexChangeEvent}. */
|
|
661
1034
|
export declare type IndexChangeEventArgs = {
|
|
1035
|
+
/** The newly selected index. */
|
|
662
1036
|
currentIndex: number;
|
|
1037
|
+
/** The previously selected index. */
|
|
663
1038
|
previousIndex: number;
|
|
664
1039
|
};
|
|
665
1040
|
|
|
1041
|
+
/** Key used to attach, on an element instance, the list of attribute names currently holding a pending (not-yet-evaluable) binding expression. */
|
|
666
1042
|
export declare const INSTANCE_BINDINGS_VAR = "pacem:custom-element:bindings";
|
|
667
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. */
|
|
668
1045
|
export declare const INSTANCE_HOST_VAR = "pacem:custom-element:host";
|
|
669
1046
|
|
|
1047
|
+
/** Key used to attach, on an element instance, its binding-expression evaluation scope object. */
|
|
670
1048
|
export declare const INSTANCE_SCOPE_VAR = "pacem:custom-element:scope";
|
|
671
1049
|
|
|
672
1050
|
declare function isItemsContainer(object: any): object is ItemsContainer<any>;
|
|
@@ -688,9 +1066,13 @@ declare class ItemRegisterEvent<TItem extends PacemItemElement> extends CustomTy
|
|
|
688
1066
|
|
|
689
1067
|
declare const ItemRegisterEventName = "itemregister";
|
|
690
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. */
|
|
691
1070
|
export declare interface ItemsContainer<TItem> extends NotifyPropertyChange {
|
|
1071
|
+
/** The currently registered items. */
|
|
692
1072
|
items: TItem[];
|
|
1073
|
+
/** Adds `item` to the collection. @returns `true` if the item was newly registered. */
|
|
693
1074
|
register(item: TItem): boolean;
|
|
1075
|
+
/** Removes `item` from the collection. @returns `true` if the item was found and removed. */
|
|
694
1076
|
unregister(item: TItem): boolean;
|
|
695
1077
|
}
|
|
696
1078
|
|
|
@@ -700,14 +1082,30 @@ declare class ItemUnregisterEvent<TItem extends PacemItemElement> extends Custom
|
|
|
700
1082
|
|
|
701
1083
|
declare const ItemUnregisterEventName = "itemunregister";
|
|
702
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}. */
|
|
703
1086
|
export declare interface Iterative<TItem> extends ItemsContainer<TItem> {
|
|
1087
|
+
/** The currently selected/active item's position within {@link ItemsContainer.items}. */
|
|
704
1088
|
index: number;
|
|
705
1089
|
}
|
|
706
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
|
+
*/
|
|
707
1098
|
export declare class Json {
|
|
708
1099
|
private _options?;
|
|
709
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
|
+
*/
|
|
710
1107
|
static serialize(obj: any, options?: JsonSerializationOptions): string;
|
|
1108
|
+
/** Deserializes a string produced by {@link serialize}, restoring references, `RegExp`s, `Element`s and functions. */
|
|
711
1109
|
static deserialize(json: string): any;
|
|
712
1110
|
private _serialize;
|
|
713
1111
|
private _deserialize;
|
|
@@ -725,21 +1123,32 @@ export declare enum JsonFunctionConversion {
|
|
|
725
1123
|
Plain = "plain"
|
|
726
1124
|
}
|
|
727
1125
|
|
|
1126
|
+
/** Options accepted by {@link Json.serialize}. */
|
|
728
1127
|
export declare interface JsonSerializationOptions {
|
|
1128
|
+
/** How to handle function-valued properties encountered while serializing; see {@link JsonFunctionConversion}. Defaults to {@link JsonFunctionConversion.Ignore}. */
|
|
729
1129
|
functions?: JsonFunctionConversion;
|
|
730
1130
|
}
|
|
731
1131
|
|
|
732
1132
|
declare const KeyboardShortcutExecuteEventName = "execute";
|
|
733
1133
|
|
|
1134
|
+
/** Minimal shape of the keyboard-modifier flags found on keyboard/mouse/touch events. */
|
|
734
1135
|
export declare interface KeyEventLike {
|
|
735
1136
|
readonly altKey: boolean;
|
|
736
1137
|
readonly ctrlKey: boolean;
|
|
737
1138
|
readonly shiftKey: boolean;
|
|
738
1139
|
readonly metaKey: boolean;
|
|
1140
|
+
/** Key code (`KeyboardEvent.which`) or, for mouse events, the pressed button (`MouseEvent.button`). */
|
|
739
1141
|
readonly which?: number;
|
|
740
1142
|
}
|
|
741
1143
|
|
|
1144
|
+
/** Minimal logging sink interface; assigned to an element's `logger` property (see {@link PacemEventTarget.logger}) to receive its diagnostic output. */
|
|
742
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
|
+
*/
|
|
743
1152
|
log(level: LogLevel, message: string, category?: string): any;
|
|
744
1153
|
}
|
|
745
1154
|
|
|
@@ -750,12 +1159,19 @@ export declare namespace Logging {
|
|
|
750
1159
|
}
|
|
751
1160
|
}
|
|
752
1161
|
|
|
1162
|
+
/** Severity levels accepted by {@link Logger.log}, and used by {@link PacemEventTarget.log}. */
|
|
753
1163
|
declare enum LogLevel {
|
|
1164
|
+
/** Fine-grained diagnostic detail. */
|
|
754
1165
|
Trace = "trace",
|
|
1166
|
+
/** Development-time diagnostic detail. */
|
|
755
1167
|
Debug = "debug",
|
|
1168
|
+
/** Recoverable but noteworthy condition. */
|
|
756
1169
|
Warn = "warn",
|
|
1170
|
+
/** Unrecoverable or unexpected failure. */
|
|
757
1171
|
Error = "error",
|
|
1172
|
+
/** General informational message. */
|
|
758
1173
|
Info = "info",
|
|
1174
|
+
/** Generic/default-severity message. */
|
|
759
1175
|
Log = "log"
|
|
760
1176
|
}
|
|
761
1177
|
|
|
@@ -774,25 +1190,33 @@ export declare namespace Net {
|
|
|
774
1190
|
}
|
|
775
1191
|
}
|
|
776
1192
|
|
|
1193
|
+
/** Marker interface for an `EventTarget` capable of dispatching {@link PropertyChangeEvent}s (i.e. hosts one or more `@Watch`-decorated properties). */
|
|
777
1194
|
export declare interface NotifyPropertyChange extends EventTarget {
|
|
778
1195
|
}
|
|
779
1196
|
|
|
1197
|
+
/** Implemented by an element that augments a {@link Fetcher} with OAuth-flavored credentials/headers to attach to its requests. */
|
|
780
1198
|
declare interface OAuthFetchable {
|
|
1199
|
+
/** The {@link Fetcher} this OAuth configuration applies to, if resolved. */
|
|
781
1200
|
readonly fetcher?: Fetcher;
|
|
1201
|
+
/** `RequestInit.credentials` mode to use for the fetch (e.g. `'include'`). */
|
|
782
1202
|
fetchCredentials: RequestCredentials;
|
|
1203
|
+
/** Extra headers (typically an `Authorization` bearer token) to merge into the request. */
|
|
783
1204
|
fetchHeaders: {
|
|
784
1205
|
[key: string]: string;
|
|
785
1206
|
};
|
|
786
1207
|
}
|
|
787
1208
|
|
|
1209
|
+
/** Implemented by elements that need to react to the standard Custom Elements `adoptedCallback` lifecycle hook. */
|
|
788
1210
|
export declare interface OnAdopted {
|
|
789
1211
|
adoptedCallback(): void;
|
|
790
1212
|
}
|
|
791
1213
|
|
|
1214
|
+
/** Implemented by elements that need to react to the standard Custom Elements `attributeChangedCallback` lifecycle hook. */
|
|
792
1215
|
export declare interface OnAttributeChanged {
|
|
793
1216
|
attributeChangedCallback(attrName?: string, oldVal?: string, newVal?: string): void;
|
|
794
1217
|
}
|
|
795
1218
|
|
|
1219
|
+
/** Implemented by elements that need to react to the standard Custom Elements `connectedCallback` lifecycle hook. */
|
|
796
1220
|
export declare interface OnConnected {
|
|
797
1221
|
connectedCallback(): void;
|
|
798
1222
|
}
|
|
@@ -801,6 +1225,7 @@ declare interface OnDestroy {
|
|
|
801
1225
|
destroyCallback(): void;
|
|
802
1226
|
}
|
|
803
1227
|
|
|
1228
|
+
/** Implemented by elements that need to react to the standard Custom Elements `disconnectedCallback` lifecycle hook. */
|
|
804
1229
|
export declare interface OnDisconnected {
|
|
805
1230
|
disconnectedCallback(): void;
|
|
806
1231
|
}
|
|
@@ -809,10 +1234,12 @@ declare interface OnInitialize {
|
|
|
809
1234
|
initializeCallback(): void;
|
|
810
1235
|
}
|
|
811
1236
|
|
|
1237
|
+
/** Implemented by elements that need to react whenever one of their `@Watch`-decorated properties changes value. */
|
|
812
1238
|
export declare interface OnPropertyChanged {
|
|
813
1239
|
propertyChangedCallback(name?: string, oldVal?: any, newVal?: any, firstChange?: boolean): void;
|
|
814
1240
|
}
|
|
815
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. */
|
|
816
1243
|
export declare interface OnViewActivated {
|
|
817
1244
|
viewActivatedCallback(): void;
|
|
818
1245
|
}
|
|
@@ -820,6 +1247,7 @@ export declare interface OnViewActivated {
|
|
|
820
1247
|
/** the overall customelement prefix */
|
|
821
1248
|
export declare const P: any;
|
|
822
1249
|
|
|
1250
|
+
/** Base class for pluggable adapters that drive the focus/navigation behavior of a {@link PacemIterativeElement}. */
|
|
823
1251
|
declare abstract class PacemAdapter<TIterative extends Iterative<TItem>, TItem> extends PacemElement implements OnInitialize, OnDestroy {
|
|
824
1252
|
private _element;
|
|
825
1253
|
/** Gets the adapted element. */
|
|
@@ -869,6 +1297,10 @@ declare abstract class PacemAdapter<TIterative extends Iterative<TItem>, TItem>
|
|
|
869
1297
|
* @param ndx index to be checked
|
|
870
1298
|
*/
|
|
871
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
|
+
*/
|
|
872
1304
|
select(ndx: number): void;
|
|
873
1305
|
/**
|
|
874
1306
|
* Sets the new iterative's index to the closest available previous item.
|
|
@@ -884,25 +1316,44 @@ declare abstract class PacemAdapter<TIterative extends Iterative<TItem>, TItem>
|
|
|
884
1316
|
next(loop: boolean): void;
|
|
885
1317
|
}
|
|
886
1318
|
|
|
1319
|
+
/** Removes itself from the DOM as soon as it gets connected; handy to strip out placeholder markup at runtime. */
|
|
887
1320
|
declare class PacemAnnihilatorElement extends HTMLElement {
|
|
888
1321
|
constructor();
|
|
889
1322
|
connectedCallback(): void;
|
|
890
1323
|
}
|
|
891
1324
|
|
|
1325
|
+
/** Warns the user (native `beforeunload` prompt or router-driven confirm dialog) before leaving the page. */
|
|
892
1326
|
declare class PacemBeforeunloadElement extends PacemEventTarget {
|
|
1327
|
+
/** Gets or sets the confirmation message to display. */
|
|
893
1328
|
message: string;
|
|
1329
|
+
/** Gets or sets whether the warning is currently armed. */
|
|
894
1330
|
active: boolean;
|
|
895
1331
|
private _unloadingHandler;
|
|
896
1332
|
viewActivatedCallback(): void;
|
|
897
1333
|
disconnectedCallback(): void;
|
|
898
1334
|
}
|
|
899
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
|
+
*/
|
|
900
1340
|
declare abstract class PacemBehavior extends PacemEventTarget {
|
|
901
1341
|
#private;
|
|
1342
|
+
/** Hooks up the behavior-specific event listeners/markup on a newly registered element. */
|
|
902
1343
|
protected abstract decorate(element: Element): any;
|
|
1344
|
+
/** Tears down whatever {@link decorate} set up on a previously registered element. */
|
|
903
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
|
+
*/
|
|
904
1350
|
register(element: Element): void;
|
|
1351
|
+
/**
|
|
1352
|
+
* Unregisters a previously registered element, undecorating it.
|
|
1353
|
+
* @param element Element to unregister.
|
|
1354
|
+
*/
|
|
905
1355
|
unregister(element: Element): void;
|
|
1356
|
+
/** @readonly Determines whether the given element is currently registered with this behavior. */
|
|
906
1357
|
protected has(element: Element): boolean;
|
|
907
1358
|
}
|
|
908
1359
|
|
|
@@ -911,16 +1362,24 @@ declare class PacemBodyProxyElement extends PacemTransferProxyElement {
|
|
|
911
1362
|
protected get proxy(): HTMLElement;
|
|
912
1363
|
}
|
|
913
1364
|
|
|
1365
|
+
/** Wraps a {@link BroadcastChannel}, sending/receiving messages to/from other same-origin browsing contexts. */
|
|
914
1366
|
declare class PacemBroadcastChannelProxyElement extends PacemEventTarget {
|
|
915
1367
|
#private;
|
|
1368
|
+
/** Gets or sets the message to be sent through the channel. */
|
|
916
1369
|
message: any;
|
|
917
|
-
/** @readonly */
|
|
1370
|
+
/** @readonly Gets the last message received through the channel. */
|
|
918
1371
|
result: any;
|
|
1372
|
+
/** Gets or sets the name of the channel to open. */
|
|
919
1373
|
channelName: string;
|
|
1374
|
+
/** Gets or sets whether to automatically send `message` as soon as it changes (default `true`). */
|
|
920
1375
|
autosend: boolean;
|
|
921
1376
|
viewActivatedCallback(): void;
|
|
922
1377
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
923
1378
|
disconnectedCallback(): void;
|
|
1379
|
+
/**
|
|
1380
|
+
* Posts a message through the channel.
|
|
1381
|
+
* @param message Message to send; defaults to the current `message` property
|
|
1382
|
+
*/
|
|
924
1383
|
send(message?: any): void;
|
|
925
1384
|
private _messageHandler;
|
|
926
1385
|
private _errorHandler;
|
|
@@ -928,19 +1387,26 @@ declare class PacemBroadcastChannelProxyElement extends PacemEventTarget {
|
|
|
928
1387
|
private _disposeChannel;
|
|
929
1388
|
}
|
|
930
1389
|
|
|
1390
|
+
/** Detects the name and version of the current (or a provided) browser user agent. */
|
|
931
1391
|
declare class PacemBrowserDetectElement extends PacemEventTarget {
|
|
932
1392
|
#private;
|
|
933
1393
|
viewActivatedCallback(): void;
|
|
934
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`. */
|
|
935
1396
|
userAgent: string;
|
|
1397
|
+
/** @readonly Gets the detected browser name. */
|
|
936
1398
|
get browser(): string;
|
|
1399
|
+
/** @readonly Gets the detected browser version. */
|
|
937
1400
|
get version(): string;
|
|
938
1401
|
private _detect;
|
|
939
1402
|
}
|
|
940
1403
|
|
|
1404
|
+
/** Animates a CSS color `target[property]` from `from` to `to` (interpolated in HSLA space) over `duration`. */
|
|
941
1405
|
declare class PacemColorAnimationElement extends TweenAnimationElement<string> {
|
|
942
1406
|
#private;
|
|
1407
|
+
/** Gets or sets the starting color (any CSS-parsable color string). */
|
|
943
1408
|
from: string;
|
|
1409
|
+
/** Gets or sets the ending color (any CSS-parsable color string). */
|
|
944
1410
|
to: string;
|
|
945
1411
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
946
1412
|
viewActivatedCallback(): void;
|
|
@@ -949,11 +1415,14 @@ declare class PacemColorAnimationElement extends TweenAnimationElement<string> {
|
|
|
949
1415
|
private _precomputeTo;
|
|
950
1416
|
private _precomputeColor;
|
|
951
1417
|
private _parseColor;
|
|
1418
|
+
/** @inheritdoc */
|
|
952
1419
|
protected tweenInterpolationCallback(time: number, progress: number): string;
|
|
953
1420
|
}
|
|
954
1421
|
|
|
1422
|
+
/** Base class for elements whose (sanitized) inner content is driven by a `content` property, restoring the original markup on disconnect. */
|
|
955
1423
|
declare abstract class PacemContentElement extends PacemElement {
|
|
956
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. */
|
|
957
1426
|
content: string | Node;
|
|
958
1427
|
private _original;
|
|
959
1428
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -983,10 +1452,13 @@ declare abstract class PacemCrossItemsContainerElement<TItem extends PacemItemEl
|
|
|
983
1452
|
unregister(item: TItem): boolean;
|
|
984
1453
|
}
|
|
985
1454
|
|
|
1455
|
+
/** Holds an arbitrary data model, optionally persisting it to local storage and debouncing/throttling change notifications. */
|
|
986
1456
|
declare class PacemDataElement extends PacemEventTarget {
|
|
987
1457
|
private storage;
|
|
988
1458
|
constructor(storage?: Storage_2);
|
|
1459
|
+
/** Gets or sets the data model held by this element. */
|
|
989
1460
|
model: any;
|
|
1461
|
+
/** Gets or sets the storage key under which `model` is persisted. */
|
|
990
1462
|
persistAs: string;
|
|
991
1463
|
/** Debounces the model change */
|
|
992
1464
|
debounce: number;
|
|
@@ -1015,14 +1487,20 @@ declare class PacemDockElement extends PacemEventTarget {
|
|
|
1015
1487
|
}
|
|
1016
1488
|
|
|
1017
1489
|
/**
|
|
1018
|
-
* 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}.
|
|
1019
1492
|
*/
|
|
1020
1493
|
declare class PacemDragDropElement extends PacemBehavior implements DragDropper {
|
|
1021
1494
|
private _startHandler;
|
|
1495
|
+
/** Wires up the `mousedown`/`touchstart` listeners that arm the drag gesture on the given element. */
|
|
1022
1496
|
protected decorate(element: Element): void;
|
|
1497
|
+
/** Removes the listeners set up by {@link decorate}. */
|
|
1023
1498
|
protected undecorate(element: Element): void;
|
|
1499
|
+
/** Registers a listener for a {@link DragDropEventType} lifecycle event. */
|
|
1024
1500
|
addEventListener(type: DragDropEventType, listener: (evt: DragDropEvent) => void, useCapture?: boolean): void;
|
|
1501
|
+
/** Unregisters a listener previously added for a {@link DragDropEventType} lifecycle event. */
|
|
1025
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. */
|
|
1026
1504
|
dispatchEvent(evt: DragDropEvent): boolean;
|
|
1027
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". */
|
|
1028
1506
|
lockTimeout: number;
|
|
@@ -1040,6 +1518,7 @@ declare class PacemDragDropElement extends PacemBehavior implements DragDropper
|
|
|
1040
1518
|
handleSelector: string;
|
|
1041
1519
|
}
|
|
1042
1520
|
|
|
1521
|
+
/** Common base class for Pacem custom elements: adds ARIA support, CSS class/part/style bags, visibility, tab order and behaviors. */
|
|
1043
1522
|
declare class PacemElement extends PacemEventTarget implements Wai {
|
|
1044
1523
|
#private;
|
|
1045
1524
|
constructor(role?: string, aria?: {
|
|
@@ -1053,19 +1532,27 @@ declare class PacemElement extends PacemEventTarget implements Wai {
|
|
|
1053
1532
|
disconnectedCallback(): void;
|
|
1054
1533
|
private _tabIndex;
|
|
1055
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. */
|
|
1056
1536
|
cssClass: {
|
|
1057
1537
|
[key: string]: boolean;
|
|
1058
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. */
|
|
1059
1540
|
cssPart: {
|
|
1060
1541
|
[key: string]: boolean;
|
|
1061
1542
|
} | string[];
|
|
1543
|
+
/** Gets or sets inline CSS custom properties/values to apply to this element's style. */
|
|
1062
1544
|
css: {
|
|
1063
1545
|
[key: string]: string;
|
|
1064
1546
|
};
|
|
1547
|
+
/** Gets or sets whether the element is hidden (animated out, then marked `hidden` and `aria-hidden`). */
|
|
1065
1548
|
hide: boolean;
|
|
1549
|
+
/** Gets or sets the tooltip text, mapped to both `title` and `aria-label`. */
|
|
1066
1550
|
tooltip: string;
|
|
1551
|
+
/** Gets or sets the tab order; mirrors `tabIndex` while the element is enabled. */
|
|
1067
1552
|
tabOrder: number;
|
|
1553
|
+
/** Gets or sets the culture (mapped to the `lang` attribute); assigning it also refreshes data bindings. */
|
|
1068
1554
|
culture: string;
|
|
1555
|
+
/** Gets or sets the list of behaviors to attach to this element. */
|
|
1069
1556
|
behaviors: PacemBehavior[];
|
|
1070
1557
|
}
|
|
1071
1558
|
|
|
@@ -1076,9 +1563,13 @@ declare class PacemElementProxyElement extends PacemTransferProxyElement {
|
|
|
1076
1563
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1077
1564
|
}
|
|
1078
1565
|
|
|
1566
|
+
/** Listens for an arbitrary DOM event on a `target` element (or `window`) and re-dispatches it as its own `emit` event. */
|
|
1079
1567
|
declare class PacemEventProxyElement extends PacemEventTarget {
|
|
1568
|
+
/** Gets or sets the element (or `window`, via the special `"$window"` value) to listen on. */
|
|
1080
1569
|
target: HTMLElement | Window;
|
|
1570
|
+
/** Gets or sets the name of the DOM event to listen for. */
|
|
1081
1571
|
event: string;
|
|
1572
|
+
/** Gets or sets whether to listen in the capture phase. */
|
|
1082
1573
|
capture: boolean;
|
|
1083
1574
|
viewActivatedCallback(): void;
|
|
1084
1575
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -1088,6 +1579,16 @@ declare class PacemEventProxyElement extends PacemEventTarget {
|
|
|
1088
1579
|
private _emitHandler;
|
|
1089
1580
|
}
|
|
1090
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
|
+
*/
|
|
1091
1592
|
export declare abstract class PacemEventTarget extends HTMLElement implements NotifyPropertyChange, OnPropertyChanged, OnConnected, OnViewActivated, OnDisconnected {
|
|
1092
1593
|
constructor();
|
|
1093
1594
|
/**
|
|
@@ -1096,6 +1597,12 @@ export declare abstract class PacemEventTarget extends HTMLElement implements No
|
|
|
1096
1597
|
*/
|
|
1097
1598
|
protected emit(evt: Event): void;
|
|
1098
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
|
+
*/
|
|
1099
1606
|
handle(evt: Event): any;
|
|
1100
1607
|
handle(type: string, detail?: any): any;
|
|
1101
1608
|
private _isReady;
|
|
@@ -1118,7 +1625,9 @@ export declare abstract class PacemEventTarget extends HTMLElement implements No
|
|
|
1118
1625
|
*/
|
|
1119
1626
|
dispatchEvent(evt: Event): boolean;
|
|
1120
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. */
|
|
1121
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. */
|
|
1122
1631
|
logger: Logger;
|
|
1123
1632
|
/**
|
|
1124
1633
|
* Logs a message if a logger is available.
|
|
@@ -1131,28 +1640,42 @@ export declare abstract class PacemEventTarget extends HTMLElement implements No
|
|
|
1131
1640
|
protected refreshBindings(): void;
|
|
1132
1641
|
}
|
|
1133
1642
|
|
|
1643
|
+
/** Declarative wrapper around the `fetch()` API, debouncing/aborting requests as its properties change and exposing the parsed `result`. */
|
|
1134
1644
|
declare class PacemFetchElement extends PacemEventTarget implements Fetcher {
|
|
1135
1645
|
#private;
|
|
1646
|
+
/** Gets or sets the request URL, optionally templated (e.g. `/api/{id}`) against `parameters`. */
|
|
1136
1647
|
url: string;
|
|
1648
|
+
/** Gets or sets the HTTP method (default `GET`). */
|
|
1137
1649
|
method: HttpMethod;
|
|
1650
|
+
/** Gets or sets the request parameters: appended as querystring on `GET`, or serialized as body otherwise. */
|
|
1138
1651
|
parameters: {
|
|
1139
1652
|
[key: string]: string;
|
|
1140
1653
|
};
|
|
1654
|
+
/** Gets or sets additional request headers. */
|
|
1141
1655
|
headers: {
|
|
1142
1656
|
[key: string]: string;
|
|
1143
1657
|
};
|
|
1658
|
+
/** Gets or sets the request's `credentials` mode. */
|
|
1144
1659
|
credentials: 'omit' | 'same-origin' | 'include';
|
|
1660
|
+
/** Gets or sets the request's `mode`. */
|
|
1145
1661
|
mode: 'cors' | 'no-cors' | 'navigate' | 'same-origin';
|
|
1662
|
+
/** Gets or sets the request's `cache` mode. */
|
|
1146
1663
|
cache: RequestCache;
|
|
1664
|
+
/** @readonly Gets whether a request is currently in flight. */
|
|
1147
1665
|
fetching: boolean;
|
|
1148
1666
|
/** Gets or sets whether to trigger a fetch whenever a significant property has changed (default: true). */
|
|
1149
1667
|
autofetch: boolean;
|
|
1668
|
+
/** Gets or sets how to parse the response body (`object`, `text`, `blob` or `image`; default `object`). */
|
|
1150
1669
|
as: 'object' | 'text' | 'blob' | 'image';
|
|
1670
|
+
/** Gets or sets the request payload encoding (`json` or `raw`, i.e. urlencoded; default `json`). */
|
|
1151
1671
|
type: 'json' | 'raw';
|
|
1672
|
+
/** Gets or sets the debounce delay (in milliseconds) applied before auto-triggered fetches (default `100`). */
|
|
1152
1673
|
debounce: number;
|
|
1674
|
+
/** Gets or sets whether to throttle (rather than debounce) auto-triggered fetches. */
|
|
1153
1675
|
throttle: boolean;
|
|
1154
1676
|
/** Gets or sets whether to compare parameter and header single values prior to trigger a new fetch execution (default false). */
|
|
1155
1677
|
diffByValues: boolean;
|
|
1678
|
+
/** @readonly Gets the parsed result of the last successful fetch. */
|
|
1156
1679
|
result: any;
|
|
1157
1680
|
private _handle;
|
|
1158
1681
|
viewActivatedCallback(): void;
|
|
@@ -1164,37 +1687,49 @@ declare class PacemFetchElement extends PacemEventTarget implements Fetcher {
|
|
|
1164
1687
|
private _acceptFetchResult;
|
|
1165
1688
|
}
|
|
1166
1689
|
|
|
1690
|
+
/** Keeps track of an undo/redo-capable history of an arbitrary state. */
|
|
1167
1691
|
declare class PacemHistoryElement extends PacemEventTarget {
|
|
1168
1692
|
#private;
|
|
1693
|
+
/** Gets or sets the current state; assigning a new value pushes it onto the history stack. */
|
|
1169
1694
|
state: any;
|
|
1695
|
+
/** Gets or sets the maximum number of states retained in the history stack. */
|
|
1170
1696
|
maxlength: number;
|
|
1171
|
-
/** @readonly*/
|
|
1697
|
+
/** @readonly Gets whether `undo()` can currently be invoked. */
|
|
1172
1698
|
canUndo: boolean;
|
|
1173
|
-
/** @readonly*/
|
|
1699
|
+
/** @readonly Gets whether `redo()` can currently be invoked. */
|
|
1174
1700
|
canRedo: boolean;
|
|
1175
1701
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1176
1702
|
viewActivatedCallback(): void;
|
|
1177
1703
|
private _handleStateChange;
|
|
1704
|
+
/** Moves the state forward one step, if `canRedo` is `true`. */
|
|
1178
1705
|
redo(): void;
|
|
1706
|
+
/** Clears the history stack, keeping only the current state. */
|
|
1179
1707
|
reset(): void;
|
|
1708
|
+
/** Moves the state back one step, if `canUndo` is `true`. */
|
|
1180
1709
|
undo(): void;
|
|
1181
1710
|
private _synchronize;
|
|
1182
1711
|
}
|
|
1183
1712
|
|
|
1713
|
+
/** Sets (or removes) an attribute on the document's root `<html>` element. */
|
|
1184
1714
|
declare class PacemHtmlProxyElement extends PacemEventTarget {
|
|
1715
|
+
/** Gets or sets the name of the `<html>` attribute to manage. */
|
|
1185
1716
|
attr: string;
|
|
1717
|
+
/** Gets or sets the value to assign to the attribute; an empty value removes it. */
|
|
1186
1718
|
value: string;
|
|
1187
1719
|
private _html;
|
|
1188
1720
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1189
1721
|
private _update;
|
|
1190
1722
|
}
|
|
1191
1723
|
|
|
1724
|
+
/** Conditionally shows or clears its own inner content, restoring the original markup whenever `match` becomes truthy again. */
|
|
1192
1725
|
declare class PacemIfElement extends HTMLElement {
|
|
1193
1726
|
#private;
|
|
1194
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`). */
|
|
1195
1729
|
match: boolean;
|
|
1196
1730
|
}
|
|
1197
1731
|
|
|
1732
|
+
/** Base class for elements that register themselves against an ancestor {@link PacemItemsContainerElement}. */
|
|
1198
1733
|
declare abstract class PacemItemElement extends PacemElement {
|
|
1199
1734
|
private _container;
|
|
1200
1735
|
protected get container(): ItemsContainer<any>;
|
|
@@ -1204,6 +1739,7 @@ declare abstract class PacemItemElement extends PacemElement {
|
|
|
1204
1739
|
disconnectedCallback(): void;
|
|
1205
1740
|
}
|
|
1206
1741
|
|
|
1742
|
+
/** Base class for container elements holding a registry of {@link PacemItemElement} children. */
|
|
1207
1743
|
declare abstract class PacemItemsContainerElement<TItem extends PacemItemElement> extends PacemElement implements ItemsContainer<TItem> {
|
|
1208
1744
|
constructor(role?: string, aria?: {
|
|
1209
1745
|
[name: string]: string;
|
|
@@ -1223,14 +1759,18 @@ declare abstract class PacemItemsContainerElement<TItem extends PacemItemElement
|
|
|
1223
1759
|
unregister(item: TItem): boolean;
|
|
1224
1760
|
}
|
|
1225
1761
|
|
|
1762
|
+
/** Base class for items belonging to a {@link PacemIterativeElement}, forwarding their property changes to the master's `adapter`. */
|
|
1226
1763
|
declare abstract class PacemIterableElement extends PacemItemElement {
|
|
1227
1764
|
/** @overrides */
|
|
1228
1765
|
protected findContainer(): any;
|
|
1229
1766
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1230
1767
|
}
|
|
1231
1768
|
|
|
1769
|
+
/** Base class for container elements whose items are driven by a pluggable {@link PacemAdapter}, tracking a `current` `index`. */
|
|
1232
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. */
|
|
1233
1772
|
adapter: PacemAdapter<PacemIterativeElement<TItem>, TItem>;
|
|
1773
|
+
/** Gets or sets the index of the currently focused/selected item. */
|
|
1234
1774
|
index: number;
|
|
1235
1775
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1236
1776
|
viewActivatedCallback(): void;
|
|
@@ -1238,9 +1778,12 @@ declare abstract class PacemIterativeElement<TItem extends PacemIterableElement>
|
|
|
1238
1778
|
disconnectedCallback(): void;
|
|
1239
1779
|
}
|
|
1240
1780
|
|
|
1781
|
+
/** Sets (or removes) an attribute on the closest ancestor shell element, e.g. to drive layout-wide CSS state. */
|
|
1241
1782
|
declare class PacemLayoutProxyElement extends PacemEventTarget {
|
|
1242
1783
|
#private;
|
|
1784
|
+
/** Gets or sets the name of the shell attribute to manage. */
|
|
1243
1785
|
attr: string;
|
|
1786
|
+
/** Gets or sets the value to assign to the attribute; `"false"` removes it, `"true"` sets it empty. */
|
|
1244
1787
|
value: string;
|
|
1245
1788
|
connectedCallback(): void;
|
|
1246
1789
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -1248,22 +1791,32 @@ declare class PacemLayoutProxyElement extends PacemEventTarget {
|
|
|
1248
1791
|
private _update;
|
|
1249
1792
|
}
|
|
1250
1793
|
|
|
1794
|
+
/** Creates, updates or removes a `<meta>` element in the document `<head>`, keyed by either `name` or `itemprop`. */
|
|
1251
1795
|
declare class PacemMetaProxyElement extends PacemEventTarget {
|
|
1796
|
+
/** Gets or sets the `name` attribute used to look up the target `<meta>` element. */
|
|
1252
1797
|
name: string;
|
|
1798
|
+
/** Gets or sets the `itemprop` attribute used to look up the target `<meta>` element (used when `name` is not set). */
|
|
1253
1799
|
itemprop: string;
|
|
1800
|
+
/** Gets or sets the `content` attribute value; an empty value removes the element. */
|
|
1254
1801
|
content: string;
|
|
1255
1802
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1256
1803
|
viewActivatedCallback(): void;
|
|
1257
1804
|
private _update;
|
|
1258
1805
|
}
|
|
1259
1806
|
|
|
1807
|
+
/** Animates a numeric `target[property]` from `from` to `to` over `duration`. */
|
|
1260
1808
|
declare class PacemNumberAnimationElement extends TweenAnimationElement<number> {
|
|
1809
|
+
/** Gets or sets the starting value. */
|
|
1261
1810
|
from: number;
|
|
1811
|
+
/** Gets or sets the ending value. */
|
|
1262
1812
|
to: number;
|
|
1813
|
+
/** @inheritdoc */
|
|
1263
1814
|
protected tweenInterpolationCallback(time: number, progress: number): number;
|
|
1264
1815
|
}
|
|
1265
1816
|
|
|
1817
|
+
/** Tracks the browser's network connectivity (`navigator.onLine`), updating `online` on `online`/`offline` events. */
|
|
1266
1818
|
declare class PacemOnlineStatusElement extends PacemEventTarget {
|
|
1819
|
+
/** @readonly Gets whether the browser currently reports itself as online. */
|
|
1267
1820
|
online: boolean;
|
|
1268
1821
|
connectedCallback(): void;
|
|
1269
1822
|
viewActivatedCallback(): void;
|
|
@@ -1271,16 +1824,23 @@ declare class PacemOnlineStatusElement extends PacemEventTarget {
|
|
|
1271
1824
|
private _onlineHandler;
|
|
1272
1825
|
}
|
|
1273
1826
|
|
|
1827
|
+
/** Plain generic-purpose container element, useful as a databinding/behaviors host wherever a `<div>` would do. */
|
|
1274
1828
|
declare class PacemPanelElement extends PacemSafeContentElement {
|
|
1275
1829
|
}
|
|
1276
1830
|
|
|
1831
|
+
/** Animates a {@link Point} `target[property]` from `from` to `to` over `duration`. */
|
|
1277
1832
|
declare class PacemPointAnimationElement extends TweenAnimationElement<Point> {
|
|
1833
|
+
/** Gets or sets the starting point. */
|
|
1278
1834
|
from: Point;
|
|
1835
|
+
/** Gets or sets the ending point. */
|
|
1279
1836
|
to: Point;
|
|
1837
|
+
/** @inheritdoc */
|
|
1280
1838
|
protected tweenInterpolationCallback(time: number, progress: number): Point;
|
|
1281
1839
|
}
|
|
1282
1840
|
|
|
1283
1841
|
/**
|
|
1842
|
+
* Repeats its `<template>` content once per `datasource` item, keeping the rendered items in sync as the datasource changes.
|
|
1843
|
+
* @example
|
|
1284
1844
|
* <pacem-repeater datasource="[{id:'first', items:['a','b','c']}, ...]">
|
|
1285
1845
|
* <ol>
|
|
1286
1846
|
* <li>
|
|
@@ -1296,15 +1856,18 @@ declare class PacemPointAnimationElement extends TweenAnimationElement<Point> {
|
|
|
1296
1856
|
* </pacem-repeater>
|
|
1297
1857
|
*/
|
|
1298
1858
|
declare class PacemRepeaterElement extends PacemEventTarget implements Repeater {
|
|
1859
|
+
/** Gets or sets the collection of items to render, one per `<template>` instance. */
|
|
1299
1860
|
datasource: any[];
|
|
1300
1861
|
private _childItems;
|
|
1301
1862
|
private _itemTemplate;
|
|
1302
1863
|
private _childTemplatePlaceholder;
|
|
1303
1864
|
private _fragment;
|
|
1865
|
+
/** Removes the rendered item at the given index. */
|
|
1304
1866
|
removeItem(index: number): void;
|
|
1305
1867
|
private _setItem;
|
|
1306
1868
|
private _removeItems;
|
|
1307
1869
|
private _setupItem;
|
|
1870
|
+
/** Forces a full re-render of the items against the current `datasource`. */
|
|
1308
1871
|
databind(): void;
|
|
1309
1872
|
private _databind;
|
|
1310
1873
|
private _onCommand;
|
|
@@ -1315,14 +1878,26 @@ declare class PacemRepeaterElement extends PacemEventTarget implements Repeater
|
|
|
1315
1878
|
propertyChangedCallback(name: string, old: any, val: any, first: boolean): void;
|
|
1316
1879
|
}
|
|
1317
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
|
+
*/
|
|
1318
1885
|
declare class PacemRescaleElement extends PacemBehavior implements Rescaler {
|
|
1886
|
+
/** Adds the resize-handle frame (see {@link RescaleHandle}) around the given element. */
|
|
1319
1887
|
protected decorate(element: Element): void;
|
|
1888
|
+
/** Removes the resize-handle frame set up by {@link decorate}. */
|
|
1320
1889
|
protected undecorate(element: Element): void;
|
|
1890
|
+
/** Gets or sets the resize handles enabled on the registered elements. */
|
|
1321
1891
|
handles: RescaleHandle[];
|
|
1892
|
+
/** Gets or sets the minimum allowed width, in pixels. */
|
|
1322
1893
|
minWidth: number;
|
|
1894
|
+
/** Gets or sets the maximum allowed width, in pixels. */
|
|
1323
1895
|
maxWidth: number;
|
|
1896
|
+
/** Gets or sets the minimum allowed height, in pixels. */
|
|
1324
1897
|
minHeight: number;
|
|
1898
|
+
/** Gets or sets the maximum allowed height, in pixels. */
|
|
1325
1899
|
maxHeight: number;
|
|
1900
|
+
/** Gets or sets whether the width/height ratio must be preserved while resizing. */
|
|
1326
1901
|
keepProportions: boolean;
|
|
1327
1902
|
viewActivatedCallback(): void;
|
|
1328
1903
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -1333,8 +1908,11 @@ declare class PacemRescaleElement extends PacemBehavior implements Rescaler {
|
|
|
1333
1908
|
private _startHandler;
|
|
1334
1909
|
}
|
|
1335
1910
|
|
|
1911
|
+
/** Observes size (and, optionally, position) changes of itself or a `target` element, firing a `resize` event accordingly. */
|
|
1336
1912
|
declare class PacemResizeElement extends PacemEventTarget {
|
|
1913
|
+
/** Gets or sets the element to observe; defaults to this element itself. */
|
|
1337
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). */
|
|
1338
1916
|
watchPosition: boolean;
|
|
1339
1917
|
private get _target();
|
|
1340
1918
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -1350,30 +1928,56 @@ declare class PacemResizeElement extends PacemEventTarget {
|
|
|
1350
1928
|
private _checkSizeHandler;
|
|
1351
1929
|
private _assignSizeDebounced;
|
|
1352
1930
|
private _checkSize;
|
|
1931
|
+
/** @readonly Gets the last measured size (and position, if `watchPosition` is set) of the observed target. */
|
|
1353
1932
|
get currentSize(): ResizeEventArgs;
|
|
1354
1933
|
private _dispatchResize;
|
|
1355
1934
|
connectedCallback(): void;
|
|
1356
1935
|
disconnectedCallback(): void;
|
|
1357
1936
|
}
|
|
1358
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
|
+
*/
|
|
1359
1942
|
declare class PacemRotateElement extends PacemBehavior implements Rotator {
|
|
1943
|
+
/** Wires up the `mousedown`/`touchstart` listeners that arm the rotate gesture on the given element. */
|
|
1360
1944
|
protected decorate(element: Element): void;
|
|
1945
|
+
/** Removes the listeners set up by {@link decorate}. */
|
|
1361
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. */
|
|
1362
1948
|
step: number;
|
|
1949
|
+
/** Gets or sets the minimum allowed rotation, in radians. */
|
|
1363
1950
|
minRotation: number;
|
|
1951
|
+
/** Gets or sets the maximum allowed rotation, in radians. */
|
|
1364
1952
|
maxRotation: number;
|
|
1953
|
+
/** Gets or sets the pivot point the element rotates around; defaults to the element's own center. */
|
|
1365
1954
|
center: Point;
|
|
1366
1955
|
private _startHandler;
|
|
1367
1956
|
}
|
|
1368
1957
|
|
|
1958
|
+
/** Client-side router: parses/generates paths against a template and drives the browser History API. */
|
|
1369
1959
|
declare class PacemRouterElement extends PacemEventTarget {
|
|
1370
1960
|
#private;
|
|
1961
|
+
/** Gets or sets the route template, e.g. `/{controller}/{action}/{id?}`. */
|
|
1371
1962
|
template: string;
|
|
1963
|
+
/** Gets or sets the current parsed state, derived from `path` against `template`. */
|
|
1372
1964
|
state: RouterState;
|
|
1965
|
+
/** Gets or sets the current path; assigning a new value triggers a `navigate`. */
|
|
1373
1966
|
path: string;
|
|
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. */
|
|
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
|
+
*/
|
|
1374
1973
|
parseState(state?: {
|
|
1375
1974
|
[key: string]: string;
|
|
1376
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
|
+
*/
|
|
1377
1981
|
navigate(path: string, title?: string): any;
|
|
1378
1982
|
navigate(state: {
|
|
1379
1983
|
[key: string]: string;
|
|
@@ -1382,6 +1986,7 @@ declare class PacemRouterElement extends PacemEventTarget {
|
|
|
1382
1986
|
connectedCallback(): void;
|
|
1383
1987
|
viewActivatedCallback(): void;
|
|
1384
1988
|
disconnectedCallback(): void;
|
|
1989
|
+
private _onScroll;
|
|
1385
1990
|
private _onPopState;
|
|
1386
1991
|
/**
|
|
1387
1992
|
* Merged to provided state into the current one and returns the resulting path (including current querystring and hash).
|
|
@@ -1393,6 +1998,7 @@ declare class PacemRouterElement extends PacemEventTarget {
|
|
|
1393
1998
|
private _parseState;
|
|
1394
1999
|
}
|
|
1395
2000
|
|
|
2001
|
+
/** {@link PacemContentElement} variant that strips out `<script>` blocks (and, for `Node` content, `<script>` elements) before rendering `content`. */
|
|
1396
2002
|
declare class PacemSafeContentElement extends PacemContentElement {
|
|
1397
2003
|
private _sanitizeLegacy;
|
|
1398
2004
|
protected sanitize(html: string | Node): string | Node;
|
|
@@ -1411,19 +2017,30 @@ declare class PacemScrollAwareElement extends PacemEventTarget {
|
|
|
1411
2017
|
};
|
|
1412
2018
|
}
|
|
1413
2019
|
|
|
2020
|
+
/** Registers a service worker and manages its (optional) Push API subscription. */
|
|
1414
2021
|
declare class PacemServiceWorkerProxyElement extends PacemEventTarget {
|
|
1415
|
-
/** @readonly */
|
|
2022
|
+
/** @readonly Gets the active service worker registration, once available. */
|
|
1416
2023
|
registration: ServiceWorkerRegistration;
|
|
1417
|
-
/** @readonly */
|
|
2024
|
+
/** @readonly Gets the current push subscription, once available. */
|
|
1418
2025
|
pushSubscription: PushSubscription;
|
|
2026
|
+
/** Gets or sets the URL of the service worker script to register. */
|
|
1419
2027
|
src: string;
|
|
2028
|
+
/** Gets or sets the VAPID public key (base64url) used when subscribing to push notifications. */
|
|
1420
2029
|
publicKey: string;
|
|
1421
2030
|
viewActivatedCallback(): void;
|
|
1422
2031
|
disconnectedCallback(): void;
|
|
1423
2032
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1424
2033
|
private _tryUnregister;
|
|
1425
2034
|
private _tryRegister;
|
|
2035
|
+
/**
|
|
2036
|
+
* Unsubscribes from push notifications.
|
|
2037
|
+
* @param subscription Subscription to cancel; defaults to the current `pushSubscription`
|
|
2038
|
+
*/
|
|
1426
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
|
+
*/
|
|
1427
2044
|
subscribe(publicKey?: string | Uint8Array<ArrayBuffer>): Promise<PushSubscription>;
|
|
1428
2045
|
}
|
|
1429
2046
|
|
|
@@ -1432,8 +2049,11 @@ declare class PacemShellProxyElement extends PacemTransferProxyElement {
|
|
|
1432
2049
|
protected get proxy(): HTMLElement;
|
|
1433
2050
|
}
|
|
1434
2051
|
|
|
2052
|
+
/** Listens for a keyboard shortcut (optionally chorded, e.g. `"ctrl+k, s"`) on a target and fires an `execute` event when matched. */
|
|
1435
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"`). */
|
|
1436
2055
|
combination: string;
|
|
2056
|
+
/** Gets or sets the event target to listen on; defaults to `window`. */
|
|
1437
2057
|
target: EventTarget;
|
|
1438
2058
|
viewActivatedCallback(): void;
|
|
1439
2059
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -1444,33 +2064,49 @@ declare class PacemShortcutElement extends PacemEventTarget {
|
|
|
1444
2064
|
private _shortcutHandler;
|
|
1445
2065
|
}
|
|
1446
2066
|
|
|
2067
|
+
/** Sets its own `textContent` to the `text` property, escaping any markup. */
|
|
1447
2068
|
declare class PacemSpanElement extends PacemSafeContentElement {
|
|
1448
2069
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1449
2070
|
viewActivatedCallback(): void;
|
|
2071
|
+
/** Gets or sets the plain text to display as this element's content. */
|
|
1450
2072
|
text: string;
|
|
1451
2073
|
}
|
|
1452
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
|
+
*/
|
|
1453
2079
|
declare class PacemStoryboardElement extends PacemItemsContainerElement<AnimationElement> {
|
|
2080
|
+
/** @inheritdoc */
|
|
1454
2081
|
validate(item: AnimationElement): boolean;
|
|
2082
|
+
/** Gets or sets whether the storyboard starts animating automatically once its view is activated. */
|
|
1455
2083
|
autostart: boolean;
|
|
1456
2084
|
/**
|
|
1457
2085
|
* Extends or contracts the computed duration
|
|
1458
2086
|
* */
|
|
1459
2087
|
duration: number;
|
|
2088
|
+
/** Gets or sets the {@link Timeline}s to animate, as an alternative to declaring {@link AnimationElement} child items. */
|
|
1460
2089
|
datasource: Timeline[];
|
|
2090
|
+
/** @readonly Gets the effective set of {@link Timeline}s in use, resolved from either `datasource` or the child `items`. */
|
|
1461
2091
|
private _adaptedDatasource;
|
|
1462
2092
|
viewActivatedCallback(): void;
|
|
1463
2093
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1464
2094
|
private _buildDatasourceFromItems;
|
|
1465
2095
|
private _buildDatasourceFromDatasource;
|
|
1466
2096
|
private _animate;
|
|
2097
|
+
/** Cancels every running {@link Timeline} in this storyboard. */
|
|
1467
2098
|
cancelAnimation(): void;
|
|
2099
|
+
/** Starts (or restarts) every {@link Timeline} in this storyboard. */
|
|
1468
2100
|
startAnimation(): Promise<any>;
|
|
1469
2101
|
}
|
|
1470
2102
|
|
|
2103
|
+
/** Injects a `<style>` element into the document `<head>`, populated either inline (`cssText`) or by fetching `src`. */
|
|
1471
2104
|
declare class PacemStyleProxyElement extends PacemEventTarget {
|
|
2105
|
+
/** Gets or sets the URL of the CSS stylesheet to fetch and inject. */
|
|
1472
2106
|
src: string;
|
|
2107
|
+
/** Gets or sets the CSS text to inject directly (used when `src` is not set). */
|
|
1473
2108
|
cssText: string;
|
|
2109
|
+
/** @readonly Gets whether the injected stylesheet (and its web fonts, if any) has finished loading. */
|
|
1474
2110
|
cssReady: boolean;
|
|
1475
2111
|
private _style;
|
|
1476
2112
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -1480,15 +2116,23 @@ declare class PacemStyleProxyElement extends PacemEventTarget {
|
|
|
1480
2116
|
private _fetch;
|
|
1481
2117
|
}
|
|
1482
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
|
+
*/
|
|
1483
2123
|
declare class PacemSwipeElement extends PacemBehavior implements Swiper {
|
|
1484
2124
|
#private;
|
|
1485
2125
|
/** No return point distance on the horizontal axis (defaults to half the device screen width). */
|
|
1486
2126
|
snaps: number[];
|
|
2127
|
+
/** Gets or sets the axis along which registered elements can be swiped. */
|
|
1487
2128
|
direction: 'horizontal' | 'vertical';
|
|
2129
|
+
/** Gets or sets the fine-tuning options (see {@link SwipeOptions}). */
|
|
1488
2130
|
options: Partial<SwipeOptions>;
|
|
1489
2131
|
/** Handle selector to be matched when starting the drag gesture. */
|
|
1490
2132
|
handleSelector: string;
|
|
2133
|
+
/** Wires up the `pointerdown` listener that arms the swipe gesture on the given element. */
|
|
1491
2134
|
protected decorate(element: Element): void;
|
|
2135
|
+
/** Removes the listener set up by {@link decorate}. */
|
|
1492
2136
|
protected undecorate(element: Element): void;
|
|
1493
2137
|
viewActivatedCallback(): void;
|
|
1494
2138
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -1499,13 +2143,16 @@ declare class PacemSwipeElement extends PacemBehavior implements Swiper {
|
|
|
1499
2143
|
private _undoHandler;
|
|
1500
2144
|
}
|
|
1501
2145
|
|
|
2146
|
+
/** Redirects consumers (e.g. {@link PacemRepeaterElement}) to an external `<template>` element, firing a `templatechange` event when it changes. */
|
|
1502
2147
|
declare class PacemTemplateProxyElement extends /*PacemEventTarget*/ TemplateElement {
|
|
2148
|
+
/** Gets or sets the external `<template>` element this proxy points to. */
|
|
1503
2149
|
target: HTMLTemplateElement;
|
|
1504
2150
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1505
2151
|
addEventListener(type: 'templatechange', listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1506
2152
|
removeEventListener(type: 'templatechange', listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1507
2153
|
}
|
|
1508
2154
|
|
|
2155
|
+
/** Renders the `text` property as its own plain-text content, replacing any existing child markup. */
|
|
1509
2156
|
declare class PacemTextElement extends HTMLElement implements OnPropertyChanged, OnConnected {
|
|
1510
2157
|
constructor();
|
|
1511
2158
|
private _text;
|
|
@@ -1517,8 +2164,10 @@ declare class PacemTextElement extends HTMLElement implements OnPropertyChanged,
|
|
|
1517
2164
|
text: string;
|
|
1518
2165
|
}
|
|
1519
2166
|
|
|
2167
|
+
/** Fires a `tick` event on a regular interval, as long as it's enabled and `interval` is greater than zero. */
|
|
1520
2168
|
declare class PacemTimerElement extends PacemEventTarget {
|
|
1521
2169
|
constructor();
|
|
2170
|
+
/** Gets or sets the tick interval, in milliseconds. */
|
|
1522
2171
|
interval: number;
|
|
1523
2172
|
private _handle;
|
|
1524
2173
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
@@ -1527,13 +2176,16 @@ declare class PacemTimerElement extends PacemEventTarget {
|
|
|
1527
2176
|
private _restart;
|
|
1528
2177
|
}
|
|
1529
2178
|
|
|
2179
|
+
/** Sets `document.title` to `value` whenever it changes. */
|
|
1530
2180
|
declare class PacemTitleProxyElement extends PacemEventTarget {
|
|
2181
|
+
/** Gets or sets the text to assign to `document.title`. */
|
|
1531
2182
|
value: string;
|
|
1532
2183
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1533
2184
|
viewActivatedCallback(): void;
|
|
1534
2185
|
private _update;
|
|
1535
2186
|
}
|
|
1536
2187
|
|
|
2188
|
+
/** Base class for elements that move their own content to another DOM location, restoring nothing on disconnect. */
|
|
1537
2189
|
declare abstract class PacemTransferProxyElement extends PacemEventTarget {
|
|
1538
2190
|
protected abstract get proxy(): HTMLElement;
|
|
1539
2191
|
private _dom;
|
|
@@ -1544,21 +2196,31 @@ declare abstract class PacemTransferProxyElement extends PacemEventTarget {
|
|
|
1544
2196
|
disconnectedCallback(): void;
|
|
1545
2197
|
}
|
|
1546
2198
|
|
|
2199
|
+
/** Animates a numeric `value` from `from` to `to` over `duration`, dispatching animation lifecycle events along the way. */
|
|
1547
2200
|
declare class PacemTweenElement extends PacemEventTarget {
|
|
1548
2201
|
private _tweener;
|
|
1549
2202
|
constructor(_tweener?: TweenService);
|
|
2203
|
+
/** Gets or sets the easing function; defaults to a linear tween. */
|
|
1550
2204
|
easing: (time: number) => number;
|
|
2205
|
+
/** Gets or sets the starting value. */
|
|
1551
2206
|
from: number;
|
|
2207
|
+
/** Gets or sets the ending value. */
|
|
1552
2208
|
to: number;
|
|
2209
|
+
/** Gets or sets the animation duration, in milliseconds (default `1000`). */
|
|
1553
2210
|
duration: number;
|
|
2211
|
+
/** Gets or sets the delay before the animation starts, in milliseconds. */
|
|
1554
2212
|
delay: number;
|
|
2213
|
+
/** Gets or sets whether the animation is running; setting it to `true` starts (or restarts) the tween. */
|
|
1555
2214
|
start: boolean;
|
|
2215
|
+
/** @readonly Gets the current animated value. */
|
|
1556
2216
|
value: number;
|
|
1557
2217
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
2218
|
+
/** Starts the animation programmatically and returns a promise resolved once it completes. */
|
|
1558
2219
|
run(): Promise<void>;
|
|
1559
2220
|
private _animate;
|
|
1560
2221
|
}
|
|
1561
2222
|
|
|
2223
|
+
/** {@link PacemContentElement} variant that renders `content` verbatim, without any sanitization. */
|
|
1562
2224
|
declare class PacemUnsafeContentElement extends PacemContentElement {
|
|
1563
2225
|
protected sanitize(html: string): string | Node;
|
|
1564
2226
|
}
|
|
@@ -1572,15 +2234,23 @@ declare class PacemViewportAwareElement extends PacemEventTarget {
|
|
|
1572
2234
|
disconnectedCallback(): void;
|
|
1573
2235
|
}
|
|
1574
2236
|
|
|
2237
|
+
/** Wraps a {@link Worker}, sending/receiving messages to/from a web worker script. */
|
|
1575
2238
|
declare class PacemWebWorkerProxyElement extends PacemEventTarget {
|
|
2239
|
+
/** Gets or sets the message to be posted to the worker. */
|
|
1576
2240
|
message: any;
|
|
1577
|
-
/** @readonly */
|
|
2241
|
+
/** @readonly Gets the last message received from the worker. */
|
|
1578
2242
|
result: any;
|
|
2243
|
+
/** Gets or sets the URL of the worker script to instantiate. */
|
|
1579
2244
|
src: string;
|
|
2245
|
+
/** Gets or sets whether to automatically send `message` as soon as it changes (default `true`). */
|
|
1580
2246
|
autosend: boolean;
|
|
1581
2247
|
viewActivatedCallback(): void;
|
|
1582
2248
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
1583
2249
|
disconnectedCallback(): void;
|
|
2250
|
+
/**
|
|
2251
|
+
* Posts a message to the worker.
|
|
2252
|
+
* @param message Message to send; defaults to the current `message` property
|
|
2253
|
+
*/
|
|
1584
2254
|
send(message?: any): void;
|
|
1585
2255
|
private _messageHandler;
|
|
1586
2256
|
private _errorHandler;
|
|
@@ -1589,25 +2259,45 @@ declare class PacemWebWorkerProxyElement extends PacemEventTarget {
|
|
|
1589
2259
|
private _disposeWorker;
|
|
1590
2260
|
}
|
|
1591
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}. */
|
|
1592
2263
|
export declare const PCSS: any;
|
|
1593
2264
|
|
|
2265
|
+
/** Ready-to-use event listener that only calls `evt.preventDefault()`; handy as an `addEventListener` callback without allocating a closure. */
|
|
1594
2266
|
export declare const preventDefaultHandler: (evt: Event) => void;
|
|
1595
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
|
+
*/
|
|
1596
2273
|
export declare class PropertyChangeEvent extends CustomTypedEvent<PropertyChangeEventArgs> {
|
|
1597
2274
|
constructor(args: PropertyChangeEventArgs);
|
|
1598
2275
|
}
|
|
1599
2276
|
|
|
2277
|
+
/** Payload carried by a {@link PropertyChangeEvent}. */
|
|
1600
2278
|
export declare interface PropertyChangeEventArgs {
|
|
2279
|
+
/** Name of the property that changed (camelCase). */
|
|
1601
2280
|
propertyName: string;
|
|
2281
|
+
/** Property's previous value, if any. */
|
|
1602
2282
|
oldValue?: any;
|
|
2283
|
+
/** Property's new value. */
|
|
1603
2284
|
currentValue: any;
|
|
2285
|
+
/** `true` when this is the property's first observed value (element not fully initialized yet). */
|
|
1604
2286
|
firstChange?: boolean;
|
|
1605
2287
|
}
|
|
1606
2288
|
|
|
2289
|
+
/** Event name dispatched whenever a `@Watch`-decorated property changes value; see {@link PropertyChangeEvent}. */
|
|
1607
2290
|
export declare const PropertyChangeEventName: string;
|
|
1608
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). */
|
|
1609
2293
|
export declare type PropertyComparer<T> = (old: T, val: T) => boolean;
|
|
1610
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
|
+
*/
|
|
1611
2301
|
export declare interface PropertyConverter {
|
|
1612
2302
|
/** You can assume `attr` not null, cause it will be processed only in that case. */
|
|
1613
2303
|
readonly convert: (attr: string, element?: HTMLElement) => any;
|
|
@@ -1617,6 +2307,11 @@ export declare interface PropertyConverter {
|
|
|
1617
2307
|
readonly retryConversionWhenReady?: boolean;
|
|
1618
2308
|
}
|
|
1619
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
|
+
*/
|
|
1620
2315
|
export declare const PropertyConverters: {
|
|
1621
2316
|
None: PropertyConverter;
|
|
1622
2317
|
String: PropertyConverter;
|
|
@@ -1634,10 +2329,12 @@ export declare const PropertyConverters: {
|
|
|
1634
2329
|
Size: PropertyConverter;
|
|
1635
2330
|
};
|
|
1636
2331
|
|
|
2332
|
+
/** A map of binding-dependent property names to their {@link PropertyDependency} descriptor. */
|
|
1637
2333
|
export declare type PropertyDependencies = {
|
|
1638
2334
|
[name: string]: PropertyDependency;
|
|
1639
2335
|
};
|
|
1640
2336
|
|
|
2337
|
+
/** Describes a single data-binding dependency: one property of one element that a bound expression relies upon. */
|
|
1641
2338
|
export declare type PropertyDependency = {
|
|
1642
2339
|
/** Element to depend upon */
|
|
1643
2340
|
element: Node;
|
|
@@ -1650,6 +2347,7 @@ export declare type PropertyDependency = {
|
|
|
1650
2347
|
twowayAllowed: boolean;
|
|
1651
2348
|
};
|
|
1652
2349
|
|
|
2350
|
+
/** Static regular-expression helpers. */
|
|
1653
2351
|
export declare class Regex {
|
|
1654
2352
|
/**
|
|
1655
2353
|
* Splits an input string into segments based on a matching pattern.
|
|
@@ -1659,16 +2357,19 @@ export declare class Regex {
|
|
|
1659
2357
|
static split(input: string, pattern: RegExp): RegexMatchSegment[];
|
|
1660
2358
|
}
|
|
1661
2359
|
|
|
2360
|
+
/** One chunk produced by {@link Regex.split}: either a literal, non-matching substring or a matched one. */
|
|
1662
2361
|
export declare type RegexMatchSegment = {
|
|
1663
2362
|
value: string;
|
|
1664
2363
|
match: boolean;
|
|
1665
2364
|
index: number;
|
|
1666
2365
|
};
|
|
1667
2366
|
|
|
2367
|
+
/** Minimal shape of an element that repeats a template once per item of a `datasource` array (e.g. `PacemRepeaterElement`). */
|
|
1668
2368
|
export declare interface Repeater extends HTMLElement {
|
|
1669
2369
|
datasource: any[];
|
|
1670
2370
|
}
|
|
1671
2371
|
|
|
2372
|
+
/** Static lookup helpers for locating the {@link RepeaterItem} context a given element belongs to. */
|
|
1672
2373
|
export declare class Repeater {
|
|
1673
2374
|
/**
|
|
1674
2375
|
* Seeks for a PacemRepeaterItem element upwards through the DOM tree, given a starting element and the number of nesting levels.
|
|
@@ -1678,15 +2379,37 @@ export declare class Repeater {
|
|
|
1678
2379
|
static findItemContext(element: Element, upLevels?: number, logFn?: (message?: string) => void): RepeaterItem;
|
|
1679
2380
|
}
|
|
1680
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
|
+
*/
|
|
1681
2388
|
export declare abstract class RepeaterItem {
|
|
1682
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
|
+
*/
|
|
1683
2399
|
static findUpwards(element: Element, upLevels?: number, logFn?: (message?: string) => void): RepeaterItem;
|
|
2400
|
+
/** Tests whether `node` is the placeholder of some {@link RepeaterItem}. */
|
|
1684
2401
|
static isRepeaterItem(node: Node): boolean;
|
|
2402
|
+
/** Retrieves the {@link RepeaterItem} attached to `node`, if `node` is a repeater-item placeholder; see {@link isRepeaterItem}. */
|
|
1685
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. */
|
|
1686
2405
|
constructor(_placeholder: Node);
|
|
2406
|
+
/** The data item this repetition renders. */
|
|
1687
2407
|
abstract item: any;
|
|
2408
|
+
/** The 0-based position of this repetition within its {@link Repeater}'s `datasource`. */
|
|
1688
2409
|
abstract index: number;
|
|
2410
|
+
/** The {@link Repeater} element this repetition belongs to. */
|
|
1689
2411
|
abstract readonly repeater: Repeater;
|
|
2412
|
+
/** The DOM placeholder node standing in for this repetition. */
|
|
1690
2413
|
get placeholder(): Node;
|
|
1691
2414
|
}
|
|
1692
2415
|
|
|
@@ -1733,7 +2456,8 @@ declare class RepeaterItemRemoveEvent extends RepeaterItemEvent {
|
|
|
1733
2456
|
|
|
1734
2457
|
declare const RepeaterItemRemoveEventName = "repeateritemremove";
|
|
1735
2458
|
|
|
1736
|
-
/** @
|
|
2459
|
+
/** Options accepted by {@link Http.request}.
|
|
2460
|
+
* @deprecated */
|
|
1737
2461
|
declare type RequestOptions = {
|
|
1738
2462
|
data?: 'string' | {
|
|
1739
2463
|
[key: string]: string;
|
|
@@ -1745,10 +2469,16 @@ declare type RequestOptions = {
|
|
|
1745
2469
|
progress?: (pct: number) => void;
|
|
1746
2470
|
};
|
|
1747
2471
|
|
|
2472
|
+
/**
|
|
2473
|
+
* Custom UI event dispatched throughout the rescale gesture lifecycle (see {@link RescaleEventType}).
|
|
2474
|
+
*/
|
|
1748
2475
|
declare class RescaleEvent extends CustomUIEvent<RescaleEventArgsClass> {
|
|
1749
2476
|
constructor(type: RescaleEventType, args: RescaleEventArgsClass, eventInit?: EventInit, evt?: MouseEvent | TouchEvent);
|
|
1750
2477
|
}
|
|
1751
2478
|
|
|
2479
|
+
/**
|
|
2480
|
+
* Plain data shape backing {@link RescaleEventArgsClass}.
|
|
2481
|
+
*/
|
|
1752
2482
|
declare type RescaleEventArgs = {
|
|
1753
2483
|
element: HTMLElement | SVGElement;
|
|
1754
2484
|
origin: Point;
|
|
@@ -1758,39 +2488,73 @@ declare type RescaleEventArgs = {
|
|
|
1758
2488
|
targetRect?: Rect;
|
|
1759
2489
|
};
|
|
1760
2490
|
|
|
2491
|
+
/**
|
|
2492
|
+
* Read-only event args dispatched with the rescale gesture lifecycle events.
|
|
2493
|
+
*/
|
|
1761
2494
|
declare class RescaleEventArgsClass {
|
|
1762
2495
|
private _builder;
|
|
1763
2496
|
private constructor();
|
|
2497
|
+
/** @readonly Gets the current pointer position. */
|
|
1764
2498
|
get currentPosition(): Point;
|
|
2499
|
+
/** @readonly Gets the rectangle the element is being resized to. */
|
|
1765
2500
|
get targetRect(): Rect;
|
|
2501
|
+
/** @readonly Gets the element being resized. */
|
|
1766
2502
|
get element(): HTMLElement | SVGElement;
|
|
2503
|
+
/** @readonly Gets the handle being dragged (see {@link RescaleHandle}). */
|
|
1767
2504
|
get handle(): string;
|
|
2505
|
+
/** Builds a new {@link RescaleEventArgsClass} out of a plain {@link RescaleEventArgs} builder. */
|
|
1768
2506
|
static fromArgs(builder: RescaleEventArgs): RescaleEventArgsClass;
|
|
1769
2507
|
}
|
|
1770
2508
|
|
|
2509
|
+
/**
|
|
2510
|
+
* Enumerates the events dispatched throughout the rescale gesture lifecycle.
|
|
2511
|
+
*/
|
|
1771
2512
|
declare enum RescaleEventType {
|
|
2513
|
+
/** First rescaling act. */
|
|
1772
2514
|
Start = "rescalestart",
|
|
2515
|
+
/** Any rescaling act. */
|
|
1773
2516
|
Rescale = "rescale",
|
|
2517
|
+
/** Terminating the rescaling activities. */
|
|
1774
2518
|
End = "rescaleend"
|
|
1775
2519
|
}
|
|
1776
2520
|
|
|
2521
|
+
/**
|
|
2522
|
+
* Enumerates the resize handles a {@link Rescaler} can expose around a rescalable element.
|
|
2523
|
+
*/
|
|
1777
2524
|
declare enum RescaleHandle {
|
|
2525
|
+
/** All four sides/corners are enabled. */
|
|
1778
2526
|
All = "all",
|
|
2527
|
+
/** The top edge (and its corners) is enabled. */
|
|
1779
2528
|
Top = "top",
|
|
2529
|
+
/** The left edge (and its corners) is enabled. */
|
|
1780
2530
|
Left = "left",
|
|
2531
|
+
/** The right edge (and its corners) is enabled. */
|
|
1781
2532
|
Right = "right",
|
|
2533
|
+
/** The bottom edge (and its corners) is enabled. */
|
|
1782
2534
|
Bottom = "bottom"
|
|
1783
2535
|
}
|
|
1784
2536
|
|
|
2537
|
+
/**
|
|
2538
|
+
* Interface to be implemented in order to create a proper rescale adapter.
|
|
2539
|
+
*/
|
|
1785
2540
|
declare interface Rescaler {
|
|
2541
|
+
/** Gets or sets the resize handles enabled on the rescalable element(s). */
|
|
1786
2542
|
handles: RescaleHandle[];
|
|
2543
|
+
/** Gets or sets the minimum allowed width, in pixels. */
|
|
1787
2544
|
minWidth: number;
|
|
2545
|
+
/** Gets or sets the maximum allowed width, in pixels. */
|
|
1788
2546
|
maxWidth: number;
|
|
2547
|
+
/** Gets or sets the maximum allowed height, in pixels. */
|
|
1789
2548
|
maxHeight: number;
|
|
2549
|
+
/** Gets or sets the minimum allowed height, in pixels. */
|
|
1790
2550
|
minHeight: number;
|
|
2551
|
+
/** Gets or sets whether the width/height ratio must be preserved while resizing. */
|
|
1791
2552
|
keepProportions: boolean;
|
|
2553
|
+
/** Registers a listener for a rescale lifecycle event. */
|
|
1792
2554
|
addEventListener(evt: RescaleEventType, listener: (evt: RescaleEvent) => void, useCapture?: boolean): void;
|
|
2555
|
+
/** Unregisters a listener previously added for a rescale lifecycle event. */
|
|
1793
2556
|
removeEventListener(evt: RescaleEventType, listener: (evt: RescaleEvent) => void, useCapture?: boolean): void;
|
|
2557
|
+
/** Dispatches a rescale lifecycle event. */
|
|
1794
2558
|
dispatchEvent(evt: RescaleEvent): boolean;
|
|
1795
2559
|
}
|
|
1796
2560
|
|
|
@@ -1807,8 +2571,10 @@ declare type ResizeEventArgs = {
|
|
|
1807
2571
|
|
|
1808
2572
|
declare const ResizeEventName = "resize";
|
|
1809
2573
|
|
|
1810
|
-
/** @
|
|
2574
|
+
/** Wraps a completed `XMLHttpRequest` produced by {@link Http.request}, exposing its status, headers and body in convenient forms.
|
|
2575
|
+
* @deprecated */
|
|
1811
2576
|
declare class Response_2 {
|
|
2577
|
+
/** @param req The completed `XMLHttpRequest`. @param processTime Elapsed request time, in milliseconds. */
|
|
1812
2578
|
constructor(req: XMLHttpRequest, processTime: number);
|
|
1813
2579
|
private _processTime;
|
|
1814
2580
|
private _status;
|
|
@@ -1817,17 +2583,26 @@ declare class Response_2 {
|
|
|
1817
2583
|
private _type;
|
|
1818
2584
|
private _allHeadersRaw;
|
|
1819
2585
|
private _headers;
|
|
2586
|
+
/** Elapsed request time, in milliseconds. */
|
|
1820
2587
|
get processTime(): number;
|
|
2588
|
+
/** Response headers, parsed into a name/value map (lazily, on first access). */
|
|
1821
2589
|
get headers(): {
|
|
1822
2590
|
[key: string]: string;
|
|
1823
2591
|
};
|
|
2592
|
+
/** The `Content-Length` response header, parsed as a number. */
|
|
1824
2593
|
get size(): number;
|
|
2594
|
+
/** The `Content-Type` response header. */
|
|
1825
2595
|
get mime(): string;
|
|
2596
|
+
/** The `Date` response header, parsed into a `Date`. */
|
|
1826
2597
|
get date(): Date;
|
|
1827
2598
|
private _parseHeaders;
|
|
2599
|
+
/** HTTP status code. */
|
|
1828
2600
|
get status(): number;
|
|
2601
|
+
/** Raw response body as text. */
|
|
1829
2602
|
get text(): string;
|
|
2603
|
+
/** Response body, typed per `XMLHttpRequest.responseType` (see {@link type}). */
|
|
1830
2604
|
get content(): any;
|
|
2605
|
+
/** The `XMLHttpRequest.responseType` used for this request. */
|
|
1831
2606
|
get type(): string;
|
|
1832
2607
|
/**
|
|
1833
2608
|
* Short-hand utility for getting or parsing json content (if any).
|
|
@@ -1835,10 +2610,16 @@ declare class Response_2 {
|
|
|
1835
2610
|
get json(): any;
|
|
1836
2611
|
}
|
|
1837
2612
|
|
|
2613
|
+
/**
|
|
2614
|
+
* Custom UI event dispatched throughout the rotate gesture lifecycle (see {@link RotateEventType}).
|
|
2615
|
+
*/
|
|
1838
2616
|
declare class RotateEvent extends CustomUIEvent<RotateEventArgsClass> {
|
|
1839
2617
|
constructor(type: RotateEventType, args: RotateEventArgsClass, eventInit?: EventInit, evt?: MouseEvent | TouchEvent);
|
|
1840
2618
|
}
|
|
1841
2619
|
|
|
2620
|
+
/**
|
|
2621
|
+
* Plain data shape backing {@link RotateEventArgsClass}.
|
|
2622
|
+
*/
|
|
1842
2623
|
declare type RotateEventArgs = {
|
|
1843
2624
|
element: HTMLElement | SVGElement;
|
|
1844
2625
|
origin: Point;
|
|
@@ -1851,23 +2632,41 @@ declare type RotateEventArgs = {
|
|
|
1851
2632
|
rotation: number;
|
|
1852
2633
|
};
|
|
1853
2634
|
|
|
2635
|
+
/**
|
|
2636
|
+
* Read-only event args dispatched with the rotate gesture lifecycle events.
|
|
2637
|
+
*/
|
|
1854
2638
|
declare class RotateEventArgsClass {
|
|
1855
2639
|
private _builder;
|
|
1856
2640
|
private constructor();
|
|
2641
|
+
/** @readonly Gets the current pointer position. */
|
|
1857
2642
|
get currentPosition(): Point;
|
|
2643
|
+
/** @readonly Gets the current rotation, in radians. */
|
|
1858
2644
|
get rotation(): number;
|
|
2645
|
+
/** @readonly Gets the element being rotated. */
|
|
1859
2646
|
get element(): HTMLElement | SVGElement;
|
|
2647
|
+
/** @readonly Gets the pivot point the element is rotating around. */
|
|
1860
2648
|
get center(): Point;
|
|
2649
|
+
/** Builds a new {@link RotateEventArgsClass} out of a plain {@link RotateEventArgs} builder. */
|
|
1861
2650
|
static fromArgs(builder: RotateEventArgs): RotateEventArgsClass;
|
|
1862
2651
|
}
|
|
1863
2652
|
|
|
2653
|
+
/**
|
|
2654
|
+
* Enumerates the events dispatched throughout the rotate gesture lifecycle.
|
|
2655
|
+
*/
|
|
1864
2656
|
declare enum RotateEventType {
|
|
2657
|
+
/** First rotating act. */
|
|
1865
2658
|
Start = "rotatestart",
|
|
2659
|
+
/** Any rotating act. */
|
|
1866
2660
|
Rotate = "rotate",
|
|
2661
|
+
/** Terminating the rotating activities. */
|
|
1867
2662
|
End = "rotateend"
|
|
1868
2663
|
}
|
|
1869
2664
|
|
|
2665
|
+
/**
|
|
2666
|
+
* Interface to be implemented in order to create a proper rotate adapter.
|
|
2667
|
+
*/
|
|
1870
2668
|
declare interface Rotator {
|
|
2669
|
+
/** Gets or sets the pivot point the element rotates around; defaults to the element's own center. */
|
|
1871
2670
|
center?: Point;
|
|
1872
2671
|
/** Gets or sets the minimum allowed rotation in radians */
|
|
1873
2672
|
minRotation?: number;
|
|
@@ -1875,35 +2674,47 @@ declare interface Rotator {
|
|
|
1875
2674
|
maxRotation?: number;
|
|
1876
2675
|
/** Gets or sets the step constrained amount in radians */
|
|
1877
2676
|
step?: number;
|
|
2677
|
+
/** Registers a listener for a rotate lifecycle event. */
|
|
1878
2678
|
addEventListener(evt: RotateEventType, listener: (evt: RotateEvent) => void, useCapture?: boolean): void;
|
|
2679
|
+
/** Unregisters a listener previously added for a rotate lifecycle event. */
|
|
1879
2680
|
removeEventListener(evt: RotateEventType, listener: (evt: RotateEvent) => void, useCapture?: boolean): void;
|
|
2681
|
+
/** Dispatches a rotate lifecycle event. */
|
|
1880
2682
|
dispatchEvent(evt: RotateEvent): boolean;
|
|
1881
2683
|
}
|
|
1882
2684
|
|
|
2685
|
+
/** Metadata describing one named `{segment}` of a route template, as parsed by `Utils.URIs.parseRoute`. */
|
|
1883
2686
|
declare type RouteMetadata = {
|
|
1884
2687
|
name: string;
|
|
1885
2688
|
optional: boolean;
|
|
1886
2689
|
index: number;
|
|
1887
2690
|
};
|
|
1888
2691
|
|
|
1889
|
-
|
|
2692
|
+
/** Dispatched by a router once it has navigated to a new `path` (not cancelable — the navigation already happened). */
|
|
2693
|
+
export declare class RouterNavigateEvent extends CustomTypedEvent<RouterNavigateEventArgs> {
|
|
2694
|
+
/** @param path Either the destination path alone, or the full navigation args (path, title, referrer). */
|
|
1890
2695
|
constructor(path: string | RouterNavigateEventArgs);
|
|
1891
2696
|
}
|
|
1892
2697
|
|
|
1893
|
-
|
|
2698
|
+
/** Payload carried by a {@link RouterNavigateEvent}. */
|
|
2699
|
+
export declare type RouterNavigateEventArgs = {
|
|
1894
2700
|
path: string;
|
|
1895
2701
|
title?: string;
|
|
1896
2702
|
referrer?: string;
|
|
1897
2703
|
};
|
|
1898
2704
|
|
|
1899
|
-
|
|
2705
|
+
/** Event name dispatched by a router *after* a navigation has been committed; see {@link RouterNavigateEvent}. */
|
|
2706
|
+
export declare const RouterNavigateEventName = "navigate";
|
|
1900
2707
|
|
|
1901
|
-
|
|
2708
|
+
/** Dispatched by a router right before navigating to `path`; cancelable, so a listener can call `preventDefault()` to abort the navigation. */
|
|
2709
|
+
export declare class RouterNavigatingEvent extends CustomTypedEvent<string> {
|
|
2710
|
+
/** @param path Destination path about to be navigated to. */
|
|
1902
2711
|
constructor(path: string);
|
|
1903
2712
|
}
|
|
1904
2713
|
|
|
1905
|
-
|
|
2714
|
+
/** Event name dispatched by a router *before* a navigation is committed; see {@link RouterNavigatingEvent}. Cancelable: calling `preventDefault()` aborts the navigation. */
|
|
2715
|
+
export declare const RouterNavigatingEventName = "navigating";
|
|
1906
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. */
|
|
1907
2718
|
export declare type RouterState = {
|
|
1908
2719
|
[key: string]: string;
|
|
1909
2720
|
} & {
|
|
@@ -1914,6 +2725,7 @@ export declare type RouterState = {
|
|
|
1914
2725
|
[key: string]: string;
|
|
1915
2726
|
};
|
|
1916
2727
|
$hash?: string;
|
|
2728
|
+
$scrollY?: number;
|
|
1917
2729
|
};
|
|
1918
2730
|
|
|
1919
2731
|
declare class ScrollEvent extends CustomTypedEvent<ScrollEventArgs> {
|
|
@@ -1939,14 +2751,24 @@ declare interface StateEventArgs<T> {
|
|
|
1939
2751
|
|
|
1940
2752
|
declare type StateEventType = 'push' | 'undo' | 'reset' | 'redo';
|
|
1941
2753
|
|
|
2754
|
+
/** Error thrown by {@link Http.request} when a request fails outright or completes with a non-2xx status. */
|
|
1942
2755
|
declare class StatusCodeError extends Error {
|
|
1943
2756
|
private statusCode;
|
|
2757
|
+
/** @param statusCode HTTP status code (`500` for network-level failures). @param statusText Status text / error message. */
|
|
1944
2758
|
constructor(statusCode: number, statusText: string);
|
|
2759
|
+
/** The HTTP status code that caused this error. */
|
|
1945
2760
|
get status(): number;
|
|
1946
2761
|
}
|
|
1947
2762
|
|
|
2763
|
+
/** Ready-to-use event listener that only calls `evt.stopPropagation()`; handy as an `addEventListener` callback without allocating a closure. */
|
|
1948
2764
|
export declare const stopPropagationHandler: (evt: Event) => void;
|
|
1949
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
|
+
*/
|
|
1950
2772
|
declare class Storage_2 {
|
|
1951
2773
|
private _getStorage;
|
|
1952
2774
|
private _parseValue;
|
|
@@ -1964,16 +2786,29 @@ declare class Storage_2 {
|
|
|
1964
2786
|
* @param duration Storage timeout in seconds
|
|
1965
2787
|
*/
|
|
1966
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
|
+
*/
|
|
1967
2794
|
getPropertyValue(name: string): any;
|
|
2795
|
+
/** Clears both session and local storage entirely. */
|
|
1968
2796
|
clear(): void;
|
|
2797
|
+
/** Removes a single entry by `name` from both session and local storage. */
|
|
1969
2798
|
removeProperty(name: string): void;
|
|
1970
2799
|
}
|
|
1971
2800
|
export { Storage_2 as Storage }
|
|
1972
2801
|
|
|
2802
|
+
/**
|
|
2803
|
+
* Custom typed event dispatched throughout the swipe gesture lifecycle (see {@link SwipeEventType}).
|
|
2804
|
+
*/
|
|
1973
2805
|
declare class SwipeEvent extends CustomTypedEvent<SwipeEventArgsClass> {
|
|
1974
2806
|
constructor(type: SwipeEventType, args: SwipeEventArgsClass, eventInit?: EventInit);
|
|
1975
2807
|
}
|
|
1976
2808
|
|
|
2809
|
+
/**
|
|
2810
|
+
* Plain data shape backing {@link SwipeEventArgsClass}.
|
|
2811
|
+
*/
|
|
1977
2812
|
declare type SwipeEventArgs = {
|
|
1978
2813
|
horizontalspeed?: number;
|
|
1979
2814
|
verticalspeed?: number;
|
|
@@ -1989,10 +2824,14 @@ declare type SwipeEventArgs = {
|
|
|
1989
2824
|
vertical?: boolean;
|
|
1990
2825
|
};
|
|
1991
2826
|
|
|
2827
|
+
/**
|
|
2828
|
+
* Read-only event args dispatched with the swipe gesture lifecycle events.
|
|
2829
|
+
*/
|
|
1992
2830
|
declare class SwipeEventArgsClass {
|
|
1993
2831
|
#private;
|
|
1994
2832
|
private _builder;
|
|
1995
2833
|
private constructor();
|
|
2834
|
+
/** @readonly Gets the resolved swipe direction (`'up'`, `'down'`, `'left'` or `'right'`). */
|
|
1996
2835
|
get direction(): "down" | "left" | "right" | "up";
|
|
1997
2836
|
/** Speed in pixels/second, with sign. */
|
|
1998
2837
|
get speed(): number;
|
|
@@ -2003,24 +2842,43 @@ declare class SwipeEventArgsClass {
|
|
|
2003
2842
|
get predictedDelta(): number;
|
|
2004
2843
|
/** Seconds to reach the final predicted position. */
|
|
2005
2844
|
get predictedDuration(): number;
|
|
2845
|
+
/** @readonly Gets the element being swiped. */
|
|
2006
2846
|
get element(): HTMLElement | SVGElement;
|
|
2847
|
+
/** Builds a new {@link SwipeEventArgsClass} out of a plain {@link SwipeEventArgs} builder. */
|
|
2007
2848
|
static fromArgs(builder: SwipeEventArgs): SwipeEventArgsClass;
|
|
2008
2849
|
}
|
|
2009
2850
|
|
|
2851
|
+
/**
|
|
2852
|
+
* Enumerates the events dispatched throughout the swipe gesture lifecycle.
|
|
2853
|
+
*/
|
|
2010
2854
|
declare enum SwipeEventType {
|
|
2855
|
+
/** Dispatched when the swipe gesture ends (release). */
|
|
2011
2856
|
Swipe = "swipe",
|
|
2857
|
+
/** Dispatched while the pointer is dragging the element around. */
|
|
2012
2858
|
Pan = "pan",
|
|
2859
|
+
/** Dispatched when the swipe ends and its resolved direction is leftward. */
|
|
2013
2860
|
SwipeLeft = "swipeleft",
|
|
2861
|
+
/** Dispatched when the swipe ends and its resolved direction is rightward. */
|
|
2014
2862
|
SwipeRight = "swiperight",
|
|
2863
|
+
/** Dispatched when the swipe ends and its resolved direction is upward. */
|
|
2015
2864
|
SwipeUp = "swipeup",
|
|
2865
|
+
/** Dispatched when the swipe ends and its resolved direction is downward. */
|
|
2016
2866
|
SwipeDown = "swipedown",
|
|
2867
|
+
/** Dispatched when the snap/bounce-back animation following a swipe completes. */
|
|
2017
2868
|
SwipeAnimationEnd = "swipeanimationend",
|
|
2869
|
+
/** Dispatched when the snap/bounce-back animation following a leftward swipe completes. */
|
|
2018
2870
|
SwipeLeftAnimationEnd = "swipeleftanimationend",
|
|
2871
|
+
/** Dispatched when the snap/bounce-back animation following a rightward swipe completes. */
|
|
2019
2872
|
SwipeRightAnimationEnd = "swiperightanimationend",
|
|
2873
|
+
/** Dispatched when the snap/bounce-back animation following an upward swipe completes. */
|
|
2020
2874
|
SwipeUpAnimationEnd = "swipeupanimationend",
|
|
2875
|
+
/** Dispatched when the snap/bounce-back animation following a downward swipe completes. */
|
|
2021
2876
|
SwipeDownAnimationEnd = "swipedownanimationend"
|
|
2022
2877
|
}
|
|
2023
2878
|
|
|
2879
|
+
/**
|
|
2880
|
+
* Fine-tuning options for the {@link PacemSwipeElement} swipe/pan gesture.
|
|
2881
|
+
*/
|
|
2024
2882
|
declare type SwipeOptions = {
|
|
2025
2883
|
/** Inertia on release. */
|
|
2026
2884
|
inertia: number;
|
|
@@ -2039,64 +2897,141 @@ declare type SwipeOptions = {
|
|
|
2039
2897
|
bouncy: boolean;
|
|
2040
2898
|
};
|
|
2041
2899
|
|
|
2900
|
+
/**
|
|
2901
|
+
* Interface to be implemented in order to create a proper swipe adapter.
|
|
2902
|
+
*/
|
|
2042
2903
|
declare interface Swiper {
|
|
2043
2904
|
/** Anchoring targets. */
|
|
2044
2905
|
readonly snaps: number[];
|
|
2045
2906
|
/** Swipe direction. */
|
|
2046
2907
|
readonly direction: 'vertical' | 'horizontal';
|
|
2908
|
+
/** Registers a listener for a swipe lifecycle event. */
|
|
2047
2909
|
addEventListener(evt: SwipeEventType, listener: (evt: SwipeEvent) => void, useCapture?: boolean): void;
|
|
2910
|
+
/** Unregisters a listener previously added for a swipe lifecycle event. */
|
|
2048
2911
|
removeEventListener(evt: SwipeEventType, listener: (evt: SwipeEvent) => void, useCapture?: boolean): void;
|
|
2912
|
+
/** Dispatches a swipe lifecycle event. */
|
|
2049
2913
|
dispatchEvent(evt: SwipeEvent): boolean;
|
|
2050
2914
|
}
|
|
2051
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`. */
|
|
2052
2917
|
export declare abstract class TemplateElement extends HTMLElement {
|
|
2053
2918
|
}
|
|
2054
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
|
+
*/
|
|
2055
2930
|
export declare function Throttle(msecs?: true | number, keyFactory?: (key: String, ...args: any[]) => string): (target: any, key: string, descriptor?: PropertyDescriptor) => void;
|
|
2056
2931
|
|
|
2932
|
+
/**
|
|
2933
|
+
* Contract for a single animatable timeline entry (e.g. an {@link AnimationElement}) that a storyboard/host can start and cancel.
|
|
2934
|
+
*/
|
|
2057
2935
|
declare interface Timeline {
|
|
2936
|
+
/** Gets or sets the element whose property is animated. */
|
|
2058
2937
|
target: Element;
|
|
2938
|
+
/** Gets or sets the name of the animated property on `target`. */
|
|
2059
2939
|
property: string;
|
|
2940
|
+
/** Gets or sets the delay before the animation starts, in milliseconds. */
|
|
2060
2941
|
delay: number;
|
|
2942
|
+
/** Gets or sets the animation duration, in milliseconds. */
|
|
2061
2943
|
duration: number;
|
|
2944
|
+
/** Gets or sets the easing function applied to the animation progress. */
|
|
2062
2945
|
easing: Easing;
|
|
2946
|
+
/** Gets or sets the number of times the animation repeats. */
|
|
2063
2947
|
iterations: number;
|
|
2948
|
+
/** Gets or sets the playback direction of the animation. */
|
|
2064
2949
|
direction: PlaybackDirection;
|
|
2950
|
+
/** Starts (or restarts) the animation. */
|
|
2065
2951
|
startAnimation(): any;
|
|
2952
|
+
/** Cancels the running animation. */
|
|
2066
2953
|
cancelAnimation(): any;
|
|
2067
2954
|
}
|
|
2068
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
|
+
*/
|
|
2069
2960
|
declare class Timer {
|
|
2070
2961
|
#private;
|
|
2071
2962
|
private constructor();
|
|
2072
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
|
+
*/
|
|
2073
2969
|
static run(callback: (time?: number) => void, fps?: number): Timer;
|
|
2970
|
+
/** Stops the timer, cancelling any pending animation frame. */
|
|
2074
2971
|
stop(): void;
|
|
2075
2972
|
}
|
|
2076
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
|
+
*/
|
|
2077
2982
|
declare function Transformer_2(name?: string): (target: any, key: string, descriptor?: PropertyDescriptor) => void;
|
|
2078
2983
|
export { Transformer_2 as Transformer }
|
|
2079
2984
|
|
|
2985
|
+
/** Signature of a function registered via the {@link Transformer} decorator: a named, globally reusable value-transforming function usable in template expressions. */
|
|
2080
2986
|
export declare type TransformFunction = (value?: any, ...args: any[]) => any;
|
|
2081
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
|
+
*/
|
|
2082
2992
|
declare abstract class TweenAnimationElement<T> extends AnimationElement {
|
|
2083
2993
|
#private;
|
|
2084
2994
|
private _tweener;
|
|
2085
2995
|
constructor(_tweener?: TweenService);
|
|
2996
|
+
/** @readonly Gets the {@link TweenService} instance driving this animation. */
|
|
2086
2997
|
protected get tweener(): TweenService;
|
|
2998
|
+
/** Gets or sets the starting value of type `T`. */
|
|
2087
2999
|
abstract from: T;
|
|
3000
|
+
/** Gets or sets the ending value of type `T`. */
|
|
2088
3001
|
abstract to: T;
|
|
3002
|
+
/** Starts (or restarts) the tween and returns a promise resolved once it completes. */
|
|
2089
3003
|
startAnimation(): Promise<void>;
|
|
3004
|
+
/** Cancels the running tween. */
|
|
2090
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
|
+
*/
|
|
2091
3011
|
protected abstract tweenInterpolationCallback(time: number, progress: number): T;
|
|
2092
3012
|
}
|
|
2093
3013
|
|
|
3014
|
+
/**
|
|
3015
|
+
* Runs `requestAnimationFrame`-driven numeric tweens between two values, invoking a callback on each frame.
|
|
3016
|
+
*/
|
|
2094
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
|
+
*/
|
|
2095
3028
|
run(from: number, to: number, duration: number, delay?: number, easing?: (time: number) => number, callback?: (time: number, value: number) => void): Promise<void>;
|
|
2096
3029
|
}
|
|
2097
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. */
|
|
2098
3032
|
export declare const Type: FunctionConstructor;
|
|
2099
3033
|
|
|
3034
|
+
/** A constructor reference for a class producing instances of `T`. */
|
|
2100
3035
|
export declare interface Type<T> extends Function {
|
|
2101
3036
|
new (...args: any[]): T;
|
|
2102
3037
|
}
|
|
@@ -2131,6 +3066,7 @@ export declare namespace UI {
|
|
|
2131
3066
|
}
|
|
2132
3067
|
}
|
|
2133
3068
|
|
|
3069
|
+
/** Minimal shape of a native UI event: keyboard modifiers plus pointer coordinates in all three coordinate systems. Implemented by {@link CustomUIEvent}. */
|
|
2134
3070
|
export declare interface UIEventLike extends KeyEventLike {
|
|
2135
3071
|
readonly clientX: number;
|
|
2136
3072
|
readonly clientY: number;
|
|
@@ -2140,13 +3076,26 @@ export declare interface UIEventLike extends KeyEventLike {
|
|
|
2140
3076
|
readonly screenY: number;
|
|
2141
3077
|
}
|
|
2142
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
|
+
*/
|
|
2143
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. */
|
|
2144
3087
|
static get core(): any;
|
|
3088
|
+
/** The platform's (native or polyfilled) `customElements` registry. */
|
|
2145
3089
|
static get customElements(): any;
|
|
3090
|
+
/** Generates a unique numeric-ish id string. */
|
|
2146
3091
|
static uniqueId(): number;
|
|
3092
|
+
/** Generates a unique short code string. */
|
|
2147
3093
|
static uniqueCode(): string;
|
|
3094
|
+
/** Generates a random string of the given `length`. */
|
|
2148
3095
|
static randomString(length: number): string;
|
|
3096
|
+
/** Parses a date-like value (ISO string, `Date`, or timestamp) into a `Date`. */
|
|
2149
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. */
|
|
2150
3099
|
static copyToClipboard(input: string): Promise<void>;
|
|
2151
3100
|
static Json: {
|
|
2152
3101
|
stringify: typeof Json.serialize;
|
|
@@ -2167,19 +3116,30 @@ export declare class Utils {
|
|
|
2167
3116
|
addDays: typeof Dates.addDays;
|
|
2168
3117
|
daysBetween: typeof Dates.daysBetween;
|
|
2169
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
|
+
*/
|
|
2170
3126
|
static colorize(element: HTMLElement, rgb: string | [number, number, number]): void;
|
|
2171
3127
|
static colorize(rgb: string | [number, number, number]): string;
|
|
3128
|
+
/** Escapes `input` for safe use as a CSS identifier/selector fragment. */
|
|
2172
3129
|
static cssEscape(input: string): string;
|
|
2173
3130
|
static Css: {
|
|
2174
3131
|
colorize: typeof Utils.colorize;
|
|
2175
3132
|
escape: typeof Utils.cssEscape;
|
|
3133
|
+
/** Reads a CSS custom property's current value off the document root (`:root`/`html`). */
|
|
2176
3134
|
getVariableValue(name: string): string;
|
|
3135
|
+
/** Sets a CSS custom property's value on the document root (`:root`/`html`). */
|
|
2177
3136
|
setVariable(name: string, value: string): void;
|
|
2178
3137
|
/**
|
|
2179
3138
|
* Naive O(n^2) implementation for an actual css class presence (definition) in the current DOM.
|
|
2180
3139
|
* @param name CSS class name
|
|
2181
3140
|
*/
|
|
2182
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. */
|
|
2183
3143
|
deserializeTransform(element: Element | CSSStyleDeclaration): Matrix2D;
|
|
2184
3144
|
};
|
|
2185
3145
|
static leftPad: typeof Strings.leftPad;
|
|
@@ -2189,6 +3149,7 @@ export declare class Utils {
|
|
|
2189
3149
|
leftPad: typeof Strings.leftPad;
|
|
2190
3150
|
format: typeof Strings.format;
|
|
2191
3151
|
diff: typeof Strings.diff;
|
|
3152
|
+
/** Strips HTML markup from `html`, returning its plain-text content. */
|
|
2192
3153
|
stripHTML: (html: string) => string;
|
|
2193
3154
|
};
|
|
2194
3155
|
static Blobs: {
|
|
@@ -2201,10 +3162,15 @@ export declare class Utils {
|
|
|
2201
3162
|
load: typeof Imaging.loadImage;
|
|
2202
3163
|
resize: typeof Imaging.resizeImage;
|
|
2203
3164
|
};
|
|
3165
|
+
/** Loads an image from `src` and resolves with the `HTMLImageElement` once ready (or rejects on error). */
|
|
2204
3166
|
static loadImage(src: string): Promise<HTMLImageElement>;
|
|
3167
|
+
/** Converts a `Blob` to a `data:` URL string. */
|
|
2205
3168
|
static blobToDataURL(blob: Blob): Promise<string>;
|
|
3169
|
+
/** Converts a `data:` URL string back into a `Blob`. */
|
|
2206
3170
|
static dataURLToBlob(dataURL: string): Blob;
|
|
3171
|
+
/** Reads a `Blob`'s content as text, using the given `encoding` (default UTF-8). */
|
|
2207
3172
|
static blobToText(blob: Blob, encoding?: string): Promise<string>;
|
|
3173
|
+
/** Wraps `content` in a `Blob` of the given MIME `type` (default `'text/plain'`). */
|
|
2208
3174
|
static textToBlob(content: string, type?: string): Blob;
|
|
2209
3175
|
/** @deprecated Use {Utils.Images.resize}, instead.
|
|
2210
3176
|
* Resizes an image when exceeding the provided size constraints.
|
|
@@ -2221,6 +3187,7 @@ export declare class Utils {
|
|
|
2221
3187
|
* @param ctx
|
|
2222
3188
|
*/
|
|
2223
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. */
|
|
2224
3191
|
static getUserMediaFunctions(): any[];
|
|
2225
3192
|
/**
|
|
2226
3193
|
* Crops the snapshot of a drawable element onto a provided canvas context. It gets centered in the area and cropped (`cover`-like behavior).
|
|
@@ -2239,10 +3206,22 @@ export declare class Utils {
|
|
|
2239
3206
|
* @param quality Quality ratio between 0..1
|
|
2240
3207
|
*/
|
|
2241
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
|
+
*/
|
|
2242
3219
|
static download(content: Blob, filename?: string, mime?: string): Promise<void>;
|
|
2243
3220
|
static download(url: string, filename?: string, mime?: string): Promise<void>;
|
|
2244
3221
|
static download(url: string, options: DownloadOptions): Promise<void>;
|
|
3222
|
+
/** Whether the document (including module scripts) has fully finished loading (`document.readyState === 'complete'`). */
|
|
2245
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). */
|
|
2246
3225
|
static onDOMReady(listener: EventListenerOrEventListenerObject): void;
|
|
2247
3226
|
/**
|
|
2248
3227
|
* Moves all the source element children to the target element and returns them as an array of nodes.
|
|
@@ -2256,25 +3235,41 @@ export declare class Utils {
|
|
|
2256
3235
|
* @param target Target element.
|
|
2257
3236
|
*/
|
|
2258
3237
|
static moveItems(nodes: Node[] | NodeList, target: Element): Node[];
|
|
3238
|
+
/** Cross-browser `Element.matches(selector)`, falling back to vendor-prefixed variants. */
|
|
2259
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. */
|
|
2260
3241
|
static lang(el: HTMLElement): string;
|
|
3242
|
+
/** JSON-stringifies `obj` (via {@link Json}), or passes through `null`/`undefined` unchanged. */
|
|
2261
3243
|
static jsonSortStringify(obj: {}): string;
|
|
2262
3244
|
static Browsers: {
|
|
2263
3245
|
detect: typeof detect;
|
|
2264
3246
|
};
|
|
3247
|
+
/** Parses a `document.cookie`-style string (or `document.cookie` itself, by default) into a name/value map. */
|
|
2265
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. */
|
|
2266
3250
|
static Cookies: {
|
|
3251
|
+
/** Retrieves all cookies (or just `cookieName`, if given) as {@link CookieData} entries. */
|
|
2267
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). */
|
|
2268
3254
|
stringify: (data: CookieData) => string;
|
|
2269
3255
|
};
|
|
3256
|
+
/** Tests whether `el` is currently visible (via the `checkVisibility` API when available, falling back to a CSS-visibility/size heuristic). */
|
|
2270
3257
|
static isVisible(el: HTMLElement | SVGElement): boolean;
|
|
3258
|
+
/** Tests whether `el` has `className` set, using `classList` when available (with a regex-based fallback). */
|
|
2271
3259
|
static hasClass(el: HTMLElement | SVGElement, className: string): boolean;
|
|
3260
|
+
/** Adds one or more (space-separated) classes to `el`, using `classList` when available. */
|
|
2272
3261
|
static addClass(el: HTMLElement | SVGElement, className: string): void;
|
|
3262
|
+
/** Removes one or more (space-separated) classes from `el`, using `classList` when available. */
|
|
2273
3263
|
static removeClass(el: HTMLElement | SVGElement, className: string): void;
|
|
3264
|
+
/** Adds or removes `className` on `el` depending on `on`; see {@link addClass}/{@link removeClass}. */
|
|
2274
3265
|
static toggleClass(el: HTMLElement | SVGElement, className: string, on: boolean): void;
|
|
3266
|
+
/** Tests whether `el`'s `part` attribute (CSS Shadow Parts) contains `partName`. */
|
|
2275
3267
|
static hasPart(el: HTMLElement | SVGElement, partName: string): boolean;
|
|
3268
|
+
/** Adds one or more (space-separated) shadow-part names to `el`'s `part` attribute. */
|
|
2276
3269
|
static addPart(el: HTMLElement | SVGElement, partName: string): void;
|
|
3270
|
+
/** Removes one or more (space-separated) shadow-part names from `el`'s `part` attribute. */
|
|
2277
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}. */
|
|
2278
3273
|
static togglePart(el: HTMLElement | SVGElement, partName: string, on: boolean): void;
|
|
2279
3274
|
/**
|
|
2280
3275
|
* Retrieve the bounding box of the provided element as of its rendered appearance on the stage (takes transformations into account).
|
|
@@ -2291,7 +3286,9 @@ export declare class Utils {
|
|
|
2291
3286
|
* @param el The element.
|
|
2292
3287
|
*/
|
|
2293
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. */
|
|
2294
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. */
|
|
2295
3292
|
static naturalOffsetLeft(el: HTMLElement): number;
|
|
2296
3293
|
/**
|
|
2297
3294
|
* Retrieve the natural bounding box of the provided element (does not takes transformations into account).
|
|
@@ -2310,10 +3307,23 @@ export declare class Utils {
|
|
|
2310
3307
|
static naturalOffsetRect(el: HTMLElement): Rect;
|
|
2311
3308
|
static deserializeTransform(element: Element): Matrix2D;
|
|
2312
3309
|
static deserializeTransform(style: CSSStyleDeclaration): Matrix2D;
|
|
3310
|
+
/** Sets the window's vertical scroll position, keeping the current horizontal position. */
|
|
2313
3311
|
static set scrollTop(y: number);
|
|
3312
|
+
/** Sets the window's horizontal scroll position, keeping the current vertical position. */
|
|
2314
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
|
+
*/
|
|
3320
|
+
static scrollTo(y: number, smooth?: boolean): void;
|
|
3321
|
+
static scrollTo(x: number, y: number, smooth?: boolean): void;
|
|
3322
|
+
/** The window's current vertical scroll position, with fallbacks for older browsers. */
|
|
2315
3323
|
static get scrollTop(): number;
|
|
3324
|
+
/** The window's current horizontal scroll position, with fallbacks for older browsers. */
|
|
2316
3325
|
static get scrollLeft(): number;
|
|
3326
|
+
/** The window's current viewport size (`{ width, height }`), with fallbacks for older browsers. */
|
|
2317
3327
|
static get windowSize(): {
|
|
2318
3328
|
width: number;
|
|
2319
3329
|
height: number;
|
|
@@ -2348,9 +3358,13 @@ export declare class Utils {
|
|
|
2348
3358
|
static accelerateCallback(callback: (token: {
|
|
2349
3359
|
cancel: boolean;
|
|
2350
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). */
|
|
2351
3362
|
static isEmpty(obj: any): boolean;
|
|
3363
|
+
/** Type-guarding test for `obj` being `null` or `undefined`. */
|
|
2352
3364
|
static isNull(obj: any): obj is null | undefined;
|
|
3365
|
+
/** Type-guarding test for `val` being an array. */
|
|
2353
3366
|
static isArray(val: any): val is any[];
|
|
3367
|
+
/** Tests whether `val` is `null`/`undefined` or "empty"; see {@link isNull}/{@link isEmpty}. */
|
|
2354
3368
|
static isNullOrEmpty(val: any): boolean;
|
|
2355
3369
|
/**
|
|
2356
3370
|
* It is a `valueOf()` based comparison.
|
|
@@ -2365,9 +3379,11 @@ export declare class Utils {
|
|
|
2365
3379
|
<T extends {}, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
|
|
2366
3380
|
(target: object, ...sources: any[]): any;
|
|
2367
3381
|
};
|
|
3382
|
+
/** Deep-clones `obj`; see {@link DeepCloner}. */
|
|
2368
3383
|
static clone<T>(obj: T): T;
|
|
2369
3384
|
/** Legacy alias for Promise.resolve(). */
|
|
2370
3385
|
static fromResult<T>(v: T): Promise<T>;
|
|
3386
|
+
/** Runs `task` on the next animation frame and wraps its result in a `Promise`. */
|
|
2371
3387
|
static fromResultAsync<T>(task: () => T): Promise<T>;
|
|
2372
3388
|
/**
|
|
2373
3389
|
* Creates an immutable (readonly) copy of an object while preserving the referential values (shallow immutability).
|
|
@@ -2383,16 +3399,36 @@ export declare class Utils {
|
|
|
2383
3399
|
* @param obj Input array to be frozen
|
|
2384
3400
|
*/
|
|
2385
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). */
|
|
2386
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
|
+
*/
|
|
2387
3411
|
format: (url: string, parameters: {
|
|
2388
3412
|
[name: string]: string;
|
|
2389
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
|
+
*/
|
|
2390
3422
|
appendQuery: (url: string, parameters: {
|
|
2391
3423
|
[name: string]: string;
|
|
2392
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. */
|
|
2393
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). */
|
|
2394
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}. */
|
|
2395
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. */
|
|
2396
3432
|
split: (url: string) => {
|
|
2397
3433
|
protocol?: string;
|
|
2398
3434
|
domain?: string;
|
|
@@ -2400,6 +3436,16 @@ export declare class Utils {
|
|
|
2400
3436
|
query?: string;
|
|
2401
3437
|
hash?: string;
|
|
2402
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
|
+
*/
|
|
2403
3449
|
parseState: (metadata: RouteMetadata[], url: string, path?: string, query?: string, hash?: string) => RouterState;
|
|
2404
3450
|
};
|
|
2405
3451
|
/**
|
|
@@ -2408,16 +3454,50 @@ export declare class Utils {
|
|
|
2408
3454
|
static getApiResult(json: any): any;
|
|
2409
3455
|
}
|
|
2410
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
|
+
*/
|
|
2411
3468
|
export declare function ViewChild(selector: string): (target: any, prop: string, descriptor?: PropertyDescriptor) => void;
|
|
2412
3469
|
|
|
2413
3470
|
declare interface Wai {
|
|
2414
3471
|
readonly aria: Aria;
|
|
2415
3472
|
}
|
|
2416
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
|
+
*/
|
|
2417
3495
|
export declare function Watch(config?: WatchConfig): (target: any, prop: string, descriptor?: PropertyDescriptor) => void;
|
|
2418
3496
|
|
|
3497
|
+
/** Key used to attach, on an element's constructor, the list of its `@Watch`-decorated (watched) property descriptors. */
|
|
2419
3498
|
export declare const WATCH_PROPS_VAR: string;
|
|
2420
3499
|
|
|
3500
|
+
/** Configuration options accepted by the {@link Watch} property decorator, controlling conversion, change notification and attribute reflection. */
|
|
2421
3501
|
export declare type WatchConfig = {
|
|
2422
3502
|
/** Whether to debounce the property change for a while or not (numeric to specify milliseconds) */
|
|
2423
3503
|
debounce?: boolean | number;
|
|
@@ -2500,6 +3580,11 @@ declare global {
|
|
|
2500
3580
|
RegexMatchSegment,
|
|
2501
3581
|
Repeater,
|
|
2502
3582
|
RepeaterItem,
|
|
3583
|
+
RouterNavigateEvent,
|
|
3584
|
+
RouterNavigateEventArgs,
|
|
3585
|
+
RouterNavigateEventName,
|
|
3586
|
+
RouterNavigatingEvent,
|
|
3587
|
+
RouterNavigatingEventName,
|
|
2503
3588
|
RouterState,
|
|
2504
3589
|
stopPropagationHandler,
|
|
2505
3590
|
TemplateElement,
|