@joist/observable 2.0.0-next.8 → 2.0.0
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/README.md +77 -8
- package/package.json +6 -5
- package/target/build/lib/attribute-parsers.d.ts +8 -0
- package/target/build/lib/attribute-parsers.js +19 -0
- package/target/build/lib/attribute.d.ts +5 -0
- package/target/build/lib/attribute.js +41 -0
- package/target/build/lib/element.d.ts +8 -0
- package/target/build/lib/element.js +47 -0
- package/target/build/lib/observable.d.ts +14 -10
- package/target/build/lib/observable.js +117 -49
- package/target/build/lib/upgradable.d.ts +621 -0
- package/target/build/lib/upgradable.js +14 -0
- package/target/build/lib.d.ts +3 -1
- package/target/build/lib.js +3 -2
- package/target/build/lib/observable.js.map +0 -1
- package/target/build/lib.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Observable
|
|
2
2
|
|
|
3
3
|
Observable in Joist means something slightly different then in something like RxJs.
|
|
4
|
-
|
|
4
|
+
Decorating a class with `@observable` means that instances of that class will BE observable. This means you can watch for changes on select properties.s
|
|
5
5
|
|
|
6
6
|
#### Installation:
|
|
7
7
|
|
|
@@ -12,10 +12,10 @@ npm i @joist/observable
|
|
|
12
12
|
#### Example:
|
|
13
13
|
|
|
14
14
|
```TS
|
|
15
|
-
import { observable, observer,
|
|
15
|
+
import { observable, observer, OnPropertyChanged, Changes } from '@joist/observable';
|
|
16
16
|
|
|
17
17
|
@observable
|
|
18
|
-
class State implements
|
|
18
|
+
class State implements OnPropertyChanged {
|
|
19
19
|
// Changes to these will trigger callback
|
|
20
20
|
@observe todos: string[] = [];
|
|
21
21
|
@observe userName?: string;
|
|
@@ -23,7 +23,7 @@ class State implements OnChange {
|
|
|
23
23
|
// changes to this will not
|
|
24
24
|
someValue: boolean = false;
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
onPropertyChanged(changes: Changes) {
|
|
27
27
|
console.log(changes);
|
|
28
28
|
// { todos: { value: ['Build Shit'], previousValue: [] }, userName: { value: 'Danny Blue', previousValue: undefined } }
|
|
29
29
|
}
|
|
@@ -40,7 +40,7 @@ state.userName = 'Danny Blue'
|
|
|
40
40
|
If you want to externally monitor your class for changes you can extend event target and dispatch events. (available in both node and the browser)
|
|
41
41
|
|
|
42
42
|
```TS
|
|
43
|
-
import { observable, observer,
|
|
43
|
+
import { observable, observer, OnPropertyChanged, Changes } from '@joist/observable';
|
|
44
44
|
|
|
45
45
|
class StateChangeEvent extends Event {
|
|
46
46
|
consetructor(public changes: Changes) {
|
|
@@ -49,7 +49,7 @@ class StateChangeEvent extends Event {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
@observable
|
|
52
|
-
class State extends EventTarget implements
|
|
52
|
+
class State extends EventTarget implements OnPropertyChanged {
|
|
53
53
|
// Changes to these will trigger callback
|
|
54
54
|
@observe todos: string[] = [];
|
|
55
55
|
@observe userName?: string;
|
|
@@ -57,8 +57,8 @@ class State extends EventTarget implements OnChange {
|
|
|
57
57
|
// changes to this will not
|
|
58
58
|
someValue: boolean = false;
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
this.dispatchEvent(new StateChangeEvent());
|
|
60
|
+
onPropertyChanged(changes: Changes) {
|
|
61
|
+
this.dispatchEvent(new StateChangeEvent(changes));
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -71,3 +71,72 @@ state.addEventListener('statechange', (e) => {
|
|
|
71
71
|
state.todos = [...state.todos, 'Build Shit'];
|
|
72
72
|
state.userName = 'Danny Blue'
|
|
73
73
|
```
|
|
74
|
+
|
|
75
|
+
#### Custom Elements
|
|
76
|
+
|
|
77
|
+
If you are using @observable with custom elements it is very likely that you will want to read from and write to attributes.
|
|
78
|
+
In order to appropriately handle reading from and writting to attributes. Any class that extends HTMLElement can use the `@attr` decorator to define attribute behavior.
|
|
79
|
+
|
|
80
|
+
```TS
|
|
81
|
+
import { observable, observe, attr } from '@joist/observable';
|
|
82
|
+
|
|
83
|
+
@observable
|
|
84
|
+
class TestElement extends HTMLElement {
|
|
85
|
+
// reads as a string and writes directly to the name attribute
|
|
86
|
+
@observe @attr name = '';
|
|
87
|
+
|
|
88
|
+
// reads as a number and writes back a string
|
|
89
|
+
@observe
|
|
90
|
+
@attr({ read: Number })
|
|
91
|
+
count: number = 0;
|
|
92
|
+
|
|
93
|
+
// reads as a Date object and writes back a string
|
|
94
|
+
@observe
|
|
95
|
+
@attr<Date>({
|
|
96
|
+
read: (val) => new Date(val),
|
|
97
|
+
write: (val) => val.toString()
|
|
98
|
+
})
|
|
99
|
+
count = new Date();
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
##### Upgrading Custom Element Properties
|
|
104
|
+
|
|
105
|
+
One tricky thing about custom elements and properties is how to handle them when the upgrade. For example.
|
|
106
|
+
|
|
107
|
+
```HTML
|
|
108
|
+
|
|
109
|
+
<my-element></my-element>
|
|
110
|
+
|
|
111
|
+
<script>
|
|
112
|
+
const el = document.querySelector('my-element');
|
|
113
|
+
|
|
114
|
+
// A property is changed BEFORE the definition is loaded.
|
|
115
|
+
// We still want this value to be available on our custom element
|
|
116
|
+
el.name = "Hello!"
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<script src="./path/to/my-element-defintion.js" type="module">
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Joist provides an `UpgradableElement` base class that will ensure that any properties that are set prior to upgrade time are forwarded to your custom element.
|
|
123
|
+
|
|
124
|
+
```TS
|
|
125
|
+
import { observable, observe, UpgradableElement } from '@joist/observable';
|
|
126
|
+
|
|
127
|
+
@observable
|
|
128
|
+
class TestElement extends UpgradableElement {
|
|
129
|
+
@observe name = ''; // now in our example above this value will be set to "Hello"
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
If you need to extend your own custom HTMLElement you can also use the provided `upgradable` mixin.
|
|
134
|
+
|
|
135
|
+
```TS
|
|
136
|
+
import { observable, observe, upgradable } from '@joist/observable';
|
|
137
|
+
|
|
138
|
+
@observable
|
|
139
|
+
class TestElement extends upgradable(HTMLElement) {
|
|
140
|
+
@observe name = ''; // now in our example above this value will be set to "Hello"
|
|
141
|
+
}
|
|
142
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joist/observable",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "./target/build/lib.js",
|
|
5
5
|
"module": "./target/build/lib.js",
|
|
6
6
|
"exports": {
|
|
@@ -12,15 +12,16 @@
|
|
|
12
12
|
"target/build"
|
|
13
13
|
],
|
|
14
14
|
"sideEffects": false,
|
|
15
|
-
"description": "
|
|
15
|
+
"description": "Monitor and respond to object changes",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
18
|
"url": "git+https://github.com/deebloo/joist.git"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
21
21
|
"TypeScript",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
22
|
+
"Observable",
|
|
23
|
+
"WebComponents",
|
|
24
|
+
"Reactive"
|
|
24
25
|
],
|
|
25
26
|
"author": "deebloo",
|
|
26
27
|
"license": "MIT",
|
|
@@ -34,5 +35,5 @@
|
|
|
34
35
|
"test": "tsc -p tsconfig.test.json && wtr --config ../../wtr.config.mjs --port 8002",
|
|
35
36
|
"build": "tsc -p tsconfig.build.json"
|
|
36
37
|
},
|
|
37
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "ed9e8f0cb4c6213ba255278a173c3dc7f45aee89"
|
|
38
39
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface AttributeParser<T> {
|
|
2
|
+
read(val: string): T;
|
|
3
|
+
write(val: T): string;
|
|
4
|
+
mapTo: string;
|
|
5
|
+
}
|
|
6
|
+
export declare type AttributeParsers = Record<string, AttributeParser<unknown>>;
|
|
7
|
+
export declare function defaultParser(mapTo: string): AttributeParser<boolean | string>;
|
|
8
|
+
export declare function propNameToAttrName(prop: string): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function defaultParser(mapTo) {
|
|
2
|
+
return {
|
|
3
|
+
read(val) {
|
|
4
|
+
// if a boolean assume such
|
|
5
|
+
if (val === 'true' || val === 'false') {
|
|
6
|
+
return val === 'true';
|
|
7
|
+
}
|
|
8
|
+
return val;
|
|
9
|
+
},
|
|
10
|
+
write: String,
|
|
11
|
+
mapTo,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function propNameToAttrName(prop) {
|
|
15
|
+
return prop
|
|
16
|
+
.split(/(?=[A-Z])/)
|
|
17
|
+
.join('-')
|
|
18
|
+
.toLowerCase();
|
|
19
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AttributeParser } from './attribute-parsers.js';
|
|
2
|
+
export declare function getObservableAttributes(c: typeof HTMLElement | Function): Array<string>;
|
|
3
|
+
export declare function getAttributeParsers<T extends typeof HTMLElement | Function>(c: T): Record<string, AttributeParser<unknown>>;
|
|
4
|
+
export declare function attr<T>(p: Partial<AttributeParser<T>>): <E extends HTMLElement>(t: E, key: string) => void;
|
|
5
|
+
export declare function attr<T extends HTMLElement>(t: T, key: string): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { defaultParser, propNameToAttrName, } from './attribute-parsers.js';
|
|
2
|
+
export function getObservableAttributes(c) {
|
|
3
|
+
return Reflect.get(c, 'observedAttributes') || [];
|
|
4
|
+
}
|
|
5
|
+
export function getAttributeParsers(c) {
|
|
6
|
+
const parsers = Reflect.get(c, 'attributeParsers') || {};
|
|
7
|
+
return parsers;
|
|
8
|
+
}
|
|
9
|
+
export function attr(targetOrParser, key) {
|
|
10
|
+
if (targetOrParser instanceof HTMLElement && typeof key === 'string') {
|
|
11
|
+
const attrName = propNameToAttrName(key);
|
|
12
|
+
return defineAttribute(targetOrParser, attrName, key);
|
|
13
|
+
}
|
|
14
|
+
return (target, key) => {
|
|
15
|
+
const parser = targetOrParser;
|
|
16
|
+
const attrName = propNameToAttrName(key);
|
|
17
|
+
defineAttribute(target, attrName, key);
|
|
18
|
+
const attributeParsers = Reflect.get(target.constructor, 'attributeParsers');
|
|
19
|
+
attributeParsers[attrName].read = parser.read || attributeParsers[attrName].read;
|
|
20
|
+
attributeParsers[attrName].write = parser.write || attributeParsers[attrName].write;
|
|
21
|
+
Reflect.set(target.constructor, 'attributeParsers', attributeParsers);
|
|
22
|
+
return void 0;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function defineAttribute(target, attrName, propName) {
|
|
26
|
+
const observedAttributes = Reflect.get(target.constructor, 'observedAttributes');
|
|
27
|
+
if (observedAttributes) {
|
|
28
|
+
observedAttributes.push(attrName);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
Reflect.set(target.constructor, 'observedAttributes', [attrName]);
|
|
32
|
+
}
|
|
33
|
+
const attributeParsers = Reflect.get(target.constructor, 'attributeParsers');
|
|
34
|
+
if (attributeParsers) {
|
|
35
|
+
attributeParsers[attrName] = defaultParser(propName);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
Reflect.set(target.constructor, 'attributeParsers', { [attrName]: defaultParser(propName) });
|
|
39
|
+
}
|
|
40
|
+
return void 0;
|
|
41
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Changes } from './observable';
|
|
2
|
+
export declare class ObservableElement extends HTMLElement {
|
|
3
|
+
__upgradedProps: Map<keyof this, unknown>;
|
|
4
|
+
constructor();
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
attributeChangedCallback(name: string, _: string, newVal: string): void;
|
|
7
|
+
onPropertyChanged(changes: Changes): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { getAttributeParsers, getObservableAttributes } from './attribute';
|
|
2
|
+
import { propNameToAttrName } from './attribute-parsers';
|
|
3
|
+
export class ObservableElement extends HTMLElement {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.__upgradedProps = new Map();
|
|
7
|
+
for (let prop in this) {
|
|
8
|
+
if (this.hasOwnProperty(prop) && prop !== 'upgradedProps') {
|
|
9
|
+
this.__upgradedProps.set(prop, this[prop]);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
connectedCallback() {
|
|
14
|
+
const attributes = getObservableAttributes(this.constructor);
|
|
15
|
+
const parsers = getAttributeParsers(this.constructor);
|
|
16
|
+
for (let i = 0; i < attributes.length; i++) {
|
|
17
|
+
const key = attributes[i];
|
|
18
|
+
const { write, mapTo } = parsers[key];
|
|
19
|
+
if (this.getAttribute(key) === null) {
|
|
20
|
+
const propVal = Reflect.get(this, mapTo);
|
|
21
|
+
if (propVal !== undefined && propVal !== null && propVal !== '') {
|
|
22
|
+
this.setAttribute(key, write(propVal));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
attributeChangedCallback(name, _, newVal) {
|
|
28
|
+
const parsers = getAttributeParsers(this.constructor);
|
|
29
|
+
const { read, mapTo } = parsers[name];
|
|
30
|
+
Reflect.set(this, mapTo, read(newVal));
|
|
31
|
+
}
|
|
32
|
+
onPropertyChanged(changes) {
|
|
33
|
+
const attributes = getObservableAttributes(this.constructor);
|
|
34
|
+
const parsers = getAttributeParsers(this.constructor);
|
|
35
|
+
if (this instanceof ObservableElement) {
|
|
36
|
+
for (let change in changes) {
|
|
37
|
+
const attrName = propNameToAttrName(change);
|
|
38
|
+
if (attributes.includes(attrName)) {
|
|
39
|
+
const value = parsers[attrName].write(changes[change].value);
|
|
40
|
+
if (value !== this.getAttribute(attrName)) {
|
|
41
|
+
this.setAttribute(attrName, value);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -5,23 +5,27 @@ export declare class Change<T = any> {
|
|
|
5
5
|
constructor(value: T, previousValue: T | undefined, firstChange: boolean);
|
|
6
6
|
}
|
|
7
7
|
export declare type Changes = Record<string | symbol, Change>;
|
|
8
|
-
export interface
|
|
9
|
-
|
|
8
|
+
export interface OnPropertyChanged {
|
|
9
|
+
onPropertyChanged(changes: Changes): void;
|
|
10
10
|
}
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function getObservableProperties(c: any): Array<string | symbol>;
|
|
12
12
|
export interface ObservableBase {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
__propChanges: Map<string | symbol, Change>;
|
|
14
|
+
__propChange: Promise<void> | null;
|
|
15
|
+
__initializedChanges: Set<string | symbol>;
|
|
16
16
|
definePropChange(key: string | symbol, propChange: Change): Promise<void>;
|
|
17
|
+
onPropertyChanged?(changes: Changes): void;
|
|
17
18
|
}
|
|
18
19
|
export declare function observe(target: any, key: string): void;
|
|
19
|
-
export declare function observable<T extends new (...args: any[]) => any>(
|
|
20
|
+
export declare function observable<T extends new (...args: any[]) => any>(Base: T): {
|
|
20
21
|
new (...args: any[]): {
|
|
21
22
|
[x: string]: any;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
__propChanges: Map<any, any>;
|
|
24
|
+
__propChange: Promise<void> | null;
|
|
25
|
+
__initializedChanges: Set<string | symbol>;
|
|
26
|
+
connectedCallback(this: HTMLElement): void;
|
|
27
|
+
attributeChangedCallback(this: HTMLElement, name: string, oldVal: string, newVal: string): void;
|
|
28
|
+
onPropertyChanged(changes: Changes): void;
|
|
25
29
|
definePropChange(key: string | symbol, propChange: Change): Promise<void>;
|
|
26
30
|
};
|
|
27
31
|
} & T;
|
|
@@ -1,79 +1,147 @@
|
|
|
1
|
+
import { getAttributeParsers, getObservableAttributes } from './attribute.js';
|
|
2
|
+
import { propNameToAttrName } from './attribute-parsers.js';
|
|
1
3
|
export class Change {
|
|
2
|
-
value;
|
|
3
|
-
previousValue;
|
|
4
|
-
firstChange;
|
|
5
4
|
constructor(value, previousValue, firstChange) {
|
|
6
5
|
this.value = value;
|
|
7
6
|
this.previousValue = previousValue;
|
|
8
7
|
this.firstChange = firstChange;
|
|
9
8
|
}
|
|
10
9
|
}
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const PROPERTY_KEY = 'observedProperties';
|
|
11
|
+
export function getObservableProperties(c) {
|
|
12
|
+
return c[PROPERTY_KEY] || [];
|
|
13
13
|
}
|
|
14
|
-
const PROPERTY_KEY = 'properties';
|
|
15
14
|
export function observe(target, key) {
|
|
16
|
-
target[PROPERTY_KEY] = target[PROPERTY_KEY] ||
|
|
17
|
-
target[PROPERTY_KEY]
|
|
15
|
+
target.constructor[PROPERTY_KEY] = target.constructor[PROPERTY_KEY] || [];
|
|
16
|
+
target.constructor[PROPERTY_KEY].push(key);
|
|
18
17
|
}
|
|
19
|
-
export function observable(
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
initializedChanges = new Set();
|
|
18
|
+
export function observable(Base) {
|
|
19
|
+
const properties = getObservableProperties(Base);
|
|
20
|
+
const descriptors = createPropertyDescripors(properties);
|
|
21
|
+
const parsers = getAttributeParsers(Base);
|
|
22
|
+
const attributes = getObservableAttributes(Base);
|
|
23
|
+
return class Observable extends Base {
|
|
26
24
|
constructor(...args) {
|
|
27
25
|
super(...args);
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
this.__propChanges = new Map();
|
|
27
|
+
this.__propChange = null;
|
|
28
|
+
this.__initializedChanges = new Set();
|
|
29
|
+
init.call(this, descriptors);
|
|
30
|
+
}
|
|
31
|
+
connectedCallback() {
|
|
32
|
+
connectedCallback.call(this, attributes, parsers);
|
|
33
|
+
if (super.connectedCallback) {
|
|
34
|
+
super.connectedCallback();
|
|
30
35
|
}
|
|
31
|
-
Object.defineProperties(this, props);
|
|
32
36
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
38
|
+
attributeChangedCallback.call(this, name, newVal, parsers);
|
|
39
|
+
if (super.attributeChangedCallback) {
|
|
40
|
+
super.attributeChangedCallback(name, oldVal, newVal);
|
|
36
41
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// keep track of whether or not this is the first time a given property has changes
|
|
43
|
-
for (let change in this.propChanges) {
|
|
44
|
-
this.propChanges[change].firstChange = !this.initializedChanges.has(change);
|
|
45
|
-
this.initializedChanges.add(change);
|
|
46
|
-
}
|
|
47
|
-
if (this.onChange) {
|
|
48
|
-
this.onChange(this.propChanges);
|
|
49
|
-
}
|
|
50
|
-
// reset for next time
|
|
51
|
-
this.propChanges = {};
|
|
52
|
-
this.propChange = null;
|
|
53
|
-
});
|
|
42
|
+
}
|
|
43
|
+
onPropertyChanged(changes) {
|
|
44
|
+
onPropertyChanged.call(this, attributes, parsers, changes);
|
|
45
|
+
if (super.onPropertyChanged) {
|
|
46
|
+
super.onPropertyChanged(changes);
|
|
54
47
|
}
|
|
55
|
-
|
|
48
|
+
}
|
|
49
|
+
definePropChange(key, propChange) {
|
|
50
|
+
return definePropChange.call(this, key, propChange);
|
|
56
51
|
}
|
|
57
52
|
};
|
|
58
53
|
}
|
|
54
|
+
function init(descriptors) {
|
|
55
|
+
for (let prop in descriptors) {
|
|
56
|
+
Object.defineProperty(this, createPrivateKey(prop), {
|
|
57
|
+
value: Reflect.get(this, prop),
|
|
58
|
+
enumerable: false,
|
|
59
|
+
writable: true,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
Object.defineProperties(this, descriptors);
|
|
63
|
+
// Set initial props if ForwardPropsed from ObservableElement
|
|
64
|
+
if ('__upgradedProps' in this && this['__upgradedProps'] instanceof Map) {
|
|
65
|
+
for (let [key, value] of this.__upgradedProps) {
|
|
66
|
+
Reflect.set(this, key, value);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function connectedCallback(attributes, parsers) {
|
|
71
|
+
for (let i = 0; i < attributes.length; i++) {
|
|
72
|
+
const key = attributes[i];
|
|
73
|
+
const { write, mapTo } = parsers[key];
|
|
74
|
+
if (this.getAttribute(key) === null) {
|
|
75
|
+
const propVal = Reflect.get(this, mapTo);
|
|
76
|
+
if (propVal !== undefined && propVal !== null && propVal !== '') {
|
|
77
|
+
this.setAttribute(key, write(propVal));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function attributeChangedCallback(name, newVal, parsers) {
|
|
83
|
+
const { read, mapTo } = parsers[name];
|
|
84
|
+
Reflect.set(this, mapTo, read(newVal));
|
|
85
|
+
}
|
|
86
|
+
function onPropertyChanged(attributes, parsers, changes) {
|
|
87
|
+
if (this instanceof HTMLElement) {
|
|
88
|
+
for (let change in changes) {
|
|
89
|
+
const attrName = propNameToAttrName(change);
|
|
90
|
+
if (attributes.includes(attrName)) {
|
|
91
|
+
const value = parsers[attrName].write(changes[change].value);
|
|
92
|
+
if (value !== this.getAttribute(attrName)) {
|
|
93
|
+
this.setAttribute(attrName, value);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function definePropChange(key, propChange) {
|
|
100
|
+
if (!this.__propChanges.has(key)) {
|
|
101
|
+
this.__propChanges.set(key, propChange);
|
|
102
|
+
}
|
|
103
|
+
this.__propChanges.get(key).value = propChange.value;
|
|
104
|
+
if (!this.__propChange) {
|
|
105
|
+
// If there is no previous change defined set it up
|
|
106
|
+
this.__propChange = Promise.resolve().then(() => {
|
|
107
|
+
// run onPropChanges here. This makes sure we capture all changes
|
|
108
|
+
const changes = {};
|
|
109
|
+
// Copy changes and keep track of whether or not this is the first time a given property has changes
|
|
110
|
+
for (let [key, value] of this.__propChanges) {
|
|
111
|
+
changes[key] = value;
|
|
112
|
+
changes[key].firstChange = !this.__initializedChanges.has(key);
|
|
113
|
+
this.__initializedChanges.add(key);
|
|
114
|
+
}
|
|
115
|
+
// clear out before calling to account for changes made INSIDE of the onPropertyChanged callback
|
|
116
|
+
this.__propChange = null;
|
|
117
|
+
this.__propChanges.clear();
|
|
118
|
+
if (this.onPropertyChanged) {
|
|
119
|
+
this.onPropertyChanged(changes);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return this.__propChange;
|
|
124
|
+
}
|
|
59
125
|
function createPrivateKey(key) {
|
|
60
|
-
return `__${key}`;
|
|
126
|
+
return `__${key.toString()}`;
|
|
61
127
|
}
|
|
62
|
-
function createPropertyDescripors(
|
|
63
|
-
const
|
|
64
|
-
for (let
|
|
65
|
-
const
|
|
66
|
-
|
|
128
|
+
function createPropertyDescripors(props) {
|
|
129
|
+
const descriptors = {};
|
|
130
|
+
for (let i = 0; i < props.length; i++) {
|
|
131
|
+
const prop = props[i];
|
|
132
|
+
const privateKey = createPrivateKey(prop);
|
|
133
|
+
descriptors[prop] = {
|
|
67
134
|
set(val) {
|
|
68
135
|
const prevVal = Reflect.get(this, privateKey);
|
|
69
|
-
|
|
70
|
-
|
|
136
|
+
if (prevVal !== val) {
|
|
137
|
+
this.definePropChange(prop, new Change(val, prevVal, true));
|
|
138
|
+
}
|
|
139
|
+
return Reflect.set(this, privateKey, val);
|
|
71
140
|
},
|
|
72
141
|
get() {
|
|
73
142
|
return Reflect.get(this, privateKey);
|
|
74
143
|
},
|
|
75
144
|
};
|
|
76
145
|
}
|
|
77
|
-
return
|
|
146
|
+
return descriptors;
|
|
78
147
|
}
|
|
79
|
-
//# sourceMappingURL=observable.js.map
|
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
export declare function upgradable<T extends new (...args: any[]) => HTMLElement>(Base: T): {
|
|
2
|
+
new (...args: any[]): {
|
|
3
|
+
__upgradedProps: Map<keyof any, unknown>;
|
|
4
|
+
accessKey: string;
|
|
5
|
+
readonly accessKeyLabel: string;
|
|
6
|
+
autocapitalize: string;
|
|
7
|
+
dir: string;
|
|
8
|
+
draggable: boolean;
|
|
9
|
+
hidden: boolean;
|
|
10
|
+
innerText: string;
|
|
11
|
+
lang: string;
|
|
12
|
+
readonly offsetHeight: number;
|
|
13
|
+
readonly offsetLeft: number;
|
|
14
|
+
readonly offsetParent: Element | null;
|
|
15
|
+
readonly offsetTop: number;
|
|
16
|
+
readonly offsetWidth: number;
|
|
17
|
+
outerText: string;
|
|
18
|
+
spellcheck: boolean;
|
|
19
|
+
title: string;
|
|
20
|
+
translate: boolean;
|
|
21
|
+
attachInternals(): ElementInternals;
|
|
22
|
+
click(): void;
|
|
23
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
24
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
25
|
+
removeEventListener<K_1 extends keyof HTMLElementEventMap>(type: K_1, listener: (this: HTMLElement, ev: HTMLElementEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void;
|
|
26
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
|
27
|
+
connectedCallback?(): void;
|
|
28
|
+
disconnectedCallback?(): void;
|
|
29
|
+
attributeChangedCallback?(name: string, oldVal: string, newVal: string): void;
|
|
30
|
+
readonly attributes: NamedNodeMap;
|
|
31
|
+
readonly classList: DOMTokenList;
|
|
32
|
+
className: string;
|
|
33
|
+
readonly clientHeight: number;
|
|
34
|
+
readonly clientLeft: number;
|
|
35
|
+
readonly clientTop: number;
|
|
36
|
+
readonly clientWidth: number;
|
|
37
|
+
id: string;
|
|
38
|
+
readonly localName: string;
|
|
39
|
+
readonly namespaceURI: string | null;
|
|
40
|
+
onfullscreenchange: ((this: Element, ev: Event) => any) | null;
|
|
41
|
+
onfullscreenerror: ((this: Element, ev: Event) => any) | null;
|
|
42
|
+
outerHTML: string;
|
|
43
|
+
readonly ownerDocument: Document;
|
|
44
|
+
readonly part: DOMTokenList;
|
|
45
|
+
readonly prefix: string | null;
|
|
46
|
+
readonly scrollHeight: number;
|
|
47
|
+
scrollLeft: number;
|
|
48
|
+
scrollTop: number;
|
|
49
|
+
readonly scrollWidth: number;
|
|
50
|
+
readonly shadowRoot: ShadowRoot | null;
|
|
51
|
+
slot: string;
|
|
52
|
+
readonly tagName: string;
|
|
53
|
+
attachShadow(init: ShadowRootInit): ShadowRoot;
|
|
54
|
+
closest<K_2 extends keyof HTMLElementTagNameMap>(selector: K_2): HTMLElementTagNameMap[K_2] | null;
|
|
55
|
+
closest<K_3 extends keyof SVGElementTagNameMap>(selector: K_3): SVGElementTagNameMap[K_3] | null;
|
|
56
|
+
closest<E extends Element = Element>(selectors: string): E | null;
|
|
57
|
+
getAttribute(qualifiedName: string): string | null;
|
|
58
|
+
getAttributeNS(namespace: string | null, localName: string): string | null;
|
|
59
|
+
getAttributeNames(): string[];
|
|
60
|
+
getAttributeNode(qualifiedName: string): Attr | null;
|
|
61
|
+
getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
|
|
62
|
+
getBoundingClientRect(): DOMRect;
|
|
63
|
+
getClientRects(): DOMRectList;
|
|
64
|
+
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
|
|
65
|
+
getElementsByTagName<K_4 extends keyof HTMLElementTagNameMap>(qualifiedName: K_4): HTMLCollectionOf<HTMLElementTagNameMap[K_4]>;
|
|
66
|
+
getElementsByTagName<K_5 extends keyof SVGElementTagNameMap>(qualifiedName: K_5): HTMLCollectionOf<SVGElementTagNameMap[K_5]>;
|
|
67
|
+
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
|
|
68
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
|
|
69
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
|
|
70
|
+
getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;
|
|
71
|
+
hasAttribute(qualifiedName: string): boolean;
|
|
72
|
+
hasAttributeNS(namespace: string | null, localName: string): boolean;
|
|
73
|
+
hasAttributes(): boolean;
|
|
74
|
+
hasPointerCapture(pointerId: number): boolean;
|
|
75
|
+
insertAdjacentElement(where: InsertPosition, element: Element): Element | null;
|
|
76
|
+
insertAdjacentHTML(position: InsertPosition, text: string): void;
|
|
77
|
+
insertAdjacentText(where: InsertPosition, data: string): void;
|
|
78
|
+
matches(selectors: string): boolean;
|
|
79
|
+
releasePointerCapture(pointerId: number): void;
|
|
80
|
+
removeAttribute(qualifiedName: string): void;
|
|
81
|
+
removeAttributeNS(namespace: string | null, localName: string): void;
|
|
82
|
+
removeAttributeNode(attr: Attr): Attr;
|
|
83
|
+
requestFullscreen(options?: FullscreenOptions | undefined): Promise<void>;
|
|
84
|
+
requestPointerLock(): void;
|
|
85
|
+
scroll(options?: ScrollToOptions | undefined): void;
|
|
86
|
+
scroll(x: number, y: number): void;
|
|
87
|
+
scrollBy(options?: ScrollToOptions | undefined): void;
|
|
88
|
+
scrollBy(x: number, y: number): void;
|
|
89
|
+
scrollIntoView(arg?: boolean | ScrollIntoViewOptions | undefined): void;
|
|
90
|
+
scrollTo(options?: ScrollToOptions | undefined): void;
|
|
91
|
+
scrollTo(x: number, y: number): void;
|
|
92
|
+
setAttribute(qualifiedName: string, value: string): void;
|
|
93
|
+
setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
|
|
94
|
+
setAttributeNode(attr: Attr): Attr | null;
|
|
95
|
+
setAttributeNodeNS(attr: Attr): Attr | null;
|
|
96
|
+
setPointerCapture(pointerId: number): void;
|
|
97
|
+
toggleAttribute(qualifiedName: string, force?: boolean | undefined): boolean;
|
|
98
|
+
webkitMatchesSelector(selectors: string): boolean;
|
|
99
|
+
readonly baseURI: string;
|
|
100
|
+
readonly childNodes: NodeListOf<ChildNode>;
|
|
101
|
+
readonly firstChild: ChildNode | null;
|
|
102
|
+
readonly isConnected: boolean;
|
|
103
|
+
readonly lastChild: ChildNode | null;
|
|
104
|
+
readonly nextSibling: ChildNode | null;
|
|
105
|
+
readonly nodeName: string;
|
|
106
|
+
readonly nodeType: number;
|
|
107
|
+
nodeValue: string | null;
|
|
108
|
+
readonly parentElement: HTMLElement | null;
|
|
109
|
+
readonly parentNode: ParentNode | null;
|
|
110
|
+
readonly previousSibling: ChildNode | null;
|
|
111
|
+
textContent: string | null;
|
|
112
|
+
appendChild<T_1 extends Node>(node: T_1): T_1;
|
|
113
|
+
cloneNode(deep?: boolean | undefined): Node;
|
|
114
|
+
compareDocumentPosition(other: Node): number;
|
|
115
|
+
contains(other: Node | null): boolean;
|
|
116
|
+
getRootNode(options?: GetRootNodeOptions | undefined): Node;
|
|
117
|
+
hasChildNodes(): boolean;
|
|
118
|
+
insertBefore<T_2 extends Node>(node: T_2, child: Node | null): T_2;
|
|
119
|
+
isDefaultNamespace(namespace: string | null): boolean;
|
|
120
|
+
isEqualNode(otherNode: Node | null): boolean;
|
|
121
|
+
isSameNode(otherNode: Node | null): boolean;
|
|
122
|
+
lookupNamespaceURI(prefix: string | null): string | null;
|
|
123
|
+
lookupPrefix(namespace: string | null): string | null;
|
|
124
|
+
normalize(): void;
|
|
125
|
+
removeChild<T_3 extends Node>(child: T_3): T_3;
|
|
126
|
+
replaceChild<T_4 extends Node>(node: Node, child: T_4): T_4;
|
|
127
|
+
readonly ATTRIBUTE_NODE: number;
|
|
128
|
+
readonly CDATA_SECTION_NODE: number;
|
|
129
|
+
readonly COMMENT_NODE: number;
|
|
130
|
+
readonly DOCUMENT_FRAGMENT_NODE: number;
|
|
131
|
+
readonly DOCUMENT_NODE: number;
|
|
132
|
+
readonly DOCUMENT_POSITION_CONTAINED_BY: number;
|
|
133
|
+
readonly DOCUMENT_POSITION_CONTAINS: number;
|
|
134
|
+
readonly DOCUMENT_POSITION_DISCONNECTED: number;
|
|
135
|
+
readonly DOCUMENT_POSITION_FOLLOWING: number;
|
|
136
|
+
readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;
|
|
137
|
+
readonly DOCUMENT_POSITION_PRECEDING: number;
|
|
138
|
+
readonly DOCUMENT_TYPE_NODE: number;
|
|
139
|
+
readonly ELEMENT_NODE: number;
|
|
140
|
+
readonly ENTITY_NODE: number;
|
|
141
|
+
readonly ENTITY_REFERENCE_NODE: number;
|
|
142
|
+
readonly NOTATION_NODE: number;
|
|
143
|
+
readonly PROCESSING_INSTRUCTION_NODE: number;
|
|
144
|
+
readonly TEXT_NODE: number;
|
|
145
|
+
dispatchEvent(event: Event): boolean;
|
|
146
|
+
ariaAtomic: string | null;
|
|
147
|
+
ariaAutoComplete: string | null;
|
|
148
|
+
ariaBusy: string | null;
|
|
149
|
+
ariaChecked: string | null;
|
|
150
|
+
ariaColCount: string | null;
|
|
151
|
+
ariaColIndex: string | null;
|
|
152
|
+
ariaColSpan: string | null;
|
|
153
|
+
ariaCurrent: string | null;
|
|
154
|
+
ariaDisabled: string | null;
|
|
155
|
+
ariaExpanded: string | null;
|
|
156
|
+
ariaHasPopup: string | null;
|
|
157
|
+
ariaHidden: string | null;
|
|
158
|
+
ariaKeyShortcuts: string | null;
|
|
159
|
+
ariaLabel: string | null;
|
|
160
|
+
ariaLevel: string | null;
|
|
161
|
+
ariaLive: string | null;
|
|
162
|
+
ariaModal: string | null;
|
|
163
|
+
ariaMultiLine: string | null;
|
|
164
|
+
ariaMultiSelectable: string | null;
|
|
165
|
+
ariaOrientation: string | null;
|
|
166
|
+
ariaPlaceholder: string | null;
|
|
167
|
+
ariaPosInSet: string | null;
|
|
168
|
+
ariaPressed: string | null;
|
|
169
|
+
ariaReadOnly: string | null;
|
|
170
|
+
ariaRequired: string | null;
|
|
171
|
+
ariaRoleDescription: string | null;
|
|
172
|
+
ariaRowCount: string | null;
|
|
173
|
+
ariaRowIndex: string | null;
|
|
174
|
+
ariaRowSpan: string | null;
|
|
175
|
+
ariaSelected: string | null;
|
|
176
|
+
ariaSetSize: string | null;
|
|
177
|
+
ariaSort: string | null;
|
|
178
|
+
ariaValueMax: string | null;
|
|
179
|
+
ariaValueMin: string | null;
|
|
180
|
+
ariaValueNow: string | null;
|
|
181
|
+
ariaValueText: string | null;
|
|
182
|
+
animate(keyframes: PropertyIndexedKeyframes | Keyframe[] | null, options?: number | KeyframeAnimationOptions | undefined): Animation;
|
|
183
|
+
getAnimations(options?: GetAnimationsOptions | undefined): Animation[];
|
|
184
|
+
after(...nodes: (string | Node)[]): void;
|
|
185
|
+
before(...nodes: (string | Node)[]): void;
|
|
186
|
+
remove(): void;
|
|
187
|
+
replaceWith(...nodes: (string | Node)[]): void;
|
|
188
|
+
innerHTML: string;
|
|
189
|
+
readonly nextElementSibling: Element | null;
|
|
190
|
+
readonly previousElementSibling: Element | null;
|
|
191
|
+
readonly childElementCount: number;
|
|
192
|
+
readonly children: HTMLCollection;
|
|
193
|
+
readonly firstElementChild: Element | null;
|
|
194
|
+
readonly lastElementChild: Element | null;
|
|
195
|
+
append(...nodes: (string | Node)[]): void;
|
|
196
|
+
prepend(...nodes: (string | Node)[]): void;
|
|
197
|
+
querySelector<K_6 extends keyof HTMLElementTagNameMap>(selectors: K_6): HTMLElementTagNameMap[K_6] | null;
|
|
198
|
+
querySelector<K_7 extends keyof SVGElementTagNameMap>(selectors: K_7): SVGElementTagNameMap[K_7] | null;
|
|
199
|
+
querySelector<E_1 extends Element = Element>(selectors: string): E_1 | null;
|
|
200
|
+
querySelectorAll<K_8 extends keyof HTMLElementTagNameMap>(selectors: K_8): NodeListOf<HTMLElementTagNameMap[K_8]>;
|
|
201
|
+
querySelectorAll<K_9 extends keyof SVGElementTagNameMap>(selectors: K_9): NodeListOf<SVGElementTagNameMap[K_9]>;
|
|
202
|
+
querySelectorAll<E_2 extends Element = Element>(selectors: string): NodeListOf<E_2>;
|
|
203
|
+
replaceChildren(...nodes: (string | Node)[]): void;
|
|
204
|
+
readonly assignedSlot: HTMLSlotElement | null;
|
|
205
|
+
oncopy: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
206
|
+
oncut: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
207
|
+
onpaste: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
208
|
+
readonly style: CSSStyleDeclaration;
|
|
209
|
+
contentEditable: string;
|
|
210
|
+
enterKeyHint: string;
|
|
211
|
+
inputMode: string;
|
|
212
|
+
readonly isContentEditable: boolean;
|
|
213
|
+
onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
214
|
+
onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
215
|
+
onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
216
|
+
onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
217
|
+
onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
218
|
+
onauxclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
219
|
+
onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
|
|
220
|
+
oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
221
|
+
oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
222
|
+
onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
223
|
+
onclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
224
|
+
onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
225
|
+
oncontextmenu: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
226
|
+
oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
227
|
+
ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
228
|
+
ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
229
|
+
ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
230
|
+
ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
231
|
+
ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
232
|
+
ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
233
|
+
ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
234
|
+
ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
235
|
+
ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
236
|
+
onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
237
|
+
onended: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
238
|
+
onerror: OnErrorEventHandler;
|
|
239
|
+
onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
|
|
240
|
+
onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null;
|
|
241
|
+
ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
242
|
+
oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
243
|
+
oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
244
|
+
onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
245
|
+
onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
246
|
+
onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
247
|
+
onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
248
|
+
onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
249
|
+
onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
250
|
+
onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
251
|
+
onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
252
|
+
onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
253
|
+
onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
254
|
+
onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
255
|
+
onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
256
|
+
onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
257
|
+
onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
258
|
+
onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
259
|
+
onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
260
|
+
onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
261
|
+
onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
262
|
+
onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
263
|
+
onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
264
|
+
onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
265
|
+
onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
266
|
+
onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
267
|
+
onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
268
|
+
onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
269
|
+
onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
270
|
+
onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent<EventTarget>) => any) | null;
|
|
271
|
+
onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
272
|
+
onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
273
|
+
onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
274
|
+
onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
275
|
+
onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null;
|
|
276
|
+
onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
277
|
+
onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
278
|
+
onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
279
|
+
onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
280
|
+
onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
281
|
+
onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
282
|
+
onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
283
|
+
onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null;
|
|
284
|
+
onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
285
|
+
ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
286
|
+
ontoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
287
|
+
ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
288
|
+
ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
289
|
+
ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
290
|
+
ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
291
|
+
ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
292
|
+
ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
293
|
+
ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
294
|
+
ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
295
|
+
onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
296
|
+
onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
297
|
+
onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
298
|
+
onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
299
|
+
onwebkitanimationstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
300
|
+
onwebkittransitionend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
301
|
+
onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
|
|
302
|
+
autofocus: boolean;
|
|
303
|
+
readonly dataset: DOMStringMap;
|
|
304
|
+
nonce?: string | undefined;
|
|
305
|
+
tabIndex: number;
|
|
306
|
+
blur(): void;
|
|
307
|
+
focus(options?: FocusOptions | undefined): void;
|
|
308
|
+
};
|
|
309
|
+
} & T;
|
|
310
|
+
export declare const UpgradableElement: {
|
|
311
|
+
new (...args: any[]): {
|
|
312
|
+
__upgradedProps: Map<keyof any, unknown>;
|
|
313
|
+
accessKey: string;
|
|
314
|
+
readonly accessKeyLabel: string;
|
|
315
|
+
autocapitalize: string;
|
|
316
|
+
dir: string;
|
|
317
|
+
draggable: boolean;
|
|
318
|
+
hidden: boolean;
|
|
319
|
+
innerText: string;
|
|
320
|
+
lang: string;
|
|
321
|
+
readonly offsetHeight: number;
|
|
322
|
+
readonly offsetLeft: number;
|
|
323
|
+
readonly offsetParent: Element | null;
|
|
324
|
+
readonly offsetTop: number;
|
|
325
|
+
readonly offsetWidth: number;
|
|
326
|
+
outerText: string;
|
|
327
|
+
spellcheck: boolean;
|
|
328
|
+
title: string;
|
|
329
|
+
translate: boolean;
|
|
330
|
+
attachInternals(): ElementInternals;
|
|
331
|
+
click(): void;
|
|
332
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
333
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
334
|
+
removeEventListener<K_1 extends keyof HTMLElementEventMap>(type: K_1, listener: (this: HTMLElement, ev: HTMLElementEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void;
|
|
335
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
|
336
|
+
connectedCallback?(): void;
|
|
337
|
+
disconnectedCallback?(): void;
|
|
338
|
+
attributeChangedCallback?(name: string, oldVal: string, newVal: string): void;
|
|
339
|
+
readonly attributes: NamedNodeMap;
|
|
340
|
+
readonly classList: DOMTokenList;
|
|
341
|
+
className: string;
|
|
342
|
+
readonly clientHeight: number;
|
|
343
|
+
readonly clientLeft: number;
|
|
344
|
+
readonly clientTop: number;
|
|
345
|
+
readonly clientWidth: number;
|
|
346
|
+
id: string;
|
|
347
|
+
readonly localName: string;
|
|
348
|
+
readonly namespaceURI: string | null;
|
|
349
|
+
onfullscreenchange: ((this: Element, ev: Event) => any) | null;
|
|
350
|
+
onfullscreenerror: ((this: Element, ev: Event) => any) | null;
|
|
351
|
+
outerHTML: string;
|
|
352
|
+
readonly ownerDocument: Document;
|
|
353
|
+
readonly part: DOMTokenList;
|
|
354
|
+
readonly prefix: string | null;
|
|
355
|
+
readonly scrollHeight: number;
|
|
356
|
+
scrollLeft: number;
|
|
357
|
+
scrollTop: number;
|
|
358
|
+
readonly scrollWidth: number;
|
|
359
|
+
readonly shadowRoot: ShadowRoot | null;
|
|
360
|
+
slot: string;
|
|
361
|
+
readonly tagName: string;
|
|
362
|
+
attachShadow(init: ShadowRootInit): ShadowRoot;
|
|
363
|
+
closest<K_2 extends keyof HTMLElementTagNameMap>(selector: K_2): HTMLElementTagNameMap[K_2] | null;
|
|
364
|
+
closest<K_3 extends keyof SVGElementTagNameMap>(selector: K_3): SVGElementTagNameMap[K_3] | null;
|
|
365
|
+
closest<E extends Element = Element>(selectors: string): E | null;
|
|
366
|
+
getAttribute(qualifiedName: string): string | null;
|
|
367
|
+
getAttributeNS(namespace: string | null, localName: string): string | null;
|
|
368
|
+
getAttributeNames(): string[];
|
|
369
|
+
getAttributeNode(qualifiedName: string): Attr | null;
|
|
370
|
+
getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
|
|
371
|
+
getBoundingClientRect(): DOMRect;
|
|
372
|
+
getClientRects(): DOMRectList;
|
|
373
|
+
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
|
|
374
|
+
getElementsByTagName<K_4 extends keyof HTMLElementTagNameMap>(qualifiedName: K_4): HTMLCollectionOf<HTMLElementTagNameMap[K_4]>;
|
|
375
|
+
getElementsByTagName<K_5 extends keyof SVGElementTagNameMap>(qualifiedName: K_5): HTMLCollectionOf<SVGElementTagNameMap[K_5]>;
|
|
376
|
+
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
|
|
377
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
|
|
378
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
|
|
379
|
+
getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;
|
|
380
|
+
hasAttribute(qualifiedName: string): boolean;
|
|
381
|
+
hasAttributeNS(namespace: string | null, localName: string): boolean;
|
|
382
|
+
hasAttributes(): boolean;
|
|
383
|
+
hasPointerCapture(pointerId: number): boolean;
|
|
384
|
+
insertAdjacentElement(where: InsertPosition, element: Element): Element | null;
|
|
385
|
+
insertAdjacentHTML(position: InsertPosition, text: string): void;
|
|
386
|
+
insertAdjacentText(where: InsertPosition, data: string): void;
|
|
387
|
+
matches(selectors: string): boolean;
|
|
388
|
+
releasePointerCapture(pointerId: number): void;
|
|
389
|
+
removeAttribute(qualifiedName: string): void;
|
|
390
|
+
removeAttributeNS(namespace: string | null, localName: string): void;
|
|
391
|
+
removeAttributeNode(attr: Attr): Attr;
|
|
392
|
+
requestFullscreen(options?: FullscreenOptions | undefined): Promise<void>;
|
|
393
|
+
requestPointerLock(): void;
|
|
394
|
+
scroll(options?: ScrollToOptions | undefined): void;
|
|
395
|
+
scroll(x: number, y: number): void;
|
|
396
|
+
scrollBy(options?: ScrollToOptions | undefined): void;
|
|
397
|
+
scrollBy(x: number, y: number): void;
|
|
398
|
+
scrollIntoView(arg?: boolean | ScrollIntoViewOptions | undefined): void;
|
|
399
|
+
scrollTo(options?: ScrollToOptions | undefined): void;
|
|
400
|
+
scrollTo(x: number, y: number): void;
|
|
401
|
+
setAttribute(qualifiedName: string, value: string): void;
|
|
402
|
+
setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
|
|
403
|
+
setAttributeNode(attr: Attr): Attr | null;
|
|
404
|
+
setAttributeNodeNS(attr: Attr): Attr | null;
|
|
405
|
+
setPointerCapture(pointerId: number): void;
|
|
406
|
+
toggleAttribute(qualifiedName: string, force?: boolean | undefined): boolean;
|
|
407
|
+
webkitMatchesSelector(selectors: string): boolean;
|
|
408
|
+
readonly baseURI: string;
|
|
409
|
+
readonly childNodes: NodeListOf<ChildNode>;
|
|
410
|
+
readonly firstChild: ChildNode | null;
|
|
411
|
+
readonly isConnected: boolean;
|
|
412
|
+
readonly lastChild: ChildNode | null;
|
|
413
|
+
readonly nextSibling: ChildNode | null;
|
|
414
|
+
readonly nodeName: string;
|
|
415
|
+
readonly nodeType: number;
|
|
416
|
+
nodeValue: string | null;
|
|
417
|
+
readonly parentElement: HTMLElement | null;
|
|
418
|
+
readonly parentNode: ParentNode | null;
|
|
419
|
+
readonly previousSibling: ChildNode | null;
|
|
420
|
+
textContent: string | null;
|
|
421
|
+
appendChild<T extends Node>(node: T): T;
|
|
422
|
+
cloneNode(deep?: boolean | undefined): Node;
|
|
423
|
+
compareDocumentPosition(other: Node): number;
|
|
424
|
+
contains(other: Node | null): boolean;
|
|
425
|
+
getRootNode(options?: GetRootNodeOptions | undefined): Node;
|
|
426
|
+
hasChildNodes(): boolean;
|
|
427
|
+
insertBefore<T_1 extends Node>(node: T_1, child: Node | null): T_1;
|
|
428
|
+
isDefaultNamespace(namespace: string | null): boolean;
|
|
429
|
+
isEqualNode(otherNode: Node | null): boolean;
|
|
430
|
+
isSameNode(otherNode: Node | null): boolean;
|
|
431
|
+
lookupNamespaceURI(prefix: string | null): string | null;
|
|
432
|
+
lookupPrefix(namespace: string | null): string | null;
|
|
433
|
+
normalize(): void;
|
|
434
|
+
removeChild<T_2 extends Node>(child: T_2): T_2;
|
|
435
|
+
replaceChild<T_3 extends Node>(node: Node, child: T_3): T_3;
|
|
436
|
+
readonly ATTRIBUTE_NODE: number;
|
|
437
|
+
readonly CDATA_SECTION_NODE: number;
|
|
438
|
+
readonly COMMENT_NODE: number;
|
|
439
|
+
readonly DOCUMENT_FRAGMENT_NODE: number;
|
|
440
|
+
readonly DOCUMENT_NODE: number;
|
|
441
|
+
readonly DOCUMENT_POSITION_CONTAINED_BY: number;
|
|
442
|
+
readonly DOCUMENT_POSITION_CONTAINS: number;
|
|
443
|
+
readonly DOCUMENT_POSITION_DISCONNECTED: number;
|
|
444
|
+
readonly DOCUMENT_POSITION_FOLLOWING: number;
|
|
445
|
+
readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;
|
|
446
|
+
readonly DOCUMENT_POSITION_PRECEDING: number;
|
|
447
|
+
readonly DOCUMENT_TYPE_NODE: number;
|
|
448
|
+
readonly ELEMENT_NODE: number;
|
|
449
|
+
readonly ENTITY_NODE: number;
|
|
450
|
+
readonly ENTITY_REFERENCE_NODE: number;
|
|
451
|
+
readonly NOTATION_NODE: number;
|
|
452
|
+
readonly PROCESSING_INSTRUCTION_NODE: number;
|
|
453
|
+
readonly TEXT_NODE: number;
|
|
454
|
+
dispatchEvent(event: Event): boolean;
|
|
455
|
+
ariaAtomic: string | null;
|
|
456
|
+
ariaAutoComplete: string | null;
|
|
457
|
+
ariaBusy: string | null;
|
|
458
|
+
ariaChecked: string | null;
|
|
459
|
+
ariaColCount: string | null;
|
|
460
|
+
ariaColIndex: string | null;
|
|
461
|
+
ariaColSpan: string | null;
|
|
462
|
+
ariaCurrent: string | null;
|
|
463
|
+
ariaDisabled: string | null;
|
|
464
|
+
ariaExpanded: string | null;
|
|
465
|
+
ariaHasPopup: string | null;
|
|
466
|
+
ariaHidden: string | null;
|
|
467
|
+
ariaKeyShortcuts: string | null;
|
|
468
|
+
ariaLabel: string | null;
|
|
469
|
+
ariaLevel: string | null;
|
|
470
|
+
ariaLive: string | null;
|
|
471
|
+
ariaModal: string | null;
|
|
472
|
+
ariaMultiLine: string | null;
|
|
473
|
+
ariaMultiSelectable: string | null;
|
|
474
|
+
ariaOrientation: string | null;
|
|
475
|
+
ariaPlaceholder: string | null;
|
|
476
|
+
ariaPosInSet: string | null;
|
|
477
|
+
ariaPressed: string | null;
|
|
478
|
+
ariaReadOnly: string | null;
|
|
479
|
+
ariaRequired: string | null;
|
|
480
|
+
ariaRoleDescription: string | null;
|
|
481
|
+
ariaRowCount: string | null;
|
|
482
|
+
ariaRowIndex: string | null;
|
|
483
|
+
ariaRowSpan: string | null;
|
|
484
|
+
ariaSelected: string | null;
|
|
485
|
+
ariaSetSize: string | null;
|
|
486
|
+
ariaSort: string | null;
|
|
487
|
+
ariaValueMax: string | null;
|
|
488
|
+
ariaValueMin: string | null;
|
|
489
|
+
ariaValueNow: string | null;
|
|
490
|
+
ariaValueText: string | null;
|
|
491
|
+
animate(keyframes: PropertyIndexedKeyframes | Keyframe[] | null, options?: number | KeyframeAnimationOptions | undefined): Animation;
|
|
492
|
+
getAnimations(options?: GetAnimationsOptions | undefined): Animation[];
|
|
493
|
+
after(...nodes: (string | Node)[]): void;
|
|
494
|
+
before(...nodes: (string | Node)[]): void;
|
|
495
|
+
remove(): void;
|
|
496
|
+
replaceWith(...nodes: (string | Node)[]): void;
|
|
497
|
+
innerHTML: string;
|
|
498
|
+
readonly nextElementSibling: Element | null;
|
|
499
|
+
readonly previousElementSibling: Element | null;
|
|
500
|
+
readonly childElementCount: number;
|
|
501
|
+
readonly children: HTMLCollection;
|
|
502
|
+
readonly firstElementChild: Element | null;
|
|
503
|
+
readonly lastElementChild: Element | null;
|
|
504
|
+
append(...nodes: (string | Node)[]): void;
|
|
505
|
+
prepend(...nodes: (string | Node)[]): void;
|
|
506
|
+
querySelector<K_6 extends keyof HTMLElementTagNameMap>(selectors: K_6): HTMLElementTagNameMap[K_6] | null;
|
|
507
|
+
querySelector<K_7 extends keyof SVGElementTagNameMap>(selectors: K_7): SVGElementTagNameMap[K_7] | null;
|
|
508
|
+
querySelector<E_1 extends Element = Element>(selectors: string): E_1 | null;
|
|
509
|
+
querySelectorAll<K_8 extends keyof HTMLElementTagNameMap>(selectors: K_8): NodeListOf<HTMLElementTagNameMap[K_8]>;
|
|
510
|
+
querySelectorAll<K_9 extends keyof SVGElementTagNameMap>(selectors: K_9): NodeListOf<SVGElementTagNameMap[K_9]>;
|
|
511
|
+
querySelectorAll<E_2 extends Element = Element>(selectors: string): NodeListOf<E_2>;
|
|
512
|
+
replaceChildren(...nodes: (string | Node)[]): void;
|
|
513
|
+
readonly assignedSlot: HTMLSlotElement | null;
|
|
514
|
+
oncopy: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
515
|
+
oncut: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
516
|
+
onpaste: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
517
|
+
readonly style: CSSStyleDeclaration;
|
|
518
|
+
contentEditable: string;
|
|
519
|
+
enterKeyHint: string;
|
|
520
|
+
inputMode: string;
|
|
521
|
+
readonly isContentEditable: boolean;
|
|
522
|
+
onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
523
|
+
onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
524
|
+
onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
525
|
+
onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
526
|
+
onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
527
|
+
onauxclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
528
|
+
onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
|
|
529
|
+
oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
530
|
+
oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
531
|
+
onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
532
|
+
onclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
533
|
+
onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
534
|
+
oncontextmenu: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
535
|
+
oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
536
|
+
ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
537
|
+
ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
538
|
+
ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
539
|
+
ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
540
|
+
ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
541
|
+
ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
542
|
+
ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
543
|
+
ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
544
|
+
ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
545
|
+
onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
546
|
+
onended: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
547
|
+
onerror: OnErrorEventHandler;
|
|
548
|
+
onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
|
|
549
|
+
onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null;
|
|
550
|
+
ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
551
|
+
oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
552
|
+
oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
553
|
+
onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
554
|
+
onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
555
|
+
onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
556
|
+
onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
557
|
+
onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
558
|
+
onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
559
|
+
onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
560
|
+
onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
561
|
+
onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
562
|
+
onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
563
|
+
onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
564
|
+
onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
565
|
+
onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
566
|
+
onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
567
|
+
onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
568
|
+
onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
569
|
+
onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
570
|
+
onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
571
|
+
onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
572
|
+
onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
573
|
+
onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
574
|
+
onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
575
|
+
onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
576
|
+
onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
577
|
+
onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
578
|
+
onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
579
|
+
onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent<EventTarget>) => any) | null;
|
|
580
|
+
onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
581
|
+
onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
582
|
+
onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
583
|
+
onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
584
|
+
onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null;
|
|
585
|
+
onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
586
|
+
onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
587
|
+
onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
588
|
+
onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
589
|
+
onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
590
|
+
onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
591
|
+
onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
592
|
+
onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null;
|
|
593
|
+
onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
594
|
+
ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
595
|
+
ontoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
596
|
+
ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
597
|
+
ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
598
|
+
ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
599
|
+
ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
600
|
+
ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
601
|
+
ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
602
|
+
ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
603
|
+
ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
604
|
+
onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
605
|
+
onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
606
|
+
onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
607
|
+
onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
608
|
+
onwebkitanimationstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
609
|
+
onwebkittransitionend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
610
|
+
onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
|
|
611
|
+
autofocus: boolean;
|
|
612
|
+
readonly dataset: DOMStringMap;
|
|
613
|
+
nonce?: string | undefined;
|
|
614
|
+
tabIndex: number;
|
|
615
|
+
blur(): void;
|
|
616
|
+
focus(options?: FocusOptions | undefined): void;
|
|
617
|
+
};
|
|
618
|
+
} & {
|
|
619
|
+
new (): HTMLElement;
|
|
620
|
+
prototype: HTMLElement;
|
|
621
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function upgradable(Base) {
|
|
2
|
+
return class Upgradeable extends Base {
|
|
3
|
+
constructor(...args) {
|
|
4
|
+
super(...args);
|
|
5
|
+
this.__upgradedProps = new Map();
|
|
6
|
+
for (let prop in this) {
|
|
7
|
+
if (this.hasOwnProperty(prop) && prop !== 'upgradedProps') {
|
|
8
|
+
this.__upgradedProps.set(prop, this[prop]);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export const UpgradableElement = upgradable(HTMLElement);
|
package/target/build/lib.d.ts
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
export { observable, Change,
|
|
1
|
+
export { observable, Change, OnPropertyChanged, observe, Changes } from './lib/observable.js';
|
|
2
|
+
export { attr } from './lib/attribute.js';
|
|
3
|
+
export { upgradable, UpgradableElement } from './lib/upgradable.js';
|
package/target/build/lib.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { observable, Change, observe } from './lib/observable';
|
|
2
|
-
|
|
1
|
+
export { observable, Change, observe } from './lib/observable.js';
|
|
2
|
+
export { attr } from './lib/attribute.js';
|
|
3
|
+
export { upgradable, UpgradableElement } from './lib/upgradable.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"observable.js","sourceRoot":"","sources":["../../../lib/observable.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,MAAM;IACE;IAAiB;IAAqC;IAAzE,YAAmB,KAAQ,EAAS,aAA4B,EAAS,WAAoB;QAA1E,UAAK,GAAL,KAAK,CAAG;QAAS,kBAAa,GAAb,aAAa,CAAe;QAAS,gBAAW,GAAX,WAAW,CAAS;IAAG,CAAC;CAClG;AAQD,MAAM,UAAU,gBAAgB,CAAC,CAAM;IACrC,OAAO,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,IAAI,EAAE,CAAC;AACtD,CAAC;AASD,MAAM,YAAY,GAAG,YAAY,CAAC;AAElC,MAAM,UAAU,OAAO,CAAC,MAAW,EAAE,GAAW;IAC9C,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IAClD,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,UAAU,CAAwC,aAAgB;IAChF,MAAM,IAAI,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAE7C,OAAO,MAAM,iBAAkB,SAAQ,aAAa;QAClD,WAAW,GAAY,EAAE,CAAC;QAC1B,UAAU,GAAyB,IAAI,CAAC;QACxC,kBAAkB,GAAG,IAAI,GAAG,EAAmB,CAAC;QAEhD,YAAY,GAAG,IAAW;YACxB,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YAEf,KAAK,IAAI,GAAG,IAAI,IAAI,EAAE;gBACpB,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;aAClE;YAED,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACvC,CAAC;QAED,gBAAgB,CAAC,GAAoB,EAAE,UAAkB;YACvD,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE;gBAC1B,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;aACpC;YAED,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;YAE/C,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;gBACpB,mDAAmD;gBACnD,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;oBAC5C,iEAAiE;oBAEjE,mFAAmF;oBACnF,KAAK,IAAI,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE;wBACnC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,WAAW,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;wBAE5E,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;qBACrC;oBAED,IAAI,IAAI,CAAC,QAAQ,EAAE;wBACjB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;qBACjC;oBAED,sBAAsB;oBACtB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;oBACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;gBACzB,CAAC,CAAC,CAAC;aACJ;YAED,OAAO,IAAI,CAAC,UAAU,CAAC;QACzB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAW;IACnC,OAAO,KAAK,GAAG,EAAE,CAAC;AACpB,CAAC;AAED,SAAS,wBAAwB,CAC/B,IAAiC;IAEjC,MAAM,KAAK,GAAuC,EAAE,CAAC;IAErD,KAAK,IAAI,GAAG,IAAI,IAAI,EAAE;QACpB,MAAM,UAAU,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAEzC,KAAK,CAAC,GAAG,CAAC,GAAG;YACX,GAAG,CAAuB,GAAG;gBAC3B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;gBAE9C,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;gBAE3D,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;YACrC,CAAC;YACD,GAAG;gBACD,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YACvC,CAAC;SACF,CAAC;KACH;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/target/build/lib.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAY,OAAO,EAAW,MAAM,kBAAkB,CAAC"}
|