ziko 0.0.5 → 0.0.6

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 (235) hide show
  1. package/dist/ziko.cjs +9999 -9853
  2. package/dist/ziko.js +10000 -9854
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +9999 -9853
  5. package/package.json +12 -4
  6. package/starter/bin/index.js +10 -0
  7. package/wrapper/react/README.md +26 -0
  8. package/wrapper/react/index.jsx +7 -1
  9. package/wrapper/svelte/ZikoUI.svelte +15 -0
  10. package/wrapper/vue/ZikoUI.vue +8 -2
  11. package/core/App/Accessibility/index.js +0 -0
  12. package/core/App/Globals/__Target__.js +0 -3
  13. package/core/App/Globals/__UI__.js +0 -38
  14. package/core/App/Globals/__init__.js +0 -8
  15. package/core/App/Globals/index.js +0 -18
  16. package/core/App/Router/index.js +0 -40
  17. package/core/App/Seo/index.js +0 -43
  18. package/core/App/Themes/dark.js +0 -885
  19. package/core/App/Themes/index.js +0 -11
  20. package/core/App/Themes/light.js +0 -255
  21. package/core/App/app.js +0 -46
  22. package/core/App/index.js +0 -12
  23. package/core/Data/Api/fetchdom.js +0 -14
  24. package/core/Data/Api/index.js +0 -4
  25. package/core/Data/Api/preload.js +0 -11
  26. package/core/Data/Converter/canvas.js +0 -25
  27. package/core/Data/Converter/csv.js +0 -33
  28. package/core/Data/Converter/index.js +0 -25
  29. package/core/Data/Converter/json.js +0 -80
  30. package/core/Data/Converter/markdown.js +0 -83
  31. package/core/Data/Converter/svg.js +0 -11
  32. package/core/Data/Parser/markdown.js +0 -0
  33. package/core/Data/Parser/xml.js +0 -47
  34. package/core/Data/Strings/index.js +0 -26
  35. package/core/Data/decorators.js +0 -0
  36. package/core/Data/index.js +0 -64
  37. package/core/Graphics/Canvas/Elements/Basic/arc.js +0 -43
  38. package/core/Graphics/Canvas/Elements/Basic/image.js +0 -0
  39. package/core/Graphics/Canvas/Elements/Basic/line.js +0 -26
  40. package/core/Graphics/Canvas/Elements/Basic/path.js +0 -0
  41. package/core/Graphics/Canvas/Elements/Basic/points.js +0 -48
  42. package/core/Graphics/Canvas/Elements/Basic/polygon.js +0 -7
  43. package/core/Graphics/Canvas/Elements/Basic/polyline.js +0 -0
  44. package/core/Graphics/Canvas/Elements/Basic/rect.js +0 -46
  45. package/core/Graphics/Canvas/Elements/Basic/text.js +0 -0
  46. package/core/Graphics/Canvas/Elements/Chart/histogram.js +0 -0
  47. package/core/Graphics/Canvas/Elements/Chart/plot.js +0 -0
  48. package/core/Graphics/Canvas/Elements/Chart/scatter.js +0 -2
  49. package/core/Graphics/Canvas/Elements/Chart/stem.js +0 -0
  50. package/core/Graphics/Canvas/Elements/Element.js +0 -115
  51. package/core/Graphics/Canvas/Elements/Groupe.js +0 -0
  52. package/core/Graphics/Canvas/Elements/grid.js +0 -0
  53. package/core/Graphics/Canvas/Elements/index.js +0 -13
  54. package/core/Graphics/Canvas/Filter/index.js +0 -0
  55. package/core/Graphics/Canvas/Paint/index.js +0 -0
  56. package/core/Graphics/Canvas/Utils/color.js +0 -8
  57. package/core/Graphics/Canvas/Utils/floodFill.js +0 -58
  58. package/core/Graphics/Canvas/_canvas_offscreen +0 -0
  59. package/core/Graphics/Canvas/canvas.js +0 -189
  60. package/core/Graphics/Canvas/index.js +0 -15
  61. package/core/Graphics/Svg/Elements/ZikoSvgElement.js +0 -28
  62. package/core/Graphics/Svg/Elements/circle.js +0 -34
  63. package/core/Graphics/Svg/Elements/ellipse.js +0 -29
  64. package/core/Graphics/Svg/Elements/foreignObject.js +0 -46
  65. package/core/Graphics/Svg/Elements/grid.js +0 -9
  66. package/core/Graphics/Svg/Elements/groupe.js +0 -29
  67. package/core/Graphics/Svg/Elements/image.js +0 -33
  68. package/core/Graphics/Svg/Elements/line.js +0 -29
  69. package/core/Graphics/Svg/Elements/path.js +0 -59
  70. package/core/Graphics/Svg/Elements/polygon.js +0 -31
  71. package/core/Graphics/Svg/Elements/polyline.js +0 -4
  72. package/core/Graphics/Svg/Elements/rect.js +0 -43
  73. package/core/Graphics/Svg/Elements/text.js +0 -26
  74. package/core/Graphics/Svg/index.js +0 -1
  75. package/core/Graphics/Svg/svg.js +0 -117
  76. package/core/Graphics/index.js +0 -61
  77. package/core/Math/Calculus/Special Functions/bessel.js +0 -31
  78. package/core/Math/Calculus/Special Functions/beta.js +0 -38
  79. package/core/Math/Calculus/Special Functions/gamma.js +0 -30
  80. package/core/Math/Calculus/Special Functions/index.js +0 -4
  81. package/core/Math/Calculus/index.js +0 -1
  82. package/core/Math/Complex/Fractals/julia.js +0 -0
  83. package/core/Math/Complex/index.js +0 -191
  84. package/core/Math/Discret/Combinaison/index.js +0 -34
  85. package/core/Math/Discret/Conversion/index.js +0 -86
  86. package/core/Math/Discret/Logic/index.js +0 -46
  87. package/core/Math/Discret/Permutation/index.js +0 -31
  88. package/core/Math/Discret/Set/index.js +0 -2
  89. package/core/Math/Discret/Set/powerSet.js +0 -15
  90. package/core/Math/Discret/Set/subSet.js +0 -10
  91. package/core/Math/Discret/index.js +0 -23
  92. package/core/Math/Functions/index.js +0 -182
  93. package/core/Math/Matrix/Decomposition.js +0 -90
  94. package/core/Math/Matrix/LinearSystem.js +0 -10
  95. package/core/Math/Matrix/Matrix.js +0 -712
  96. package/core/Math/Matrix/index.js +0 -3
  97. package/core/Math/Numeric/index.js +0 -0
  98. package/core/Math/Random/index.js +0 -173
  99. package/core/Math/Signal/__np.py.txt +0 -40
  100. package/core/Math/Signal/conv.js +0 -175
  101. package/core/Math/Signal/fft.js +0 -55
  102. package/core/Math/Signal/filter.js +0 -39
  103. package/core/Math/Signal/functions.js +0 -146
  104. package/core/Math/Signal/index.js +0 -110
  105. package/core/Math/Statistics/Functions/index.js +0 -100
  106. package/core/Math/Statistics/index.js +0 -16
  107. package/core/Math/Utils/arithmetic.js +0 -139
  108. package/core/Math/Utils/checkers.js +0 -11
  109. package/core/Math/Utils/comparaison.js +0 -1
  110. package/core/Math/Utils/conversions.js +0 -7
  111. package/core/Math/Utils/discret.js +0 -28
  112. package/core/Math/Utils/index.js +0 -102
  113. package/core/Math/Utils/mapfun.js +0 -43
  114. package/core/Math/absract.js +0 -1
  115. package/core/Math/const.js +0 -3
  116. package/core/Math/index.js +0 -193
  117. package/core/Reactivity/Events/Global/Click.js +0 -56
  118. package/core/Reactivity/Events/Global/Clipboard.js +0 -84
  119. package/core/Reactivity/Events/Global/CustomEvent.js +0 -53
  120. package/core/Reactivity/Events/Global/Drag.js +0 -137
  121. package/core/Reactivity/Events/Global/Focus.js +0 -56
  122. package/core/Reactivity/Events/Global/Key.js +0 -104
  123. package/core/Reactivity/Events/Global/Mouse.js +0 -230
  124. package/core/Reactivity/Events/Global/Pointer.js +0 -214
  125. package/core/Reactivity/Events/Global/Touch.js +0 -0
  126. package/core/Reactivity/Events/Global/Wheel.js +0 -44
  127. package/core/Reactivity/Events/Partiel/Hash.js +0 -44
  128. package/core/Reactivity/Events/Partiel/Input.js +0 -59
  129. package/core/Reactivity/Events/Partiel/MediaEvent.js +0 -1
  130. package/core/Reactivity/Events/ZikoEvent.js +0 -91
  131. package/core/Reactivity/Events/index.js +0 -60
  132. package/core/Reactivity/Observer/index.js +0 -3
  133. package/core/Reactivity/Observer/intersection.js +0 -40
  134. package/core/Reactivity/Observer/mutation.js +0 -90
  135. package/core/Reactivity/Observer/resize.js +0 -47
  136. package/core/Reactivity/Use/Contexte/index.js +0 -1
  137. package/core/Reactivity/Use/Contexte/useSuccesifKeys.js +0 -14
  138. package/core/Reactivity/Use/Decorators/index.js +0 -4
  139. package/core/Reactivity/Use/Interactions/index.js +0 -4
  140. package/core/Reactivity/Use/Interactions/useBluetooth.js +0 -48
  141. package/core/Reactivity/Use/Interactions/useChannel.js +0 -50
  142. package/core/Reactivity/Use/Interactions/useEventEmmiter.js +0 -64
  143. package/core/Reactivity/Use/Interactions/useSerial.js +0 -0
  144. package/core/Reactivity/Use/Interactions/useThread.js +0 -44
  145. package/core/Reactivity/Use/Interactions/useUsb.js +0 -0
  146. package/core/Reactivity/Use/Sensors/index.js +0 -2
  147. package/core/Reactivity/Use/Sensors/useBattery.js +0 -36
  148. package/core/Reactivity/Use/Sensors/useCamera.js +0 -0
  149. package/core/Reactivity/Use/Sensors/useGeolocation.js +0 -17
  150. package/core/Reactivity/Use/Sensors/useMicro.js +0 -0
  151. package/core/Reactivity/Use/Sensors/useOrientation.js +0 -0
  152. package/core/Reactivity/Use/Storage/index.js +0 -1
  153. package/core/Reactivity/Use/Storage/useCookie.js +0 -0
  154. package/core/Reactivity/Use/Storage/useIndexedDb.js +0 -0
  155. package/core/Reactivity/Use/Storage/useStorage.js +0 -74
  156. package/core/Reactivity/Use/UI/index.js +0 -4
  157. package/core/Reactivity/Use/UI/useCssLink.js +0 -0
  158. package/core/Reactivity/Use/UI/useCssText.js +0 -21
  159. package/core/Reactivity/Use/UI/useFavIcon.js +0 -38
  160. package/core/Reactivity/Use/UI/useLinearGradient.js +0 -0
  161. package/core/Reactivity/Use/UI/useMediaQuery.js +0 -1
  162. package/core/Reactivity/Use/UI/useRadialGradient.js +0 -0
  163. package/core/Reactivity/Use/UI/useStyle.js +0 -54
  164. package/core/Reactivity/Use/UI/useTheme.js +0 -62
  165. package/core/Reactivity/Use/UI/useTitle.js +0 -30
  166. package/core/Reactivity/Use/index.js +0 -82
  167. package/core/Reactivity/Use/todo.md +0 -26
  168. package/core/Reactivity/index.js +0 -3
  169. package/core/Time/animation.js +0 -76
  170. package/core/Time/index.js +0 -54
  171. package/core/Time/loop.js +0 -83
  172. package/core/Time/utils/decorators.js +0 -17
  173. package/core/Time/utils/ease.js +0 -144
  174. package/core/Time/utils/index.js +0 -18
  175. package/core/Time/utils/performance.js +0 -16
  176. package/core/Time/utils/ui.js +0 -26
  177. package/core/UI/CustomElement/Elements/Accordion/index.js +0 -62
  178. package/core/UI/CustomElement/Elements/Carousel/index.js +0 -47
  179. package/core/UI/CustomElement/Elements/CodeNote/CodeCell.js +0 -176
  180. package/core/UI/CustomElement/Elements/CodeNote/CodeNote.js +0 -69
  181. package/core/UI/CustomElement/Elements/CodeNote/SubElements.js +0 -64
  182. package/core/UI/CustomElement/Elements/CodeNote/index.js +0 -2
  183. package/core/UI/CustomElement/Elements/Columns.js +0 -1
  184. package/core/UI/CustomElement/Elements/FAB.js +0 -0
  185. package/core/UI/CustomElement/Elements/Menu.js +0 -0
  186. package/core/UI/CustomElement/Elements/Notification.js +0 -0
  187. package/core/UI/CustomElement/Elements/Popover.js +0 -0
  188. package/core/UI/CustomElement/Elements/Popup.js +0 -0
  189. package/core/UI/CustomElement/Elements/Swipper.js +0 -4
  190. package/core/UI/CustomElement/Elements/Tabs/index.js +0 -111
  191. package/core/UI/CustomElement/Elements/Timeline.js +0 -0
  192. package/core/UI/CustomElement/Elements/Toast.js +0 -0
  193. package/core/UI/CustomElement/Elements/Treeview.js +0 -0
  194. package/core/UI/CustomElement/Elements/index.js +0 -4
  195. package/core/UI/CustomElement/Flex.js +0 -97
  196. package/core/UI/CustomElement/Grid.js +0 -30
  197. package/core/UI/CustomElement/index.js +0 -3
  198. package/core/UI/Embaded/index.js +0 -1
  199. package/core/UI/Inputs/Primitives/btn.js +0 -30
  200. package/core/UI/Inputs/Primitives/elements.js +0 -28
  201. package/core/UI/Inputs/Primitives/inputs.js +0 -324
  202. package/core/UI/Inputs/Primitives/select.js +0 -14
  203. package/core/UI/Inputs/Primitives/textarea.js +0 -15
  204. package/core/UI/Inputs/camera.js +0 -23
  205. package/core/UI/Inputs/index.js +0 -20
  206. package/core/UI/List/elements.js +0 -0
  207. package/core/UI/List/index.js +0 -127
  208. package/core/UI/Media/Audio/index.js +0 -38
  209. package/core/UI/Media/Image/figure.js +0 -16
  210. package/core/UI/Media/Image/image.js +0 -33
  211. package/core/UI/Media/Image/index.js +0 -2
  212. package/core/UI/Media/Video/index.js +0 -49
  213. package/core/UI/Media/index.js +0 -3
  214. package/core/UI/Misc/index.js +0 -45
  215. package/core/UI/Semantic/index.js +0 -61
  216. package/core/UI/Style/index.js +0 -499
  217. package/core/UI/Table/elements.js +0 -94
  218. package/core/UI/Table/index.js +0 -3
  219. package/core/UI/Table/table.js +0 -112
  220. package/core/UI/Table/utils.js +0 -12
  221. package/core/UI/Text/heading.js +0 -34
  222. package/core/UI/Text/index.js +0 -3
  223. package/core/UI/Text/p.js +0 -36
  224. package/core/UI/Text/pre.js +0 -0
  225. package/core/UI/Text/text.js +0 -65
  226. package/core/UI/Utils/index.js +0 -70
  227. package/core/UI/ZikoUIElement.js +0 -503
  228. package/core/UI/index.js +0 -154
  229. package/core/__proto__/Array.js +0 -74
  230. package/core/__proto__/Function.js +0 -0
  231. package/core/__proto__/Number.js +0 -76
  232. package/core/__proto__/Object.js +0 -0
  233. package/core/__proto__/String.js +0 -0
  234. package/core/index.js +0 -72
  235. package/wrapper/react/readme.md +0 -19
@@ -1,230 +0,0 @@
1
- import {ZikoEvent,EVENT_CONTROLLER} from "../ZikoEvent.js";
2
- class ZikoEventMouse extends ZikoEvent{
3
- constructor(target){
4
- super(target);
5
- this.event=null;
6
- this.dx=0;
7
- this.dy=0;
8
- this.dt=0;
9
- this.mx=0;
10
- this.my=0;
11
- this.mt=0;
12
- this.ux=0;
13
- this.uy=0;
14
- this.ut=0;
15
- this.swippe={
16
- h:null,
17
- v:null,
18
- delta_x:0,
19
- delta_y:0
20
- }
21
- this.isMoving=false;
22
- this.isDown=false;
23
- this.cache={
24
- prefixe:"mouse",
25
- preventDefault:{
26
- down:false,
27
- move:false,
28
- up:false,
29
- enter:false,
30
- out:false,
31
- leave:false,
32
- over:false,
33
- },
34
- paused:{
35
- down:false,
36
- move:false,
37
- up:false,
38
- enter:false,
39
- out:false,
40
- leave:false,
41
- over:false,
42
- },
43
- stream:{
44
- enabled:{
45
- down:false,
46
- move:false,
47
- up:false,
48
- enter:false,
49
- out:false,
50
- leave:false,
51
- over:false,
52
- },
53
- clear:{
54
- down:false,
55
- move:false,
56
- up:false,
57
- enter:false,
58
- out:false,
59
- leave:false,
60
- over:false,
61
- },
62
- history:{
63
- down:[],
64
- move:[],
65
- up:[],
66
- enter:[],
67
- out:[],
68
- leave:[],
69
- over:[]
70
- }
71
- },
72
- callbacks:{
73
- down:[(self)=>console.log({dx:self.dx,dy:self.dy,down:self.down,move:self.move,t:self.dt})],
74
- move:[(self)=>console.log({mx:self.mx,my:self.my,down:self.down,move:self.move,t:self.dt})],
75
- up:[(self)=>console.log({ux:self.ux,uy:self.uy,down:self.down,move:self.move,t:self.dt})],
76
- enter:[(self)=>console.log({dx:self.dx,dy:self.dy,down:self.down,move:self.move,t:self.dt})],
77
- out:[(self)=>console.log({mx:self.mx,my:self.my,down:self.down,move:self.move,t:self.dt})],
78
- leave:[(self)=>console.log({ux:self.ux,uy:self.uy,down:self.down,move:self.move,t:self.dt})],
79
- over:[(self)=>console.log({ux:self.ux,uy:self.uy,down:self.down,move:self.move,t:self.dt})]
80
- }
81
- }
82
- this.__controller={
83
- down:mousedown_controller.bind(this),
84
- move:mousemove_controller.bind(this),
85
- up:mouseup_controller.bind(this),
86
- enter:mouseenter_controller.bind(this),
87
- out:mouseout_controller.bind(this),
88
- leave:mouseleave_controller.bind(this),
89
- over:mouseover_controller.bind(this),
90
- }
91
- }
92
- onDown(...callbacks){
93
- if(callbacks.length===0)callbacks=[()=>{}];
94
- this.__onEvent("down",{down:true,move:false,up:false,enter:false,out:false,leave:false,over:false},...callbacks)
95
- return this;
96
- }
97
- onMove(...callbacks){
98
- if(callbacks.length===0)callbacks=[()=>{}];
99
- this.__onEvent("move",{down:false,move:true,up:false,enter:false,out:false,leave:false,over:false},...callbacks)
100
- return this;
101
- }
102
- onUp(...callbacks){
103
- if(callbacks.length===0)callbacks=[()=>{}];
104
- this.__onEvent("up",{down:false,move:false,up:true,enter:false,out:false,leave:false,over:false},...callbacks)
105
- return this;
106
- }
107
- onEnter(...callbacks){
108
- if(callbacks.length===0)callbacks=[()=>{}];
109
- this.__onEvent("enter",{down:false,move:false,up:false,enter:true,out:false,leave:false,over:false},...callbacks)
110
- return this;
111
- }
112
- onOut(...callbacks){
113
- if(callbacks.length===0)callbacks=[()=>{}];
114
- this.__onEvent("out",{down:false,move:false,up:false,enter:false,out:true,leave:false,over:false},...callbacks)
115
- return this;
116
- }
117
- onLeave(...callbacks){
118
- if(callbacks.length===0)callbacks=[()=>{}];
119
- this.__onEvent("leave",{down:false,move:false,up:false,enter:false,out:false,leave:true,over:false},...callbacks)
120
- return this;
121
- }
122
- onOver(...callbacks){
123
- if(callbacks.length===0)callbacks=[()=>{}];
124
- this.__onEvent("over",{down:false,move:false,up:false,enter:false,out:false,leave:false,over:true},...callbacks)
125
- return this;
126
- }
127
- }
128
- function mousedown_controller(e){
129
- EVENT_CONTROLLER.call(
130
- this,
131
- e,
132
- "down",
133
- ()=>{
134
- this.dx=parseInt(e.offsetX);
135
- this.dy=parseInt(e.offsetY);
136
- this.isDown=true;
137
- },
138
- {
139
- x:this.dx,
140
- y:this.dy,
141
- t:Date.now()-this.cache.stream.t0
142
- }
143
- )
144
- }
145
- function mousemove_controller(e){
146
- EVENT_CONTROLLER.call(
147
- this,
148
- e,
149
- "move",
150
- ()=>{
151
- this.mx=parseInt(e.offsetX);
152
- this.my=parseInt(e.offsetY);
153
- this.isMoving=true;
154
- },
155
- {
156
- x:this.mx,
157
- y:this.my,
158
- t:Date.now()-this.cache.stream.t0
159
- }
160
- )
161
- }
162
- function mouseup_controller(e){
163
- EVENT_CONTROLLER.call(
164
- this,
165
- e,
166
- "up",
167
- ()=>{
168
- this.ux=parseInt(e.offsetX);
169
- this.uy=parseInt(e.offsetY);
170
- this.isDown=false;
171
- const dx=this.dx;
172
- const dy=this.dy;
173
- const ux=this.ux;
174
- const uy=this.uy;
175
- const delta_x=(ux-dx)/this.target.Width;
176
- const delta_y=(dy-uy)/this.target.Height;
177
- const HORIZONTAL_SWIPPE=(delta_x<0)?"left":(delta_x>0)?"right":"none";
178
- const VERTICAL_SWIPPE=(delta_y<0)?"bottom":(delta_y>0)?"top":"none";
179
- this.swippe={
180
- h:HORIZONTAL_SWIPPE,
181
- v:VERTICAL_SWIPPE,
182
- delta_x,
183
- delta_y
184
- }
185
- },
186
- {
187
- x:this.ux,
188
- y:this.uy,
189
- t:Date.now()-this.cache.stream.t0
190
- }
191
- )
192
- }
193
- function mouseenter_controller(e){
194
- EVENT_CONTROLLER.call(
195
- this,
196
- e,
197
- "enter",
198
- null,
199
- null
200
- )
201
- }
202
- function mouseleave_controller(e){
203
- EVENT_CONTROLLER.call(
204
- this,
205
- e,
206
- "leave",
207
- null,
208
- null
209
- )
210
- }
211
- function mouseout_controller(e){
212
- EVENT_CONTROLLER.call(
213
- this,
214
- e,
215
- "out",
216
- null,
217
- null
218
- )
219
- }
220
- function mouseover_controller(e){
221
- EVENT_CONTROLLER.call(
222
- this,
223
- e,
224
- "out",
225
- null,
226
- null
227
- )
228
- }
229
- const Mouse=target=>new ZikoEventMouse(target);
230
- export default Mouse;
@@ -1,214 +0,0 @@
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;
File without changes
@@ -1,44 +0,0 @@
1
- import { ZikoEvent , EVENT_CONTROLLER } from "../ZikoEvent.js";
2
- function wheel_controller(e){
3
- EVENT_CONTROLLER.call(this,e,"wheel",null,null)
4
- }
5
- class ZikoEventWheel extends ZikoEvent{
6
- constructor(target){
7
- super(target);
8
- this.event=null;
9
- this.cache={
10
- prefixe:"",
11
- preventDefault:{
12
- wheel:false,
13
- },
14
- paused:{
15
- wheel:false,
16
- },
17
- stream:{
18
- enabled:{
19
- wheel:false,
20
-
21
- },
22
- clear:{
23
- wheel:false,
24
-
25
- },
26
- history:{
27
- wheel:[],
28
- }
29
- },
30
- callbacks:{
31
- click:[],
32
- }
33
- }
34
- this.__controller={
35
- wheel:wheel_controller.bind(this),
36
- }
37
- }
38
- onWheel(...callbacks){
39
- this.__onEvent("wheel",{},...callbacks)
40
- return this;
41
- }
42
- }
43
- const Wheel=Target=>new ZikoEventWheel(Target);
44
- export default Wheel
@@ -1,44 +0,0 @@
1
- import { ZikoEvent , EVENT_CONTROLLER } from "../ZikoEvent.js";
2
- function hashchange_controller(e){
3
- EVENT_CONTROLLER.call(this,e,"hashchange",null,null)
4
- }
5
- class ZikoEventHash extends ZikoEvent{
6
- constructor(target){
7
- super(target);
8
- this.event=null;
9
- this.cache={
10
- prefixe:"",
11
- preventDefault:{
12
- hashchange:false,
13
- },
14
- paused:{
15
- hashchange:false,
16
- },
17
- stream:{
18
- enabled:{
19
- hashchange:false,
20
-
21
- },
22
- clear:{
23
- hashchange:false,
24
-
25
- },
26
- history:{
27
- hashchange:[],
28
- }
29
- },
30
- callbacks:{
31
- hashchange:[],
32
- }
33
- }
34
- this.__controller={
35
- hashchange:hashchange_controller.bind(this),
36
- }
37
- }
38
- onChange(...callbacks){
39
- this.__onEvent("hashchange",{},...callbacks)
40
- return this;
41
- }
42
- }
43
- const HashEvent=Target=>new ZikoEventHash(Target);
44
- export default HashEvent
@@ -1,59 +0,0 @@
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
@@ -1 +0,0 @@
1
- // Timeupdate
@@ -1,91 +0,0 @@
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}