ziko 0.0.1 → 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.
@@ -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
- CustomEvent,
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
- filter(condition_callback,if_callback,else_callback){
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 = CustomEvent(this);
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 = CustomEvent(this);
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/src/index.js CHANGED
@@ -45,8 +45,13 @@ function RemoveAll(){
45
45
  Graphics.RemoveAll();
46
46
  Data.RemoveAll()
47
47
  }
48
+ export * from "./Math"
49
+ export * from "./UI";
50
+ export * from "./Graphics";
51
+ export * from "./Time"
52
+ export * from "./Data"
53
+ export * from "./App"
48
54
  export {
49
- Ziko,
50
55
  App,
51
56
  Math,
52
57
  UI,
@@ -59,11 +64,7 @@ export {
59
64
  ExtractAll,
60
65
  RemoveAll
61
66
  };
62
- export * from "./Math"
63
- export * from "./UI";
64
- export * from "./Graphics";
65
- export * from "./Time"
66
- export * from "./Data"
67
- export * from "./App"
67
+ export default Ziko;
68
+
68
69
 
69
70