@zcomponent/html 1.4.2 → 2.0.0-alpha.2
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 +1 -0
- package/index.js +0 -3
- package/lib/CSS.d.ts +6 -8
- package/lib/CSS.js +89 -37
- package/lib/HTMLElement.d.ts +183 -103
- package/lib/HTMLElement.js +380 -155
- package/lib/button.d.ts +12 -2
- package/lib/button.js +69 -7
- package/lib/context.d.ts +1 -1
- package/lib/context.js +4 -7
- package/lib/div.d.ts +11 -2
- package/lib/div.js +68 -7
- package/lib/headings.d.ts +24 -18
- package/lib/headings.js +193 -45
- package/lib/i.d.ts +3 -2
- package/lib/i.js +60 -7
- package/lib/img.d.ts +8 -8
- package/lib/img.js +74 -14
- package/lib/span.d.ts +3 -2
- package/lib/span.js +60 -7
- package/package.json +19 -2
package/lib/img.js
CHANGED
|
@@ -1,18 +1,78 @@
|
|
|
1
|
-
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
35
|
+
import { zComponent, zLoad } from '@zcomponent/core';
|
|
2
36
|
import { ZHTMLElement } from './HTMLElement';
|
|
3
|
-
/**
|
|
4
|
-
* @
|
|
37
|
+
/**
|
|
38
|
+
* @zcomponent
|
|
5
39
|
* @zicon html
|
|
40
|
+
* @ztag html/element/img
|
|
6
41
|
* @zparents html/element/**
|
|
7
42
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
43
|
+
let Img = (() => {
|
|
44
|
+
let _classDecorators = [zComponent({ tags: ['html/element/img'], parents: ['html/element/**'], icon: 'html' })];
|
|
45
|
+
let _classDescriptor;
|
|
46
|
+
let _classExtraInitializers = [];
|
|
47
|
+
let _classThis;
|
|
48
|
+
let _classSuper = ZHTMLElement;
|
|
49
|
+
let _instanceExtraInitializers = [];
|
|
50
|
+
let __load_decorators;
|
|
51
|
+
var Img = class extends _classSuper {
|
|
52
|
+
static { _classThis = this; }
|
|
53
|
+
static {
|
|
54
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
55
|
+
__load_decorators = [zLoad()];
|
|
56
|
+
__esDecorate(this, null, __load_decorators, { kind: "method", name: "_load", static: false, private: false, access: { has: obj => "_load" in obj, get: obj => obj._load }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
57
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
58
|
+
Img = _classThis = _classDescriptor.value;
|
|
59
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
60
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
61
|
+
}
|
|
62
|
+
_src = __runInitializers(this, _instanceExtraInitializers);
|
|
63
|
+
constructor(mgr, props) {
|
|
64
|
+
const elm = document.createElement('img');
|
|
65
|
+
super(mgr, props, elm);
|
|
66
|
+
this._src = props.src ?? '';
|
|
67
|
+
}
|
|
68
|
+
async _load() {
|
|
69
|
+
return new Promise((resolve, reject) => {
|
|
70
|
+
this.element.src = this._src;
|
|
71
|
+
this.element.addEventListener('load', () => resolve());
|
|
72
|
+
this.element.addEventListener('error', () => reject());
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return Img = _classThis;
|
|
77
|
+
})();
|
|
78
|
+
export { Img };
|
package/lib/span.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ContextManager } from '@zcomponent/core';
|
|
2
2
|
import { HTMLElementProps, ZHTMLElement } from './HTMLElement';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @zcomponent
|
|
5
|
+
* @zicon html
|
|
4
6
|
* @ztag html/element/span
|
|
5
7
|
* @zparents html/element/**
|
|
6
|
-
* @zicon html
|
|
7
8
|
*/
|
|
8
9
|
export declare class Span extends ZHTMLElement<HTMLSpanElement> {
|
|
9
10
|
constructor(mgr: ContextManager, props: HTMLElementProps);
|
package/lib/span.js
CHANGED
|
@@ -1,11 +1,64 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { zComponent } from '@zcomponent/core';
|
|
1
36
|
import { ZHTMLElement } from './HTMLElement';
|
|
2
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* @zcomponent
|
|
39
|
+
* @zicon html
|
|
3
40
|
* @ztag html/element/span
|
|
4
41
|
* @zparents html/element/**
|
|
5
|
-
* @zicon html
|
|
6
42
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
43
|
+
let Span = (() => {
|
|
44
|
+
let _classDecorators = [zComponent({ tags: ['html/element/span'], parents: ['html/element/**'], icon: 'html' })];
|
|
45
|
+
let _classDescriptor;
|
|
46
|
+
let _classExtraInitializers = [];
|
|
47
|
+
let _classThis;
|
|
48
|
+
let _classSuper = ZHTMLElement;
|
|
49
|
+
var Span = class extends _classSuper {
|
|
50
|
+
static { _classThis = this; }
|
|
51
|
+
static {
|
|
52
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
53
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
54
|
+
Span = _classThis = _classDescriptor.value;
|
|
55
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
56
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
57
|
+
}
|
|
58
|
+
constructor(mgr, props) {
|
|
59
|
+
super(mgr, props, document.createElement('span'));
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return Span = _classThis;
|
|
63
|
+
})();
|
|
64
|
+
export { Span };
|
package/package.json
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zcomponent/html",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.2",
|
|
4
4
|
"description": "Mattercraft support for HTML",
|
|
5
5
|
"author": "Zappar Limited",
|
|
6
6
|
"license": "Proprietary",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"types": "index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"development": "./src/index.ts",
|
|
12
|
+
"types": "./index.d.ts",
|
|
13
|
+
"default": "./index.js"
|
|
14
|
+
},
|
|
15
|
+
"./*": {
|
|
16
|
+
"development": "./src/*.ts",
|
|
17
|
+
"types": "./lib/*.d.ts",
|
|
18
|
+
"default": "./lib/*.js"
|
|
19
|
+
},
|
|
20
|
+
"./lib/*": {
|
|
21
|
+
"development": "./src/*.ts",
|
|
22
|
+
"types": "./lib/*.d.ts",
|
|
23
|
+
"default": "./lib/*.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
9
26
|
"zexports": [
|
|
10
27
|
"./lib/**/*"
|
|
11
28
|
],
|
|
@@ -19,7 +36,7 @@
|
|
|
19
36
|
"public/**/*"
|
|
20
37
|
],
|
|
21
38
|
"scripts": {
|
|
22
|
-
"build": "rm -rf lib &&
|
|
39
|
+
"build": "rm -rf lib && tspc && tsc-alias",
|
|
23
40
|
"watch": "tsc -w",
|
|
24
41
|
"docs": "typedoc --out docs",
|
|
25
42
|
"predocs": "npm run ctix",
|