ziko 0.38.0 → 0.39.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/dist/ziko.cjs +165 -759
- package/dist/ziko.js +165 -759
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +164 -756
- package/package.json +2 -1
- 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__/index.js +12 -11
- package/src/events/types/clipboard.d.ts +2 -2
- package/src/events/types/focus.d.ts +2 -2
- package/src/events/types/pointer.d.ts +2 -2
- package/src/hooks/use-state.js +5 -0
- package/src/reactivity/hooks/UI/index.js +1 -1
- package/src/ui/__methods__/attrs.js +46 -0
- package/src/ui/__methods__/index.js +5 -0
- package/src/ui/__methods__/style.js +14 -0
- package/src/ui/__utils__/index.js +2 -2
- package/src/ui/constructors/{ZikoUIElement.js → UIElement.js} +30 -82
- package/src/ui/constructors/{ZikoUINode.js → UINode.js} +2 -2
- package/src/ui/flex/index.js +8 -8
- package/src/ui/graphics/canvas.js +2 -2
- package/src/ui/graphics/svg.js +2 -2
- package/src/ui/grid/index.js +4 -4
- package/src/ui/index.js +2 -2
- package/src/ui/suspense/index.js +3 -3
- package/src/ui/tags/index.d.ts.txt +125 -125
- package/src/ui/tags/index.js +28 -18
- package/src/ui/text/index.js +2 -2
- package/src/ui/wrapper/index.js +3 -3
- package/src/__helpers__/composition/compose-class.js +0 -28
- /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/ui/constructors/{ZikoUIElementMethodesToBeMoved.js → ZikoUIElementMethodesToBeMoved-dep.js} +0 -0
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
import
|
|
1
|
+
import UIElement from "../elements/UIElement.js";
|
|
2
2
|
interface HtmlTags {
|
|
3
|
-
a:
|
|
4
|
-
abbr:
|
|
5
|
-
address:
|
|
6
|
-
area:
|
|
7
|
-
article:
|
|
8
|
-
aside:
|
|
9
|
-
audio:
|
|
10
|
-
b:
|
|
11
|
-
base:
|
|
12
|
-
bdi:
|
|
13
|
-
bdo:
|
|
14
|
-
blockquote:
|
|
15
|
-
body:
|
|
16
|
-
br:
|
|
17
|
-
button:
|
|
18
|
-
canvas:
|
|
19
|
-
caption:
|
|
20
|
-
cite:
|
|
21
|
-
code:
|
|
22
|
-
col:
|
|
23
|
-
colgroup:
|
|
24
|
-
data:
|
|
25
|
-
datalist:
|
|
26
|
-
dd:
|
|
27
|
-
del:
|
|
28
|
-
details:
|
|
29
|
-
dfn:
|
|
30
|
-
dialog:
|
|
31
|
-
div:
|
|
32
|
-
dl:
|
|
33
|
-
dt:
|
|
34
|
-
em:
|
|
35
|
-
embed:
|
|
36
|
-
fieldset:
|
|
37
|
-
figcaption:
|
|
38
|
-
figure:
|
|
39
|
-
footer:
|
|
40
|
-
form:
|
|
41
|
-
h1:
|
|
42
|
-
h2:
|
|
43
|
-
h3:
|
|
44
|
-
h4:
|
|
45
|
-
h5:
|
|
46
|
-
h6:
|
|
47
|
-
head:
|
|
48
|
-
header:
|
|
49
|
-
hgroup:
|
|
50
|
-
hr:
|
|
51
|
-
html:
|
|
52
|
-
i:
|
|
53
|
-
iframe:
|
|
54
|
-
img:
|
|
55
|
-
input:
|
|
56
|
-
ins:
|
|
57
|
-
kbd:
|
|
58
|
-
label:
|
|
59
|
-
legend:
|
|
60
|
-
li:
|
|
61
|
-
link:
|
|
62
|
-
main:
|
|
63
|
-
map:
|
|
64
|
-
mark:
|
|
65
|
-
meta:
|
|
66
|
-
meter:
|
|
67
|
-
nav:
|
|
68
|
-
noscript:
|
|
69
|
-
object:
|
|
70
|
-
ol:
|
|
71
|
-
optgroup:
|
|
72
|
-
option:
|
|
73
|
-
output:
|
|
74
|
-
p:
|
|
75
|
-
param:
|
|
76
|
-
picture:
|
|
77
|
-
pre:
|
|
78
|
-
progress:
|
|
79
|
-
q:
|
|
80
|
-
rp:
|
|
81
|
-
rt:
|
|
82
|
-
ruby:
|
|
83
|
-
s:
|
|
84
|
-
samp:
|
|
85
|
-
script:
|
|
86
|
-
section:
|
|
87
|
-
select:
|
|
88
|
-
small:
|
|
89
|
-
source:
|
|
90
|
-
span:
|
|
91
|
-
strong:
|
|
92
|
-
style:
|
|
93
|
-
sub:
|
|
94
|
-
summary:
|
|
95
|
-
sup:
|
|
96
|
-
table:
|
|
97
|
-
tbody:
|
|
98
|
-
td:
|
|
99
|
-
template:
|
|
100
|
-
textarea:
|
|
101
|
-
tfoot:
|
|
102
|
-
th:
|
|
103
|
-
thead:
|
|
104
|
-
time:
|
|
105
|
-
title:
|
|
106
|
-
tr:
|
|
107
|
-
track:
|
|
108
|
-
u:
|
|
109
|
-
ul:
|
|
110
|
-
var:
|
|
111
|
-
video:
|
|
112
|
-
wbr:
|
|
3
|
+
a: UIElement;
|
|
4
|
+
abbr: UIElement;
|
|
5
|
+
address: UIElement;
|
|
6
|
+
area: UIElement;
|
|
7
|
+
article: UIElement;
|
|
8
|
+
aside: UIElement;
|
|
9
|
+
audio: UIElement;
|
|
10
|
+
b: UIElement;
|
|
11
|
+
base: UIElement;
|
|
12
|
+
bdi: UIElement;
|
|
13
|
+
bdo: UIElement;
|
|
14
|
+
blockquote: UIElement;
|
|
15
|
+
body: UIElement;
|
|
16
|
+
br: UIElement;
|
|
17
|
+
button: UIElement;
|
|
18
|
+
canvas: UIElement;
|
|
19
|
+
caption: UIElement;
|
|
20
|
+
cite: UIElement;
|
|
21
|
+
code: UIElement;
|
|
22
|
+
col: UIElement;
|
|
23
|
+
colgroup: UIElement;
|
|
24
|
+
data: UIElement;
|
|
25
|
+
datalist: UIElement;
|
|
26
|
+
dd: UIElement;
|
|
27
|
+
del: UIElement;
|
|
28
|
+
details: UIElement;
|
|
29
|
+
dfn: UIElement;
|
|
30
|
+
dialog: UIElement;
|
|
31
|
+
div: UIElement;
|
|
32
|
+
dl: UIElement;
|
|
33
|
+
dt: UIElement;
|
|
34
|
+
em: UIElement;
|
|
35
|
+
embed: UIElement;
|
|
36
|
+
fieldset: UIElement;
|
|
37
|
+
figcaption: UIElement;
|
|
38
|
+
figure: UIElement;
|
|
39
|
+
footer: UIElement;
|
|
40
|
+
form: UIElement;
|
|
41
|
+
h1: UIElement;
|
|
42
|
+
h2: UIElement;
|
|
43
|
+
h3: UIElement;
|
|
44
|
+
h4: UIElement;
|
|
45
|
+
h5: UIElement;
|
|
46
|
+
h6: UIElement;
|
|
47
|
+
head: UIElement;
|
|
48
|
+
header: UIElement;
|
|
49
|
+
hgroup: UIElement;
|
|
50
|
+
hr: UIElement;
|
|
51
|
+
html: UIElement;
|
|
52
|
+
i: UIElement;
|
|
53
|
+
iframe: UIElement;
|
|
54
|
+
img: UIElement;
|
|
55
|
+
input: UIElement;
|
|
56
|
+
ins: UIElement;
|
|
57
|
+
kbd: UIElement;
|
|
58
|
+
label: UIElement;
|
|
59
|
+
legend: UIElement;
|
|
60
|
+
li: UIElement;
|
|
61
|
+
link: UIElement;
|
|
62
|
+
main: UIElement;
|
|
63
|
+
map: UIElement;
|
|
64
|
+
mark: UIElement;
|
|
65
|
+
meta: UIElement;
|
|
66
|
+
meter: UIElement;
|
|
67
|
+
nav: UIElement;
|
|
68
|
+
noscript: UIElement;
|
|
69
|
+
object: UIElement;
|
|
70
|
+
ol: UIElement;
|
|
71
|
+
optgroup: UIElement;
|
|
72
|
+
option: UIElement;
|
|
73
|
+
output: UIElement;
|
|
74
|
+
p: UIElement;
|
|
75
|
+
param: UIElement;
|
|
76
|
+
picture: UIElement;
|
|
77
|
+
pre: UIElement;
|
|
78
|
+
progress: UIElement;
|
|
79
|
+
q: UIElement;
|
|
80
|
+
rp: UIElement;
|
|
81
|
+
rt: UIElement;
|
|
82
|
+
ruby: UIElement;
|
|
83
|
+
s: UIElement;
|
|
84
|
+
samp: UIElement;
|
|
85
|
+
script: UIElement;
|
|
86
|
+
section: UIElement;
|
|
87
|
+
select: UIElement;
|
|
88
|
+
small: UIElement;
|
|
89
|
+
source: UIElement;
|
|
90
|
+
span: UIElement;
|
|
91
|
+
strong: UIElement;
|
|
92
|
+
style: UIElement;
|
|
93
|
+
sub: UIElement;
|
|
94
|
+
summary: UIElement;
|
|
95
|
+
sup: UIElement;
|
|
96
|
+
table: UIElement;
|
|
97
|
+
tbody: UIElement;
|
|
98
|
+
td: UIElement;
|
|
99
|
+
template: UIElement;
|
|
100
|
+
textarea: UIElement;
|
|
101
|
+
tfoot: UIElement;
|
|
102
|
+
th: UIElement;
|
|
103
|
+
thead: UIElement;
|
|
104
|
+
time: UIElement;
|
|
105
|
+
title: UIElement;
|
|
106
|
+
tr: UIElement;
|
|
107
|
+
track: UIElement;
|
|
108
|
+
u: UIElement;
|
|
109
|
+
ul: UIElement;
|
|
110
|
+
var: UIElement;
|
|
111
|
+
video: UIElement;
|
|
112
|
+
wbr: UIElement;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
interface SvgTags {
|
|
116
|
-
svg:
|
|
117
|
-
circle:
|
|
118
|
-
rect:
|
|
119
|
-
line:
|
|
120
|
-
path:
|
|
121
|
-
g:
|
|
122
|
-
text:
|
|
116
|
+
svg: UIElement;
|
|
117
|
+
circle: UIElement;
|
|
118
|
+
rect: UIElement;
|
|
119
|
+
line: UIElement;
|
|
120
|
+
path: UIElement;
|
|
121
|
+
g: UIElement;
|
|
122
|
+
text: UIElement;
|
|
123
123
|
//...
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
interface MathTags {
|
|
127
|
-
math:
|
|
128
|
-
mrow:
|
|
129
|
-
mi:
|
|
130
|
-
mo:
|
|
131
|
-
mn:
|
|
132
|
-
ms:
|
|
127
|
+
math: UIElement;
|
|
128
|
+
mrow: UIElement;
|
|
129
|
+
mi: UIElement;
|
|
130
|
+
mo: UIElement;
|
|
131
|
+
mn: UIElement;
|
|
132
|
+
ms: UIElement;
|
|
133
133
|
//...
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
export type Tags = HtmlTags & SvgTags & MathTags & {
|
|
137
|
-
[key: string]:
|
|
137
|
+
[key: string]: UIElement;
|
|
138
138
|
};
|
|
139
139
|
|
|
140
140
|
declare const tags: Tags;
|
package/src/ui/tags/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import UIElement from "../constructors/UIElement.js";
|
|
2
2
|
import { HTMLTags, SVGTags } from "./tags-list.js";
|
|
3
|
+
import { isStateGetter } from "../../hooks/use-state.js";
|
|
3
4
|
const _h=(tag, type, attributes, ...children)=>{
|
|
4
5
|
const { name, style, ...attrs } = attributes;
|
|
5
|
-
let element = new
|
|
6
|
+
let element = new UIElement(tag, name, type);
|
|
6
7
|
style && element.style(style);
|
|
7
8
|
attrs && element.setAttr(attrs);
|
|
8
9
|
children && element.append(...children);
|
|
@@ -15,23 +16,32 @@ const tags = new Proxy({}, {
|
|
|
15
16
|
get(target, prop) {
|
|
16
17
|
if (typeof prop !== 'string') return undefined;
|
|
17
18
|
let tag = prop.replaceAll("_","-").toLowerCase();
|
|
19
|
+
let type ;
|
|
20
|
+
if(HTMLTags.includes(tag)) type = 'html'
|
|
21
|
+
if(SVGTags.includes(tag)) type = 'svg'
|
|
18
22
|
if(HTMLTags.includes(tag)) return (...args)=>{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
console.log(isStateGetter(args[0]))
|
|
24
|
+
// if(typeof args[0] === 'function') {
|
|
25
|
+
// console.log(args[0], args[0]?.() instanceof StateGetter)
|
|
26
|
+
// globalThis.a = args[0]
|
|
27
|
+
// console.log({t : a.constructor})
|
|
28
|
+
// }
|
|
29
|
+
if(
|
|
30
|
+
['string', 'number'].includes(typeof args[0])
|
|
31
|
+
|| args[0] instanceof UIElement
|
|
32
|
+
|| (typeof args[0] === 'function' && args[0]().isStateGetter())
|
|
33
|
+
) return new UIElement({element :tag, name : tag, type}).append(...args);
|
|
34
|
+
return new UIElement({element : tag}).setAttr(args.shift()).append(...args)
|
|
25
35
|
}
|
|
26
|
-
if(SVGTags.includes(tag)) return (...args)=>new
|
|
27
|
-
return (...args)=>{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
// switch(tag){
|
|
36
|
+
// if(SVGTags.includes(tag)) return (...args) => new UIElement(tag,"",{el_type : "svg"}).append(...args);
|
|
37
|
+
// return (...args)=>{
|
|
38
|
+
// if(!(args[0] instanceof UIElement) && args[0] instanceof Object){
|
|
39
|
+
// let attributes = args.shift()
|
|
40
|
+
// return new UIElement(tag).setAttr(attributes).append(...args)
|
|
41
|
+
// }
|
|
42
|
+
// return new UIElement(tag).append(...args);
|
|
43
|
+
// }
|
|
44
|
+
// // switch(tag){
|
|
35
45
|
// case "html" : globalThis?.document?.createElement("html")
|
|
36
46
|
// case "head" :
|
|
37
47
|
// case "style" :
|
|
@@ -39,7 +49,7 @@ const tags = new Proxy({}, {
|
|
|
39
49
|
// case "meta" :
|
|
40
50
|
// case "srcipt":
|
|
41
51
|
// case "body" : return null; break;
|
|
42
|
-
// default : return new
|
|
52
|
+
// default : return new UIElement(tag);
|
|
43
53
|
// }
|
|
44
54
|
}
|
|
45
55
|
});
|
package/src/ui/text/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
class ZikoUIText extends
|
|
1
|
+
import UINode from "../constructors/UINode.js";
|
|
2
|
+
class ZikoUIText extends UINode {
|
|
3
3
|
constructor(...value) {
|
|
4
4
|
super("span", "text", false, ...value);
|
|
5
5
|
this.element = globalThis?.document?.createTextNode(...value)
|
package/src/ui/wrapper/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
class ZikoUIXMLWrapper extends
|
|
1
|
+
import UIElement from "../constructors/UIElement.js";
|
|
2
|
+
class ZikoUIXMLWrapper extends UIElement{
|
|
3
3
|
constructor(XMLContent, type){
|
|
4
|
-
super("div", "")
|
|
4
|
+
super({element : "div", name : ""})
|
|
5
5
|
this.element.append(type==="svg"?svg2dom(XMLContent):html2dom(XMLContent))
|
|
6
6
|
}
|
|
7
7
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export function composeClass(Class, mixin) {
|
|
2
|
-
const descriptors = Object.getOwnPropertyDescriptors(mixin);
|
|
3
|
-
|
|
4
|
-
class Composed extends Class {
|
|
5
|
-
constructor(...args) {
|
|
6
|
-
super(...args);
|
|
7
|
-
for (const key of Reflect.ownKeys(descriptors)) {
|
|
8
|
-
const desc = descriptors[key];
|
|
9
|
-
|
|
10
|
-
if (typeof desc.value === 'function') {
|
|
11
|
-
this[key] = desc.value.bind(this);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
for (const key of Reflect.ownKeys(descriptors)) {
|
|
18
|
-
const desc = descriptors[key];
|
|
19
|
-
|
|
20
|
-
if ('get' in desc || 'set' in desc) {
|
|
21
|
-
Object.defineProperty(Composed.prototype, key, desc);
|
|
22
|
-
} else if (typeof desc.value !== 'function') {
|
|
23
|
-
Object.defineProperty(Composed.prototype, key, desc);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return Composed;
|
|
28
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|