@joist/element 3.0.7 → 3.0.8-next.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 +3 -4
- package/package.json +2 -3
- package/src/lib/attr.test.ts +1 -17
- package/src/lib/attr.ts +9 -44
- package/src/lib/element.test.ts +24 -0
- package/src/lib/element.ts +54 -0
- package/src/lib/tag-name.test.ts +2 -0
- package/src/lib/tag-name.ts +8 -9
- package/src/lib.ts +1 -0
- package/target/lib/attr.js +5 -28
- package/target/lib/attr.js.map +1 -1
- package/target/lib/attr.test.js +1 -39
- package/target/lib/attr.test.js.map +1 -1
- package/target/lib/element.d.ts +336 -0
- package/target/lib/element.js +37 -0
- package/target/lib/element.js.map +1 -0
- package/target/lib/element.test.d.ts +1 -0
- package/target/lib/element.test.js +63 -0
- package/target/lib/element.test.js.map +1 -0
- package/target/lib/result.js.map +1 -1
- package/target/lib/shadow.js.map +1 -1
- package/target/lib/tag-name.d.ts +4 -1
- package/target/lib/tag-name.js +6 -9
- package/target/lib/tag-name.js.map +1 -1
- package/target/lib/tag-name.test.js +16 -4
- package/target/lib/tag-name.test.js.map +1 -1
- package/target/lib/tags.js.map +1 -1
- package/target/lib.d.ts +1 -0
- package/target/lib.js +1 -0
- package/target/lib.js.map +1 -1
package/README.md
CHANGED
|
@@ -2,19 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Create a shadow root and apply styles and html as defined
|
|
4
4
|
|
|
5
|
-
## NOTE: This lastest version uses the stage-3 decorator proposal. This requires typescript >= 5.0 and many other tools do not yet support this latest syntax.
|
|
6
|
-
|
|
7
5
|
#### Installation:
|
|
8
6
|
|
|
9
7
|
```BASH
|
|
10
|
-
npm i @joist/element
|
|
8
|
+
npm i @joist/element
|
|
11
9
|
```
|
|
12
10
|
|
|
13
11
|
#### Example:
|
|
14
12
|
|
|
15
13
|
```TS
|
|
16
|
-
import { tagName, shadow, css, html, attr, listen } from '@joist/element';
|
|
14
|
+
import { tagName, shadow, css, html, attr, listen, element } from '@joist/element';
|
|
17
15
|
|
|
16
|
+
@element
|
|
18
17
|
export class MyElement extends HTMLElement {
|
|
19
18
|
// define a custom element
|
|
20
19
|
@tagName static tagName = 'my-element';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joist/element",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.8-next.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./target/lib.js",
|
|
6
6
|
"module": "./target/lib.js",
|
|
@@ -63,6 +63,5 @@
|
|
|
63
63
|
"build"
|
|
64
64
|
]
|
|
65
65
|
}
|
|
66
|
-
}
|
|
67
|
-
"gitHead": "e6e36105708633b45a0585b066a89f07a7ac78cb"
|
|
66
|
+
}
|
|
68
67
|
}
|
package/src/lib/attr.test.ts
CHANGED
|
@@ -2,23 +2,7 @@ import { expect, fixture, html } from '@open-wc/testing';
|
|
|
2
2
|
|
|
3
3
|
import { attr } from './attr.js';
|
|
4
4
|
|
|
5
|
-
describe('
|
|
6
|
-
it('should write default value to attribute', async () => {
|
|
7
|
-
class MyElement extends HTMLElement {
|
|
8
|
-
@attr accessor value1 = 'hello'; // no attribute
|
|
9
|
-
@attr accessor value2 = 0; // number
|
|
10
|
-
@attr accessor value3 = true; // boolean
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
customElements.define('attr-test-1', MyElement);
|
|
14
|
-
|
|
15
|
-
const el = await fixture(html`<attr-test-1></attr-test-1>`);
|
|
16
|
-
|
|
17
|
-
expect(el.getAttribute('value1')).to.equal('hello');
|
|
18
|
-
expect(el.getAttribute('value2')).to.equal('0');
|
|
19
|
-
expect(el.getAttribute('value3')).to.equal('');
|
|
20
|
-
});
|
|
21
|
-
|
|
5
|
+
describe('@attr()', () => {
|
|
22
6
|
it('should read and parse the correct values', async () => {
|
|
23
7
|
class MyElement extends HTMLElement {
|
|
24
8
|
@attr accessor value1 = 100; // no attribute
|
package/src/lib/attr.ts
CHANGED
|
@@ -1,52 +1,17 @@
|
|
|
1
|
+
// ensure that the metadata symbol exists
|
|
2
|
+
(Symbol as any).metadata ??= Symbol('Symbol.metadata');
|
|
3
|
+
|
|
4
|
+
import { ElementMetadata } from './element.js';
|
|
5
|
+
|
|
1
6
|
export function attr<This extends HTMLElement>(
|
|
2
7
|
{ get, set }: ClassAccessorDecoratorTarget<This, unknown>,
|
|
3
8
|
ctx: ClassAccessorDecoratorContext<This>
|
|
4
9
|
): ClassAccessorDecoratorResult<This, any> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (this.hasAttribute(ctx.name)) {
|
|
9
|
-
const attr = this.getAttribute(ctx.name);
|
|
10
|
-
|
|
11
|
-
// treat as boolean
|
|
12
|
-
if (attr === '') {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
10
|
+
ctx.metadata.el ??= new ElementMetadata();
|
|
11
|
+
const meta = ctx.metadata.el as ElementMetadata;
|
|
12
|
+
meta.attrs.push(String(ctx.name));
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
if (typeof value === 'number') {
|
|
18
|
-
return Number(attr);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// treat as string
|
|
22
|
-
return attr;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* should set attributes AFTER init to allow setup to complete
|
|
27
|
-
* this causes attribute changed callback to fire
|
|
28
|
-
* If the user attempts to read or write to this property in that cb it will fail
|
|
29
|
-
* this also normalizes when the attributeChangedCallback is called in different rendering scenarios
|
|
30
|
-
*/
|
|
31
|
-
Promise.resolve().then(() => {
|
|
32
|
-
const cached = get.call(this);
|
|
33
|
-
|
|
34
|
-
if (cached !== null && cached !== undefined && cached !== '') {
|
|
35
|
-
if (typeof cached === 'boolean') {
|
|
36
|
-
if (cached === true) {
|
|
37
|
-
// set boolean attribute
|
|
38
|
-
this.setAttribute(ctx.name.toString(), '');
|
|
39
|
-
}
|
|
40
|
-
} else {
|
|
41
|
-
// set key/value attribute
|
|
42
|
-
this.setAttribute(ctx.name.toString(), String(cached));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return value;
|
|
49
|
-
},
|
|
14
|
+
return {
|
|
50
15
|
set(value: unknown) {
|
|
51
16
|
if (typeof ctx.name === 'string') {
|
|
52
17
|
if (typeof value === 'boolean') {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
|
2
|
+
|
|
3
|
+
import { attr } from './attr.js';
|
|
4
|
+
import { element } from './element.js';
|
|
5
|
+
import { tagName } from './tag-name.js';
|
|
6
|
+
|
|
7
|
+
describe('@element()', () => {
|
|
8
|
+
it('should write default value to attribute', async () => {
|
|
9
|
+
@element
|
|
10
|
+
class MyElement extends HTMLElement {
|
|
11
|
+
@tagName static tag = 'element-1';
|
|
12
|
+
|
|
13
|
+
@attr accessor value1 = 'hello'; // no attribute
|
|
14
|
+
@attr accessor value2 = 0; // number
|
|
15
|
+
@attr accessor value3 = true; // boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const el = await fixture<MyElement>(html`<element-1></element-1>`);
|
|
19
|
+
|
|
20
|
+
expect(el.getAttribute('value1')).to.equal('hello');
|
|
21
|
+
expect(el.getAttribute('value2')).to.equal('0');
|
|
22
|
+
expect(el.getAttribute('value3')).to.equal('');
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
(Symbol as any).metadata ??= Symbol('Symbol.metadata');
|
|
2
|
+
|
|
3
|
+
export class ElementMetadata {
|
|
4
|
+
attrs: string[] = [];
|
|
5
|
+
tagName?: (val: unknown) => unknown;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ElementCtx {
|
|
9
|
+
el?: ElementMetadata;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function element<T extends new (...args: any[]) => HTMLElement>(
|
|
13
|
+
Base: T,
|
|
14
|
+
ctx: ClassDecoratorContext<T>
|
|
15
|
+
) {
|
|
16
|
+
ctx.metadata.el ??= new ElementMetadata();
|
|
17
|
+
const meta = ctx.metadata.el as ElementMetadata;
|
|
18
|
+
|
|
19
|
+
ctx.addInitializer(function (this: T) {
|
|
20
|
+
const val = meta.tagName!(this) as string;
|
|
21
|
+
|
|
22
|
+
if (!customElements.get(val)) {
|
|
23
|
+
customElements.define(val, this);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return class JoistElement extends Base {
|
|
28
|
+
// make all attrs observable
|
|
29
|
+
static observedAttributes = [...meta.attrs];
|
|
30
|
+
|
|
31
|
+
connectedCallback() {
|
|
32
|
+
for (let attr of meta.attrs) {
|
|
33
|
+
const value = Reflect.get(this, attr);
|
|
34
|
+
|
|
35
|
+
// reflect values back to attributes
|
|
36
|
+
if (value !== null && value !== undefined && value !== '') {
|
|
37
|
+
if (typeof value === 'boolean') {
|
|
38
|
+
if (value === true) {
|
|
39
|
+
// set boolean attribute
|
|
40
|
+
this.setAttribute(attr, '');
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
// set key/value attribute
|
|
44
|
+
this.setAttribute(attr, String(value));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (super.connectedCallback) {
|
|
50
|
+
super.connectedCallback();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
package/src/lib/tag-name.test.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { element } from './element.js';
|
|
1
2
|
import { tagName } from './tag-name.js';
|
|
2
3
|
|
|
3
4
|
describe('tag-name', () => {
|
|
4
5
|
it('should define a custom element', async () => {
|
|
6
|
+
@element
|
|
5
7
|
class MyElement extends HTMLElement {
|
|
6
8
|
@tagName static tagName = 'tn-test-1';
|
|
7
9
|
}
|
package/src/lib/tag-name.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
return function (this: CustomElementConstructor, val: string) {
|
|
3
|
-
Promise.resolve().then(() => {
|
|
4
|
-
if (!customElements.get(val)) {
|
|
5
|
-
customElements.define(val, this);
|
|
6
|
-
}
|
|
7
|
-
});
|
|
1
|
+
(Symbol as any).metadata ??= Symbol('Symbol.metadata');
|
|
8
2
|
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import { ElementCtx, ElementMetadata } from './element.js';
|
|
4
|
+
|
|
5
|
+
export function tagName(_val: unknown, ctx: ClassFieldDecoratorContext & { metadata: ElementCtx }) {
|
|
6
|
+
ctx.metadata.el ??= new ElementMetadata();
|
|
7
|
+
const meta = ctx.metadata.el as ElementMetadata;
|
|
8
|
+
|
|
9
|
+
meta.tagName = ctx.access.get;
|
|
11
10
|
}
|
package/src/lib.ts
CHANGED
package/target/lib/attr.js
CHANGED
|
@@ -1,33 +1,10 @@
|
|
|
1
|
+
Symbol.metadata ??= Symbol('Symbol.metadata');
|
|
2
|
+
import { ElementMetadata } from './element.js';
|
|
1
3
|
export function attr({ get, set }, ctx) {
|
|
4
|
+
ctx.metadata.el ??= new ElementMetadata();
|
|
5
|
+
const meta = ctx.metadata.el;
|
|
6
|
+
meta.attrs.push(String(ctx.name));
|
|
2
7
|
return {
|
|
3
|
-
init(value) {
|
|
4
|
-
if (typeof ctx.name === 'string') {
|
|
5
|
-
if (this.hasAttribute(ctx.name)) {
|
|
6
|
-
const attr = this.getAttribute(ctx.name);
|
|
7
|
-
if (attr === '') {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
if (typeof value === 'number') {
|
|
11
|
-
return Number(attr);
|
|
12
|
-
}
|
|
13
|
-
return attr;
|
|
14
|
-
}
|
|
15
|
-
Promise.resolve().then(() => {
|
|
16
|
-
const cached = get.call(this);
|
|
17
|
-
if (cached !== null && cached !== undefined && cached !== '') {
|
|
18
|
-
if (typeof cached === 'boolean') {
|
|
19
|
-
if (cached === true) {
|
|
20
|
-
this.setAttribute(ctx.name.toString(), '');
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
this.setAttribute(ctx.name.toString(), String(cached));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
return value;
|
|
30
|
-
},
|
|
31
8
|
set(value) {
|
|
32
9
|
if (typeof ctx.name === 'string') {
|
|
33
10
|
if (typeof value === 'boolean') {
|
package/target/lib/attr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attr.js","sourceRoot":"","sources":["../../src/lib/attr.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"attr.js","sourceRoot":"","sources":["../../src/lib/attr.ts"],"names":[],"mappings":"AACC,MAAc,CAAC,QAAQ,KAAK,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,UAAU,IAAI,CAClB,EAAE,GAAG,EAAE,GAAG,EAA+C,EACzD,GAAwC;IAExC,GAAG,CAAC,QAAQ,CAAC,EAAE,KAAK,IAAI,eAAe,EAAE,CAAC;IAC1C,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,EAAqB,CAAC;IAChD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAElC,OAAO;QACL,GAAG,CAAC,KAAc;YAChB,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACjC,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;oBAC/B,IAAI,KAAK,EAAE,CAAC;wBACV,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;oBAClC,CAAC;yBAAM,CAAC;wBACN,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBACjC,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC7C,CAAC;YACH,CAAC;YAED,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC/B,CAAC;QACD,GAAG;YACD,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAE/B,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACjC,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAEzC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;oBAElB,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;wBAChB,OAAO,IAAI,CAAC;oBACd,CAAC;oBAGD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;wBAChC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;oBACtB,CAAC;oBAGD,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;YAGD,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/target/lib/attr.test.js
CHANGED
|
@@ -1,45 +1,7 @@
|
|
|
1
1
|
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
2
|
import { expect, fixture, html } from '@open-wc/testing';
|
|
3
3
|
import { attr } from './attr.js';
|
|
4
|
-
describe('
|
|
5
|
-
it('should write default value to attribute', async () => {
|
|
6
|
-
let MyElement = (() => {
|
|
7
|
-
let _classSuper = HTMLElement;
|
|
8
|
-
let _instanceExtraInitializers = [];
|
|
9
|
-
let _value1_decorators;
|
|
10
|
-
let _value1_initializers = [];
|
|
11
|
-
let _value2_decorators;
|
|
12
|
-
let _value2_initializers = [];
|
|
13
|
-
let _value3_decorators;
|
|
14
|
-
let _value3_initializers = [];
|
|
15
|
-
return class MyElement extends _classSuper {
|
|
16
|
-
static {
|
|
17
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
18
|
-
_value1_decorators = [attr];
|
|
19
|
-
_value2_decorators = [attr];
|
|
20
|
-
_value3_decorators = [attr];
|
|
21
|
-
__esDecorate(this, null, _value1_decorators, { kind: "accessor", name: "value1", static: false, private: false, access: { has: obj => "value1" in obj, get: obj => obj.value1, set: (obj, value) => { obj.value1 = value; } }, metadata: _metadata }, _value1_initializers, _instanceExtraInitializers);
|
|
22
|
-
__esDecorate(this, null, _value2_decorators, { kind: "accessor", name: "value2", static: false, private: false, access: { has: obj => "value2" in obj, get: obj => obj.value2, set: (obj, value) => { obj.value2 = value; } }, metadata: _metadata }, _value2_initializers, _instanceExtraInitializers);
|
|
23
|
-
__esDecorate(this, null, _value3_decorators, { kind: "accessor", name: "value3", static: false, private: false, access: { has: obj => "value3" in obj, get: obj => obj.value3, set: (obj, value) => { obj.value3 = value; } }, metadata: _metadata }, _value3_initializers, _instanceExtraInitializers);
|
|
24
|
-
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
25
|
-
}
|
|
26
|
-
#value1_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _value1_initializers, 'hello'));
|
|
27
|
-
get value1() { return this.#value1_accessor_storage; }
|
|
28
|
-
set value1(value) { this.#value1_accessor_storage = value; }
|
|
29
|
-
#value2_accessor_storage = __runInitializers(this, _value2_initializers, 0);
|
|
30
|
-
get value2() { return this.#value2_accessor_storage; }
|
|
31
|
-
set value2(value) { this.#value2_accessor_storage = value; }
|
|
32
|
-
#value3_accessor_storage = __runInitializers(this, _value3_initializers, true);
|
|
33
|
-
get value3() { return this.#value3_accessor_storage; }
|
|
34
|
-
set value3(value) { this.#value3_accessor_storage = value; }
|
|
35
|
-
};
|
|
36
|
-
})();
|
|
37
|
-
customElements.define('attr-test-1', MyElement);
|
|
38
|
-
const el = await fixture(html `<attr-test-1></attr-test-1>`);
|
|
39
|
-
expect(el.getAttribute('value1')).to.equal('hello');
|
|
40
|
-
expect(el.getAttribute('value2')).to.equal('0');
|
|
41
|
-
expect(el.getAttribute('value3')).to.equal('');
|
|
42
|
-
});
|
|
4
|
+
describe('@attr()', () => {
|
|
43
5
|
it('should read and parse the correct values', async () => {
|
|
44
6
|
let MyElement = (() => {
|
|
45
7
|
let _classSuper = HTMLElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attr.test.js","sourceRoot":"","sources":["../../src/lib/attr.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"attr.test.js","sourceRoot":"","sources":["../../src/lib/attr.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,0CAA0C,EAAE,KAAK,IAAI,EAAE;YAClD,SAAS;8BAAS,WAAW;;;;;;;;;;yBAA7B,SAAU,SAAQ,WAAW;;;0CAChC,IAAI;0CACJ,IAAI;0CACJ,IAAI;0CACJ,IAAI;oBAHC,uKAAS,MAAM,6BAAN,MAAM,wFAAO;oBACtB,uKAAS,MAAM,6BAAN,MAAM,wFAAK;oBACpB,uKAAS,MAAM,6BAAN,MAAM,wFAAS;oBACxB,uKAAS,MAAM,6BAAN,MAAM,wFAAW;;;gBAH1B,+HAAkB,GAAG,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AAxB,IAAS,MAAM,4CAAS;gBAAxB,IAAS,MAAM,kDAAS;;;QAGhC,cAAc,CAAC,MAAM,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;QAEhD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAY,IAAI,CAAA,6BAA6B,CAAC,CAAC;QAEvE,EAAE,CAAC,MAAM,GAAG,OAAO,CAAC;QACpB,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC;QAChB,EAAE,CAAC,MAAM,GAAG,KAAK,CAAC;QAClB,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC;QAEjB,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACpD,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAClD,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QAC9C,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
export declare class ElementMetadata {
|
|
2
|
+
attrs: string[];
|
|
3
|
+
tagName?: (val: unknown) => unknown;
|
|
4
|
+
}
|
|
5
|
+
export interface ElementCtx {
|
|
6
|
+
el?: ElementMetadata;
|
|
7
|
+
}
|
|
8
|
+
export declare function element<T extends new (...args: any[]) => HTMLElement>(Base: T, ctx: ClassDecoratorContext<T>): {
|
|
9
|
+
new (...args: any[]): {
|
|
10
|
+
connectedCallback(): void;
|
|
11
|
+
accessKey: string;
|
|
12
|
+
readonly accessKeyLabel: string;
|
|
13
|
+
autocapitalize: string;
|
|
14
|
+
dir: string;
|
|
15
|
+
draggable: boolean;
|
|
16
|
+
hidden: boolean;
|
|
17
|
+
inert: boolean;
|
|
18
|
+
innerText: string;
|
|
19
|
+
lang: string;
|
|
20
|
+
readonly offsetHeight: number;
|
|
21
|
+
readonly offsetLeft: number;
|
|
22
|
+
readonly offsetParent: Element | null;
|
|
23
|
+
readonly offsetTop: number;
|
|
24
|
+
readonly offsetWidth: number;
|
|
25
|
+
outerText: string;
|
|
26
|
+
popover: string | null;
|
|
27
|
+
spellcheck: boolean;
|
|
28
|
+
title: string;
|
|
29
|
+
translate: boolean;
|
|
30
|
+
attachInternals(): ElementInternals;
|
|
31
|
+
click(): void;
|
|
32
|
+
hidePopover(): void;
|
|
33
|
+
showPopover(): void;
|
|
34
|
+
togglePopover(force?: boolean | undefined): void;
|
|
35
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
36
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
37
|
+
removeEventListener<K_1 extends keyof HTMLElementEventMap>(type: K_1, listener: (this: HTMLElement, ev: HTMLElementEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void;
|
|
38
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
|
39
|
+
disconnectedCallback?(): void;
|
|
40
|
+
readonly attributes: NamedNodeMap;
|
|
41
|
+
readonly classList: DOMTokenList;
|
|
42
|
+
className: string;
|
|
43
|
+
readonly clientHeight: number;
|
|
44
|
+
readonly clientLeft: number;
|
|
45
|
+
readonly clientTop: number;
|
|
46
|
+
readonly clientWidth: number;
|
|
47
|
+
id: string;
|
|
48
|
+
readonly localName: string;
|
|
49
|
+
readonly namespaceURI: string | null;
|
|
50
|
+
onfullscreenchange: ((this: Element, ev: Event) => any) | null;
|
|
51
|
+
onfullscreenerror: ((this: Element, ev: Event) => any) | null;
|
|
52
|
+
outerHTML: string;
|
|
53
|
+
readonly ownerDocument: Document;
|
|
54
|
+
readonly part: DOMTokenList;
|
|
55
|
+
readonly prefix: string | null;
|
|
56
|
+
readonly scrollHeight: number;
|
|
57
|
+
scrollLeft: number;
|
|
58
|
+
scrollTop: number;
|
|
59
|
+
readonly scrollWidth: number;
|
|
60
|
+
readonly shadowRoot: ShadowRoot | null;
|
|
61
|
+
slot: string;
|
|
62
|
+
readonly tagName: string;
|
|
63
|
+
attachShadow(init: ShadowRootInit): ShadowRoot;
|
|
64
|
+
checkVisibility(options?: CheckVisibilityOptions | undefined): boolean;
|
|
65
|
+
closest<K_2 extends keyof HTMLElementTagNameMap>(selector: K_2): HTMLElementTagNameMap[K_2] | null;
|
|
66
|
+
closest<K_3 extends keyof SVGElementTagNameMap>(selector: K_3): SVGElementTagNameMap[K_3] | null;
|
|
67
|
+
closest<K_4 extends keyof MathMLElementTagNameMap>(selector: K_4): MathMLElementTagNameMap[K_4] | null;
|
|
68
|
+
closest<E extends Element = Element>(selectors: string): E | null;
|
|
69
|
+
computedStyleMap(): StylePropertyMapReadOnly;
|
|
70
|
+
getAttribute(qualifiedName: string): string | null;
|
|
71
|
+
getAttributeNS(namespace: string | null, localName: string): string | null;
|
|
72
|
+
getAttributeNames(): string[];
|
|
73
|
+
getAttributeNode(qualifiedName: string): Attr | null;
|
|
74
|
+
getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
|
|
75
|
+
getBoundingClientRect(): DOMRect;
|
|
76
|
+
getClientRects(): DOMRectList;
|
|
77
|
+
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
|
|
78
|
+
getElementsByTagName<K_5 extends keyof HTMLElementTagNameMap>(qualifiedName: K_5): HTMLCollectionOf<HTMLElementTagNameMap[K_5]>;
|
|
79
|
+
getElementsByTagName<K_6 extends keyof SVGElementTagNameMap>(qualifiedName: K_6): HTMLCollectionOf<SVGElementTagNameMap[K_6]>;
|
|
80
|
+
getElementsByTagName<K_7 extends keyof MathMLElementTagNameMap>(qualifiedName: K_7): HTMLCollectionOf<MathMLElementTagNameMap[K_7]>;
|
|
81
|
+
getElementsByTagName<K_8 extends keyof HTMLElementDeprecatedTagNameMap>(qualifiedName: K_8): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K_8]>;
|
|
82
|
+
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
|
|
83
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
|
|
84
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
|
|
85
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", localName: string): HTMLCollectionOf<MathMLElement>;
|
|
86
|
+
getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;
|
|
87
|
+
hasAttribute(qualifiedName: string): boolean;
|
|
88
|
+
hasAttributeNS(namespace: string | null, localName: string): boolean;
|
|
89
|
+
hasAttributes(): boolean;
|
|
90
|
+
hasPointerCapture(pointerId: number): boolean;
|
|
91
|
+
insertAdjacentElement(where: InsertPosition, element: Element): Element | null;
|
|
92
|
+
insertAdjacentHTML(position: InsertPosition, text: string): void;
|
|
93
|
+
insertAdjacentText(where: InsertPosition, data: string): void;
|
|
94
|
+
matches(selectors: string): boolean;
|
|
95
|
+
releasePointerCapture(pointerId: number): void;
|
|
96
|
+
removeAttribute(qualifiedName: string): void;
|
|
97
|
+
removeAttributeNS(namespace: string | null, localName: string): void;
|
|
98
|
+
removeAttributeNode(attr: Attr): Attr;
|
|
99
|
+
requestFullscreen(options?: FullscreenOptions | undefined): Promise<void>;
|
|
100
|
+
requestPointerLock(): void;
|
|
101
|
+
scroll(options?: ScrollToOptions | undefined): void;
|
|
102
|
+
scroll(x: number, y: number): void;
|
|
103
|
+
scrollBy(options?: ScrollToOptions | undefined): void;
|
|
104
|
+
scrollBy(x: number, y: number): void;
|
|
105
|
+
scrollIntoView(arg?: boolean | ScrollIntoViewOptions | undefined): void;
|
|
106
|
+
scrollTo(options?: ScrollToOptions | undefined): void;
|
|
107
|
+
scrollTo(x: number, y: number): void;
|
|
108
|
+
setAttribute(qualifiedName: string, value: string): void;
|
|
109
|
+
setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
|
|
110
|
+
setAttributeNode(attr: Attr): Attr | null;
|
|
111
|
+
setAttributeNodeNS(attr: Attr): Attr | null;
|
|
112
|
+
setPointerCapture(pointerId: number): void;
|
|
113
|
+
toggleAttribute(qualifiedName: string, force?: boolean | undefined): boolean;
|
|
114
|
+
webkitMatchesSelector(selectors: string): boolean;
|
|
115
|
+
readonly baseURI: string;
|
|
116
|
+
readonly childNodes: NodeListOf<ChildNode>;
|
|
117
|
+
readonly firstChild: ChildNode | null;
|
|
118
|
+
readonly isConnected: boolean;
|
|
119
|
+
readonly lastChild: ChildNode | null;
|
|
120
|
+
readonly nextSibling: ChildNode | null;
|
|
121
|
+
readonly nodeName: string;
|
|
122
|
+
readonly nodeType: number;
|
|
123
|
+
nodeValue: string | null;
|
|
124
|
+
readonly parentElement: HTMLElement | null;
|
|
125
|
+
readonly parentNode: ParentNode | null;
|
|
126
|
+
readonly previousSibling: ChildNode | null;
|
|
127
|
+
textContent: string | null;
|
|
128
|
+
appendChild<T extends Node>(node: T): T;
|
|
129
|
+
cloneNode(deep?: boolean | undefined): Node;
|
|
130
|
+
compareDocumentPosition(other: Node): number;
|
|
131
|
+
contains(other: Node | null): boolean;
|
|
132
|
+
getRootNode(options?: GetRootNodeOptions | undefined): Node;
|
|
133
|
+
hasChildNodes(): boolean;
|
|
134
|
+
insertBefore<T_1 extends Node>(node: T_1, child: Node | null): T_1;
|
|
135
|
+
isDefaultNamespace(namespace: string | null): boolean;
|
|
136
|
+
isEqualNode(otherNode: Node | null): boolean;
|
|
137
|
+
isSameNode(otherNode: Node | null): boolean;
|
|
138
|
+
lookupNamespaceURI(prefix: string | null): string | null;
|
|
139
|
+
lookupPrefix(namespace: string | null): string | null;
|
|
140
|
+
normalize(): void;
|
|
141
|
+
removeChild<T_2 extends Node>(child: T_2): T_2;
|
|
142
|
+
replaceChild<T_3 extends Node>(node: Node, child: T_3): T_3;
|
|
143
|
+
readonly ELEMENT_NODE: 1;
|
|
144
|
+
readonly ATTRIBUTE_NODE: 2;
|
|
145
|
+
readonly TEXT_NODE: 3;
|
|
146
|
+
readonly CDATA_SECTION_NODE: 4;
|
|
147
|
+
readonly ENTITY_REFERENCE_NODE: 5;
|
|
148
|
+
readonly ENTITY_NODE: 6;
|
|
149
|
+
readonly PROCESSING_INSTRUCTION_NODE: 7;
|
|
150
|
+
readonly COMMENT_NODE: 8;
|
|
151
|
+
readonly DOCUMENT_NODE: 9;
|
|
152
|
+
readonly DOCUMENT_TYPE_NODE: 10;
|
|
153
|
+
readonly DOCUMENT_FRAGMENT_NODE: 11;
|
|
154
|
+
readonly NOTATION_NODE: 12;
|
|
155
|
+
readonly DOCUMENT_POSITION_DISCONNECTED: 1;
|
|
156
|
+
readonly DOCUMENT_POSITION_PRECEDING: 2;
|
|
157
|
+
readonly DOCUMENT_POSITION_FOLLOWING: 4;
|
|
158
|
+
readonly DOCUMENT_POSITION_CONTAINS: 8;
|
|
159
|
+
readonly DOCUMENT_POSITION_CONTAINED_BY: 16;
|
|
160
|
+
readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32;
|
|
161
|
+
dispatchEvent(event: Event): boolean;
|
|
162
|
+
ariaAtomic: string | null;
|
|
163
|
+
ariaAutoComplete: string | null;
|
|
164
|
+
ariaBusy: string | null;
|
|
165
|
+
ariaChecked: string | null;
|
|
166
|
+
ariaColCount: string | null;
|
|
167
|
+
ariaColIndex: string | null;
|
|
168
|
+
ariaColSpan: string | null;
|
|
169
|
+
ariaCurrent: string | null;
|
|
170
|
+
ariaDisabled: string | null;
|
|
171
|
+
ariaExpanded: string | null;
|
|
172
|
+
ariaHasPopup: string | null;
|
|
173
|
+
ariaHidden: string | null;
|
|
174
|
+
ariaInvalid: string | null;
|
|
175
|
+
ariaKeyShortcuts: string | null;
|
|
176
|
+
ariaLabel: string | null;
|
|
177
|
+
ariaLevel: string | null;
|
|
178
|
+
ariaLive: string | null;
|
|
179
|
+
ariaModal: string | null;
|
|
180
|
+
ariaMultiLine: string | null;
|
|
181
|
+
ariaMultiSelectable: string | null;
|
|
182
|
+
ariaOrientation: string | null;
|
|
183
|
+
ariaPlaceholder: string | null;
|
|
184
|
+
ariaPosInSet: string | null;
|
|
185
|
+
ariaPressed: string | null;
|
|
186
|
+
ariaReadOnly: string | null;
|
|
187
|
+
ariaRequired: string | null;
|
|
188
|
+
ariaRoleDescription: string | null;
|
|
189
|
+
ariaRowCount: string | null;
|
|
190
|
+
ariaRowIndex: string | null;
|
|
191
|
+
ariaRowSpan: string | null;
|
|
192
|
+
ariaSelected: string | null;
|
|
193
|
+
ariaSetSize: string | null;
|
|
194
|
+
ariaSort: string | null;
|
|
195
|
+
ariaValueMax: string | null;
|
|
196
|
+
ariaValueMin: string | null;
|
|
197
|
+
ariaValueNow: string | null;
|
|
198
|
+
ariaValueText: string | null;
|
|
199
|
+
role: string | null;
|
|
200
|
+
animate(keyframes: PropertyIndexedKeyframes | Keyframe[] | null, options?: number | KeyframeAnimationOptions | undefined): Animation;
|
|
201
|
+
getAnimations(options?: GetAnimationsOptions | undefined): Animation[];
|
|
202
|
+
after(...nodes: (string | Node)[]): void;
|
|
203
|
+
before(...nodes: (string | Node)[]): void;
|
|
204
|
+
remove(): void;
|
|
205
|
+
replaceWith(...nodes: (string | Node)[]): void;
|
|
206
|
+
innerHTML: string;
|
|
207
|
+
readonly nextElementSibling: Element | null;
|
|
208
|
+
readonly previousElementSibling: Element | null;
|
|
209
|
+
readonly childElementCount: number;
|
|
210
|
+
readonly children: HTMLCollection;
|
|
211
|
+
readonly firstElementChild: Element | null;
|
|
212
|
+
readonly lastElementChild: Element | null;
|
|
213
|
+
append(...nodes: (string | Node)[]): void;
|
|
214
|
+
prepend(...nodes: (string | Node)[]): void;
|
|
215
|
+
querySelector<K_9 extends keyof HTMLElementTagNameMap>(selectors: K_9): HTMLElementTagNameMap[K_9] | null;
|
|
216
|
+
querySelector<K_10 extends keyof SVGElementTagNameMap>(selectors: K_10): SVGElementTagNameMap[K_10] | null;
|
|
217
|
+
querySelector<K_11 extends keyof MathMLElementTagNameMap>(selectors: K_11): MathMLElementTagNameMap[K_11] | null;
|
|
218
|
+
querySelector<K_12 extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K_12): HTMLElementDeprecatedTagNameMap[K_12] | null;
|
|
219
|
+
querySelector<E_1 extends Element = Element>(selectors: string): E_1 | null;
|
|
220
|
+
querySelectorAll<K_13 extends keyof HTMLElementTagNameMap>(selectors: K_13): NodeListOf<HTMLElementTagNameMap[K_13]>;
|
|
221
|
+
querySelectorAll<K_14 extends keyof SVGElementTagNameMap>(selectors: K_14): NodeListOf<SVGElementTagNameMap[K_14]>;
|
|
222
|
+
querySelectorAll<K_15 extends keyof MathMLElementTagNameMap>(selectors: K_15): NodeListOf<MathMLElementTagNameMap[K_15]>;
|
|
223
|
+
querySelectorAll<K_16 extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K_16): NodeListOf<HTMLElementDeprecatedTagNameMap[K_16]>;
|
|
224
|
+
querySelectorAll<E_2 extends Element = Element>(selectors: string): NodeListOf<E_2>;
|
|
225
|
+
replaceChildren(...nodes: (string | Node)[]): void;
|
|
226
|
+
readonly assignedSlot: HTMLSlotElement | null;
|
|
227
|
+
readonly attributeStyleMap: StylePropertyMap;
|
|
228
|
+
readonly style: CSSStyleDeclaration;
|
|
229
|
+
contentEditable: string;
|
|
230
|
+
enterKeyHint: string;
|
|
231
|
+
inputMode: string;
|
|
232
|
+
readonly isContentEditable: boolean;
|
|
233
|
+
onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
234
|
+
onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
235
|
+
onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
236
|
+
onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
237
|
+
onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
238
|
+
onauxclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
239
|
+
onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null;
|
|
240
|
+
onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
|
|
241
|
+
oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
242
|
+
oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
243
|
+
oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
244
|
+
onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
245
|
+
onclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
246
|
+
onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
247
|
+
oncontextmenu: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
248
|
+
oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
249
|
+
oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
250
|
+
oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
251
|
+
ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
252
|
+
ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
253
|
+
ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
254
|
+
ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
255
|
+
ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
256
|
+
ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
257
|
+
ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
258
|
+
ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
259
|
+
ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
260
|
+
onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
261
|
+
onended: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
262
|
+
onerror: OnErrorEventHandler;
|
|
263
|
+
onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
|
|
264
|
+
onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null;
|
|
265
|
+
ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
266
|
+
oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
267
|
+
oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
268
|
+
onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
269
|
+
onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
270
|
+
onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
271
|
+
onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
272
|
+
onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
273
|
+
onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
274
|
+
onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
275
|
+
onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
276
|
+
onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
277
|
+
onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
278
|
+
onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
279
|
+
onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
280
|
+
onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
281
|
+
onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
282
|
+
onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
283
|
+
onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
284
|
+
onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
285
|
+
onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
286
|
+
onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
287
|
+
onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
288
|
+
onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
289
|
+
onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
290
|
+
onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
291
|
+
onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
292
|
+
onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
293
|
+
onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
294
|
+
onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
295
|
+
onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent<EventTarget>) => any) | null;
|
|
296
|
+
onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
297
|
+
onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
298
|
+
onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
299
|
+
onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
300
|
+
onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
301
|
+
onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null;
|
|
302
|
+
onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
303
|
+
onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
304
|
+
onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
305
|
+
onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
306
|
+
onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
307
|
+
onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
308
|
+
onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
309
|
+
onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null;
|
|
310
|
+
onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
311
|
+
ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
312
|
+
ontoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
313
|
+
ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
314
|
+
ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
315
|
+
ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
316
|
+
ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
317
|
+
ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
318
|
+
ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
319
|
+
ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
320
|
+
ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
321
|
+
onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
322
|
+
onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
323
|
+
onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
324
|
+
onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
325
|
+
onwebkitanimationstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
326
|
+
onwebkittransitionend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
327
|
+
onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
|
|
328
|
+
autofocus: boolean;
|
|
329
|
+
readonly dataset: DOMStringMap;
|
|
330
|
+
nonce?: string | undefined;
|
|
331
|
+
tabIndex: number;
|
|
332
|
+
blur(): void;
|
|
333
|
+
focus(options?: FocusOptions | undefined): void;
|
|
334
|
+
};
|
|
335
|
+
observedAttributes: string[];
|
|
336
|
+
} & T;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Symbol.metadata ??= Symbol('Symbol.metadata');
|
|
2
|
+
export class ElementMetadata {
|
|
3
|
+
attrs = [];
|
|
4
|
+
tagName;
|
|
5
|
+
}
|
|
6
|
+
export function element(Base, ctx) {
|
|
7
|
+
ctx.metadata.el ??= new ElementMetadata();
|
|
8
|
+
const meta = ctx.metadata.el;
|
|
9
|
+
ctx.addInitializer(function () {
|
|
10
|
+
const val = meta.tagName(this);
|
|
11
|
+
if (!customElements.get(val)) {
|
|
12
|
+
customElements.define(val, this);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return class JoistElement extends Base {
|
|
16
|
+
static observedAttributes = [...meta.attrs];
|
|
17
|
+
connectedCallback() {
|
|
18
|
+
for (let attr of meta.attrs) {
|
|
19
|
+
const value = Reflect.get(this, attr);
|
|
20
|
+
if (value !== null && value !== undefined && value !== '') {
|
|
21
|
+
if (typeof value === 'boolean') {
|
|
22
|
+
if (value === true) {
|
|
23
|
+
this.setAttribute(attr, '');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
this.setAttribute(attr, String(value));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (super.connectedCallback) {
|
|
32
|
+
super.connectedCallback();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../src/lib/element.ts"],"names":[],"mappings":"AAAC,MAAc,CAAC,QAAQ,KAAK,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAEvD,MAAM,OAAO,eAAe;IAC1B,KAAK,GAAa,EAAE,CAAC;IACrB,OAAO,CAA6B;CACrC;AAMD,MAAM,UAAU,OAAO,CACrB,IAAO,EACP,GAA6B;IAE7B,GAAG,CAAC,QAAQ,CAAC,EAAE,KAAK,IAAI,eAAe,EAAE,CAAC;IAC1C,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,EAAqB,CAAC;IAEhD,GAAG,CAAC,cAAc,CAAC;QACjB,MAAM,GAAG,GAAG,IAAI,CAAC,OAAQ,CAAC,IAAI,CAAW,CAAC;QAE1C,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,cAAc,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,YAAa,SAAQ,IAAI;QAEpC,MAAM,CAAC,kBAAkB,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QAE5C,iBAAiB;YACf,KAAK,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAGtC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;oBAC1D,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;wBAC/B,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;4BAEnB,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;wBAC9B,CAAC;oBACH,CAAC;yBAAM,CAAC;wBAEN,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;oBACzC,CAAC;gBACH,CAAC;YACH,CAAC;YAED,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;gBAC5B,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
|
3
|
+
import { attr } from './attr.js';
|
|
4
|
+
import { element } from './element.js';
|
|
5
|
+
import { tagName } from './tag-name.js';
|
|
6
|
+
describe('@element()', () => {
|
|
7
|
+
it('should write default value to attribute', async () => {
|
|
8
|
+
let MyElement = (() => {
|
|
9
|
+
let _classDecorators = [element];
|
|
10
|
+
let _classDescriptor;
|
|
11
|
+
let _classExtraInitializers = [];
|
|
12
|
+
let _classThis;
|
|
13
|
+
let _classSuper = HTMLElement;
|
|
14
|
+
let _staticExtraInitializers = [];
|
|
15
|
+
let _instanceExtraInitializers = [];
|
|
16
|
+
let _static_tag_decorators;
|
|
17
|
+
let _static_tag_initializers = [];
|
|
18
|
+
let _value1_decorators;
|
|
19
|
+
let _value1_initializers = [];
|
|
20
|
+
let _value2_decorators;
|
|
21
|
+
let _value2_initializers = [];
|
|
22
|
+
let _value3_decorators;
|
|
23
|
+
let _value3_initializers = [];
|
|
24
|
+
var MyElement = class extends _classSuper {
|
|
25
|
+
static { _classThis = this; }
|
|
26
|
+
static {
|
|
27
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
28
|
+
_static_tag_decorators = [tagName];
|
|
29
|
+
_value1_decorators = [attr];
|
|
30
|
+
_value2_decorators = [attr];
|
|
31
|
+
_value3_decorators = [attr];
|
|
32
|
+
__esDecorate(this, null, _value1_decorators, { kind: "accessor", name: "value1", static: false, private: false, access: { has: obj => "value1" in obj, get: obj => obj.value1, set: (obj, value) => { obj.value1 = value; } }, metadata: _metadata }, _value1_initializers, _instanceExtraInitializers);
|
|
33
|
+
__esDecorate(this, null, _value2_decorators, { kind: "accessor", name: "value2", static: false, private: false, access: { has: obj => "value2" in obj, get: obj => obj.value2, set: (obj, value) => { obj.value2 = value; } }, metadata: _metadata }, _value2_initializers, _instanceExtraInitializers);
|
|
34
|
+
__esDecorate(this, null, _value3_decorators, { kind: "accessor", name: "value3", static: false, private: false, access: { has: obj => "value3" in obj, get: obj => obj.value3, set: (obj, value) => { obj.value3 = value; } }, metadata: _metadata }, _value3_initializers, _instanceExtraInitializers);
|
|
35
|
+
__esDecorate(null, null, _static_tag_decorators, { kind: "field", name: "tag", static: true, private: false, access: { has: obj => "tag" in obj, get: obj => obj.tag, set: (obj, value) => { obj.tag = value; } }, metadata: _metadata }, _static_tag_initializers, _staticExtraInitializers);
|
|
36
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
37
|
+
MyElement = _classThis = _classDescriptor.value;
|
|
38
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
39
|
+
__runInitializers(_classThis, _staticExtraInitializers);
|
|
40
|
+
}
|
|
41
|
+
static tag = __runInitializers(_classThis, _static_tag_initializers, 'element-1');
|
|
42
|
+
#value1_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _value1_initializers, 'hello'));
|
|
43
|
+
get value1() { return this.#value1_accessor_storage; }
|
|
44
|
+
set value1(value) { this.#value1_accessor_storage = value; }
|
|
45
|
+
#value2_accessor_storage = __runInitializers(this, _value2_initializers, 0);
|
|
46
|
+
get value2() { return this.#value2_accessor_storage; }
|
|
47
|
+
set value2(value) { this.#value2_accessor_storage = value; }
|
|
48
|
+
#value3_accessor_storage = __runInitializers(this, _value3_initializers, true);
|
|
49
|
+
get value3() { return this.#value3_accessor_storage; }
|
|
50
|
+
set value3(value) { this.#value3_accessor_storage = value; }
|
|
51
|
+
static {
|
|
52
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return MyElement = _classThis;
|
|
56
|
+
})();
|
|
57
|
+
const el = await fixture(html `<element-1></element-1>`);
|
|
58
|
+
expect(el.getAttribute('value1')).to.equal('hello');
|
|
59
|
+
expect(el.getAttribute('value2')).to.equal('0');
|
|
60
|
+
expect(el.getAttribute('value3')).to.equal('');
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=element.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.test.js","sourceRoot":"","sources":["../../src/lib/element.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;YAEjD,SAAS;oCADd,OAAO;;;;8BACgB,WAAW;;;;;;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Q;IAEd,OAAO,GAA2B,SAAS,CAAC;IAE5C,IAAI,MAAM;QACR,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/lib/result.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,YAAY;IAChC,OAAO,CAAuB;IAC9B,MAAM,CAAQ;IAEd,OAAO,GAA2B,SAAS,CAAC;IAE5C,IAAI,MAAM;QACR,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,YAAY,GAAyB,EAAE,GAAG,MAAa;QACrD,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,OAAO,CAAC,IAAgB;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAEpB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;CAGF"}
|
package/target/lib/shadow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadow.js","sourceRoot":"","sources":["../../src/lib/shadow.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,MAAM,CACpB,CAAY,EACZ,GAAwC;IAExC,GAAG,CAAC,cAAc,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"shadow.js","sourceRoot":"","sources":["../../src/lib/shadow.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,MAAM,CACpB,CAAY,EACZ,GAAwC;IAExC,GAAG,CAAC,cAAc,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,UAAsB,MAAS;QACpC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,UAAW,CAAC,CAAC;QAEjC,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
|
package/target/lib/tag-name.d.ts
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { ElementCtx } from './element.js';
|
|
2
|
+
export declare function tagName(_val: unknown, ctx: ClassFieldDecoratorContext & {
|
|
3
|
+
metadata: ElementCtx;
|
|
4
|
+
}): void;
|
package/target/lib/tag-name.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
return val;
|
|
9
|
-
};
|
|
1
|
+
Symbol.metadata ??= Symbol('Symbol.metadata');
|
|
2
|
+
import { ElementMetadata } from './element.js';
|
|
3
|
+
export function tagName(_val, ctx) {
|
|
4
|
+
ctx.metadata.el ??= new ElementMetadata();
|
|
5
|
+
const meta = ctx.metadata.el;
|
|
6
|
+
meta.tagName = ctx.access.get;
|
|
10
7
|
}
|
|
11
8
|
//# sourceMappingURL=tag-name.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag-name.js","sourceRoot":"","sources":["../../src/lib/tag-name.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tag-name.js","sourceRoot":"","sources":["../../src/lib/tag-name.ts"],"names":[],"mappings":"AAAC,MAAc,CAAC,QAAQ,KAAK,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAEvD,OAAO,EAAc,eAAe,EAAE,MAAM,cAAc,CAAC;AAE3D,MAAM,UAAU,OAAO,CAAC,IAAa,EAAE,GAA0D;IAC/F,GAAG,CAAC,QAAQ,CAAC,EAAE,KAAK,IAAI,eAAe,EAAE,CAAC;IAC1C,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,EAAqB,CAAC;IAEhD,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC;AAChC,CAAC"}
|
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { element } from './element.js';
|
|
2
3
|
import { tagName } from './tag-name.js';
|
|
3
4
|
describe('tag-name', () => {
|
|
4
5
|
it('should define a custom element', async () => {
|
|
5
6
|
let MyElement = (() => {
|
|
7
|
+
let _classDecorators = [element];
|
|
8
|
+
let _classDescriptor;
|
|
9
|
+
let _classExtraInitializers = [];
|
|
10
|
+
let _classThis;
|
|
6
11
|
let _classSuper = HTMLElement;
|
|
7
12
|
let _staticExtraInitializers = [];
|
|
8
13
|
let _static_tagName_decorators;
|
|
9
14
|
let _static_tagName_initializers = [];
|
|
10
|
-
|
|
15
|
+
var MyElement = class extends _classSuper {
|
|
16
|
+
static { _classThis = this; }
|
|
11
17
|
static {
|
|
12
18
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
13
19
|
_static_tagName_decorators = [tagName];
|
|
14
20
|
__esDecorate(null, null, _static_tagName_decorators, { kind: "field", name: "tagName", static: true, private: false, access: { has: obj => "tagName" in obj, get: obj => obj.tagName, set: (obj, value) => { obj.tagName = value; } }, metadata: _metadata }, _static_tagName_initializers, _staticExtraInitializers);
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
22
|
+
MyElement = _classThis = _classDescriptor.value;
|
|
23
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
24
|
+
__runInitializers(_classThis, _staticExtraInitializers);
|
|
25
|
+
}
|
|
26
|
+
static tagName = __runInitializers(_classThis, _static_tagName_initializers, 'tn-test-1');
|
|
27
|
+
static {
|
|
28
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
17
29
|
}
|
|
18
|
-
static tagName = __runInitializers(this, _static_tagName_initializers, 'tn-test-1');
|
|
19
30
|
};
|
|
31
|
+
return MyElement = _classThis;
|
|
20
32
|
})();
|
|
21
33
|
return customElements.whenDefined(MyElement.tagName);
|
|
22
34
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag-name.test.js","sourceRoot":"","sources":["../../src/lib/tag-name.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,gCAAgC,EAAE,KAAK,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"tag-name.test.js","sourceRoot":"","sources":["../../src/lib/tag-name.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,gCAAgC,EAAE,KAAK,IAAI,EAAE;YAExC,SAAS;oCADd,OAAO;;;;8BACgB,WAAW;;;;iCAAnB,SAAQ,WAAW;;;;kDAChC,OAAO;oBAAC,6KAAO,OAAO,6BAAP,OAAO,8FAAe;oBADxC,6KAEC;;;oBAFK,wDAAS;;gBACJ,MAAM,CAAC,OAAO,+DAAG,WAAW,EAAC;;oBADlC,uDAAS;;;;;QAIf,OAAO,cAAc,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/target/lib/tags.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../src/lib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AAE,CAAC;QACxC,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/target/lib.d.ts
CHANGED
package/target/lib.js
CHANGED
package/target/lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
|