ziko 0.0.1

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 (226) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +316 -0
  3. package/dist/ziko.cjs +9786 -0
  4. package/dist/ziko.js +9792 -0
  5. package/dist/ziko.min.js +9 -0
  6. package/dist/ziko.mjs +9567 -0
  7. package/package.json +55 -0
  8. package/src/App/Accessibility/index.js +0 -0
  9. package/src/App/Globals/__Target__.js +3 -0
  10. package/src/App/Globals/__UI__.js +38 -0
  11. package/src/App/Globals/__init__.js +8 -0
  12. package/src/App/Globals/index.js +3 -0
  13. package/src/App/Router/index.js +40 -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/App/app.js +37 -0
  19. package/src/App/index.js +11 -0
  20. package/src/Data/Api/fetchdom.js +14 -0
  21. package/src/Data/Api/index.js +4 -0
  22. package/src/Data/Api/preload.js +11 -0
  23. package/src/Data/Converter/canvas.js +25 -0
  24. package/src/Data/Converter/csv.js +33 -0
  25. package/src/Data/Converter/index.js +25 -0
  26. package/src/Data/Converter/json.js +80 -0
  27. package/src/Data/Converter/markdown.js +83 -0
  28. package/src/Data/Converter/svg.js +11 -0
  29. package/src/Data/Parser/markdown.js +0 -0
  30. package/src/Data/Parser/xml.js +47 -0
  31. package/src/Data/Strings/index.js +26 -0
  32. package/src/Data/decorators.js +0 -0
  33. package/src/Data/index.js +64 -0
  34. package/src/Graphics/Canvas/Elements/Basic/arc.js +43 -0
  35. package/src/Graphics/Canvas/Elements/Basic/image.js +0 -0
  36. package/src/Graphics/Canvas/Elements/Basic/line.js +26 -0
  37. package/src/Graphics/Canvas/Elements/Basic/path.js +0 -0
  38. package/src/Graphics/Canvas/Elements/Basic/points.js +48 -0
  39. package/src/Graphics/Canvas/Elements/Basic/polygon.js +7 -0
  40. package/src/Graphics/Canvas/Elements/Basic/polyline.js +0 -0
  41. package/src/Graphics/Canvas/Elements/Basic/rect.js +46 -0
  42. package/src/Graphics/Canvas/Elements/Basic/text.js +0 -0
  43. package/src/Graphics/Canvas/Elements/Chart/histogram.js +0 -0
  44. package/src/Graphics/Canvas/Elements/Chart/plot.js +0 -0
  45. package/src/Graphics/Canvas/Elements/Chart/scatter.js +2 -0
  46. package/src/Graphics/Canvas/Elements/Chart/stem.js +0 -0
  47. package/src/Graphics/Canvas/Elements/Element.js +115 -0
  48. package/src/Graphics/Canvas/Elements/Groupe.js +0 -0
  49. package/src/Graphics/Canvas/Elements/grid.js +0 -0
  50. package/src/Graphics/Canvas/Elements/index.js +13 -0
  51. package/src/Graphics/Canvas/Filter/index.js +0 -0
  52. package/src/Graphics/Canvas/Paint/index.js +0 -0
  53. package/src/Graphics/Canvas/Utils/color.js +8 -0
  54. package/src/Graphics/Canvas/Utils/floodFill.js +58 -0
  55. package/src/Graphics/Canvas/_canvas_offscreen +0 -0
  56. package/src/Graphics/Canvas/canvas.js +189 -0
  57. package/src/Graphics/Canvas/index.js +15 -0
  58. package/src/Graphics/Svg/Elements/ZikoSvgElement.js +28 -0
  59. package/src/Graphics/Svg/Elements/circle.js +34 -0
  60. package/src/Graphics/Svg/Elements/ellipse.js +29 -0
  61. package/src/Graphics/Svg/Elements/foreignObject.js +46 -0
  62. package/src/Graphics/Svg/Elements/grid.js +9 -0
  63. package/src/Graphics/Svg/Elements/groupe.js +29 -0
  64. package/src/Graphics/Svg/Elements/image.js +33 -0
  65. package/src/Graphics/Svg/Elements/line.js +29 -0
  66. package/src/Graphics/Svg/Elements/path.js +59 -0
  67. package/src/Graphics/Svg/Elements/polygon.js +31 -0
  68. package/src/Graphics/Svg/Elements/polyline.js +4 -0
  69. package/src/Graphics/Svg/Elements/rect.js +43 -0
  70. package/src/Graphics/Svg/Elements/text.js +26 -0
  71. package/src/Graphics/Svg/index.js +1 -0
  72. package/src/Graphics/Svg/svg.js +117 -0
  73. package/src/Graphics/index.js +61 -0
  74. package/src/Math/Calculus/Special Functions/bessel.js +31 -0
  75. package/src/Math/Calculus/Special Functions/beta.js +38 -0
  76. package/src/Math/Calculus/Special Functions/gamma.js +30 -0
  77. package/src/Math/Calculus/Special Functions/index.js +4 -0
  78. package/src/Math/Calculus/index.js +1 -0
  79. package/src/Math/Complex/Fractals/julia.js +0 -0
  80. package/src/Math/Complex/index.js +191 -0
  81. package/src/Math/Discret/Combinaison/index.js +34 -0
  82. package/src/Math/Discret/Conversion/index.js +86 -0
  83. package/src/Math/Discret/Logic/index.js +46 -0
  84. package/src/Math/Discret/Permutation/index.js +31 -0
  85. package/src/Math/Discret/Set/index.js +2 -0
  86. package/src/Math/Discret/Set/powerSet.js +15 -0
  87. package/src/Math/Discret/Set/subSet.js +10 -0
  88. package/src/Math/Discret/index.js +23 -0
  89. package/src/Math/Functions/index.js +182 -0
  90. package/src/Math/Matrix/Decomposition.js +90 -0
  91. package/src/Math/Matrix/LinearSystem.js +10 -0
  92. package/src/Math/Matrix/Matrix.js +712 -0
  93. package/src/Math/Matrix/index.js +3 -0
  94. package/src/Math/Numeric/index.js +0 -0
  95. package/src/Math/Random/index.js +173 -0
  96. package/src/Math/Signal/__np.py.txt +40 -0
  97. package/src/Math/Signal/conv.js +175 -0
  98. package/src/Math/Signal/fft.js +55 -0
  99. package/src/Math/Signal/filter.js +39 -0
  100. package/src/Math/Signal/functions.js +146 -0
  101. package/src/Math/Signal/index.js +110 -0
  102. package/src/Math/Statistics/Functions/index.js +100 -0
  103. package/src/Math/Statistics/index.js +16 -0
  104. package/src/Math/Utils/arithmetic.js +139 -0
  105. package/src/Math/Utils/checkers.js +11 -0
  106. package/src/Math/Utils/comparaison.js +1 -0
  107. package/src/Math/Utils/conversions.js +7 -0
  108. package/src/Math/Utils/discret.js +28 -0
  109. package/src/Math/Utils/index.js +102 -0
  110. package/src/Math/Utils/mapfun.js +43 -0
  111. package/src/Math/absract.js +1 -0
  112. package/src/Math/const.js +3 -0
  113. package/src/Math/index.js +193 -0
  114. package/src/Reactivity/Events/Global/Click.js +56 -0
  115. package/src/Reactivity/Events/Global/Clipboard.js +84 -0
  116. package/src/Reactivity/Events/Global/CustomEvent.js +53 -0
  117. package/src/Reactivity/Events/Global/Drag.js +137 -0
  118. package/src/Reactivity/Events/Global/Focus.js +56 -0
  119. package/src/Reactivity/Events/Global/Key.js +104 -0
  120. package/src/Reactivity/Events/Global/Pointer.js +214 -0
  121. package/src/Reactivity/Events/Partiel/Input.js +59 -0
  122. package/src/Reactivity/Events/ZikoEvent.js +91 -0
  123. package/src/Reactivity/Events/index.js +51 -0
  124. package/src/Reactivity/Observer/index.js +3 -0
  125. package/src/Reactivity/Observer/intersection.js +40 -0
  126. package/src/Reactivity/Observer/mutation.js +90 -0
  127. package/src/Reactivity/Observer/resize.js +47 -0
  128. package/src/Reactivity/Use/Contexte/index.js +1 -0
  129. package/src/Reactivity/Use/Contexte/useSuccesifKeys.js +14 -0
  130. package/src/Reactivity/Use/Decorators/index.js +4 -0
  131. package/src/Reactivity/Use/Interactions/index.js +4 -0
  132. package/src/Reactivity/Use/Interactions/useBluetooth.js +48 -0
  133. package/src/Reactivity/Use/Interactions/useChannel.js +50 -0
  134. package/src/Reactivity/Use/Interactions/useEventEmmiter.js +64 -0
  135. package/src/Reactivity/Use/Interactions/useSerial.js +0 -0
  136. package/src/Reactivity/Use/Interactions/useThread.js +44 -0
  137. package/src/Reactivity/Use/Interactions/useUsb.js +0 -0
  138. package/src/Reactivity/Use/Sensors/index.js +2 -0
  139. package/src/Reactivity/Use/Sensors/useBattery.js +36 -0
  140. package/src/Reactivity/Use/Sensors/useCamera.js +0 -0
  141. package/src/Reactivity/Use/Sensors/useGeolocation.js +17 -0
  142. package/src/Reactivity/Use/Sensors/useMicro.js +0 -0
  143. package/src/Reactivity/Use/Sensors/useOrientation.js +0 -0
  144. package/src/Reactivity/Use/Storage/index.js +1 -0
  145. package/src/Reactivity/Use/Storage/useCookie.js +0 -0
  146. package/src/Reactivity/Use/Storage/useIndexedDb.js +0 -0
  147. package/src/Reactivity/Use/Storage/useStorage.js +74 -0
  148. package/src/Reactivity/Use/UI/index.js +4 -0
  149. package/src/Reactivity/Use/UI/useCssLink.js +0 -0
  150. package/src/Reactivity/Use/UI/useCssText.js +21 -0
  151. package/src/Reactivity/Use/UI/useFavIcon.js +38 -0
  152. package/src/Reactivity/Use/UI/useLinearGradient.js +0 -0
  153. package/src/Reactivity/Use/UI/useMediaQuery.js +1 -0
  154. package/src/Reactivity/Use/UI/useRadialGradient.js +0 -0
  155. package/src/Reactivity/Use/UI/useStyle.js +54 -0
  156. package/src/Reactivity/Use/UI/useTheme.js +62 -0
  157. package/src/Reactivity/Use/UI/useTitle.js +30 -0
  158. package/src/Reactivity/Use/index.js +82 -0
  159. package/src/Reactivity/Use/todo.md +26 -0
  160. package/src/Reactivity/index.js +3 -0
  161. package/src/Time/animation.js +76 -0
  162. package/src/Time/index.js +54 -0
  163. package/src/Time/loop.js +83 -0
  164. package/src/Time/utils/decorators.js +17 -0
  165. package/src/Time/utils/ease.js +144 -0
  166. package/src/Time/utils/index.js +18 -0
  167. package/src/Time/utils/performance.js +16 -0
  168. package/src/Time/utils/ui.js +26 -0
  169. package/src/UI/CustomElement/Elements/Accordion/index.js +62 -0
  170. package/src/UI/CustomElement/Elements/Carousel/index.js +47 -0
  171. package/src/UI/CustomElement/Elements/CodeNote/CodeCell.js +176 -0
  172. package/src/UI/CustomElement/Elements/CodeNote/CodeNote.js +69 -0
  173. package/src/UI/CustomElement/Elements/CodeNote/SubElements.js +64 -0
  174. package/src/UI/CustomElement/Elements/CodeNote/index.js +2 -0
  175. package/src/UI/CustomElement/Elements/Columns.js +1 -0
  176. package/src/UI/CustomElement/Elements/FAB.js +0 -0
  177. package/src/UI/CustomElement/Elements/Menu.js +0 -0
  178. package/src/UI/CustomElement/Elements/Notification.js +0 -0
  179. package/src/UI/CustomElement/Elements/Popover.js +0 -0
  180. package/src/UI/CustomElement/Elements/Popup.js +0 -0
  181. package/src/UI/CustomElement/Elements/Swipper.js +4 -0
  182. package/src/UI/CustomElement/Elements/Tabs/index.js +111 -0
  183. package/src/UI/CustomElement/Elements/Timeline.js +0 -0
  184. package/src/UI/CustomElement/Elements/Toast.js +0 -0
  185. package/src/UI/CustomElement/Elements/Treeview.js +0 -0
  186. package/src/UI/CustomElement/Elements/index.js +4 -0
  187. package/src/UI/CustomElement/Flex.js +97 -0
  188. package/src/UI/CustomElement/Grid.js +30 -0
  189. package/src/UI/CustomElement/index.js +3 -0
  190. package/src/UI/Embaded/index.js +1 -0
  191. package/src/UI/Inputs/Primitives/btn.js +31 -0
  192. package/src/UI/Inputs/Primitives/elements.js +28 -0
  193. package/src/UI/Inputs/Primitives/inputs.js +334 -0
  194. package/src/UI/Inputs/Primitives/select.js +15 -0
  195. package/src/UI/Inputs/Primitives/textarea.js +16 -0
  196. package/src/UI/Inputs/camera.js +23 -0
  197. package/src/UI/Inputs/index.js +20 -0
  198. package/src/UI/List/elements.js +0 -0
  199. package/src/UI/List/index.js +130 -0
  200. package/src/UI/Media/Audio/index.js +26 -0
  201. package/src/UI/Media/Image/figure.js +17 -0
  202. package/src/UI/Media/Image/image.js +34 -0
  203. package/src/UI/Media/Image/index.js +2 -0
  204. package/src/UI/Media/Video/index.js +37 -0
  205. package/src/UI/Media/index.js +3 -0
  206. package/src/UI/Misc/index.js +49 -0
  207. package/src/UI/Semantic/index.js +68 -0
  208. package/src/UI/Style/index.js +499 -0
  209. package/src/UI/Table/elements.js +94 -0
  210. package/src/UI/Table/index.js +3 -0
  211. package/src/UI/Table/table.js +113 -0
  212. package/src/UI/Table/utils.js +12 -0
  213. package/src/UI/Text/heading.js +35 -0
  214. package/src/UI/Text/index.js +3 -0
  215. package/src/UI/Text/p.js +37 -0
  216. package/src/UI/Text/pre.js +0 -0
  217. package/src/UI/Text/text.js +66 -0
  218. package/src/UI/Utils/index.js +70 -0
  219. package/src/UI/ZikoUIElement.js +478 -0
  220. package/src/UI/index.js +154 -0
  221. package/src/__proto__/Array.js +74 -0
  222. package/src/__proto__/Function.js +0 -0
  223. package/src/__proto__/Number.js +76 -0
  224. package/src/__proto__/Object.js +0 -0
  225. package/src/__proto__/String.js +0 -0
  226. package/src/index.js +69 -0
@@ -0,0 +1,214 @@
1
+ import {ZikoEvent,EVENT_CONTROLLER} from "../ZikoEvent.js";
2
+ function pointerdown_controller(e){
3
+ EVENT_CONTROLLER.call(
4
+ this,
5
+ e,
6
+ "down",
7
+ ()=>{
8
+ this.dx=parseInt(e.offsetX);
9
+ this.dy=parseInt(e.offsetY);
10
+ this.isDown=true;
11
+ },
12
+ {
13
+ x:this.dx,
14
+ y:this.dy,
15
+ t:Date.now()-this.cache.stream.t0
16
+ }
17
+ )
18
+ }
19
+ function pointermove_controller(e){
20
+ EVENT_CONTROLLER.call(
21
+ this,
22
+ e,
23
+ "move",
24
+ ()=>{
25
+ this.mx=parseInt(e.offsetX);
26
+ this.my=parseInt(e.offsetY);
27
+ this.isMoving=true;
28
+ },
29
+ {
30
+ x:this.mx,
31
+ y:this.my,
32
+ t:Date.now()-this.cache.stream.t0
33
+ }
34
+ )
35
+ }
36
+ function pointerup_controller(e){
37
+ EVENT_CONTROLLER.call(
38
+ this,
39
+ e,
40
+ "up",
41
+ ()=>{
42
+ this.ux=parseInt(e.offsetX);
43
+ this.uy=parseInt(e.offsetY);
44
+ this.isDown=false;
45
+ const dx=this.dx;
46
+ const dy=this.dy;
47
+ const ux=this.ux;
48
+ const uy=this.uy;
49
+ const delta_x=(ux-dx)/this.target.Width;
50
+ const delta_y=(dy-uy)/this.target.Height;
51
+ const HORIZONTAL_SWIPPE=(delta_x<0)?"left":(delta_x>0)?"right":"none";
52
+ const VERTICAL_SWIPPE=(delta_y<0)?"bottom":(delta_y>0)?"top":"none";
53
+ this.swippe={
54
+ h:HORIZONTAL_SWIPPE,
55
+ v:VERTICAL_SWIPPE,
56
+ delta_x,
57
+ delta_y
58
+ }
59
+ },
60
+ {
61
+ x:this.ux,
62
+ y:this.uy,
63
+ t:Date.now()-this.cache.stream.t0
64
+ }
65
+ )
66
+ }
67
+ function pointerenter_controller(e){
68
+ EVENT_CONTROLLER.call(
69
+ this,
70
+ e,
71
+ "enter",
72
+ null,
73
+ null
74
+ )
75
+ }
76
+ function pointerleave_controller(e){
77
+ EVENT_CONTROLLER.call(
78
+ this,
79
+ e,
80
+ "leave",
81
+ null,
82
+ null
83
+ )
84
+ }
85
+ function pointerout_controller(e){
86
+ EVENT_CONTROLLER.call(
87
+ this,
88
+ e,
89
+ "out",
90
+ null,
91
+ null
92
+ )
93
+ }
94
+ class ZikoEventPointer extends ZikoEvent{
95
+ constructor(target){
96
+ super(target);
97
+ this.event=null;
98
+ this.dx=0;
99
+ this.dy=0;
100
+ this.dt=0;
101
+ this.mx=0;
102
+ this.my=0;
103
+ this.mt=0;
104
+ this.ux=0;
105
+ this.uy=0;
106
+ this.ut=0;
107
+ this.swippe={
108
+ h:null,
109
+ v:null,
110
+ delta_x:0,
111
+ delta_y:0
112
+ }
113
+ this.isMoving=false;
114
+ this.isDown=false;
115
+ this.cache={
116
+ prefixe:"pointer",
117
+ preventDefault:{
118
+ down:false,
119
+ move:false,
120
+ up:false,
121
+ enter:false,
122
+ out:false,
123
+ leave:false,
124
+ },
125
+ paused:{
126
+ down:false,
127
+ move:false,
128
+ up:false,
129
+ enter:false,
130
+ out:false,
131
+ leave:false,
132
+ },
133
+ stream:{
134
+ enabled:{
135
+ down:false,
136
+ move:false,
137
+ up:false,
138
+ enter:false,
139
+ out:false,
140
+ leave:false,
141
+ },
142
+ clear:{
143
+ down:false,
144
+ move:false,
145
+ up:false,
146
+ enter:false,
147
+ out:false,
148
+ leave:false,
149
+ },
150
+ history:{
151
+ down:[],
152
+ move:[],
153
+ up:[],
154
+ enter:[],
155
+ out:[],
156
+ leave:[]
157
+ }
158
+ },
159
+ callbacks:{
160
+ down:[(self)=>console.log({dx:self.dx,dy:self.dy,down:self.down,move:self.move,t:self.dt})],
161
+ move:[(self)=>console.log({mx:self.mx,my:self.my,down:self.down,move:self.move,t:self.dt})],
162
+ up:[(self)=>console.log({ux:self.ux,uy:self.uy,down:self.down,move:self.move,t:self.dt})],
163
+ enter:[(self)=>console.log({dx:self.dx,dy:self.dy,down:self.down,move:self.move,t:self.dt})],
164
+ out:[(self)=>console.log({mx:self.mx,my:self.my,down:self.down,move:self.move,t:self.dt})],
165
+ leave:[(self)=>console.log({ux:self.ux,uy:self.uy,down:self.down,move:self.move,t:self.dt})]
166
+ }
167
+ }
168
+ this.__controller={
169
+ down:pointerdown_controller.bind(this),
170
+ move:pointermove_controller.bind(this),
171
+ up:pointerup_controller.bind(this),
172
+ enter:pointerenter_controller.bind(this),
173
+ out:pointerout_controller.bind(this),
174
+ leave:pointerleave_controller.bind(this),
175
+ }
176
+ }
177
+ onDown(...callbacks){
178
+ if(callbacks.length===0)callbacks=[()=>{}];
179
+ this.__onEvent("down",{down:true,move:false,up:false,enter:false,out:false,leave:false},...callbacks)
180
+ return this;
181
+ }
182
+ onMove(...callbacks){
183
+ if(callbacks.length===0)callbacks=[()=>{}];
184
+ this.__onEvent("move",{down:false,move:true,up:false,enter:false,out:false,leave:false},...callbacks)
185
+ return this;
186
+ }
187
+ onUp(...callbacks){
188
+ if(callbacks.length===0)callbacks=[()=>{}];
189
+ this.__onEvent("up",{down:false,move:false,up:true,enter:false,out:false,leave:false},...callbacks)
190
+ return this;
191
+ }
192
+ onEnter(...callbacks){
193
+ if(callbacks.length===0)callbacks=[()=>{}];
194
+ this.__onEvent("enter",{down:false,move:false,up:false,enter:true,out:false,leave:false},...callbacks)
195
+ return this;
196
+ }
197
+ onOut(...callbacks){
198
+ if(callbacks.length===0)callbacks=[()=>{}];
199
+ this.__onEvent("out",{down:false,move:false,up:false,enter:false,out:true,leave:false},...callbacks)
200
+ return this;
201
+ }
202
+ onLeave(...callbacks){
203
+ if(callbacks.length===0)callbacks=[()=>{}];
204
+ this.__onEvent("leave",{down:false,move:false,up:false,enter:false,out:false,leave:true},...callbacks)
205
+ return this;
206
+ }
207
+ // handle({down=false,move=false,up=false}={}){
208
+ // if(down)this.handleDown();
209
+ // if(move)this.handleMove();
210
+ // if(up)this.handleUp()
211
+ // }
212
+ }
213
+ var Pointer=target=>new ZikoEventPointer(target)
214
+ export default Pointer;
@@ -0,0 +1,59 @@
1
+ import { ZikoEvent , EVENT_CONTROLLER } from "../ZikoEvent.js";
2
+ function input_controller(e){
3
+ EVENT_CONTROLLER.call(this,e,"input",null,null)
4
+ }
5
+ function change_controller(e){
6
+ EVENT_CONTROLLER.call(this,e,"change",null,null)
7
+ }
8
+ class ZikoEventInput extends ZikoEvent{
9
+ constructor(target){
10
+ super(target);
11
+ this.event=null;
12
+ this.cache={
13
+ prefixe:"",
14
+ preventDefault:{
15
+ input:false,
16
+ change:false,
17
+ },
18
+ paused:{
19
+ input:false,
20
+ change:false,
21
+ },
22
+ stream:{
23
+ enabled:{
24
+ input:false,
25
+ change:false,
26
+ },
27
+ clear:{
28
+ input:false,
29
+ change:false,
30
+ },
31
+ history:{
32
+ input:[],
33
+ change:[],
34
+ }
35
+ },
36
+ callbacks:{
37
+ input:[],
38
+ change:[],
39
+ }
40
+ }
41
+ this.__controller={
42
+ input:input_controller.bind(this),
43
+ change:change_controller.bind(this),
44
+ }
45
+ }
46
+ get value(){
47
+ return this.target.value;
48
+ }
49
+ onInput(...callbacks){
50
+ this.__onEvent("input",{},...callbacks)
51
+ return this;
52
+ }
53
+ onChange(...callbacks){
54
+ this.__onEvent("change",{},...callbacks)
55
+ return this;
56
+ }
57
+ }
58
+ const Input=Target=>new ZikoEventInput(Target);
59
+ export default Input
@@ -0,0 +1,91 @@
1
+ function EVENT_CONTROLLER(e,EVENT,setter,push_object){
2
+ this.event=e
3
+ if(this.cache.preventDefault[EVENT])e.preventDefault();
4
+ if(setter)setter();
5
+ if(this.cache.stream.enabled[EVENT]&&push_object)this.cache.stream.history[EVENT].push(push_object);
6
+ this.cache.callbacks[EVENT].map(n=>n(this));
7
+ return this;
8
+ }
9
+ class ZikoEvent{
10
+ constructor(Target){
11
+ this.target=null;
12
+ this.setTarget(Target);
13
+ this.__dispose=this.dispose.bind(this);
14
+ // this.EventIndex=Garbage.Pointer.data.length;
15
+ // Garbage.Pointer.data.push({event:this,index:this.EventIndex});
16
+ }
17
+ get targetElement(){
18
+ return this.target.element
19
+ }
20
+ setTarget(UI){
21
+ this.target=UI;
22
+ return this;
23
+ }
24
+ __handle(event,handler,dispose){
25
+ const EVENT=(event==="drag")?event:`${this.cache.prefixe}${event}`
26
+ this.dispose(dispose);
27
+ this.targetElement.addEventListener(EVENT,handler);
28
+ return this;
29
+ }
30
+ __onEvent(event,dispose,...callbacks){
31
+ if(callbacks.length===0){
32
+ if(this.cache.callbacks.length>1){
33
+ this.cache.callbacks.map(n=>e=>n.call(this,e));
34
+ }
35
+ else {
36
+ return this;
37
+ }
38
+ }
39
+ else this.cache.callbacks[event]=callbacks.map(n=>e=>n.call(this,e));
40
+ this.__handle(event,this.__controller[event],dispose)
41
+ return this;
42
+ }
43
+ preventDefault(config={}){
44
+ Object.assign(this.cache.preventDefault,config);
45
+ return this;
46
+ }
47
+ pause(config={}){
48
+ const all=Object.fromEntries(Object.keys(this.cache.stream.enabled).map(n=>[n,true]))
49
+ config={...all,...config}
50
+ for(let key in config){
51
+ if(config[key]){
52
+ this.targetElement.removeEventListener(`${this.cache.prefixe}${key}`,this.__controller[`${this.cache.prefixe}${key}`]);
53
+ this.cache.paused[`${this.cache.prefixe}${key}`]=true;
54
+ }
55
+ }
56
+ return this;
57
+ }
58
+ resume(config={}){
59
+ const all=Object.fromEntries(Object.keys(this.cache.stream.enabled).map(n=>[n,true]))
60
+ config={...all,...config}
61
+ for(let key in config){
62
+ if(config[key]){
63
+ this.targetElement.addEventListener(`${this.cache.prefixe}${key}`,this.__controller[`${this.cache.prefixe}${key}`]);
64
+ this.cache.paused[`${this.cache.prefixe}${key}`]=false;
65
+ }
66
+ }
67
+ return this;
68
+ }
69
+ dispose(config={}){
70
+ this.pause(config);
71
+ return this;
72
+ }
73
+ stream(config={}){
74
+ this.cache.stream.t0=Date.now();
75
+ const all=Object.fromEntries(Object.keys(this.cache.stream.enabled).map(n=>[n,true]))
76
+ config={...all,...config}
77
+ Object.assign(this.cache.stream.enabled,config);
78
+ return this;
79
+ }
80
+ clear(config={}){
81
+ const all=Object.fromEntries(Object.keys(this.cache.stream.clear).map(n=>[n,true]))
82
+ config={...all,...config}
83
+ for(let key in config){
84
+ if(config[key]){
85
+ this.cache.stream.history[key]=[]
86
+ }
87
+ }
88
+ return this;
89
+ }
90
+ }
91
+ export {ZikoEvent,EVENT_CONTROLLER}
@@ -0,0 +1,51 @@
1
+ import Pointer from "./Global/Pointer.js";
2
+ import Key from "./Global/Key.js";
3
+ import {Drag,Drop} from "./Global/Drag.js";
4
+ import Click from "./Global/Click.js";
5
+ import Clipboard from "./Global/Clipboard.js";
6
+ import Focus from "./Global/Focus.js";
7
+ import Input from "./Partiel/Input.js";
8
+ import CustomEvent from "./Global/CustomEvent.js";
9
+ const Events={
10
+ Pointer,
11
+ Key,
12
+ Drag,
13
+ Drop,
14
+ Click,
15
+ Clipboard,
16
+ Focus,
17
+ Input,
18
+ CustomEvent,
19
+ ExtractAll: function () {
20
+ const keys = Object.keys(this);
21
+ for (let i = 0; i < keys.length; i++) {
22
+ const key = keys[i];
23
+ if (key !== 'ExtractAll' && key !== 'RemoveAll') {
24
+ globalThis[key] = this[key];
25
+ }
26
+ }
27
+ return this;
28
+ },
29
+ RemoveAll: function () {
30
+ const keys = Object.keys(this);
31
+ for (let i = 0; i < keys.length; i++) {
32
+ const key = keys[i];
33
+ if (key !== 'RemoveAll') {
34
+ delete globalThis[key];
35
+ }
36
+ }
37
+ return this;
38
+ }
39
+ }
40
+ export {
41
+ Pointer,
42
+ Key,
43
+ Drag,
44
+ Drop,
45
+ Click,
46
+ Clipboard,
47
+ Focus,
48
+ Input,
49
+ CustomEvent
50
+ }
51
+ export default Events
@@ -0,0 +1,3 @@
1
+ export * from "./intersection";
2
+ export * from "./mutation";
3
+ export * from "./resize";
@@ -0,0 +1,40 @@
1
+ class ZikoIntersectionObserver{
2
+ constructor(UIElement,callback,{threshold=0,margin=0}={}){
3
+ this.target=UIElement;
4
+ this.config={
5
+ threshold,
6
+ margin
7
+ }
8
+ this.observer=new IntersectionObserver((entries)=>{
9
+ this.entrie=entries[0];
10
+ callback(this)
11
+ },{
12
+ threshold:this.threshold,
13
+ })
14
+ }
15
+ get ratio(){
16
+ return this.entrie.intersectionRatio;
17
+ }
18
+ get isIntersecting(){
19
+ return this.entrie.isIntersecting;
20
+ }
21
+ setThreshould(threshold){
22
+ this.config.threshold=threshold;
23
+ return this;
24
+ }
25
+ setMargin(margin){
26
+ margin=(typeof margin === "number")?margin+"px":margin;
27
+ this.config.margin=margin;
28
+ return this;
29
+ }
30
+ start(){
31
+ this.observer.observe(this.target.element);
32
+ return this;
33
+ }
34
+ stop(){
35
+ return this;
36
+ }
37
+ }
38
+
39
+ const WatchIntersection=(UI,callback,config)=>new ZikoIntersectionObserver(UI,callback,config);
40
+ export {WatchIntersection}
@@ -0,0 +1,90 @@
1
+ class ZikoMutationObserver {
2
+ constructor(UIElement, options) {
3
+ this.UIElement = UIElement;
4
+ this.options = options || { attributes: true, childList: true, subtree: true };
5
+ this.observer = null;
6
+ this.streamingEnabled = true;
7
+ this.mutationHistory = {
8
+ attributes: [],
9
+ childList: [],
10
+ subtree: [],
11
+ };
12
+
13
+ this.observeCallback = (mutationsList, observer) => {
14
+ if (this.streamingEnabled) {
15
+ for (const mutation of mutationsList) {
16
+ if (mutation.type === 'attributes') {
17
+ this.mutationHistory.attributes.push(mutation.target.getAttribute(mutation.attributeName));
18
+ } else if (mutation.type === 'childList') {
19
+ this.mutationHistory.childList.push(mutation);
20
+ } else if (mutation.type === 'subtree') {
21
+ this.mutationHistory.subtree.push(mutation);
22
+ }
23
+ }
24
+ }
25
+ if (this.callback) {
26
+ this.callback(mutationsList, observer);
27
+ }
28
+ };
29
+ }
30
+
31
+ observe(callback) {
32
+ if(!this.observer) {
33
+ this.observer = new MutationObserver(this.observeCallback);
34
+ this.observer.observe(this.UIElement.element, this.options);
35
+ this.callback = callback;
36
+ this.streamingEnabled = true;
37
+ }
38
+ }
39
+
40
+ pause(options) {
41
+ if (this.observer) {
42
+ this.observer.disconnect();
43
+ if (options) {
44
+ this.observer.observe(this.UIElement, options);
45
+ }
46
+ }
47
+ }
48
+
49
+ reset(options) {
50
+ if (this.observer) {
51
+ this.observer.disconnect();
52
+ this.observer.observe(this.UIElement, options || this.options);
53
+ }
54
+ }
55
+
56
+ clear() {
57
+ if (this.observer) {
58
+ this.observer.disconnect();
59
+ this.observer = null;
60
+ this.mutationHistory = {
61
+ attributes: [],
62
+ childList: [],
63
+ subtree: [],
64
+ };
65
+ }
66
+ this.streamingEnabled = false;
67
+ return this;
68
+ }
69
+
70
+ getMutationHistory() {
71
+ return this.mutationHistory;
72
+ }
73
+
74
+ enableStreaming() {
75
+ this.streamingEnabled = true;
76
+ return this;
77
+ }
78
+
79
+ disableStreaming() {
80
+ this.streamingEnabled = false;
81
+ return this;
82
+ }
83
+ }
84
+
85
+ const Watch=(UIElement,options={},callback=null)=>{
86
+ const Observer= new ZikoMutationObserver(UIElement,options);
87
+ if(callback)Observer.observe(callback);
88
+ return Observer
89
+ }
90
+ export { Watch };
@@ -0,0 +1,47 @@
1
+ class ZikoResizeObserver{
2
+ constructor(UIElement,callback){
3
+ this.target=UIElement;
4
+ this.contentRect=null;
5
+ this.observer=new ResizeObserver(()=>{
6
+ callback(this)
7
+ })
8
+ }
9
+ get BoundingRect(){
10
+ return this.target.element.getBoundingClientRect();
11
+ }
12
+ get width(){
13
+ return this.BoundingRect.width;
14
+ }
15
+ get height(){
16
+ return this.BoundingRect.height;
17
+ }
18
+ get top(){
19
+ return this.BoundingRect.top;
20
+ }
21
+ get bottom(){
22
+ return this.BoundingRect.bottom;
23
+ }
24
+ get right(){
25
+ return this.BoundingRect.right;
26
+ }
27
+ get left(){
28
+ return this.BoundingRect.left;
29
+ }
30
+ get x(){
31
+ return this.BoundingRect.x;
32
+ }
33
+ get y(){
34
+ return this.boundingRect.y;
35
+ }
36
+ start(){
37
+ this.observer.observe(this.target.element);
38
+ return this;
39
+ }
40
+ stop(){
41
+ this.observer.unobserve(this.target.element);
42
+ return this;
43
+ }
44
+ }
45
+
46
+ const WatchSize=(UI,callback)=>new ZikoResizeObserver(UI,callback)
47
+ export {WatchSize}
@@ -0,0 +1 @@
1
+ export * from "./useSuccesifKeys"
@@ -0,0 +1,14 @@
1
+ const useSuccesifKeys=(self,keys=[],callback=()=>{})=>{
2
+ self.cache.stream.enabled.down=true;
3
+ const length=keys.length;
4
+ const LastKeysDown=self.cache.stream.history.down.slice(-length).map(n=>n.key);
5
+
6
+ if(keys.join("")===LastKeysDown.join("")){
7
+ self.event.preventDefault();
8
+ callback.call(self,self);
9
+ }
10
+
11
+ }
12
+ export {
13
+ useSuccesifKeys
14
+ }
@@ -0,0 +1,4 @@
1
+ export {
2
+ useThrottle,
3
+ useDebounce
4
+ } from "../../../Time";
@@ -0,0 +1,4 @@
1
+ export * from "./useChannel";
2
+ export * from "./useEventEmmiter";
3
+ export * from "./useThread";
4
+ export * from "./useBluetooth";
@@ -0,0 +1,48 @@
1
+ import { useEventEmitter } from "./useEventEmmiter";
2
+ class ZikoUseBluetooth{
3
+ constructor(options={acceptAllDevices:true}){
4
+ this.options=options;
5
+ this.__Emitter__=useEventEmitter();
6
+ if(this.isSupported)this.#init();
7
+ }
8
+ async #init(){
9
+ this.promise=navigator.bluetooth.requestDevice(this.options).then(device=>this.device=device)
10
+ }
11
+ get isSupported(){
12
+ return !!navigator.bluetooth;
13
+ }
14
+ get current(){
15
+ // Synchrouns Code
16
+ return this.device;
17
+ }
18
+ connect(){
19
+ this.server=this.device.gatt.connect();
20
+ this.__Emitter__.emit("ziko:bluetooth-connected");
21
+ return this;
22
+ }
23
+ disconnect(){
24
+ this.device.gatt.disconnect();
25
+ this.__Emitter__.emit("ziko:bluetooth-disconnected");
26
+ return this;
27
+ }
28
+ onConnect(callback){
29
+ this.__Emitter__.on("ziko:bluetooth-connected",callback);
30
+ return this;
31
+ }
32
+ onDisconnect(callback){
33
+ this.__Emitter__.on("ziko:bluetooth-disconnected",callback);
34
+ return this;
35
+ }
36
+ dispose(){
37
+
38
+ }
39
+ async battery(callback){
40
+ const batteryService = await this.server.getPrimaryService("battery_service");
41
+ const batteryLevelCharacteristic = await batteryService.getCharacteristic("battery_level");
42
+ const batteryLevel = await batteryLevelCharacteristic.readValue();
43
+ const batteryPercent = await batteryLevel.getUint8(0);
44
+ callback(batteryPercent)
45
+ }
46
+ }
47
+ const useBluetooth=(options)=>new ZikoUseBluetooth(options);
48
+ export{ useBluetooth }