ziko 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +316 -0
  3. package/dist/ziko.cjs +9786 -0
  4. package/dist/ziko.js +9792 -0
  5. package/dist/ziko.min.js +9 -0
  6. package/dist/ziko.mjs +9567 -0
  7. package/package.json +55 -0
  8. package/src/App/Accessibility/index.js +0 -0
  9. package/src/App/Globals/__Target__.js +3 -0
  10. package/src/App/Globals/__UI__.js +38 -0
  11. package/src/App/Globals/__init__.js +8 -0
  12. package/src/App/Globals/index.js +3 -0
  13. package/src/App/Router/index.js +40 -0
  14. package/src/App/Seo/index.js +43 -0
  15. package/src/App/Themes/dark.js +885 -0
  16. package/src/App/Themes/index.js +11 -0
  17. package/src/App/Themes/light.js +255 -0
  18. package/src/App/app.js +37 -0
  19. package/src/App/index.js +11 -0
  20. package/src/Data/Api/fetchdom.js +14 -0
  21. package/src/Data/Api/index.js +4 -0
  22. package/src/Data/Api/preload.js +11 -0
  23. package/src/Data/Converter/canvas.js +25 -0
  24. package/src/Data/Converter/csv.js +33 -0
  25. package/src/Data/Converter/index.js +25 -0
  26. package/src/Data/Converter/json.js +80 -0
  27. package/src/Data/Converter/markdown.js +83 -0
  28. package/src/Data/Converter/svg.js +11 -0
  29. package/src/Data/Parser/markdown.js +0 -0
  30. package/src/Data/Parser/xml.js +47 -0
  31. package/src/Data/Strings/index.js +26 -0
  32. package/src/Data/decorators.js +0 -0
  33. package/src/Data/index.js +64 -0
  34. package/src/Graphics/Canvas/Elements/Basic/arc.js +43 -0
  35. package/src/Graphics/Canvas/Elements/Basic/image.js +0 -0
  36. package/src/Graphics/Canvas/Elements/Basic/line.js +26 -0
  37. package/src/Graphics/Canvas/Elements/Basic/path.js +0 -0
  38. package/src/Graphics/Canvas/Elements/Basic/points.js +48 -0
  39. package/src/Graphics/Canvas/Elements/Basic/polygon.js +7 -0
  40. package/src/Graphics/Canvas/Elements/Basic/polyline.js +0 -0
  41. package/src/Graphics/Canvas/Elements/Basic/rect.js +46 -0
  42. package/src/Graphics/Canvas/Elements/Basic/text.js +0 -0
  43. package/src/Graphics/Canvas/Elements/Chart/histogram.js +0 -0
  44. package/src/Graphics/Canvas/Elements/Chart/plot.js +0 -0
  45. package/src/Graphics/Canvas/Elements/Chart/scatter.js +2 -0
  46. package/src/Graphics/Canvas/Elements/Chart/stem.js +0 -0
  47. package/src/Graphics/Canvas/Elements/Element.js +115 -0
  48. package/src/Graphics/Canvas/Elements/Groupe.js +0 -0
  49. package/src/Graphics/Canvas/Elements/grid.js +0 -0
  50. package/src/Graphics/Canvas/Elements/index.js +13 -0
  51. package/src/Graphics/Canvas/Filter/index.js +0 -0
  52. package/src/Graphics/Canvas/Paint/index.js +0 -0
  53. package/src/Graphics/Canvas/Utils/color.js +8 -0
  54. package/src/Graphics/Canvas/Utils/floodFill.js +58 -0
  55. package/src/Graphics/Canvas/_canvas_offscreen +0 -0
  56. package/src/Graphics/Canvas/canvas.js +189 -0
  57. package/src/Graphics/Canvas/index.js +15 -0
  58. package/src/Graphics/Svg/Elements/ZikoSvgElement.js +28 -0
  59. package/src/Graphics/Svg/Elements/circle.js +34 -0
  60. package/src/Graphics/Svg/Elements/ellipse.js +29 -0
  61. package/src/Graphics/Svg/Elements/foreignObject.js +46 -0
  62. package/src/Graphics/Svg/Elements/grid.js +9 -0
  63. package/src/Graphics/Svg/Elements/groupe.js +29 -0
  64. package/src/Graphics/Svg/Elements/image.js +33 -0
  65. package/src/Graphics/Svg/Elements/line.js +29 -0
  66. package/src/Graphics/Svg/Elements/path.js +59 -0
  67. package/src/Graphics/Svg/Elements/polygon.js +31 -0
  68. package/src/Graphics/Svg/Elements/polyline.js +4 -0
  69. package/src/Graphics/Svg/Elements/rect.js +43 -0
  70. package/src/Graphics/Svg/Elements/text.js +26 -0
  71. package/src/Graphics/Svg/index.js +1 -0
  72. package/src/Graphics/Svg/svg.js +117 -0
  73. package/src/Graphics/index.js +61 -0
  74. package/src/Math/Calculus/Special Functions/bessel.js +31 -0
  75. package/src/Math/Calculus/Special Functions/beta.js +38 -0
  76. package/src/Math/Calculus/Special Functions/gamma.js +30 -0
  77. package/src/Math/Calculus/Special Functions/index.js +4 -0
  78. package/src/Math/Calculus/index.js +1 -0
  79. package/src/Math/Complex/Fractals/julia.js +0 -0
  80. package/src/Math/Complex/index.js +191 -0
  81. package/src/Math/Discret/Combinaison/index.js +34 -0
  82. package/src/Math/Discret/Conversion/index.js +86 -0
  83. package/src/Math/Discret/Logic/index.js +46 -0
  84. package/src/Math/Discret/Permutation/index.js +31 -0
  85. package/src/Math/Discret/Set/index.js +2 -0
  86. package/src/Math/Discret/Set/powerSet.js +15 -0
  87. package/src/Math/Discret/Set/subSet.js +10 -0
  88. package/src/Math/Discret/index.js +23 -0
  89. package/src/Math/Functions/index.js +182 -0
  90. package/src/Math/Matrix/Decomposition.js +90 -0
  91. package/src/Math/Matrix/LinearSystem.js +10 -0
  92. package/src/Math/Matrix/Matrix.js +712 -0
  93. package/src/Math/Matrix/index.js +3 -0
  94. package/src/Math/Numeric/index.js +0 -0
  95. package/src/Math/Random/index.js +173 -0
  96. package/src/Math/Signal/__np.py.txt +40 -0
  97. package/src/Math/Signal/conv.js +175 -0
  98. package/src/Math/Signal/fft.js +55 -0
  99. package/src/Math/Signal/filter.js +39 -0
  100. package/src/Math/Signal/functions.js +146 -0
  101. package/src/Math/Signal/index.js +110 -0
  102. package/src/Math/Statistics/Functions/index.js +100 -0
  103. package/src/Math/Statistics/index.js +16 -0
  104. package/src/Math/Utils/arithmetic.js +139 -0
  105. package/src/Math/Utils/checkers.js +11 -0
  106. package/src/Math/Utils/comparaison.js +1 -0
  107. package/src/Math/Utils/conversions.js +7 -0
  108. package/src/Math/Utils/discret.js +28 -0
  109. package/src/Math/Utils/index.js +102 -0
  110. package/src/Math/Utils/mapfun.js +43 -0
  111. package/src/Math/absract.js +1 -0
  112. package/src/Math/const.js +3 -0
  113. package/src/Math/index.js +193 -0
  114. package/src/Reactivity/Events/Global/Click.js +56 -0
  115. package/src/Reactivity/Events/Global/Clipboard.js +84 -0
  116. package/src/Reactivity/Events/Global/CustomEvent.js +53 -0
  117. package/src/Reactivity/Events/Global/Drag.js +137 -0
  118. package/src/Reactivity/Events/Global/Focus.js +56 -0
  119. package/src/Reactivity/Events/Global/Key.js +104 -0
  120. package/src/Reactivity/Events/Global/Pointer.js +214 -0
  121. package/src/Reactivity/Events/Partiel/Input.js +59 -0
  122. package/src/Reactivity/Events/ZikoEvent.js +91 -0
  123. package/src/Reactivity/Events/index.js +51 -0
  124. package/src/Reactivity/Observer/index.js +3 -0
  125. package/src/Reactivity/Observer/intersection.js +40 -0
  126. package/src/Reactivity/Observer/mutation.js +90 -0
  127. package/src/Reactivity/Observer/resize.js +47 -0
  128. package/src/Reactivity/Use/Contexte/index.js +1 -0
  129. package/src/Reactivity/Use/Contexte/useSuccesifKeys.js +14 -0
  130. package/src/Reactivity/Use/Decorators/index.js +4 -0
  131. package/src/Reactivity/Use/Interactions/index.js +4 -0
  132. package/src/Reactivity/Use/Interactions/useBluetooth.js +48 -0
  133. package/src/Reactivity/Use/Interactions/useChannel.js +50 -0
  134. package/src/Reactivity/Use/Interactions/useEventEmmiter.js +64 -0
  135. package/src/Reactivity/Use/Interactions/useSerial.js +0 -0
  136. package/src/Reactivity/Use/Interactions/useThread.js +44 -0
  137. package/src/Reactivity/Use/Interactions/useUsb.js +0 -0
  138. package/src/Reactivity/Use/Sensors/index.js +2 -0
  139. package/src/Reactivity/Use/Sensors/useBattery.js +36 -0
  140. package/src/Reactivity/Use/Sensors/useCamera.js +0 -0
  141. package/src/Reactivity/Use/Sensors/useGeolocation.js +17 -0
  142. package/src/Reactivity/Use/Sensors/useMicro.js +0 -0
  143. package/src/Reactivity/Use/Sensors/useOrientation.js +0 -0
  144. package/src/Reactivity/Use/Storage/index.js +1 -0
  145. package/src/Reactivity/Use/Storage/useCookie.js +0 -0
  146. package/src/Reactivity/Use/Storage/useIndexedDb.js +0 -0
  147. package/src/Reactivity/Use/Storage/useStorage.js +74 -0
  148. package/src/Reactivity/Use/UI/index.js +4 -0
  149. package/src/Reactivity/Use/UI/useCssLink.js +0 -0
  150. package/src/Reactivity/Use/UI/useCssText.js +21 -0
  151. package/src/Reactivity/Use/UI/useFavIcon.js +38 -0
  152. package/src/Reactivity/Use/UI/useLinearGradient.js +0 -0
  153. package/src/Reactivity/Use/UI/useMediaQuery.js +1 -0
  154. package/src/Reactivity/Use/UI/useRadialGradient.js +0 -0
  155. package/src/Reactivity/Use/UI/useStyle.js +54 -0
  156. package/src/Reactivity/Use/UI/useTheme.js +62 -0
  157. package/src/Reactivity/Use/UI/useTitle.js +30 -0
  158. package/src/Reactivity/Use/index.js +82 -0
  159. package/src/Reactivity/Use/todo.md +26 -0
  160. package/src/Reactivity/index.js +3 -0
  161. package/src/Time/animation.js +76 -0
  162. package/src/Time/index.js +54 -0
  163. package/src/Time/loop.js +83 -0
  164. package/src/Time/utils/decorators.js +17 -0
  165. package/src/Time/utils/ease.js +144 -0
  166. package/src/Time/utils/index.js +18 -0
  167. package/src/Time/utils/performance.js +16 -0
  168. package/src/Time/utils/ui.js +26 -0
  169. package/src/UI/CustomElement/Elements/Accordion/index.js +62 -0
  170. package/src/UI/CustomElement/Elements/Carousel/index.js +47 -0
  171. package/src/UI/CustomElement/Elements/CodeNote/CodeCell.js +176 -0
  172. package/src/UI/CustomElement/Elements/CodeNote/CodeNote.js +69 -0
  173. package/src/UI/CustomElement/Elements/CodeNote/SubElements.js +64 -0
  174. package/src/UI/CustomElement/Elements/CodeNote/index.js +2 -0
  175. package/src/UI/CustomElement/Elements/Columns.js +1 -0
  176. package/src/UI/CustomElement/Elements/FAB.js +0 -0
  177. package/src/UI/CustomElement/Elements/Menu.js +0 -0
  178. package/src/UI/CustomElement/Elements/Notification.js +0 -0
  179. package/src/UI/CustomElement/Elements/Popover.js +0 -0
  180. package/src/UI/CustomElement/Elements/Popup.js +0 -0
  181. package/src/UI/CustomElement/Elements/Swipper.js +4 -0
  182. package/src/UI/CustomElement/Elements/Tabs/index.js +111 -0
  183. package/src/UI/CustomElement/Elements/Timeline.js +0 -0
  184. package/src/UI/CustomElement/Elements/Toast.js +0 -0
  185. package/src/UI/CustomElement/Elements/Treeview.js +0 -0
  186. package/src/UI/CustomElement/Elements/index.js +4 -0
  187. package/src/UI/CustomElement/Flex.js +97 -0
  188. package/src/UI/CustomElement/Grid.js +30 -0
  189. package/src/UI/CustomElement/index.js +3 -0
  190. package/src/UI/Embaded/index.js +1 -0
  191. package/src/UI/Inputs/Primitives/btn.js +31 -0
  192. package/src/UI/Inputs/Primitives/elements.js +28 -0
  193. package/src/UI/Inputs/Primitives/inputs.js +334 -0
  194. package/src/UI/Inputs/Primitives/select.js +15 -0
  195. package/src/UI/Inputs/Primitives/textarea.js +16 -0
  196. package/src/UI/Inputs/camera.js +23 -0
  197. package/src/UI/Inputs/index.js +20 -0
  198. package/src/UI/List/elements.js +0 -0
  199. package/src/UI/List/index.js +130 -0
  200. package/src/UI/Media/Audio/index.js +26 -0
  201. package/src/UI/Media/Image/figure.js +17 -0
  202. package/src/UI/Media/Image/image.js +34 -0
  203. package/src/UI/Media/Image/index.js +2 -0
  204. package/src/UI/Media/Video/index.js +37 -0
  205. package/src/UI/Media/index.js +3 -0
  206. package/src/UI/Misc/index.js +49 -0
  207. package/src/UI/Semantic/index.js +68 -0
  208. package/src/UI/Style/index.js +499 -0
  209. package/src/UI/Table/elements.js +94 -0
  210. package/src/UI/Table/index.js +3 -0
  211. package/src/UI/Table/table.js +113 -0
  212. package/src/UI/Table/utils.js +12 -0
  213. package/src/UI/Text/heading.js +35 -0
  214. package/src/UI/Text/index.js +3 -0
  215. package/src/UI/Text/p.js +37 -0
  216. package/src/UI/Text/pre.js +0 -0
  217. package/src/UI/Text/text.js +66 -0
  218. package/src/UI/Utils/index.js +70 -0
  219. package/src/UI/ZikoUIElement.js +478 -0
  220. package/src/UI/index.js +154 -0
  221. package/src/__proto__/Array.js +74 -0
  222. package/src/__proto__/Function.js +0 -0
  223. package/src/__proto__/Number.js +76 -0
  224. package/src/__proto__/Object.js +0 -0
  225. package/src/__proto__/String.js +0 -0
  226. package/src/index.js +69 -0
@@ -0,0 +1,478 @@
1
+ import { ZikoStyle } from "./Style";
2
+ import {
3
+ Pointer,
4
+ Key,
5
+ Drag ,
6
+ Drop,
7
+ Click ,
8
+ Clipboard ,
9
+ Focus,
10
+ CustomEvent,
11
+ } from "../Reactivity/Events"
12
+ import {
13
+ WatchIntersection,
14
+ WatchSize
15
+ } from "../Reactivity";
16
+ import { text } from "./Text";
17
+ import { Random } from "../Math/Random";
18
+ class ZikoUIElement {
19
+ constructor(element,name="") {
20
+ this.target = globalThis.__Target__||globalThis.document.body;
21
+ if(typeof element === "string") element = globalThis.document.createElement(element);
22
+ this.element = element;
23
+ this.uuid=this.constructor.name+"-"+Random.string(10);
24
+ this.cache = {
25
+ name,
26
+ parent:null,
27
+ isRoot:false,
28
+ isHidden: false,
29
+ isFrozzen:false,
30
+ // transformMatrix:matrix([
31
+ // [0,0,0],
32
+ // [0,0,0],
33
+ // [1,1,0]
34
+ // ]),
35
+ style: ZikoStyle({}),
36
+ attributes: {},
37
+ filters: {},
38
+
39
+ };
40
+ this.items = [];
41
+ this.events = {
42
+ ptr:null,
43
+ key:null,
44
+ drag:null,
45
+ drop:null,
46
+ click:null,
47
+ clipboard:null,
48
+ focus:null,
49
+ custom:null,
50
+ }
51
+ this.observer={
52
+ resize:null,
53
+ intersection:null
54
+ }
55
+ this.cache.style.linkTo(this);
56
+ this.style({
57
+ position: "relative",
58
+ boxSizing:"border-box",
59
+ fontFamily:"verdana",
60
+ margin:0,
61
+ padding:0,
62
+ });
63
+ this.size("auto", "auto");
64
+ globalThis.__UI__[this.cache.name]?.push(this)
65
+ }
66
+ get st(){
67
+ return this.cache.style;
68
+ }
69
+ get attr(){
70
+ return this.cache.attributes;
71
+ }
72
+ get evt(){
73
+ return this.cache.events;
74
+ }
75
+ get html(){
76
+ return this.element.innerHTML;
77
+ }
78
+ get __app__(){
79
+ if(this.cache.isRoot)return this;
80
+ let root=this.cache.parent;
81
+ while(1){
82
+ if(!root)return null;
83
+ if(root.cache.isRoot)return root;
84
+ root=root.parent;
85
+ }
86
+ }
87
+ clone() {
88
+ // Not working For Table
89
+ const UI = new this.constructor();
90
+ UI.__proto__=this.__proto__;
91
+ if(this.items.length){
92
+ const items = [...this.items].map(n=>n.clone());
93
+ UI.append(...items);
94
+ }
95
+ else UI.element=this.element.cloneNode(true);
96
+ return UI;
97
+ }
98
+ style(styles,{target = "parent", maskVector = null } = {}){
99
+ this.st.style(styles,{target,maskVector});
100
+ return this;
101
+ }
102
+ size(width,height,{ target, maskVector } = {}){
103
+ this.st.size(width,height,{target,maskVector});
104
+ return this;
105
+ }
106
+ get parent(){
107
+ return this.cache.parent;
108
+ }
109
+ get Width(){
110
+ return this.element.getBoundingClientRect().width;
111
+ }
112
+ get Height(){
113
+ return this.element.getBoundingClientRect().height;
114
+ }
115
+ get Top(){
116
+ return this.element.getBoundingClientRect().top;
117
+ }
118
+ get Right(){
119
+ return this.element.getBoundingClientRect().right;
120
+ }
121
+ get Bottom(){
122
+ return this.element.getBoundingClientRect().bottom;
123
+ }
124
+ get Left(){
125
+ return this.element.getBoundingClientRect().left;
126
+ }
127
+ freeze(freeze){
128
+ this.cache.isFrozzen=freeze;
129
+ return this;
130
+ }
131
+ at(index) {
132
+ return this.items.at(index);
133
+ }
134
+ maintain() {
135
+ for (let i = 0; i < this.items.length; i++)
136
+ Object.assign(this, { [[i]]: this.items[i] });
137
+ this.length = this.items.length;
138
+ return this;
139
+ }
140
+ setTarget(tg) {
141
+ if (tg instanceof ZikoUIElement) tg = tg.element;
142
+ this.remove();
143
+ this.target = tg;
144
+ this.render();
145
+ return this;
146
+ }
147
+ render(render = true , target = this.target) {
148
+ if(target instanceof ZikoUIElement)target=target.element;
149
+ this.target=target;
150
+ if(render) {
151
+ this.target.appendChild(this.element);
152
+ }
153
+ else this.remove();
154
+ return this;
155
+ }
156
+ append(...ele) {
157
+ if(this.cache.isFrozzen){
158
+ console.warn("You can't append new item to frozzen element");
159
+ return this;
160
+ }
161
+ for (let i = 0; i < ele.length; i++){
162
+ if(["number","string"].includes(typeof ele[i]))ele[i]=text(ele[i]);
163
+ if (ele[i] instanceof ZikoUIElement) {
164
+ ele[i].cache.parent=this;
165
+ this.element.appendChild(ele[i].element);
166
+ ele[i].Target = this.element;
167
+ this.items.push(ele[i]);
168
+ } else if (ele[i] instanceof Object) {
169
+ if (ele[i]?.style) this.style(ele[i]?.style);
170
+ if (ele[i]?.attr) {
171
+ Object.entries(ele[i].attr).forEach((n) =>
172
+ this.setAttr("" + n[0], n[1]),
173
+ );
174
+ }
175
+ }
176
+ }
177
+ this.maintain();
178
+ return this;
179
+ }
180
+ remove(...ele) {
181
+ if(ele.length==0){
182
+ if(this.cache.parent)this.cache.parent.remove(this);
183
+ else if(this.target.children.length && [...this.target.children].includes(this.element)) this.target.removeChild(this.element);
184
+ }
185
+ else {
186
+ const remove = (ele) => {
187
+ if(typeof ele === "number") ele=this.items[ele];
188
+ if(ele instanceof ZikoUIElement)this.element.removeChild(ele.element);
189
+ this.items=this.items.filter(n=>n!==ele);
190
+ };
191
+ for (let i = 0; i < ele.length; i++) remove(ele[i]);
192
+ for (let i = 0; i < this.items.length; i++)Object.assign(this, { [[i]]: this.items[i] });
193
+ // Remove from item
194
+ }
195
+ return this;
196
+ }
197
+ removeAfter(t = 1) {
198
+ setTimeout(() => this.remove(), t);
199
+ return this;
200
+ }
201
+ removeItem(...ele) {
202
+ const remove = (ele) => {
203
+ if (ele instanceof ZikoUIElement) this.element.removeChild(ele.element);
204
+ else if (typeof ele === "number")
205
+ this.element.removeChild(this.element.children[ele]);
206
+ };
207
+ for (let i = 0; i < ele.length; i++) remove(ele[i]);
208
+ for (let i = 0; i < this.items.length; i++)
209
+ Object.assign(this, { [[i]]: this.items[i] });
210
+ return this;
211
+ }
212
+ insertAt(index, ...ele) {
213
+ if (index >= this.element.children.length) this.append(...ele);
214
+ else
215
+ for (let i = 0; i < ele.length; i++) {
216
+ if(["number","string"].includes(typeof ele[i]))ele[i]=text(ele[i]);
217
+ this.element.insertBefore(ele[i].element, this.items[index].element);
218
+ this.items.splice(index, 0, ele[i]);
219
+ }
220
+ return this;
221
+ }
222
+ // Attributes
223
+ setAttr(name, value) {
224
+ this.element.setAttribute(name, value);
225
+ Object.assign(this.cache.attributes, Object.fromEntries([[name, value]]));
226
+ return this;
227
+ }
228
+ removeAttr(name) {
229
+ this.element.removeAttribute(name);
230
+ return this;
231
+ }
232
+ setContentEditable(bool = true) {
233
+ this.setAttr("contenteditable", bool);
234
+ return this;
235
+ }
236
+ get children() {
237
+ return [...this.element.children];
238
+ }
239
+ get cloneElement() {
240
+ return this.element.cloneNode(true);
241
+ }
242
+ setClasses(...value) {
243
+ this.setAttr("class", value.join(" "));
244
+ return this;
245
+ }
246
+ get Classes(){
247
+ const classes=this.element.getAttribute("class");
248
+ return classes===null?[]:classes.split(" ");
249
+ }
250
+ addClass() {
251
+ /*this.setAttr("class", value);
252
+ return this;*/
253
+ }
254
+ setId(Id) {
255
+ this.element.setAttribute("id", Id);
256
+ return this;
257
+ }
258
+ get Id() {
259
+ return this.element.getAttribute("id");
260
+ }
261
+ forEach(callback){
262
+ this.items.forEach(callback);
263
+ return this;
264
+ }
265
+ filter(condition_callback,if_callback,else_callback){
266
+ this.items.filter(condition_callback).forEach(if_callback)
267
+ return this;
268
+ }
269
+ filterByTextContent(text,exactMatch=false){
270
+ this.items.map(n=>n.render());
271
+ this.items.filter(n=>{
272
+ const content=n.element.textContent
273
+ return !(exactMatch?content===text:content.includes(text))
274
+ }).map(n=>n.render(false));
275
+ return this;
276
+ }
277
+ filterByClass(value) {
278
+ this.items.map(n=>n.render());
279
+ this.items.filter(n=>!n.Classes.includes(value)).map(n=>n.render(false));
280
+ return this;
281
+ }
282
+ sortByTextContent(value, displays) {
283
+ let item = this.children;
284
+ item
285
+ .filter((n) => !n.textContent.toLowerCase().includes(value.toLowerCase()))
286
+ .map((n) => {
287
+ n.style.display = "none";
288
+ });
289
+ item
290
+ .filter((n) => n.textContent.toLowerCase().includes(value.toLowerCase()))
291
+ .map((n, i) => (n.style.display = displays[i]));
292
+ //return item.filter(n=>n.style.display!="none")
293
+ item.filter((n) => n.style.display != "none");
294
+ return this;
295
+ }
296
+ onPtrMove(...callbacks){
297
+ if(!this.events.ptr)this.events.ptr = Pointer(this);
298
+ this.events.ptr.onMove(...callbacks);
299
+ return this;
300
+ }
301
+ onPtrDown(...callbacks){
302
+ if(!this.events.ptr)this.events.ptr = Pointer(this);
303
+ this.events.ptr.onDown(...callbacks);
304
+ return this;
305
+ }
306
+ onPtrUp(...callbacks){
307
+ if(!this.events.ptr)this.events.ptr = Pointer(this);
308
+ this.events.ptr.onUp(...callbacks);
309
+ return this;
310
+ }
311
+ onPtrEnter(...callbacks){
312
+ if(!this.events.ptr)this.events.ptr = Pointer(this);
313
+ this.events.ptr.onEnter(...callbacks);
314
+ return this;
315
+ }
316
+ onPtrLeave(...callbacks){
317
+ if(!this.events.ptr)this.events.ptr = Pointer(this);
318
+ this.events.ptr.onLeave(...callbacks);
319
+ return this;
320
+ }
321
+ onPtrOut(...callbacks){
322
+ if(!this.events.ptr)this.events.ptr = Pointer(this);
323
+ this.events.ptr.onOut(...callbacks);
324
+ return this;
325
+ }
326
+ onKeyDown(...callbacks){
327
+ if(!this.events.key)this.events.key = Key(this);
328
+ this.events.key.onDown(...callbacks);
329
+ return this;
330
+ }
331
+ onKeyPress(...callbacks){
332
+ if(!this.events.key)this.events.key = Key(this);
333
+ this.events.key.onPress(...callbacks);
334
+ return this;
335
+ }
336
+ onKeyUp(...callbacks){
337
+ if(!this.events.key)this.events.key = Key(this);
338
+ this.events.key.onUp(...callbacks);
339
+ return this;
340
+ }
341
+ onKeysDown({keys=[],callback}={}){
342
+ if(!this.events.key)this.events.key = Key(this);
343
+ this.events.key.handleSuccessifKeys({keys,callback});
344
+ return this;
345
+ }
346
+ onDragStart(...callbacks){
347
+ if(!this.events.drag)this.events.drag = Drag(this);
348
+ this.events.drag.onStart(...callbacks);
349
+ return this;
350
+ }
351
+ onDrag(...callbacks){
352
+ if(!this.events.drag)this.events.drag = Drag(this);
353
+ this.events.drag.onDrag(...callbacks);
354
+ return this;
355
+ }
356
+ onDragEnd(...callbacks){
357
+ if(!this.events.drag)this.events.drag = Drag(this);
358
+ this.events.drag.onEnd(...callbacks);
359
+ return this;
360
+ }
361
+ onDrop(...callbacks){
362
+ if(!this.events.drop)this.events.drop = Drop(this);
363
+ this.events.drop.onDrop(...callbacks);
364
+ return this;
365
+ }
366
+ onClick(...callbacks){
367
+ if(!this.events.click)this.events.click = Click(this);
368
+ this.events.click.onClick(...callbacks);
369
+ return this;
370
+ }
371
+ onDbClick(...callbacks){
372
+ if(!this.events.click)this.events.click = Click(this);
373
+ this.events.click.onDbClick(...callbacks);
374
+ return this;
375
+ }
376
+ onCopy(...callbacks){
377
+ if(!this.events.clipboard)this.events.clipboard = Clipboard(this);
378
+ this.events.clipboard.onCopy(...callbacks);
379
+ return this;
380
+ }
381
+ onCut(...callbacks){
382
+ if(!this.events.clipboard)this.events.clipboard = Clipboard(this);
383
+ this.events.clipboard.onCut(...callbacks);
384
+ return this;
385
+ }
386
+ onPaste(...callbacks){
387
+ if(!this.events.clipboard)this.events.clipboard = Clipboard(this);
388
+ this.events.clipboard.onPaste(...callbacks);
389
+ return this;
390
+ }
391
+ onSelect(...callbacks){
392
+ if(!this.events.clipboard)this.events.clipboard = Clipboard(this);
393
+ this.events.clipboard.onSelect(...callbacks);
394
+ return this;
395
+ }
396
+ onFocus(...callbacks){
397
+ if(!this.events.focus)this.events.focus = Focus(this);
398
+ this.events.focus.onFocus(...callbacks);
399
+ return this;
400
+ }
401
+ onBlur(...callbacks){
402
+ if(!this.events.focus)this.events.focus = Focus(this);
403
+ this.events.focus.onFocus(...callbacks);
404
+ return this;
405
+ }
406
+ on(event_name,...callbacks){
407
+ if(!this.events.custom)this.events.custom = CustomEvent(this);
408
+ this.events.custom.on(event_name,...callbacks);
409
+ return this;
410
+ }
411
+ emit(event_name,detail={}){
412
+ if(!this.events.custom)this.events.custom = CustomEvent(this);
413
+ this.events.custom.emit(event_name,detail);
414
+ return this;
415
+ }
416
+ WatchAttributes(){
417
+
418
+ }
419
+ WatchChildren(){
420
+
421
+ }
422
+ WatchSize(callback){
423
+ if(!this.observer.resize)this.observer.resize = WatchSize(this,callback);
424
+ this.observer.resize.start();
425
+ return this;
426
+ }
427
+ WatchIntersection(callback,config){
428
+ if(!this.observer.intersection)this.observer.intersection = WatchIntersection(this,callback,config);
429
+ this.observer.intersection.start();
430
+ return this;
431
+ }
432
+ get VisibleArea() {
433
+ let coords = this.element.getBoundingClientRect();
434
+ let windowHeight = globalThis.document.documentElement.clientHeight;
435
+ let windowWidth = globalThis.document.documentElement.clientWidth;
436
+ let topVisible = coords.top > 0 && coords.top < windowHeight;
437
+ let bottomVisible = coords.bottom < windowHeight && coords.bottom > 0;
438
+ let leftVisible = coords.left > 0 && coords.left < windowWidth;
439
+ let rightVisible = coords.right > 0 && coords.right < windowWidth;
440
+ return {
441
+ top: topVisible,
442
+ bottom: bottomVisible,
443
+ left: leftVisible,
444
+ right: rightVisible,
445
+ heightRatio: (coords.height + coords.y) / coords.height,
446
+ isVisible: topVisible || bottomVisible || rightVisible || leftVisible,
447
+ };
448
+ }
449
+
450
+
451
+ // toggleSlide() {}
452
+
453
+
454
+ // Glassmorphism(background = "rgba(255,255,255,0.1)", blur = "1px") {
455
+ // this.style({ background: background, backdropFilter: blur });
456
+ // return this;
457
+ // }
458
+ // Neumorphism(r = "50px", bg = "cyan", box = "13px -13px 49px #5d8fac") {
459
+ // this.style({ borderRadius: r, background: bg, boxShadow: box });
460
+ // return this;
461
+ // }
462
+
463
+ setFullScreen(set = true, e) {
464
+ if(!this.element.requestFullscreen){
465
+ console.error("Fullscreen API is not supported in this browser.");
466
+ return this;
467
+ }
468
+ if (set) this.element.requestFullscreen(e);
469
+ else globalThis.document.exitFullscreen();
470
+ return this;
471
+ }
472
+ toggleFullScreen(e) {
473
+ if (!globalThis.document.fullscreenElement) this.element.requestFullscreen(e);
474
+ else globalThis.document.exitFullscreen();
475
+ return this;
476
+ }
477
+ }
478
+ export default ZikoUIElement;
@@ -0,0 +1,154 @@
1
+ import {
2
+ text,
3
+ p,
4
+ h1,
5
+ h2,
6
+ h3,
7
+ h4,
8
+ h5,
9
+ h6
10
+ } from "./Text";
11
+ import {
12
+ br,
13
+ hr,
14
+ brs,
15
+ hrs,
16
+ link,
17
+ ZikoHtml
18
+ } from "./Misc";
19
+ import {
20
+ ol,
21
+ ul
22
+ } from "./List"
23
+ import {
24
+ btn,
25
+ input,
26
+ search,
27
+ slider,
28
+ checkbox,
29
+ radio,
30
+ datalist,
31
+ inputNumber,
32
+ inputColor,
33
+ inputDate,
34
+ inputDateTime,
35
+ inputEmail,
36
+ inputImage,
37
+ inputPassword,
38
+ inputTime,
39
+ select,
40
+ textarea,
41
+ inputCamera
42
+ } from "./Inputs";
43
+ import {
44
+ image,
45
+ video,
46
+ audio,
47
+ figure
48
+ } from "./Media"
49
+ import{
50
+ Flex,
51
+ Grid,
52
+ Carousel,
53
+ CodeCell,
54
+ CodeNote,
55
+ Tabs,
56
+ Accordion,
57
+ } from "./CustomElement"
58
+ import{
59
+ Header,
60
+ Main,
61
+ Section,
62
+ Article,
63
+ Aside,
64
+ Nav,
65
+ Footer,
66
+ } from "./Semantic";
67
+ import { Table } from "./Table";
68
+ const UI={
69
+ ZikoHtml,
70
+ text,
71
+ p,
72
+ h1,
73
+ h2,
74
+ h3,
75
+ h4,
76
+ h5,
77
+ h6,
78
+ btn,
79
+ br,
80
+ hr,
81
+ brs,
82
+ hrs,
83
+ link,
84
+ ol,
85
+ ul,
86
+ input,
87
+ search,
88
+ slider,
89
+ checkbox,
90
+ radio,
91
+ datalist,
92
+ inputNumber,
93
+ inputColor,
94
+ inputDate,
95
+ inputDateTime,
96
+ inputEmail,
97
+ inputImage,
98
+ inputPassword,
99
+ inputTime,
100
+ select,
101
+ textarea,
102
+ inputCamera,
103
+ image,
104
+ video,
105
+ audio,
106
+ figure,
107
+ Flex,
108
+ Carousel,
109
+ Grid,
110
+ Header,
111
+ Main,
112
+ Section,
113
+ Article,
114
+ Aside,
115
+ Nav,
116
+ Footer,
117
+ Table,
118
+ CodeCell,
119
+ CodeNote,
120
+ Tabs,
121
+ Accordion,
122
+ ExtractAll: function () {
123
+ const keys = Object.keys(this);
124
+ for (let i = 0; i < keys.length; i++) {
125
+ const key = keys[i];
126
+ if (key !== 'ExtractAll' && key !== 'RemoveAll') {
127
+ globalThis[key] = this[key];
128
+ }
129
+ }
130
+ return this;
131
+ },
132
+ RemoveAll: function () {
133
+ const keys = Object.keys(this);
134
+ for (let i = 0; i < keys.length; i++) {
135
+ const key = keys[i];
136
+ if (key !== 'RemoveAll') {
137
+ delete globalThis[key];
138
+ }
139
+ }
140
+ return this;
141
+ }
142
+ }
143
+ export * from "./Text";
144
+ export * from "./List";
145
+ export * from "./Inputs";
146
+ export * from "./Media";
147
+ export * from "./Table";
148
+ export * from "./Semantic";
149
+ export * from "./Misc";
150
+ export * from "./CustomElement";
151
+ export {
152
+ ZikoHtml
153
+ }
154
+ export default UI;
@@ -0,0 +1,74 @@
1
+ import {
2
+ add,
3
+ sub,
4
+ mul,
5
+ div,
6
+ modulo,
7
+ inRange,
8
+ mapfun
9
+ } from "../Math/Utils";
10
+ function __ArrayProto__(){
11
+ Object.defineProperties(Array.prototype,{
12
+ inRange:{
13
+ value: function(a,b) {
14
+ return inRange(this.valueOf(),a,b)
15
+ }
16
+ },
17
+ add:{
18
+ value: function(...n) {
19
+ return add(this.valueOf(),...n)
20
+ }
21
+ },
22
+ sub:{
23
+ value: function(...n) {
24
+ return sub(this.valueOf(),...n)
25
+ }
26
+ },
27
+ mul:{
28
+ value: function(...n) {
29
+ return mul(this.valueOf(),...n)
30
+ }
31
+ },
32
+ div:{
33
+ value: function(...n) {
34
+ return div(this.valueOf(),...n)
35
+ }
36
+ },
37
+ modulo:{
38
+ value: function(...n) {
39
+ return modulo(this.valueOf(),...n)
40
+ }
41
+ },
42
+ norm:{
43
+ value: function(min,max) {
44
+ return norm(this.valueOf(),min,max)
45
+ }
46
+ },
47
+ lerp:{
48
+ value: function(min,max) {
49
+ return lerp(this.valueOf(),min,max)
50
+ }
51
+ },
52
+ _map:{
53
+ value: function(a,b,c,d) {
54
+ return map(this.valueOf(),a,b,c,d)
55
+ }
56
+ },
57
+ clamp:{
58
+ value: function(min,max) {
59
+ return clamp(this.valueOf(),min,max)
60
+ }
61
+ },
62
+ deepMap:{
63
+ value: function(callback) {
64
+ return mapfun(callback,...this.valueOf())
65
+ }
66
+ },
67
+ // chunk:{
68
+ // value: function() {
69
+ // }
70
+ // },
71
+
72
+ })
73
+ }
74
+ export {__ArrayProto__}
File without changes