ziko 0.0.5 → 0.0.7

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 (236) hide show
  1. package/README.md +171 -182
  2. package/dist/ziko.cjs +10022 -9853
  3. package/dist/ziko.js +10023 -9854
  4. package/dist/ziko.min.js +2 -2
  5. package/dist/ziko.mjs +10021 -9853
  6. package/package.json +12 -4
  7. package/starter/bin/index.js +11 -0
  8. package/wrapper/react/README.md +26 -0
  9. package/wrapper/react/index.jsx +7 -1
  10. package/wrapper/svelte/ZikoUI.svelte +15 -0
  11. package/wrapper/vue/ZikoUI.vue +8 -2
  12. package/core/App/Accessibility/index.js +0 -0
  13. package/core/App/Globals/__Target__.js +0 -3
  14. package/core/App/Globals/__UI__.js +0 -38
  15. package/core/App/Globals/__init__.js +0 -8
  16. package/core/App/Globals/index.js +0 -18
  17. package/core/App/Router/index.js +0 -40
  18. package/core/App/Seo/index.js +0 -43
  19. package/core/App/Themes/dark.js +0 -885
  20. package/core/App/Themes/index.js +0 -11
  21. package/core/App/Themes/light.js +0 -255
  22. package/core/App/app.js +0 -46
  23. package/core/App/index.js +0 -12
  24. package/core/Data/Api/fetchdom.js +0 -14
  25. package/core/Data/Api/index.js +0 -4
  26. package/core/Data/Api/preload.js +0 -11
  27. package/core/Data/Converter/canvas.js +0 -25
  28. package/core/Data/Converter/csv.js +0 -33
  29. package/core/Data/Converter/index.js +0 -25
  30. package/core/Data/Converter/json.js +0 -80
  31. package/core/Data/Converter/markdown.js +0 -83
  32. package/core/Data/Converter/svg.js +0 -11
  33. package/core/Data/Parser/markdown.js +0 -0
  34. package/core/Data/Parser/xml.js +0 -47
  35. package/core/Data/Strings/index.js +0 -26
  36. package/core/Data/decorators.js +0 -0
  37. package/core/Data/index.js +0 -64
  38. package/core/Graphics/Canvas/Elements/Basic/arc.js +0 -43
  39. package/core/Graphics/Canvas/Elements/Basic/image.js +0 -0
  40. package/core/Graphics/Canvas/Elements/Basic/line.js +0 -26
  41. package/core/Graphics/Canvas/Elements/Basic/path.js +0 -0
  42. package/core/Graphics/Canvas/Elements/Basic/points.js +0 -48
  43. package/core/Graphics/Canvas/Elements/Basic/polygon.js +0 -7
  44. package/core/Graphics/Canvas/Elements/Basic/polyline.js +0 -0
  45. package/core/Graphics/Canvas/Elements/Basic/rect.js +0 -46
  46. package/core/Graphics/Canvas/Elements/Basic/text.js +0 -0
  47. package/core/Graphics/Canvas/Elements/Chart/histogram.js +0 -0
  48. package/core/Graphics/Canvas/Elements/Chart/plot.js +0 -0
  49. package/core/Graphics/Canvas/Elements/Chart/scatter.js +0 -2
  50. package/core/Graphics/Canvas/Elements/Chart/stem.js +0 -0
  51. package/core/Graphics/Canvas/Elements/Element.js +0 -115
  52. package/core/Graphics/Canvas/Elements/Groupe.js +0 -0
  53. package/core/Graphics/Canvas/Elements/grid.js +0 -0
  54. package/core/Graphics/Canvas/Elements/index.js +0 -13
  55. package/core/Graphics/Canvas/Filter/index.js +0 -0
  56. package/core/Graphics/Canvas/Paint/index.js +0 -0
  57. package/core/Graphics/Canvas/Utils/color.js +0 -8
  58. package/core/Graphics/Canvas/Utils/floodFill.js +0 -58
  59. package/core/Graphics/Canvas/_canvas_offscreen +0 -0
  60. package/core/Graphics/Canvas/canvas.js +0 -189
  61. package/core/Graphics/Canvas/index.js +0 -15
  62. package/core/Graphics/Svg/Elements/ZikoSvgElement.js +0 -28
  63. package/core/Graphics/Svg/Elements/circle.js +0 -34
  64. package/core/Graphics/Svg/Elements/ellipse.js +0 -29
  65. package/core/Graphics/Svg/Elements/foreignObject.js +0 -46
  66. package/core/Graphics/Svg/Elements/grid.js +0 -9
  67. package/core/Graphics/Svg/Elements/groupe.js +0 -29
  68. package/core/Graphics/Svg/Elements/image.js +0 -33
  69. package/core/Graphics/Svg/Elements/line.js +0 -29
  70. package/core/Graphics/Svg/Elements/path.js +0 -59
  71. package/core/Graphics/Svg/Elements/polygon.js +0 -31
  72. package/core/Graphics/Svg/Elements/polyline.js +0 -4
  73. package/core/Graphics/Svg/Elements/rect.js +0 -43
  74. package/core/Graphics/Svg/Elements/text.js +0 -26
  75. package/core/Graphics/Svg/index.js +0 -1
  76. package/core/Graphics/Svg/svg.js +0 -117
  77. package/core/Graphics/index.js +0 -61
  78. package/core/Math/Calculus/Special Functions/bessel.js +0 -31
  79. package/core/Math/Calculus/Special Functions/beta.js +0 -38
  80. package/core/Math/Calculus/Special Functions/gamma.js +0 -30
  81. package/core/Math/Calculus/Special Functions/index.js +0 -4
  82. package/core/Math/Calculus/index.js +0 -1
  83. package/core/Math/Complex/Fractals/julia.js +0 -0
  84. package/core/Math/Complex/index.js +0 -191
  85. package/core/Math/Discret/Combinaison/index.js +0 -34
  86. package/core/Math/Discret/Conversion/index.js +0 -86
  87. package/core/Math/Discret/Logic/index.js +0 -46
  88. package/core/Math/Discret/Permutation/index.js +0 -31
  89. package/core/Math/Discret/Set/index.js +0 -2
  90. package/core/Math/Discret/Set/powerSet.js +0 -15
  91. package/core/Math/Discret/Set/subSet.js +0 -10
  92. package/core/Math/Discret/index.js +0 -23
  93. package/core/Math/Functions/index.js +0 -182
  94. package/core/Math/Matrix/Decomposition.js +0 -90
  95. package/core/Math/Matrix/LinearSystem.js +0 -10
  96. package/core/Math/Matrix/Matrix.js +0 -712
  97. package/core/Math/Matrix/index.js +0 -3
  98. package/core/Math/Numeric/index.js +0 -0
  99. package/core/Math/Random/index.js +0 -173
  100. package/core/Math/Signal/__np.py.txt +0 -40
  101. package/core/Math/Signal/conv.js +0 -175
  102. package/core/Math/Signal/fft.js +0 -55
  103. package/core/Math/Signal/filter.js +0 -39
  104. package/core/Math/Signal/functions.js +0 -146
  105. package/core/Math/Signal/index.js +0 -110
  106. package/core/Math/Statistics/Functions/index.js +0 -100
  107. package/core/Math/Statistics/index.js +0 -16
  108. package/core/Math/Utils/arithmetic.js +0 -139
  109. package/core/Math/Utils/checkers.js +0 -11
  110. package/core/Math/Utils/comparaison.js +0 -1
  111. package/core/Math/Utils/conversions.js +0 -7
  112. package/core/Math/Utils/discret.js +0 -28
  113. package/core/Math/Utils/index.js +0 -102
  114. package/core/Math/Utils/mapfun.js +0 -43
  115. package/core/Math/absract.js +0 -1
  116. package/core/Math/const.js +0 -3
  117. package/core/Math/index.js +0 -193
  118. package/core/Reactivity/Events/Global/Click.js +0 -56
  119. package/core/Reactivity/Events/Global/Clipboard.js +0 -84
  120. package/core/Reactivity/Events/Global/CustomEvent.js +0 -53
  121. package/core/Reactivity/Events/Global/Drag.js +0 -137
  122. package/core/Reactivity/Events/Global/Focus.js +0 -56
  123. package/core/Reactivity/Events/Global/Key.js +0 -104
  124. package/core/Reactivity/Events/Global/Mouse.js +0 -230
  125. package/core/Reactivity/Events/Global/Pointer.js +0 -214
  126. package/core/Reactivity/Events/Global/Touch.js +0 -0
  127. package/core/Reactivity/Events/Global/Wheel.js +0 -44
  128. package/core/Reactivity/Events/Partiel/Hash.js +0 -44
  129. package/core/Reactivity/Events/Partiel/Input.js +0 -59
  130. package/core/Reactivity/Events/Partiel/MediaEvent.js +0 -1
  131. package/core/Reactivity/Events/ZikoEvent.js +0 -91
  132. package/core/Reactivity/Events/index.js +0 -60
  133. package/core/Reactivity/Observer/index.js +0 -3
  134. package/core/Reactivity/Observer/intersection.js +0 -40
  135. package/core/Reactivity/Observer/mutation.js +0 -90
  136. package/core/Reactivity/Observer/resize.js +0 -47
  137. package/core/Reactivity/Use/Contexte/index.js +0 -1
  138. package/core/Reactivity/Use/Contexte/useSuccesifKeys.js +0 -14
  139. package/core/Reactivity/Use/Decorators/index.js +0 -4
  140. package/core/Reactivity/Use/Interactions/index.js +0 -4
  141. package/core/Reactivity/Use/Interactions/useBluetooth.js +0 -48
  142. package/core/Reactivity/Use/Interactions/useChannel.js +0 -50
  143. package/core/Reactivity/Use/Interactions/useEventEmmiter.js +0 -64
  144. package/core/Reactivity/Use/Interactions/useSerial.js +0 -0
  145. package/core/Reactivity/Use/Interactions/useThread.js +0 -44
  146. package/core/Reactivity/Use/Interactions/useUsb.js +0 -0
  147. package/core/Reactivity/Use/Sensors/index.js +0 -2
  148. package/core/Reactivity/Use/Sensors/useBattery.js +0 -36
  149. package/core/Reactivity/Use/Sensors/useCamera.js +0 -0
  150. package/core/Reactivity/Use/Sensors/useGeolocation.js +0 -17
  151. package/core/Reactivity/Use/Sensors/useMicro.js +0 -0
  152. package/core/Reactivity/Use/Sensors/useOrientation.js +0 -0
  153. package/core/Reactivity/Use/Storage/index.js +0 -1
  154. package/core/Reactivity/Use/Storage/useCookie.js +0 -0
  155. package/core/Reactivity/Use/Storage/useIndexedDb.js +0 -0
  156. package/core/Reactivity/Use/Storage/useStorage.js +0 -74
  157. package/core/Reactivity/Use/UI/index.js +0 -4
  158. package/core/Reactivity/Use/UI/useCssLink.js +0 -0
  159. package/core/Reactivity/Use/UI/useCssText.js +0 -21
  160. package/core/Reactivity/Use/UI/useFavIcon.js +0 -38
  161. package/core/Reactivity/Use/UI/useLinearGradient.js +0 -0
  162. package/core/Reactivity/Use/UI/useMediaQuery.js +0 -1
  163. package/core/Reactivity/Use/UI/useRadialGradient.js +0 -0
  164. package/core/Reactivity/Use/UI/useStyle.js +0 -54
  165. package/core/Reactivity/Use/UI/useTheme.js +0 -62
  166. package/core/Reactivity/Use/UI/useTitle.js +0 -30
  167. package/core/Reactivity/Use/index.js +0 -82
  168. package/core/Reactivity/Use/todo.md +0 -26
  169. package/core/Reactivity/index.js +0 -3
  170. package/core/Time/animation.js +0 -76
  171. package/core/Time/index.js +0 -54
  172. package/core/Time/loop.js +0 -83
  173. package/core/Time/utils/decorators.js +0 -17
  174. package/core/Time/utils/ease.js +0 -144
  175. package/core/Time/utils/index.js +0 -18
  176. package/core/Time/utils/performance.js +0 -16
  177. package/core/Time/utils/ui.js +0 -26
  178. package/core/UI/CustomElement/Elements/Accordion/index.js +0 -62
  179. package/core/UI/CustomElement/Elements/Carousel/index.js +0 -47
  180. package/core/UI/CustomElement/Elements/CodeNote/CodeCell.js +0 -176
  181. package/core/UI/CustomElement/Elements/CodeNote/CodeNote.js +0 -69
  182. package/core/UI/CustomElement/Elements/CodeNote/SubElements.js +0 -64
  183. package/core/UI/CustomElement/Elements/CodeNote/index.js +0 -2
  184. package/core/UI/CustomElement/Elements/Columns.js +0 -1
  185. package/core/UI/CustomElement/Elements/FAB.js +0 -0
  186. package/core/UI/CustomElement/Elements/Menu.js +0 -0
  187. package/core/UI/CustomElement/Elements/Notification.js +0 -0
  188. package/core/UI/CustomElement/Elements/Popover.js +0 -0
  189. package/core/UI/CustomElement/Elements/Popup.js +0 -0
  190. package/core/UI/CustomElement/Elements/Swipper.js +0 -4
  191. package/core/UI/CustomElement/Elements/Tabs/index.js +0 -111
  192. package/core/UI/CustomElement/Elements/Timeline.js +0 -0
  193. package/core/UI/CustomElement/Elements/Toast.js +0 -0
  194. package/core/UI/CustomElement/Elements/Treeview.js +0 -0
  195. package/core/UI/CustomElement/Elements/index.js +0 -4
  196. package/core/UI/CustomElement/Flex.js +0 -97
  197. package/core/UI/CustomElement/Grid.js +0 -30
  198. package/core/UI/CustomElement/index.js +0 -3
  199. package/core/UI/Embaded/index.js +0 -1
  200. package/core/UI/Inputs/Primitives/btn.js +0 -30
  201. package/core/UI/Inputs/Primitives/elements.js +0 -28
  202. package/core/UI/Inputs/Primitives/inputs.js +0 -324
  203. package/core/UI/Inputs/Primitives/select.js +0 -14
  204. package/core/UI/Inputs/Primitives/textarea.js +0 -15
  205. package/core/UI/Inputs/camera.js +0 -23
  206. package/core/UI/Inputs/index.js +0 -20
  207. package/core/UI/List/elements.js +0 -0
  208. package/core/UI/List/index.js +0 -127
  209. package/core/UI/Media/Audio/index.js +0 -38
  210. package/core/UI/Media/Image/figure.js +0 -16
  211. package/core/UI/Media/Image/image.js +0 -33
  212. package/core/UI/Media/Image/index.js +0 -2
  213. package/core/UI/Media/Video/index.js +0 -49
  214. package/core/UI/Media/index.js +0 -3
  215. package/core/UI/Misc/index.js +0 -45
  216. package/core/UI/Semantic/index.js +0 -61
  217. package/core/UI/Style/index.js +0 -499
  218. package/core/UI/Table/elements.js +0 -94
  219. package/core/UI/Table/index.js +0 -3
  220. package/core/UI/Table/table.js +0 -112
  221. package/core/UI/Table/utils.js +0 -12
  222. package/core/UI/Text/heading.js +0 -34
  223. package/core/UI/Text/index.js +0 -3
  224. package/core/UI/Text/p.js +0 -36
  225. package/core/UI/Text/pre.js +0 -0
  226. package/core/UI/Text/text.js +0 -65
  227. package/core/UI/Utils/index.js +0 -70
  228. package/core/UI/ZikoUIElement.js +0 -503
  229. package/core/UI/index.js +0 -154
  230. package/core/__proto__/Array.js +0 -74
  231. package/core/__proto__/Function.js +0 -0
  232. package/core/__proto__/Number.js +0 -76
  233. package/core/__proto__/Object.js +0 -0
  234. package/core/__proto__/String.js +0 -0
  235. package/core/index.js +0 -72
  236. package/wrapper/react/readme.md +0 -19
@@ -1,60 +0,0 @@
1
- import Pointer from "./Global/Pointer.js";
2
- import Mouse from "./Global/Mouse.js";
3
- import Wheel from "./Global/Wheel.js";
4
- import Key from "./Global/Key.js";
5
- import {Drag,Drop} from "./Global/Drag.js";
6
- import Click from "./Global/Click.js";
7
- import Clipboard from "./Global/Clipboard.js";
8
- import Focus from "./Global/Focus.js";
9
- import Input from "./Partiel/Input.js";
10
- import HashEvent from "./Partiel/Hash.js";
11
- import customEvent from "./Global/CustomEvent.js";
12
- const Events={
13
- Pointer,
14
- Mouse,
15
- Wheel,
16
- Key,
17
- Drag,
18
- Drop,
19
- Click,
20
- Clipboard,
21
- Focus,
22
- Input,
23
- HashEvent,
24
- customEvent,
25
- ExtractAll: function () {
26
- const keys = Object.keys(this);
27
- for (let i = 0; i < keys.length; i++) {
28
- const key = keys[i];
29
- if (key !== 'ExtractAll' && key !== 'RemoveAll') {
30
- globalThis[key] = this[key];
31
- }
32
- }
33
- return this;
34
- },
35
- RemoveAll: function () {
36
- const keys = Object.keys(this);
37
- for (let i = 0; i < keys.length; i++) {
38
- const key = keys[i];
39
- if (key !== 'RemoveAll') {
40
- delete globalThis[key];
41
- }
42
- }
43
- return this;
44
- }
45
- }
46
- export {
47
- Pointer,
48
- Mouse,
49
- Wheel,
50
- Key,
51
- Drag,
52
- Drop,
53
- Click,
54
- Clipboard,
55
- Focus,
56
- Input,
57
- HashEvent,
58
- customEvent
59
- }
60
- export default Events
@@ -1,3 +0,0 @@
1
- export * from "./intersection";
2
- export * from "./mutation";
3
- export * from "./resize";
@@ -1,40 +0,0 @@
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}
@@ -1,90 +0,0 @@
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 };
@@ -1,47 +0,0 @@
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}
@@ -1 +0,0 @@
1
- export * from "./useSuccesifKeys"
@@ -1,14 +0,0 @@
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
- }
@@ -1,4 +0,0 @@
1
- export {
2
- useThrottle,
3
- useDebounce
4
- } from "../../../Time";
@@ -1,4 +0,0 @@
1
- export * from "./useChannel";
2
- export * from "./useEventEmmiter";
3
- export * from "./useThread";
4
- export * from "./useBluetooth";
@@ -1,48 +0,0 @@
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 }
@@ -1,50 +0,0 @@
1
- import { Random } from "../../../Math/Random";
2
- class ZikoUseChannel{
3
- constructor(name=""){
4
- this.channel=new BroadcastChannel(name);
5
- this.EVENTS_DATAS_PAIRS=new Map();
6
- this.EVENTS_HANDLERS_PAIRS=new Map();
7
- this.LAST_RECEIVED_EVENT="";
8
- this.UUID="ziko-channel"+Random.string(10);
9
- this.SUBSCRIBERS=new Set([this.UUID]);
10
- }
11
- get broadcast(){
12
- // update receiver
13
- return this;
14
- }
15
- emit(event, data){
16
- this.EVENTS_DATAS_PAIRS.set(event,data)
17
- this.#maintainEmit(event);
18
- return this;
19
- }
20
- on(event,handler=console.log){
21
- this.EVENTS_HANDLERS_PAIRS.set(event,handler);
22
- this.#maintainOn()
23
- return this;
24
- }
25
- #maintainOn(){
26
- this.channel.onmessage = (e) => {
27
- this.LAST_RECEIVED_EVENT=e.data.last_sended_event;
28
- const USER_ID=e.data.userId;
29
- this.SUBSCRIBERS.add(USER_ID)
30
- const Data=e.data.EVENTS_DATAS_PAIRS.get(this.LAST_RECEIVED_EVENT)
31
- const Handler=this.EVENTS_HANDLERS_PAIRS.get(this.LAST_RECEIVED_EVENT)
32
- if(Data && Handler)Handler(Data)
33
- };
34
- return this;
35
- }
36
- #maintainEmit(event){
37
- this.channel.postMessage({
38
- EVENTS_DATAS_PAIRS:this.EVENTS_DATAS_PAIRS,
39
- last_sended_event:event,
40
- userId:this.UUID
41
- });
42
- return this;
43
- }
44
- close(){
45
- this.channel.close();
46
- return this;
47
- }
48
- }
49
- const useChannel=name=>new ZikoUseChannel(name);
50
- export{ useChannel }
@@ -1,64 +0,0 @@
1
- class ZikoUseEventEmitter {
2
- constructor() {
3
- this.events = {};
4
- this.maxListeners = 10;
5
- }
6
- on(event, listener) {
7
- if (!this.events[event]) {
8
- this.events[event] = [];
9
- }
10
- this.events[event].push(listener);
11
- if (this.events[event].length > this.maxListeners) {
12
- console.warn(`Warning: Possible memory leak. Event '${event}' has more than ${this.maxListeners} listeners.`);
13
- }
14
- }
15
- once(event, listener) {
16
- const onceListener = (data) => {
17
- this.off(event, onceListener); // Remove the listener after it's been called
18
- listener(data);
19
- };
20
- this.on(event, onceListener);
21
- }
22
-
23
- off(event, listener) {
24
- const listeners = this.events[event];
25
- if (listeners) {
26
- const index = listeners.indexOf(listener);
27
- if (index !== -1) {
28
- listeners.splice(index, 1);
29
- }
30
- }
31
- }
32
-
33
- emit(event, data) {
34
- const listeners = this.events[event];
35
- if (listeners) {
36
- listeners.forEach(listener => {
37
- listener(data);
38
- });
39
- }
40
- }
41
-
42
- clear(event) {
43
- if (event) {
44
- delete this.events[event];
45
- } else {
46
- this.events = {};
47
- }
48
- }
49
-
50
- setMaxListener(event, max) {
51
- this.maxListeners = max;
52
- }
53
-
54
- removeAllListeners(event) {
55
- if (event) {
56
- this.events[event] = [];
57
- } else {
58
- this.events = {};
59
- }
60
- }
61
- }
62
-
63
- const useEventEmitter=()=>new ZikoUseEventEmitter()
64
- export{useEventEmitter}
File without changes
@@ -1,44 +0,0 @@
1
- class ZikoUseThreed {
2
- #workerContent;
3
- constructor() {
4
- this.#workerContent = (
5
- function (msg) {
6
- try {
7
- const func = new Function("return " + msg.data.fun)();
8
- let result = func();
9
- postMessage({ result });
10
- } catch (error) {
11
- postMessage({ error: error.message });
12
- } finally {
13
- if (msg.data.close) self.close();
14
- }
15
- }
16
- ).toString();
17
- this.blob = new Blob(["this.onmessage = " + this.#workerContent], { type: "text/javascript" });
18
- this.worker = new Worker(window.URL.createObjectURL(this.blob));
19
- }
20
- call(func, callback, close = true) {
21
- this.worker.postMessage({
22
- fun: func.toString(),
23
- close
24
- });
25
- this.worker.onmessage = function (e) {
26
- if (e.data.error) {
27
- console.error(e.data.error);
28
- } else {
29
- callback(e.data.result);
30
- }
31
- };
32
- return this;
33
- }
34
- }
35
-
36
- const useThread = (func, callback , close) => {
37
- const T = new ZikoUseThreed();
38
- if (func) {
39
- T.call(func, callback , close);
40
- }
41
- return T;
42
- }
43
-
44
- export { useThread };
File without changes
@@ -1,2 +0,0 @@
1
- export * from "./useBattery";
2
- export * from "./useGeolocation"
@@ -1,36 +0,0 @@
1
- class ZikoUseBattery{
2
- constructor(){
3
- if(this.isSupported)this.#init();
4
- }
5
- async #init(){
6
- this.__Battery__=await navigator.getBattery();
7
- }
8
- get isSupported(){
9
- return !!navigator.getBattery;
10
- }
11
- get current(){
12
- // Synchrouns Code
13
- const {
14
- level,
15
- charging,
16
- chargingTime,
17
- dischargingTime
18
- }=this.__Battery__;
19
- return{
20
- level,
21
- charging,
22
- chargingTime,
23
- dischargingTime
24
- }
25
- }
26
- onChargingChange(callback){
27
- this.__Battery__.addEventListener("chargingchange",callback);
28
- return this;
29
- }
30
- onLevelChange(callback){
31
- this.__Battery__.addEventListener("levelchange",callback);
32
- return this;
33
- }
34
- }
35
- const useBattery=()=>new ZikoUseBattery();
36
- export{ useBattery }
File without changes
@@ -1,17 +0,0 @@
1
- class ZikoUseGeolocation{
2
- constructor(){
3
- if(this.isSupported)this.#init();
4
- }
5
- async #init(){
6
- navigator.geolocation.getCurrentPosition(e=>this.__Geolocation__=e)
7
- }
8
- get isSupported(){
9
- return !!navigator.geolocation;
10
- }
11
- get current(){
12
- // Synchrouns Code
13
- return this.__Geolocation__;
14
- }
15
- }
16
- const useGeolocation=()=>new ZikoUseGeolocation();
17
- export{ useGeolocation }
File without changes
File without changes
@@ -1 +0,0 @@
1
- export * from "./useStorage";
File without changes
File without changes
@@ -1,74 +0,0 @@
1
- // To do : remove old items
2
- import { useChannel } from "../Interactions";
3
- class ZikoUseStorage{
4
- #CACHE
5
- constructor(storage,globalKey,initialValue){
6
- this.#CACHE={
7
- storage,
8
- globalKey,
9
- channel:useChannel(`Ziko:useStorage-${globalKey}`),
10
- oldItemKeys:new Set()
11
- }
12
- this.#init(initialValue);
13
- this.#maintain();
14
- }
15
- get items(){
16
- return JSON.parse(this.#CACHE.storage[this.#CACHE.globalKey]??null);
17
- }
18
- #maintain() {
19
- for(let i in this.items)Object.assign(this, { [[i]]: this.items[i] });
20
- }
21
- #init(initialValue){
22
- this.#CACHE.channel=useChannel(`Ziko:useStorage-${this.#CACHE.globalKey}`);
23
- this.#CACHE.channel.on("Ziko-Storage-Updated",()=>this.#maintain());
24
- if(!initialValue)return;
25
- if(this.#CACHE.storage[this.#CACHE.globalKey]){
26
- Object.keys(this.items).forEach(key=>this.#CACHE.oldItemKeys.add(key));
27
- console.group("Ziko:useStorage")
28
- console.warn(`Storage key '${this.#CACHE.globalKey}' already exists. we will not overwrite it.`);
29
- console.info(`%cWe'll keep the existing data.`,"background-color:#2222dd; color:gold;");
30
- console.group("")
31
- }
32
- else this.set(initialValue);
33
- }
34
- set(data){
35
- this.#CACHE.storage.setItem(this.#CACHE.globalKey,JSON.stringify(data));
36
- this.#CACHE.channel.emit("Ziko-Storage-Updated",{});
37
- Object.keys(data).forEach(key=>this.#CACHE.oldItemKeys.add(key));
38
- this.#maintain();
39
- return this
40
- }
41
- add(data){
42
- const db={
43
- ...this.items,
44
- ...data
45
- }
46
- this.#CACHE.storage.setItem(this.#CACHE.globalKey,JSON.stringify(db));
47
- this.#maintain();
48
- return this;
49
- }
50
- remove(...keys){
51
- const db={...this.items};
52
- for(let i=0;i<keys.length;i++){
53
- delete db[keys[i]];
54
- delete this[keys[i]];
55
- }
56
- this.set(db);
57
- return this;
58
- }
59
- get(key){
60
- return this.items[key];
61
- }
62
- clear(){
63
- this.#CACHE.storage.removeItem(this.#CACHE.globalKey);
64
- this.#maintain();
65
- return this;
66
- }
67
-
68
- }
69
- const useLocaleStorage=(key,initialValue)=>new ZikoUseStorage(localStorage,key,initialValue);
70
- const useSessionStorage=(key,initialValue)=>new ZikoUseStorage(sessionStorage,key,initialValue);
71
- export{
72
- useLocaleStorage,
73
- useSessionStorage
74
- }
@@ -1,4 +0,0 @@
1
- export * from "./useStyle";
2
- export * from "./useTheme";
3
- export * from "./useTitle";
4
- export * from "./useFavIcon";
File without changes
@@ -1,21 +0,0 @@
1
- class ZikoUseCssText{
2
- constructor(css){
3
- this.#init();
4
- this.set(css);
5
- }
6
- #init(){
7
- // this.__FavIcon__=document.querySelector("link[rel*='icon']") || document.createElement('link');
8
- // this.__FavIcon__.type = 'image/x-icon';
9
- // this.__FavIcon__.rel = 'shortcut icon';
10
- return this;
11
- }
12
- set(cssText){
13
- // if(href!==this.__FavIcon__.href){
14
- // this.__FavIcon__.href=href;
15
- // if(this.cache.Emitter)this.cache.Emitter.emit("ziko:favicon-changed");
16
- // }
17
- return this;
18
- }
19
- }
20
- const useFavIcon=(FavIcon,useEventEmitter)=>new ZikoUseFavIcon(FavIcon,useEventEmitter);
21
- export{ useFavIcon }