ziko 0.0.11 → 0.0.13

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 (278) hide show
  1. package/README.md +6 -3
  2. package/dist/ziko.cjs +5640 -4532
  3. package/dist/ziko.js +5640 -4532
  4. package/dist/ziko.min.js +2 -2
  5. package/dist/ziko.mjs +5602 -4532
  6. package/package.json +39 -12
  7. package/src/__helpers__/index.js +41 -0
  8. package/src/app/accessibility/index.js +0 -0
  9. package/src/app/app.js +46 -0
  10. package/src/app/component/index.js +38 -0
  11. package/src/app/globals/index.js +20 -0
  12. package/src/app/index.js +12 -0
  13. package/src/app/params/index.js +40 -0
  14. package/src/app/router/index.js +67 -0
  15. package/src/app/seo/index.js +43 -0
  16. package/src/app/themes/dark.js +885 -0
  17. package/src/app/themes/index.js +11 -0
  18. package/src/app/themes/light.js +255 -0
  19. package/src/data/api/fetchdom.js +14 -0
  20. package/src/data/api/index.js +4 -0
  21. package/src/data/api/preload.js +11 -0
  22. package/src/data/converter/adoc.js +130 -0
  23. package/src/data/converter/array.js +43 -0
  24. package/src/data/converter/canvas.js +25 -0
  25. package/src/data/converter/csv.js +33 -0
  26. package/src/data/converter/idea.txt +10 -0
  27. package/src/data/converter/index.js +34 -0
  28. package/src/data/converter/json.js +80 -0
  29. package/src/data/converter/markdown.js +95 -0
  30. package/src/data/converter/object.js +70 -0
  31. package/src/data/converter/svg.js +11 -0
  32. package/src/data/decorators.js +0 -0
  33. package/src/data/index.js +74 -0
  34. package/src/data/parser/markdown.js +0 -0
  35. package/src/data/parser/xml.js +47 -0
  36. package/src/data/string/index.js +1 -0
  37. package/src/data/string/patterns.js +12 -0
  38. package/src/data/string/string.js +170 -0
  39. package/src/graphics/canvas/_canvas_offscreen +0 -0
  40. package/src/graphics/canvas/canvas.js +189 -0
  41. package/src/graphics/canvas/elements/Basic/arc.js +43 -0
  42. package/src/graphics/canvas/elements/Basic/image.js +0 -0
  43. package/src/graphics/canvas/elements/Basic/line.js +26 -0
  44. package/src/graphics/canvas/elements/Basic/path.js +0 -0
  45. package/src/graphics/canvas/elements/Basic/points.js +48 -0
  46. package/src/graphics/canvas/elements/Basic/polygon.js +7 -0
  47. package/src/graphics/canvas/elements/Basic/polyline.js +0 -0
  48. package/src/graphics/canvas/elements/Basic/rect.js +46 -0
  49. package/src/graphics/canvas/elements/Basic/text.js +0 -0
  50. package/src/graphics/canvas/elements/Chart/histogram.js +0 -0
  51. package/src/graphics/canvas/elements/Chart/plot.js +0 -0
  52. package/src/graphics/canvas/elements/Chart/scatter.js +2 -0
  53. package/src/graphics/canvas/elements/Chart/stem.js +0 -0
  54. package/src/graphics/canvas/elements/Element.js +115 -0
  55. package/src/graphics/canvas/elements/Groupe.js +0 -0
  56. package/src/graphics/canvas/elements/grid.js +0 -0
  57. package/src/graphics/canvas/elements/index.js +13 -0
  58. package/src/graphics/canvas/filter/index.js +0 -0
  59. package/src/graphics/canvas/index.js +15 -0
  60. package/src/graphics/canvas/paint/index.js +0 -0
  61. package/src/graphics/canvas/utils/color.js +8 -0
  62. package/src/graphics/canvas/utils/floodFill.js +58 -0
  63. package/src/graphics/index.js +69 -0
  64. package/src/graphics/svg/Elements/Basic/circle.js +26 -0
  65. package/src/graphics/svg/Elements/Basic/ellipse.js +21 -0
  66. package/src/graphics/svg/Elements/Basic/foreignObject.js +33 -0
  67. package/src/graphics/svg/Elements/Basic/groupe.js +29 -0
  68. package/src/graphics/svg/Elements/Basic/image.js +33 -0
  69. package/src/graphics/svg/Elements/Basic/line.js +29 -0
  70. package/src/graphics/svg/Elements/Basic/link.js +30 -0
  71. package/src/graphics/svg/Elements/Basic/path.js +59 -0
  72. package/src/graphics/svg/Elements/Basic/polygon.js +32 -0
  73. package/src/graphics/svg/Elements/Basic/polyline.js +4 -0
  74. package/src/graphics/svg/Elements/Basic/rect.js +43 -0
  75. package/src/graphics/svg/Elements/Basic/text.js +26 -0
  76. package/src/graphics/svg/Elements/Derived/grid.js +9 -0
  77. package/src/graphics/svg/Elements/ZikoSvgElement.js +46 -0
  78. package/src/graphics/svg/Elements/index.js +14 -0
  79. package/src/graphics/svg/index.js +2 -0
  80. package/src/graphics/svg/svg.js +115 -0
  81. package/src/index.js +88 -0
  82. package/src/math/absract.js +1 -0
  83. package/src/math/calculus/index.js +1 -0
  84. package/src/math/calculus/special-functions/bessel.js +31 -0
  85. package/src/math/calculus/special-functions/beta.js +38 -0
  86. package/src/math/calculus/special-functions/gamma.js +30 -0
  87. package/src/math/calculus/special-functions/index.js +4 -0
  88. package/src/math/complex/Fractals/julia.js +0 -0
  89. package/src/math/complex/index.js +203 -0
  90. package/src/math/const.js +3 -0
  91. package/src/math/discret/Combinaison/index.js +34 -0
  92. package/src/math/discret/Conversion/index.js +86 -0
  93. package/src/math/discret/Logic/index.js +46 -0
  94. package/src/math/discret/Permutation/index.js +31 -0
  95. package/src/math/discret/Set/index.js +2 -0
  96. package/src/math/discret/Set/power-set.js +15 -0
  97. package/src/math/discret/Set/sub-set.js +10 -0
  98. package/src/math/discret/index.js +23 -0
  99. package/src/math/functions/index.js +182 -0
  100. package/src/math/index.js +189 -0
  101. package/src/math/matrix/Decomposition.js +90 -0
  102. package/src/math/matrix/LinearSystem.js +10 -0
  103. package/src/math/matrix/Matrix.js +717 -0
  104. package/src/math/matrix/index.js +3 -0
  105. package/src/math/numeric/index.js +0 -0
  106. package/src/math/random/index.js +173 -0
  107. package/src/math/signal/__np.py.txt +40 -0
  108. package/src/math/signal/conv.js +175 -0
  109. package/src/math/signal/fft.js +55 -0
  110. package/src/math/signal/filter.js +39 -0
  111. package/src/math/signal/functions.js +146 -0
  112. package/src/math/signal/index.js +110 -0
  113. package/src/math/statistics/Functions/index.js +100 -0
  114. package/src/math/statistics/index.js +16 -0
  115. package/src/math/utils/arithmetic.js +139 -0
  116. package/src/math/utils/checkers.js +29 -0
  117. package/src/math/utils/comparaison.js +1 -0
  118. package/src/math/utils/conversions.js +19 -0
  119. package/src/math/utils/discret.js +51 -0
  120. package/src/math/utils/index.js +102 -0
  121. package/src/math/utils/mapfun.js +50 -0
  122. package/src/reactivity/events/Global/Click.js +56 -0
  123. package/src/reactivity/events/Global/Clipboard.js +84 -0
  124. package/src/reactivity/events/Global/CustomEvent.js +53 -0
  125. package/src/reactivity/events/Global/Drag.js +137 -0
  126. package/src/reactivity/events/Global/Focus.js +56 -0
  127. package/src/reactivity/events/Global/Key.js +104 -0
  128. package/src/reactivity/events/Global/Mouse.js +230 -0
  129. package/src/reactivity/events/Global/Pointer.js +234 -0
  130. package/src/reactivity/events/Global/Swipe.js +147 -0
  131. package/src/reactivity/events/Global/Touch.js +0 -0
  132. package/src/reactivity/events/Global/Wheel.js +44 -0
  133. package/src/reactivity/events/Partiel/Hash.js +44 -0
  134. package/src/reactivity/events/Partiel/Input.js +59 -0
  135. package/src/reactivity/events/Partiel/Media.js +1 -0
  136. package/src/reactivity/events/ZikoEvent.js +91 -0
  137. package/src/reactivity/events/index.js +63 -0
  138. package/src/reactivity/hooks/Contexte/index.js +1 -0
  139. package/src/reactivity/hooks/Contexte/useSuccesifKeys.js +14 -0
  140. package/src/reactivity/hooks/Decorators/index.js +6 -0
  141. package/src/reactivity/hooks/Decorators/time.js +17 -0
  142. package/src/reactivity/hooks/Decorators/type.js +88 -0
  143. package/src/reactivity/hooks/Interactions/index.js +4 -0
  144. package/src/reactivity/hooks/Interactions/useBluetooth.js +48 -0
  145. package/src/reactivity/hooks/Interactions/useChannel.js +50 -0
  146. package/src/reactivity/hooks/Interactions/useEventEmmiter.js +64 -0
  147. package/src/reactivity/hooks/Interactions/useSerial.js +0 -0
  148. package/src/reactivity/hooks/Interactions/useThread.js +44 -0
  149. package/src/reactivity/hooks/Interactions/useUsb.js +0 -0
  150. package/src/reactivity/hooks/Sensors/index.js +2 -0
  151. package/src/reactivity/hooks/Sensors/useBattery.js +36 -0
  152. package/src/reactivity/hooks/Sensors/useCamera.js +0 -0
  153. package/src/reactivity/hooks/Sensors/useGeolocation.js +17 -0
  154. package/src/reactivity/hooks/Sensors/useMicro.js +0 -0
  155. package/src/reactivity/hooks/Sensors/useOrientation.js +0 -0
  156. package/src/reactivity/hooks/Storage/index.js +1 -0
  157. package/src/reactivity/hooks/Storage/useCookie.js +0 -0
  158. package/src/reactivity/hooks/Storage/useIndexedDb.js +0 -0
  159. package/src/reactivity/hooks/Storage/useStorage.js +73 -0
  160. package/src/reactivity/hooks/UI/index.js +5 -0
  161. package/src/reactivity/hooks/UI/useCssLink.js +0 -0
  162. package/src/reactivity/hooks/UI/useCssText.js +21 -0
  163. package/src/reactivity/hooks/UI/useFavIcon.js +38 -0
  164. package/src/reactivity/hooks/UI/useLinearGradient.js +0 -0
  165. package/src/reactivity/hooks/UI/useMediaQuery.js +43 -0
  166. package/src/reactivity/hooks/UI/useRadialGradient.js +0 -0
  167. package/src/reactivity/hooks/UI/useStyle.js +79 -0
  168. package/src/reactivity/hooks/UI/useTheme.js +62 -0
  169. package/src/reactivity/hooks/UI/useTitle.js +30 -0
  170. package/src/reactivity/hooks/index.js +85 -0
  171. package/src/reactivity/hooks/todo.md +26 -0
  172. package/src/reactivity/idea +2 -0
  173. package/src/reactivity/index.js +22 -0
  174. package/src/reactivity/observer/attributes.js +28 -0
  175. package/src/reactivity/observer/children.js +37 -0
  176. package/src/reactivity/observer/index.js +44 -0
  177. package/src/reactivity/observer/intersection.js +44 -0
  178. package/src/reactivity/observer/mutation.js +113 -0
  179. package/src/reactivity/observer/resize.js +47 -0
  180. package/src/reactivity/observer/screen.js +45 -0
  181. package/src/reactivity/observer/screen.js.txt +84 -0
  182. package/src/reactivity/observer/screen.txt +13 -0
  183. package/src/time/animation.js +76 -0
  184. package/src/time/index.js +54 -0
  185. package/src/time/loop.js +87 -0
  186. package/src/time/utils/decorators.js +17 -0
  187. package/src/time/utils/ease.js +144 -0
  188. package/src/time/utils/index.js +18 -0
  189. package/src/time/utils/performance.js +16 -0
  190. package/src/time/utils/ui.js +26 -0
  191. package/src/user-interface/elements/derived/Flex.js +103 -0
  192. package/src/user-interface/elements/derived/Grid.js +33 -0
  193. package/src/user-interface/elements/derived/elements/Notification.js +0 -0
  194. package/src/user-interface/elements/derived/elements/Popover.js +0 -0
  195. package/src/user-interface/elements/derived/elements/Popup.js +0 -0
  196. package/src/user-interface/elements/derived/elements/Swipper.js +4 -0
  197. package/src/user-interface/elements/derived/elements/Timeline.js +0 -0
  198. package/src/user-interface/elements/derived/elements/Toast.js +0 -0
  199. package/src/user-interface/elements/derived/elements/Treeview.js +0 -0
  200. package/src/user-interface/elements/derived/elements/accordion/accordion.js +45 -0
  201. package/src/user-interface/elements/derived/elements/accordion/collapsible.js +82 -0
  202. package/src/user-interface/elements/derived/elements/accordion/index.js +2 -0
  203. package/src/user-interface/elements/derived/elements/alert/alert.js +80 -0
  204. package/src/user-interface/elements/derived/elements/alert/index.js +1 -0
  205. package/src/user-interface/elements/derived/elements/alert/palette.js +52 -0
  206. package/src/user-interface/elements/derived/elements/carousel/index.js +50 -0
  207. package/src/user-interface/elements/derived/elements/code-note/SubElements.js.txt +105 -0
  208. package/src/user-interface/elements/derived/elements/code-note/code-cell.js +195 -0
  209. package/src/user-interface/elements/derived/elements/code-note/code-note.js +72 -0
  210. package/src/user-interface/elements/derived/elements/code-note/index.js +2 -0
  211. package/src/user-interface/elements/derived/elements/code-note/sub-elements.js +67 -0
  212. package/src/user-interface/elements/derived/elements/columns.js +1 -0
  213. package/src/user-interface/elements/derived/elements/fab.js +0 -0
  214. package/src/user-interface/elements/derived/elements/index.js +9 -0
  215. package/src/user-interface/elements/derived/elements/menu/index.js +1 -0
  216. package/src/user-interface/elements/derived/elements/menu/menu3d.js +260 -0
  217. package/src/user-interface/elements/derived/elements/modal/index.js +92 -0
  218. package/src/user-interface/elements/derived/elements/pagination/breadcrumbs.js +54 -0
  219. package/src/user-interface/elements/derived/elements/pagination/index.js +1 -0
  220. package/src/user-interface/elements/derived/elements/splitter/__ZikoUISplitter__.js +62 -0
  221. package/src/user-interface/elements/derived/elements/splitter/hsplitter.js +40 -0
  222. package/src/user-interface/elements/derived/elements/splitter/index.js +2 -0
  223. package/src/user-interface/elements/derived/elements/splitter/vsplitter.js +40 -0
  224. package/src/user-interface/elements/derived/elements/tabs/index.js +180 -0
  225. package/src/user-interface/elements/derived/index.js +3 -0
  226. package/src/user-interface/elements/primitives/ZikoUIContainerElement.js +127 -0
  227. package/src/user-interface/elements/primitives/ZikoUIElement.js +478 -0
  228. package/src/user-interface/elements/primitives/embaded/index.js +1 -0
  229. package/src/user-interface/elements/primitives/index.js +8 -0
  230. package/src/user-interface/elements/primitives/io/Form/index.js +42 -0
  231. package/src/user-interface/elements/primitives/io/Form/index.js.txt +104 -0
  232. package/src/user-interface/elements/primitives/io/Inputs/__helpers__.js +52 -0
  233. package/src/user-interface/elements/primitives/io/Inputs/index.js +12 -0
  234. package/src/user-interface/elements/primitives/io/Inputs/input/index.js +98 -0
  235. package/src/user-interface/elements/primitives/io/Inputs/input-camera/index.js +26 -0
  236. package/src/user-interface/elements/primitives/io/Inputs/input-checkbox/index.js +26 -0
  237. package/src/user-interface/elements/primitives/io/Inputs/input-color/index.js +16 -0
  238. package/src/user-interface/elements/primitives/io/Inputs/input-date-time/index.js +3 -0
  239. package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-date-time.js +14 -0
  240. package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-date.js +14 -0
  241. package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-time.js +14 -0
  242. package/src/user-interface/elements/primitives/io/Inputs/input-email-password/index.js +2 -0
  243. package/src/user-interface/elements/primitives/io/Inputs/input-email-password/input-email.js +15 -0
  244. package/src/user-interface/elements/primitives/io/Inputs/input-email-password/input-password.js +14 -0
  245. package/src/user-interface/elements/primitives/io/Inputs/input-file/index.js +1 -0
  246. package/src/user-interface/elements/primitives/io/Inputs/input-file/input-file.js +0 -0
  247. package/src/user-interface/elements/primitives/io/Inputs/input-file/input-image.js +43 -0
  248. package/src/user-interface/elements/primitives/io/Inputs/input-number/index.js +37 -0
  249. package/src/user-interface/elements/primitives/io/Inputs/input-radio/index.js +26 -0
  250. package/src/user-interface/elements/primitives/io/Inputs/input-search/index.js +45 -0
  251. package/src/user-interface/elements/primitives/io/Inputs/input-slider/index.js +34 -0
  252. package/src/user-interface/elements/primitives/io/Select/index.js +20 -0
  253. package/src/user-interface/elements/primitives/io/Textarea/index.js +18 -0
  254. package/src/user-interface/elements/primitives/io/index.js +4 -0
  255. package/src/user-interface/elements/primitives/list/elements.js +0 -0
  256. package/src/user-interface/elements/primitives/list/index.js +139 -0
  257. package/src/user-interface/elements/primitives/media/Audio/index.js +17 -0
  258. package/src/user-interface/elements/primitives/media/Image/figure.js +19 -0
  259. package/src/user-interface/elements/primitives/media/Image/image.js +36 -0
  260. package/src/user-interface/elements/primitives/media/Image/index.js +2 -0
  261. package/src/user-interface/elements/primitives/media/Video/index.js +27 -0
  262. package/src/user-interface/elements/primitives/media/__ZikoUIDynamicMediaELement__.js +47 -0
  263. package/src/user-interface/elements/primitives/media/index.js +3 -0
  264. package/src/user-interface/elements/primitives/misc/index.js +99 -0
  265. package/src/user-interface/elements/primitives/semantic/index.js +82 -0
  266. package/src/user-interface/elements/primitives/table/elements.js +94 -0
  267. package/src/user-interface/elements/primitives/table/index.js +3 -0
  268. package/src/user-interface/elements/primitives/table/table.js +115 -0
  269. package/src/user-interface/elements/primitives/table/utils.js +12 -0
  270. package/src/user-interface/elements/primitives/text/__ZikoUIText__.js +71 -0
  271. package/src/user-interface/elements/primitives/text/heading.js +36 -0
  272. package/src/user-interface/elements/primitives/text/index.js +3 -0
  273. package/src/user-interface/elements/primitives/text/p.js +26 -0
  274. package/src/user-interface/elements/primitives/text/pre.js +0 -0
  275. package/src/user-interface/elements/primitives/text/text.js +81 -0
  276. package/src/user-interface/index.js +188 -0
  277. package/src/user-interface/style/index.js +510 -0
  278. package/src/user-interface/utils/index.js +70 -0
@@ -0,0 +1,95 @@
1
+ const parseInlineElements = text => {
2
+ return text
3
+ .replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
4
+ .replace(/\*(.*?)\*/g, '<em>$1</em>')
5
+ .replace(/\[(.*?)\]\((.*?)\)/g, '<a href="$2">$1</a>')
6
+ .replace(/!\[(.*?)\]\((.*?)\)/g, '<img src="$2" alt="$1">')
7
+ .replace(/`([^`]+)`/g, '<code>$1</code>'); // Inline Code
8
+ };
9
+
10
+ const parseTable = line => {
11
+ const cells = line.split('|').map(cell => cell.trim()).filter(cell => cell !== '');
12
+ const tableRow = cells.map(cell => `<td>${parseInlineElements(cell)}</td>`).join('');
13
+ return `<tr>${tableRow}</tr>\n`;
14
+ };
15
+
16
+ const parseCodeBlock = (lines, language) => {
17
+ const codeContent = lines.join('\n'); // No need to exclude the triple backticks
18
+ const highlightedCode = language ? `<pre><code data-language="${language}">${codeContent}</code></pre>` : `<pre><code>${codeContent}</code></pre>`;
19
+ return `${highlightedCode}\n`;
20
+ };
21
+
22
+ const parseList = line => {
23
+ const DIGIT_FOLLOWED_BY_A_DOT_AND_SPACE = /^\d+\.\s/;
24
+ const match = line.match(DIGIT_FOLLOWED_BY_A_DOT_AND_SPACE);
25
+ if (match) {
26
+ let start = +match[1];
27
+ return `<ol${start===1?"":` start="${start}"`}>${parseInlineElements(line.slice(match[0].length))}</ol>\n`;
28
+ }
29
+ return `<ul>${parseInlineElements(line)}</ul>\n`;
30
+ };
31
+
32
+ const parseHorizontalRule = () => {
33
+ return '<hr>\n';
34
+ };
35
+
36
+ const markdown2html = markdownText => {
37
+ const lines = markdownText.split('\n');
38
+ let htmlOutput = '';
39
+ let inTable = false;
40
+ let inCodeBlock = false;
41
+ let codeBlockLines = [];
42
+ let codeBlockLanguage = '';
43
+ for (let i = 0; i < lines.length; i++) {
44
+ let line = lines[i];
45
+ // Table
46
+ if (line.startsWith('|')) {
47
+ if (!inTable) {
48
+ inTable = true;
49
+ htmlOutput += '<table>\n';
50
+ }
51
+ htmlOutput += parseTable(line);
52
+ continue;
53
+ } else if (inTable) {
54
+ inTable = false;
55
+ htmlOutput += '</table>\n';
56
+ }
57
+ // Code block
58
+ if (line.startsWith('```')) {
59
+ if (!inCodeBlock) {
60
+ inCodeBlock = true;
61
+ codeBlockLines = [];
62
+ codeBlockLanguage = line.slice(3).trim();
63
+ } else {
64
+ inCodeBlock = false;
65
+ htmlOutput += parseCodeBlock(codeBlockLines, codeBlockLanguage);
66
+ }
67
+ continue;
68
+ } else if (inCodeBlock) {
69
+ codeBlockLines.push(line);
70
+ continue;
71
+ }
72
+ // Headings
73
+ if (line.startsWith('# ')) {
74
+ const headingLevel = line.indexOf(' ');
75
+ const headingText = line.slice(headingLevel + 1);
76
+ htmlOutput += `<h${headingLevel}>${parseInlineElements(headingText)}</h${headingLevel}>\n`;
77
+ continue;
78
+ }
79
+ // Lists
80
+ if (line.startsWith('- ') || line.startsWith('* ') || line.match(/^\d+\.\s/)) {
81
+ htmlOutput += parseList(line);
82
+ continue;
83
+ }
84
+ // Horizontal Rule
85
+ if (line.trim() === '---') {
86
+ htmlOutput += parseHorizontalRule();
87
+ continue;
88
+ }
89
+ // Other paragraphs
90
+ htmlOutput += `<p>${parseInlineElements(line)}</p>\n`;
91
+ }
92
+ return htmlOutput;
93
+ };
94
+
95
+ export { markdown2html };
@@ -0,0 +1,70 @@
1
+ import { arr2str } from "../index.js";
2
+ import { Complex, mapfun, Matrix } from "../../math/index.js";
3
+
4
+ // const obj2str=(object)=>{
5
+ // const recursiveToString = (obj) => {
6
+ // if (Array.isArray(obj)) return arr2str(obj);
7
+ // if (typeof obj === 'object' && obj !== null) {
8
+ // return `{ ${Object.entries(obj)
9
+ // .map(([key, value]) => `${key}:${recursiveToString(value)}`)
10
+ // .join(" , ")} }`;
11
+ // }
12
+ // return String(obj);
13
+ // };
14
+ // return recursiveToString(object);
15
+ // };
16
+ // const obj2str = (object) => {
17
+ // const recursiveToString = (obj, indentLevel = 0) => {
18
+ // const indent = ' '.repeat(indentLevel);
19
+ // const nextIndent = ' '.repeat(indentLevel + 1);
20
+ // if(Array.isArray(obj)) return arr2str(obj, indentLevel);
21
+ // if(obj instanceof Complex || obj instanceof Matrix) return obj.toString();
22
+ // if (typeof obj === 'object' && obj !== null) {
23
+ // const entries = Object.entries(obj)
24
+ // .map(([key, value]) => `${nextIndent}${key}: ${recursiveToString(value, indentLevel + 1)}`)
25
+ // .join(",\n");
26
+
27
+ // return `{\n${entries}\n${indent}}`;
28
+ // }
29
+
30
+ // return String(obj);
31
+ // };
32
+
33
+ // return recursiveToString(object);
34
+ // };
35
+ // const obj2str = (object, useIndentation = true, indentLevel = 0) => {
36
+ // const recursiveToString = (obj, level = 0) => {
37
+ // const indent = useIndentation ? ' '.repeat(level) : '';
38
+ // const nextIndent = useIndentation ? ' '.repeat(level + 1) : '';
39
+ // if (Array.isArray(obj)) return arr2str(obj, false, level);
40
+ // if(obj instanceof Complex || obj instanceof Matrix) return obj.toString();
41
+ // if (typeof obj === 'object' && obj !== null) {
42
+ // const entries = Object.entries(obj)
43
+ // .map(([key, value]) => useIndentation
44
+ // ? `${nextIndent}${key}: ${recursiveToString(value, level + 1)}`
45
+ // : `${key}: ${recursiveToString(value, level + 1)}`
46
+ // ).join(useIndentation ? ",\n" : ", ");
47
+
48
+ // return useIndentation
49
+ // ? `{\n${entries}\n${indent}}`
50
+ // : `{${entries}}`;
51
+ // }
52
+
53
+ // return String(obj);
54
+ // };
55
+
56
+ // return recursiveToString(object, indentLevel);
57
+ // };
58
+
59
+ const obj2str=(obj)=>JSON.stringify(
60
+ mapfun(n=>{
61
+ if(["number","string","boolean","bigint"].includes(typeof n)) return String(n);
62
+ if(n instanceof Complex || n instanceof Matrix) return n.toString();
63
+ if(n instanceof Array) return arr2str(n)
64
+ },
65
+ obj), null, " ")
66
+ .replace(/"([^"]+)":/g, '$1:') // Remove Quotes from Keys
67
+ .replace(/: "([^"]+)"/g, ': $1'); // Remove Quotes from str values
68
+ export{
69
+ obj2str
70
+ }
@@ -0,0 +1,11 @@
1
+ import { image } from "../../user-interface/elements/primitives/media/Image/image.js"
2
+ const svg2str=svg=>(new XMLSerializer()).serializeToString(svg);
3
+ const svg2ascii=svg=>btoa(svg2str(svg));
4
+ const svg2imgUrl=svg=>'data:image/svg+xml;base64,'+svg2ascii(svg);
5
+ const svg2img=(svg,render=true)=>image(svg2imgUrl(svg)).render(render);
6
+ export{
7
+ svg2str,
8
+ svg2ascii,
9
+ svg2imgUrl,
10
+ svg2img
11
+ }
File without changes
@@ -0,0 +1,74 @@
1
+ import {
2
+ obj2str,
3
+ arr2str,
4
+ markdown2html,
5
+ adoc2html,
6
+ csv2arr,
7
+ csv2matrix,
8
+ csv2object,
9
+ csv2json,
10
+ csv2sql,
11
+ json2arr,
12
+ json2csv,
13
+ json2csvFile,
14
+ json2yml,
15
+ json2ymlFile,
16
+ json2xml,
17
+ json2xmlFile,
18
+ svg2str,
19
+ svg2ascii,
20
+ svg2imgUrl,
21
+ svg2img,
22
+ } from "./converter/index.js";
23
+ import parseXML from "./parser/xml.js";
24
+ import { preload } from "./api/preload.js";
25
+ import {str,Str} from "./string/index.js"
26
+ const Data={
27
+ str,
28
+ Str,
29
+ parseXML,
30
+ preload,
31
+ obj2str,
32
+ arr2str,
33
+ markdown2html,
34
+ adoc2html,
35
+ csv2arr,
36
+ csv2matrix,
37
+ csv2object,
38
+ csv2json,
39
+ csv2sql,
40
+ json2arr,
41
+ json2csv,
42
+ json2csvFile,
43
+ json2yml,
44
+ json2ymlFile,
45
+ json2xml,
46
+ json2xmlFile,
47
+ svg2str,
48
+ svg2ascii,
49
+ svg2imgUrl,
50
+ svg2img,
51
+ ExtractAll: function () {
52
+ const keys = Object.keys(this);
53
+ for (let i = 0; i < keys.length; i++) {
54
+ const key = keys[i];
55
+ if (key !== 'ExtractAll' && key !== 'RemoveAll') {
56
+ globalThis[key] = this[key];
57
+ }
58
+ }
59
+ return this;
60
+ },
61
+ RemoveAll: function () {
62
+ const keys = Object.keys(this);
63
+ for (let i = 0; i < keys.length; i++) {
64
+ const key = keys[i];
65
+ if (key !== 'RemoveAll') {
66
+ delete globalThis[key];
67
+ }
68
+ }
69
+ return this;
70
+ }
71
+ }
72
+ export * from "./converter/index.js";
73
+ export * from "./string/index.js"
74
+ export default Data
File without changes
@@ -0,0 +1,47 @@
1
+ function parseXML(xmlString) {
2
+ const parser = new DOMParser();
3
+ const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
4
+ const rootNode = xmlDoc.documentElement;
5
+ const result = parseNode(rootNode);
6
+ return result;
7
+ }
8
+
9
+ function parseNode(node) {
10
+ const obj = {
11
+ type: node.nodeName,
12
+ attributes: {},
13
+ children: []
14
+ };
15
+ for (let i = 0; i < node.attributes.length; i++) {
16
+ const attr = node.attributes[i];
17
+ obj.attributes[attr.name] = attr.value;
18
+ }
19
+ for (let i = 0; i < node.childNodes.length; i++) {
20
+ const child = node.childNodes[i];
21
+ if (child.nodeType === Node.ELEMENT_NODE) {
22
+ obj.children.push(parseNode(child));
23
+ } else if (child.nodeType === Node.TEXT_NODE) {
24
+ obj.text = child.textContent.trim();
25
+ }
26
+ }
27
+ return obj;
28
+ }
29
+ export default parseXML;
30
+
31
+ // function htmlParser(element) {
32
+ // const obj = {
33
+ // type: element.tagName,
34
+ // attributes: {},
35
+ // children: [],
36
+ // };
37
+ // for (let i = 0; i < element.attributes.length; i++) {
38
+ // const attr = element.attributes[i];
39
+ // obj.attributes[attr.name] = attr.value;
40
+ // }
41
+ // for (let i = 0; i < element.children.length; i++) {
42
+ // const child = element.children[i];
43
+ // obj.children.push(htmlParser(child));
44
+ // }
45
+ // return obj;
46
+ // }
47
+
@@ -0,0 +1 @@
1
+ export * from "./string.js";
@@ -0,0 +1,12 @@
1
+ const Patterns={
2
+ isDigit: /^\d+$/,
3
+ isEmail: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,
4
+ isURL: /^(https?:\/\/)?([\w\-]+\.)+[\w\-]+(\/[\w\-./?%&=]*)?$/,
5
+ isHexColor: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,
6
+ 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]?)$/,
7
+ isMACAddress: /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/,
8
+ isDate: /^\d{4}-\d{2}-\d{2}$/,
9
+ }
10
+ export{
11
+ Patterns
12
+ }
@@ -0,0 +1,170 @@
1
+ import { Patterns } from "./patterns.js";
2
+ class Str{
3
+ constructor(string){
4
+ this.string=string;
5
+ }
6
+ isDigit() {
7
+ return Patterns.isDigit.test(this.string);
8
+ }
9
+ static isDigit(string){
10
+ return new Str(string).isDigit();
11
+ }
12
+ isNumber() {
13
+ return !isNaN(this.string);
14
+ }
15
+ static isNumber(string){
16
+ return new Str(string).isNumber();
17
+ }
18
+ isUrl(){
19
+ return Patterns.isURL.test(this.string);
20
+ }
21
+ static isUrl(string){
22
+ return new Str(string).isUrl();
23
+ }
24
+ isHexColor(){
25
+ return Patterns.isHexColor.test(this.string);
26
+ }
27
+ static isHexColor(string){
28
+ return new Str(string).isHexColor();
29
+ }
30
+ isIPv4(){
31
+ return Patterns.isIPv4.test(this.string);
32
+ }
33
+ static isIPv4(string){
34
+ return new Str(string).isIPv4();
35
+ }
36
+ isDate(){
37
+ return Patterns.isDate.test(this.string);
38
+ }
39
+ static isDate(string){
40
+ return new Str(string).isDate();
41
+ }
42
+ isMACAddress(){
43
+ return Patterns.isMACAddress.test(this.string);
44
+ }
45
+ static isMACAddress(string){
46
+ return new Str(string).isMACAddress();
47
+ }
48
+ isPascalCase(){
49
+ if (this.string.length === 0) return false;
50
+ const PascalCasePattern = /^[A-Z][a-zA-Z0-9]*$/;
51
+ return PascalCasePattern.test(this.string);
52
+ }
53
+ static isPascalCase(string){
54
+ return new Str(string).isPascalCase();
55
+ }
56
+ isCamelCase() {
57
+ if (this.string.length === 0) return false;
58
+ const camelCasePattern = /^[a-z][a-zA-Z0-9]*$/;
59
+ return camelCasePattern.test(this.string);
60
+ }
61
+ static isCamelCase(string){
62
+ return new Str(string).isCamelCase();
63
+ }
64
+ isHyphenCase(){
65
+ return this.string.split('-').length > 1;
66
+ }
67
+ static isHyphenCase(string){
68
+ return new Str(string).isHyphenCase();
69
+ }
70
+ isSnakeCase(){
71
+ return this.string.split('_').length > 1;
72
+ }
73
+ static isSnakeCase(string){
74
+ return new Str(string).isSnakeCase();
75
+ }
76
+ isPalindrome(){
77
+ const str=this.string.toLocaleLowerCase();
78
+ let l=str.length,i;
79
+ for(i=0;i<l/2;i++)if(str[i]!=str[l-i-1])return false;
80
+ return true;
81
+ }
82
+ static isPalindrome(string){
83
+ return new Str(string).isPalindrome();
84
+ }
85
+ static isAnagrams(word,words){
86
+ word=word.split("").sort();
87
+ words=words.split("").sort();
88
+ return JSON.stringify(word)===JSON.stringify(words);
89
+ }
90
+ isIsogram(){
91
+ return [...new Set(this.string.toLowerCase())].length===this.string.length;
92
+ }
93
+ static isIsogram(string){
94
+ return new Str(string).isIsogram();
95
+ }
96
+ static camel2hyphencase(text) {
97
+ return text.replace(/[A-Z]/g, match => '-' + match.toLowerCase());
98
+ }
99
+ static camel2snakecase(text) {
100
+ return text.replace(/[A-Z]/g, match => '_' + match.toLowerCase());
101
+ }
102
+ static camel2pascalcase(text) {
103
+ return text.charAt(0).toUpperCase() + text.slice(1);
104
+ }
105
+ static camel2constantcase(text) {
106
+ return text.replace(/[A-Z]/g, match => '_' + match).toUpperCase();
107
+ }
108
+ static pascal2snakecase(text) {
109
+ return text.replace(/([A-Z])/g, (match, offset) => offset ? '_' + match.toLowerCase() : match.toLowerCase());
110
+ }
111
+ static pascal2hyphencase(text) {
112
+ return text.replace(/([A-Z])/g, (match, offset) => offset ? '-' + match.toLowerCase() : match.toLowerCase());
113
+ }
114
+ static pascal2camelcase(text) {
115
+ return text.charAt(0).toLowerCase() + text.slice(1);
116
+ }
117
+ static pascal2constantcase(text) {
118
+ return text.replace(/([A-Z])/g, (match, offset) => offset ? '_' + match : match).toUpperCase();
119
+ }
120
+ static snake2camelcase(text) {
121
+ return text.replace(/(_\w)/g, match => match[1].toUpperCase());
122
+ }
123
+ static snake2hyphencase(text) {
124
+ return text.replace(/_/g, "-");
125
+ }
126
+ static snake2pascalcase(text) {
127
+ return text.split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
128
+ }
129
+ static snake2constantcase(text) {
130
+ return text.toUpperCase();
131
+ }
132
+ static hyphen2camelcase(text) {
133
+ return text.replace(/-([a-z])/g, match => match[1].toUpperCase());
134
+ }
135
+ static hyphen2snakecase(text) {
136
+ return text.replace(/-/g, '_');
137
+ }
138
+ static hyphen2pascalcase(text) {
139
+ return text.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
140
+ }
141
+ static hyphen2constantcase(text) {
142
+ return text.replace(/-/g, '_').toUpperCase();
143
+ }
144
+ static constant2camelcase(text) {
145
+ return text.toLowerCase().replace(/_([a-z])/g, match => match[1].toUpperCase());
146
+ }
147
+ static constant2snakecase(text) {
148
+ return text.toLowerCase();
149
+ }
150
+ static constant2pascalcase(text) {
151
+ return text.toLowerCase().split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
152
+ }
153
+ static constant2hyphencase(text) {
154
+ return text.toLowerCase().replace(/_/g, '-');
155
+ }
156
+ }
157
+ const removeExtraSpace=str=>str.replace(/\s+/g,' ');
158
+ const count=(str,value)=>str.split("").filter(x => x==value).length;
159
+ const countWords=(str,value)=>str.split(" ").filter(x => x==value).length;
160
+
161
+ export{
162
+ removeExtraSpace,
163
+ count,
164
+ countWords
165
+ }
166
+ const str=string=>new Str(string);
167
+ export{
168
+ Str,
169
+ str
170
+ }
File without changes
@@ -0,0 +1,189 @@
1
+ import ZikoUIContainerElement from "../../user-interface/elements/primitives/ZikoUIContainerElement.js";
2
+ import {Matrix} from "../../math/matrix/index.js"
3
+ import { convolute } from "../../math/signal/conv.js";
4
+ class ZikoUICanvas extends ZikoUIContainerElement{
5
+ constructor(w,h){
6
+ super("canvas","canvas");
7
+ //this.element=document?.createElement("canvas");
8
+ this.ctx = this.element?.getContext("2d");
9
+ this.style({
10
+ border:"1px red solid",
11
+ //width:"300px",
12
+ //height:"300px"
13
+ })
14
+ this.transformMatrix=new Matrix([
15
+ [1,0,0],
16
+ [0,1,0],
17
+ [0,0,1]
18
+ ])
19
+ this.axisMatrix=new Matrix([
20
+ [-10,-10],
21
+ [10,10]
22
+ ])
23
+ // this.render(globalThis.__Ziko__.__Config__.default.render);
24
+ setTimeout(()=>this.resize(w,h),0);
25
+ this.on("sizeupdated",()=>this.adjust())
26
+ }
27
+ get Width(){
28
+ return this.element?.width;
29
+ }
30
+ get Height(){
31
+ return this.element?.height;
32
+ }
33
+ get Xmin(){
34
+ return this.axisMatrix[0][0];
35
+ }
36
+ get Ymin(){
37
+ return this.axisMatrix[0][1];
38
+ }
39
+ get Xmax(){
40
+ return this.axisMatrix[1][0];
41
+ }
42
+ get Ymax(){
43
+ return this.axisMatrix[1][1];
44
+ }
45
+ get ImageData(){
46
+ return this.ctx.getImageData(0,0,c.Width,c.Height);
47
+ }
48
+ draw(all=true){
49
+ if(all){
50
+ this.clear();
51
+ this.items.forEach(element => {
52
+ element.parent=this;
53
+ element.draw(this.ctx)
54
+ });
55
+ }
56
+ else {
57
+ this.items.at(-1).parent=this;
58
+ this.items.at(-1).draw(this.ctx);
59
+ }
60
+ this.maintain();
61
+ return this;
62
+ }
63
+ applyTransformMatrix(){
64
+ this.ctx.setTransform(
65
+ this.transformMatrix[0][0],
66
+ this.transformMatrix[1][0],
67
+ this.transformMatrix[0][1],
68
+ this.transformMatrix[1][1],
69
+ this.transformMatrix[0][2],
70
+ this.transformMatrix[1][2],
71
+ );
72
+ return this;
73
+ }
74
+ resize(w,h){
75
+ // this.style({
76
+ // width:w,
77
+ // height:h
78
+ // })
79
+ this.size(w,h)
80
+ this.lineWidth();
81
+ this.view(this.axisMatrix[0][0], this.axisMatrix[0][1], this.axisMatrix[1][0], this.axisMatrix[1][1]);
82
+ this.emit("sizeupdated");
83
+ return this;
84
+ }
85
+ adjust(){
86
+ this.element.width =this.element?.getBoundingClientRect().width;
87
+ this.element.height =this.element?.getBoundingClientRect().height;
88
+ this.view(this.axisMatrix[0][0], this.axisMatrix[0][1], this.axisMatrix[1][0], this.axisMatrix[1][1]);
89
+ return this;
90
+ }
91
+ view(xMin,yMin,xMax,yMax){
92
+ this.transformMatrix[0][0]=this.Width/(xMax-xMin); // scaleX
93
+ this.transformMatrix[1][1]=-this.Height/(yMax-yMin); // scaleY
94
+ this.transformMatrix[0][2]=this.Width/2;
95
+ this.transformMatrix[1][2]=this.Height/2;
96
+ this.axisMatrix=new Matrix([
97
+ [xMin,yMin],
98
+ [xMax,yMax]
99
+ ])
100
+
101
+ this.applyTransformMatrix();
102
+ this.clear();
103
+ this.lineWidth(1);
104
+ this.draw();
105
+ return this;
106
+ }
107
+ reset(){
108
+ this.ctx.setTransform(1,0,0,0,0,0);
109
+ return this;
110
+ }
111
+ append(element){
112
+ this.items.push(element);
113
+ this.draw(false);
114
+ return this;
115
+ }
116
+ background(color){
117
+ this.ctx.fillStyle = color;
118
+ this.ctx.setTransform(1, 0, 0, 1, 0, 0);
119
+ this.ctx.fillRect(0, 0, this.Width, this.Height);
120
+ this.applyTransformMatrix();
121
+ this.draw();
122
+ }
123
+ lineWidth(w){
124
+ this.ctx.lineWidth=w/this.transformMatrix[0][0];;
125
+ return this
126
+ }
127
+ ImageData(x=0,y=0,w=this.Width,h=this.Height){
128
+ return this.ctx.getImageData(x,y,w,h);
129
+ }
130
+ clear(){
131
+ this.ctx.setTransform(1, 0, 0, 1, 0, 0);
132
+ this.ctx.clearRect(0, 0, this.Width, this.Height);
133
+ this.applyTransformMatrix();
134
+ return this;
135
+ }
136
+ clone(){
137
+ console.log(this.Width)
138
+ const canvas=new ZikoUICanvas();
139
+ canvas.items=this.items;
140
+ canvas.transformMatrix=this.transformMatrix;
141
+ canvas.axisMatrix=this.axisMatrix;
142
+ Object.assign(canvas.cache,{...this.cache});
143
+ //waitForUIElm(this)
144
+ //console.log(element)
145
+ this.size(element.style.width,element.style.width);
146
+ this.applyTransformMatrix();
147
+ this.draw();
148
+ this.adjust();
149
+ return canvas;
150
+ }
151
+ toImage() {
152
+ this.img = document?.createElement("img");
153
+ this.img.src = this.element?.toDataURL("image/png");
154
+ return this;
155
+ }
156
+ toBlob() {
157
+ var canvas = this.element;
158
+ canvas.toBlob(function (blob) {
159
+ var newImg = document?.createElement("img"),
160
+ url = URL.createObjectURL(blob);
161
+ newImg.onload = function () {
162
+ URL.revokeObjectURL(url);
163
+ };
164
+ newImg.src = url;
165
+ console.log(newImg);
166
+ });
167
+ }
168
+ zoomIn(){
169
+
170
+ }
171
+ zoomOut(){
172
+
173
+ }
174
+ undo(n){
175
+
176
+ }
177
+ redo(n){
178
+
179
+ }
180
+ stream(){
181
+
182
+ }
183
+ }
184
+
185
+ const Canvas=(w,h)=>new ZikoUICanvas(w,h);
186
+ export{
187
+ ZikoUICanvas
188
+ }
189
+ export default Canvas;