ziko 0.37.0 → 0.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ziko.cjs +1722 -3956
- package/dist/ziko.js +6150 -8384
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +1713 -3840
- package/package.json +16 -13
- package/readme.md +79 -5
- package/src/__helpers__/composition-dep/compose-class.js +46 -0
- package/src/__helpers__/register/index.js +6 -0
- package/src/__helpers__/register/register-to-class.js +16 -0
- package/src/__helpers__/register/register-to-instance.js +18 -0
- package/src/__ziko__/__cache__.js +6 -0
- package/src/__ziko__/__config__.js +19 -0
- package/src/__ziko__/__hydration__.js +8 -0
- package/src/__ziko__/__ui__.js +22 -0
- package/src/__ziko__/index.js +17 -0
- package/src/__ziko__/params.js +40 -0
- package/src/app/globals.js +14 -0
- package/src/app/index.js +4 -4
- package/src/app/spa-file-based-routing.js +2 -2
- package/src/app/ziko-app.js +1 -1
- package/src/data/converter/svg.js +2 -2
- package/src/hooks/index.js +3 -0
- package/src/hooks/use-derived.js +61 -0
- package/src/hooks/use-reactive.js +7 -0
- package/src/hooks/use-state.js +52 -0
- package/src/index.js +1 -78
- package/src/math/complex/index.js +3 -0
- package/src/math/functions/index.js +23 -23
- package/src/math/functions/proxy.js +58 -0
- package/src/math/utils/mapfun.js +17 -21
- package/src/no-module.js +32 -0
- package/src/time/{animation.js → animation/index.js} +2 -2
- package/src/time/decorators/index.js +17 -0
- package/src/time/index.js +11 -12
- package/src/time/utils/index.js +0 -1
- package/src/ui/{methods → __methods__}/dom.js +15 -14
- package/src/ui/__methods__/index.js +4 -0
- package/src/ui/{utils → __utils__}/index.js +1 -1
- package/src/ui/constructors/{ziko-ui-element.js → ZikoUIElement.js} +17 -117
- package/src/ui/constructors/ZikoUIElementMethodesToBeMoved-dep.js +96 -0
- package/src/ui/{style → constructors/style}/index.js +3 -3
- package/src/ui/{elements/flex → flex}/index.js +1 -1
- package/src/{graphics/canvas/index.js → ui/graphics/canvas.js} +4 -5
- package/src/ui/graphics/index.js +2 -0
- package/src/{graphics/svg/index.js → ui/graphics/svg.js} +1 -1
- package/src/ui/{elements/grid → grid}/index.js +1 -1
- package/src/ui/index.js +9 -40
- package/src/ui/{elements/misc/suspense.js → suspense/index.js} +1 -15
- package/src/ui/tags/index.js +27 -17
- package/src/ui/text/index.js +15 -0
- package/src/ui/{elements/misc/xml-wrapper.js → wrapper/index.js} +1 -1
- package/src/use/index.js +3 -7
- package/src/__helpers__/composition/compose-class.js +0 -28
- package/src/graphics/canvas/_canvas_offscreen +0 -0
- package/src/graphics/canvas/utils/color.js +0 -8
- package/src/graphics/canvas/utils/floodFill.js +0 -57
- package/src/graphics/index.js +0 -10
- package/src/time/utils/decorators.js +0 -17
- package/src/ui/elements/embaded/html.js +0 -20
- package/src/ui/elements/embaded/index.js +0 -3
- package/src/ui/elements/embaded/pdf.js +0 -17
- package/src/ui/elements/embaded/youtube.js +0 -24
- package/src/ui/elements/hydrate.js +0 -0
- package/src/ui/elements/index.js +0 -10
- package/src/ui/elements/io/Form/index.js +0 -42
- package/src/ui/elements/io/Form/index.js.txt +0 -104
- package/src/ui/elements/io/Inputs/__helpers__.js +0 -52
- package/src/ui/elements/io/Inputs/index.js +0 -12
- package/src/ui/elements/io/Inputs/input/index.js +0 -99
- package/src/ui/elements/io/Inputs/input-camera/index.js +0 -26
- package/src/ui/elements/io/Inputs/input-checkbox/index.js +0 -26
- package/src/ui/elements/io/Inputs/input-color/index.js +0 -16
- package/src/ui/elements/io/Inputs/input-date-time/index.js +0 -3
- package/src/ui/elements/io/Inputs/input-date-time/input-date-time.js +0 -14
- package/src/ui/elements/io/Inputs/input-date-time/input-date.js +0 -14
- package/src/ui/elements/io/Inputs/input-date-time/input-time.js +0 -14
- package/src/ui/elements/io/Inputs/input-email-password/index.js +0 -2
- package/src/ui/elements/io/Inputs/input-email-password/input-email.js +0 -15
- package/src/ui/elements/io/Inputs/input-email-password/input-password.js +0 -14
- package/src/ui/elements/io/Inputs/input-file/index.js +0 -1
- package/src/ui/elements/io/Inputs/input-file/input-file.js +0 -0
- package/src/ui/elements/io/Inputs/input-file/input-image.js +0 -43
- package/src/ui/elements/io/Inputs/input-number/index.js +0 -37
- package/src/ui/elements/io/Inputs/input-radio/index.js +0 -26
- package/src/ui/elements/io/Inputs/input-search/index.js +0 -45
- package/src/ui/elements/io/Inputs/input-slider/index.js +0 -34
- package/src/ui/elements/io/Select/index.js +0 -20
- package/src/ui/elements/io/Textarea/index.js +0 -18
- package/src/ui/elements/io/index.js +0 -4
- package/src/ui/elements/list/elements.js +0 -0
- package/src/ui/elements/list/index.js +0 -138
- package/src/ui/elements/media/Audio/index.js +0 -17
- package/src/ui/elements/media/Image/figure.js +0 -19
- package/src/ui/elements/media/Image/image.js +0 -37
- package/src/ui/elements/media/Image/index.js +0 -2
- package/src/ui/elements/media/Video/index.js +0 -27
- package/src/ui/elements/media/__ZikoUIDynamicMediaELement__.js +0 -47
- package/src/ui/elements/media/index.js +0 -3
- package/src/ui/elements/misc/hyperscript.js +0 -144
- package/src/ui/elements/misc/index.js +0 -101
- package/src/ui/elements/semantic/index.js +0 -42
- package/src/ui/elements/table/elements.js +0 -94
- package/src/ui/elements/table/index.js +0 -3
- package/src/ui/elements/table/table.js +0 -115
- package/src/ui/elements/table/utils.js +0 -12
- package/src/ui/elements/text/__ZikoUIText__.js +0 -70
- package/src/ui/elements/text/heading.js +0 -36
- package/src/ui/elements/text/index.js +0 -3
- package/src/ui/elements/text/p.js +0 -26
- package/src/ui/elements/text/pre.js +0 -0
- package/src/ui/elements/text/text.js +0 -81
- package/src/use/use-debounce.js +0 -4
- package/src/use/use-state.js +0 -22
- package/src/use/use-throttle.js +0 -9
- /package/src/__helpers__/{composition → composition-dep}/compose-instance.js +0 -0
- /package/src/__helpers__/{composition → composition-dep}/compose.js +0 -0
- /package/src/__helpers__/{composition → composition-dep}/index.js +0 -0
- /package/src/reactivity/hooks/{Head → head}/_useCssText.js +0 -0
- /package/src/reactivity/hooks/{Head → head}/index.js +0 -0
- /package/src/reactivity/hooks/{Head → head}/useFavIcon.js +0 -0
- /package/src/reactivity/hooks/{Head → head}/useHead.js +0 -0
- /package/src/reactivity/hooks/{Head → head}/useMeta.js +0 -0
- /package/src/reactivity/hooks/{Head → head}/useTitle.js +0 -0
- /package/src/time/{loop.js → loop/index.js} +0 -0
- /package/src/ui/{methods → __methods__}/events.js +0 -0
- /package/src/ui/{methods → __methods__}/indexing.js +0 -0
- /package/src/ui/{methods → __methods__}/observer.js +0 -0
- /package/src/ui/{methods → __methods__}/style.js +0 -0
- /package/src/ui/constructors/{ziko-ui-node.js → ZikoUINode.js} +0 -0
- /package/src/ui/tags/{tags.js → tags-list.js} +0 -0
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import ZikoUIElement from "../../constructors/ziko-ui-element.js";
|
|
2
|
-
import {text} from "../text/index.js";
|
|
3
|
-
class ZikoUILI extends ZikoUIElement{
|
|
4
|
-
constructor(UI){
|
|
5
|
-
super("li","li");
|
|
6
|
-
this.append(UI);
|
|
7
|
-
}
|
|
8
|
-
get isLi(){
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
class ZikoUIList extends ZikoUIElement {
|
|
13
|
-
constructor(element,name) {
|
|
14
|
-
super(element,name);
|
|
15
|
-
delete this.append;
|
|
16
|
-
this.style({ listStylePosition: "inside" });
|
|
17
|
-
}
|
|
18
|
-
get isList(){
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
append(...arr){
|
|
22
|
-
for (let i = 0; i < arr.length; i++) {
|
|
23
|
-
let li = null;
|
|
24
|
-
if(["string","number"].includes(typeof arr[i]))arr[i]=text(arr[i])
|
|
25
|
-
if (arr[i] instanceof ZikoUIElement)li=new ZikoUILI(arr[i]);
|
|
26
|
-
li.setTarget(this.element)
|
|
27
|
-
this.items.push(li[0]);
|
|
28
|
-
this.maintain();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
remove(...ele) {
|
|
32
|
-
if(ele.length==0){
|
|
33
|
-
if(this.target.children.length) this.target.removeChild(this.element);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
const remove = (ele) => {
|
|
37
|
-
if(typeof ele === "number") ele=this.items[ele];
|
|
38
|
-
if(ele instanceof ZikoUIElement)this.element?.removeChild(ele.parent.element);
|
|
39
|
-
this.items=this.items.filter(n=>n!==ele);
|
|
40
|
-
};
|
|
41
|
-
for (let i = 0; i < ele.length; i++) remove(ele[i]);
|
|
42
|
-
for (let i = 0; i < this.items.length; i++)
|
|
43
|
-
Object.assign(this, { [[i]]: this.items[i] });
|
|
44
|
-
}
|
|
45
|
-
return this;
|
|
46
|
-
}
|
|
47
|
-
insertAt(index, ...ele) {
|
|
48
|
-
if (index >= this.element.children.length) this.append(...ele);
|
|
49
|
-
else
|
|
50
|
-
for (let i = 0; i < ele.length; i++) {
|
|
51
|
-
let li = null;
|
|
52
|
-
if(["number","string"].includes(typeof ele[i]))ele[i]=text(ele[i]);
|
|
53
|
-
if (ele[i] instanceof ZikoUIElement)li=new ZikoUILI(ele[i]);
|
|
54
|
-
this.element?.insertBefore(li.element, this.items[index].parent.element);
|
|
55
|
-
this.items.splice(index, 0, ele[i][0]);
|
|
56
|
-
}
|
|
57
|
-
return this;
|
|
58
|
-
}
|
|
59
|
-
filterByTextContent(text,exactMatch=false){
|
|
60
|
-
this.items.map(n=>n.parent.render());
|
|
61
|
-
this.items.filter(n=>{
|
|
62
|
-
const content=n.element.textContent
|
|
63
|
-
return !(exactMatch?content===text:content.includes(text))
|
|
64
|
-
}).map(n=>n.parent.render(false));
|
|
65
|
-
return this;
|
|
66
|
-
}
|
|
67
|
-
sortByTextContent(order=1){
|
|
68
|
-
this.items.map(n=>n.parent.render(false));
|
|
69
|
-
// To Fix
|
|
70
|
-
this.sortedItems=this.items.sort((a,b)=>order*a.element.textContent.localeCompare(b.element.textContent))
|
|
71
|
-
this.append(...this.sortedItems);
|
|
72
|
-
return this;
|
|
73
|
-
}
|
|
74
|
-
filterByClass(value) {
|
|
75
|
-
this.items.map(n=>n.parent.render(true));
|
|
76
|
-
this.items.filter(n=>!n.Classes.includes(value)).map(n=>n.parent.render(false));
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
79
|
-
delete(value) {
|
|
80
|
-
const valueIndex = [...this.element.children].indexOf(value);
|
|
81
|
-
return valueIndex;
|
|
82
|
-
/*if(valueIndex >= 0) {
|
|
83
|
-
return this.list.splice(valueIndex, 1);
|
|
84
|
-
}*/
|
|
85
|
-
}
|
|
86
|
-
push(){
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
pop(){
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
unshift(){
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
shift(){
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
sort(){
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
filter(){
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
slice(){
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
class ZikoUIOList extends ZikoUIList{
|
|
109
|
-
constructor(...arr){
|
|
110
|
-
super("ol","ol");
|
|
111
|
-
this.append(...arr);
|
|
112
|
-
}
|
|
113
|
-
get isOl(){
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
type(tp = 1) {
|
|
117
|
-
this.element?.setAttribute("type", tp);
|
|
118
|
-
return this;
|
|
119
|
-
}
|
|
120
|
-
start(st = 1) {
|
|
121
|
-
this.element?.setAttribute("start", st);
|
|
122
|
-
return this;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
class ZikoUIUList extends ZikoUIList{
|
|
126
|
-
constructor(...arr){
|
|
127
|
-
super("ul","ul");
|
|
128
|
-
this.append(...arr);
|
|
129
|
-
}
|
|
130
|
-
get isUl(){
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
const li=UI=>new ZikoUILI(UI)
|
|
135
|
-
const ol = (...arr) => new ZikoUIOList(...arr);
|
|
136
|
-
const ul = (...arr) => new ZikoUIUList(...arr);
|
|
137
|
-
|
|
138
|
-
export{ol,ul,li}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { __ZikoUIDynamicMediaElement__ } from "../__ZikoUIDynamicMediaELement__.js";
|
|
2
|
-
class ZikoUIAudio extends __ZikoUIDynamicMediaElement__ {
|
|
3
|
-
constructor(src) {
|
|
4
|
-
super("audio","audio");
|
|
5
|
-
this.element?.setAttribute("src", src);
|
|
6
|
-
this.size("150px","30px")
|
|
7
|
-
// this.useControls();
|
|
8
|
-
}
|
|
9
|
-
get isAudio(){
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
const audio = (src) => new ZikoUIAudio(src);
|
|
14
|
-
export {
|
|
15
|
-
audio,
|
|
16
|
-
ZikoUIAudio
|
|
17
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import ZikoUIElement from "../../../constructors/ziko-ui-element.js";
|
|
2
|
-
class ZikoUIFigure extends ZikoUIElement{
|
|
3
|
-
constructor(src,caption){
|
|
4
|
-
super("figure","figure")
|
|
5
|
-
this.img=src.width("100%").element;
|
|
6
|
-
this.caption=document?.createElement("figcaption");
|
|
7
|
-
this.caption.append(caption.element)
|
|
8
|
-
this.element?.append(this.img);
|
|
9
|
-
this.element?.append(this.caption);
|
|
10
|
-
}
|
|
11
|
-
get isFigure(){
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
const figure =(image,caption) =>new ZikoUIFigure(image,caption);
|
|
16
|
-
export{
|
|
17
|
-
figure,
|
|
18
|
-
ZikoUIFigure
|
|
19
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import ZikoUIElement from "../../../constructors/ziko-ui-element.js";
|
|
2
|
-
class ZikoUIImage extends ZikoUIElement {
|
|
3
|
-
constructor(src,alt, w, h) {
|
|
4
|
-
super("img","image");
|
|
5
|
-
this.value=src;
|
|
6
|
-
if (src.nodeName === "IMG")this.element.setAttribute("src", src.src);
|
|
7
|
-
else this.element?.setAttribute("src", src);
|
|
8
|
-
if (typeof w == "number") w += "%";
|
|
9
|
-
if (typeof h == "number") h += "%";
|
|
10
|
-
this.setAttr("alt", alt)
|
|
11
|
-
this.style({ border: "1px solid black", width: w, height: h });
|
|
12
|
-
}
|
|
13
|
-
get isImg(){
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
updateSrc(url){
|
|
17
|
-
this.value=url;
|
|
18
|
-
this.element.src=url;
|
|
19
|
-
return this;
|
|
20
|
-
}
|
|
21
|
-
toggleSrc(...values){
|
|
22
|
-
values=values.map(n=>""+n);
|
|
23
|
-
let index=values.indexOf(""+this.value);
|
|
24
|
-
if(index!=-1&&index!=(values.length-1))this.updateSrc(values[index+1]);
|
|
25
|
-
else this.updateSrc(values[0]);
|
|
26
|
-
return this;
|
|
27
|
-
}
|
|
28
|
-
alt(alt){
|
|
29
|
-
this.element.alt=alt;
|
|
30
|
-
return this;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
const image = (src,alt, width, height) => new ZikoUIImage(src,alt, width, height);
|
|
34
|
-
export{
|
|
35
|
-
image,
|
|
36
|
-
ZikoUIImage
|
|
37
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { __ZikoUIDynamicMediaElement__ } from "../__ZikoUIDynamicMediaELement__.js";
|
|
2
|
-
class ZikoUIVideo extends __ZikoUIDynamicMediaElement__ {
|
|
3
|
-
constructor(src="", w = "100%", h = "50vh") {
|
|
4
|
-
super("video","video");
|
|
5
|
-
if (src.nodeName === "VIDEO") this.element?.setAttribute("src", src.src);
|
|
6
|
-
else this.element?.setAttribute("src", src);
|
|
7
|
-
if (typeof w == "number") w += "%";
|
|
8
|
-
if (typeof h == "number") h += "%";
|
|
9
|
-
this.style({ width: w, height: h });
|
|
10
|
-
}
|
|
11
|
-
get isVideo(){
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
usePoster(src=""){
|
|
15
|
-
this.element.poster=src;
|
|
16
|
-
return this;
|
|
17
|
-
}
|
|
18
|
-
usePIP(e){
|
|
19
|
-
this.element.requestPictureInPicture(e);
|
|
20
|
-
return this;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
const video = (src, width, height) => new ZikoUIVideo(src, width, height);
|
|
24
|
-
export {
|
|
25
|
-
video,
|
|
26
|
-
ZikoUIVideo
|
|
27
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import ZikoUIElement from "../../constructors/ziko-ui-element.js";
|
|
2
|
-
class __ZikoUIDynamicMediaElement__ extends ZikoUIElement {
|
|
3
|
-
constructor(element, name) {
|
|
4
|
-
super(element, name);
|
|
5
|
-
this.useControls();
|
|
6
|
-
}
|
|
7
|
-
get t(){
|
|
8
|
-
return this.element.currentTime;
|
|
9
|
-
}
|
|
10
|
-
useControls(enabled = true) {
|
|
11
|
-
this.element.controls = enabled;
|
|
12
|
-
return this;
|
|
13
|
-
}
|
|
14
|
-
enableControls(){
|
|
15
|
-
this.element.controls = true;
|
|
16
|
-
return this;
|
|
17
|
-
}
|
|
18
|
-
disableControls(){
|
|
19
|
-
this.element.controls = true;
|
|
20
|
-
return this;
|
|
21
|
-
}
|
|
22
|
-
toggleControls(){
|
|
23
|
-
this.element.controls = !this.element.controls;
|
|
24
|
-
return this;
|
|
25
|
-
}
|
|
26
|
-
play() {
|
|
27
|
-
this.element.play();
|
|
28
|
-
return this;
|
|
29
|
-
}
|
|
30
|
-
pause() {
|
|
31
|
-
this.element.pause();
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
seekTo(time) {
|
|
35
|
-
this.element.currentTime = time;
|
|
36
|
-
return this;
|
|
37
|
-
}
|
|
38
|
-
onPlay(){
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
onPause(){
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export {
|
|
46
|
-
__ZikoUIDynamicMediaElement__
|
|
47
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import ZikoUIElement from '../../constructors/ziko-ui-element.js';
|
|
2
|
-
const _h=(tag, type, attributes, ...children)=>{
|
|
3
|
-
const { name, style, ...attrs } = attributes;
|
|
4
|
-
let element = new ZikoUIElement(tag, name, type);
|
|
5
|
-
style && element.style(style);
|
|
6
|
-
attrs && element.setAttr(attrs);
|
|
7
|
-
children && element.append(...children);
|
|
8
|
-
return element;
|
|
9
|
-
}
|
|
10
|
-
const h=(tag, attributes = {}, ...children)=> _h(tag, "html", attributes, ...children);
|
|
11
|
-
const s=(tag, attributes = {}, ...children)=> _h(tag, "svg", attributes, ...children);
|
|
12
|
-
|
|
13
|
-
const HTMLTags = [
|
|
14
|
-
'a',
|
|
15
|
-
'abb',
|
|
16
|
-
'address',
|
|
17
|
-
'area',
|
|
18
|
-
'article',
|
|
19
|
-
'aside',
|
|
20
|
-
'audio',
|
|
21
|
-
'b',
|
|
22
|
-
'base',
|
|
23
|
-
'bdi',
|
|
24
|
-
'bdo',
|
|
25
|
-
'blockquote',
|
|
26
|
-
'br',
|
|
27
|
-
'button',
|
|
28
|
-
'canvas',
|
|
29
|
-
'caption',
|
|
30
|
-
'cite',
|
|
31
|
-
'code',
|
|
32
|
-
'col',
|
|
33
|
-
'colgroup',
|
|
34
|
-
'data',
|
|
35
|
-
'datalist',
|
|
36
|
-
'dd',
|
|
37
|
-
'del',
|
|
38
|
-
'details',
|
|
39
|
-
'dfn',
|
|
40
|
-
'dialog',
|
|
41
|
-
'div',
|
|
42
|
-
'dl',
|
|
43
|
-
'dt',
|
|
44
|
-
'em',
|
|
45
|
-
'embed',
|
|
46
|
-
'fieldset',
|
|
47
|
-
'figcaption',
|
|
48
|
-
'figure',
|
|
49
|
-
'footer',
|
|
50
|
-
'form',
|
|
51
|
-
'h1',
|
|
52
|
-
'h2',
|
|
53
|
-
'h3',
|
|
54
|
-
'h4',
|
|
55
|
-
'h5',
|
|
56
|
-
'h6',
|
|
57
|
-
'header',
|
|
58
|
-
'hgroup',
|
|
59
|
-
'hr',
|
|
60
|
-
'i',
|
|
61
|
-
'iframe',
|
|
62
|
-
'img',
|
|
63
|
-
'ipnut',
|
|
64
|
-
'ins',
|
|
65
|
-
'kbd',
|
|
66
|
-
'label',
|
|
67
|
-
'legend',
|
|
68
|
-
'li',
|
|
69
|
-
'main',
|
|
70
|
-
'map',
|
|
71
|
-
'mark',
|
|
72
|
-
'menu',
|
|
73
|
-
'meter',
|
|
74
|
-
'nav',
|
|
75
|
-
'object',
|
|
76
|
-
'ol',
|
|
77
|
-
'optgroup',
|
|
78
|
-
'option',
|
|
79
|
-
'output',
|
|
80
|
-
'p',
|
|
81
|
-
'param',
|
|
82
|
-
'picture',
|
|
83
|
-
'pre',
|
|
84
|
-
'progress',
|
|
85
|
-
'q',
|
|
86
|
-
'rp',
|
|
87
|
-
'rt',
|
|
88
|
-
'ruby',
|
|
89
|
-
's',
|
|
90
|
-
'samp',
|
|
91
|
-
'search',
|
|
92
|
-
'section',
|
|
93
|
-
'select',
|
|
94
|
-
'small',
|
|
95
|
-
'source',
|
|
96
|
-
'span',
|
|
97
|
-
'strong',
|
|
98
|
-
'sub',
|
|
99
|
-
'summary',
|
|
100
|
-
'sup',
|
|
101
|
-
'svg',
|
|
102
|
-
'table',
|
|
103
|
-
'tbody',
|
|
104
|
-
'td',
|
|
105
|
-
'template',
|
|
106
|
-
'textarea',
|
|
107
|
-
'tfoot',
|
|
108
|
-
'th',
|
|
109
|
-
'thead',
|
|
110
|
-
'time',
|
|
111
|
-
'title',
|
|
112
|
-
'tr',
|
|
113
|
-
'track',
|
|
114
|
-
'u',
|
|
115
|
-
'ul',
|
|
116
|
-
'var',
|
|
117
|
-
'video',
|
|
118
|
-
'wbr'
|
|
119
|
-
];
|
|
120
|
-
|
|
121
|
-
const SVGTags = [
|
|
122
|
-
"svg", "g", "defs", "symbol", "use", "image", "switch",
|
|
123
|
-
"rect", "circle", "ellipse", "line", "polyline", "polygon", "path",
|
|
124
|
-
"text", "tspan", "textPath", "altGlyph", "altGlyphDef", "altGlyphItem", "glyph", "glyphRef",
|
|
125
|
-
"linearGradient", "radialGradient", "pattern", "solidColor",
|
|
126
|
-
"filter", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix",
|
|
127
|
-
"feDiffuseLighting", "feDisplacementMap", "feDropShadow", "feFlood", "feFuncA", "feFuncR", "feFuncG", "feFuncB",
|
|
128
|
-
"feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "feSpecularLighting",
|
|
129
|
-
"feTile", "feTurbulence",
|
|
130
|
-
"animate", "animateMotion", "animateTransform", "set",
|
|
131
|
-
"script",
|
|
132
|
-
"desc", "title", "metadata", "foreignObject"
|
|
133
|
-
];
|
|
134
|
-
|
|
135
|
-
const hTags = HTMLTags.reduce((acc, key) => {
|
|
136
|
-
acc[key] = (attr, ...children) => h(key, attr, ...children);
|
|
137
|
-
return acc;
|
|
138
|
-
}, {});
|
|
139
|
-
const sTags = SVGTags.reduce((acc, key) => {
|
|
140
|
-
acc[key] = (attr, ...children) => h(key, attr, ...children);
|
|
141
|
-
return acc;
|
|
142
|
-
}, {});
|
|
143
|
-
|
|
144
|
-
export { h, s, hTags, sTags };
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import ZikoUIElement from "../../constructors/ziko-ui-element.js";
|
|
2
|
-
class ZikoUIHtmlTag extends ZikoUIElement {
|
|
3
|
-
constructor(element) {
|
|
4
|
-
super(element,"html");
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
class ZikoUIBtn extends ZikoUIElement {
|
|
8
|
-
constructor(value = "button") {
|
|
9
|
-
super("button","btn");
|
|
10
|
-
this.setValue(value);
|
|
11
|
-
this.st.cursor("pointer");
|
|
12
|
-
globalThis.__Ziko__.__Config__.default.render && this.render();
|
|
13
|
-
}
|
|
14
|
-
get isBtn(){
|
|
15
|
-
return true
|
|
16
|
-
}
|
|
17
|
-
setValue(value) {
|
|
18
|
-
if (value instanceof ZikoUIElement) value.setTarget(this.element);
|
|
19
|
-
else {
|
|
20
|
-
this.element?.appendChild(document.createTextNode(""));
|
|
21
|
-
this.element.childNodes[0].data = value;
|
|
22
|
-
}
|
|
23
|
-
return this;
|
|
24
|
-
}
|
|
25
|
-
get value() {
|
|
26
|
-
return this.element.innerText;
|
|
27
|
-
}
|
|
28
|
-
toggleValues(...values) {
|
|
29
|
-
values = values.map((n) => "" + n);
|
|
30
|
-
let index = values.indexOf("" + this.value);
|
|
31
|
-
if (index != -1 && index != values.length - 1)
|
|
32
|
-
this.setValue(values[index + 1]);
|
|
33
|
-
else this.setValue(values[0]);
|
|
34
|
-
return this;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
class ZikoUIBr extends ZikoUIElement {
|
|
38
|
-
constructor() {
|
|
39
|
-
super("br","br");
|
|
40
|
-
}
|
|
41
|
-
get isBr(){
|
|
42
|
-
return true
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
class ZikoUIHr extends ZikoUIElement {
|
|
46
|
-
constructor() {
|
|
47
|
-
super("hr","hr");
|
|
48
|
-
this.setAttr("role", "none");
|
|
49
|
-
}
|
|
50
|
-
get isHr(){
|
|
51
|
-
return true
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
class ZikoUILink extends ZikoUIElement{
|
|
55
|
-
constructor(href){
|
|
56
|
-
super("a","link");
|
|
57
|
-
Object.assign(this.cache,{
|
|
58
|
-
defaultStyle:{
|
|
59
|
-
color:"#0275d8",
|
|
60
|
-
textDecoration: "none"
|
|
61
|
-
},
|
|
62
|
-
hoverStyle:{
|
|
63
|
-
color:"#01447e",
|
|
64
|
-
textDecoration: "underline"
|
|
65
|
-
},
|
|
66
|
-
})
|
|
67
|
-
this.setHref(href);
|
|
68
|
-
this.style(this.cache.defaultStyle);
|
|
69
|
-
this.onPtrEnter(()=>this.style(this.cache.hoverStyle));
|
|
70
|
-
this.onPtrLeave(()=>this.style(this.cache.defaultStyle));
|
|
71
|
-
}
|
|
72
|
-
setHref(href){
|
|
73
|
-
this.element.href=href;
|
|
74
|
-
}
|
|
75
|
-
get isLink(){
|
|
76
|
-
return true
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const br = () => new ZikoUIBr();
|
|
80
|
-
const hr = () => new ZikoUIHr();
|
|
81
|
-
const brs = (n=1)=> new Array(n).fill(new ZikoUIBr());
|
|
82
|
-
const hrs = (n=1)=> new Array(n).fill(new ZikoUIHr());
|
|
83
|
-
const link=(href,...UIElement)=>new ZikoUILink(href).append(...UIElement);
|
|
84
|
-
const html=(tag,...UIElement)=>new ZikoUIHtmlTag(tag).append(...UIElement);
|
|
85
|
-
const btn = (value) => new ZikoUIBtn(value);
|
|
86
|
-
export * from "./xml-wrapper.js";
|
|
87
|
-
export * from "./suspense.js"
|
|
88
|
-
export * from "./hyperscript.js"
|
|
89
|
-
export{
|
|
90
|
-
html,
|
|
91
|
-
btn,
|
|
92
|
-
br,
|
|
93
|
-
hr,
|
|
94
|
-
brs,
|
|
95
|
-
hrs,
|
|
96
|
-
link,
|
|
97
|
-
ZikoUIHtmlTag,
|
|
98
|
-
ZikoUIBr,
|
|
99
|
-
ZikoUIHr,
|
|
100
|
-
ZikoUILink
|
|
101
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import ZikoUIElement from "../../constructors/ziko-ui-element.js";
|
|
2
|
-
const elements = ['Main', 'Header', 'Nav', 'Section', 'Article', 'Aside', 'Footer']
|
|
3
|
-
|
|
4
|
-
// Storage for Classes and component functions
|
|
5
|
-
const Classes = {};
|
|
6
|
-
const Components = {};
|
|
7
|
-
|
|
8
|
-
// Auto-generate Classes and factory functions
|
|
9
|
-
for (let i=0; i<elements.length; i++) {
|
|
10
|
-
Classes[`ZikoUI${elements[i]}`] = class extends ZikoUIElement {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(elements[i].toLowerCase());
|
|
13
|
-
this.style({ position: "relative" });
|
|
14
|
-
}
|
|
15
|
-
get [`is${elements[i]}`]() {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
Components[elements[i]] = (...children) =>
|
|
21
|
-
new Classes[`ZikoUI${elements[i]}`]().append(...children);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const {
|
|
25
|
-
Main,
|
|
26
|
-
Header,
|
|
27
|
-
Nav,
|
|
28
|
-
Section,
|
|
29
|
-
Article,
|
|
30
|
-
Aside,
|
|
31
|
-
Footer
|
|
32
|
-
} = Components;
|
|
33
|
-
|
|
34
|
-
export const {
|
|
35
|
-
ZikoUIMain,
|
|
36
|
-
ZikoUIHeader,
|
|
37
|
-
ZikoUINav,
|
|
38
|
-
ZikoUISection,
|
|
39
|
-
ZikoUIArticle,
|
|
40
|
-
ZikoUIAside,
|
|
41
|
-
ZikoUIFooter
|
|
42
|
-
} = Classes;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import ZikoUIElement from "../../constructors/ziko-ui-element.js"
|
|
2
|
-
import { text } from "../text/text.js";
|
|
3
|
-
class ZikoUITh extends ZikoUIElement{
|
|
4
|
-
constructor(...ZikoUIElement){
|
|
5
|
-
super()
|
|
6
|
-
this.element=document?.createElement("Th");
|
|
7
|
-
this.append(...ZikoUIElement)
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
class ZikoUITr extends ZikoUIElement{
|
|
11
|
-
constructor(...ZikoUIElement){
|
|
12
|
-
super()
|
|
13
|
-
this.element=document?.createElement("Tr");
|
|
14
|
-
this.append(...ZikoUIElement)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
class ZikoUITd extends ZikoUIElement{
|
|
18
|
-
constructor(...ZikoUIElement){
|
|
19
|
-
super()
|
|
20
|
-
this.element=document?.createElement("Td");
|
|
21
|
-
this.append(...ZikoUIElement)
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
class ZikoUIThead extends ZikoUIElement{
|
|
25
|
-
constructor(...ZikoUITr){
|
|
26
|
-
super()
|
|
27
|
-
this.element=document?.createElement("Thead");
|
|
28
|
-
this.append(...ZikoUITr)
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
class ZikoUITbody extends ZikoUIElement{
|
|
32
|
-
constructor(...ZikoUITr){
|
|
33
|
-
super()
|
|
34
|
-
this.element=document?.createElement("Tbody");
|
|
35
|
-
this.append(...ZikoUITr)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
class ZikoUITfoot extends ZikoUIElement{
|
|
39
|
-
constructor(...ZikoUITr){
|
|
40
|
-
super()
|
|
41
|
-
this.element=document?.createElement("Tfoot");
|
|
42
|
-
this.append(...ZikoUITr)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export class ZikoUICaption extends ZikoUIElement{
|
|
46
|
-
constructor(ZikoUIElement){
|
|
47
|
-
super()
|
|
48
|
-
this.element=document?.createElement("Caption");
|
|
49
|
-
this.append(ZikoUIElement)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
class ZikoUICol extends ZikoUIElement{
|
|
53
|
-
constructor(...ZikoUIElement){
|
|
54
|
-
super()
|
|
55
|
-
this.element=document?.createElement("Col");
|
|
56
|
-
this.append(...ZikoUIElement)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
class ZikoUIColgroup extends ZikoUIElement{
|
|
60
|
-
constructor(...ZikoUIElement){
|
|
61
|
-
super()
|
|
62
|
-
this.element=document?.createElement("Colgroup");
|
|
63
|
-
this.append(...ZikoUIElement)
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const tr=(...ZikoUIElement)=>new ZikoUITr(...ZikoUIElement)
|
|
68
|
-
const th=(...UI)=>{
|
|
69
|
-
UI=UI.map(n=>{
|
|
70
|
-
if(!(n instanceof ZikoUIElement))n=text(n)
|
|
71
|
-
return n
|
|
72
|
-
})
|
|
73
|
-
return new ZikoUITh(...UI)
|
|
74
|
-
}
|
|
75
|
-
const td=(...UI)=>{
|
|
76
|
-
UI=UI.map(n=>{
|
|
77
|
-
if(!(n instanceof ZikoUIElement))n=text(n)
|
|
78
|
-
return n
|
|
79
|
-
})
|
|
80
|
-
return new ZikoUITd(...UI)
|
|
81
|
-
}
|
|
82
|
-
const thead=(...ZikoUITd)=>{
|
|
83
|
-
ZikoUITd=ZikoUITd.map(n=>{
|
|
84
|
-
if(!(n instanceof ZikoUIElement))n=td(n)
|
|
85
|
-
return n
|
|
86
|
-
})
|
|
87
|
-
return new ZikoUIThead(...UI)
|
|
88
|
-
}
|
|
89
|
-
const tbody=(...ZikoUITr)=>new ZikoUITbody(...ZikoUITr)
|
|
90
|
-
const tfoot=(...ZikoUITr)=>new ZikoUITfoot(...ZikoUITr)
|
|
91
|
-
const caption=(ZikoUITr)=>new ZikoUICaption(ZikoUITr)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
export {th,tr,td,thead,tbody,tfoot,caption}
|