ziko 0.38.1 → 0.40.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.
Files changed (51) hide show
  1. package/dist/ziko.cjs +962 -1360
  2. package/dist/ziko.js +962 -1360
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +902 -1342
  5. package/package.json +1 -1
  6. package/src/data/index.js +2 -2
  7. package/src/data/string/checkers.js +27 -0
  8. package/src/data/string/converters.js +24 -0
  9. package/src/data/string/index.js +2 -1
  10. package/src/data/string-dep/index.js +1 -0
  11. package/src/events/types/clipboard.d.ts +2 -2
  12. package/src/events/types/focus.d.ts +2 -2
  13. package/src/events/types/pointer.d.ts +2 -2
  14. package/src/hooks/use-state.js +11 -8
  15. package/src/index.js +2 -1
  16. package/src/math/index.js +17 -17
  17. package/src/reactivity/hooks/UI/index.js +1 -1
  18. package/src/reactivity/hooks/UI/useRoot.js +3 -3
  19. package/src/time/animation/index.js +88 -70
  20. package/src/time/clocks/clock.js +62 -0
  21. package/src/time/clocks/index.js +3 -0
  22. package/src/time/clocks/scheduler.js +69 -0
  23. package/src/time/clocks/tick.js +34 -0
  24. package/src/time/converters/index.js +1 -0
  25. package/src/time/delay/index.js +2 -0
  26. package/src/time/delay/sleep.js +3 -0
  27. package/src/time/delay/timeout.js +15 -0
  28. package/src/time/ease/index.js +77 -0
  29. package/src/time/index.js +6 -9
  30. package/src/time/loop/index.js +67 -51
  31. package/src/time/utils/index.js +2 -2
  32. package/src/ui/__methods__/attrs.js +49 -0
  33. package/src/ui/__methods__/index.js +2 -1
  34. package/src/ui/__methods__/style.js +34 -0
  35. package/src/ui/__utils__/index.js +2 -2
  36. package/src/ui/constructors/{ZikoUIElement.js → UIElement.js} +23 -64
  37. package/src/ui/constructors/{ZikoUINode.js → UINode.js} +2 -2
  38. package/src/ui/constructors/style/index.js +2 -1
  39. package/src/ui/flex/index.js +8 -8
  40. package/src/ui/graphics/canvas.js +2 -2
  41. package/src/ui/graphics/svg.js +2 -2
  42. package/src/ui/grid/index.js +4 -4
  43. package/src/ui/index.js +2 -2
  44. package/src/ui/suspense/index.js +3 -3
  45. package/src/ui/tags/index.d.ts.txt +125 -125
  46. package/src/ui/tags/index.js +12 -16
  47. package/src/ui/text/index.js +2 -2
  48. package/src/ui/wrapper/index.js +3 -3
  49. package/src/time/utils/ease.js +0 -144
  50. /package/src/data/{string → string-dep}/patterns.js +0 -0
  51. /package/src/data/{string → string-dep}/string.js +0 -0
@@ -1,140 +1,140 @@
1
- import ZikoUIElement from "../elements/ZikoUIElement.js";
1
+ import UIElement from "../elements/UIElement.js";
2
2
  interface HtmlTags {
3
- a: ZikoUIElement;
4
- abbr: ZikoUIElement;
5
- address: ZikoUIElement;
6
- area: ZikoUIElement;
7
- article: ZikoUIElement;
8
- aside: ZikoUIElement;
9
- audio: ZikoUIElement;
10
- b: ZikoUIElement;
11
- base: ZikoUIElement;
12
- bdi: ZikoUIElement;
13
- bdo: ZikoUIElement;
14
- blockquote: ZikoUIElement;
15
- body: ZikoUIElement;
16
- br: ZikoUIElement;
17
- button: ZikoUIElement;
18
- canvas: ZikoUIElement;
19
- caption: ZikoUIElement;
20
- cite: ZikoUIElement;
21
- code: ZikoUIElement;
22
- col: ZikoUIElement;
23
- colgroup: ZikoUIElement;
24
- data: ZikoUIElement;
25
- datalist: ZikoUIElement;
26
- dd: ZikoUIElement;
27
- del: ZikoUIElement;
28
- details: ZikoUIElement;
29
- dfn: ZikoUIElement;
30
- dialog: ZikoUIElement;
31
- div: ZikoUIElement;
32
- dl: ZikoUIElement;
33
- dt: ZikoUIElement;
34
- em: ZikoUIElement;
35
- embed: ZikoUIElement;
36
- fieldset: ZikoUIElement;
37
- figcaption: ZikoUIElement;
38
- figure: ZikoUIElement;
39
- footer: ZikoUIElement;
40
- form: ZikoUIElement;
41
- h1: ZikoUIElement;
42
- h2: ZikoUIElement;
43
- h3: ZikoUIElement;
44
- h4: ZikoUIElement;
45
- h5: ZikoUIElement;
46
- h6: ZikoUIElement;
47
- head: ZikoUIElement;
48
- header: ZikoUIElement;
49
- hgroup: ZikoUIElement;
50
- hr: ZikoUIElement;
51
- html: ZikoUIElement;
52
- i: ZikoUIElement;
53
- iframe: ZikoUIElement;
54
- img: ZikoUIElement;
55
- input: ZikoUIElement;
56
- ins: ZikoUIElement;
57
- kbd: ZikoUIElement;
58
- label: ZikoUIElement;
59
- legend: ZikoUIElement;
60
- li: ZikoUIElement;
61
- link: ZikoUIElement;
62
- main: ZikoUIElement;
63
- map: ZikoUIElement;
64
- mark: ZikoUIElement;
65
- meta: ZikoUIElement;
66
- meter: ZikoUIElement;
67
- nav: ZikoUIElement;
68
- noscript: ZikoUIElement;
69
- object: ZikoUIElement;
70
- ol: ZikoUIElement;
71
- optgroup: ZikoUIElement;
72
- option: ZikoUIElement;
73
- output: ZikoUIElement;
74
- p: ZikoUIElement;
75
- param: ZikoUIElement;
76
- picture: ZikoUIElement;
77
- pre: ZikoUIElement;
78
- progress: ZikoUIElement;
79
- q: ZikoUIElement;
80
- rp: ZikoUIElement;
81
- rt: ZikoUIElement;
82
- ruby: ZikoUIElement;
83
- s: ZikoUIElement;
84
- samp: ZikoUIElement;
85
- script: ZikoUIElement;
86
- section: ZikoUIElement;
87
- select: ZikoUIElement;
88
- small: ZikoUIElement;
89
- source: ZikoUIElement;
90
- span: ZikoUIElement;
91
- strong: ZikoUIElement;
92
- style: ZikoUIElement;
93
- sub: ZikoUIElement;
94
- summary: ZikoUIElement;
95
- sup: ZikoUIElement;
96
- table: ZikoUIElement;
97
- tbody: ZikoUIElement;
98
- td: ZikoUIElement;
99
- template: ZikoUIElement;
100
- textarea: ZikoUIElement;
101
- tfoot: ZikoUIElement;
102
- th: ZikoUIElement;
103
- thead: ZikoUIElement;
104
- time: ZikoUIElement;
105
- title: ZikoUIElement;
106
- tr: ZikoUIElement;
107
- track: ZikoUIElement;
108
- u: ZikoUIElement;
109
- ul: ZikoUIElement;
110
- var: ZikoUIElement;
111
- video: ZikoUIElement;
112
- wbr: ZikoUIElement;
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: ZikoUIElement;
117
- circle: ZikoUIElement;
118
- rect: ZikoUIElement;
119
- line: ZikoUIElement;
120
- path: ZikoUIElement;
121
- g: ZikoUIElement;
122
- text: ZikoUIElement;
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: ZikoUIElement;
128
- mrow: ZikoUIElement;
129
- mi: ZikoUIElement;
130
- mo: ZikoUIElement;
131
- mn: ZikoUIElement;
132
- ms: ZikoUIElement;
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]: ZikoUIElement;
137
+ [key: string]: UIElement;
138
138
  };
139
139
 
140
140
  declare const tags: Tags;
@@ -1,9 +1,9 @@
1
- import ZikoUIElement from "../constructors/ZikoUIElement.js";
1
+ import UIElement from "../constructors/UIElement.js";
2
2
  import { HTMLTags, SVGTags } from "./tags-list.js";
3
3
  import { isStateGetter } from "../../hooks/use-state.js";
4
4
  const _h=(tag, type, attributes, ...children)=>{
5
5
  const { name, style, ...attrs } = attributes;
6
- let element = new ZikoUIElement(tag, name, type);
6
+ let element = new UIElement(tag, name, type);
7
7
  style && element.style(style);
8
8
  attrs && element.setAttr(attrs);
9
9
  children && element.append(...children);
@@ -19,27 +19,23 @@ const tags = new Proxy({}, {
19
19
  let type ;
20
20
  if(HTMLTags.includes(tag)) type = 'html'
21
21
  if(SVGTags.includes(tag)) type = 'svg'
22
- if(HTMLTags.includes(tag)) return (...args)=>{
22
+ return (...args)=>{
23
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
24
  if(
30
25
  ['string', 'number'].includes(typeof args[0])
31
- || args[0] instanceof ZikoUIElement
26
+ || args[0] instanceof UIElement
32
27
  || (typeof args[0] === 'function' && args[0]().isStateGetter())
33
- ) return new ZikoUIElement(tag, tag, {type}).append(...args);
34
- return new ZikoUIElement(tag).setAttr(args.shift()).append(...args)
28
+ ) return new UIElement({element : tag, name : tag, type}).append(...args);
29
+ // console.log(args[0])
30
+ return new UIElement({element : tag}).setAttr(args.shift()).append(...args)
35
31
  }
36
- // if(SVGTags.includes(tag)) return (...args) => new ZikoUIElement(tag,"",{el_type : "svg"}).append(...args);
32
+ // if(SVGTags.includes(tag)) return (...args) => new UIElement(tag,"",{el_type : "svg"}).append(...args);
37
33
  // return (...args)=>{
38
- // if(!(args[0] instanceof ZikoUIElement) && args[0] instanceof Object){
34
+ // if(!(args[0] instanceof UIElement) && args[0] instanceof Object){
39
35
  // let attributes = args.shift()
40
- // return new ZikoUIElement(tag).setAttr(attributes).append(...args)
36
+ // return new UIElement(tag).setAttr(attributes).append(...args)
41
37
  // }
42
- // return new ZikoUIElement(tag).append(...args);
38
+ // return new UIElement(tag).append(...args);
43
39
  // }
44
40
  // // switch(tag){
45
41
  // case "html" : globalThis?.document?.createElement("html")
@@ -49,7 +45,7 @@ const tags = new Proxy({}, {
49
45
  // case "meta" :
50
46
  // case "srcipt":
51
47
  // case "body" : return null; break;
52
- // default : return new ZikoUIElement(tag);
48
+ // default : return new UIElement(tag);
53
49
  // }
54
50
  }
55
51
  });
@@ -1,5 +1,5 @@
1
- import ZikoUINode from "../constructors/ZikoUINode.js";
2
- class ZikoUIText extends ZikoUINode {
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)
@@ -1,7 +1,7 @@
1
- import ZikoUIElement from "../constructors/ZikoUIElement.js";
2
- class ZikoUIXMLWrapper extends ZikoUIElement{
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,144 +0,0 @@
1
- const Ease={
2
- Linear:function(t){
3
- return t;
4
- },
5
- InSin(t){
6
- return 1 - Math.cos((t * Math.PI) / 2);
7
- },
8
- OutSin(t){
9
- return Math.sin((t * Math.PI) / 2);
10
- },
11
- InOutSin(t){
12
- return -(Math.cos(Math.PI * t) - 1) / 2;
13
- },
14
- InQuad(t){
15
- return t**2;
16
- },
17
- OutQuad(t){
18
- return 1 - Math.pow((1 - t),2)
19
- },
20
- InOutQuad(t){
21
- return t < 0.5 ? 2 * Math.pow(t,2) : 1 - Math.pow(-2 * t + 2, 2) / 2;
22
- },
23
- InCubic(t){
24
- return t**3;
25
- },
26
- OutCubic(t){
27
- return 1 - Math.pow((1 - t),3)
28
- },
29
- InOutCubic(t){
30
- return t < 0.5 ? 4 * Math.pow(t,3) : 1 - Math.pow(-2 * t + 2, 3) / 2;
31
- },
32
- InQuart(t){
33
- return t**4;
34
- },
35
- OutQuart(t){
36
- return 1 - Math.pow((1 - t),4);
37
- },
38
- InOutQuart(t){
39
- return t < 0.5 ? 8 * Math.pow(t,4) : 1 - Math.pow(-2 * t + 2, 4) / 2;
40
- },
41
- InQuint(t){
42
- return t**5;
43
- },
44
- OutQuint(t){
45
- return 1 - Math.pow((1 - t),5);
46
- },
47
- InOutQuint(t){
48
- return t < 0.5 ? 16 * Math.pow(t,5) : 1 - Math.pow(-2 * t + 2, 5) / 2;
49
- },
50
- InExpo(t){
51
- return t === 0 ? 0 : Math.pow(2, 10 * t - 10);
52
- },
53
- OutExpo(t){
54
- return t === 1 ? 1 : 1 - Math.pow(2, -10 * t);
55
- },
56
- InOutExpo(t){
57
- return t === 0? 0: t === 1? 1: t < 0.5 ? Math.pow(2, 20 * t - 10) / 2: (2 - Math.pow(2, -20 * t + 10)) / 2;
58
- },
59
- InCirc(t){
60
- return 1 - Math.sqrt(1 - Math.pow(t, 2));
61
- },
62
- OutCirc(t){
63
- return Math.sqrt(1 - Math.pow(t - 1, 2));
64
- },
65
- InOutCic(t){
66
- return t < 0.5? (1 - Math.sqrt(1 - Math.pow(2 * t, 2))) / 2: (Math.sqrt(1 - Math.pow(-2 * t + 2, 2)) + 1) / 2;
67
- },
68
- Arc(t){
69
- return 1 - Math.sin(Math.acos(t));
70
- },
71
- Back(t){
72
- // To Be Changed
73
- let x=1
74
- return Math.pow(t, 2) * ((x + 1) * t - x);
75
- },
76
- Elastic(t){
77
- return -2*Math.pow(2, 10 * (t - 1)) * Math.cos(20 * Math.PI * t / 3 * t);
78
- },
79
- InBack(t){
80
- const c1 = 1.70158;
81
- const c3 = c1 + 1;
82
- return c3 *Math.pow(t,3)- c1 * (t**2);
83
- },
84
- OutBack(t){
85
- const c1 = 1.70158;
86
- const c3 = c1 + 1;
87
- return 1 + c3 * Math.pow(t - 1, 3) + c1 * Math.pow(t - 1, 2);
88
- },
89
- InOutBack(t){
90
- const c1 = 1.70158;
91
- const c2 = c1 * 1.525;
92
- return t < 0.5
93
- ? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2
94
- : (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2;
95
- },
96
- InElastic(t){
97
- const c4 = (2 * Math.PI) / 3;return t === 0
98
- ? 0
99
- : t === 1
100
- ? 1
101
- : -Math.pow(2, 10 * t - 10) * Math.sin((t * 10 - 10.75) * c4);
102
- },
103
- OutElastic(t){
104
- const c4 = (2 * Math.PI) / 3;
105
- return t === 0
106
- ? 0
107
- : t === 1
108
- ? 1
109
- : Math.pow(2, -10 * t) * Math.sin((t * 10 - 0.75) * c4) + 1;
110
- },
111
- InOutElastic(t){
112
- const c5 = (2 * Math.PI) / 4.5;
113
- return t === 0
114
- ? 0
115
- : t === 1
116
- ? 1
117
- : t < 0.5
118
- ? -(Math.pow(2, 20 * t - 10) * Math.sin((20 * t - 11.125) * c5)) / 2
119
- : (Math.pow(2, -20 * t + 10) * Math.sin((20 * t - 11.125) * c5)) / 2 + 1;
120
- },
121
- InBounce(t){
122
- return 1 - Ease.OutBounce(1-t);
123
- },
124
- OutBounce(t){
125
- const n1 = 7.5625;
126
- const d1 = 2.75;
127
- if (t < 1 / d1) {
128
- return n1 * t * t;
129
- } else if (t < 2 / d1) {
130
- return n1 * (t -= 1.5 / d1) * t + 0.75;
131
- } else if (t < 2.5 / d1) {
132
- return n1 * (t -= 2.25 / d1) * t + 0.9375;
133
- } else {
134
- return n1 * (t -= 2.625 / d1) * t + 0.984375;
135
- }
136
-
137
- },
138
- InOutBounce(t){
139
- return t < 0.5
140
- ? (1 - Ease.OutBounce(1 - 2 * t)) / 2
141
- : (1 + Ease.OutBounce(2 * t - 1)) / 2;
142
- }
143
- }
144
- export default Ease
File without changes
File without changes