ziko 0.37.0 → 0.38.0

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 (121) hide show
  1. package/dist/ziko.cjs +1160 -3365
  2. package/dist/ziko.js +6179 -8384
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +1153 -3251
  5. package/package.json +15 -13
  6. package/readme.md +79 -5
  7. package/src/__ziko__/__cache__.js +6 -0
  8. package/src/__ziko__/__config__.js +19 -0
  9. package/src/__ziko__/__hydration__.js +8 -0
  10. package/src/__ziko__/__ui__.js +22 -0
  11. package/src/__ziko__/index.js +16 -0
  12. package/src/__ziko__/params.js +40 -0
  13. package/src/app/globals.js +14 -0
  14. package/src/app/index.js +4 -4
  15. package/src/app/spa-file-based-routing.js +2 -2
  16. package/src/app/ziko-app.js +1 -1
  17. package/src/data/converter/svg.js +2 -2
  18. package/src/hooks/index.js +3 -0
  19. package/src/hooks/use-derived.js +61 -0
  20. package/src/hooks/use-reactive.js +7 -0
  21. package/src/hooks/use-state.js +47 -0
  22. package/src/index.js +1 -78
  23. package/src/math/complex/index.js +3 -0
  24. package/src/math/functions/index.js +23 -23
  25. package/src/math/functions/proxy.js +58 -0
  26. package/src/math/utils/mapfun.js +17 -21
  27. package/src/no-module.js +32 -0
  28. package/src/time/{animation.js → animation/index.js} +2 -2
  29. package/src/time/decorators/index.js +17 -0
  30. package/src/time/index.js +11 -12
  31. package/src/time/utils/index.js +0 -1
  32. package/src/ui/{methods → __methods__}/dom.js +15 -14
  33. package/src/ui/{utils → __utils__}/index.js +1 -1
  34. package/src/ui/constructors/{ziko-ui-element.js → ZikoUIElement.js} +9 -98
  35. package/src/ui/constructors/ZikoUIElementMethodesToBeMoved.js +96 -0
  36. package/src/ui/{style → constructors/style}/index.js +3 -3
  37. package/src/ui/{elements/flex → flex}/index.js +1 -1
  38. package/src/{graphics/canvas/index.js → ui/graphics/canvas.js} +4 -5
  39. package/src/ui/graphics/index.js +2 -0
  40. package/src/{graphics/svg/index.js → ui/graphics/svg.js} +1 -1
  41. package/src/ui/{elements/grid → grid}/index.js +1 -1
  42. package/src/ui/index.js +9 -40
  43. package/src/ui/{elements/misc/suspense.js → suspense/index.js} +1 -15
  44. package/src/ui/tags/index.js +3 -3
  45. package/src/ui/text/index.js +15 -0
  46. package/src/ui/{elements/misc/xml-wrapper.js → wrapper/index.js} +1 -1
  47. package/src/use/index.js +3 -7
  48. package/src/graphics/canvas/_canvas_offscreen +0 -0
  49. package/src/graphics/canvas/utils/color.js +0 -8
  50. package/src/graphics/canvas/utils/floodFill.js +0 -57
  51. package/src/graphics/index.js +0 -10
  52. package/src/time/utils/decorators.js +0 -17
  53. package/src/ui/elements/embaded/html.js +0 -20
  54. package/src/ui/elements/embaded/index.js +0 -3
  55. package/src/ui/elements/embaded/pdf.js +0 -17
  56. package/src/ui/elements/embaded/youtube.js +0 -24
  57. package/src/ui/elements/hydrate.js +0 -0
  58. package/src/ui/elements/index.js +0 -10
  59. package/src/ui/elements/io/Form/index.js +0 -42
  60. package/src/ui/elements/io/Form/index.js.txt +0 -104
  61. package/src/ui/elements/io/Inputs/__helpers__.js +0 -52
  62. package/src/ui/elements/io/Inputs/index.js +0 -12
  63. package/src/ui/elements/io/Inputs/input/index.js +0 -99
  64. package/src/ui/elements/io/Inputs/input-camera/index.js +0 -26
  65. package/src/ui/elements/io/Inputs/input-checkbox/index.js +0 -26
  66. package/src/ui/elements/io/Inputs/input-color/index.js +0 -16
  67. package/src/ui/elements/io/Inputs/input-date-time/index.js +0 -3
  68. package/src/ui/elements/io/Inputs/input-date-time/input-date-time.js +0 -14
  69. package/src/ui/elements/io/Inputs/input-date-time/input-date.js +0 -14
  70. package/src/ui/elements/io/Inputs/input-date-time/input-time.js +0 -14
  71. package/src/ui/elements/io/Inputs/input-email-password/index.js +0 -2
  72. package/src/ui/elements/io/Inputs/input-email-password/input-email.js +0 -15
  73. package/src/ui/elements/io/Inputs/input-email-password/input-password.js +0 -14
  74. package/src/ui/elements/io/Inputs/input-file/index.js +0 -1
  75. package/src/ui/elements/io/Inputs/input-file/input-file.js +0 -0
  76. package/src/ui/elements/io/Inputs/input-file/input-image.js +0 -43
  77. package/src/ui/elements/io/Inputs/input-number/index.js +0 -37
  78. package/src/ui/elements/io/Inputs/input-radio/index.js +0 -26
  79. package/src/ui/elements/io/Inputs/input-search/index.js +0 -45
  80. package/src/ui/elements/io/Inputs/input-slider/index.js +0 -34
  81. package/src/ui/elements/io/Select/index.js +0 -20
  82. package/src/ui/elements/io/Textarea/index.js +0 -18
  83. package/src/ui/elements/io/index.js +0 -4
  84. package/src/ui/elements/list/elements.js +0 -0
  85. package/src/ui/elements/list/index.js +0 -138
  86. package/src/ui/elements/media/Audio/index.js +0 -17
  87. package/src/ui/elements/media/Image/figure.js +0 -19
  88. package/src/ui/elements/media/Image/image.js +0 -37
  89. package/src/ui/elements/media/Image/index.js +0 -2
  90. package/src/ui/elements/media/Video/index.js +0 -27
  91. package/src/ui/elements/media/__ZikoUIDynamicMediaELement__.js +0 -47
  92. package/src/ui/elements/media/index.js +0 -3
  93. package/src/ui/elements/misc/hyperscript.js +0 -144
  94. package/src/ui/elements/misc/index.js +0 -101
  95. package/src/ui/elements/semantic/index.js +0 -42
  96. package/src/ui/elements/table/elements.js +0 -94
  97. package/src/ui/elements/table/index.js +0 -3
  98. package/src/ui/elements/table/table.js +0 -115
  99. package/src/ui/elements/table/utils.js +0 -12
  100. package/src/ui/elements/text/__ZikoUIText__.js +0 -70
  101. package/src/ui/elements/text/heading.js +0 -36
  102. package/src/ui/elements/text/index.js +0 -3
  103. package/src/ui/elements/text/p.js +0 -26
  104. package/src/ui/elements/text/pre.js +0 -0
  105. package/src/ui/elements/text/text.js +0 -81
  106. package/src/use/use-debounce.js +0 -4
  107. package/src/use/use-state.js +0 -22
  108. package/src/use/use-throttle.js +0 -9
  109. /package/src/reactivity/hooks/{Head → head}/_useCssText.js +0 -0
  110. /package/src/reactivity/hooks/{Head → head}/index.js +0 -0
  111. /package/src/reactivity/hooks/{Head → head}/useFavIcon.js +0 -0
  112. /package/src/reactivity/hooks/{Head → head}/useHead.js +0 -0
  113. /package/src/reactivity/hooks/{Head → head}/useMeta.js +0 -0
  114. /package/src/reactivity/hooks/{Head → head}/useTitle.js +0 -0
  115. /package/src/time/{loop.js → loop/index.js} +0 -0
  116. /package/src/ui/{methods → __methods__}/events.js +0 -0
  117. /package/src/ui/{methods → __methods__}/indexing.js +0 -0
  118. /package/src/ui/{methods → __methods__}/observer.js +0 -0
  119. /package/src/ui/{methods → __methods__}/style.js +0 -0
  120. /package/src/ui/constructors/{ziko-ui-node.js → ZikoUINode.js} +0 -0
  121. /package/src/ui/tags/{tags.js → tags-list.js} +0 -0
package/dist/ziko.mjs CHANGED
@@ -2,96 +2,15 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Fri Aug 15 2025 09:48:20 GMT+0100 (UTC+01:00)
5
+ Date : Fri Aug 15 2025 21:37:17 GMT+0100 (UTC+01:00)
6
6
  Git-Repo : https://github.com/zakarialaoui10/ziko.js
7
7
  Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
8
8
  Released under MIT License
9
9
  */
10
10
 
11
- function composeClass(Class, mixin) {
12
- const descriptors = Object.getOwnPropertyDescriptors(mixin);
13
-
14
- class Composed extends Class {
15
- constructor(...args) {
16
- super(...args);
17
- for (const key of Reflect.ownKeys(descriptors)) {
18
- const desc = descriptors[key];
19
-
20
- if (typeof desc.value === 'function') {
21
- this[key] = desc.value.bind(this);
22
- }
23
- }
24
- }
25
- }
26
-
27
- for (const key of Reflect.ownKeys(descriptors)) {
28
- const desc = descriptors[key];
29
-
30
- if ('get' in desc || 'set' in desc) {
31
- Object.defineProperty(Composed.prototype, key, desc);
32
- } else if (typeof desc.value !== 'function') {
33
- Object.defineProperty(Composed.prototype, key, desc);
34
- }
35
- }
36
-
37
- return Composed;
38
- }
39
-
40
- function composeInstance(instance, mixin) {
41
- const descriptors = Object.getOwnPropertyDescriptors(mixin);
42
-
43
- for (const key of Reflect.ownKeys(descriptors)) {
44
- const desc = descriptors[key];
45
-
46
- if ('get' in desc || 'set' in desc) {
47
- Object.defineProperty(instance, key, desc);
48
- } else if (typeof desc.value === 'function') {
49
- instance[key] = desc.value.bind(instance);
50
- } else {
51
- instance[key] = desc.value;
52
- }
53
- }
54
- }
55
-
56
- function compose(target, ...mixin) {
57
- if (typeof target === 'function') {
58
- return mixin.forEach(item =>composeClass(target, item));
59
- } else if (typeof target === 'object') {
60
- mixin.forEach(item =>composeInstance(target, item));
61
- } else {
62
- throw new TypeError("compose: target must be a class or instance");
63
- }
64
- }
65
-
66
- const __ExtractAll__ =(obj)=> {
67
- const keys = Object.keys(obj);
68
- for (let i = 0; i < keys.length; i++) {
69
- const key = keys[i];
70
- if (!["__ExtractAll__","__RemoveAll__","ExtractAll","RemoveAll"].includes(key)) {
71
- globalThis[key] = obj[key];
72
- }
73
- }
74
- };
75
- const __RemoveAll__ =(obj)=> {
76
- const keys = Object.keys(obj);
77
- for (let i = 0; i < keys.length; i++) {
78
- const key = keys[i];
79
- if (key !== '__RemoveAll__') {
80
- delete globalThis[key];
81
- }
82
- }
83
- };
84
-
85
11
  const { PI: PI$1, E } = Math;
86
12
  const EPSILON=Number.EPSILON;
87
13
 
88
- var __Const__ = /*#__PURE__*/Object.freeze({
89
- __proto__: null,
90
- E: E,
91
- EPSILON: EPSILON,
92
- PI: PI$1
93
- });
94
-
95
14
  const {PI, cos: cos$1, sin: sin$1, tan: tan$1, acos: acos$1, asin: asin$1, atan: atan$1, cosh: cosh$1, sinh: sinh$1, tanh: tanh$1, acosh: acosh$1, asinh: asinh$1, atanh: atanh$1, log} = Math;
96
15
  let Fixed={
97
16
  cos: cos$1,
@@ -125,35 +44,30 @@ Fixed = new Proxy(Fixed, {
125
44
 
126
45
  class ZikoMath {}
127
46
 
128
- /** @module Math */
129
- /**
130
- * map a function to ...X
131
- * @param {function} fun
132
- * @param {...any} X
133
- * @returns {any|any[]}
134
- */
47
+ // To generalise
48
+
135
49
  const mapfun$1=(fun,...X)=>{
136
50
  const Y=X.map(x=>{
137
- if(x===null)return fun(null);
138
- if(["number","string","boolean","bigint","undefined"].includes(typeof x))return fun(x);
139
- if(x instanceof Array)return x.map(n=>mapfun$1(fun,n));
140
- if(ArrayBuffer.isView(x))return x.map(n=>fun(n));
141
- if(x instanceof Set)return new Set(mapfun$1(fun,...[...x]));
142
- if(x instanceof Map)return new Map([...x].map(n=>[n[0],mapfun$1(fun,n[1])]));
51
+ if(x===null) return fun(null);
52
+ if(["number","string","boolean","bigint","undefined"].includes(typeof x)) return fun(x);
53
+ if(x instanceof Array) return x.map(n=>mapfun$1(fun,n));
54
+ if(ArrayBuffer.isView(x)) return x.map(n=>fun(n));
55
+ if(x instanceof Set) return new Set(mapfun$1(fun,...[...x]));
56
+ if(x instanceof Map) return new Map([...x].map(n=>[n[0],mapfun$1(fun,n[1])]));
143
57
  if(x instanceof Matrix){
144
- return new Matrix(x.rows,x.cols,mapfun$1(x.arr.flat(1)))
58
+ return new Matrix(x.rows,x.cols, mapfun$1(x.arr.flat(1)))
145
59
  }
146
60
  if(x instanceof Complex){
147
61
  const [a,b,z,phi]=[x.a,x.b,x.z,x.phi];
148
62
  switch(fun){
149
- case Math.log:return complex(ln(z),phi); // Done
150
- case Math.exp:return complex(e(a)*cos(b),e(a)*sin(b)); // Done
151
- case Math.abs:return z; // Done
152
- case Math.sqrt:return complex(sqrt(z)*cos(phi/2),sqrt(z)*sin(phi/2)); // Done
153
- case Fixed.cos:return complex(cos(a)*cosh(b),-(sin(a)*sinh(b)));
154
- case Fixed.sin:return complex(sin(a)*cosh(b),cos(a)*sinh(b));
63
+ case Math.log: return complex(ln(z),phi); // Done
64
+ case Math.exp: return complex(e(a)*cos(b),e(a)*sin(b)); // Done
65
+ case Math.abs: return z; // Done
66
+ case Math.sqrt: return complex(sqrt(z)*cos(phi/2),sqrt(z)*sin(phi/2)); // Done
67
+ case Fixed.cos: return complex(cos(a)*cosh(b),-(sin(a)*sinh(b)));
68
+ case Fixed.sin: return complex(sin(a)*cosh(b),cos(a)*sinh(b));
155
69
  case Fixed.tan:{
156
- const DEN=cos(2*a)+cosh(2*b);
70
+ const DEN = cos(2*a)+cosh(2*b);
157
71
  return complex(sin(2*a)/DEN,sinh(2*b)/DEN);
158
72
  }
159
73
  case Fixed.cosh:return complex(cosh(a)*cos(b),sinh(a)*sin(b));
@@ -166,7 +80,7 @@ const mapfun$1=(fun,...X)=>{
166
80
  }
167
81
  }
168
82
  else if(x instanceof Object){
169
- return fun(Object) || Object.fromEntries(Object.entries(x).map(n=>n=[n[0],mapfun$1(fun,n[1])]))
83
+ return Object.fromEntries(Object.entries(x).map(n=>n=[n[0],mapfun$1(fun,n[1])]))
170
84
  }
171
85
  });
172
86
  return Y.length==1?Y[0]:Y;
@@ -606,7 +520,7 @@ const ppcm = (n1, n2) => {
606
520
  } else console.log("error");
607
521
  };
608
522
 
609
- const Utils$1={
523
+ const Utils={
610
524
  add,
611
525
  sub,
612
526
  mul,
@@ -640,37 +554,6 @@ const Utils$1={
640
554
  isApproximatlyEqual
641
555
  };
642
556
 
643
- var __Utils__ = /*#__PURE__*/Object.freeze({
644
- __proto__: null,
645
- Utils: Utils$1,
646
- add: add,
647
- arange: arange,
648
- cartesianProduct: cartesianProduct,
649
- clamp: clamp,
650
- deg2rad: deg2rad,
651
- div: div,
652
- geomspace: geomspace,
653
- inRange: inRange,
654
- isApproximatlyEqual: isApproximatlyEqual,
655
- lerp: lerp,
656
- linspace: linspace,
657
- logspace: logspace,
658
- map: map,
659
- mapfun: mapfun$1,
660
- modulo: modulo,
661
- mul: mul,
662
- norm: norm,
663
- nums: nums,
664
- ones: ones,
665
- pgcd: pgcd,
666
- ppcm: ppcm,
667
- prod: prod,
668
- rad2deg: rad2deg,
669
- sub: sub,
670
- sum: sum,
671
- zeros: zeros
672
- });
673
-
674
557
  const powerSet=originalSet=>{
675
558
  const subSets = [];
676
559
  const NUMBER_OF_COMBINATIONS = 2 ** originalSet.length;
@@ -883,17 +766,6 @@ class Combinaison {
883
766
  }
884
767
  const combinaison=(comboOptions, comboLength, discount=false)=>Combinaison[discount?"withDiscount":"withoutDiscount"](comboOptions, comboLength);
885
768
 
886
- var __Discrect__ = /*#__PURE__*/Object.freeze({
887
- __proto__: null,
888
- Base: Base,
889
- Combinaison: Combinaison,
890
- Logic: Logic$1,
891
- Permutation: Permutation,
892
- combinaison: combinaison,
893
- powerSet: powerSet,
894
- subSet: subSet
895
- });
896
-
897
769
  class Random {
898
770
  static float(a = 1, b) {
899
771
  return b ? Math.random() * (b - a) + a : a * Math.random();
@@ -928,7 +800,7 @@ class Random {
928
800
  }
929
801
  static choice(choices = [1, 2, 3], p = new Array(choices.length).fill(1 / choices.length)) {
930
802
  let newchoice = new Array(100);
931
- p=Utils$1.accum(...p).map(n=>n*100);
803
+ p=Utils.accum(...p).map(n=>n*100);
932
804
  newchoice.fill(choices[0], 0, p[0]);
933
805
  for (let i = 1; i < choices.length; i++) newchoice.fill(choices[i], p[i - 1], p[i]);
934
806
  return newchoice[this.int(newchoice.length - 1)];
@@ -1062,11 +934,6 @@ class Random {
1062
934
  }
1063
935
  }
1064
936
 
1065
- var __Random__ = /*#__PURE__*/Object.freeze({
1066
- __proto__: null,
1067
- Random: Random
1068
- });
1069
-
1070
937
  const preload=(url)=>{
1071
938
  const xhr = new XMLHttpRequest();
1072
939
  xhr.open("GET", url, false);
@@ -1093,11 +960,6 @@ function fetchdomSync(url='https://github.com/zakarialaoui10'){
1093
960
  globalThis.fetchdom=fetchdom;
1094
961
  globalThis.fetchdomSync=fetchdomSync;
1095
962
 
1096
- var Api = /*#__PURE__*/Object.freeze({
1097
- __proto__: null,
1098
- preload: preload
1099
- });
1100
-
1101
963
  const csv2arr = (csv, delimiter = ",")=>csv.trim().trimEnd().split("\n").map(n=>n.split(delimiter));
1102
964
  const csv2matrix = (csv, delimiter = ",")=>new Matrix(csv2arr(csv,delimiter));
1103
965
  const csv2object = (csv, delimiter = ",") => {
@@ -1212,6 +1074,72 @@ class ZikoUINode {
1212
1074
 
1213
1075
  globalThis.node = (node) => new ZikoUINode(node);
1214
1076
 
1077
+ function composeClass(Class, mixin) {
1078
+ const descriptors = Object.getOwnPropertyDescriptors(mixin);
1079
+
1080
+ class Composed extends Class {
1081
+ constructor(...args) {
1082
+ super(...args);
1083
+ for (const key of Reflect.ownKeys(descriptors)) {
1084
+ const desc = descriptors[key];
1085
+
1086
+ if (typeof desc.value === 'function') {
1087
+ this[key] = desc.value.bind(this);
1088
+ }
1089
+ }
1090
+ }
1091
+ }
1092
+
1093
+ for (const key of Reflect.ownKeys(descriptors)) {
1094
+ const desc = descriptors[key];
1095
+
1096
+ if ('get' in desc || 'set' in desc) {
1097
+ Object.defineProperty(Composed.prototype, key, desc);
1098
+ } else if (typeof desc.value !== 'function') {
1099
+ Object.defineProperty(Composed.prototype, key, desc);
1100
+ }
1101
+ }
1102
+
1103
+ return Composed;
1104
+ }
1105
+
1106
+ function composeInstance(instance, mixin) {
1107
+ const descriptors = Object.getOwnPropertyDescriptors(mixin);
1108
+
1109
+ for (const key of Reflect.ownKeys(descriptors)) {
1110
+ const desc = descriptors[key];
1111
+
1112
+ if ('get' in desc || 'set' in desc) {
1113
+ Object.defineProperty(instance, key, desc);
1114
+ } else if (typeof desc.value === 'function') {
1115
+ instance[key] = desc.value.bind(instance);
1116
+ } else {
1117
+ instance[key] = desc.value;
1118
+ }
1119
+ }
1120
+ }
1121
+
1122
+ function compose(target, ...mixin) {
1123
+ if (typeof target === 'function') {
1124
+ return mixin.forEach(item =>composeClass(target, item));
1125
+ } else if (typeof target === 'object') {
1126
+ mixin.forEach(item =>composeInstance(target, item));
1127
+ } else {
1128
+ throw new TypeError("compose: target must be a class or instance");
1129
+ }
1130
+ }
1131
+
1132
+ class ZikoUIText extends ZikoUINode {
1133
+ constructor(...value) {
1134
+ super("span", "text", false, ...value);
1135
+ this.element = globalThis?.document?.createTextNode(...value);
1136
+ }
1137
+ isText(){
1138
+ return true
1139
+ }
1140
+ }
1141
+ const text = (...str) => new ZikoUIText(...str);
1142
+
1215
1143
  const DomMethods = {
1216
1144
  append(...ele) {
1217
1145
  __addItem__.call(this, "append", "push", ...ele);
@@ -1288,24 +1216,25 @@ function __addItem__(adder, pusher, ...ele) {
1288
1216
  }
1289
1217
  for (let i = 0; i < ele.length; i++) {
1290
1218
  if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
1291
- if (typeof globalThis?.Node === "function" && ele[i] instanceof globalThis?.Node) ele[i] = new this.constructor(ele[i]);
1292
- if (ele[i]?.isZikoUIElement) {
1293
- ele[i].cache.parent = this;
1294
- this.element[adder](ele[i].element);
1295
- ele[i].target = this.element;
1296
- this.items[pusher](ele[i]);
1297
- }
1298
- // Fix Items Latter
1299
- if( ele[i] instanceof Function){
1300
- const getter = ele[i]();
1219
+ // Fix Items Latter
1220
+ if (ele[i] instanceof Function) {
1221
+ const getter = ele[i]();
1301
1222
  if (getter.isStateGetter) {
1302
- const textNode = document?.createTextNode(getter.value);
1303
- this.element.appendChild(textNode);
1223
+ ele[i] = text(getter.value);
1304
1224
  getter._subscribe(
1305
- (newValue) => (textNode.textContent = newValue),
1225
+ (newValue) => (ele[i].element.textContent = newValue),
1226
+ ele[i]
1306
1227
  );
1228
+ // this.element.appendChild(textNode);
1307
1229
  }
1308
1230
  }
1231
+ if (typeof globalThis?.Node === "function" && ele[i] instanceof globalThis?.Node) ele[i] = new this.constructor(ele[i]);
1232
+ if (ele[i]?.isZikoUINode) {
1233
+ ele[i].cache.parent = this;
1234
+ this.element?.[adder](ele[i].element);
1235
+ ele[i].target = this.element;
1236
+ this.items[pusher](ele[i]);
1237
+ }
1309
1238
  else if (ele[i] instanceof Object) {
1310
1239
  if (ele[i]?.style) this.style(ele[i]?.style);
1311
1240
  if (ele[i]?.attr) {
@@ -1335,7 +1264,7 @@ const IndexingMethods = {
1335
1264
  },
1336
1265
  };
1337
1266
 
1338
- const Events$1 = {
1267
+ const Events = {
1339
1268
  'Click' : [
1340
1269
  'Click',
1341
1270
  'DblClick'
@@ -1556,7 +1485,7 @@ class __ZikoEvent__ {
1556
1485
 
1557
1486
  class ZikoEventClick extends __ZikoEvent__{
1558
1487
  constructor(target, customizer){
1559
- super(target, Events$1.Click, details_setter$a, customizer);
1488
+ super(target, Events.Click, details_setter$a, customizer);
1560
1489
  }
1561
1490
  }
1562
1491
  function details_setter$a(){
@@ -1568,7 +1497,7 @@ const bindClickEvent = (target, customizer) => new ZikoEventClick(target, custom
1568
1497
 
1569
1498
  class ZikoEventClipboard extends __ZikoEvent__{
1570
1499
  constructor(target, customizer){
1571
- super(target, Events$1.Clipboard, details_setter$9, customizer);
1500
+ super(target, Events.Clipboard, details_setter$9, customizer);
1572
1501
  }
1573
1502
  }
1574
1503
  function details_setter$9(){
@@ -1602,7 +1531,7 @@ const bindCustomEvent = (target, events, customizer) => new ZikoEventCustom(targ
1602
1531
 
1603
1532
  class ZikoEventDrag extends __ZikoEvent__{
1604
1533
  constructor(target, customizer){
1605
- super(target, Events$1.Drag, details_setter$7, customizer);
1534
+ super(target, Events.Drag, details_setter$7, customizer);
1606
1535
  }
1607
1536
  }
1608
1537
  function details_setter$7(){
@@ -1612,7 +1541,7 @@ const bindDragEvent = (target, customizer) => new ZikoEventDrag(target, customiz
1612
1541
 
1613
1542
  class ZikoEventFocus extends __ZikoEvent__{
1614
1543
  constructor(target, customizer){
1615
- super(target, Events$1.Focus, details_setter$6, customizer);
1544
+ super(target, Events.Focus, details_setter$6, customizer);
1616
1545
  }
1617
1546
  }
1618
1547
  function details_setter$6(){
@@ -1622,7 +1551,7 @@ const bindFocusEvent = (target, customizer) => new ZikoEventFocus(target, custom
1622
1551
 
1623
1552
  let ZikoEventHash$1 = class ZikoEventHash extends __ZikoEvent__{
1624
1553
  constructor(target, customizer){
1625
- super(target, Events$1.Hash, details_setter$5, customizer);
1554
+ super(target, Events.Hash, details_setter$5, customizer);
1626
1555
  }
1627
1556
  };
1628
1557
  function details_setter$5(){
@@ -1632,7 +1561,7 @@ const bindHashEvent = (target, customizer) => new ZikoEventHash$1(target, custom
1632
1561
 
1633
1562
  class ZikoEventKey extends __ZikoEvent__{
1634
1563
  constructor(target, customizer){
1635
- super(target, Events$1.Key, details_setter$4, customizer);
1564
+ super(target, Events.Key, details_setter$4, customizer);
1636
1565
  }
1637
1566
  }
1638
1567
  function details_setter$4(){
@@ -1653,7 +1582,7 @@ const bindKeyEvent = (target, customizer) => new ZikoEventKey(target, customizer
1653
1582
 
1654
1583
  class ZikoEventMouse extends __ZikoEvent__{
1655
1584
  constructor(target, customizer){
1656
- super(target, Events$1.Mouse, details_setter$3, customizer);
1585
+ super(target, Events.Mouse, details_setter$3, customizer);
1657
1586
  }
1658
1587
  }
1659
1588
  function details_setter$3(){
@@ -1663,7 +1592,7 @@ const bindMouseEvent = (target, customizer) => new ZikoEventMouse(target, custom
1663
1592
 
1664
1593
  class ZikoEventPointer extends __ZikoEvent__{
1665
1594
  constructor(target, customizer){
1666
- super(target, Events$1.Ptr, details_setter$2, customizer);
1595
+ super(target, Events.Ptr, details_setter$2, customizer);
1667
1596
  this.isDown = false;
1668
1597
  }
1669
1598
  }
@@ -1704,7 +1633,7 @@ const bindPointerEvent = (target, customizer) => new ZikoEventPointer(target, cu
1704
1633
 
1705
1634
  class ZikoEventTouch extends __ZikoEvent__{
1706
1635
  constructor(target, customizer){
1707
- super(target, Events$1.Touch, details_setter$1, customizer);
1636
+ super(target, Events.Touch, details_setter$1, customizer);
1708
1637
  }
1709
1638
  }
1710
1639
  function details_setter$1(){
@@ -1714,7 +1643,7 @@ const bindTouchEvent = (target, customizer) => new ZikoEventTouch(target, custom
1714
1643
 
1715
1644
  class ZikoEventWheel extends __ZikoEvent__{
1716
1645
  constructor(target, customizer){
1717
- super(target, Events$1.Wheel, details_setter, customizer);
1646
+ super(target, Events.Wheel, details_setter, customizer);
1718
1647
  }
1719
1648
  }
1720
1649
  function details_setter(){
@@ -1735,7 +1664,7 @@ const binderMap = {
1735
1664
 
1736
1665
  const EventsMethodes = {};
1737
1666
 
1738
- Object.entries(Events$1).forEach(([name, eventList]) => {
1667
+ Object.entries(Events).forEach(([name, eventList]) => {
1739
1668
  eventList.forEach(event => {
1740
1669
  const methodName = `on${event}`;
1741
1670
  EventsMethodes[methodName] = function (...callbacks) {
@@ -2717,27 +2646,6 @@ e=>{
2717
2646
  })
2718
2647
  */
2719
2648
 
2720
- // export * from "./click.js";
2721
- // export * from "./pointer.js";
2722
- // export * from "./mouse.js";
2723
- // export * from "./wheel.js";
2724
- // export * from "./key.js";
2725
- // export * from "./drag.js";
2726
- // export * from "./clipboard.js";
2727
- // export * from "./focus.js";
2728
-
2729
- var Events = /*#__PURE__*/Object.freeze({
2730
- __proto__: null,
2731
- ZikoCustomEvent: ZikoCustomEvent,
2732
- ZikoEventHash: ZikoEventHash,
2733
- ZikoEventInput: ZikoEventInput,
2734
- ZikoEventSwipe: ZikoEventSwipe,
2735
- useCustomEvent: useCustomEvent,
2736
- useHashEvent: useHashEvent,
2737
- useInputEvent: useInputEvent,
2738
- useSwipeEvent: useSwipeEvent
2739
- });
2740
-
2741
2649
  class ZikoMutationObserver {
2742
2650
  constructor(targetUIElement, options) {
2743
2651
  this.target = targetUIElement;
@@ -3030,17 +2938,6 @@ class ZikoScreenObserver {
3030
2938
 
3031
2939
  const watchScreen=(callback)=>new ZikoScreenObserver(callback);
3032
2940
 
3033
- var Observer = /*#__PURE__*/Object.freeze({
3034
- __proto__: null,
3035
- ZikoMutationObserver: ZikoMutationObserver,
3036
- watch: watch,
3037
- watchAttr: watchAttr,
3038
- watchChildren: watchChildren,
3039
- watchIntersection: watchIntersection,
3040
- watchScreen: watchScreen,
3041
- watchSize: watchSize
3042
- });
3043
-
3044
2941
  const useSuccesifKeys=(self,keys=[],callback=()=>{})=>{
3045
2942
  self.cache.stream.enabled.down=true;
3046
2943
  const length=keys.length;
@@ -3117,7 +3014,7 @@ class ZikoUseEventEmitter {
3117
3014
 
3118
3015
  const useEventEmitter=()=>new ZikoUseEventEmitter();
3119
3016
 
3120
- let ZikoUseFavIcon$1 = class ZikoUseFavIcon{
3017
+ class ZikoUseFavIcon{
3121
3018
  constructor(FavIcon,useEventEmitter=true){
3122
3019
  this.#init();
3123
3020
  this.cache={
@@ -3151,10 +3048,10 @@ let ZikoUseFavIcon$1 = class ZikoUseFavIcon{
3151
3048
  return this;
3152
3049
  }
3153
3050
 
3154
- };
3155
- const useFavIcon$1=(FavIcon,useEventEmitter)=>new ZikoUseFavIcon$1(FavIcon,useEventEmitter);
3051
+ }
3052
+ const useFavIcon=(FavIcon,useEventEmitter)=>new ZikoUseFavIcon(FavIcon,useEventEmitter);
3156
3053
 
3157
- let ZikoMeta$1 = class ZikoMeta{
3054
+ class ZikoMeta{
3158
3055
  constructor({viewport,charset,description,author,keywords}){
3159
3056
  this.document = globalThis?.document;
3160
3057
  this.meta={};
@@ -3202,10 +3099,10 @@ let ZikoMeta$1 = class ZikoMeta{
3202
3099
  this.set("author",author);
3203
3100
  return this;
3204
3101
  }
3205
- };
3206
- const useMeta$1=({viewport,charset,description,author,keywords})=>new ZikoMeta$1({viewport,charset,description,author,keywords});
3102
+ }
3103
+ const useMeta=({viewport,charset,description,author,keywords})=>new ZikoMeta({viewport,charset,description,author,keywords});
3207
3104
 
3208
- let ZikoUseTitle$1 = class ZikoUseTitle{
3105
+ class ZikoUseTitle{
3209
3106
  constructor(title=document.title,useEventEmitter=true){
3210
3107
  this.cache={
3211
3108
  Emitter:null
@@ -3231,19 +3128,19 @@ let ZikoUseTitle$1 = class ZikoUseTitle{
3231
3128
  if(this.cache.Emitter)this.cache.Emitter.on("ziko:title-changed",callback);
3232
3129
  return this;
3233
3130
  }
3234
- };
3235
- const useTitle$1=(title, useEventEmitter)=>new ZikoUseTitle$1(title, useEventEmitter);
3131
+ }
3132
+ const useTitle=(title, useEventEmitter)=>new ZikoUseTitle(title, useEventEmitter);
3236
3133
 
3237
3134
  // import {useLink} from "./";
3238
- let ZikoHead$1 = class ZikoHead{
3135
+ class ZikoHead{
3239
3136
  constructor({title,lang,icon,meta,noscript}){
3240
3137
  this.html = globalThis?.document?.documentElement;
3241
3138
  this.head = globalThis?.document?.head;
3242
3139
 
3243
- title && useTitle$1(title);
3140
+ title && useTitle(title);
3244
3141
  lang && this.setLang(lang);
3245
- icon && useFavIcon$1(icon);
3246
- meta && useMeta$1(meta);
3142
+ icon && useFavIcon(icon);
3143
+ meta && useMeta(meta);
3247
3144
  noscript && this.setNoScript();
3248
3145
  }
3249
3146
  setLang(lang){
@@ -3252,9 +3149,9 @@ let ZikoHead$1 = class ZikoHead{
3252
3149
  setNoScript(content){
3253
3150
 
3254
3151
  }
3255
- };
3152
+ }
3256
3153
 
3257
- const useHead$1=({ title, lang, icon, meta, noscript })=>new ZikoHead$1({ title, lang, icon, meta, noscript });
3154
+ const useHead=({ title, lang, icon, meta, noscript })=>new ZikoHead({ title, lang, icon, meta, noscript });
3258
3155
 
3259
3156
  /*
3260
3157
  [
@@ -3297,27 +3194,105 @@ class ZikoUseMediaQuery {
3297
3194
 
3298
3195
  const useMediaQuery = (mediaQueryRules,fallback) => new ZikoUseMediaQuery(mediaQueryRules,fallback);
3299
3196
 
3300
- // export * from "./window"
3197
+ function parseQueryParams$1(queryString) {
3198
+ const params = {};
3199
+ queryString.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi, (match) => {
3200
+ const [key, value] = match.split('=');
3201
+ params[key] = value;
3202
+ });
3203
+ return params;
3204
+ }
3205
+
3206
+ function defineParamsGetter$1(target ){
3207
+ Object.defineProperties(target, {
3208
+ 'QueryParams': {
3209
+ get: function() {
3210
+ return parseQueryParams$1(globalThis.location.search.substring(1));
3211
+ },
3212
+ configurable: false,
3213
+ enumerable: true
3214
+ },
3215
+ 'HashParams': {
3216
+ get: function() {
3217
+ const hash = globalThis.location.hash.substring(1);
3218
+ return hash.split("#");
3219
+ },
3220
+ configurable: false,
3221
+ enumerable: true
3222
+ }
3223
+ });
3224
+ }
3225
+
3226
+ const __UI__={
3227
+ __all__(){
3228
+ return Object.values(this)
3229
+ .filter(Array.isArray)
3230
+ .flat();
3231
+ },
3232
+ querySelectorAll(){
3233
+ return this.__all__().filter(n=>n)
3234
+ },
3235
+ getElementByIndex(index){
3236
+ return this.__all__().find(n=>n.ui_index===index);
3237
+ },
3238
+ getElementById(id){
3239
+ return null;
3240
+ },
3241
+ getElementsByClass(){
3242
+
3243
+ },
3244
+ getElementsByTagName(){
3245
+
3246
+ }
3247
+ };
3301
3248
 
3302
- var Hooks = /*#__PURE__*/Object.freeze({
3303
- __proto__: null,
3304
- ZikoHead: ZikoHead$1,
3305
- ZikoUseStyle: ZikoUseStyle,
3306
- useFavIcon: useFavIcon$1,
3307
- useHead: useHead$1,
3308
- useMediaQuery: useMediaQuery,
3309
- useMeta: useMeta$1,
3310
- useStyle: useStyle,
3311
- useSuccesifKeys: useSuccesifKeys,
3312
- useTitle: useTitle$1
3313
- });
3249
+ const __Config__ = {
3250
+ default:{
3251
+ target:null,
3252
+ render:true,
3253
+ math:{
3254
+ mode:"deg"
3255
+ }
3256
+ },
3257
+ setDefault:function(pairs){
3258
+ const keys=Object.keys(pairs);
3259
+ const values=Object.values(pairs);
3260
+ for(let i=0; i<keys.length; i++) this.default[keys[i]]=values[i];
3261
+ },
3262
+ init:()=>{
3263
+ // document.documentElement.setAttribute("data-engine","zikojs")
3264
+ },
3265
+ renderingMode :"spa",
3266
+ isSSC : false,
3267
+ };
3268
+
3269
+ const __HYDRATION__ = {
3270
+ map : new Map(),
3271
+ index : 0,
3272
+ increment : function(){
3273
+ return this.index ++
3274
+ }
3275
+ };
3276
+ const __HYDRATION_MAP__ = new Map();
3314
3277
 
3315
- const Reactivity={
3316
- ...Events,
3317
- ...Observer,
3318
- ...Hooks,
3278
+ const __CACHE__ = {
3279
+ ui_index : 0,
3280
+ get_ui_index:function(){
3281
+ return this.ui_index ++
3282
+ }
3319
3283
  };
3320
3284
 
3285
+ if ( !globalThis?.__Ziko__ ){
3286
+ globalThis.__Ziko__ = {
3287
+ __UI__,
3288
+ __HYDRATION__,
3289
+ __HYDRATION_MAP__,
3290
+ __Config__,
3291
+ __CACHE__,
3292
+ };
3293
+ defineParamsGetter$1(__Ziko__);
3294
+ }
3295
+
3321
3296
  class ZikoUIElement extends ZikoUINode{
3322
3297
  constructor(element, name="", {el_type="html", useDefaultStyle=false}={}){
3323
3298
  super();
@@ -3408,7 +3383,6 @@ class ZikoUIElement extends ZikoUINode{
3408
3383
  isInteractive(){
3409
3384
  return this.cache.isInteractive;
3410
3385
  }
3411
- // Remove get
3412
3386
  isZikoUIElement(){
3413
3387
  return true;
3414
3388
  }
@@ -3486,84 +3460,8 @@ class ZikoUIElement extends ZikoUINode{
3486
3460
  });
3487
3461
  }
3488
3462
  }
3489
- filter(condition_callback, if_callback = () => {}, else_callback = () => {}) {
3490
- const FilterItems = this.items.filter(condition_callback);
3491
- FilterItems.forEach(if_callback);
3492
- this.items
3493
- .filter((item) => !FilterItems.includes(item))
3494
- .forEach(else_callback);
3495
- return this;
3496
- }
3497
- filterByTextContent(text, exactMatch = false) {
3498
- this.items.forEach((n) => n.render());
3499
- this.filter(
3500
- (n) => !(exactMatch ? n.text === text : n.text.includes(text)),
3501
- (e) => e.unrender(),
3502
- );
3503
- // this.items.filter(n=>{
3504
- // const content=n.element.textContent;
3505
- // return !(exactMatch?content===text:content.includes(text))
3506
- // }).map(n=>n.unrender());
3507
- // return this;
3508
- }
3509
- filterByClass(value) {
3510
- this.items.map((n) => n.render());
3511
- this.items
3512
- .filter((n) => !n.classes.includes(value))
3513
- .map((n) => n.unrender());
3514
- return this;
3515
- }
3516
- sortByTextContent(value, displays) {
3517
- let item = this.children;
3518
- item
3519
- .filter((n) => !n.textContent.toLowerCase().includes(value.toLowerCase()))
3520
- .map((n) => {
3521
- n.style.display = "none";
3522
- });
3523
- item
3524
- .filter((n) => n.textContent.toLowerCase().includes(value.toLowerCase()))
3525
- .map((n, i) => (n.style.display = displays[i]));
3526
- //return item.filter(n=>n.style.display!="none")
3527
- item.filter((n) => n.style.display != "none");
3528
- return this;
3529
- }
3530
- get #SwitchedStyleRTL_LTR(){
3531
- const CalculedStyle = globalThis.getComputedStyle(this.element);
3532
- const SwitchedStyle = {};
3533
- if(CalculedStyle.marginRight!=="0px")Object.assign(SwitchedStyle, {marginLeft: CalculedStyle.marginRight});
3534
- if(CalculedStyle.marginLeft!=="0px")Object.assign(SwitchedStyle, {marginRight: CalculedStyle.marginLeft});
3535
- if(CalculedStyle.paddingRight!=="0px")Object.assign(SwitchedStyle, {paddingLeft: CalculedStyle.paddingRight});
3536
- if(CalculedStyle.paddingLeft!=="0px")Object.assign(SwitchedStyle, {paddingRight: CalculedStyle.paddingLeft});
3537
- if(CalculedStyle.left!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.left});
3538
- if(CalculedStyle.right!=="0px")Object.assign(SwitchedStyle, {left: CalculedStyle.right});
3539
- if(CalculedStyle.textAlign === "right")Object.assign(SwitchedStyle, {textAlign: "left"});
3540
- if(CalculedStyle.textAlign === "left")Object.assign(SwitchedStyle, {textAlign: "right"});
3541
- if(CalculedStyle.float === "right")Object.assign(SwitchedStyle, {float: "left"});
3542
- if(CalculedStyle.float === "left")Object.assign(SwitchedStyle, {float: "right"});
3543
- if(CalculedStyle.borderRadiusLeft!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.borderRadiusRight});
3544
- if(CalculedStyle.borderRadiusRight!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.borderRadiusLeft});
3545
- if(["flex","inline-flex"].includes(CalculedStyle.display)){
3546
- if(CalculedStyle.justifyContent === "flex-end")Object.assign(SwitchedStyle, {justifyContent: "flex-start"});
3547
- if(CalculedStyle.justifyContent === "flex-start")Object.assign(SwitchedStyle, {justifyContent: "flex-end"});
3548
- }
3549
- return SwitchedStyle;
3550
- }
3551
- useRtl(switchAll = false){
3552
- switchAll ? this.style({
3553
- ...this.#SwitchedStyleRTL_LTR,
3554
- direction : "rtl"
3555
- }) : this.style({direction : "rtl"});
3556
- return this;
3557
- }
3558
- useLtr(switchAll = false){
3559
- switchAll ? this.style({
3560
- ...this.#SwitchedStyleRTL_LTR,
3561
- direction : "ltr"
3562
- }) : this.style({direction : "ltr"});
3563
- return this;
3564
- }
3565
- freeze(freeze){
3566
- this.cache.isFrozzen=freeze;
3463
+ freeze(freeze){
3464
+ this.cache.isFrozzen=freeze;
3567
3465
  return this;
3568
3466
  }
3569
3467
  setTarget(tg) {
@@ -3583,9 +3481,9 @@ class ZikoUIElement extends ZikoUINode{
3583
3481
  }
3584
3482
  // Attributes
3585
3483
  #setAttr(name, value){
3586
- if(this.element.tagName !== "svg") name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
3484
+ if(this.element?.tagName !== "svg") name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
3587
3485
  if(this?.attr[name] && this?.attr[name]===value) return;
3588
- this.element.setAttribute(name, value);
3486
+ this.element?.setAttribute(name, value);
3589
3487
  Object.assign(this.cache.attributes, {[name]:value});
3590
3488
  }
3591
3489
  setAttr(name, value) {
@@ -3683,657 +3581,318 @@ class ZikoUIElement extends ZikoUINode{
3683
3581
  this.observer.intersection.start();
3684
3582
  return this;
3685
3583
  }
3686
- // setFullScreen(set = true, e) {
3687
- // if(!this.element.requestFullscreen){
3688
- // console.error("Fullscreen API is not supported in this browser.");
3689
- // return this;
3690
- // }
3691
- // if (set) this.element.requestFullscreen(e);
3692
- // else globalThis.document.exitFullscreen();
3693
- // return this;
3694
- // }
3695
- // toggleFullScreen(e) {
3696
- // if (!globalThis.document.fullscreenElement) this.element.requestFullscreen(e);
3697
- // else globalThis.document.exitFullscreen();
3698
- // return this;
3699
- // }
3584
+
3700
3585
  }
3701
3586
 
3702
- class __ZikoUIText__ extends ZikoUIElement {
3703
- constructor(tag, name, lineBreak,...value) {
3704
- super(tag, name);
3705
- this.addValue(...value);
3706
- this.style({margin:0,padding:0});
3707
- Object.assign(this.cache,{
3708
- lineBreak,
3709
- });
3710
- }
3711
- get isText(){
3712
- return true;
3713
- }
3714
- get value(){
3715
- return this.element.textContent;
3716
- }
3717
- clear() {
3718
- this.element.childNodes.forEach((e) => e.remove());
3719
- this.element.textContent = "";
3720
- return this;
3721
- }
3722
- addValue(...value) {
3723
- value.forEach((item,i) => {
3724
- if (typeof item === "string" || typeof item === "number") this.element?.appendChild(globalThis?.document.createTextNode(item));
3725
- else if (item instanceof ZikoUIElement) this.element?.appendChild(item.element);
3726
- else if (item instanceof Complex || item instanceof Matrix) this.element?.appendChild(new Text(item.toString()));
3727
- else if (item instanceof Array) this.element?.appendChild(new Text(arr2str(item)));
3728
- else if (item instanceof Object) this.element?.appendChild(new Text(obj2str(item)));
3729
-
3730
- // if(
3731
- // (item !== value[value.length - 1])
3732
- // && !(value[i+1] instanceof ZikoUIElement)
3733
- // && !(value[i-1] instanceof ZikoUIElement)
3734
- // ) this.element?.appendChild(new Text(" "))
3735
-
3736
- if(this.cache.lineBreak)this.element?.appendChild(globalThis.document?.createElement("br"));
3737
- });
3738
- // if(this.element?.innerHTML){
3739
- // this.element.innerHTML = this.element.innerHTML.replace(/\n/g, '<br>').replace(/(?<!<[^>]+) /g, '&nbsp;');
3740
- // }
3741
- return this
3587
+ const HTMLTags = [
3588
+ 'a',
3589
+ 'abb',
3590
+ 'address',
3591
+ 'area',
3592
+ 'article',
3593
+ 'aside',
3594
+ 'audio',
3595
+ 'b',
3596
+ 'base',
3597
+ 'bdi',
3598
+ 'bdo',
3599
+ 'blockquote',
3600
+ 'br',
3601
+ 'button',
3602
+ 'canvas',
3603
+ 'caption',
3604
+ 'cite',
3605
+ 'code',
3606
+ 'col',
3607
+ 'colgroup',
3608
+ 'data',
3609
+ 'datalist',
3610
+ 'dd',
3611
+ 'del',
3612
+ 'details',
3613
+ 'dfn',
3614
+ 'dialog',
3615
+ 'div',
3616
+ 'dl',
3617
+ 'dt',
3618
+ 'em',
3619
+ 'embed',
3620
+ 'fieldset',
3621
+ 'figcaption',
3622
+ 'figure',
3623
+ 'footer',
3624
+ 'form',
3625
+ 'h1',
3626
+ 'h2',
3627
+ 'h3',
3628
+ 'h4',
3629
+ 'h5',
3630
+ 'h6',
3631
+ 'header',
3632
+ 'hgroup',
3633
+ 'hr',
3634
+ 'i',
3635
+ 'iframe',
3636
+ 'img',
3637
+ 'ipnut',
3638
+ 'ins',
3639
+ 'kbd',
3640
+ 'label',
3641
+ 'legend',
3642
+ 'li',
3643
+ 'main',
3644
+ 'map',
3645
+ 'mark',
3646
+ 'menu',
3647
+ 'meter',
3648
+ 'nav',
3649
+ 'object',
3650
+ 'ol',
3651
+ 'optgroup',
3652
+ 'option',
3653
+ 'output',
3654
+ 'p',
3655
+ 'param',
3656
+ 'picture',
3657
+ 'pre',
3658
+ 'progress',
3659
+ 'q',
3660
+ 'rp',
3661
+ 'rt',
3662
+ 'ruby',
3663
+ 's',
3664
+ 'samp',
3665
+ 'search',
3666
+ 'section',
3667
+ 'select',
3668
+ 'small',
3669
+ 'source',
3670
+ 'span',
3671
+ 'strong',
3672
+ 'sub',
3673
+ 'summary',
3674
+ 'sup',
3675
+ 'svg',
3676
+ 'table',
3677
+ 'tbody',
3678
+ 'td',
3679
+ 'template',
3680
+ 'textarea',
3681
+ 'tfoot',
3682
+ 'th',
3683
+ 'thead',
3684
+ 'time',
3685
+ 'title',
3686
+ 'tr',
3687
+ 'track',
3688
+ 'u',
3689
+ 'ul',
3690
+ 'var',
3691
+ 'video',
3692
+ 'wbr'
3693
+ ];
3694
+
3695
+ const SVGTags = [
3696
+ "svg", "g", "defs", "symbol", "use", "image", "switch",
3697
+ "rect", "circle", "ellipse", "line", "polyline", "polygon", "path",
3698
+ "text", "tspan", "textPath", "altGlyph", "altGlyphDef", "altGlyphItem", "glyph", "glyphRef",
3699
+ "linearGradient", "radialGradient", "pattern", "solidColor",
3700
+ "filter", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix",
3701
+ "feDiffuseLighting", "feDisplacementMap", "feDropShadow", "feFlood", "feFuncA", "feFuncR", "feFuncG", "feFuncB",
3702
+ "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "feSpecularLighting",
3703
+ "feTile", "feTurbulence",
3704
+ "animate", "animateMotion", "animateTransform", "set",
3705
+ "script",
3706
+ "desc", "title", "metadata", "foreignObject"
3707
+ ];
3708
+
3709
+ const tags = new Proxy({}, {
3710
+ get(target, prop) {
3711
+ if (typeof prop !== 'string') return undefined;
3712
+ let tag = prop.replaceAll("_","-").toLowerCase();
3713
+ if(HTMLTags.includes(tag)) return (...args)=>{
3714
+ if(!(args[0] instanceof ZikoUIElement) && args[0] instanceof Object){
3715
+ let attributes = args.shift();
3716
+ // console.log(args)
3717
+ return new ZikoUIElement(tag).setAttr(attributes).append(...args)
3718
+ }
3719
+ return new ZikoUIElement(tag).append(...args);
3742
3720
  }
3743
- setValue(...value) {
3744
- this.clear();
3745
- this.addValue(...value);
3746
- return this;
3721
+ if(SVGTags.includes(tag)) return (...args)=>new ZikoUIElement(tag,"",{el_type : "svg"}).append(...args);
3722
+ return (...args)=>{
3723
+ if(!(args[0] instanceof ZikoUIElement) && args[0] instanceof Object){
3724
+ let attributes = args.shift();
3725
+ return new ZikoUIElement(tag).setAttr(attributes).append(...args)
3726
+ }
3727
+ return new ZikoUIElement(tag).append(...args);
3747
3728
  }
3748
- }
3729
+ // switch(tag){
3730
+ // case "html" : globalThis?.document?.createElement("html")
3731
+ // case "head" :
3732
+ // case "style" :
3733
+ // case "link" :
3734
+ // case "meta" :
3735
+ // case "srcipt":
3736
+ // case "body" : return null; break;
3737
+ // default : return new ZikoUIElement(tag);
3738
+ // }
3739
+ }
3740
+ });
3749
3741
 
3750
- class ZikoUIText extends __ZikoUIText__ {
3751
- constructor(...value) {
3752
- super("span", "text", false, ...value);
3753
- }
3754
- }
3755
- class ZikoUIQuote extends __ZikoUIText__ {
3756
- constructor(...value) {
3757
- super("q", "quote", false, ...value);
3758
- this.style({
3759
- fontStyle: "italic"
3760
- });
3742
+ class ZikoUIFlex extends ZikoUIElement {
3743
+ constructor(tag = "div", w = "100%", h = "100%") {
3744
+ super(tag ,"Flex");
3745
+ this.direction = "cols";
3746
+ if (typeof w == "number") w += "%";
3747
+ if (typeof h == "number") h += "%";
3748
+ this.style({ width: w, height: h });
3749
+ this.style({ display: "flex" });
3750
+ // this.render();
3761
3751
  }
3762
- get isQuote(){
3763
- return true
3752
+ get isFlex(){
3753
+ return true;
3764
3754
  }
3765
- }
3766
- class ZikoUIDefintion extends __ZikoUIText__ {
3767
- constructor(...value) {
3768
- super("dfn", "dfnText", false, ...value);
3755
+ resp(px,wrap = true) {
3756
+ this.wrap(wrap);
3757
+ if (this.element.clientWidth < px) this.vertical();
3758
+ else this.horizontal();
3759
+ return this;
3769
3760
  }
3770
- get isDfnText(){
3771
- return true
3761
+ setSpaceAround() {
3762
+ this.style({ justifyContent: "space-around" });
3763
+ return this;
3772
3764
  }
3773
- }
3774
- class ZikoUISupText extends __ZikoUIText__ {
3775
- constructor(sup) {
3776
- super("sup", "supText", false, sup);
3765
+ setSpaceBetween() {
3766
+ this.style({ justifyContent: "space-between" });
3767
+ return this;
3777
3768
  }
3778
- get isSupText(){
3779
- return true
3769
+ setBaseline() {
3770
+ this.style({ alignItems: "baseline" });
3771
+ return this;
3780
3772
  }
3781
- }
3782
- class ZikoUISubText extends __ZikoUIText__ {
3783
- constructor(...value) {
3784
- super("sub", "subText", false, ...value);
3773
+ gap(g) {
3774
+ if (this.direction === "row") this.style({ columnGap: g });
3775
+ else if (this.direction === "column") this.style({ rowGap: g });
3776
+ return this;
3785
3777
  }
3786
- get isSubText(){
3787
- return true
3778
+ wrap(value = "wrap") {
3779
+ const values = ["no-wrap", "wrap","wrap-reverse"];
3780
+ this.style({
3781
+ flexWrap: typeof value === "string" ? value : values[+value],
3782
+ });
3783
+ return this;
3788
3784
  }
3789
- }
3790
- class ZikoUICodeText extends __ZikoUIText__ {
3791
- constructor(...value) {
3792
- super("code", "codeText", false, ...value);
3785
+ _justifyContent(align = "center") {
3786
+ this.style({ justifyContent: align });
3787
+ return this;
3793
3788
  }
3794
- get isCodeText(){
3795
- return true
3789
+ vertical(x, y, order=1) {
3790
+ set_vertical.call(this,order);
3791
+ this.style({
3792
+ alignItems: typeof(x)==="number"?map_pos_x.call(this,x):x,
3793
+ justifyContent: typeof(y)=="number"?map_pos_y.call(this,y):y
3794
+ });
3795
+ return this;
3796
3796
  }
3797
- }
3798
- class ZikoUIAbbrText extends __ZikoUIText__ {
3799
- constructor(abbr, title) {
3800
- super("abbr", "abbrText", false, abbr);
3801
- this.setAttr("title", title);
3797
+ horizontal(x, y, order=1) {
3798
+ set_horizontal.call(this,order);
3799
+ this.style({
3800
+ alignItems: typeof(y)=="number"?map_pos_y.call(this,y):y,
3801
+ justifyContent: typeof(x)==="number"?map_pos_x.call(this,x):x
3802
+ });
3803
+ return this;
3802
3804
  }
3803
- get isAbbrText(){
3804
- return true
3805
- }
3806
- }
3807
- const text = (...str) => new ZikoUIText(...str);
3808
- const quote = (...str) => new ZikoUIQuote(...str);
3809
- const dfnText = (...str) => new ZikoUIDefintion(...str);
3810
- const supText = (...str) => new ZikoUISupText(...str);
3811
- const subText = (...str) => new ZikoUISubText(...str);
3812
- const codeText = (...str) => new ZikoUICodeText(...str);
3813
- const abbrText = (abbr, title) => new ZikoUIAbbrText(abbr, title);
3814
-
3815
- class ZikoUIParagraphe extends __ZikoUIText__ {
3816
- constructor(...value) {
3817
- super("p", "p", true, ...value);
3818
- }
3819
- get isPara(){
3820
- return true;
3821
- }
3822
- }
3823
- class ZikoUIBlockQuote extends __ZikoUIText__ {
3824
- constructor(cite,quote) {
3825
- super("blockquote", "blockquote", true, quote);
3826
- this.setAttr("cite", cite);
3827
- }
3828
- get isBlockQuote(){
3829
- return true;
3830
- }
3831
- }
3832
- const p = (...ZikoUIElement) => new ZikoUIParagraphe(...ZikoUIElement);
3833
- const blockQuote = (cite, quote) => new ZikoUIBlockQuote(cite, quote);
3834
-
3835
- class ZikoUIHeading extends ZikoUIElement {
3836
- constructor(type = 1, value = "") {
3837
- super(`h${type}`,`h${type}`);
3838
- this.element.textContent = value;
3839
- }
3840
- get isHeading(){
3841
- return true;
3842
- }
3843
- get value() {
3844
- return this.element.innerText;
3845
- }
3846
- setValue(text = "") {
3847
- this.element.innerText = text;
3848
- return;
3849
- }
3850
- addValue(text = "") {
3851
- this.element.innerText += text;
3852
- return this;
3853
- }
3854
- }
3855
- const h1=(text="")=>new ZikoUIHeading(1, text);
3856
- const h2=(text="")=>new ZikoUIHeading(2, text);
3857
- const h3=(text="")=>new ZikoUIHeading(3, text);
3858
- const h4=(text="")=>new ZikoUIHeading(4, text);
3859
- const h5=(text="")=>new ZikoUIHeading(5, text);
3860
- const h6=(text="")=>new ZikoUIHeading(6, text);
3861
-
3862
- var Text$1 = /*#__PURE__*/Object.freeze({
3863
- __proto__: null,
3864
- ZikoUIAbbrText: ZikoUIAbbrText,
3865
- ZikoUIBlockQuote: ZikoUIBlockQuote,
3866
- ZikoUICodeText: ZikoUICodeText,
3867
- ZikoUIDefintion: ZikoUIDefintion,
3868
- ZikoUIHeading: ZikoUIHeading,
3869
- ZikoUIParagraphe: ZikoUIParagraphe,
3870
- ZikoUIQuote: ZikoUIQuote,
3871
- ZikoUISubText: ZikoUISubText,
3872
- ZikoUISupText: ZikoUISupText,
3873
- ZikoUIText: ZikoUIText,
3874
- abbrText: abbrText,
3875
- blockQuote: blockQuote,
3876
- codeText: codeText,
3877
- dfnText: dfnText,
3878
- h1: h1,
3879
- h2: h2,
3880
- h3: h3,
3881
- h4: h4,
3882
- h5: h5,
3883
- h6: h6,
3884
- p: p,
3885
- quote: quote,
3886
- subText: subText,
3887
- supText: supText,
3888
- text: text
3889
- });
3890
-
3891
- class ZikoUILI extends ZikoUIElement{
3892
- constructor(UI){
3893
- super("li","li");
3894
- this.append(UI);
3895
- }
3896
- get isLi(){
3897
- return true;
3898
- }
3899
- }
3900
- class ZikoUIList extends ZikoUIElement {
3901
- constructor(element,name) {
3902
- super(element,name);
3903
- delete this.append;
3904
- this.style({ listStylePosition: "inside" });
3905
- }
3906
- get isList(){
3907
- return true;
3908
- }
3909
- append(...arr){
3910
- for (let i = 0; i < arr.length; i++) {
3911
- let li = null;
3912
- if(["string","number"].includes(typeof arr[i]))arr[i]=text(arr[i]);
3913
- if (arr[i] instanceof ZikoUIElement)li=new ZikoUILI(arr[i]);
3914
- li.setTarget(this.element);
3915
- this.items.push(li[0]);
3916
- this.maintain();
3917
- }
3918
- }
3919
- remove(...ele) {
3920
- if(ele.length==0){
3921
- if(this.target.children.length) this.target.removeChild(this.element);
3922
- }
3923
- else {
3924
- const remove = (ele) => {
3925
- if(typeof ele === "number") ele=this.items[ele];
3926
- if(ele instanceof ZikoUIElement)this.element?.removeChild(ele.parent.element);
3927
- this.items=this.items.filter(n=>n!==ele);
3928
- };
3929
- for (let i = 0; i < ele.length; i++) remove(ele[i]);
3930
- for (let i = 0; i < this.items.length; i++)
3931
- Object.assign(this, { [[i]]: this.items[i] });
3932
- }
3933
- return this;
3934
- }
3935
- insertAt(index, ...ele) {
3936
- if (index >= this.element.children.length) this.append(...ele);
3937
- else
3938
- for (let i = 0; i < ele.length; i++) {
3939
- let li = null;
3940
- if(["number","string"].includes(typeof ele[i]))ele[i]=text(ele[i]);
3941
- if (ele[i] instanceof ZikoUIElement)li=new ZikoUILI(ele[i]);
3942
- this.element?.insertBefore(li.element, this.items[index].parent.element);
3943
- this.items.splice(index, 0, ele[i][0]);
3944
- }
3945
- return this;
3946
- }
3947
- filterByTextContent(text,exactMatch=false){
3948
- this.items.map(n=>n.parent.render());
3949
- this.items.filter(n=>{
3950
- const content=n.element.textContent;
3951
- return !(exactMatch?content===text:content.includes(text))
3952
- }).map(n=>n.parent.render(false));
3953
- return this;
3954
- }
3955
- sortByTextContent(order=1){
3956
- this.items.map(n=>n.parent.render(false));
3957
- // To Fix
3958
- this.sortedItems=this.items.sort((a,b)=>order*a.element.textContent.localeCompare(b.element.textContent));
3959
- this.append(...this.sortedItems);
3960
- return this;
3961
- }
3962
- filterByClass(value) {
3963
- this.items.map(n=>n.parent.render(true));
3964
- this.items.filter(n=>!n.Classes.includes(value)).map(n=>n.parent.render(false));
3965
- return this;
3966
- }
3967
- delete(value) {
3968
- const valueIndex = [...this.element.children].indexOf(value);
3969
- return valueIndex;
3970
- /*if(valueIndex >= 0) {
3971
- return this.list.splice(valueIndex, 1);
3972
- }*/
3973
- }
3974
- push(){
3975
-
3976
- }
3977
- pop(){
3978
-
3979
- }
3980
- unshift(){
3981
-
3982
- }
3983
- shift(){
3984
-
3985
- }
3986
- sort(){
3987
-
3988
- }
3989
- filter(){
3990
-
3991
- }
3992
- slice(){
3993
-
3994
- }
3995
- }
3996
- class ZikoUIOList extends ZikoUIList{
3997
- constructor(...arr){
3998
- super("ol","ol");
3999
- this.append(...arr);
4000
- }
4001
- get isOl(){
4002
- return true;
4003
- }
4004
- type(tp = 1) {
4005
- this.element?.setAttribute("type", tp);
4006
- return this;
4007
- }
4008
- start(st = 1) {
4009
- this.element?.setAttribute("start", st);
4010
- return this;
4011
- }
4012
- }
4013
- class ZikoUIUList extends ZikoUIList{
4014
- constructor(...arr){
4015
- super("ul","ul");
4016
- this.append(...arr);
4017
- }
4018
- get isUl(){
4019
- return true;
4020
- }
4021
- }
4022
- const li=UI=>new ZikoUILI(UI);
4023
- const ol = (...arr) => new ZikoUIOList(...arr);
4024
- const ul = (...arr) => new ZikoUIUList(...arr);
4025
-
4026
- var List = /*#__PURE__*/Object.freeze({
4027
- __proto__: null,
4028
- li: li,
4029
- ol: ol,
4030
- ul: ul
4031
- });
4032
-
4033
- class ZikoUIInput extends ZikoUIElement {
4034
- constructor(type, name , value = "", datalist) {
4035
- super("input", "input");
4036
- Object.assign(this.events, { input: null });
4037
- this.setValue(value);
4038
- this.setAttr("type", type);
4039
- this.setAttr("name", name);
4040
- // this.setAttr("tab-index","0")
4041
- if (datalist) this.linkDatalist(datalist);
4042
- }
4043
- get isInput() {
4044
- return true;
4045
- }
4046
- setName(name){
4047
- this.setAttr("name", name);
4048
- return this;
4049
- }
4050
- onInput(...callbacks) {
4051
- if (!this.events.input) this.events.input = useInputEvent(this);
4052
- this.events.input.onInput(...callbacks);
4053
- return this;
4054
- }
4055
- onChange(...callbacks) {
4056
- if (!this.events.input) this.events.input = useInputEvent(this);
4057
- this.events.input.onChange(...callbacks);
4058
- return this;
4059
- }
4060
- linkDatalist(datalist) {
4061
- let id;
4062
- if (datalist instanceof ZikoUIInputDatalist) id = datalist.Id;
4063
- else if (datalist instanceof Array) {
4064
- const Datalist = new ZikoUIInputDatalist(...datalist);
4065
- id = Datalist.Id;
4066
- console.log(Datalist);
4067
- } else id = datalist;
4068
- this.element?.setAttribute("list", id);
4069
- return this;
4070
- }
4071
- get value() {
4072
- return this.element.value;
4073
- }
4074
- // _setType(type) {
4075
- // this.element.type = type;
4076
- // return this;
4077
- // }
4078
- setValue(value = "") {
4079
- this.element.value = value;
4080
- return this;
4081
- }
4082
- useState(state) {
4083
- this.setValue(state);
4084
- return [{ value: this.value }, (e) => this.setValue(e)];
4085
- }
4086
- setPlaceholder(value) {
4087
- if (value) this.element.placeholder = value;
4088
- return this;
4089
- }
4090
- get isValide() {
4091
- return this.element.checkValidity();
4092
- }
4093
- setRequired(required = true) {
4094
- this.element.required = required;
4095
- return this;
4096
- }
4097
- select() {
4098
- this.element.select();
4099
- return this;
4100
- }
4101
- copy() {
4102
- this.element.select();
4103
- document.execCommand("copy");
4104
- return this;
4105
- }
4106
- cut() {
4107
- this.element.select();
4108
- document.execCommand("cut");
4109
- return this;
4110
- }
4111
- accept(value) {
4112
- this.element.accept = value;
4113
- return this;
3805
+ show() {
3806
+ this.isHidden = false;
3807
+ this.style({ display: "flex" });
3808
+ return this;
4114
3809
  }
4115
3810
  }
4116
3811
 
4117
- const input = (value, datalist) => {
4118
- if (value instanceof Object) {
4119
- const { datalist, placeholder } = value;
4120
- value = value.value ?? "";
4121
- return new ZikoUIInput("text", "input", value, datalist).setPlaceholder(placeholder);
4122
- }
4123
- return new ZikoUIInput("text", "input", value, datalist);
4124
- };
4125
-
4126
- class ZikoUIInputNumber extends ZikoUIInput {
4127
- constructor(min, max, step = 1) {
4128
- super("number", "inpuNumber");
4129
- this.setMin(min).setMax(max).setStep(step);
4130
- }
4131
- get isInputNumber() {
4132
- return true;
4133
- }
4134
- get value() {
4135
- return +this.element.value;
4136
- }
4137
- setMin(min) {
4138
- this.element.min = min;
4139
- return this;
4140
- }
4141
- setMax(max) {
4142
- this.element.max = max;
4143
- return this;
4144
- }
4145
- setStep(step) {
4146
- this.element.step = step;
4147
- return this;
4148
- }
3812
+ const Flex = (...ZikoUIElement) =>{
3813
+ let tag="div";
3814
+ if(typeof ZikoUIElement[0]==="string"){
3815
+ tag=ZikoUIElement[0];
3816
+ ZikoUIElement.pop();
4149
3817
  }
4150
- const inputNumber = (min, max, step) => {
4151
- if (min instanceof Object) {
4152
- const { value, max = 10, step = 1, placeholder = "" } = min;
4153
- min = min?.min ?? 0;
4154
- return new ZikoUIInputSlider(min, max, step)
4155
- .setValue(value)
4156
- .setPlaceholder(placeholder);
4157
- }
4158
- return new ZikoUIInputNumber(min, max, step);
4159
- };
4160
-
4161
- let ZikoUIInputSlider$1 = class ZikoUIInputSlider extends ZikoUIInput {
4162
- constructor(val = 0, min = 0, max = 10, step = 1) {
4163
- super("range", "inputSlider");
4164
- this.setMin(min).setMax(max).setValue(val).setStep(step);
4165
- }
4166
- get isInputSlider(){
4167
- return true;
4168
- }
4169
- setMin(min) {
4170
- this.element.min = min;
4171
- return this;
4172
- }
4173
- setMax(max) {
4174
- this.element.max = max;
4175
- return this;
4176
- }
4177
- setStep(step) {
4178
- this.element.step = step;
4179
- return this;
4180
- }
3818
+ return new ZikoUIFlex(tag).append(...ZikoUIElement);
4181
3819
  };
4182
- const slider = (value, min, max, step) =>{
4183
- if(value instanceof Object){
4184
- const {min=0,max=10,step=1}=value;
4185
- value=value?.value??5;
4186
- return new ZikoUIInputSlider$1(value, min, max, step);
4187
- }
4188
- return new ZikoUIInputSlider$1(value, min, max, step);
4189
- };
4190
-
4191
- class ZikoUIInputColor extends ZikoUIInput {
4192
- constructor() {
4193
- super("color", "inputColor");
4194
- this.background(this.value);
4195
- this.onInput(() => this.background(this.value));
4196
- }
4197
- get isInputColor(){
4198
- return true;
4199
- }
4200
- }
4201
- const inputColor = () => new ZikoUIInputColor();
4202
-
4203
- class ZikoUIInputSearch extends ZikoUIInput {
4204
- constructor() {
4205
- super("search", "inputSearch");
4206
- this.Length = 0;
4207
- }
4208
- get isInputSearch() {
4209
- return true;
4210
- }
4211
- onsearch(callback) {
4212
- this.element?.addEventListener("search", () => callback());
4213
- return this;
4214
- }
4215
- connect(...UIElement) {
4216
- /*
4217
- let memory = new Array(UIElement.length).fill([]);
4218
- UIElement.map((n, i) => {
4219
- //console.log(n)
4220
- n.items.map((m, j) => {
4221
- memory[i][j] = m.element.style.display;
4222
- });
4223
- });
4224
- UIElement.map((n, i) =>
4225
- this.onInput(() => {
4226
- n.filterByTextContent(this.value, memory[i]);
4227
- this.Length = n.children.filter(
4228
- (n) => n.style.display != "none"
4229
- ).length;
4230
- })
4231
- );
4232
- */
4233
- return this;
4234
- }
4235
- displayLength(UIElement) {
4236
- this.element?.addEventListener("keyup", () =>
4237
- UIElement.setValue(this.Length),
4238
- );
4239
- return this;
4240
- }
3820
+ function set_vertical(direction){
3821
+ direction == 1
3822
+ ? this.style({ flexDirection: "column" })
3823
+ : direction == -1 && this.style({ flexDirection: "column-reverse" });
3824
+ return this;
4241
3825
  }
4242
- const search = (...a) => new ZikoUIInputSearch().connect(...a);
4243
-
4244
- class ZikoUIInputCheckbox extends ZikoUIInput {
4245
- constructor() {
4246
- super("checkbox", "inputCheckbox");
4247
- this.cursor("pointer");
4248
- }
4249
- get isInputCheckbox(){
4250
- return true;
4251
- }
4252
- get checked() {
4253
- return this.element.checked;
4254
- }
4255
- check(checked = true) {
4256
- this.element.checked = checked;
4257
- return this;
4258
- }
4259
- color(color) {
4260
- this.element.style.accentColor = color;
4261
- return this;
4262
- }
3826
+ function set_horizontal(direction){
3827
+ direction == 1
3828
+ ? this.style({ flexDirection: "row" })
3829
+ : direction == -1 && this.style({ flexDirection: "row-reverse" });
3830
+ return this;
4263
3831
  }
4264
- const checkbox = () => new ZikoUIInputCheckbox();
4265
-
4266
- class ZikoUIInputRadio extends ZikoUIInput {
4267
- constructor() {
4268
- super("radio", "inputRadio");
4269
- this.cursor("pointer");
4270
- }
4271
- get isInputRadio(){
4272
- return true;
4273
- }
4274
- get checked() {
4275
- return this.element.checked;
4276
- }
4277
- check(checked = true) {
4278
- this.element.checked = checked;
4279
- return this;
4280
- }
4281
- color(color) {
4282
- this.element.style.accentColor = color;
4283
- return this;
4284
- }
3832
+ function map_pos_x(align){
3833
+ let pos = ["flex-start", "center", "flex-end"];
3834
+ if (typeof align === "number") align = pos[align + 1];
3835
+ return align;
4285
3836
  }
4286
- const radio = () => new ZikoUIInputRadio();
4287
-
4288
- class ZikoUIInputEmail extends ZikoUIInput {
4289
- constructor() {
4290
- super("email", "inputEmail");
4291
- }
4292
- get isInputEmail(){
4293
- return true;
4294
- }
4295
- }
4296
- const inputEmail = () => new ZikoUIInputEmail();
4297
-
4298
- class ZikoUIInputPassword extends ZikoUIInput {
4299
- constructor() {
4300
- super("password", "inputPassword");
4301
- }
4302
- get isInputPassword(){
4303
- return true;
4304
- }
4305
- }
4306
- const inputPassword = () => new ZikoUIInputPassword();
3837
+ function map_pos_y(align){
3838
+ return map_pos_x(-align);
3839
+ }
4307
3840
 
4308
- class ZikoUIInputDate extends ZikoUIInput {
4309
- constructor() {
4310
- super("date", "inputDate");
3841
+ class ZikoUIGrid extends ZikoUIElement {
3842
+ constructor(tag ="div", w = "50vw", h = "50vh") {
3843
+ super(tag,"Grid");
3844
+ this.direction = "cols";
3845
+ if (typeof w == "number") w += "%";
3846
+ if (typeof h == "number") h += "%";
3847
+ this.style({ border: "1px solid black", width: w, height: h });
3848
+ this.style({ display: "grid" });
3849
+ // this.render();
4311
3850
  }
4312
- get isInputDate(){
4313
- return true;
3851
+ get isGird(){
3852
+ return true;
3853
+ }
3854
+ columns(n) {
3855
+ let temp = "";
3856
+ for (let i = 0; i < n; i++) temp = temp.concat(" auto");
3857
+ this.#templateColumns(temp);
3858
+ return this;
4314
3859
  }
4315
- }
4316
- const inputDate = () => new ZikoUIInputDate();
4317
-
4318
- class ZikoUIInputTime extends ZikoUIInput {
4319
- constructor() {
4320
- super("time", "inputTime");
3860
+ #templateColumns(temp = "auto auto") {
3861
+ this.style({ gridTemplateColumns: temp });
3862
+ return this;
4321
3863
  }
4322
- get isInputTime(){
4323
- return true;
3864
+ gap(w = 10, h = w) {
3865
+ if(typeof (w) === "number")w += "px";
3866
+ if(typeof (h) === "number")h += "px";
3867
+ this.style({gridColumnGap: w,gridRowGap: h});
3868
+ return this;
4324
3869
  }
4325
3870
  }
4326
- const inputTime = () => new ZikoUIInputTime();
3871
+ const Grid$1 = (...ZikoUIElement) => new ZikoUIGrid("div").append(...ZikoUIElement);
4327
3872
 
4328
- class ZikoUIInputDateTime extends ZikoUIInput {
4329
- constructor() {
4330
- super("datetime-local", "inputDateTime");
4331
- }
4332
- get isInputDateTime(){
4333
- return true;
3873
+ class ZikoUISuspense extends ZikoUIElement{
3874
+ constructor(fallback_ui, callback){
3875
+ super("div", "suspense");
3876
+ this.setAttr({
3877
+ dataTemp : "suspense"
3878
+ });
3879
+ this.fallback_ui = fallback_ui;
3880
+ this.append(fallback_ui);
3881
+ (async ()=>{
3882
+ try{
3883
+ const ui = await callback();
3884
+ fallback_ui.unrender();
3885
+ this.append(ui);
3886
+ // console.log(content)
3887
+ }
3888
+ catch(error){
3889
+ console.log({error});
3890
+ }
3891
+ })();
4334
3892
  }
4335
3893
  }
4336
- const inputDateTime = () => new ZikoUIInputDateTime();
3894
+
3895
+ const Suspense = (fallback_ui, callback) => new ZikoUISuspense(fallback_ui, callback);
4337
3896
 
4338
3897
  class ZikoUIXMLWrapper extends ZikoUIElement{
4339
3898
  constructor(XMLContent, type){
@@ -4369,1660 +3928,651 @@ class ZikoUISVGWrapper extends ZikoUIXMLWrapper{
4369
3928
  const HTMLWrapper = (HTMLContent) => new ZikoUIHTMLWrapper(HTMLContent);
4370
3929
  const SVGWrapper = (SVGContent) => new ZikoUISVGWrapper(SVGContent);
4371
3930
 
4372
- // function loadComponent() {
4373
- // return new Promise((resolve) => {
4374
- // setTimeout(() => {
4375
- // resolve(p(1000))
4376
- // }, 500);
4377
- // });
4378
- // }
4379
-
4380
- // Suspense(p("Loading ..."),()=>fetch('https://jsonplaceholder.typicode.com/todos/1')
4381
- // .then(response => response.json())
4382
- // .then(json => h2(json.title)))
4383
-
4384
-
4385
-
4386
- class ZikoUISuspense extends ZikoUIElement{
4387
- constructor(fallback_ui, callback){
4388
- super("div", "suspense");
4389
- this.setAttr({
4390
- dataTemp : "suspense"
4391
- });
4392
- this.fallback_ui = fallback_ui;
4393
- this.append(fallback_ui);
4394
- (async ()=>{
4395
- try{
4396
- const ui = await callback();
4397
- fallback_ui.unrender();
4398
- this.append(ui);
4399
- // console.log(content)
4400
- }
4401
- catch(error){
4402
- console.log({error});
4403
- }
4404
- })();
4405
- }
4406
- }
4407
-
4408
- const Suspense = (fallback_ui, callback) => new ZikoUISuspense(fallback_ui, callback);
4409
-
4410
- const _h=(tag, type, attributes, ...children)=>{
4411
- const { name, style, ...attrs } = attributes;
4412
- let element = new ZikoUIElement(tag, name, type);
4413
- style && element.style(style);
4414
- attrs && element.setAttr(attrs);
4415
- children && element.append(...children);
4416
- return element;
4417
- };
4418
- const h=(tag, attributes = {}, ...children)=> _h(tag, "html", attributes, ...children);
4419
- const s=(tag, attributes = {}, ...children)=> _h(tag, "svg", attributes, ...children);
4420
-
4421
- const HTMLTags$1 = [
4422
- 'a',
4423
- 'abb',
4424
- 'address',
4425
- 'area',
4426
- 'article',
4427
- 'aside',
4428
- 'audio',
4429
- 'b',
4430
- 'base',
4431
- 'bdi',
4432
- 'bdo',
4433
- 'blockquote',
4434
- 'br',
4435
- 'button',
4436
- 'canvas',
4437
- 'caption',
4438
- 'cite',
4439
- 'code',
4440
- 'col',
4441
- 'colgroup',
4442
- 'data',
4443
- 'datalist',
4444
- 'dd',
4445
- 'del',
4446
- 'details',
4447
- 'dfn',
4448
- 'dialog',
4449
- 'div',
4450
- 'dl',
4451
- 'dt',
4452
- 'em',
4453
- 'embed',
4454
- 'fieldset',
4455
- 'figcaption',
4456
- 'figure',
4457
- 'footer',
4458
- 'form',
4459
- 'h1',
4460
- 'h2',
4461
- 'h3',
4462
- 'h4',
4463
- 'h5',
4464
- 'h6',
4465
- 'header',
4466
- 'hgroup',
4467
- 'hr',
4468
- 'i',
4469
- 'iframe',
4470
- 'img',
4471
- 'ipnut',
4472
- 'ins',
4473
- 'kbd',
4474
- 'label',
4475
- 'legend',
4476
- 'li',
4477
- 'main',
4478
- 'map',
4479
- 'mark',
4480
- 'menu',
4481
- 'meter',
4482
- 'nav',
4483
- 'object',
4484
- 'ol',
4485
- 'optgroup',
4486
- 'option',
4487
- 'output',
4488
- 'p',
4489
- 'param',
4490
- 'picture',
4491
- 'pre',
4492
- 'progress',
4493
- 'q',
4494
- 'rp',
4495
- 'rt',
4496
- 'ruby',
4497
- 's',
4498
- 'samp',
4499
- 'search',
4500
- 'section',
4501
- 'select',
4502
- 'small',
4503
- 'source',
4504
- 'span',
4505
- 'strong',
4506
- 'sub',
4507
- 'summary',
4508
- 'sup',
4509
- 'svg',
4510
- 'table',
4511
- 'tbody',
4512
- 'td',
4513
- 'template',
4514
- 'textarea',
4515
- 'tfoot',
4516
- 'th',
4517
- 'thead',
4518
- 'time',
4519
- 'title',
4520
- 'tr',
4521
- 'track',
4522
- 'u',
4523
- 'ul',
4524
- 'var',
4525
- 'video',
4526
- 'wbr'
4527
- ];
4528
-
4529
- const SVGTags$1 = [
4530
- "svg", "g", "defs", "symbol", "use", "image", "switch",
4531
- "rect", "circle", "ellipse", "line", "polyline", "polygon", "path",
4532
- "text", "tspan", "textPath", "altGlyph", "altGlyphDef", "altGlyphItem", "glyph", "glyphRef",
4533
- "linearGradient", "radialGradient", "pattern", "solidColor",
4534
- "filter", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix",
4535
- "feDiffuseLighting", "feDisplacementMap", "feDropShadow", "feFlood", "feFuncA", "feFuncR", "feFuncG", "feFuncB",
4536
- "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "feSpecularLighting",
4537
- "feTile", "feTurbulence",
4538
- "animate", "animateMotion", "animateTransform", "set",
4539
- "script",
4540
- "desc", "title", "metadata", "foreignObject"
4541
- ];
4542
-
4543
- const hTags = HTMLTags$1.reduce((acc, key) => {
4544
- acc[key] = (attr, ...children) => h(key, attr, ...children);
4545
- return acc;
4546
- }, {});
4547
- const sTags = SVGTags$1.reduce((acc, key) => {
4548
- acc[key] = (attr, ...children) => h(key, attr, ...children);
4549
- return acc;
4550
- }, {});
4551
-
4552
- class ZikoUIHtmlTag extends ZikoUIElement {
4553
- constructor(element) {
4554
- super(element,"html");
4555
- }
4556
- }
4557
- class ZikoUIBtn extends ZikoUIElement {
4558
- constructor(value = "button") {
4559
- super("button","btn");
4560
- this.setValue(value);
4561
- this.st.cursor("pointer");
4562
- globalThis.__Ziko__.__Config__.default.render && this.render();
4563
- }
4564
- get isBtn(){
4565
- return true
4566
- }
4567
- setValue(value) {
4568
- if (value instanceof ZikoUIElement) value.setTarget(this.element);
4569
- else {
4570
- this.element?.appendChild(document.createTextNode(""));
4571
- this.element.childNodes[0].data = value;
4572
- }
4573
- return this;
4574
- }
4575
- get value() {
4576
- return this.element.innerText;
4577
- }
4578
- toggleValues(...values) {
4579
- values = values.map((n) => "" + n);
4580
- let index = values.indexOf("" + this.value);
4581
- if (index != -1 && index != values.length - 1)
4582
- this.setValue(values[index + 1]);
4583
- else this.setValue(values[0]);
4584
- return this;
4585
- }
4586
- }
4587
- class ZikoUIBr extends ZikoUIElement {
4588
- constructor() {
4589
- super("br","br");
4590
- }
4591
- get isBr(){
4592
- return true
3931
+ class ZikoUICanvas extends ZikoUIElement{
3932
+ constructor(w,h){
3933
+ super("canvas","canvas");
3934
+ this.ctx = this.element?.getContext("2d");
3935
+ this.style({
3936
+ border:"1px red solid",
3937
+ });
3938
+ this.transformMatrix = new Matrix([
3939
+ [1,0,0],
3940
+ [0,1,0],
3941
+ [0,0,1]
3942
+ ]);
3943
+ this.axisMatrix = new Matrix([
3944
+ [-10,-10],
3945
+ [10,10]
3946
+ ]);
3947
+ // setTimeout(()=>this.resize(w,h),0);
3948
+ requestAnimationFrame(()=>this.resize(w,h),0);
3949
+ this.on("sizeupdated",()=>this.adjust());
4593
3950
  }
4594
- }
4595
- class ZikoUIHr extends ZikoUIElement {
4596
- constructor() {
4597
- super("hr","hr");
4598
- this.setAttr("role", "none");
3951
+ get Xmin(){
3952
+ return this.axisMatrix[0][0];
4599
3953
  }
4600
- get isHr(){
4601
- return true
3954
+ get Ymin(){
3955
+ return this.axisMatrix[0][1];
4602
3956
  }
4603
- }
4604
- class ZikoUILink extends ZikoUIElement{
4605
- constructor(href){
4606
- super("a","link");
4607
- Object.assign(this.cache,{
4608
- defaultStyle:{
4609
- color:"#0275d8",
4610
- textDecoration: "none"
4611
- },
4612
- hoverStyle:{
4613
- color:"#01447e",
4614
- textDecoration: "underline"
4615
- },
4616
- });
4617
- this.setHref(href);
4618
- this.style(this.cache.defaultStyle);
4619
- this.onPtrEnter(()=>this.style(this.cache.hoverStyle));
4620
- this.onPtrLeave(()=>this.style(this.cache.defaultStyle));
3957
+ get Xmax(){
3958
+ return this.axisMatrix[1][0];
4621
3959
  }
4622
- setHref(href){
4623
- this.element.href=href;
3960
+ get Ymax(){
3961
+ return this.axisMatrix[1][1];
4624
3962
  }
4625
- get isLink(){
4626
- return true
3963
+ get ImageData(){
3964
+ return this.ctx.getImageData(0,0,c.Width,c.Height);
4627
3965
  }
4628
- }
4629
- const br = () => new ZikoUIBr();
4630
- const hr = () => new ZikoUIHr();
4631
- const brs = (n=1)=> new Array(n).fill(new ZikoUIBr());
4632
- const hrs = (n=1)=> new Array(n).fill(new ZikoUIHr());
4633
- const link=(href,...UIElement)=>new ZikoUILink(href).append(...UIElement);
4634
- const html=(tag,...UIElement)=>new ZikoUIHtmlTag(tag).append(...UIElement);
4635
- const btn = (value) => new ZikoUIBtn(value);
4636
-
4637
- var Misc = /*#__PURE__*/Object.freeze({
4638
- __proto__: null,
4639
- HTMLWrapper: HTMLWrapper,
4640
- SVGWrapper: SVGWrapper,
4641
- Suspense: Suspense,
4642
- ZikoUIBr: ZikoUIBr,
4643
- ZikoUIHTMLWrapper: ZikoUIHTMLWrapper,
4644
- ZikoUIHr: ZikoUIHr,
4645
- ZikoUIHtmlTag: ZikoUIHtmlTag,
4646
- ZikoUILink: ZikoUILink,
4647
- ZikoUISVGWrapper: ZikoUISVGWrapper,
4648
- ZikoUISuspense: ZikoUISuspense,
4649
- ZikoUIXMLWrapper: ZikoUIXMLWrapper,
4650
- br: br,
4651
- brs: brs,
4652
- btn: btn,
4653
- h: h,
4654
- hTags: hTags,
4655
- hr: hr,
4656
- hrs: hrs,
4657
- html: html,
4658
- link: link,
4659
- s: s,
4660
- sTags: sTags
4661
- });
4662
-
4663
- class ZikoUIInputImage extends ZikoUIElement {
4664
- constructor(text = "File") {
4665
- super("inputImage");
4666
- this._aux_element = btn(text).setTarget(this.target);
4667
- this.element = document?.createElement("input");
4668
- this.element?.setAttribute("type", "file");
4669
- this.element?.setAttribute("accept", "image");
4670
- this._aux_element.onClick(() => this.element.click());
4671
- this.element.onChange = this.handleImage.bind(this);
4672
- }
4673
- get isInputImage(){
4674
- return true;
4675
- }
4676
- handleImage(e) {
4677
- const reader = new FileReader();
4678
- const img = new Image();
4679
- reader.onload = function (event) {
4680
- img.src = event.target.result;
4681
- console.log(img.src);
4682
- };
4683
- reader.readAsDataURL(e.target.files[0]);
4684
- this.img = img;
3966
+ draw(all=true){
3967
+ if(all){
3968
+ this.clear();
3969
+ this.items.forEach(element => {
3970
+ element.parent=this;
3971
+ element.draw(this.ctx);
3972
+ });
3973
+ }
3974
+ else {
3975
+ this.items.at(-1).parent=this;
3976
+ this.items.at(-1).draw(this.ctx);
3977
+ }
3978
+ this.maintain();
3979
+ return this;
4685
3980
  }
4686
- get value() {
4687
- return this.img;
3981
+ applyTransformMatrix(){
3982
+ this.ctx.setTransform(
3983
+ this.transformMatrix[0][0],
3984
+ this.transformMatrix[1][0],
3985
+ this.transformMatrix[0][1],
3986
+ this.transformMatrix[1][1],
3987
+ this.transformMatrix[0][2],
3988
+ this.transformMatrix[1][2],
3989
+ );
3990
+ return this;
4688
3991
  }
4689
- render(bool = true) {
4690
- if (bool) this.target.appendChild(this._aux_element.element);
4691
- else this.remove();
4692
- return this;
3992
+ resize(w,h){
3993
+ this.size(w,h);
3994
+ this.lineWidth();
3995
+ this.view(this.axisMatrix[0][0], this.axisMatrix[0][1], this.axisMatrix[1][0], this.axisMatrix[1][1]);
3996
+ this.emit("sizeupdated");
3997
+ return this;
4693
3998
  }
4694
- remove() {
4695
- if (this.target.children.length) this.target.removeChild(this._aux_element.element);
4696
- return this;
3999
+ adjust(){
4000
+ this.element.width =this.element?.getBoundingClientRect().width;
4001
+ this.element.height =this.element?.getBoundingClientRect().height;
4002
+ this.view(this.axisMatrix[0][0], this.axisMatrix[0][1], this.axisMatrix[1][0], this.axisMatrix[1][1]);
4003
+ return this;
4697
4004
  }
4698
- }
4699
- const inputImage = (text) => new ZikoUIInputImage(text);
4700
-
4701
- class ZikoUIImage extends ZikoUIElement {
4702
- constructor(src,alt, w, h) {
4703
- super("img","image");
4704
- this.value=src;
4705
- if (src.nodeName === "IMG")this.element.setAttribute("src", src.src);
4706
- else this.element?.setAttribute("src", src);
4707
- if (typeof w == "number") w += "%";
4708
- if (typeof h == "number") h += "%";
4709
- this.setAttr("alt", alt);
4710
- this.style({ border: "1px solid black", width: w, height: h });
4005
+ view(xMin,yMin,xMax,yMax){
4006
+ this.transformMatrix[0][0]=this.width/(xMax-xMin); // scaleX
4007
+ this.transformMatrix[1][1]=-this.height/(yMax-yMin); // scaleY
4008
+ this.transformMatrix[0][2]=this.width/2;
4009
+ this.transformMatrix[1][2]=this.height/2;
4010
+ this.axisMatrix=new Matrix([
4011
+ [xMin,yMin],
4012
+ [xMax,yMax]
4013
+ ]);
4014
+
4015
+ this.applyTransformMatrix();
4016
+ this.clear();
4017
+ this.lineWidth(1);
4018
+ this.draw();
4019
+ return this;
4711
4020
  }
4712
- get isImg(){
4713
- return true;
4021
+ reset(){
4022
+ this.ctx.setTransform(1,0,0,0,0,0);
4023
+ return this;
4714
4024
  }
4715
- updateSrc(url){
4716
- this.value=url;
4717
- this.element.src=url;
4718
- return this;
4025
+ append(element){
4026
+ this.items.push(element);
4027
+ this.draw(false);
4028
+ return this;
4719
4029
  }
4720
- toggleSrc(...values){
4721
- values=values.map(n=>""+n);
4722
- let index=values.indexOf(""+this.value);
4723
- if(index!=-1&&index!=(values.length-1))this.updateSrc(values[index+1]);
4724
- else this.updateSrc(values[0]);
4725
- return this;
4726
- }
4727
- alt(alt){
4728
- this.element.alt=alt;
4729
- return this;
4730
- }
4731
- }
4732
- const image = (src,alt, width, height) => new ZikoUIImage(src,alt, width, height);
4733
-
4734
- class ZikoUIFigure extends ZikoUIElement{
4735
- constructor(src,caption){
4736
- super("figure","figure");
4737
- this.img=src.width("100%").element;
4738
- this.caption=document?.createElement("figcaption");
4739
- this.caption.append(caption.element);
4740
- this.element?.append(this.img);
4741
- this.element?.append(this.caption);
4742
- }
4743
- get isFigure(){
4744
- return true;
4030
+ background(color){
4031
+ this.ctx.fillStyle = color;
4032
+ this.ctx.setTransform(1, 0, 0, 1, 0, 0);
4033
+ this.ctx.fillRect(0, 0, this.width, this.height);
4034
+ this.applyTransformMatrix();
4035
+ this.draw();
4745
4036
  }
4746
- }
4747
- const figure =(image,caption) =>new ZikoUIFigure(image,caption);
4748
-
4749
- class __ZikoUIDynamicMediaElement__ extends ZikoUIElement {
4750
- constructor(element, name) {
4751
- super(element, name);
4752
- this.useControls();
4037
+ lineWidth(w){
4038
+ this.ctx.lineWidth=w/this.transformMatrix[0][0];
4039
+ return this
4753
4040
  }
4754
- get t(){
4755
- return this.element.currentTime;
4041
+ getImageData(x=0,y=0,w=this.width,h=this.height){
4042
+ return this.ctx.getImageData(x,y,w,h);
4756
4043
  }
4757
- useControls(enabled = true) {
4758
- this.element.controls = enabled;
4759
- return this;
4044
+ clear(){
4045
+ this.ctx.setTransform(1, 0, 0, 1, 0, 0);
4046
+ this.ctx.clearRect(0, 0, this.width, this.height);
4047
+ this.applyTransformMatrix();
4048
+ return this;
4760
4049
  }
4761
- enableControls(){
4762
- this.element.controls = true;
4763
- return this;
4050
+ clone(){
4051
+ console.log(this.width);
4052
+ const canvas=new ZikoUICanvas();
4053
+ canvas.items=this.items;
4054
+ canvas.transformMatrix=this.transformMatrix;
4055
+ canvas.axisMatrix=this.axisMatrix;
4056
+ Object.assign(canvas.cache,{...this.cache});
4057
+ //waitForUIElm(this)
4058
+ //console.log(element)
4059
+ this.size(this.element.style.width,this.element.style.width);
4060
+ this.applyTransformMatrix();
4061
+ this.draw();
4062
+ this.adjust();
4063
+ return canvas;
4764
4064
  }
4765
- disableControls(){
4766
- this.element.controls = true;
4767
- return this;
4065
+ toImage() {
4066
+ this.img = document?.createElement("img");
4067
+ this.img.src = this.element?.toDataURL("image/png");
4068
+ return this;
4768
4069
  }
4769
- toggleControls(){
4770
- this.element.controls = !this.element.controls;
4771
- return this;
4070
+ toBlob() {
4071
+ var canvas = this.element;
4072
+ canvas.toBlob(function (blob) {
4073
+ var newImg = document?.createElement("img"),
4074
+ url = URL.createObjectURL(blob);
4075
+ newImg.onload = function () {
4076
+ URL.revokeObjectURL(url);
4077
+ };
4078
+ newImg.src = url;
4079
+ console.log(newImg);
4080
+ });
4772
4081
  }
4773
- play() {
4774
- this.element.play();
4775
- return this;
4082
+ zoomIn(){
4083
+
4776
4084
  }
4777
- pause() {
4778
- this.element.pause();
4779
- return this;
4085
+ zoomOut(){
4086
+
4780
4087
  }
4781
- seekTo(time) {
4782
- this.element.currentTime = time;
4783
- return this;
4088
+ undo(n){
4089
+
4784
4090
  }
4785
- onPlay(){
4091
+ redo(n){
4786
4092
 
4787
4093
  }
4788
- onPause(){
4094
+ stream(){
4789
4095
 
4790
4096
  }
4791
- }
4097
+ }
4098
+
4099
+ const Canvas=(w,h)=>new ZikoUICanvas(w,h);
4792
4100
 
4793
- class ZikoUIVideo extends __ZikoUIDynamicMediaElement__ {
4794
- constructor(src="", w = "100%", h = "50vh") {
4795
- super("video","video");
4796
- if (src.nodeName === "VIDEO") this.element?.setAttribute("src", src.src);
4797
- else this.element?.setAttribute("src", src);
4798
- if (typeof w == "number") w += "%";
4799
- if (typeof h == "number") h += "%";
4800
- this.style({ width: w, height: h });
4101
+ class ZikoUISvg extends ZikoUIElement {
4102
+ constructor(w=360,h=300) {
4103
+ super("svg","svg");
4104
+ //this.cache={};
4105
+ // this.setAttr("width",w);
4106
+ // this.setAttr("height",h);
4107
+ // this.setAttr({
4108
+ // width : w,
4109
+ // height : h
4110
+ // })
4111
+ this.style({border:"1px black solid"});
4112
+ //this.view(-w/2,-h/2,w/2,h/2);
4113
+ this.size(w, h);
4114
+ this.view(-10,-10,10,10);
4801
4115
  }
4802
- get isVideo(){
4803
- return true;
4116
+ size(w, h){
4117
+ this.setAttr({
4118
+ width : w,
4119
+ height : h
4120
+ });
4121
+ return this
4804
4122
  }
4805
- usePoster(src=""){
4806
- this.element.poster=src;
4123
+ view(x1,y1,x2,y2){
4124
+ let width=Math.abs(x2-x1);
4125
+ let height=Math.abs(y2-y1);
4126
+ this.setAttr("viewBox",[x1,y1,width,height].join(" "));
4127
+ this.st.scaleY(-1);
4807
4128
  return this;
4808
4129
  }
4809
- usePIP(e){
4810
- this.element.requestPictureInPicture(e);
4130
+ add(...svgElement){
4131
+ for(let i=0;i<svgElement.length;i++){
4132
+ this.element.append(svgElement[i].element);
4133
+ this.items.push(svgElement[i]);
4134
+ }
4135
+ this.maintain();
4811
4136
  return this;
4812
4137
  }
4813
- }
4814
- const video = (src, width, height) => new ZikoUIVideo(src, width, height);
4815
-
4816
- class ZikoUIAudio extends __ZikoUIDynamicMediaElement__ {
4817
- constructor(src) {
4818
- super("audio","audio");
4819
- this.element?.setAttribute("src", src);
4820
- this.size("150px","30px");
4821
- // this.useControls();
4138
+ remove(...svgElement){
4139
+ for(let i=0;i<svgElement.length;i++){
4140
+ this.element?.removeChild(svgElement[i].element);
4141
+ this.items=this.items.filter(n=>!svgElement);
4142
+ }
4143
+ this.maintain();
4144
+ return this;
4822
4145
  }
4823
- get isAudio(){
4824
- return true;
4146
+ mask(){
4147
+
4825
4148
  }
4826
- }
4827
- const audio = (src) => new ZikoUIAudio(src);
4828
-
4829
- var Media = /*#__PURE__*/Object.freeze({
4830
- __proto__: null,
4831
- ZikoUIAudio: ZikoUIAudio,
4832
- ZikoUIFigure: ZikoUIFigure,
4833
- ZikoUIImage: ZikoUIImage,
4834
- ZikoUIVideo: ZikoUIVideo,
4835
- audio: audio,
4836
- figure: figure,
4837
- image: image,
4838
- video: video
4839
- });
4840
-
4841
- class ZikoUIWebcame extends ZikoUIVideo{
4842
- constructor(){
4843
- super();
4844
- this.element?.setAttribute("src", "");
4845
- this.constraints = { audio: true, video: { width: 1280, height: 720 } };
4846
- //this.video=this.element
4149
+ toString(){
4150
+ return (new XMLSerializer()).serializeToString(this.element);
4847
4151
  }
4848
- get isInputCamera(){
4849
- return true;
4152
+ btoa(){
4153
+ return btoa(this.toString())
4850
4154
  }
4851
- start(){
4852
- navigator.mediaDevices.getUserMedia(this.constraints).then((mediaStream)=>{
4853
- this.element.srcObject = mediaStream;
4854
- this.element.onloadedmetadata = () =>{
4855
- this.element.play();
4856
- };
4857
- })
4858
- .catch(function(err) { console.log(err.name + ": " + err.message); });
4859
- return this;
4155
+ toImg(){
4156
+ return 'data:image/svg+xml;base64,'+this.btoa()
4860
4157
  }
4861
- }
4862
- const inputCamera=()=>new ZikoUIWebcame();
4863
-
4864
- class ZikoUILabel extends ZikoUIElement{
4865
- constructor(){
4866
- super();
4867
- this.element=document?.createElement("label");
4158
+ toImg2(){
4159
+ return "data:image/svg+xml;charset=utf8,"+this.toString().replaceAll("<","%3C").replaceAll(">","%3E").replaceAll("#","%23").replaceAll('"',"'");
4868
4160
  }
4869
- get isLabel(){
4870
- return true;
4871
- }
4161
+
4872
4162
  }
4873
- class ZikoUIInputOption extends ZikoUIElement {
4874
- constructor(value = "") {
4875
- super();
4876
- this.element = document?.createElement("option");
4877
- if(value instanceof Object&&"value" in value){
4878
- this.setValue(value.value);
4879
- this.setText(value?.text??value.value);
4163
+
4164
+ const Svg =(w,h)=>new ZikoUISvg(w,h);
4165
+
4166
+ const svg2str=svg=>(new XMLSerializer()).serializeToString(svg);
4167
+ const svg2ascii=svg=>btoa(svg2str(svg));
4168
+ const svg2imgUrl=svg=>'data:image/svg+xml;base64,'+svg2ascii(svg);
4169
+ const svg2img=(svg,render=true)=>tags.img(svg2imgUrl(svg)).render(render);
4170
+
4171
+ // const obj2str=(object)=>{
4172
+ // const recursiveToString = (obj) => {
4173
+ // if (Array.isArray(obj)) return arr2str(obj);
4174
+ // if (typeof obj === 'object' && obj !== null) {
4175
+ // return `{ ${Object.entries(obj)
4176
+ // .map(([key, value]) => `${key}:${recursiveToString(value)}`)
4177
+ // .join(" , ")} }`;
4178
+ // }
4179
+ // return String(obj);
4180
+ // };
4181
+ // return recursiveToString(object);
4182
+ // };
4183
+ // const obj2str = (object) => {
4184
+ // const recursiveToString = (obj, indentLevel = 0) => {
4185
+ // const indent = ' '.repeat(indentLevel);
4186
+ // const nextIndent = ' '.repeat(indentLevel + 1);
4187
+ // if(Array.isArray(obj)) return arr2str(obj, indentLevel);
4188
+ // if(obj instanceof Complex || obj instanceof Matrix) return obj.toString();
4189
+ // if (typeof obj === 'object' && obj !== null) {
4190
+ // const entries = Object.entries(obj)
4191
+ // .map(([key, value]) => `${nextIndent}${key}: ${recursiveToString(value, indentLevel + 1)}`)
4192
+ // .join(",\n");
4193
+
4194
+ // return `{\n${entries}\n${indent}}`;
4195
+ // }
4196
+
4197
+ // return String(obj);
4198
+ // };
4199
+
4200
+ // return recursiveToString(object);
4201
+ // };
4202
+ // const obj2str = (object, useIndentation = true, indentLevel = 0) => {
4203
+ // const recursiveToString = (obj, level = 0) => {
4204
+ // const indent = useIndentation ? ' '.repeat(level) : '';
4205
+ // const nextIndent = useIndentation ? ' '.repeat(level + 1) : '';
4206
+ // if (Array.isArray(obj)) return arr2str(obj, false, level);
4207
+ // if(obj instanceof Complex || obj instanceof Matrix) return obj.toString();
4208
+ // if (typeof obj === 'object' && obj !== null) {
4209
+ // const entries = Object.entries(obj)
4210
+ // .map(([key, value]) => useIndentation
4211
+ // ? `${nextIndent}${key}: ${recursiveToString(value, level + 1)}`
4212
+ // : `${key}: ${recursiveToString(value, level + 1)}`
4213
+ // ).join(useIndentation ? ",\n" : ", ");
4214
+
4215
+ // return useIndentation
4216
+ // ? `{\n${entries}\n${indent}}`
4217
+ // : `{${entries}}`;
4218
+ // }
4219
+
4220
+ // return String(obj);
4221
+ // };
4222
+
4223
+ // return recursiveToString(object, indentLevel);
4224
+ // };
4225
+
4226
+ const obj2str=(obj)=>JSON.stringify(
4227
+ mapfun$1(n=>{
4228
+ if(["number","string","boolean","bigint"].includes(typeof n)) return String(n);
4229
+ if(n instanceof Complex || n instanceof Matrix) return n.toString();
4230
+ if(n instanceof Array) return arr2str(n)
4231
+ },
4232
+ obj), null, " ")
4233
+ .replace(/"([^"]+)":/g, '$1:') // Remove Quotes from Keys
4234
+ .replace(/: "([^"]+)"/g, ': $1'); // Remove Quotes from str values
4235
+
4236
+ const getMaxDepth = arr=> {
4237
+ if (!Array.isArray(arr)) return 0;
4238
+ let maxDepth = 1;
4239
+ for (const element of arr) {
4240
+ if (Array.isArray(element)) {
4241
+ const depth = getMaxDepth(element);
4242
+ if (depth + 1 > maxDepth) {
4243
+ maxDepth = depth + 1;
4880
4244
  }
4881
- else this.setValue(value);
4882
- }
4883
- setValue(str = "") {
4884
- this.element.value = str;
4885
- return this;
4886
4245
  }
4887
- setText(text=""){
4888
- if(text)this.element.textContent=text;
4889
- return this;
4890
- }
4891
- }
4892
- let ZikoUIInputDatalist$1 = class ZikoUIInputDatalist extends ZikoUIElement {
4893
- constructor(...options){
4894
- super();
4895
- this.element = document?.createElement("datalist");
4896
- this.addOptions(...options).setId("ziko-datalist-id"+Random.string(10));
4897
- }
4898
- get isDatalist(){
4899
- return true;
4900
- }
4901
- addOptions(...options) {
4902
- options.map((n) => this.append(new ZikoUIInputOption(n)));
4903
- return this;
4904
4246
  }
4247
+ return maxDepth;
4905
4248
  };
4906
-
4907
- const datalist = (...options) => new ZikoUIInputDatalist$1(...options);
4908
-
4909
- class ZikoUISelect extends ZikoUIElement {
4910
- constructor(){
4911
- super();
4912
- this.element=document?.createElement("select");
4913
- }
4914
- addOptions(...options) {
4915
- options.map(n => this.append(new ZikoUIInputOption(n)));
4916
- return this;
4917
- }
4918
- get isSelect(){
4919
- return true;
4249
+ const arr2str = (arr) => {
4250
+ let level = 0;
4251
+ function arrStringify(arr) {
4252
+ let max = getMaxDepth(arr);
4253
+ let useIdentation = 0;
4254
+ if (arr.some((n) => Array.isArray(n))) {
4255
+ level++;
4256
+ useIdentation = 1;
4920
4257
  }
4258
+ return (
4259
+ "[" +
4260
+ arr.map((n, i) => {
4261
+ if (["number", "string", "boolean", "bigint"].includes(typeof n))
4262
+ return String(n);
4263
+ if (n instanceof Complex) return n.toString();
4264
+ if (n instanceof Array) {
4265
+ return `\n${" ".repeat(level)}${arrStringify(n)}${i === arr.length - 1 ? "\n" : ""}`;
4266
+ }
4267
+ if( n instanceof Object) return obj2str(n);
4268
+ })
4269
+ + `${" ".repeat((max+level+1) * useIdentation)}]`
4270
+ );
4921
4271
  }
4922
- const select=()=>new ZikoUISelect();
4272
+ return arrStringify(arr);
4273
+ };
4923
4274
 
4924
- class ZikoUITextArea extends ZikoUIElement {
4925
- constructor() {
4926
- super();
4927
- this.element = document?.createElement("textarea");
4928
- }
4929
- get value(){
4930
- return this.element.textContent;
4931
- }
4932
- get isTextArea(){
4933
- return true;
4275
+ const json2css=(json, indentLevel = 0)=>{
4276
+ json = trimKeys(json);
4277
+ let cssText = '';
4278
+ const indent = ' '.repeat(indentLevel);
4279
+
4280
+ for (let selector in json) {
4281
+ if (typeof json[selector] === 'object') {
4282
+ cssText += `${indent}${selector} {\n`;
4283
+ const properties = json[selector];
4284
+ for (let property in properties) {
4285
+ if (typeof properties[property] === 'object') {
4286
+ cssText += json2css({ [property]: properties[property] }, indentLevel + 1);
4287
+ } else {
4288
+ cssText += `${indent} ${property.replace(/[A-Z]/g, match => '-' + match.toLowerCase())}: ${properties[property]};\n`;
4289
+ }
4290
+ }
4291
+
4292
+ cssText += `${indent}}\n`;
4293
+ }
4934
4294
  }
4935
- }
4936
- const textarea =()=> new ZikoUITextArea();
4937
-
4938
- class ZikoUIFlex extends ZikoUIElement {
4939
- constructor(tag = "div", w = "100%", h = "100%") {
4940
- super(tag ,"Flex");
4941
- this.direction = "cols";
4942
- if (typeof w == "number") w += "%";
4943
- if (typeof h == "number") h += "%";
4944
- this.style({ width: w, height: h });
4945
- this.style({ display: "flex" });
4946
- // this.render();
4947
- }
4948
- get isFlex(){
4949
- return true;
4950
- }
4951
- resp(px,wrap = true) {
4952
- this.wrap(wrap);
4953
- if (this.element.clientWidth < px) this.vertical();
4954
- else this.horizontal();
4955
- return this;
4956
- }
4957
- setSpaceAround() {
4958
- this.style({ justifyContent: "space-around" });
4959
- return this;
4960
- }
4961
- setSpaceBetween() {
4962
- this.style({ justifyContent: "space-between" });
4963
- return this;
4964
- }
4965
- setBaseline() {
4966
- this.style({ alignItems: "baseline" });
4967
- return this;
4968
- }
4969
- gap(g) {
4970
- if (this.direction === "row") this.style({ columnGap: g });
4971
- else if (this.direction === "column") this.style({ rowGap: g });
4972
- return this;
4973
- }
4974
- wrap(value = "wrap") {
4975
- const values = ["no-wrap", "wrap","wrap-reverse"];
4976
- this.style({
4977
- flexWrap: typeof value === "string" ? value : values[+value],
4978
- });
4979
- return this;
4980
- }
4981
- _justifyContent(align = "center") {
4982
- this.style({ justifyContent: align });
4983
- return this;
4984
- }
4985
- vertical(x, y, order=1) {
4986
- set_vertical.call(this,order);
4987
- this.style({
4988
- alignItems: typeof(x)==="number"?map_pos_x.call(this,x):x,
4989
- justifyContent: typeof(y)=="number"?map_pos_y.call(this,y):y
4990
- });
4991
- return this;
4992
- }
4993
- horizontal(x, y, order=1) {
4994
- set_horizontal.call(this,order);
4995
- this.style({
4996
- alignItems: typeof(y)=="number"?map_pos_y.call(this,y):y,
4997
- justifyContent: typeof(x)==="number"?map_pos_x.call(this,x):x
4998
- });
4999
- return this;
5000
- }
5001
- show() {
5002
- this.isHidden = false;
5003
- this.style({ display: "flex" });
5004
- return this;
5005
- }
5006
- }
5007
4295
 
5008
- const Flex = (...ZikoUIElement) =>{
5009
- let tag="div";
5010
- if(typeof ZikoUIElement[0]==="string"){
5011
- tag=ZikoUIElement[0];
5012
- ZikoUIElement.pop();
5013
- }
5014
- return new ZikoUIFlex(tag).append(...ZikoUIElement);
4296
+ return cssText;
5015
4297
  };
5016
- function set_vertical(direction){
5017
- direction == 1
5018
- ? this.style({ flexDirection: "column" })
5019
- : direction == -1 && this.style({ flexDirection: "column-reverse" });
5020
- return this;
5021
- }
5022
- function set_horizontal(direction){
5023
- direction == 1
5024
- ? this.style({ flexDirection: "row" })
5025
- : direction == -1 && this.style({ flexDirection: "row-reverse" });
5026
- return this;
5027
- }
5028
- function map_pos_x(align){
5029
- let pos = ["flex-start", "center", "flex-end"];
5030
- if (typeof align === "number") align = pos[align + 1];
5031
- return align;
5032
- }
5033
- function map_pos_y(align){
5034
- return map_pos_x(-align);
4298
+ function trimKeys(obj) {
4299
+ if (typeof obj !== 'object' || obj === null) {
4300
+ return obj;
4301
+ }
4302
+
4303
+ return Object.keys(obj).reduce((acc, key) => {
4304
+ const trimmedKey = key.trim();
4305
+ acc[trimmedKey] = trimKeys(obj[key]);
4306
+ return acc;
4307
+ }, Array.isArray(obj) ? [] : {});
5035
4308
  }
5036
4309
 
5037
- var Flex$1 = /*#__PURE__*/Object.freeze({
5038
- __proto__: null,
5039
- Flex: Flex,
5040
- ZikoUIFlex: ZikoUIFlex
5041
- });
4310
+ const Patterns={
4311
+ isDigit: /^\d+$/,
4312
+ isURL: /^(https?:\/\/)?([\w\-]+\.)+[\w\-]+(\/[\w\-./?%&=]*)?$/,
4313
+ isHexColor: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,
4314
+ isIPv4: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
4315
+ isMACAddress: /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/,
4316
+ isDate: /^\d{4}-\d{2}-\d{2}$/,
4317
+ };
5042
4318
 
5043
- class ZikoUIForm extends ZikoUIFlex{
5044
- constructor(...items){
5045
- super("form", "Form");
5046
- this.append(...items);
5047
- this.setMethod("POST");
5048
- this.setAction("/");
4319
+ class Str{
4320
+ constructor(string){
4321
+ this.string=string;
5049
4322
  }
5050
- setAction(action = "/"){
5051
- this.setAttr("action", action);
5052
- return this;
4323
+ isDigit() {
4324
+ return Patterns.isDigit.test(this.string);
5053
4325
  }
5054
- setMethod(method = "post"){
5055
- this.setAttr("method", method);
5056
- return this;
4326
+ static isDigit(string){
4327
+ return new Str(string).isDigit();
5057
4328
  }
5058
- get data(){
5059
- let formData = new FormData(this.element);
5060
- this.items.forEach(n=>{
5061
- if(n.isInput||n.isSelect||n.isTextarea)formData.append(n.element.name, n.value);
5062
- });
5063
- return formData;
4329
+ isNumber() {
4330
+ return !isNaN(this.string);
5064
4331
  }
5065
- sendFormData(){
5066
- fetch(this.element.action, {
5067
- method: this.element.method,
5068
- body: this.data
5069
- })
5070
- .then(response => response.json())
5071
- .then(data => console.log(data))
5072
- .catch(error => console.error('Error:', error));
5073
- return this;
4332
+ static isNumber(string){
4333
+ return new Str(string).isNumber();
5074
4334
  }
5075
- getByName(name){
5076
- return this.data.get(name);
4335
+ isUrl(){
4336
+ return Patterns.isURL.test(this.string);
5077
4337
  }
5078
- }
5079
- const Form = (...items) => new ZikoUIForm(...items);
5080
-
5081
- var Io = /*#__PURE__*/Object.freeze({
5082
- __proto__: null,
5083
- Form: Form,
5084
- ZikoUIForm: ZikoUIForm,
5085
- ZikoUIInput: ZikoUIInput,
5086
- ZikoUIInputCheckbox: ZikoUIInputCheckbox,
5087
- ZikoUIInputColor: ZikoUIInputColor,
5088
- ZikoUIInputDatalist: ZikoUIInputDatalist$1,
5089
- ZikoUIInputDate: ZikoUIInputDate,
5090
- ZikoUIInputDateTime: ZikoUIInputDateTime,
5091
- ZikoUIInputEmail: ZikoUIInputEmail,
5092
- ZikoUIInputImage: ZikoUIInputImage,
5093
- ZikoUIInputNumber: ZikoUIInputNumber,
5094
- ZikoUIInputOption: ZikoUIInputOption,
5095
- ZikoUIInputPassword: ZikoUIInputPassword,
5096
- ZikoUIInputRadio: ZikoUIInputRadio,
5097
- ZikoUIInputSearch: ZikoUIInputSearch,
5098
- ZikoUIInputSlider: ZikoUIInputSlider$1,
5099
- ZikoUIInputTime: ZikoUIInputTime,
5100
- ZikoUILabel: ZikoUILabel,
5101
- ZikoUISelect: ZikoUISelect,
5102
- ZikoUITextArea: ZikoUITextArea,
5103
- checkbox: checkbox,
5104
- datalist: datalist,
5105
- input: input,
5106
- inputCamera: inputCamera,
5107
- inputColor: inputColor,
5108
- inputDate: inputDate,
5109
- inputDateTime: inputDateTime,
5110
- inputEmail: inputEmail,
5111
- inputImage: inputImage,
5112
- inputNumber: inputNumber,
5113
- inputPassword: inputPassword,
5114
- inputTime: inputTime,
5115
- radio: radio,
5116
- search: search,
5117
- select: select,
5118
- slider: slider,
5119
- textarea: textarea
5120
- });
5121
-
5122
- class ZikoUITr extends ZikoUIElement{
5123
- constructor(...ZikoUIElement){
5124
- super();
5125
- this.element=document?.createElement("Tr");
5126
- this.append(...ZikoUIElement);
4338
+ static isUrl(string){
4339
+ return new Str(string).isUrl();
5127
4340
  }
5128
- }
5129
- class ZikoUITd extends ZikoUIElement{
5130
- constructor(...ZikoUIElement){
5131
- super();
5132
- this.element=document?.createElement("Td");
5133
- this.append(...ZikoUIElement);
4341
+ isHexColor(){
4342
+ return Patterns.isHexColor.test(this.string);
5134
4343
  }
5135
- }
5136
- class ZikoUIThead extends ZikoUIElement{
5137
- constructor(...ZikoUITr){
5138
- super();
5139
- this.element=document?.createElement("Thead");
5140
- this.append(...ZikoUITr);
4344
+ static isHexColor(string){
4345
+ return new Str(string).isHexColor();
5141
4346
  }
5142
- }
5143
- class ZikoUITbody extends ZikoUIElement{
5144
- constructor(...ZikoUITr){
5145
- super();
5146
- this.element=document?.createElement("Tbody");
5147
- this.append(...ZikoUITr);
4347
+ isIPv4(){
4348
+ return Patterns.isIPv4.test(this.string);
5148
4349
  }
5149
- }
5150
- class ZikoUICaption extends ZikoUIElement{
5151
- constructor(ZikoUIElement){
5152
- super();
5153
- this.element=document?.createElement("Caption");
5154
- this.append(ZikoUIElement);
4350
+ static isIPv4(string){
4351
+ return new Str(string).isIPv4();
5155
4352
  }
5156
- }
5157
-
5158
- const tr=(...ZikoUIElement)=>new ZikoUITr(...ZikoUIElement);
5159
- const td=(...UI)=>{
5160
- UI=UI.map(n=>{
5161
- if(!(n instanceof ZikoUIElement))n=text(n);
5162
- return n
5163
- });
5164
- return new ZikoUITd(...UI)
5165
- };
5166
- const thead=(...ZikoUITd)=>{
5167
- ZikoUITd=ZikoUITd.map(n=>{
5168
- if(!(n instanceof ZikoUIElement))n=td(n);
5169
- return n
5170
- });
5171
- return new ZikoUIThead(...UI)
5172
- };
5173
- const tbody=(...ZikoUITr)=>new ZikoUITbody(...ZikoUITr);
5174
- const caption=(ZikoUITr)=>new ZikoUICaption(ZikoUITr);
5175
-
5176
- const MatrixToTableUI=matrix=>{
5177
- var Tr = new Array(matrix.rows).fill(null).map(() => tr());
5178
- var Td = matrix.arr.map((n) => n.map(() => null));
5179
- for (let i = 0; i < Td.length; i++) {
5180
- for (let j = 0; j < Td[0].length; j++) {
5181
- Td[i][j] = td(matrix.arr[i][j]);
5182
- Tr[i].append(Td[i][j]);
5183
- }
4353
+ isDate(){
4354
+ return Patterns.isDate.test(this.string);
5184
4355
  }
5185
- return Tr
5186
- };
5187
-
5188
- class ZikoUITable extends ZikoUIElement {
5189
- constructor(body,{caption=null,head=null,foot=null}={}){
5190
- super("table","Table");
5191
- this.structure={
5192
- caption,
5193
- head,
5194
- body:null,
5195
- foot
5196
- };
5197
- if(body)this.fromMatrix(body);
5198
- if(caption)this.setCaption(caption);
4356
+ static isDate(string){
4357
+ return new Str(string).isDate();
5199
4358
  }
5200
- get isTable(){
5201
- return true;
5202
- }
5203
- get caption(){
5204
- return this.structure.caption;
4359
+ isMACAddress(){
4360
+ return Patterns.isMACAddress.test(this.string);
5205
4361
  }
5206
- get header(){
5207
-
4362
+ static isMACAddress(string){
4363
+ return new Str(string).isMACAddress();
5208
4364
  }
5209
- get body(){
5210
-
4365
+ isPascalCase(){
4366
+ if (this.string.length === 0) return false;
4367
+ const PascalCasePattern = /^[A-Z][a-zA-Z0-9]*$/;
4368
+ return PascalCasePattern.test(this.string);
5211
4369
  }
5212
- get footer(){
5213
-
4370
+ static isPascalCase(string){
4371
+ return new Str(string).isPascalCase();
5214
4372
  }
5215
- setCaption(c){
5216
- this.removeCaption();
5217
- this.structure.caption=caption(c);
5218
- this.append(this.structure.caption);
5219
- return this;
4373
+ isCamelCase() {
4374
+ if (this.string.length === 0) return false;
4375
+ const camelCasePattern = /^[a-z][a-zA-Z0-9]*$/;
4376
+ return camelCasePattern.test(this.string);
5220
4377
  }
5221
- removeCaption(){
5222
- if(this.structure.caption)this.removeItem(...this.items.filter(n=>n instanceof ZikoUICaption));
5223
- this.structure.caption=null;
5224
- return this;
4378
+ static isCamelCase(string){
4379
+ return new Str(string).isCamelCase();
5225
4380
  }
5226
- setHeader(...c){
5227
- this.tHead=thead(...c);
5228
- this.append(this.tHead);
5229
- return this;
4381
+ isHyphenCase(){
4382
+ return this.string.split('-').length > 1;
5230
4383
  }
5231
- removeHeader(){
5232
- this.removeItem(...this.items.filter(n=>n instanceof ZikoUICaption));
5233
- return this;
4384
+ static isHyphenCase(string){
4385
+ return new Str(string).isHyphenCase();
5234
4386
  }
5235
- setFooter(c){
5236
- this.structure.caption=caption(c);
5237
- this.append(this.structure.caption);
5238
- return this;
4387
+ isSnakeCase(){
4388
+ return this.string.split('_').length > 1;
5239
4389
  }
5240
- removeFooter(){
5241
- this.removeItem(...this.items.filter(n=>n instanceof ZikoUICaption));
5242
- return this;
4390
+ static isSnakeCase(string){
4391
+ return new Str(string).isSnakeCase();
5243
4392
  }
5244
- fromMatrix(bodyMatrix) {
5245
- (bodyMatrix instanceof Array)?this.bodyMatrix=matrix(bodyMatrix):this.bodyMatrix=bodyMatrix;
5246
- if(this.structure.body)this.remove(this.structure.body);
5247
- this.structure.body=tbody();
5248
- this.append(this.structure.body);
5249
- this.structure.body.append(...MatrixToTableUI(this.bodyMatrix));
5250
- //this.structure.body.append(...MatrixToTableUI(matrix))
5251
- //this.cellStyles({ padding: "0.2rem 0.4rem", textAlign: "center" });
5252
- return this;
5253
- }
5254
- transpose() {
5255
- this.fromMatrix(this.bodyMatrix.T);
5256
- return this;
5257
- }
5258
- hstack(m) {
5259
- if(m instanceof ZikoUITable)m=m.bodyMatrix;
5260
- this.fromMatrix(this.bodyMatrix.clone.hstack(m));
5261
- return this;
4393
+ isPalindrome(){
4394
+ const str=this.string.toLocaleLowerCase();
4395
+ let l=str.length,i;
4396
+ for(i=0;i<l/2;i++)if(str[i]!=str[l-i-1])return false;
4397
+ return true;
5262
4398
  }
5263
- vstack(m) {
5264
- if(m instanceof ZikoUITable)m=m.bodyMatrix;
5265
- this.fromMatrix(this.bodyMatrix.clone.vstack(m));
5266
- return this;
4399
+ static isPalindrome(string){
4400
+ return new Str(string).isPalindrome();
5267
4401
  }
5268
- slice(r0=0,c0=0,r1=this.bodyMatrix.rows-1,c1=this.bodyMatrix.cols-1) {
5269
- this.fromMatrix(this.bodyMatrix.slice(r0,c0,r1,c1));
5270
- return this;
5271
- }
5272
- sortByCols(n, config = { type: "num", order: "asc" }) {
5273
- this.fromMatrix(this.bodyMatrix.clone.sortTable(n, config));
5274
- return this;
4402
+ static isAnagrams(word,words){
4403
+ word=word.split("").sort();
4404
+ words=words.split("").sort();
4405
+ return JSON.stringify(word)===JSON.stringify(words);
5275
4406
  }
5276
- sortByRows(n, config = { type: "num", order: "asc" }) {
5277
- this.fromMatrix(this.bodyMatrix.T.clone.sortTable(n, config).T);
5278
- return this;
4407
+ isIsogram(){
4408
+ return [...new Set(this.string.toLowerCase())].length===this.string.length;
5279
4409
  }
5280
- filterByRows(item) {
5281
- this.fromMatrix(this.bodyMatrix.clone.filterByRows(item));
5282
- return this;
4410
+ static isIsogram(string){
4411
+ return new Str(string).isIsogram();
5283
4412
  }
5284
- filterByCols(item) {
5285
- this.fromMatrix(this.bodyMatrix.clone.filterByCols(item));
5286
- return this;
5287
- }
5288
- forEachRow(callback){
5289
- this.structure.body.forEach(callback);
5290
- return this;
4413
+ static camel2hyphencase(text) {
4414
+ return text.replace(/[A-Z]/g, match => '-' + match.toLowerCase());
5291
4415
  }
5292
- forEachItem(callback){
5293
- this.structure.body.forEach(n=>n.forEach(callback));
5294
- return this;
4416
+ static camel2snakecase(text) {
4417
+ return text.replace(/[A-Z]/g, match => '_' + match.toLowerCase());
5295
4418
  }
5296
- }
5297
- const Table$1=(matrix,config)=>new ZikoUITable(matrix,config);
5298
-
5299
- var Table = /*#__PURE__*/Object.freeze({
5300
- __proto__: null,
5301
- Table: Table$1
5302
- });
5303
-
5304
- const elements = ['Main', 'Header', 'Nav', 'Section', 'Article', 'Aside', 'Footer'];
5305
-
5306
- // Storage for Classes and component functions
5307
- const Classes = {};
5308
- const Components = {};
5309
-
5310
- // Auto-generate Classes and factory functions
5311
- for (let i=0; i<elements.length; i++) {
5312
- Classes[`ZikoUI${elements[i]}`] = class extends ZikoUIElement {
5313
- constructor() {
5314
- super(elements[i].toLowerCase());
5315
- this.style({ position: "relative" });
4419
+ static camel2pascalcase(text) {
4420
+ return text.charAt(0).toUpperCase() + text.slice(1);
5316
4421
  }
5317
- get [`is${elements[i]}`]() {
5318
- return true;
4422
+ static camel2constantcase(text) {
4423
+ return text.replace(/[A-Z]/g, match => '_' + match).toUpperCase();
5319
4424
  }
5320
- };
5321
-
5322
- Components[elements[i]] = (...children) =>
5323
- new Classes[`ZikoUI${elements[i]}`]().append(...children);
5324
- }
5325
-
5326
- const {
5327
- Main,
5328
- Header,
5329
- Nav,
5330
- Section,
5331
- Article,
5332
- Aside,
5333
- Footer
5334
- } = Components;
5335
-
5336
- const {
5337
- ZikoUIMain,
5338
- ZikoUIHeader,
5339
- ZikoUINav,
5340
- ZikoUISection,
5341
- ZikoUIArticle,
5342
- ZikoUIAside,
5343
- ZikoUIFooter
5344
- } = Classes;
5345
-
5346
- var Semantic = /*#__PURE__*/Object.freeze({
5347
- __proto__: null,
5348
- Article: Article,
5349
- Aside: Aside,
5350
- Footer: Footer,
5351
- Header: Header,
5352
- Main: Main,
5353
- Nav: Nav,
5354
- Section: Section,
5355
- ZikoUIArticle: ZikoUIArticle,
5356
- ZikoUIAside: ZikoUIAside,
5357
- ZikoUIFooter: ZikoUIFooter,
5358
- ZikoUIHeader: ZikoUIHeader,
5359
- ZikoUIMain: ZikoUIMain,
5360
- ZikoUINav: ZikoUINav,
5361
- ZikoUISection: ZikoUISection
5362
- });
5363
-
5364
- class ZikoUIGrid extends ZikoUIElement {
5365
- constructor(tag ="div", w = "50vw", h = "50vh") {
5366
- super(tag,"Grid");
5367
- this.direction = "cols";
5368
- if (typeof w == "number") w += "%";
5369
- if (typeof h == "number") h += "%";
5370
- this.style({ border: "1px solid black", width: w, height: h });
5371
- this.style({ display: "grid" });
5372
- // this.render();
4425
+ static pascal2snakecase(text) {
4426
+ return text.replace(/([A-Z])/g, (match, offset) => offset ? '_' + match.toLowerCase() : match.toLowerCase());
5373
4427
  }
5374
- get isGird(){
5375
- return true;
5376
- }
5377
- columns(n) {
5378
- let temp = "";
5379
- for (let i = 0; i < n; i++) temp = temp.concat(" auto");
5380
- this.#templateColumns(temp);
5381
- return this;
4428
+ static pascal2hyphencase(text) {
4429
+ return text.replace(/([A-Z])/g, (match, offset) => offset ? '-' + match.toLowerCase() : match.toLowerCase());
5382
4430
  }
5383
- #templateColumns(temp = "auto auto") {
5384
- this.style({ gridTemplateColumns: temp });
5385
- return this;
4431
+ static pascal2camelcase(text) {
4432
+ return text.charAt(0).toLowerCase() + text.slice(1);
5386
4433
  }
5387
- gap(w = 10, h = w) {
5388
- if(typeof (w) === "number")w += "px";
5389
- if(typeof (h) === "number")h += "px";
5390
- this.style({gridColumnGap: w,gridRowGap: h});
5391
- return this;
4434
+ static pascal2constantcase(text) {
4435
+ return text.replace(/([A-Z])/g, (match, offset) => offset ? '_' + match : match).toUpperCase();
5392
4436
  }
5393
- }
5394
- const Grid$1 = (...ZikoUIElement) => new ZikoUIGrid("div").append(...ZikoUIElement);
5395
-
5396
- var Grid$2 = /*#__PURE__*/Object.freeze({
5397
- __proto__: null,
5398
- Grid: Grid$1,
5399
- ZikoUIGrid: ZikoUIGrid
5400
- });
5401
-
5402
- const HTMLTags = [
5403
- 'a',
5404
- 'abb',
5405
- 'address',
5406
- 'area',
5407
- 'article',
5408
- 'aside',
5409
- 'audio',
5410
- 'b',
5411
- 'base',
5412
- 'bdi',
5413
- 'bdo',
5414
- 'blockquote',
5415
- 'br',
5416
- 'button',
5417
- 'canvas',
5418
- 'caption',
5419
- 'cite',
5420
- 'code',
5421
- 'col',
5422
- 'colgroup',
5423
- 'data',
5424
- 'datalist',
5425
- 'dd',
5426
- 'del',
5427
- 'details',
5428
- 'dfn',
5429
- 'dialog',
5430
- 'div',
5431
- 'dl',
5432
- 'dt',
5433
- 'em',
5434
- 'embed',
5435
- 'fieldset',
5436
- 'figcaption',
5437
- 'figure',
5438
- 'footer',
5439
- 'form',
5440
- 'h1',
5441
- 'h2',
5442
- 'h3',
5443
- 'h4',
5444
- 'h5',
5445
- 'h6',
5446
- 'header',
5447
- 'hgroup',
5448
- 'hr',
5449
- 'i',
5450
- 'iframe',
5451
- 'img',
5452
- 'ipnut',
5453
- 'ins',
5454
- 'kbd',
5455
- 'label',
5456
- 'legend',
5457
- 'li',
5458
- 'main',
5459
- 'map',
5460
- 'mark',
5461
- 'menu',
5462
- 'meter',
5463
- 'nav',
5464
- 'object',
5465
- 'ol',
5466
- 'optgroup',
5467
- 'option',
5468
- 'output',
5469
- 'p',
5470
- 'param',
5471
- 'picture',
5472
- 'pre',
5473
- 'progress',
5474
- 'q',
5475
- 'rp',
5476
- 'rt',
5477
- 'ruby',
5478
- 's',
5479
- 'samp',
5480
- 'search',
5481
- 'section',
5482
- 'select',
5483
- 'small',
5484
- 'source',
5485
- 'span',
5486
- 'strong',
5487
- 'sub',
5488
- 'summary',
5489
- 'sup',
5490
- 'svg',
5491
- 'table',
5492
- 'tbody',
5493
- 'td',
5494
- 'template',
5495
- 'textarea',
5496
- 'tfoot',
5497
- 'th',
5498
- 'thead',
5499
- 'time',
5500
- 'title',
5501
- 'tr',
5502
- 'track',
5503
- 'u',
5504
- 'ul',
5505
- 'var',
5506
- 'video',
5507
- 'wbr'
5508
- ];
5509
-
5510
- const SVGTags = [
5511
- "svg", "g", "defs", "symbol", "use", "image", "switch",
5512
- "rect", "circle", "ellipse", "line", "polyline", "polygon", "path",
5513
- "text", "tspan", "textPath", "altGlyph", "altGlyphDef", "altGlyphItem", "glyph", "glyphRef",
5514
- "linearGradient", "radialGradient", "pattern", "solidColor",
5515
- "filter", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix",
5516
- "feDiffuseLighting", "feDisplacementMap", "feDropShadow", "feFlood", "feFuncA", "feFuncR", "feFuncG", "feFuncB",
5517
- "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "feSpecularLighting",
5518
- "feTile", "feTurbulence",
5519
- "animate", "animateMotion", "animateTransform", "set",
5520
- "script",
5521
- "desc", "title", "metadata", "foreignObject"
5522
- ];
5523
-
5524
- const tags = new Proxy({}, {
5525
- get(target, prop) {
5526
- if (typeof prop !== 'string') return undefined;
5527
- let tag = prop.replaceAll("_","-").toLowerCase();
5528
- if(HTMLTags.includes(tag)) return (...args)=>{
5529
- if(!(args[0] instanceof ZikoUIElement) && args[0] instanceof Object){
5530
- let attributes = args.shift();
5531
- console.log(args);
5532
- return new ZikoUIElement(tag).setAttr(attributes).append(...args)
5533
- }
5534
- return new ZikoUIElement(tag).append(...args);
4437
+ static snake2camelcase(text) {
4438
+ return text.replace(/(_\w)/g, match => match[1].toUpperCase());
5535
4439
  }
5536
- if(SVGTags.includes(tag)) return (...args)=>new ZikoUIElement(tag,"",{el_type : "svg"}).append(...args);
5537
- return (...args)=>{
5538
- if(!(args[0] instanceof ZikoUIElement) && args[0] instanceof Object){
5539
- let attributes = args.shift();
5540
- return new ZikoUIElement(tag).setAttr(attributes).append(...args)
5541
- }
5542
- return new ZikoUIElement(tag).append(...args);
4440
+ static snake2hyphencase(text) {
4441
+ return text.replace(/_/g, "-");
5543
4442
  }
5544
- // switch(tag){
5545
- // case "html" : globalThis?.document?.createElement("html")
5546
- // case "head" :
5547
- // case "style" :
5548
- // case "link" :
5549
- // case "meta" :
5550
- // case "srcipt":
5551
- // case "body" : return null; break;
5552
- // default : return new ZikoUIElement(tag);
5553
- // }
5554
- }
5555
- });
5556
-
5557
- const UI$1 = {
5558
- ...Text$1,
5559
- ...List,
5560
- ...Io,
5561
- ...Media,
5562
- ...Table,
5563
- ...Semantic,
5564
- ...Misc,
5565
- ...Flex$1,
5566
- ...Grid$2,
5567
- ZikoUIElement,
5568
- };
4443
+ static snake2pascalcase(text) {
4444
+ return text.split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
4445
+ }
4446
+ static snake2constantcase(text) {
4447
+ return text.toUpperCase();
4448
+ }
4449
+ static hyphen2camelcase(text) {
4450
+ return text.replace(/-([a-z])/g, match => match[1].toUpperCase());
4451
+ }
4452
+ static hyphen2snakecase(text) {
4453
+ return text.replace(/-/g, '_');
4454
+ }
4455
+ static hyphen2pascalcase(text) {
4456
+ return text.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
4457
+ }
4458
+ static hyphen2constantcase(text) {
4459
+ return text.replace(/-/g, '_').toUpperCase();
4460
+ }
4461
+ static constant2camelcase(text) {
4462
+ return text.toLowerCase().replace(/_([a-z])/g, match => match[1].toUpperCase());
4463
+ }
4464
+ static constant2snakecase(text) {
4465
+ return text.toLowerCase();
4466
+ }
4467
+ static constant2pascalcase(text) {
4468
+ return text.toLowerCase().split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
4469
+ }
4470
+ static constant2hyphencase(text) {
4471
+ return text.toLowerCase().replace(/_/g, '-');
4472
+ }
4473
+ }
4474
+ const removeExtraSpace=str=>str.replace(/\s+/g,' ');
4475
+ const count=(str,value)=>str.split("").filter(x => x==value).length;
4476
+ const countWords=(str,value)=>str.split(" ").filter(x => x==value).length;
4477
+ const str=string=>new Str(string);
5569
4478
 
5570
- const svg2str=svg=>(new XMLSerializer()).serializeToString(svg);
5571
- const svg2ascii=svg=>btoa(svg2str(svg));
5572
- const svg2imgUrl=svg=>'data:image/svg+xml;base64,'+svg2ascii(svg);
5573
- const svg2img=(svg,render=true)=>image(svg2imgUrl(svg)).render(render);
5574
-
5575
- // const obj2str=(object)=>{
5576
- // const recursiveToString = (obj) => {
5577
- // if (Array.isArray(obj)) return arr2str(obj);
5578
- // if (typeof obj === 'object' && obj !== null) {
5579
- // return `{ ${Object.entries(obj)
5580
- // .map(([key, value]) => `${key}:${recursiveToString(value)}`)
5581
- // .join(" , ")} }`;
5582
- // }
5583
- // return String(obj);
5584
- // };
5585
- // return recursiveToString(object);
5586
- // };
5587
- // const obj2str = (object) => {
5588
- // const recursiveToString = (obj, indentLevel = 0) => {
5589
- // const indent = ' '.repeat(indentLevel);
5590
- // const nextIndent = ' '.repeat(indentLevel + 1);
5591
- // if(Array.isArray(obj)) return arr2str(obj, indentLevel);
5592
- // if(obj instanceof Complex || obj instanceof Matrix) return obj.toString();
5593
- // if (typeof obj === 'object' && obj !== null) {
5594
- // const entries = Object.entries(obj)
5595
- // .map(([key, value]) => `${nextIndent}${key}: ${recursiveToString(value, indentLevel + 1)}`)
5596
- // .join(",\n");
5597
-
5598
- // return `{\n${entries}\n${indent}}`;
5599
- // }
5600
-
5601
- // return String(obj);
5602
- // };
5603
-
5604
- // return recursiveToString(object);
5605
- // };
5606
- // const obj2str = (object, useIndentation = true, indentLevel = 0) => {
5607
- // const recursiveToString = (obj, level = 0) => {
5608
- // const indent = useIndentation ? ' '.repeat(level) : '';
5609
- // const nextIndent = useIndentation ? ' '.repeat(level + 1) : '';
5610
- // if (Array.isArray(obj)) return arr2str(obj, false, level);
5611
- // if(obj instanceof Complex || obj instanceof Matrix) return obj.toString();
5612
- // if (typeof obj === 'object' && obj !== null) {
5613
- // const entries = Object.entries(obj)
5614
- // .map(([key, value]) => useIndentation
5615
- // ? `${nextIndent}${key}: ${recursiveToString(value, level + 1)}`
5616
- // : `${key}: ${recursiveToString(value, level + 1)}`
5617
- // ).join(useIndentation ? ",\n" : ", ");
5618
-
5619
- // return useIndentation
5620
- // ? `{\n${entries}\n${indent}}`
5621
- // : `{${entries}}`;
5622
- // }
5623
-
5624
- // return String(obj);
5625
- // };
5626
-
5627
- // return recursiveToString(object, indentLevel);
5628
- // };
5629
-
5630
- const obj2str=(obj)=>JSON.stringify(
5631
- mapfun$1(n=>{
5632
- if(["number","string","boolean","bigint"].includes(typeof n)) return String(n);
5633
- if(n instanceof Complex || n instanceof Matrix) return n.toString();
5634
- if(n instanceof Array) return arr2str(n)
5635
- },
5636
- obj), null, " ")
5637
- .replace(/"([^"]+)":/g, '$1:') // Remove Quotes from Keys
5638
- .replace(/: "([^"]+)"/g, ': $1'); // Remove Quotes from str values
5639
-
5640
- const getMaxDepth = arr=> {
5641
- if (!Array.isArray(arr)) return 0;
5642
- let maxDepth = 1;
5643
- for (const element of arr) {
5644
- if (Array.isArray(element)) {
5645
- const depth = getMaxDepth(element);
5646
- if (depth + 1 > maxDepth) {
5647
- maxDepth = depth + 1;
5648
- }
5649
- }
5650
- }
5651
- return maxDepth;
5652
- };
5653
- const arr2str = (arr) => {
5654
- let level = 0;
5655
- function arrStringify(arr) {
5656
- let max = getMaxDepth(arr);
5657
- let useIdentation = 0;
5658
- if (arr.some((n) => Array.isArray(n))) {
5659
- level++;
5660
- useIdentation = 1;
5661
- }
5662
- return (
5663
- "[" +
5664
- arr.map((n, i) => {
5665
- if (["number", "string", "boolean", "bigint"].includes(typeof n))
5666
- return String(n);
5667
- if (n instanceof Complex) return n.toString();
5668
- if (n instanceof Array) {
5669
- return `\n${" ".repeat(level)}${arrStringify(n)}${i === arr.length - 1 ? "\n" : ""}`;
4479
+ class Matrix extends ZikoMath{
4480
+ constructor(rows, cols, element = [] ) {
4481
+ super();
4482
+ if(rows instanceof Matrix){
4483
+ this.arr=rows.arr;
4484
+ this.rows=rows.rows;
4485
+ this.cols=rows.cols;
5670
4486
  }
5671
- if( n instanceof Object) return obj2str(n);
5672
- })
5673
- + `${" ".repeat((max+level+1) * useIdentation)}]`
5674
- );
5675
- }
5676
- return arrStringify(arr);
5677
- };
5678
-
5679
- const json2css=(json, indentLevel = 0)=>{
5680
- json = trimKeys(json);
5681
- let cssText = '';
5682
- const indent = ' '.repeat(indentLevel);
5683
-
5684
- for (let selector in json) {
5685
- if (typeof json[selector] === 'object') {
5686
- cssText += `${indent}${selector} {\n`;
5687
- const properties = json[selector];
5688
- for (let property in properties) {
5689
- if (typeof properties[property] === 'object') {
5690
- cssText += json2css({ [property]: properties[property] }, indentLevel + 1);
5691
- } else {
5692
- cssText += `${indent} ${property.replace(/[A-Z]/g, match => '-' + match.toLowerCase())}: ${properties[property]};\n`;
4487
+ else {
4488
+ let arr = [],
4489
+ i,
4490
+ j;
4491
+ if (arguments[0] instanceof Array) {
4492
+ rows = arguments[0].length;
4493
+ cols = arguments[0][0].length;
4494
+ arr = arguments[0];
4495
+ } else {
4496
+ for (i = 0; i < rows; i++) {
4497
+ arr.push([]);
4498
+ arr[i].push(new Array(cols));
4499
+ for (j = 0; j < cols; j++) {
4500
+ arr[i][j] = element[i * cols + j];
4501
+ if (element[i * cols + j] == undefined) arr[i][j] = 0;
5693
4502
  }
5694
4503
  }
5695
-
5696
- cssText += `${indent}}\n`;
5697
4504
  }
4505
+ this.rows = rows;
4506
+ this.cols = cols;
4507
+ this.arr = arr;
5698
4508
  }
5699
-
5700
- return cssText;
5701
- };
5702
- function trimKeys(obj) {
5703
- if (typeof obj !== 'object' || obj === null) {
5704
- return obj;
4509
+ this.#maintain();
4510
+ //Object.seal(this);
5705
4511
  }
5706
-
5707
- return Object.keys(obj).reduce((acc, key) => {
5708
- const trimmedKey = key.trim();
5709
- acc[trimmedKey] = trimKeys(obj[key]);
5710
- return acc;
5711
- }, Array.isArray(obj) ? [] : {});
5712
- }
5713
-
5714
- // export { markdown2html } from "./markdown.js";
5715
- // export { adoc2html } from "./adoc.js";
5716
-
5717
- var Converter = /*#__PURE__*/Object.freeze({
5718
- __proto__: null,
5719
- arr2str: arr2str,
5720
- csv2arr: csv2arr,
5721
- csv2json: csv2json,
5722
- csv2matrix: csv2matrix,
5723
- csv2object: csv2object,
5724
- csv2sql: csv2sql,
5725
- json2arr: json2arr,
5726
- json2css: json2css,
5727
- json2csv: json2csv,
5728
- json2csvFile: json2csvFile,
5729
- json2xml: json2xml,
5730
- json2xmlFile: json2xmlFile,
5731
- json2yml: json2yml,
5732
- json2ymlFile: json2ymlFile,
5733
- obj2str: obj2str,
5734
- svg2ascii: svg2ascii,
5735
- svg2img: svg2img,
5736
- svg2imgUrl: svg2imgUrl,
5737
- svg2str: svg2str
5738
- });
5739
-
5740
- var Parser = /*#__PURE__*/Object.freeze({
5741
- __proto__: null
5742
- });
5743
-
5744
- const Patterns={
5745
- isDigit: /^\d+$/,
5746
- isURL: /^(https?:\/\/)?([\w\-]+\.)+[\w\-]+(\/[\w\-./?%&=]*)?$/,
5747
- isHexColor: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,
5748
- isIPv4: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
5749
- isMACAddress: /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/,
5750
- isDate: /^\d{4}-\d{2}-\d{2}$/,
5751
- };
5752
-
5753
- class Str{
5754
- constructor(string){
5755
- this.string=string;
4512
+ toString(){
4513
+ return arr2str(this.arr);
5756
4514
  }
5757
- isDigit() {
5758
- return Patterns.isDigit.test(this.string);
4515
+ at(i=0,j=undefined){
4516
+ if(i<0)i=this.rows+i;
4517
+ if(j==undefined) return this.arr[i];
4518
+ if(j<0)j=this.cols+j;
4519
+ return this.arr[i][j];
5759
4520
  }
5760
- static isDigit(string){
5761
- return new Str(string).isDigit();
4521
+ reshape(newRows, newCols) {
4522
+ let check = newRows * newCols === this.rows * this.cols;
4523
+ if (check) return new Matrix(newRows, newCols, this.arr.flat(1));
4524
+ else console.error("Err");
5762
4525
  }
5763
- isNumber() {
5764
- return !isNaN(this.string);
4526
+ static eye(size) {
4527
+ let result = new Matrix(size, size);
4528
+ for (let i = 0; i < size; i++) for (let j = 0; j < size; j++) i === j ? (result.arr[i][j] = 1) : (result.arr[i][j] = 0);
4529
+ return result;
5765
4530
  }
5766
- static isNumber(string){
5767
- return new Str(string).isNumber();
4531
+ get clone() {
4532
+ return new Matrix(this.rows, this.cols, this.arr.flat(1));
5768
4533
  }
5769
- isUrl(){
5770
- return Patterns.isURL.test(this.string);
4534
+ get size() {
4535
+ return this.rows * this.cols;
4536
+ }
4537
+ get shape() {
4538
+ return [this.rows, this.cols];
5771
4539
  }
5772
- static isUrl(string){
5773
- return new Str(string).isUrl();
4540
+ get reel() {
4541
+ return new Matrix(this.cols, this.rows, this.arr.flat(1).reel);
5774
4542
  }
5775
- isHexColor(){
5776
- return Patterns.isHexColor.test(this.string);
4543
+ get imag() {
4544
+ return new Matrix(this.cols, this.rows, this.arr.flat(1).imag);
5777
4545
  }
5778
- static isHexColor(string){
5779
- return new Str(string).isHexColor();
4546
+ [Symbol.iterator]() {
4547
+ return this.arr[Symbol.iterator]();
5780
4548
  }
5781
- isIPv4(){
5782
- return Patterns.isIPv4.test(this.string);
4549
+ #maintain() {
4550
+ for (let i = 0; i < this.arr.length; i++) {
4551
+ Object.defineProperty(this, i, {
4552
+ value: this.arr[i],
4553
+ writable: true,
4554
+ configurable: true,
4555
+ enumerable: false
4556
+ });
4557
+ }
5783
4558
  }
5784
- static isIPv4(string){
5785
- return new Str(string).isIPv4();
4559
+ get(row = 0, col = 0) {
4560
+ if (col == -1) return this.arr[row];
4561
+ else if (row == -1) return this.arr.map((n) => n[col]);
4562
+ else return this.arr[row][col];
5786
4563
  }
5787
- isDate(){
5788
- return Patterns.isDate.test(this.string);
4564
+ set(row = 0, col = 0, value) {
4565
+ if (col == -1) return (this.arr[row] = value);
4566
+ else if (row == -1) {
4567
+ for (let i = 0; i < this.cols; i++) {
4568
+ this.arr[i][col] = value[i] || 0;
4569
+ }
4570
+ return this.arr;
4571
+ }
4572
+ return (this.arr[row][col] = value);
5789
4573
  }
5790
- static isDate(string){
5791
- return new Str(string).isDate();
5792
- }
5793
- isMACAddress(){
5794
- return Patterns.isMACAddress.test(this.string);
5795
- }
5796
- static isMACAddress(string){
5797
- return new Str(string).isMACAddress();
5798
- }
5799
- isPascalCase(){
5800
- if (this.string.length === 0) return false;
5801
- const PascalCasePattern = /^[A-Z][a-zA-Z0-9]*$/;
5802
- return PascalCasePattern.test(this.string);
5803
- }
5804
- static isPascalCase(string){
5805
- return new Str(string).isPascalCase();
5806
- }
5807
- isCamelCase() {
5808
- if (this.string.length === 0) return false;
5809
- const camelCasePattern = /^[a-z][a-zA-Z0-9]*$/;
5810
- return camelCasePattern.test(this.string);
5811
- }
5812
- static isCamelCase(string){
5813
- return new Str(string).isCamelCase();
5814
- }
5815
- isHyphenCase(){
5816
- return this.string.split('-').length > 1;
5817
- }
5818
- static isHyphenCase(string){
5819
- return new Str(string).isHyphenCase();
5820
- }
5821
- isSnakeCase(){
5822
- return this.string.split('_').length > 1;
5823
- }
5824
- static isSnakeCase(string){
5825
- return new Str(string).isSnakeCase();
5826
- }
5827
- isPalindrome(){
5828
- const str=this.string.toLocaleLowerCase();
5829
- let l=str.length,i;
5830
- for(i=0;i<l/2;i++)if(str[i]!=str[l-i-1])return false;
5831
- return true;
5832
- }
5833
- static isPalindrome(string){
5834
- return new Str(string).isPalindrome();
5835
- }
5836
- static isAnagrams(word,words){
5837
- word=word.split("").sort();
5838
- words=words.split("").sort();
5839
- return JSON.stringify(word)===JSON.stringify(words);
5840
- }
5841
- isIsogram(){
5842
- return [...new Set(this.string.toLowerCase())].length===this.string.length;
5843
- }
5844
- static isIsogram(string){
5845
- return new Str(string).isIsogram();
5846
- }
5847
- static camel2hyphencase(text) {
5848
- return text.replace(/[A-Z]/g, match => '-' + match.toLowerCase());
5849
- }
5850
- static camel2snakecase(text) {
5851
- return text.replace(/[A-Z]/g, match => '_' + match.toLowerCase());
5852
- }
5853
- static camel2pascalcase(text) {
5854
- return text.charAt(0).toUpperCase() + text.slice(1);
5855
- }
5856
- static camel2constantcase(text) {
5857
- return text.replace(/[A-Z]/g, match => '_' + match).toUpperCase();
5858
- }
5859
- static pascal2snakecase(text) {
5860
- return text.replace(/([A-Z])/g, (match, offset) => offset ? '_' + match.toLowerCase() : match.toLowerCase());
5861
- }
5862
- static pascal2hyphencase(text) {
5863
- return text.replace(/([A-Z])/g, (match, offset) => offset ? '-' + match.toLowerCase() : match.toLowerCase());
5864
- }
5865
- static pascal2camelcase(text) {
5866
- return text.charAt(0).toLowerCase() + text.slice(1);
5867
- }
5868
- static pascal2constantcase(text) {
5869
- return text.replace(/([A-Z])/g, (match, offset) => offset ? '_' + match : match).toUpperCase();
5870
- }
5871
- static snake2camelcase(text) {
5872
- return text.replace(/(_\w)/g, match => match[1].toUpperCase());
5873
- }
5874
- static snake2hyphencase(text) {
5875
- return text.replace(/_/g, "-");
5876
- }
5877
- static snake2pascalcase(text) {
5878
- return text.split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
5879
- }
5880
- static snake2constantcase(text) {
5881
- return text.toUpperCase();
5882
- }
5883
- static hyphen2camelcase(text) {
5884
- return text.replace(/-([a-z])/g, match => match[1].toUpperCase());
5885
- }
5886
- static hyphen2snakecase(text) {
5887
- return text.replace(/-/g, '_');
5888
- }
5889
- static hyphen2pascalcase(text) {
5890
- return text.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
5891
- }
5892
- static hyphen2constantcase(text) {
5893
- return text.replace(/-/g, '_').toUpperCase();
5894
- }
5895
- static constant2camelcase(text) {
5896
- return text.toLowerCase().replace(/_([a-z])/g, match => match[1].toUpperCase());
5897
- }
5898
- static constant2snakecase(text) {
5899
- return text.toLowerCase();
5900
- }
5901
- static constant2pascalcase(text) {
5902
- return text.toLowerCase().split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
5903
- }
5904
- static constant2hyphencase(text) {
5905
- return text.toLowerCase().replace(/_/g, '-');
5906
- }
5907
- }
5908
- const removeExtraSpace=str=>str.replace(/\s+/g,' ');
5909
- const count=(str,value)=>str.split("").filter(x => x==value).length;
5910
- const countWords=(str,value)=>str.split(" ").filter(x => x==value).length;
5911
- const str=string=>new Str(string);
5912
-
5913
- var String$1 = /*#__PURE__*/Object.freeze({
5914
- __proto__: null,
5915
- Str: Str,
5916
- count: count,
5917
- countWords: countWords,
5918
- removeExtraSpace: removeExtraSpace,
5919
- str: str
5920
- });
5921
-
5922
- const Data = {
5923
- ...Api,
5924
- ...Converter,
5925
- ...Parser,
5926
- ...String$1
5927
- };
5928
-
5929
- class Matrix extends ZikoMath{
5930
- constructor(rows, cols, element = [] ) {
5931
- super();
5932
- if(rows instanceof Matrix){
5933
- this.arr=rows.arr;
5934
- this.rows=rows.rows;
5935
- this.cols=rows.cols;
5936
- }
5937
- else {
5938
- let arr = [],
5939
- i,
5940
- j;
5941
- if (arguments[0] instanceof Array) {
5942
- rows = arguments[0].length;
5943
- cols = arguments[0][0].length;
5944
- arr = arguments[0];
5945
- } else {
5946
- for (i = 0; i < rows; i++) {
5947
- arr.push([]);
5948
- arr[i].push(new Array(cols));
5949
- for (j = 0; j < cols; j++) {
5950
- arr[i][j] = element[i * cols + j];
5951
- if (element[i * cols + j] == undefined) arr[i][j] = 0;
5952
- }
5953
- }
5954
- }
5955
- this.rows = rows;
5956
- this.cols = cols;
5957
- this.arr = arr;
5958
- }
5959
- this.#maintain();
5960
- //Object.seal(this);
5961
- }
5962
- toString(){
5963
- return arr2str(this.arr);
5964
- }
5965
- at(i=0,j=undefined){
5966
- if(i<0)i=this.rows+i;
5967
- if(j==undefined) return this.arr[i];
5968
- if(j<0)j=this.cols+j;
5969
- return this.arr[i][j];
5970
- }
5971
- reshape(newRows, newCols) {
5972
- let check = newRows * newCols === this.rows * this.cols;
5973
- if (check) return new Matrix(newRows, newCols, this.arr.flat(1));
5974
- else console.error("Err");
5975
- }
5976
- static eye(size) {
5977
- let result = new Matrix(size, size);
5978
- for (let i = 0; i < size; i++) for (let j = 0; j < size; j++) i === j ? (result.arr[i][j] = 1) : (result.arr[i][j] = 0);
5979
- return result;
5980
- }
5981
- get clone() {
5982
- return new Matrix(this.rows, this.cols, this.arr.flat(1));
5983
- }
5984
- get size() {
5985
- return this.rows * this.cols;
5986
- }
5987
- get shape() {
5988
- return [this.rows, this.cols];
5989
- }
5990
- get reel() {
5991
- return new Matrix(this.cols, this.rows, this.arr.flat(1).reel);
5992
- }
5993
- get imag() {
5994
- return new Matrix(this.cols, this.rows, this.arr.flat(1).imag);
5995
- }
5996
- [Symbol.iterator]() {
5997
- return this.arr[Symbol.iterator]();
5998
- }
5999
- #maintain() {
6000
- for (let i = 0; i < this.arr.length; i++) {
6001
- Object.defineProperty(this, i, {
6002
- value: this.arr[i],
6003
- writable: true,
6004
- configurable: true,
6005
- enumerable: false
6006
- });
6007
- }
6008
- }
6009
- get(row = 0, col = 0) {
6010
- if (col == -1) return this.arr[row];
6011
- else if (row == -1) return this.arr.map((n) => n[col]);
6012
- else return this.arr[row][col];
6013
- }
6014
- set(row = 0, col = 0, value) {
6015
- if (col == -1) return (this.arr[row] = value);
6016
- else if (row == -1) {
6017
- for (let i = 0; i < this.cols; i++) {
6018
- this.arr[i][col] = value[i] || 0;
6019
- }
6020
- return this.arr;
6021
- }
6022
- return (this.arr[row][col] = value);
6023
- }
6024
- get isSquare() {
6025
- return this.rows / this.cols === 1;
4574
+ get isSquare() {
4575
+ return this.rows / this.cols === 1;
6026
4576
  }
6027
4577
  get isSym() {
6028
4578
  if (!this.isSquare) return false;
@@ -6073,7 +4623,7 @@ class Matrix extends ZikoMath{
6073
4623
  console.warn("Tensors are not completely supported yet ...");
6074
4624
  return;
6075
4625
  }
6076
- return Utils$1.sub(Utils$1.mul(M[0][0],M[1][1]),Utils$1.mul(M[0][1],M[1][0]))
4626
+ return Utils.sub(Utils.mul(M[0][0],M[1][1]),Utils.mul(M[0][1],M[1][0]))
6077
4627
  }
6078
4628
  var answer = 0;
6079
4629
  for (var i = 0; i < M.length; i++) {
@@ -6084,8 +4634,8 @@ class Matrix extends ZikoMath{
6084
4634
  .mul(determinat(deleteRowAndColumn(M, i)))
6085
4635
  );*/
6086
4636
  //const to_be_added=Utils.add(Utils.mul(pow(-1, i),Utils.mul(M[0][i],determinat(deleteRowAndColumn(M, i)))));
6087
- const to_be_added=Utils$1.add(Utils$1.mul(pow(-1, i),Utils$1.mul(M[0][i],determinat(deleteRowAndColumn(M, i)))));
6088
- answer=Utils$1.add(answer,to_be_added);
4637
+ const to_be_added=Utils.add(Utils.mul(pow(-1, i),Utils.mul(M[0][i],determinat(deleteRowAndColumn(M, i)))));
4638
+ answer=Utils.add(answer,to_be_added);
6089
4639
  }
6090
4640
  return answer;
6091
4641
  }
@@ -6156,28 +4706,28 @@ class Matrix extends ZikoMath{
6156
4706
  return result;
6157
4707
  }
6158
4708
  map(Imin, Imax, Fmin, Fmax) {
6159
- return Utils$1.map(this, Imin, Imax, Fmin, Fmax);
4709
+ return Utils.map(this, Imin, Imax, Fmin, Fmax);
6160
4710
  }
6161
4711
  lerp(min, max) {
6162
- return Utils$1.lerp(this, min, max);
4712
+ return Utils.lerp(this, min, max);
6163
4713
  }
6164
4714
  norm(min, max) {
6165
- return Utils$1.norm(this, min, max);
4715
+ return Utils.norm(this, min, max);
6166
4716
  }
6167
4717
  clamp(min, max) {
6168
- return Utils$1.clamp(this, min, max);
4718
+ return Utils.clamp(this, min, max);
6169
4719
  }
6170
4720
  static map(matrix, Imin, Imax, Fmin, Fmax) {
6171
- return Utils$1.map(matrix, Imin, Imax, Fmin, Fmax);
4721
+ return Utils.map(matrix, Imin, Imax, Fmin, Fmax);
6172
4722
  }
6173
4723
  static lerp(matrix, min, max) {
6174
- return Utils$1.lerp(matrix, min, max);
4724
+ return Utils.lerp(matrix, min, max);
6175
4725
  }
6176
4726
  static norm(matrix, min, max) {
6177
- return Utils$1.norm(matrix, min, max);
4727
+ return Utils.norm(matrix, min, max);
6178
4728
  }
6179
4729
  static clamp(m, min, max) {
6180
- return Utils$1.clamp(matrix, min, max);
4730
+ return Utils.clamp(matrix, min, max);
6181
4731
  }
6182
4732
  toPrecision(p) {
6183
4733
  for (let i = 0; i < this.cols; i++) for (let j = 0; j < this.rows; j++) this.arr[i][j] = +this.arr[i][j].toPrecision(p);
@@ -6318,14 +4868,14 @@ class Matrix extends ZikoMath{
6318
4868
  add(...matr) {
6319
4869
  for (let k = 0; k < matr.length; k++) {
6320
4870
  if (typeof matr[k] == "number"||matr[k] instanceof Complex) matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
6321
- for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = Utils$1.add(this.arr[i][j],matr[k].arr[i][j]);
4871
+ for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = Utils.add(this.arr[i][j],matr[k].arr[i][j]);
6322
4872
  }
6323
4873
  return new Matrix(this.rows, this.cols, this.arr.flat(1));
6324
4874
  }
6325
4875
  sub(...matr) {
6326
4876
  for (let k = 0; k < matr.length; k++) {
6327
4877
  if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
6328
- for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = Utils$1.sub(this.arr[i][j],matr[k].arr[i][j]);
4878
+ for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = Utils.sub(this.arr[i][j],matr[k].arr[i][j]);
6329
4879
  }
6330
4880
  return new Matrix(this.rows, this.cols, this.arr.flat(1));
6331
4881
  }
@@ -6338,14 +4888,14 @@ class Matrix extends ZikoMath{
6338
4888
  mul(...matr) {
6339
4889
  for (let k = 0; k < matr.length; k++) {
6340
4890
  if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
6341
- for (var i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = Utils$1.mul(this.arr[i][j],matr[k].arr[i][j]);
4891
+ for (var i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = Utils.mul(this.arr[i][j],matr[k].arr[i][j]);
6342
4892
  }
6343
4893
  return new Matrix(this.rows, this.cols, this.arr.flat(1));
6344
4894
  }
6345
4895
  div(...matr) {
6346
4896
  for (let k = 0; k < matr.length; k++) {
6347
4897
  if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
6348
- for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = Utils$1.div(this.arr[i][j],matr[k].arr[i][j]);
4898
+ for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = Utils.div(this.arr[i][j],matr[k].arr[i][j]);
6349
4899
  }
6350
4900
  return new Matrix(this.rows, this.cols, this.arr.flat(1));
6351
4901
  }
@@ -6358,7 +4908,7 @@ class Matrix extends ZikoMath{
6358
4908
  modulo(...matr) {
6359
4909
  for (let k = 0; k < matr.length; k++) {
6360
4910
  if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
6361
- for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++)this.arr[i][j]=Utils$1.modulo(this.arr[i][j],matr[k].arr[i][j]);
4911
+ for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++)this.arr[i][j]=Utils.modulo(this.arr[i][j],matr[k].arr[i][j]);
6362
4912
  }
6363
4913
  return new Matrix(this.rows, this.cols, this.arr.flat(1));
6364
4914
  }
@@ -6372,9 +4922,9 @@ class Matrix extends ZikoMath{
6372
4922
  for (var j = 0; j < matrix.arr[0].length; j++) {
6373
4923
  res[i][j] = 0;
6374
4924
  for (var k = 0; k < this.arr[0].length; k++) {
6375
- res[i][j] = Utils$1.add(
4925
+ res[i][j] = Utils.add(
6376
4926
  res[i][j],
6377
- Utils$1.mul(this.arr[i][k],matrix.arr[k][j])
4927
+ Utils.mul(this.arr[i][k],matrix.arr[k][j])
6378
4928
  );
6379
4929
  }
6380
4930
  }
@@ -6593,15 +5143,6 @@ const matrix2=(...element)=>new Matrix(2, 2, element);
6593
5143
  const matrix3=(...element)=>new Matrix(3, 3, element);
6594
5144
  const matrix4=(...element)=>new Matrix(4, 4, element);
6595
5145
 
6596
- var __Matrix__ = /*#__PURE__*/Object.freeze({
6597
- __proto__: null,
6598
- Matrix: Matrix,
6599
- matrix: matrix,
6600
- matrix2: matrix2,
6601
- matrix3: matrix3,
6602
- matrix4: matrix4
6603
- });
6604
-
6605
5146
  class Complex extends ZikoMath{
6606
5147
  constructor(a = 0, b = 0) {
6607
5148
  super();
@@ -6640,6 +5181,9 @@ class Complex extends ZikoMath{
6640
5181
  this.b = +b.toFixed(32);
6641
5182
  }
6642
5183
  }
5184
+ isComplex(){
5185
+ return true
5186
+ }
6643
5187
  toString(){
6644
5188
  let str = "";
6645
5189
  if (this.a !== 0)
@@ -6788,12 +5332,6 @@ const complex=(a,b)=>{
6788
5332
  return new Complex(a,b)
6789
5333
  };
6790
5334
 
6791
- var __Complex__ = /*#__PURE__*/Object.freeze({
6792
- __proto__: null,
6793
- Complex: Complex,
6794
- complex: complex
6795
- });
6796
-
6797
5335
  // import {
6798
5336
  // gamma,
6799
5337
  // bessel,
@@ -6847,29 +5385,29 @@ const sqrtn=(x,n)=>{
6847
5385
  }
6848
5386
  }
6849
5387
  };
6850
- const e=(...x)=>mapfun$1(Math.exp,...x);
6851
- const ln=(...x)=>mapfun$1(Math.log,...x);
6852
- const cos=(...x)=>mapfun$1(Fixed.cos,...x);
6853
- const sin=(...x)=>mapfun$1(Fixed.sin,...x);
6854
- const tan=(...x)=>mapfun$1(Fixed.tan,...x);
6855
- const sec=(...x)=>mapfun$1(Fixed.sec,...x);
6856
- const sinc=(...x)=>mapfun$1(Fixed.sinc,...x);
6857
- const csc=(...x)=>mapfun$1(Fixed.csc,...x);
6858
- const cot=(...x)=>mapfun$1(Fixed.cot,...x);
6859
- const acos=(...x)=>mapfun$1(Fixed.acos,...x);
6860
- const asin=(...x)=>mapfun$1(Fixed.asin,...x);
6861
- const atan=(...x)=>mapfun$1(Fixed.atan,...x);
6862
- const acot=(...x)=>mapfun$1(Fixed.acot,...x);
6863
- const cosh=(...x)=>mapfun$1(Fixed.cosh,...x);
6864
- const sinh=(...x)=>mapfun$1(Fixed.sinh,...x);
6865
- const tanh=(...x)=>mapfun$1(Fixed.tanh,...x);
6866
- const coth=(...x)=>mapfun$1(Fixed.coth,...x);
6867
- const acosh=(...x)=>mapfun$1(Fixed.acosh,...x);
6868
- const asinh=(...x)=>mapfun$1(Fixed.asinh,...x);
6869
- const atanh=(...x)=>mapfun$1(Fixed.atanh,...x);
6870
- const ceil=(...x)=>mapfun$1(Math.ceil,...x);
6871
- const floor=(...x)=>mapfun$1(Math.floor,...x);
6872
- const round=(...x)=>mapfun$1(Math.round,...x);
5388
+ const e=(...x) => mapfun$1(Math.exp,...x);
5389
+ const ln=(...x) => mapfun$1(Math.log,...x);
5390
+ const cos=(...x) => mapfun$1(Fixed.cos,...x);
5391
+ const sin=(...x) => mapfun$1(Fixed.sin,...x);
5392
+ const tan=(...x) => mapfun$1(Fixed.tan,...x);
5393
+ const sec=(...x) => mapfun$1(Fixed.sec,...x);
5394
+ const sinc=(...x) => mapfun$1(Fixed.sinc,...x);
5395
+ const csc=(...x) => mapfun$1(Fixed.csc,...x);
5396
+ const cot=(...x) => mapfun$1(Fixed.cot,...x);
5397
+ const acos=(...x) => mapfun$1(Fixed.acos,...x);
5398
+ const asin=(...x) => mapfun$1(Fixed.asin,...x);
5399
+ const atan=(...x) => mapfun$1(Fixed.atan,...x);
5400
+ const acot=(...x) => mapfun$1(Fixed.acot,...x);
5401
+ const cosh=(...x) => mapfun$1(Fixed.cosh,...x);
5402
+ const sinh=(...x) => mapfun$1(Fixed.sinh,...x);
5403
+ const tanh=(...x) => mapfun$1(Fixed.tanh,...x);
5404
+ const coth=(...x) => mapfun$1(Fixed.coth,...x);
5405
+ const acosh=(...x) => mapfun$1(Fixed.acosh,...x);
5406
+ const asinh=(...x) => mapfun$1(Fixed.asinh,...x);
5407
+ const atanh=(...x) => mapfun$1(Fixed.atanh,...x);
5408
+ const ceil=(...x) => mapfun$1(Math.ceil,...x);
5409
+ const floor=(...x) => mapfun$1(Math.floor,...x);
5410
+ const round=(...x) => mapfun$1(Math.round,...x);
6873
5411
  const atan2=(x,y,rad=true)=>{
6874
5412
  if(typeof x === "number"){
6875
5413
  if(typeof y === "number")return rad?Math.atan2(x,y):Math.atan2(x,y)*180/Math.PI;
@@ -6910,54 +5448,6 @@ const hypot=(...x)=>{
6910
5448
  )
6911
5449
  };
6912
5450
 
6913
- var __Functions__ = /*#__PURE__*/Object.freeze({
6914
- __proto__: null,
6915
- abs: abs,
6916
- acos: acos,
6917
- acosh: acosh,
6918
- acot: acot,
6919
- asin: asin,
6920
- asinh: asinh,
6921
- atan: atan,
6922
- atan2: atan2,
6923
- atanh: atanh,
6924
- ceil: ceil,
6925
- cos: cos,
6926
- cosh: cosh,
6927
- cot: cot,
6928
- coth: coth,
6929
- csc: csc,
6930
- e: e,
6931
- fact: fact,
6932
- floor: floor,
6933
- hypot: hypot,
6934
- ln: ln,
6935
- max: max,
6936
- min: min,
6937
- pow: pow,
6938
- round: round,
6939
- sec: sec,
6940
- sig: sig,
6941
- sign: sign,
6942
- sin: sin,
6943
- sinc: sinc,
6944
- sinh: sinh,
6945
- sqrt: sqrt,
6946
- sqrtn: sqrtn,
6947
- tan: tan,
6948
- tanh: tanh
6949
- });
6950
-
6951
- const Math$1 = {
6952
- ...__Const__,
6953
- ...__Functions__,
6954
- ...__Complex__,
6955
- ...__Matrix__,
6956
- ...__Random__,
6957
- ...__Utils__,
6958
- ...__Discrect__,
6959
- };
6960
-
6961
5451
  class ZikoTimeLoop {
6962
5452
  constructor(callback, step = 1000/30, startTime=0, endTime = Infinity, started = true) {
6963
5453
  this.callback = callback;
@@ -7038,12 +5528,6 @@ class ZikoTimeLoop {
7038
5528
  const useFps = fps => 1000/fps;
7039
5529
  const useTimeLoop = (callback, step, startTime, endTime, started) => new ZikoTimeLoop(callback, step, startTime, endTime, started);
7040
5530
 
7041
- var Animation = /*#__PURE__*/Object.freeze({
7042
- __proto__: null,
7043
- useFps: useFps,
7044
- useTimeLoop: useTimeLoop
7045
- });
7046
-
7047
5531
  const Ease={
7048
5532
  Linear:function(t){
7049
5533
  return t;
@@ -7188,20 +5672,6 @@ const Ease={
7188
5672
  }
7189
5673
  };
7190
5674
 
7191
- const useDebounce=(fn,delay=1000)=>{
7192
- let id;
7193
- return (...args)=>id?clearTimeout(id):setTimeout(()=>fn(...args),delay)
7194
- };
7195
- const useThrottle=(fn,delay)=>{
7196
- let lastTime=0;
7197
- return (...args)=>{
7198
- const now=new Date().getTime();
7199
- if(now-lastTime<delay)return;
7200
- lastTime=now;
7201
- fn(...args);
7202
- }
7203
- };
7204
-
7205
5675
  const time_memory_Taken = (callback) => {
7206
5676
  const t0 = Date.now();
7207
5677
  const m0 = performance.memory.usedJSHeapSize;
@@ -7253,489 +5723,93 @@ const timeTaken = callback => {
7253
5723
  return r;
7254
5724
  };
7255
5725
 
7256
- var Utils = /*#__PURE__*/Object.freeze({
7257
- __proto__: null,
7258
- Ease: Ease,
7259
- timeTaken: timeTaken,
7260
- time_memory_Taken: time_memory_Taken,
7261
- useDebounce: useDebounce,
7262
- useThrottle: useThrottle,
7263
- wait: wait,
7264
- waitForUIElm: waitForUIElm,
7265
- waitForUIElmSync: waitForUIElmSync
7266
- });
7267
-
7268
- class ZikoTimeAnimation{
7269
- constructor(callback,ease=Ease.Linear,step=50,{t=[0,null],start=true,duration=3000}={}){
7270
- this.cache={
7271
- isRunning:false,
7272
- AnimationId:null,
7273
- startTime:null,
7274
- ease,
7275
- step,
7276
- intervall:t,
7277
- started:start,
7278
- duration
7279
- };
7280
- this.t=0;
7281
- this.tx=0;
7282
- this.ty=0;
7283
- this.i=0;
7284
- this.callback=callback;
7285
- }
7286
- #animation_handler(){
7287
- this.t+=this.cache.step;
7288
- this.i++;
7289
- this.tx=map(this.t,0,this.cache.duration,0,1);
7290
- this.ty=this.cache.ease(this.tx);
7291
- this.callback(this);
7292
- if(this.t>=this.cache.duration){
7293
- clearInterval(this.cache.AnimationId);
7294
- this.cache.isRunning=false;
7295
- }
7296
- }
7297
- reset(restart=true){
7298
- this.t=0;
7299
- this.tx=0;
7300
- this.ty=0;
7301
- this.i=0;
7302
- if(restart)this.start();
7303
- return this;
7304
- }
7305
- #animate(reset=true){
7306
- if(!this.cache.isRunning){
7307
- if(reset)this.reset(false);
7308
- this.cache.isRunning=true;
7309
- this.cache.startTime = Date.now();
7310
- this.cache.AnimationId=setInterval(this.#animation_handler.bind(this),this.cache.step);
7311
- }
7312
- return this;
7313
- }
7314
- start(){
7315
- this.#animate(true);
7316
- return this;
7317
- }
7318
- pause(){
7319
- if (this.cache.isRunning) {
7320
- clearTimeout(this.cache.AnimationId);
7321
- this.cache.isRunning = false;
7322
- }
7323
- return this;
7324
- }
7325
- resume(){
7326
- this.#animate(false);
7327
- return this;
7328
- }
7329
- stop(){
7330
- this.pause();
7331
- this.reset(false);
7332
- return this;
7333
- }
7334
- // clear(){
7335
- // }
7336
- // stream(){
7337
- // }
7338
- }
7339
-
7340
- const useAnimation=(callback,ease=Ease.Linear,step=50,config)=>new ZikoTimeAnimation(callback,ease=Ease.Linear,step=50,config);
7341
-
7342
- const Time = {
7343
- ...Animation,
7344
- ...Animation,
7345
- ...Utils
7346
- };
7347
-
7348
- class ZikoUISvg extends ZikoUIElement {
7349
- constructor(w=360,h=300) {
7350
- super("svg","svg");
7351
- //this.cache={};
7352
- // this.setAttr("width",w);
7353
- // this.setAttr("height",h);
7354
- // this.setAttr({
7355
- // width : w,
7356
- // height : h
7357
- // })
7358
- this.style({border:"1px black solid"});
7359
- //this.view(-w/2,-h/2,w/2,h/2);
7360
- this.size(w, h);
7361
- this.view(-10,-10,10,10);
7362
- }
7363
- size(w, h){
7364
- this.setAttr({
7365
- width : w,
7366
- height : h
7367
- });
7368
- return this
7369
- }
7370
- view(x1,y1,x2,y2){
7371
- let width=Math.abs(x2-x1);
7372
- let height=Math.abs(y2-y1);
7373
- this.setAttr("viewBox",[x1,y1,width,height].join(" "));
7374
- this.st.scaleY(-1);
7375
- return this;
7376
- }
7377
- add(...svgElement){
7378
- for(let i=0;i<svgElement.length;i++){
7379
- this.element.append(svgElement[i].element);
7380
- this.items.push(svgElement[i]);
7381
- }
7382
- this.maintain();
7383
- return this;
7384
- }
7385
- remove(...svgElement){
7386
- for(let i=0;i<svgElement.length;i++){
7387
- this.element?.removeChild(svgElement[i].element);
7388
- this.items=this.items.filter(n=>!svgElement);
7389
- }
7390
- this.maintain();
7391
- return this;
7392
- }
7393
- mask(){
7394
-
7395
- }
7396
- toString(){
7397
- return (new XMLSerializer()).serializeToString(this.element);
7398
- }
7399
- btoa(){
7400
- return btoa(this.toString())
7401
- }
7402
- toImg(){
7403
- return 'data:image/svg+xml;base64,'+this.btoa()
7404
- }
7405
- toImg2(){
7406
- return "data:image/svg+xml;charset=utf8,"+this.toString().replaceAll("<","%3C").replaceAll(">","%3E").replaceAll("#","%23").replaceAll('"',"'");
7407
- }
7408
-
7409
- }
7410
-
7411
- const Svg =(w,h)=>new ZikoUISvg(w,h);
7412
-
7413
- var SVG = /*#__PURE__*/Object.freeze({
7414
- __proto__: null,
7415
- Svg: Svg,
7416
- ZikoUISvg: ZikoUISvg
7417
- });
7418
-
7419
- // import { convolute } from "../../math/signal/conv.js";
7420
- class ZikoUICanvas extends ZikoUIElement{
7421
- constructor(w,h){
7422
- super("canvas","canvas");
7423
- this.ctx = this.element?.getContext("2d");
7424
- this.style({
7425
- border:"1px red solid",
7426
- });
7427
- this.transformMatrix=new Matrix([
7428
- [1,0,0],
7429
- [0,1,0],
7430
- [0,0,1]
7431
- ]);
7432
- this.axisMatrix=new Matrix([
7433
- [-10,-10],
7434
- [10,10]
7435
- ]);
7436
- // setTimeout(()=>this.resize(w,h),0);
7437
- requestAnimationFrame(()=>this.resize(w,h),0);
7438
- this.on("sizeupdated",()=>this.adjust());
7439
- }
7440
- get Xmin(){
7441
- return this.axisMatrix[0][0];
7442
- }
7443
- get Ymin(){
7444
- return this.axisMatrix[0][1];
7445
- }
7446
- get Xmax(){
7447
- return this.axisMatrix[1][0];
7448
- }
7449
- get Ymax(){
7450
- return this.axisMatrix[1][1];
7451
- }
7452
- get ImageData(){
7453
- return this.ctx.getImageData(0,0,c.Width,c.Height);
7454
- }
7455
- draw(all=true){
7456
- if(all){
7457
- this.clear();
7458
- this.items.forEach(element => {
7459
- element.parent=this;
7460
- element.draw(this.ctx);
7461
- });
7462
- }
7463
- else {
7464
- this.items.at(-1).parent=this;
7465
- this.items.at(-1).draw(this.ctx);
7466
- }
7467
- this.maintain();
7468
- return this;
7469
- }
7470
- applyTransformMatrix(){
7471
- this.ctx.setTransform(
7472
- this.transformMatrix[0][0],
7473
- this.transformMatrix[1][0],
7474
- this.transformMatrix[0][1],
7475
- this.transformMatrix[1][1],
7476
- this.transformMatrix[0][2],
7477
- this.transformMatrix[1][2],
7478
- );
7479
- return this;
7480
- }
7481
- resize(w,h){
7482
- this.size(w,h);
7483
- this.lineWidth();
7484
- this.view(this.axisMatrix[0][0], this.axisMatrix[0][1], this.axisMatrix[1][0], this.axisMatrix[1][1]);
7485
- this.emit("sizeupdated");
7486
- return this;
7487
- }
7488
- adjust(){
7489
- this.element.width =this.element?.getBoundingClientRect().width;
7490
- this.element.height =this.element?.getBoundingClientRect().height;
7491
- this.view(this.axisMatrix[0][0], this.axisMatrix[0][1], this.axisMatrix[1][0], this.axisMatrix[1][1]);
7492
- return this;
7493
- }
7494
- view(xMin,yMin,xMax,yMax){
7495
- this.transformMatrix[0][0]=this.width/(xMax-xMin); // scaleX
7496
- this.transformMatrix[1][1]=-this.height/(yMax-yMin); // scaleY
7497
- this.transformMatrix[0][2]=this.width/2;
7498
- this.transformMatrix[1][2]=this.height/2;
7499
- this.axisMatrix=new Matrix([
7500
- [xMin,yMin],
7501
- [xMax,yMax]
7502
- ]);
7503
-
7504
- this.applyTransformMatrix();
7505
- this.clear();
7506
- this.lineWidth(1);
7507
- this.draw();
7508
- return this;
7509
- }
7510
- reset(){
7511
- this.ctx.setTransform(1,0,0,0,0,0);
7512
- return this;
7513
- }
7514
- append(element){
7515
- this.items.push(element);
7516
- this.draw(false);
7517
- return this;
7518
- }
7519
- background(color){
7520
- this.ctx.fillStyle = color;
7521
- this.ctx.setTransform(1, 0, 0, 1, 0, 0);
7522
- this.ctx.fillRect(0, 0, this.width, this.height);
7523
- this.applyTransformMatrix();
7524
- this.draw();
7525
- }
7526
- lineWidth(w){
7527
- this.ctx.lineWidth=w/this.transformMatrix[0][0];
7528
- return this
7529
- }
7530
- getImageData(x=0,y=0,w=this.width,h=this.height){
7531
- return this.ctx.getImageData(x,y,w,h);
7532
- }
7533
- clear(){
7534
- this.ctx.setTransform(1, 0, 0, 1, 0, 0);
7535
- this.ctx.clearRect(0, 0, this.width, this.height);
7536
- this.applyTransformMatrix();
7537
- return this;
7538
- }
7539
- clone(){
7540
- console.log(this.width);
7541
- const canvas=new ZikoUICanvas();
7542
- canvas.items=this.items;
7543
- canvas.transformMatrix=this.transformMatrix;
7544
- canvas.axisMatrix=this.axisMatrix;
7545
- Object.assign(canvas.cache,{...this.cache});
7546
- //waitForUIElm(this)
7547
- //console.log(element)
7548
- this.size(this.element.style.width,this.element.style.width);
7549
- this.applyTransformMatrix();
7550
- this.draw();
7551
- this.adjust();
7552
- return canvas;
7553
- }
7554
- toImage() {
7555
- this.img = document?.createElement("img");
7556
- this.img.src = this.element?.toDataURL("image/png");
7557
- return this;
7558
- }
7559
- toBlob() {
7560
- var canvas = this.element;
7561
- canvas.toBlob(function (blob) {
7562
- var newImg = document?.createElement("img"),
7563
- url = URL.createObjectURL(blob);
7564
- newImg.onload = function () {
7565
- URL.revokeObjectURL(url);
7566
- };
7567
- newImg.src = url;
7568
- console.log(newImg);
7569
- });
7570
- }
7571
- zoomIn(){
7572
-
7573
- }
7574
- zoomOut(){
7575
-
7576
- }
7577
- undo(n){
7578
-
7579
- }
7580
- redo(n){
7581
-
7582
- }
7583
- stream(){
7584
-
7585
- }
7586
- }
7587
-
7588
- const Canvas=(w,h)=>new ZikoUICanvas(w,h);
7589
-
7590
- var CANVAS = /*#__PURE__*/Object.freeze({
7591
- __proto__: null,
7592
- Canvas: Canvas,
7593
- ZikoUICanvas: ZikoUICanvas
7594
- });
7595
-
7596
- const Graphics = {
7597
- ...SVG,
7598
- ...CANVAS
7599
- };
7600
-
7601
- class ZikoUseFavIcon{
7602
- constructor(FavIcon,useEventEmitter=true){
7603
- this.#init();
5726
+ class ZikoTimeAnimation{
5727
+ constructor(callback,ease=Ease.Linear,step=50,{t=[0,null],start=true,duration=3000}={}){
7604
5728
  this.cache={
7605
- Emitter:null
5729
+ isRunning:false,
5730
+ AnimationId:null,
5731
+ startTime:null,
5732
+ ease,
5733
+ step,
5734
+ intervall:t,
5735
+ started:start,
5736
+ duration
7606
5737
  };
7607
- if(useEventEmitter)this.useEventEmitter();
7608
- this.set(FavIcon);
7609
- }
7610
- #init(){
7611
- this.__FavIcon__ = document.querySelector("link[rel*='icon']") || document?.createElement('link');
7612
- this.__FavIcon__.type = 'image/x-icon';
7613
- this.__FavIcon__.rel = 'shortcut icon';
7614
- return this;
7615
- }
7616
- set(href){
7617
- if(href!==this.__FavIcon__.href){
7618
- this.__FavIcon__.href=href;
7619
- if(this.cache.Emitter)this.cache.Emitter.emit("ziko:favicon-changed");
7620
- }
7621
- return this;
7622
- }
7623
- get current(){
7624
- return document.__FavIcon__.href;
5738
+ this.t=0;
5739
+ this.tx=0;
5740
+ this.ty=0;
5741
+ this.i=0;
5742
+ this.callback=callback;
7625
5743
  }
7626
- onChange(callback){
7627
- if(this.cache.Emitter)this.cache.Emitter.on("ziko:favicon-changed",callback);
7628
- return this;
5744
+ #animation_handler(){
5745
+ this.t+=this.cache.step;
5746
+ this.i++;
5747
+ this.tx=map(this.t,0,this.cache.duration,0,1);
5748
+ this.ty=this.cache.ease(this.tx);
5749
+ this.callback(this);
5750
+ if(this.t>=this.cache.duration){
5751
+ clearInterval(this.cache.AnimationId);
5752
+ this.cache.isRunning=false;
5753
+ }
7629
5754
  }
7630
- useEventEmitter(){
7631
- this.cache.Emitter=useEventEmitter();
5755
+ reset(restart=true){
5756
+ this.t=0;
5757
+ this.tx=0;
5758
+ this.ty=0;
5759
+ this.i=0;
5760
+ if(restart)this.start();
7632
5761
  return this;
7633
5762
  }
7634
-
7635
- }
7636
- const useFavIcon=(FavIcon,useEventEmitter)=>new ZikoUseFavIcon(FavIcon,useEventEmitter);
7637
-
7638
- class ZikoMeta{
7639
- constructor({viewport,charset,description,author,keywords}){
7640
- this.document = globalThis?.document;
7641
- this.meta={};
7642
- this.init({viewport,charset,description,author,keywords});
7643
- }
7644
- init({viewport,charset,description,author,keywords}){
7645
- viewport && this.setViewport(viewport);
7646
- charset && this.setCharset(charset);
7647
- description && this.describe(description);
7648
- author && this.setAuthor(author);
7649
- keywords && this.setKeywords(keywords);
7650
- }
7651
- set(key,value){
7652
- key = key.toLowerCase();
7653
- const isCharset = (key === "charset");
7654
- const meta = isCharset ? document.querySelector("meta[charset]"):document.querySelector(`meta[name=${key}]`);
7655
- this.meta=meta?? document?.createElement("meta");
7656
- if(isCharset) this.meta.setAttribute("charset",value);
7657
- else {
7658
- this.meta.setAttribute("name",key);
7659
- this.meta.setAttribute("content",value);
5763
+ #animate(reset=true){
5764
+ if(!this.cache.isRunning){
5765
+ if(reset)this.reset(false);
5766
+ this.cache.isRunning=true;
5767
+ this.cache.startTime = Date.now();
5768
+ this.cache.AnimationId=setInterval(this.#animation_handler.bind(this),this.cache.step);
7660
5769
  }
7661
- if(!meta)this.document.head.append(this.meta);
7662
- return this;
7663
- }
7664
- setCharset(charset="utf-8"){
7665
- this.set("charset",charset);
7666
- return this;
7667
- }
7668
- describe(description){
7669
- this.set("description",description);
7670
- return this;
7671
- }
7672
- setViewport(viewport="width=device-width, initial-scale=1.0"){
7673
- this.set("viewport",viewport);
7674
- return this;
7675
- }
7676
- setKeywords(...keywords){
7677
- // keywords.push("zikojs");
7678
- keywords=[...new Set(keywords)].join(", ");
7679
- this.set("keywords",keywords);
7680
5770
  return this;
7681
5771
  }
7682
- setAuthor(author){
7683
- this.set("author",author);
5772
+ start(){
5773
+ this.#animate(true);
7684
5774
  return this;
7685
5775
  }
7686
- }
7687
- const useMeta=({viewport,charset,description,author,keywords})=>new ZikoMeta({viewport,charset,description,author,keywords});
7688
-
7689
- class ZikoUseTitle{
7690
- constructor(title=document.title,useEventEmitter=true){
7691
- this.cache={
7692
- Emitter:null
7693
- };
7694
- if(useEventEmitter)this.useEventEmitter();
7695
- this.set(title);
7696
- }
7697
- useEventEmitter(){
7698
- this.cache.Emitter=useEventEmitter();
5776
+ pause(){
5777
+ if (this.cache.isRunning) {
5778
+ clearTimeout(this.cache.AnimationId);
5779
+ this.cache.isRunning = false;
5780
+ }
7699
5781
  return this;
7700
5782
  }
7701
- set(title){
7702
- if(title!==document.title){
7703
- document.title=title;
7704
- if(this.cache.Emitter)this.cache.Emitter.emit("ziko:title-changed");
7705
- }
5783
+ resume(){
5784
+ this.#animate(false);
7706
5785
  return this;
7707
5786
  }
7708
- get current(){
7709
- return document.title;
7710
- }
7711
- onChange(callback){
7712
- if(this.cache.Emitter)this.cache.Emitter.on("ziko:title-changed",callback);
5787
+ stop(){
5788
+ this.pause();
5789
+ this.reset(false);
7713
5790
  return this;
7714
5791
  }
5792
+ // clear(){
5793
+ // }
5794
+ // stream(){
5795
+ // }
7715
5796
  }
7716
- const useTitle=(title, useEventEmitter)=>new ZikoUseTitle(title, useEventEmitter);
7717
-
7718
- // import {useLink} from "./";
7719
- class ZikoHead{
7720
- constructor({title,lang,icon,meta,noscript}){
7721
- this.html = globalThis?.document?.documentElement;
7722
- this.head = globalThis?.document?.head;
7723
-
7724
- title && useTitle(title);
7725
- lang && this.setLang(lang);
7726
- icon && useFavIcon(icon);
7727
- meta && useMeta(meta);
7728
- noscript && this.setNoScript();
7729
- }
7730
- setLang(lang){
7731
- this.html.setAttribute("lang",lang);
7732
- }
7733
- setNoScript(content){
7734
5797
 
5798
+ const useAnimation=(callback,ease=Ease.Linear,step=50,config)=>new ZikoTimeAnimation(callback,ease=Ease.Linear,step=50,config);
5799
+
5800
+ const debounce=(fn,delay=1000)=>{
5801
+ let id;
5802
+ return (...args) => id ? clearTimeout(id) : setTimeout(()=>fn(...args),delay);
5803
+ };
5804
+ const throttle=(fn,delay)=>{
5805
+ let lastTime=0;
5806
+ return (...args) => {
5807
+ const now = new Date().getTime();
5808
+ if(now-lastTime < delay) return;
5809
+ lastTime = now;
5810
+ fn(...args);
7735
5811
  }
7736
- }
7737
-
7738
- const useHead=({ title, lang, icon, meta, noscript })=>new ZikoHead({ title, lang, icon, meta, noscript });
5812
+ };
7739
5813
 
7740
5814
  class ZikoApp {
7741
5815
  constructor({head = null, wrapper = null, target = null}){
@@ -7770,13 +5844,7 @@ class ZikoApp {
7770
5844
  }
7771
5845
 
7772
5846
  }
7773
- const App$1 = ({head, wrapper, target}) => new ZikoApp({head, wrapper, target});
7774
-
7775
- var __App__ = /*#__PURE__*/Object.freeze({
7776
- __proto__: null,
7777
- App: App$1,
7778
- ZikoApp: ZikoApp
7779
- });
5847
+ const App = ({head, wrapper, target}) => new ZikoApp({head, wrapper, target});
7780
5848
 
7781
5849
  function routesMatcher(mask, route) {
7782
5850
  const maskSegments = mask.split('/');
@@ -7873,12 +5941,6 @@ const SPA=({head, wrapper, target, routes})=>new ZikoSPA({head, wrapper, target,
7873
5941
  // regEx
7874
5942
  */
7875
5943
 
7876
- var Spa = /*#__PURE__*/Object.freeze({
7877
- __proto__: null,
7878
- SPA: SPA,
7879
- ZikoSPA: ZikoSPA
7880
- });
7881
-
7882
5944
  function parseQueryParams(queryString) {
7883
5945
  const params = {};
7884
5946
  queryString.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi, (match) => {
@@ -7908,71 +5970,6 @@ function defineParamsGetter(target ){
7908
5970
  });
7909
5971
  }
7910
5972
 
7911
- const __UI__={
7912
- __all__(){
7913
- return Object.values(this)
7914
- .filter(Array.isArray)
7915
- .flat();
7916
- },
7917
- querySelectorAll(){
7918
- return this.__all__().filter(n=>n)
7919
- },
7920
- getElementByIndex(index){
7921
- return this.__all__().find(n=>n.ui_index===index);
7922
- },
7923
- getElementById(id){
7924
- return null;
7925
- },
7926
- getElementsByClass(){
7927
-
7928
- },
7929
- getElementsByTagName(){
7930
-
7931
- }
7932
- };
7933
- const __HYDRATION__ = {
7934
- map : new Map(),
7935
- index : 0,
7936
- increment : function(){
7937
- return this.index ++
7938
- }
7939
- };
7940
- const __HYDRATION_MAP__ = new Map();
7941
- const __Config__={
7942
- default:{
7943
- target:null,
7944
- render:true,
7945
- math:{
7946
- mode:"deg"
7947
- }
7948
- },
7949
- setDefault:function(pairs){
7950
- const keys=Object.keys(pairs);
7951
- const values=Object.values(pairs);
7952
- for(let i=0; i<keys.length; i++) this.default[keys[i]]=values[i];
7953
- },
7954
- init:()=>{
7955
- // document.documentElement.setAttribute("data-engine","zikojs")
7956
- },
7957
- renderingMode :"spa",
7958
- isSSC : false,
7959
- };
7960
- const __CACHE__ = {
7961
- ui_index : 0,
7962
- get_ui_index:function(){
7963
- return this.ui_index ++
7964
- }
7965
- };
7966
-
7967
- var Global = /*#__PURE__*/Object.freeze({
7968
- __proto__: null,
7969
- __CACHE__: __CACHE__,
7970
- __Config__: __Config__,
7971
- __HYDRATION_MAP__: __HYDRATION_MAP__,
7972
- __HYDRATION__: __HYDRATION__,
7973
- __UI__: __UI__
7974
- });
7975
-
7976
5973
  // import.meta.glob('./src/pages/**/*.js')
7977
5974
  async function FileBasedRouting(pages /* use import.meta.glob */){
7978
5975
  const routes = Object.keys(pages);
@@ -7989,7 +5986,7 @@ async function FileBasedRouting(pages /* use import.meta.glob */){
7989
5986
  "/" : ()=>{},
7990
5987
  ...pairs
7991
5988
  },
7992
- wrapper : Section()
5989
+ wrapper : tags.section()
7993
5990
  })
7994
5991
  }
7995
5992
  function customPath(inputPath, root = './src/pages', extensions = ['js', 'ts']) {
@@ -8029,38 +6026,6 @@ function findCommonPath(paths) {
8029
6026
  return commonPath;
8030
6027
  }
8031
6028
 
8032
- // import * as Params from "./params"
8033
-
8034
- const App={
8035
- ...__App__,
8036
- ...Spa,
8037
- ...Global,
8038
- // ...Params
8039
- };
8040
-
8041
- function useState(initialValue) {
8042
- let value = initialValue;
8043
- const subscribers = new Set();
8044
-
8045
- function getValue() {
8046
- return {
8047
- value,
8048
- isStateGetter: () => true,
8049
- _subscribe: (fn) => subscribers.add(fn),
8050
- };
8051
- }
8052
-
8053
- function setValue(newValue) {
8054
- if (typeof newValue === "function") newValue = newValue(value);
8055
- if (newValue !== value) {
8056
- value = newValue;
8057
- subscribers.forEach(fn => fn(value));
8058
- }
8059
- }
8060
-
8061
- return [getValue, setValue];
8062
- }
8063
-
8064
6029
  class ZikoUseChannel{
8065
6030
  constructor(name = ""){
8066
6031
  this.channel = new BroadcastChannel(name);
@@ -8176,7 +6141,6 @@ class ZikoUseRoot {
8176
6141
  cssProp,
8177
6142
  this.currentPropsMap[prop]
8178
6143
  );
8179
- console.log({cssProp});
8180
6144
  // Object.assign(this.pairs, {
8181
6145
  // [prop] : `var(--${this.namespace}-${prop})`
8182
6146
  // })
@@ -8296,70 +6260,8 @@ class ZikoUseStorage{
8296
6260
  const useLocaleStorage=(key,initialValue)=>new ZikoUseStorage(localStorage,key,initialValue);
8297
6261
  const useSessionStorage=(key,initialValue)=>new ZikoUseStorage(sessionStorage,key,initialValue);
8298
6262
 
8299
- [
8300
- App,
8301
- Math$1,
8302
- UI$1,
8303
- Time,
8304
- Data,
8305
- Reactivity,
8306
- Graphics,
8307
- ].forEach(n=>Object.assign(n,{
8308
- ExtractAll:()=>__ExtractAll__(n),
8309
- RemoveAll:()=>__RemoveAll__(n)
8310
- }));
8311
-
8312
- const Ziko={
8313
- App,
8314
- Math: Math$1,
8315
- UI: UI$1,
8316
- Time,
8317
- Data,
8318
- Reactivity,
8319
- Graphics
8320
- };
8321
-
8322
- if ( globalThis.__Ziko__ ) {
8323
- console.warn( 'WARNING: Multiple instances of Ziko.js being imported.' );
8324
- } else {
8325
- globalThis.__Ziko__={
8326
- ...Ziko,
8327
- __UI__,
8328
- __HYDRATION__,
8329
- __HYDRATION_MAP__,
8330
- __Config__,
8331
- __CACHE__,
8332
- ExtractAll,
8333
- RemoveAll
8334
- };
8335
- defineParamsGetter(__Ziko__);
8336
- }
8337
- // globalThis.__Ziko__={
8338
- // ...Ziko,
8339
- // __UI__,
8340
- // __Config__,
8341
- // ExtractAll,
8342
- // RemoveAll
8343
- // };
8344
6263
  if(globalThis?.document){
8345
6264
  document?.addEventListener("DOMContentLoaded", __Ziko__.__Config__.init());
8346
- }
8347
- function ExtractAll(){
8348
- UI$1.ExtractAll();
8349
- Math$1.ExtractAll();
8350
- Time.ExtractAll();
8351
- Reactivity.ExtractAll();
8352
- Graphics.ExtractAll();
8353
- Data.ExtractAll();
8354
- return this;
8355
- }
8356
- function RemoveAll(){
8357
- UI$1.RemoveAll();
8358
- Math$1.RemoveAll();
8359
- Time.RemoveAll();
8360
- Reactivity.RemoveAll();
8361
- Graphics.RemoveAll();
8362
- Data.RemoveAll();
8363
6265
  }
8364
6266
 
8365
- export { App$1 as App, Article, Aside, Base, Canvas, Combinaison, Complex, E, EPSILON, Ease, FileBasedRouting, Flex, Footer, Form, Grid$1 as Grid, HTMLWrapper, Header, Logic$1 as Logic, Main, Matrix, Nav, PI$1 as PI, Permutation, Random, SPA, SVGWrapper, Section, Str, Suspense, Svg, Table$1 as Table, Utils$1 as Utils, ZikoApp, ZikoCustomEvent, ZikoEventClick, ZikoEventClipboard, ZikoEventCustom, ZikoEventDrag, ZikoEventFocus, ZikoEventInput, ZikoEventKey, ZikoEventMouse, ZikoEventPointer, ZikoEventSwipe, ZikoEventTouch, ZikoEventWheel, ZikoHead$1 as ZikoHead, ZikoMutationObserver, ZikoSPA, ZikoUIAbbrText, ZikoUIArticle, ZikoUIAside, ZikoUIAudio, ZikoUIBlockQuote, ZikoUIBr, ZikoUICanvas, ZikoUICodeText, ZikoUIDefintion, ZikoUIElement, ZikoUIFigure, ZikoUIFlex, ZikoUIFooter, ZikoUIForm, ZikoUIGrid, ZikoUIHTMLWrapper, ZikoUIHeader, ZikoUIHeading, ZikoUIHr, ZikoUIHtmlTag, ZikoUIImage, ZikoUIInput, ZikoUIInputCheckbox, ZikoUIInputColor, ZikoUIInputDatalist$1 as ZikoUIInputDatalist, ZikoUIInputDate, ZikoUIInputDateTime, ZikoUIInputEmail, ZikoUIInputImage, ZikoUIInputNumber, ZikoUIInputOption, ZikoUIInputPassword, ZikoUIInputRadio, ZikoUIInputSearch, ZikoUIInputSlider$1 as ZikoUIInputSlider, ZikoUIInputTime, ZikoUILabel, ZikoUILink, ZikoUIMain, ZikoUINav, ZikoUIParagraphe, ZikoUIQuote, ZikoUISVGWrapper, ZikoUISection, ZikoUISelect, ZikoUISubText, ZikoUISupText, ZikoUISuspense, ZikoUISvg, ZikoUIText, ZikoUITextArea, ZikoUIVideo, ZikoUIXMLWrapper, ZikoUseRoot, ZikoUseStyle, __CACHE__, __Config__, __HYDRATION_MAP__, __HYDRATION__, __UI__, __ZikoEvent__, abbrText, abs, accum, acos, acosh, acot, add, arange, arr2str, asin, asinh, atan, atan2, atanh, audio, bindClickEvent, bindClipboardEvent, bindCustomEvent, bindDragEvent, bindFocusEvent, bindHashEvent, bindKeyEvent, bindMouseEvent, bindPointerEvent, bindTouchEvent, bindWheelEvent, blockQuote, br, brs, btn, cartesianProduct, ceil, checkbox, clamp, codeText, combinaison, complex, cos, cosh, cot, coth, count, countWords, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, datalist, Ziko as default, defineParamsGetter, deg2rad, dfnText, div, e, fact, figure, floor, geomspace, getEvent, h, h1, h2, h3, h4, h5, h6, hTags, hr, hrs, html, hypot, image, inRange, input, inputCamera, inputColor, inputDate, inputDateTime, inputEmail, inputImage, inputNumber, inputPassword, inputTime, isApproximatlyEqual, json2arr, json2css, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, lerp, li, link, linspace, ln, logspace, map, mapfun$1 as mapfun, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, obj2str, ol, ones, p, pgcd, pow, powerSet, ppcm, preload, prod, quote, rad2deg, radio, removeExtraSpace, round, s, sTags, search, sec, select, sig, sign, sin, sinc, sinh, slider, sqrt, sqrtn, str, sub, subSet, subText, sum, supText, svg2ascii, svg2img, svg2imgUrl, svg2str, tags, tan, tanh, text, textarea, timeTaken, time_memory_Taken, ul, useAnimation, useChannel, useCustomEvent, useEventEmitter, useFavIcon$1 as useFavIcon, useFps, useHashEvent, useHead$1 as useHead, useInputEvent, useLocaleStorage, useMediaQuery, useMeta$1 as useMeta, useRoot, useSessionStorage, useState, useStyle, useSuccesifKeys, useSwipeEvent, useThread, useTimeLoop, useTitle$1 as useTitle, video, wait, waitForUIElm, waitForUIElmSync, watch, watchAttr, watchChildren, watchIntersection, watchScreen, watchSize, zeros };
6267
+ export { App, Base, Canvas, Combinaison, Complex, E, EPSILON, Ease, FileBasedRouting, Flex, Grid$1 as Grid, HTMLWrapper, Logic$1 as Logic, Matrix, PI$1 as PI, Permutation, Random, SPA, SVGWrapper, Str, Suspense, Svg, Utils, ZikoApp, ZikoCustomEvent, ZikoEventClick, ZikoEventClipboard, ZikoEventCustom, ZikoEventDrag, ZikoEventFocus, ZikoEventInput, ZikoEventKey, ZikoEventMouse, ZikoEventPointer, ZikoEventSwipe, ZikoEventTouch, ZikoEventWheel, ZikoHead, ZikoMutationObserver, ZikoSPA, ZikoUICanvas, ZikoUIElement, ZikoUIFlex, ZikoUIGrid, ZikoUIHTMLWrapper, ZikoUINode, ZikoUISVGWrapper, ZikoUISuspense, ZikoUISvg, ZikoUIText, ZikoUIXMLWrapper, ZikoUseRoot, ZikoUseStyle, __ZikoEvent__, abs, accum, acos, acosh, acot, add, arange, arr2str, asin, asinh, atan, atan2, atanh, bindClickEvent, bindClipboardEvent, bindCustomEvent, bindDragEvent, bindFocusEvent, bindHashEvent, bindKeyEvent, bindMouseEvent, bindPointerEvent, bindTouchEvent, bindWheelEvent, cartesianProduct, ceil, clamp, combinaison, complex, cos, cosh, cot, coth, count, countWords, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, debounce, defineParamsGetter, deg2rad, div, e, fact, floor, geomspace, getEvent, hypot, inRange, isApproximatlyEqual, json2arr, json2css, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, lerp, linspace, ln, logspace, map, mapfun$1 as mapfun, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, obj2str, ones, pgcd, pow, powerSet, ppcm, preload, prod, rad2deg, removeExtraSpace, round, sec, sig, sign, sin, sinc, sinh, sqrt, sqrtn, str, sub, subSet, sum, svg2ascii, svg2img, svg2imgUrl, svg2str, tags, tan, tanh, text, throttle, timeTaken, time_memory_Taken, useAnimation, useChannel, useCustomEvent, useEventEmitter, useFavIcon, useFps, useHashEvent, useHead, useInputEvent, useLocaleStorage, useMediaQuery, useMeta, useRoot, useSessionStorage, useStyle, useSuccesifKeys, useSwipeEvent, useThread, useTimeLoop, useTitle, wait, waitForUIElm, waitForUIElmSync, watch, watchAttr, watchChildren, watchIntersection, watchScreen, watchSize, zeros };