ziko 0.0.4 → 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 (234) hide show
  1. package/dist/ziko.cjs +10000 -9874
  2. package/dist/ziko.js +10001 -9875
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +9998 -9873
  5. package/package.json +15 -5
  6. package/starter/bin/index.js +10 -0
  7. package/wrapper/react/README.md +26 -0
  8. package/wrapper/react/index.jsx +22 -0
  9. package/wrapper/svelte/ZikoUI.svelte +15 -0
  10. package/wrapper/vue/ZikoUI.vue +23 -0
  11. package/src/App/Accessibility/index.js +0 -0
  12. package/src/App/Globals/__Target__.js +0 -3
  13. package/src/App/Globals/__UI__.js +0 -38
  14. package/src/App/Globals/__init__.js +0 -8
  15. package/src/App/Globals/index.js +0 -3
  16. package/src/App/Router/index.js +0 -40
  17. package/src/App/Seo/index.js +0 -43
  18. package/src/App/Themes/dark.js +0 -885
  19. package/src/App/Themes/index.js +0 -11
  20. package/src/App/Themes/light.js +0 -255
  21. package/src/App/app.js +0 -46
  22. package/src/App/index.js +0 -11
  23. package/src/Data/Api/fetchdom.js +0 -14
  24. package/src/Data/Api/index.js +0 -4
  25. package/src/Data/Api/preload.js +0 -11
  26. package/src/Data/Converter/canvas.js +0 -25
  27. package/src/Data/Converter/csv.js +0 -33
  28. package/src/Data/Converter/index.js +0 -25
  29. package/src/Data/Converter/json.js +0 -80
  30. package/src/Data/Converter/markdown.js +0 -83
  31. package/src/Data/Converter/svg.js +0 -11
  32. package/src/Data/Parser/markdown.js +0 -0
  33. package/src/Data/Parser/xml.js +0 -47
  34. package/src/Data/Strings/index.js +0 -26
  35. package/src/Data/decorators.js +0 -0
  36. package/src/Data/index.js +0 -64
  37. package/src/Graphics/Canvas/Elements/Basic/arc.js +0 -43
  38. package/src/Graphics/Canvas/Elements/Basic/image.js +0 -0
  39. package/src/Graphics/Canvas/Elements/Basic/line.js +0 -26
  40. package/src/Graphics/Canvas/Elements/Basic/path.js +0 -0
  41. package/src/Graphics/Canvas/Elements/Basic/points.js +0 -48
  42. package/src/Graphics/Canvas/Elements/Basic/polygon.js +0 -7
  43. package/src/Graphics/Canvas/Elements/Basic/polyline.js +0 -0
  44. package/src/Graphics/Canvas/Elements/Basic/rect.js +0 -46
  45. package/src/Graphics/Canvas/Elements/Basic/text.js +0 -0
  46. package/src/Graphics/Canvas/Elements/Chart/histogram.js +0 -0
  47. package/src/Graphics/Canvas/Elements/Chart/plot.js +0 -0
  48. package/src/Graphics/Canvas/Elements/Chart/scatter.js +0 -2
  49. package/src/Graphics/Canvas/Elements/Chart/stem.js +0 -0
  50. package/src/Graphics/Canvas/Elements/Element.js +0 -115
  51. package/src/Graphics/Canvas/Elements/Groupe.js +0 -0
  52. package/src/Graphics/Canvas/Elements/grid.js +0 -0
  53. package/src/Graphics/Canvas/Elements/index.js +0 -13
  54. package/src/Graphics/Canvas/Filter/index.js +0 -0
  55. package/src/Graphics/Canvas/Paint/index.js +0 -0
  56. package/src/Graphics/Canvas/Utils/color.js +0 -8
  57. package/src/Graphics/Canvas/Utils/floodFill.js +0 -58
  58. package/src/Graphics/Canvas/_canvas_offscreen +0 -0
  59. package/src/Graphics/Canvas/canvas.js +0 -189
  60. package/src/Graphics/Canvas/index.js +0 -15
  61. package/src/Graphics/Svg/Elements/ZikoSvgElement.js +0 -28
  62. package/src/Graphics/Svg/Elements/circle.js +0 -34
  63. package/src/Graphics/Svg/Elements/ellipse.js +0 -29
  64. package/src/Graphics/Svg/Elements/foreignObject.js +0 -46
  65. package/src/Graphics/Svg/Elements/grid.js +0 -9
  66. package/src/Graphics/Svg/Elements/groupe.js +0 -29
  67. package/src/Graphics/Svg/Elements/image.js +0 -33
  68. package/src/Graphics/Svg/Elements/line.js +0 -29
  69. package/src/Graphics/Svg/Elements/path.js +0 -59
  70. package/src/Graphics/Svg/Elements/polygon.js +0 -31
  71. package/src/Graphics/Svg/Elements/polyline.js +0 -4
  72. package/src/Graphics/Svg/Elements/rect.js +0 -43
  73. package/src/Graphics/Svg/Elements/text.js +0 -26
  74. package/src/Graphics/Svg/index.js +0 -1
  75. package/src/Graphics/Svg/svg.js +0 -117
  76. package/src/Graphics/index.js +0 -61
  77. package/src/Math/Calculus/Special Functions/bessel.js +0 -31
  78. package/src/Math/Calculus/Special Functions/beta.js +0 -38
  79. package/src/Math/Calculus/Special Functions/gamma.js +0 -30
  80. package/src/Math/Calculus/Special Functions/index.js +0 -4
  81. package/src/Math/Calculus/index.js +0 -1
  82. package/src/Math/Complex/Fractals/julia.js +0 -0
  83. package/src/Math/Complex/index.js +0 -191
  84. package/src/Math/Discret/Combinaison/index.js +0 -34
  85. package/src/Math/Discret/Conversion/index.js +0 -86
  86. package/src/Math/Discret/Logic/index.js +0 -46
  87. package/src/Math/Discret/Permutation/index.js +0 -31
  88. package/src/Math/Discret/Set/index.js +0 -2
  89. package/src/Math/Discret/Set/powerSet.js +0 -15
  90. package/src/Math/Discret/Set/subSet.js +0 -10
  91. package/src/Math/Discret/index.js +0 -23
  92. package/src/Math/Functions/index.js +0 -182
  93. package/src/Math/Matrix/Decomposition.js +0 -90
  94. package/src/Math/Matrix/LinearSystem.js +0 -10
  95. package/src/Math/Matrix/Matrix.js +0 -712
  96. package/src/Math/Matrix/index.js +0 -3
  97. package/src/Math/Numeric/index.js +0 -0
  98. package/src/Math/Random/index.js +0 -173
  99. package/src/Math/Signal/__np.py.txt +0 -40
  100. package/src/Math/Signal/conv.js +0 -175
  101. package/src/Math/Signal/fft.js +0 -55
  102. package/src/Math/Signal/filter.js +0 -39
  103. package/src/Math/Signal/functions.js +0 -146
  104. package/src/Math/Signal/index.js +0 -110
  105. package/src/Math/Statistics/Functions/index.js +0 -100
  106. package/src/Math/Statistics/index.js +0 -16
  107. package/src/Math/Utils/arithmetic.js +0 -139
  108. package/src/Math/Utils/checkers.js +0 -11
  109. package/src/Math/Utils/comparaison.js +0 -1
  110. package/src/Math/Utils/conversions.js +0 -7
  111. package/src/Math/Utils/discret.js +0 -28
  112. package/src/Math/Utils/index.js +0 -102
  113. package/src/Math/Utils/mapfun.js +0 -43
  114. package/src/Math/absract.js +0 -1
  115. package/src/Math/const.js +0 -3
  116. package/src/Math/index.js +0 -193
  117. package/src/Reactivity/Events/Global/Click.js +0 -56
  118. package/src/Reactivity/Events/Global/Clipboard.js +0 -84
  119. package/src/Reactivity/Events/Global/CustomEvent.js +0 -53
  120. package/src/Reactivity/Events/Global/Drag.js +0 -137
  121. package/src/Reactivity/Events/Global/Focus.js +0 -56
  122. package/src/Reactivity/Events/Global/Key.js +0 -104
  123. package/src/Reactivity/Events/Global/Mouse.js +0 -230
  124. package/src/Reactivity/Events/Global/Pointer.js +0 -214
  125. package/src/Reactivity/Events/Global/Touch.js +0 -0
  126. package/src/Reactivity/Events/Global/Wheel.js +0 -44
  127. package/src/Reactivity/Events/Partiel/Hash.js +0 -44
  128. package/src/Reactivity/Events/Partiel/Input.js +0 -59
  129. package/src/Reactivity/Events/Partiel/MediaEvent.js +0 -1
  130. package/src/Reactivity/Events/ZikoEvent.js +0 -91
  131. package/src/Reactivity/Events/index.js +0 -60
  132. package/src/Reactivity/Observer/index.js +0 -3
  133. package/src/Reactivity/Observer/intersection.js +0 -40
  134. package/src/Reactivity/Observer/mutation.js +0 -90
  135. package/src/Reactivity/Observer/resize.js +0 -47
  136. package/src/Reactivity/Use/Contexte/index.js +0 -1
  137. package/src/Reactivity/Use/Contexte/useSuccesifKeys.js +0 -14
  138. package/src/Reactivity/Use/Decorators/index.js +0 -4
  139. package/src/Reactivity/Use/Interactions/index.js +0 -4
  140. package/src/Reactivity/Use/Interactions/useBluetooth.js +0 -48
  141. package/src/Reactivity/Use/Interactions/useChannel.js +0 -50
  142. package/src/Reactivity/Use/Interactions/useEventEmmiter.js +0 -64
  143. package/src/Reactivity/Use/Interactions/useSerial.js +0 -0
  144. package/src/Reactivity/Use/Interactions/useThread.js +0 -44
  145. package/src/Reactivity/Use/Interactions/useUsb.js +0 -0
  146. package/src/Reactivity/Use/Sensors/index.js +0 -2
  147. package/src/Reactivity/Use/Sensors/useBattery.js +0 -36
  148. package/src/Reactivity/Use/Sensors/useCamera.js +0 -0
  149. package/src/Reactivity/Use/Sensors/useGeolocation.js +0 -17
  150. package/src/Reactivity/Use/Sensors/useMicro.js +0 -0
  151. package/src/Reactivity/Use/Sensors/useOrientation.js +0 -0
  152. package/src/Reactivity/Use/Storage/index.js +0 -1
  153. package/src/Reactivity/Use/Storage/useCookie.js +0 -0
  154. package/src/Reactivity/Use/Storage/useIndexedDb.js +0 -0
  155. package/src/Reactivity/Use/Storage/useStorage.js +0 -74
  156. package/src/Reactivity/Use/UI/index.js +0 -4
  157. package/src/Reactivity/Use/UI/useCssLink.js +0 -0
  158. package/src/Reactivity/Use/UI/useCssText.js +0 -21
  159. package/src/Reactivity/Use/UI/useFavIcon.js +0 -38
  160. package/src/Reactivity/Use/UI/useLinearGradient.js +0 -0
  161. package/src/Reactivity/Use/UI/useMediaQuery.js +0 -1
  162. package/src/Reactivity/Use/UI/useRadialGradient.js +0 -0
  163. package/src/Reactivity/Use/UI/useStyle.js +0 -54
  164. package/src/Reactivity/Use/UI/useTheme.js +0 -62
  165. package/src/Reactivity/Use/UI/useTitle.js +0 -30
  166. package/src/Reactivity/Use/index.js +0 -82
  167. package/src/Reactivity/Use/todo.md +0 -26
  168. package/src/Reactivity/index.js +0 -3
  169. package/src/Time/animation.js +0 -76
  170. package/src/Time/index.js +0 -54
  171. package/src/Time/loop.js +0 -83
  172. package/src/Time/utils/decorators.js +0 -17
  173. package/src/Time/utils/ease.js +0 -144
  174. package/src/Time/utils/index.js +0 -18
  175. package/src/Time/utils/performance.js +0 -16
  176. package/src/Time/utils/ui.js +0 -26
  177. package/src/UI/CustomElement/Elements/Accordion/index.js +0 -62
  178. package/src/UI/CustomElement/Elements/Carousel/index.js +0 -47
  179. package/src/UI/CustomElement/Elements/CodeNote/CodeCell.js +0 -176
  180. package/src/UI/CustomElement/Elements/CodeNote/CodeNote.js +0 -69
  181. package/src/UI/CustomElement/Elements/CodeNote/SubElements.js +0 -64
  182. package/src/UI/CustomElement/Elements/CodeNote/index.js +0 -2
  183. package/src/UI/CustomElement/Elements/Columns.js +0 -1
  184. package/src/UI/CustomElement/Elements/FAB.js +0 -0
  185. package/src/UI/CustomElement/Elements/Menu.js +0 -0
  186. package/src/UI/CustomElement/Elements/Notification.js +0 -0
  187. package/src/UI/CustomElement/Elements/Popover.js +0 -0
  188. package/src/UI/CustomElement/Elements/Popup.js +0 -0
  189. package/src/UI/CustomElement/Elements/Swipper.js +0 -4
  190. package/src/UI/CustomElement/Elements/Tabs/index.js +0 -111
  191. package/src/UI/CustomElement/Elements/Timeline.js +0 -0
  192. package/src/UI/CustomElement/Elements/Toast.js +0 -0
  193. package/src/UI/CustomElement/Elements/Treeview.js +0 -0
  194. package/src/UI/CustomElement/Elements/index.js +0 -4
  195. package/src/UI/CustomElement/Flex.js +0 -97
  196. package/src/UI/CustomElement/Grid.js +0 -30
  197. package/src/UI/CustomElement/index.js +0 -3
  198. package/src/UI/Embaded/index.js +0 -1
  199. package/src/UI/Inputs/Primitives/btn.js +0 -31
  200. package/src/UI/Inputs/Primitives/elements.js +0 -28
  201. package/src/UI/Inputs/Primitives/inputs.js +0 -334
  202. package/src/UI/Inputs/Primitives/select.js +0 -15
  203. package/src/UI/Inputs/Primitives/textarea.js +0 -16
  204. package/src/UI/Inputs/camera.js +0 -23
  205. package/src/UI/Inputs/index.js +0 -20
  206. package/src/UI/List/elements.js +0 -0
  207. package/src/UI/List/index.js +0 -130
  208. package/src/UI/Media/Audio/index.js +0 -39
  209. package/src/UI/Media/Image/figure.js +0 -17
  210. package/src/UI/Media/Image/image.js +0 -34
  211. package/src/UI/Media/Image/index.js +0 -2
  212. package/src/UI/Media/Video/index.js +0 -50
  213. package/src/UI/Media/index.js +0 -3
  214. package/src/UI/Misc/index.js +0 -49
  215. package/src/UI/Semantic/index.js +0 -68
  216. package/src/UI/Style/index.js +0 -499
  217. package/src/UI/Table/elements.js +0 -94
  218. package/src/UI/Table/index.js +0 -3
  219. package/src/UI/Table/table.js +0 -113
  220. package/src/UI/Table/utils.js +0 -12
  221. package/src/UI/Text/heading.js +0 -35
  222. package/src/UI/Text/index.js +0 -3
  223. package/src/UI/Text/p.js +0 -37
  224. package/src/UI/Text/pre.js +0 -0
  225. package/src/UI/Text/text.js +0 -66
  226. package/src/UI/Utils/index.js +0 -70
  227. package/src/UI/ZikoUIElement.js +0 -501
  228. package/src/UI/index.js +0 -154
  229. package/src/__proto__/Array.js +0 -74
  230. package/src/__proto__/Function.js +0 -0
  231. package/src/__proto__/Number.js +0 -76
  232. package/src/__proto__/Object.js +0 -0
  233. package/src/__proto__/String.js +0 -0
  234. package/src/index.js +0 -70
@@ -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 }