ziko 0.0.2 → 0.0.4
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 +11 -15
- package/dist/ziko.cjs +459 -82
- package/dist/ziko.js +459 -82
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +459 -82
- package/package.json +5 -7
- package/src/App/app.js +9 -0
- package/src/Reactivity/Events/Global/CustomEvent.js +2 -2
- package/src/Reactivity/Events/Global/Mouse.js +230 -0
- package/src/Reactivity/Events/Global/Touch.js +0 -0
- package/src/Reactivity/Events/Global/Wheel.js +44 -0
- package/src/Reactivity/Events/Partiel/Hash.js +44 -0
- package/src/Reactivity/Events/Partiel/MediaEvent.js +1 -0
- package/src/Reactivity/Events/index.js +11 -2
- package/src/UI/CustomElement/Flex.js +22 -22
- package/src/UI/Media/Audio/index.js +14 -1
- package/src/UI/Media/Video/index.js +13 -0
- package/src/UI/ZikoUIElement.js +52 -29
- package/starter/bin/index.js +0 -10
package/src/UI/ZikoUIElement.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { ZikoStyle } from "./Style";
|
|
2
2
|
import {
|
|
3
|
-
Pointer,
|
|
3
|
+
Pointer,
|
|
4
|
+
Mouse,
|
|
5
|
+
Wheel,
|
|
4
6
|
Key,
|
|
5
7
|
Drag ,
|
|
6
8
|
Drop,
|
|
7
9
|
Click ,
|
|
8
10
|
Clipboard ,
|
|
9
11
|
Focus,
|
|
10
|
-
|
|
12
|
+
customEvent,
|
|
11
13
|
} from "../Reactivity/Events"
|
|
12
14
|
import {
|
|
13
15
|
WatchIntersection,
|
|
@@ -27,19 +29,16 @@ class ZikoUIElement {
|
|
|
27
29
|
isRoot:false,
|
|
28
30
|
isHidden: false,
|
|
29
31
|
isFrozzen:false,
|
|
30
|
-
// transformMatrix:matrix([
|
|
31
|
-
// [0,0,0],
|
|
32
|
-
// [0,0,0],
|
|
33
|
-
// [1,1,0]
|
|
34
|
-
// ]),
|
|
35
32
|
style: ZikoStyle({}),
|
|
36
33
|
attributes: {},
|
|
37
34
|
filters: {},
|
|
38
|
-
|
|
35
|
+
temp:{}
|
|
39
36
|
};
|
|
40
37
|
this.items = [];
|
|
41
38
|
this.events = {
|
|
42
39
|
ptr:null,
|
|
40
|
+
mouse:null,
|
|
41
|
+
Wheel:null,
|
|
43
42
|
key:null,
|
|
44
43
|
drag:null,
|
|
45
44
|
drop:null,
|
|
@@ -61,7 +60,7 @@ class ZikoUIElement {
|
|
|
61
60
|
padding:0,
|
|
62
61
|
});
|
|
63
62
|
this.size("auto", "auto");
|
|
64
|
-
globalThis.__UI__[this.cache.name]?.push(this)
|
|
63
|
+
globalThis.__UI__[this.cache.name]?.push(this);
|
|
65
64
|
}
|
|
66
65
|
get st(){
|
|
67
66
|
return this.cache.style;
|
|
@@ -84,7 +83,7 @@ class ZikoUIElement {
|
|
|
84
83
|
root=root.parent;
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
|
-
clone() {
|
|
86
|
+
clone(render=false) {
|
|
88
87
|
// Not working For Table
|
|
89
88
|
const UI = new this.constructor();
|
|
90
89
|
UI.__proto__=this.__proto__;
|
|
@@ -93,7 +92,7 @@ class ZikoUIElement {
|
|
|
93
92
|
UI.append(...items);
|
|
94
93
|
}
|
|
95
94
|
else UI.element=this.element.cloneNode(true);
|
|
96
|
-
return UI;
|
|
95
|
+
return UI.render(render);
|
|
97
96
|
}
|
|
98
97
|
style(styles,{target = "parent", maskVector = null } = {}){
|
|
99
98
|
this.st.style(styles,{target,maskVector});
|
|
@@ -262,14 +261,17 @@ class ZikoUIElement {
|
|
|
262
261
|
this.items.forEach(callback);
|
|
263
262
|
return this;
|
|
264
263
|
}
|
|
265
|
-
|
|
264
|
+
where(condition_callback,if_callback,else_callback){
|
|
266
265
|
this.items.filter(condition_callback).forEach(if_callback)
|
|
267
266
|
return this;
|
|
268
267
|
}
|
|
268
|
+
filter(condition){
|
|
269
|
+
return this.items.filter(condition);
|
|
270
|
+
}
|
|
269
271
|
filterByTextContent(text,exactMatch=false){
|
|
270
272
|
this.items.map(n=>n.render());
|
|
271
273
|
this.items.filter(n=>{
|
|
272
|
-
const content=n.element.textContent
|
|
274
|
+
const content=n.element.textContent;
|
|
273
275
|
return !(exactMatch?content===text:content.includes(text))
|
|
274
276
|
}).map(n=>n.render(false));
|
|
275
277
|
return this;
|
|
@@ -323,6 +325,41 @@ class ZikoUIElement {
|
|
|
323
325
|
this.events.ptr.onOut(...callbacks);
|
|
324
326
|
return this;
|
|
325
327
|
}
|
|
328
|
+
onMouseMove(...callbacks){
|
|
329
|
+
if(!this.events.mouse)this.events.mouse = Mouse(this);
|
|
330
|
+
this.events.mouse.onMove(...callbacks);
|
|
331
|
+
return this;
|
|
332
|
+
}
|
|
333
|
+
onMouseDown(...callbacks){
|
|
334
|
+
if(!this.events.mouse)this.events.mouse = Mouse(this);
|
|
335
|
+
this.events.mouse.onDown(...callbacks);
|
|
336
|
+
return this;
|
|
337
|
+
}
|
|
338
|
+
onMouseUp(...callbacks){
|
|
339
|
+
if(!this.events.mouse)this.events.mouse = Mouse(this);
|
|
340
|
+
this.events.mouse.onUp(...callbacks);
|
|
341
|
+
return this;
|
|
342
|
+
}
|
|
343
|
+
onMouseEnter(...callbacks){
|
|
344
|
+
if(!this.events.mouse)this.events.mouse = Mouse(this);
|
|
345
|
+
this.events.mouse.onEnter(...callbacks);
|
|
346
|
+
return this;
|
|
347
|
+
}
|
|
348
|
+
onMouseLeave(...callbacks){
|
|
349
|
+
if(!this.events.mouse)this.events.mouse = Mouse(this);
|
|
350
|
+
this.events.mouse.onLeave(...callbacks);
|
|
351
|
+
return this;
|
|
352
|
+
}
|
|
353
|
+
onMouseOut(...callbacks){
|
|
354
|
+
if(!this.events.mouse)this.events.mouse = Mouse(this);
|
|
355
|
+
this.events.mouse.onOut(...callbacks);
|
|
356
|
+
return this;
|
|
357
|
+
}
|
|
358
|
+
onWheel(...callbacks){
|
|
359
|
+
if(!this.events.wheel)this.events.wheel = Wheel(this);
|
|
360
|
+
this.events.wheel.onWheel(...callbacks);
|
|
361
|
+
return this;
|
|
362
|
+
}
|
|
326
363
|
onKeyDown(...callbacks){
|
|
327
364
|
if(!this.events.key)this.events.key = Key(this);
|
|
328
365
|
this.events.key.onDown(...callbacks);
|
|
@@ -404,12 +441,12 @@ class ZikoUIElement {
|
|
|
404
441
|
return this;
|
|
405
442
|
}
|
|
406
443
|
on(event_name,...callbacks){
|
|
407
|
-
if(!this.events.custom)this.events.custom =
|
|
444
|
+
if(!this.events.custom)this.events.custom = customEvent(this);
|
|
408
445
|
this.events.custom.on(event_name,...callbacks);
|
|
409
446
|
return this;
|
|
410
447
|
}
|
|
411
448
|
emit(event_name,detail={}){
|
|
412
|
-
if(!this.events.custom)this.events.custom =
|
|
449
|
+
if(!this.events.custom)this.events.custom = customEvent(this);
|
|
413
450
|
this.events.custom.emit(event_name,detail);
|
|
414
451
|
return this;
|
|
415
452
|
}
|
|
@@ -446,20 +483,6 @@ class ZikoUIElement {
|
|
|
446
483
|
isVisible: topVisible || bottomVisible || rightVisible || leftVisible,
|
|
447
484
|
};
|
|
448
485
|
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
// toggleSlide() {}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
// Glassmorphism(background = "rgba(255,255,255,0.1)", blur = "1px") {
|
|
455
|
-
// this.style({ background: background, backdropFilter: blur });
|
|
456
|
-
// return this;
|
|
457
|
-
// }
|
|
458
|
-
// Neumorphism(r = "50px", bg = "cyan", box = "13px -13px 49px #5d8fac") {
|
|
459
|
-
// this.style({ borderRadius: r, background: bg, boxShadow: box });
|
|
460
|
-
// return this;
|
|
461
|
-
// }
|
|
462
|
-
|
|
463
486
|
setFullScreen(set = true, e) {
|
|
464
487
|
if(!this.element.requestFullscreen){
|
|
465
488
|
console.error("Fullscreen API is not supported in this browser.");
|
package/starter/bin/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import path from "path"
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { createFolder,copyFolder , runCommand } from "./utils/commands.js";
|
|
5
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
const TEMPLATE = path.join(__dirname,"../template");
|
|
7
|
-
const PROJECT_TITLE = process.argv[2]||"zikojs-project";
|
|
8
|
-
createFolder(PROJECT_TITLE);
|
|
9
|
-
copyFolder(TEMPLATE,path.join(process.cwd(),PROJECT_TITLE));
|
|
10
|
-
runCommand(`cd ${PROJECT_TITLE} && npm install`);
|