ziko 0.0.12 → 0.0.14

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 (281) hide show
  1. package/dist/ziko.cjs +3069 -2463
  2. package/dist/ziko.js +2993 -2329
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +2984 -2328
  5. package/package.json +39 -12
  6. package/src/__helpers__/index.js +41 -0
  7. package/src/app/accessibility/index.js +0 -0
  8. package/src/app/app.js +46 -0
  9. package/src/app/component/index.js +38 -0
  10. package/src/app/globals/index.js +20 -0
  11. package/src/app/index.js +12 -0
  12. package/src/app/params/index.js +40 -0
  13. package/src/app/router/index.js +67 -0
  14. package/src/app/seo/index.js +43 -0
  15. package/src/app/themes/dark.js +885 -0
  16. package/src/app/themes/index.js +11 -0
  17. package/src/app/themes/light.js +255 -0
  18. package/src/data/api/fetchdom.js +14 -0
  19. package/src/data/api/index.js +4 -0
  20. package/src/data/api/preload.js +11 -0
  21. package/src/data/converter/adoc.js +130 -0
  22. package/src/data/converter/array.js +43 -0
  23. package/src/data/converter/canvas.js +25 -0
  24. package/src/data/converter/csv.js +33 -0
  25. package/src/data/converter/idea.txt +10 -0
  26. package/src/data/converter/index.js +34 -0
  27. package/src/data/converter/json.js +80 -0
  28. package/src/data/converter/markdown.js +95 -0
  29. package/src/data/converter/object.js +70 -0
  30. package/src/data/converter/svg.js +11 -0
  31. package/src/data/decorators.js +0 -0
  32. package/src/data/index.js +74 -0
  33. package/src/data/parser/markdown.js +0 -0
  34. package/src/data/parser/xml.js +47 -0
  35. package/src/data/string/index.js +1 -0
  36. package/src/data/string/patterns.js +12 -0
  37. package/src/data/string/string.js +170 -0
  38. package/src/graphics/canvas/_canvas_offscreen +0 -0
  39. package/src/graphics/canvas/canvas.js +189 -0
  40. package/src/graphics/canvas/elements/Basic/arc.js +43 -0
  41. package/src/graphics/canvas/elements/Basic/image.js +0 -0
  42. package/src/graphics/canvas/elements/Basic/line.js +26 -0
  43. package/src/graphics/canvas/elements/Basic/path.js +0 -0
  44. package/src/graphics/canvas/elements/Basic/points.js +48 -0
  45. package/src/graphics/canvas/elements/Basic/polygon.js +7 -0
  46. package/src/graphics/canvas/elements/Basic/polyline.js +0 -0
  47. package/src/graphics/canvas/elements/Basic/rect.js +46 -0
  48. package/src/graphics/canvas/elements/Basic/text.js +0 -0
  49. package/src/graphics/canvas/elements/Chart/histogram.js +0 -0
  50. package/src/graphics/canvas/elements/Chart/plot.js +0 -0
  51. package/src/graphics/canvas/elements/Chart/scatter.js +2 -0
  52. package/src/graphics/canvas/elements/Chart/stem.js +0 -0
  53. package/src/graphics/canvas/elements/Element.js +115 -0
  54. package/src/graphics/canvas/elements/Groupe.js +0 -0
  55. package/src/graphics/canvas/elements/grid.js +0 -0
  56. package/src/graphics/canvas/elements/index.js +13 -0
  57. package/src/graphics/canvas/filter/index.js +0 -0
  58. package/src/graphics/canvas/index.js +15 -0
  59. package/src/graphics/canvas/paint/index.js +0 -0
  60. package/src/graphics/canvas/utils/color.js +8 -0
  61. package/src/graphics/canvas/utils/floodFill.js +58 -0
  62. package/src/graphics/index.js +69 -0
  63. package/src/graphics/svg/Elements/Basic/circle.js +26 -0
  64. package/src/graphics/svg/Elements/Basic/ellipse.js +21 -0
  65. package/src/graphics/svg/Elements/Basic/foreignObject.js +33 -0
  66. package/src/graphics/svg/Elements/Basic/groupe.js +29 -0
  67. package/src/graphics/svg/Elements/Basic/image.js +33 -0
  68. package/src/graphics/svg/Elements/Basic/line.js +29 -0
  69. package/src/graphics/svg/Elements/Basic/link.js +30 -0
  70. package/src/graphics/svg/Elements/Basic/path.js +59 -0
  71. package/src/graphics/svg/Elements/Basic/polygon.js +32 -0
  72. package/src/graphics/svg/Elements/Basic/polyline.js +4 -0
  73. package/src/graphics/svg/Elements/Basic/rect.js +43 -0
  74. package/src/graphics/svg/Elements/Basic/text.js +26 -0
  75. package/src/graphics/svg/Elements/Derived/grid.js +9 -0
  76. package/src/graphics/svg/Elements/ZikoSvgElement.js +46 -0
  77. package/src/graphics/svg/Elements/index.js +14 -0
  78. package/src/graphics/svg/index.js +2 -0
  79. package/src/graphics/svg/svg.js +115 -0
  80. package/src/index.js +88 -0
  81. package/src/math/absract.js +1 -0
  82. package/src/math/calculus/index.js +1 -0
  83. package/src/math/calculus/special-functions/bessel.js +31 -0
  84. package/src/math/calculus/special-functions/beta.js +38 -0
  85. package/src/math/calculus/special-functions/gamma.js +30 -0
  86. package/src/math/calculus/special-functions/index.js +4 -0
  87. package/src/math/complex/Fractals/julia.js +0 -0
  88. package/src/math/complex/index.js +203 -0
  89. package/src/math/const.js +3 -0
  90. package/src/math/discret/Combinaison/index.js +34 -0
  91. package/src/math/discret/Conversion/index.js +86 -0
  92. package/src/math/discret/Logic/index.js +46 -0
  93. package/src/math/discret/Permutation/index.js +31 -0
  94. package/src/math/discret/Set/index.js +2 -0
  95. package/src/math/discret/Set/power-set.js +15 -0
  96. package/src/math/discret/Set/sub-set.js +10 -0
  97. package/src/math/discret/index.js +23 -0
  98. package/src/math/functions/index.js +182 -0
  99. package/src/math/index.js +189 -0
  100. package/src/math/matrix/Decomposition.js +90 -0
  101. package/src/math/matrix/LinearSystem.js +10 -0
  102. package/src/math/matrix/Matrix.js +717 -0
  103. package/src/math/matrix/index.js +3 -0
  104. package/src/math/numeric/index.js +0 -0
  105. package/src/math/random/index.js +173 -0
  106. package/src/math/signal/__np.py.txt +40 -0
  107. package/src/math/signal/conv.js +175 -0
  108. package/src/math/signal/fft.js +55 -0
  109. package/src/math/signal/filter.js +39 -0
  110. package/src/math/signal/functions.js +146 -0
  111. package/src/math/signal/index.js +110 -0
  112. package/src/math/statistics/Functions/index.js +100 -0
  113. package/src/math/statistics/index.js +16 -0
  114. package/src/math/utils/arithmetic.js +139 -0
  115. package/src/math/utils/checkers.js +29 -0
  116. package/src/math/utils/comparaison.js +1 -0
  117. package/src/math/utils/conversions.js +19 -0
  118. package/src/math/utils/discret.js +51 -0
  119. package/src/math/utils/index.js +102 -0
  120. package/src/math/utils/mapfun.js +50 -0
  121. package/src/reactivity/events/Global/Click.js +56 -0
  122. package/src/reactivity/events/Global/Clipboard.js +84 -0
  123. package/src/reactivity/events/Global/CustomEvent.js +53 -0
  124. package/src/reactivity/events/Global/Drag.js +137 -0
  125. package/src/reactivity/events/Global/Focus.js +56 -0
  126. package/src/reactivity/events/Global/Key.js +104 -0
  127. package/src/reactivity/events/Global/Mouse.js +230 -0
  128. package/src/reactivity/events/Global/Pointer.js +234 -0
  129. package/src/reactivity/events/Global/Swipe.js +147 -0
  130. package/src/reactivity/events/Global/Touch.js +0 -0
  131. package/src/reactivity/events/Global/Wheel.js +44 -0
  132. package/src/reactivity/events/Partiel/Hash.js +44 -0
  133. package/src/reactivity/events/Partiel/Input.js +59 -0
  134. package/src/reactivity/events/Partiel/Media.js +1 -0
  135. package/src/reactivity/events/ZikoEvent.js +91 -0
  136. package/src/reactivity/events/index.js +63 -0
  137. package/src/reactivity/hooks/Contexte/index.js +1 -0
  138. package/src/reactivity/hooks/Contexte/useSuccesifKeys.js +14 -0
  139. package/src/reactivity/hooks/Decorators/index.js +6 -0
  140. package/src/reactivity/hooks/Decorators/time.js +17 -0
  141. package/src/reactivity/hooks/Decorators/type.js +88 -0
  142. package/src/reactivity/hooks/Interactions/index.js +4 -0
  143. package/src/reactivity/hooks/Interactions/useBluetooth.js +48 -0
  144. package/src/reactivity/hooks/Interactions/useChannel.js +50 -0
  145. package/src/reactivity/hooks/Interactions/useEventEmmiter.js +64 -0
  146. package/src/reactivity/hooks/Interactions/useSerial.js +0 -0
  147. package/src/reactivity/hooks/Interactions/useThread.js +44 -0
  148. package/src/reactivity/hooks/Interactions/useUsb.js +0 -0
  149. package/src/reactivity/hooks/Sensors/index.js +2 -0
  150. package/src/reactivity/hooks/Sensors/useBattery.js +36 -0
  151. package/src/reactivity/hooks/Sensors/useCamera.js +0 -0
  152. package/src/reactivity/hooks/Sensors/useGeolocation.js +17 -0
  153. package/src/reactivity/hooks/Sensors/useMicro.js +0 -0
  154. package/src/reactivity/hooks/Sensors/useOrientation.js +0 -0
  155. package/src/reactivity/hooks/Storage/index.js +1 -0
  156. package/src/reactivity/hooks/Storage/useCookie.js +0 -0
  157. package/src/reactivity/hooks/Storage/useIndexedDb.js +0 -0
  158. package/src/reactivity/hooks/Storage/useStorage.js +73 -0
  159. package/src/reactivity/hooks/UI/index.js +5 -0
  160. package/src/reactivity/hooks/UI/useCssLink.js +0 -0
  161. package/src/reactivity/hooks/UI/useCssText.js +21 -0
  162. package/src/reactivity/hooks/UI/useFavIcon.js +38 -0
  163. package/src/reactivity/hooks/UI/useLinearGradient.js +0 -0
  164. package/src/reactivity/hooks/UI/useMediaQuery.js +43 -0
  165. package/src/reactivity/hooks/UI/useRadialGradient.js +0 -0
  166. package/src/reactivity/hooks/UI/useStyle.js +79 -0
  167. package/src/reactivity/hooks/UI/useTheme.js +62 -0
  168. package/src/reactivity/hooks/UI/useTitle.js +30 -0
  169. package/src/reactivity/hooks/index.js +85 -0
  170. package/src/reactivity/hooks/todo.md +26 -0
  171. package/src/reactivity/idea +2 -0
  172. package/src/reactivity/index.js +22 -0
  173. package/src/reactivity/observer/attributes.js +28 -0
  174. package/src/reactivity/observer/children.js +37 -0
  175. package/src/reactivity/observer/index.js +44 -0
  176. package/src/reactivity/observer/intersection.js +44 -0
  177. package/src/reactivity/observer/mutation.js +113 -0
  178. package/src/reactivity/observer/resize.js +47 -0
  179. package/src/reactivity/observer/screen.js +45 -0
  180. package/src/reactivity/observer/screen.js.txt +84 -0
  181. package/src/reactivity/observer/screen.txt +13 -0
  182. package/src/time/animation.js +76 -0
  183. package/src/time/index.js +54 -0
  184. package/src/time/loop.js +87 -0
  185. package/src/time/utils/decorators.js +17 -0
  186. package/src/time/utils/ease.js +144 -0
  187. package/src/time/utils/index.js +18 -0
  188. package/src/time/utils/performance.js +16 -0
  189. package/src/time/utils/ui.js +26 -0
  190. package/src/types.js +71 -0
  191. package/src/user-interface/elements/derived/Flex.js +103 -0
  192. package/src/user-interface/elements/derived/Grid.js +33 -0
  193. package/src/user-interface/elements/derived/elements/Notification.js +0 -0
  194. package/src/user-interface/elements/derived/elements/Popover.js +0 -0
  195. package/src/user-interface/elements/derived/elements/Popup.js +0 -0
  196. package/src/user-interface/elements/derived/elements/Swipper.js +4 -0
  197. package/src/user-interface/elements/derived/elements/Timeline.js +0 -0
  198. package/src/user-interface/elements/derived/elements/Toast.js +0 -0
  199. package/src/user-interface/elements/derived/elements/Treeview.js +0 -0
  200. package/src/user-interface/elements/derived/elements/accordion/accordion.js +45 -0
  201. package/src/user-interface/elements/derived/elements/accordion/collapsible.js +82 -0
  202. package/src/user-interface/elements/derived/elements/accordion/index.js +2 -0
  203. package/src/user-interface/elements/derived/elements/alert/alert.js +80 -0
  204. package/src/user-interface/elements/derived/elements/alert/index.js +1 -0
  205. package/src/user-interface/elements/derived/elements/alert/palette.js +52 -0
  206. package/src/user-interface/elements/derived/elements/carousel/index.js +51 -0
  207. package/src/user-interface/elements/derived/elements/code-note/SubElements.js.txt +105 -0
  208. package/src/user-interface/elements/derived/elements/code-note/code-cell.js +195 -0
  209. package/src/user-interface/elements/derived/elements/code-note/code-note.js +72 -0
  210. package/src/user-interface/elements/derived/elements/code-note/index.js +2 -0
  211. package/src/user-interface/elements/derived/elements/code-note/sub-elements.js +67 -0
  212. package/src/user-interface/elements/derived/elements/columns.js +1 -0
  213. package/src/user-interface/elements/derived/elements/fab.js +0 -0
  214. package/src/user-interface/elements/derived/elements/index.js +9 -0
  215. package/src/user-interface/elements/derived/elements/menu/index.js +1 -0
  216. package/src/user-interface/elements/derived/elements/menu/menu3d.js +260 -0
  217. package/src/user-interface/elements/derived/elements/modal/index.js +92 -0
  218. package/src/user-interface/elements/derived/elements/pagination/breadcrumbs.js +54 -0
  219. package/src/user-interface/elements/derived/elements/pagination/index.js +1 -0
  220. package/src/user-interface/elements/derived/elements/splitter/__ZikoUISplitter__.js +62 -0
  221. package/src/user-interface/elements/derived/elements/splitter/hsplitter.js +40 -0
  222. package/src/user-interface/elements/derived/elements/splitter/index.js +2 -0
  223. package/src/user-interface/elements/derived/elements/splitter/vsplitter.js +40 -0
  224. package/src/user-interface/elements/derived/elements/tabs/index.js +180 -0
  225. package/src/user-interface/elements/derived/index.js +3 -0
  226. package/src/user-interface/elements/primitives/ZikoUIContainerElement.js +127 -0
  227. package/src/user-interface/elements/primitives/ZikoUIElement.js +480 -0
  228. package/src/user-interface/elements/primitives/embaded/html.js +21 -0
  229. package/src/user-interface/elements/primitives/embaded/index.js +3 -0
  230. package/src/user-interface/elements/primitives/embaded/pdf.js +18 -0
  231. package/src/user-interface/elements/primitives/embaded/youtube.js +26 -0
  232. package/src/user-interface/elements/primitives/index.js +8 -0
  233. package/src/user-interface/elements/primitives/io/Form/index.js +42 -0
  234. package/src/user-interface/elements/primitives/io/Form/index.js.txt +104 -0
  235. package/src/user-interface/elements/primitives/io/Inputs/__helpers__.js +52 -0
  236. package/src/user-interface/elements/primitives/io/Inputs/index.js +12 -0
  237. package/src/user-interface/elements/primitives/io/Inputs/input/index.js +99 -0
  238. package/src/user-interface/elements/primitives/io/Inputs/input-camera/index.js +26 -0
  239. package/src/user-interface/elements/primitives/io/Inputs/input-checkbox/index.js +26 -0
  240. package/src/user-interface/elements/primitives/io/Inputs/input-color/index.js +16 -0
  241. package/src/user-interface/elements/primitives/io/Inputs/input-date-time/index.js +3 -0
  242. package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-date-time.js +14 -0
  243. package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-date.js +14 -0
  244. package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-time.js +14 -0
  245. package/src/user-interface/elements/primitives/io/Inputs/input-email-password/index.js +2 -0
  246. package/src/user-interface/elements/primitives/io/Inputs/input-email-password/input-email.js +15 -0
  247. package/src/user-interface/elements/primitives/io/Inputs/input-email-password/input-password.js +14 -0
  248. package/src/user-interface/elements/primitives/io/Inputs/input-file/index.js +1 -0
  249. package/src/user-interface/elements/primitives/io/Inputs/input-file/input-file.js +0 -0
  250. package/src/user-interface/elements/primitives/io/Inputs/input-file/input-image.js +43 -0
  251. package/src/user-interface/elements/primitives/io/Inputs/input-number/index.js +37 -0
  252. package/src/user-interface/elements/primitives/io/Inputs/input-radio/index.js +26 -0
  253. package/src/user-interface/elements/primitives/io/Inputs/input-search/index.js +45 -0
  254. package/src/user-interface/elements/primitives/io/Inputs/input-slider/index.js +34 -0
  255. package/src/user-interface/elements/primitives/io/Select/index.js +20 -0
  256. package/src/user-interface/elements/primitives/io/Textarea/index.js +18 -0
  257. package/src/user-interface/elements/primitives/io/index.js +4 -0
  258. package/src/user-interface/elements/primitives/list/elements.js +0 -0
  259. package/src/user-interface/elements/primitives/list/index.js +139 -0
  260. package/src/user-interface/elements/primitives/media/Audio/index.js +17 -0
  261. package/src/user-interface/elements/primitives/media/Image/figure.js +19 -0
  262. package/src/user-interface/elements/primitives/media/Image/image.js +37 -0
  263. package/src/user-interface/elements/primitives/media/Image/index.js +2 -0
  264. package/src/user-interface/elements/primitives/media/Video/index.js +27 -0
  265. package/src/user-interface/elements/primitives/media/__ZikoUIDynamicMediaELement__.js +47 -0
  266. package/src/user-interface/elements/primitives/media/index.js +3 -0
  267. package/src/user-interface/elements/primitives/misc/index.js +100 -0
  268. package/src/user-interface/elements/primitives/semantic/index.js +82 -0
  269. package/src/user-interface/elements/primitives/table/elements.js +94 -0
  270. package/src/user-interface/elements/primitives/table/index.js +3 -0
  271. package/src/user-interface/elements/primitives/table/table.js +115 -0
  272. package/src/user-interface/elements/primitives/table/utils.js +12 -0
  273. package/src/user-interface/elements/primitives/text/__ZikoUIText__.js +71 -0
  274. package/src/user-interface/elements/primitives/text/heading.js +36 -0
  275. package/src/user-interface/elements/primitives/text/index.js +3 -0
  276. package/src/user-interface/elements/primitives/text/p.js +26 -0
  277. package/src/user-interface/elements/primitives/text/pre.js +0 -0
  278. package/src/user-interface/elements/primitives/text/text.js +81 -0
  279. package/src/user-interface/index.js +190 -0
  280. package/src/user-interface/style/index.js +510 -0
  281. package/src/user-interface/utils/index.js +70 -0
@@ -0,0 +1,84 @@
1
+ import { useTimeLoop } from "../../Time";
2
+ import {
3
+ map,
4
+ complex,
5
+ } from "../../Math";
6
+ class ZikoScreenObserver {
7
+ constructor(callback=e=>console.log({x:e.x,y:e.y})) {
8
+ this.previousX = globalThis?.screenX;
9
+ this.previousY = globalThis?.screenY;
10
+ this.view=[-1,-1,1,1];
11
+ this.start(callback);
12
+ }
13
+ get xMin(){
14
+ return this.view[0];
15
+ }
16
+ get yMin(){
17
+ return this.view[1];
18
+ }
19
+ get xMax(){
20
+ return this.view[2];
21
+ }
22
+ get yMax(){
23
+ return this.view[3];
24
+ }
25
+ get x(){
26
+ return globalThis?.screenX;
27
+ }
28
+ get y(){
29
+ return globalThis?.screenY;
30
+ }
31
+ get scx(){
32
+ return screen.availWidth/2;
33
+ }
34
+ get scy(){
35
+ return screen.availHeight/2;
36
+ }
37
+ get wcx(){
38
+ return screenX+globalThis?.innerWidth/2;
39
+ }
40
+ get wcx_v(){
41
+ return map(this.wcx,0,screen.availWidth,this.view[0],this.view[2]);
42
+ }
43
+ get wcy(){
44
+ return screenY+globalThis?.innerHeight/2;
45
+ }
46
+ get wcy_v(){
47
+ return -map(this.wcy,0,screen.availHeight,this.view[1],this.view[3]);
48
+ }
49
+ get dx(){
50
+ return map(this.x,0,screen.availWidth,this.xMin,this.xMax);
51
+ }
52
+ get dy(){
53
+ return map(this.y,0,screen.availHeight,this.yMin,this.yMax);
54
+ }
55
+ start(callback){
56
+ this.loop = useTimeLoop(()=>{
57
+ let currentX = globalThis?.screenX;
58
+ let currentY = globalThis?.screenY;
59
+ if (this.previousX !== currentX || this.previousY !== currentY) {
60
+ callback(this)
61
+ this.previousX = currentX;
62
+ this.previousY = currentY;
63
+ }
64
+ },1000/60,0,Infinity,true);
65
+ return this;
66
+ }
67
+ }
68
+ const watchScreen=(callback)=>new ZikoScreenObserver(callback);
69
+ // globalThis.watchScreen=watchScreen;
70
+ export{
71
+ watchScreen
72
+ }
73
+
74
+ /*
75
+ a=ul("x","y","dx","dy","wcx","wxy")
76
+ watchScreen(e=>{
77
+ a[0].setValue("x : "+e.x)
78
+ a[1].setValue("y : "+e.y)
79
+ a[2].setValue("dx : "+e.dx)
80
+ a[3].setValue("dy : "+e.dy)
81
+ a[4].setValue("wCx : "+e.wcx)
82
+ a[5].setValue("wCy : "+e.wcy)
83
+ })
84
+ */
@@ -0,0 +1,13 @@
1
+ screenXLeft = screenX
2
+ screenXRight = screen.availWidth - screenX
3
+
4
+ screenYTop = screenY
5
+ screenYBottom = screen.availHeight - screenY - outerHeight
6
+
7
+ screenCenterX = screen.availWidth/2;
8
+ screenCenterX = screen.availHeight/2;
9
+
10
+ windowCenterX = outerWidth/2+screenX;
11
+ windowCenterX = outerHeight/2+0;
12
+
13
+ deltaCenterX = screenCenterX-windowCenterX
@@ -0,0 +1,76 @@
1
+ import { Ease } from "./utils";
2
+ import { map } from "../math/utils"
3
+ class ZikoTimeAnimation{
4
+ constructor(callback,ease=Ease.Linear,step=50,{t=[0,null],start=true,duration=3000}={}){
5
+ this.cache={
6
+ isRunning:false,
7
+ AnimationId:null,
8
+ startTime:null,
9
+ ease,
10
+ step,
11
+ intervall:t,
12
+ started:start,
13
+ duration
14
+ }
15
+ this.t=0;
16
+ this.tx=0;
17
+ this.ty=0;
18
+ this.i=0;
19
+ this.callback=callback;
20
+ }
21
+ #animation_handler(){
22
+ this.t+=this.cache.step;
23
+ this.i++;
24
+ this.tx=map(this.t,0,this.cache.duration,0,1);
25
+ this.ty=this.cache.ease(this.tx);
26
+ this.callback(this)
27
+ if(this.t>=this.cache.duration){
28
+ clearInterval(this.cache.AnimationId);
29
+ this.cache.isRunning=false;
30
+ }
31
+ }
32
+ reset(restart=true){
33
+ this.t=0
34
+ this.tx=0;
35
+ this.ty=0;
36
+ this.i=0;
37
+ if(restart)this.start();
38
+ return this;
39
+ }
40
+ #animate(reset=true){
41
+ if(!this.cache.isRunning){
42
+ if(reset)this.reset(false);
43
+ this.cache.isRunning=true;
44
+ this.cache.startTime = Date.now();
45
+ this.cache.AnimationId=setInterval(this.#animation_handler.bind(this),this.cache.step);
46
+ }
47
+ return this;
48
+ }
49
+ start(){
50
+ this.#animate(true);
51
+ return this;
52
+ }
53
+ pause(){
54
+ if (this.cache.isRunning) {
55
+ clearTimeout(this.cache.AnimationId);
56
+ this.cache.isRunning = false;
57
+ }
58
+ return this;
59
+ }
60
+ resume(){
61
+ this.#animate(false);
62
+ return this;
63
+ }
64
+ stop(){
65
+ this.pause();
66
+ this.reset(false);
67
+ return this;
68
+ }
69
+ // clear(){
70
+ // }
71
+ // stream(){
72
+ // }
73
+ }
74
+
75
+ const useAnimation=(callback,ease=Ease.Linear,step=50,config)=>new ZikoTimeAnimation(callback,ease=Ease.Linear,step=50,config)
76
+ export{useAnimation}
@@ -0,0 +1,54 @@
1
+ import{
2
+ useTimeLoop
3
+ } from "./loop.js"
4
+ import{
5
+ useAnimation
6
+ } from "./animation.js"
7
+ import {
8
+ wait,
9
+ timeTaken,
10
+ useThrottle,
11
+ useDebounce,
12
+ Ease,
13
+ time_memory_Taken,
14
+ waitForUIElm,
15
+ waitForUIElmSync
16
+ } from "./utils/index.js";
17
+ const Time={
18
+ wait,
19
+ timeTaken,
20
+ useThrottle,
21
+ useDebounce,
22
+ Ease,
23
+ time_memory_Taken,
24
+ useTimeLoop,
25
+ useAnimation,
26
+ waitForUIElm,
27
+ waitForUIElmSync,
28
+ ExtractAll: function () {
29
+ const keys = Object.keys(this);
30
+ for (let i = 0; i < keys.length; i++) {
31
+ const key = keys[i];
32
+ if (key !== 'ExtractAll' && key !== 'RemoveAll') {
33
+ globalThis[key] = this[key];
34
+ }
35
+ }
36
+ return this;
37
+ },
38
+ RemoveAll: function () {
39
+ const keys = Object.keys(this);
40
+ for (let i = 0; i < keys.length; i++) {
41
+ const key = keys[i];
42
+ if (key !== 'RemoveAll') {
43
+ delete globalThis[key];
44
+ }
45
+ }
46
+ return this;
47
+ }
48
+ }
49
+ export * from "./utils/index.js"
50
+ export {
51
+ useTimeLoop,
52
+ useAnimation
53
+ }
54
+ export default Time;
@@ -0,0 +1,87 @@
1
+ class ZikoTimeLoop {
2
+ constructor(callback, step = 1000/30, startTime=0, endTime = Infinity, started = true) {
3
+ this.callback = callback;
4
+ this.cache = {
5
+ isRunning: false,
6
+ AnimationId : null,
7
+ t0 : null,
8
+ step,
9
+ // fps,
10
+ startTime,
11
+ endTime,
12
+ started
13
+ };
14
+ this.init();
15
+ this.i=0;
16
+ }
17
+ init(){
18
+ // if(this.cache.step && this.cache.fps){
19
+ // console.warn(`Fps will be adjusted from ${this.cache.fps} to ${1000/this.cache.step} to ensure a smoother animation`);
20
+ // this.cache.fps=1000/this.cache.step;
21
+ // }
22
+ if(this.cache.started){
23
+ this.cache.startTime?this.startAfter(this.cache.startTime):this.start();
24
+ if(this.cache.endTime&&this.cache.endTime!==Infinity)this.stopAfter(this.cache.endTime);
25
+ }
26
+ return this;
27
+ }
28
+ // get TIME_STEP() {
29
+ // // return this.cache.step?this.cache.step:1000 / this.cache.fps;
30
+ // return this.cache.step;
31
+ // }
32
+ start() {
33
+ if (!this.cache.isRunning) {
34
+ this.i=0;
35
+ this.cache.isRunning = true;
36
+ this.cache.t0 = Date.now();
37
+ this.animate();
38
+ }
39
+ return this;
40
+ }
41
+ pause() {
42
+ if (this.cache.isRunning) {
43
+ clearTimeout(this.cache.AnimationId);
44
+ this.cache.isRunning = false;
45
+ }
46
+ return this;
47
+ }
48
+ stop(){
49
+ this.pause();
50
+ this.i=0;
51
+ return this;
52
+ }
53
+ resume(){
54
+ this.cache.isRunning=true;
55
+ this.animate();
56
+ return this;
57
+ }
58
+ startAfter(t=1000){
59
+ setTimeout(this.start.bind(this),t);
60
+ return this;
61
+ }
62
+ stopAfter(t=1000){
63
+ setTimeout(this.stop.bind(this),t);
64
+ return this;
65
+ }
66
+ animate = () => {
67
+ if (this.cache.isRunning) {
68
+ const now = Date.now();
69
+ const delta = now - this.cache.t0;
70
+ if (delta > this.cache.step) {
71
+ this.callback(this);
72
+ this.i++;
73
+ this.cache.t0 = now - (delta % this.cache.step);
74
+ }
75
+ this.cache.AnimationId = setTimeout(this.animate, 0);
76
+ };
77
+ }
78
+ }
79
+ const useFps = fps => 1000/fps;
80
+ const useTimeLoop = (callback, step, startTime, endTime, started) => new ZikoTimeLoop(callback, step, startTime, endTime, started);
81
+
82
+
83
+ //const a = useTimeLoop((e) => console.log(e.i), {step:100,fps:30,t:[500,4001],start:true});
84
+ export {
85
+ useTimeLoop,
86
+ useFps
87
+ }
@@ -0,0 +1,17 @@
1
+ const useDebounce=(fn,delay=1000)=>{
2
+ let id;
3
+ return(...args)=>id?clearTimeout(id):setTimeout(()=>fn(...args),delay)
4
+ }
5
+ const useThrottle=(fn,delay)=>{
6
+ let lastTime=0;
7
+ return (...args)=>{
8
+ const now=new Date().getTime()
9
+ if(now-lastTime<delay)return;
10
+ lastTime=now;
11
+ fn(...args);
12
+ }
13
+ }
14
+ export{
15
+ useDebounce,
16
+ useThrottle
17
+ }
@@ -0,0 +1,144 @@
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
@@ -0,0 +1,18 @@
1
+ import Ease from "./ease.js";
2
+ const wait=(delayInMS)=>{
3
+ return new Promise((resolve) => setTimeout(resolve, delayInMS));
4
+ }
5
+ const timeTaken = callback => {
6
+ console.time('timeTaken');
7
+ const r = callback();
8
+ console.timeEnd('timeTaken');
9
+ return r;
10
+ }
11
+ export{
12
+ wait,
13
+ timeTaken,
14
+ Ease
15
+ }
16
+ export * from "./decorators.js";
17
+ export * from "./performance.js";
18
+ export * from "./ui.js"
@@ -0,0 +1,16 @@
1
+ const time_memory_Taken = (callback) => {
2
+ const t0 = Date.now();
3
+ const m0 = performance.memory.usedJSHeapSize;
4
+ const result = callback();
5
+ const t1 = Date.now();
6
+ const m1 = performance.memory.usedJSHeapSize;
7
+ const elapsedTime = t1 - t0;
8
+ const usedMemory = m1 - m0;
9
+ return {
10
+ elapsedTime,
11
+ usedMemory,
12
+ result
13
+ };
14
+ };
15
+ export {time_memory_Taken}
16
+
@@ -0,0 +1,26 @@
1
+ const waitForUIElm=(UIElement)=>{
2
+ return new Promise(resolve => {
3
+ if (UIElement.element) {
4
+ return resolve(UIElement.element);
5
+ }
6
+
7
+ const observer = new MutationObserver(() => {
8
+ if (UIElement.element) {
9
+ resolve(UIElement.element);
10
+ observer.disconnect();
11
+ }
12
+ });
13
+
14
+ observer.observe(document?.body, {
15
+ childList: true,
16
+ subtree: true
17
+ });
18
+ });
19
+ }
20
+ const waitForUIElmSync=(UIElement,timeout=2000)=>{
21
+ const t0=Date.now();
22
+ while(Date.now()-t0<timeout){
23
+ if(UIElement.element)return UIElement.element
24
+ }
25
+ }
26
+ export {waitForUIElm,waitForUIElmSync}
package/src/types.js ADDED
@@ -0,0 +1,71 @@
1
+ import ZikoUIElement from "./user-interface/elements/primitives/ZikoUIElement";
2
+ import ZikoUIContainerElement from "./user-interface/elements/primitives/ZikoUIContainerElement";
3
+
4
+ export {
5
+ ZikoUIElement,
6
+ ZikoUIContainerElement
7
+ }
8
+ export {
9
+ ZikoUIAbbrText,
10
+ ZikoUIAccordion,
11
+ ZikoUIArticle,
12
+ ZikoUIAside,
13
+ ZikoUIAudio,
14
+ ZikoUIBlockQuote,
15
+ ZikoUIBr,
16
+ ZikoUIBreadcrumbs,
17
+ ZikoUICodeNote,
18
+ ZikoUICodeText,
19
+ ZikoUIDefintion,
20
+ ZikoUIFigure,
21
+ ZikoUIFlex,
22
+ ZikoUIFooter,
23
+ ZikoUIForm,
24
+ ZikoUIGrid,
25
+ ZikoUIHeader,
26
+ ZikoUIHeading,
27
+ ZikoUIHorizontalSplitter,
28
+ ZikoUIHr,
29
+ ZikoUIHtmlTag,
30
+ ZikoUIImage,
31
+ ZikoUIInput,
32
+ ZikoUIInputCheckbox,
33
+ ZikoUIInputColor,
34
+ ZikoUIInputDatalist,
35
+ ZikoUIInputDate,
36
+ ZikoUIInputDateTime,
37
+ ZikoUIInputEmail,
38
+ ZikoUIInputImage,
39
+ ZikoUIInputNumber,
40
+ ZikoUIInputOption,
41
+ ZikoUIInputPassword,
42
+ ZikoUIInputRadio,
43
+ ZikoUIInputSearch,
44
+ ZikoUIInputSlider,
45
+ ZikoUIInputTime,
46
+ ZikoUILabel,
47
+ ZikoUILink,
48
+ ZikoUIMain,
49
+ ZikoUIMenu3d,
50
+ ZikoUIModal,
51
+ ZikoUINav,
52
+ ZikoUIParagraphe,
53
+ ZikoUIQuote,
54
+ ZikoUISection,
55
+ ZikoUISelect,
56
+ ZikoUISubText,
57
+ ZikoUISupText,
58
+ ZikoUIText,
59
+ ZikoUITextArea,
60
+ ZikoUIVerticalSplitter,
61
+ ZikoUIVideo,
62
+ } from "./user-interface/index.js"
63
+
64
+ export{
65
+ Matrix,
66
+ LinearSystem,
67
+ Complex,
68
+ Random,
69
+ } from "./math/index.js"
70
+
71
+