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