ziko 0.33.0 → 0.34.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 (71) hide show
  1. package/dist/ziko.cjs +2440 -3447
  2. package/dist/ziko.js +8192 -9199
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +2423 -3424
  5. package/package.json +4 -6
  6. package/src/__helpers__/index.js +19 -18
  7. package/src/app/index.js +0 -3
  8. package/src/events/__Events__.js +18 -8
  9. package/src/events/pointer.js +1 -1
  10. package/src/index.js +9 -3
  11. package/src/math/functions/index.js +6 -9
  12. package/src/math/index.js +0 -7
  13. package/src/math/matrix/Matrix.js +1 -50
  14. package/src/math/matrix/index.js +1 -3
  15. package/src/math/signal/index.js +1 -110
  16. package/src/math/statistics/index.js +2 -2
  17. package/src/reactivity/events/index.js +8 -8
  18. package/src/reactivity/hooks/Head/useFavIcon.js +2 -2
  19. package/src/reactivity/hooks/Head/useTitle.js +1 -1
  20. package/src/reactivity/hooks/index.js +3 -3
  21. package/src/ui/elements/ZikoUIElement.js +34 -176
  22. package/src/ui/elements/semantic/index.js +33 -73
  23. package/src/ui/methods/events.js +39 -0
  24. package/src/use/decorators/index.js +2 -0
  25. package/src/use/decorators/use-debounce.js +4 -0
  26. package/src/use/decorators/use-throttle.js +9 -0
  27. package/src/use/index.js +3 -0
  28. package/src/use/interactions/index.js +3 -0
  29. package/src/{reactivity/hooks/Interactions/useChannel.js → use/interactions/use-channel.js} +8 -8
  30. package/src/{reactivity/hooks/Storage/useStorage.js → use/storage/index.js} +2 -2
  31. package/src/app/json-style-sheet.js +0 -64
  32. package/src/compose.js +0 -89
  33. package/src/math/calculus/derivation/index.js +0 -7
  34. package/src/math/calculus/index.js +0 -2
  35. package/src/math/calculus/special-functions/bessel.js +0 -31
  36. package/src/math/calculus/special-functions/beta.js +0 -38
  37. package/src/math/calculus/special-functions/gamma.js +0 -30
  38. package/src/math/calculus/special-functions/index.js +0 -4
  39. package/src/math/matrix/Decomposition.js +0 -90
  40. package/src/math/matrix/LinearSystem.js +0 -10
  41. package/src/math/signal/__np.py.txt +0 -40
  42. package/src/math/signal/conv.js +0 -175
  43. package/src/math/signal/fft.js +0 -55
  44. package/src/math/signal/filter.js +0 -39
  45. package/src/reactivity/events/Pointer.js +0 -232
  46. package/src/reactivity/events/click.js +0 -102
  47. package/src/reactivity/events/clipboard.js +0 -88
  48. package/src/reactivity/events/drag.js +0 -137
  49. package/src/reactivity/events/focus.js +0 -59
  50. package/src/reactivity/events/key.js +0 -102
  51. package/src/reactivity/events/wheel.js +0 -47
  52. package/src/reactivity/hooks/Decorators/index.js +0 -6
  53. package/src/reactivity/hooks/Decorators/time.js +0 -17
  54. package/src/reactivity/hooks/Decorators/type.js +0 -88
  55. package/src/reactivity/hooks/Interactions/_useBluetooth.js +0 -48
  56. package/src/reactivity/hooks/Interactions/index.js +0 -4
  57. package/src/reactivity/hooks/Sensors ( To Be Moved )/index.js +0 -2
  58. package/src/reactivity/hooks/Sensors ( To Be Moved )/useBattery.js +0 -36
  59. package/src/reactivity/hooks/Sensors ( To Be Moved )/useGeolocation.js +0 -17
  60. package/src/reactivity/hooks/Storage/index.js +0 -1
  61. package/src/reactivity/hooks/Storage/useCookie.js +0 -0
  62. package/src/reactivity/hooks/Storage/useIndexedDb.js +0 -0
  63. /package/src/events/{index.d.ts → index.d.ts.txt} +0 -0
  64. /package/src/math/statistics/{Functions → functions}/index.js +0 -0
  65. /package/src/{math/numeric → use/app}/index.js +0 -0
  66. /package/src/{reactivity/hooks/Interactions/useUsb.js → use/app/use-favicon.js} +0 -0
  67. /package/src/{reactivity/hooks/Sensors ( To Be Moved )/useCamera.js → use/app/use-link.js} +0 -0
  68. /package/src/{reactivity/hooks/Sensors ( To Be Moved )/useMicro.js → use/app/use-meta.js} +0 -0
  69. /package/src/{reactivity/hooks/Sensors ( To Be Moved )/useOrientation.js → use/app/use-title.js} +0 -0
  70. /package/src/{reactivity/hooks/Interactions/useEventEmmiter.js → use/interactions/use-event-emmiter.js} +0 -0
  71. /package/src/{reactivity/hooks/Interactions/useThread.js → use/interactions/use-thread.js} +0 -0
@@ -1,102 +0,0 @@
1
- import {ZikoEvent,EVENT_CONTROLLER} from "./ZikoEvent.js";
2
- function keydown_controller(e){
3
- EVENT_CONTROLLER.call(
4
- this,
5
- e,
6
- "down",
7
- ()=>this.kd=e.key,
8
- {key:e.key,t:10}
9
- )
10
- }
11
- function keypress_controller(e){
12
- EVENT_CONTROLLER.call(
13
- this,
14
- e,
15
- "press",
16
- ()=>this.kp=e.key,
17
- {key:e.key,t:10}
18
- )
19
- }
20
- function keyup_controller(e){
21
- EVENT_CONTROLLER.call(
22
- this,
23
- e,
24
- "up",
25
- ()=>this.ku=e.key,
26
- {key:e.key,t:10}
27
- )
28
- }
29
- class ZikoEventKey extends ZikoEvent{
30
- constructor(target){
31
- super(target)
32
- this.kp=null;
33
- this.kd=null;
34
- this.ku=null;
35
- this.t=0;
36
- this.cache={
37
- prefixe:"key",
38
- preventDefault:{
39
- down:false,
40
- press:false,
41
- up:false,
42
- },
43
- paused:{
44
- down:false,
45
- press:false,
46
- up:false,
47
- },
48
- stream:{
49
- enabled:{
50
- down:false,
51
- press:false,
52
- up:false,
53
- },
54
- clear:{
55
- down:true,
56
- press:false,
57
- up:false,
58
- },
59
- history:{
60
- down:[],
61
- press:[],
62
- up:[],
63
- }
64
- },
65
- callbacks:{
66
- down:[(self)=>console.log({kd:self.kd})],
67
- press:[(self)=>console.log({kp:self.kp})],
68
- up:[(self)=>console.log({ku:self.ku})]
69
- },
70
- successifKeysCallback:{
71
- down:[(self)=>console.log(1111)],
72
- press:[(self)=>console.log(1112)],
73
- kyup:[(self)=>console.log(1113)]
74
- }
75
- }
76
- this.__controller={
77
- down:keydown_controller.bind(this),
78
- press:keypress_controller.bind(this),
79
- up:keyup_controller.bind(this)
80
- }
81
- }
82
- onDown(...callbacks){
83
- this.__onEvent("down",{down:true},...callbacks)
84
- return this;
85
- }
86
- onPress(...callbacks){
87
- this.__onEvent("press",{press:true},...callbacks)
88
- return this;
89
- }
90
- onUp(...callbacks){
91
- this.__onEvent("up",{up:true},...callbacks)
92
- return this;
93
- }
94
-
95
- }
96
-
97
- var useKeyEvent=target=>new ZikoEventKey(target)
98
-
99
- export{
100
- useKeyEvent,
101
- ZikoEventKey
102
- }
@@ -1,47 +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 useWheelEvent=target=>new ZikoEventWheel(target);
44
- export{
45
- useWheelEvent,
46
- ZikoEventWheel
47
- }
@@ -1,6 +0,0 @@
1
- export { useType } from "./type";
2
-
3
- export {
4
- useThrottle,
5
- useDebounce
6
- } from "../../../time";
@@ -1,17 +0,0 @@
1
- const useDebounce=(fn,delay=1000)=>{
2
- let id;
3
- return(...args)=>id?clearTimeout(id):setTimeout(()=>fn(...args),delay)
4
- }
5
- const useThrottle=(fn,delay)=>{
6
- let lastTime=0;
7
- return (...args)=>{
8
- const now=new Date().getTime()
9
- if(now-lastTime<delay)return;
10
- lastTime=now;
11
- fn(...args);
12
- }
13
- }
14
- export{
15
- useDebounce,
16
- useThrottle
17
- }
@@ -1,88 +0,0 @@
1
- function useType(func, ...expectedTypes) {
2
- const argNames = func.toString()
3
- .match(/\(([^)]*)\)/)[1]
4
- .split(',')
5
- .map(arg => arg.trim());
6
- return function(...args) {
7
- const lastExpectedType = expectedTypes[expectedTypes.length - 1];
8
- for (let i = 0; i < args.length; i++) {
9
- const isRestParam = i >= expectedTypes.length;
10
- const expectedType = isRestParam ? lastExpectedType : expectedTypes[i];
11
- const arg = args[i];
12
- const argName = isRestParam ? `${argNames[argNames.length - 1]}[${i - expectedTypes.length + 1}]` : argNames[i] || `Argument ${i + 1}`;
13
- let isValid = false;
14
- if(typeof expectedType === "object"){
15
- if (expectedType.or) {
16
- for (const type of expectedType.types) {
17
- if (checkTypeOrInstance(type, arg)) {
18
- isValid = true;
19
- break;
20
- }
21
- }
22
- }
23
- if (expectedType.nor) {
24
- for (const type of expectedType.types) {
25
- if (checkTypeOrInstance(type, arg)) {
26
- isValid = false;
27
- break;
28
- }
29
- isValid = true
30
- }
31
- }
32
- else if (expectedType.not) isValid = !checkTypeOrInstance(expectedType.type, arg);
33
- }
34
- else isValid = checkTypeOrInstance(expectedType, arg);
35
- // Should Fix Nor error Message
36
- if (!isValid) {
37
- // const expectedTypeName = typeof expectedType === 'object'
38
- // ? expectedType.or
39
- // ? expectedType.types.map(type => (typeof type === 'string' ? type : type.name)).join(' or ')
40
- // : expectedType.not
41
- // ? `not ${typeof expectedType.type === 'string' ? expectedType.type : expectedType.type.name}`
42
- // : Array.isArray(expectedType)
43
- // ? `[${expectedType.map(type => (typeof type === 'string' ? type : type.name)).join(', ')}]`
44
- // : `{${Object.entries(expectedType).map(([key, type]) => `${key}: ${typeof type === 'string' ? type : type.name}`).join(', ')}}`
45
- // : typeof expectedType === 'string'
46
- // ? expectedType
47
- // : expectedType.name;
48
- // throw new TypeError(`${argName} should be of type ${expectedTypeName}`);
49
- throw new TypeError("jjj")
50
- }
51
- }
52
- return func(...args);
53
- };
54
- }
55
-
56
- function useOr(...types) {
57
- return { or: true, types };
58
- }
59
- function useNot(type) {
60
- return { not: true, type };
61
- }
62
- function useNor(...types){
63
- return { nor: true, types}
64
- }
65
- const checkTypeOrInstance = (type, arg) => {
66
- if (typeof type === 'string') return typeof arg === type;
67
- else if (type instanceof Function) return arg instanceof type;
68
- else if (Array.isArray(type))
69
- return (!Array.isArray(arg) || arg.length !== type.length)? false: arg.every((item, index) => checkTypeOrInstance(type[index], item));
70
- else if (typeof type === 'object' && !Array.isArray(type))
71
- return (typeof arg !== 'object' || arg === null)? false : Object.keys(type).every(key => key in arg && checkTypeOrInstance(type[key], arg[key]))
72
- return false;
73
- };
74
- // globalThis.useType = useType
75
- // globalThis.useNot = useNot
76
- // globalThis.useOr = useOr
77
-
78
- // function add(a, b = 0){
79
- // return a+b
80
- // }
81
-
82
- // add = useType(add,"number",useNor("string","number"))
83
-
84
- // console.log(add(1))
85
-
86
- export{
87
- useType
88
- }
@@ -1,48 +0,0 @@
1
- import { useEventEmitter } from "./useEventEmmiter.js";
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,4 +0,0 @@
1
- export * from "./useChannel";
2
- export * from "./useEventEmmiter";
3
- export * from "./useThread";
4
- // export * from "./useBluetooth";
@@ -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 }
@@ -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 }
@@ -1 +0,0 @@
1
- export * from "./useStorage";
File without changes
File without changes
File without changes
File without changes