ziko 0.0.23 → 0.0.24

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 (156) hide show
  1. package/dist/ziko.cjs +78 -2817
  2. package/dist/ziko.js +78 -2817
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +76 -2755
  5. package/package.json +1 -1
  6. package/src/app/globals.js +4 -2
  7. package/src/data/converter/index.js +2 -6
  8. package/src/graphics/canvas/index.js +176 -2
  9. package/src/graphics/canvas/utils/floodFill.js +0 -1
  10. package/src/graphics/svg/index.js +69 -2
  11. package/src/reactivity/hooks/index.js +1 -1
  12. package/src/ui/elements/{primitives/ZikoUIElement.js → ZikoUIElement.js} +8 -9
  13. package/src/ui/elements/derived ( To Be Moved)/index.js +12 -0
  14. package/src/ui/elements/{derived/flex → flex}/index.js +2 -2
  15. package/src/ui/elements/{derived/grid → grid}/index.js +2 -2
  16. package/src/ui/elements/{primitives/index.js → index.js} +3 -1
  17. package/src/ui/elements/{primitives/io → io}/Form/index.js +1 -1
  18. package/src/ui/elements/{primitives/io → io}/Inputs/__helpers__.js +1 -1
  19. package/src/ui/elements/{primitives/io → io}/Inputs/input/index.js +1 -1
  20. package/src/ui/elements/{primitives/list → list}/index.js +2 -3
  21. package/src/ui/elements/{primitives/misc → misc}/index.js +2 -3
  22. package/src/ui/elements/{primitives/semantic → semantic}/index.js +8 -8
  23. package/src/ui/elements/{primitives/table → table}/table.js +1 -1
  24. package/src/ui/elements/{primitives/text → text}/__ZikoUIText__.js +3 -4
  25. package/src/ui/index.js +21 -21
  26. package/src/ui/utils/index.js +1 -1
  27. package/src/data/parser/markdown.js +0 -0
  28. package/src/graphics/canvas/canvas.js +0 -176
  29. package/src/graphics/svg/svg.js +0 -69
  30. package/src/reactivity/hooks/Interactions/useSerial.js +0 -0
  31. package/src/types.js +0 -73
  32. package/src/ui/elements/derived/index.js +0 -12
  33. package/src/ui/elements/primitives/ZikoUIContainerElement.js +0 -123
  34. /package/src/{global → _global (To Be Replaced )}/_themes/dark.js +0 -0
  35. /package/src/{global → _global (To Be Replaced )}/_themes/index.js +0 -0
  36. /package/src/{global → _global (To Be Replaced )}/_themes/light.js +0 -0
  37. /package/src/{global → _global (To Be Replaced )}/app/index.js +0 -0
  38. /package/src/{global → _global (To Be Replaced )}/component/index.js +0 -0
  39. /package/src/{global → _global (To Be Replaced )}/globals/index.js +0 -0
  40. /package/src/{global → _global (To Be Replaced )}/index.js +0 -0
  41. /package/src/{global → _global (To Be Replaced )}/params/index.js +0 -0
  42. /package/src/{global → _global (To Be Replaced )}/router/index.js +0 -0
  43. /package/src/{global → _global (To Be Replaced )}/seo/index.js +0 -0
  44. /package/src/{global → _global (To Be Replaced )}/style/index.js +0 -0
  45. /package/src/data/converter/{adoc.js → __(To Be Moved)adoc.js} +0 -0
  46. /package/src/data/converter/{markdown.js → __(To Be Moved)markdown.js} +0 -0
  47. /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/arc.js +0 -0
  48. /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/image.js +0 -0
  49. /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/line.js +0 -0
  50. /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/path.js +0 -0
  51. /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/points.js +0 -0
  52. /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/polygon.js +0 -0
  53. /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/polyline.js +0 -0
  54. /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/rect.js +0 -0
  55. /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/text.js +0 -0
  56. /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Chart/histogram.js +0 -0
  57. /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Chart/plot.js +0 -0
  58. /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Chart/scatter.js +0 -0
  59. /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Chart/stem.js +0 -0
  60. /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Element.js +0 -0
  61. /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/index.js +0 -0
  62. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/circle.js +0 -0
  63. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/ellipse.js +0 -0
  64. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/foreign-object.js +0 -0
  65. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/groupe.js +0 -0
  66. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/image.js +0 -0
  67. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/index.js +0 -0
  68. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/line.js +0 -0
  69. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/link.js +0 -0
  70. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/path.js +0 -0
  71. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/polygon.js +0 -0
  72. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/polyline.js +0 -0
  73. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/rect.js +0 -0
  74. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/text.js +0 -0
  75. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Derived/grid.js +0 -0
  76. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Derived/index.js +0 -0
  77. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/index.js +0 -0
  78. /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/ziko-svg-element.js +0 -0
  79. /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/index.js +0 -0
  80. /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/useBattery.js +0 -0
  81. /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/useCamera.js +0 -0
  82. /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/useGeolocation.js +0 -0
  83. /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/useMicro.js +0 -0
  84. /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/useOrientation.js +0 -0
  85. /package/src/ui/elements/{derived → derived ( To Be Moved)}/accordion/accordion.js +0 -0
  86. /package/src/ui/elements/{derived → derived ( To Be Moved)}/accordion/collapsible.js +0 -0
  87. /package/src/ui/elements/{derived → derived ( To Be Moved)}/accordion/index.js +0 -0
  88. /package/src/ui/elements/{derived → derived ( To Be Moved)}/alert/alert.js +0 -0
  89. /package/src/ui/elements/{derived → derived ( To Be Moved)}/alert/index.js +0 -0
  90. /package/src/ui/elements/{derived → derived ( To Be Moved)}/alert/palette.js +0 -0
  91. /package/src/ui/elements/{derived → derived ( To Be Moved)}/carousel/index.js +0 -0
  92. /package/src/ui/elements/{derived → derived ( To Be Moved)}/code-note/SubElements.js.txt +0 -0
  93. /package/src/ui/elements/{derived → derived ( To Be Moved)}/code-note/code-cell.js +0 -0
  94. /package/src/ui/elements/{derived → derived ( To Be Moved)}/code-note/code-note.js +0 -0
  95. /package/src/ui/elements/{derived → derived ( To Be Moved)}/code-note/index.js +0 -0
  96. /package/src/ui/elements/{derived → derived ( To Be Moved)}/code-note/sub-elements.js +0 -0
  97. /package/src/ui/elements/{derived → derived ( To Be Moved)}/menu/index.js +0 -0
  98. /package/src/ui/elements/{derived → derived ( To Be Moved)}/menu/menu3d.js +0 -0
  99. /package/src/ui/elements/{derived → derived ( To Be Moved)}/modal/index.js +0 -0
  100. /package/src/ui/elements/{derived → derived ( To Be Moved)}/pagination/breadcrumbs.js +0 -0
  101. /package/src/ui/elements/{derived → derived ( To Be Moved)}/pagination/index.js +0 -0
  102. /package/src/ui/elements/{derived → derived ( To Be Moved)}/slider/__ZikoUISlider__.js +0 -0
  103. /package/src/ui/elements/{derived → derived ( To Be Moved)}/slider/hSlider.js +0 -0
  104. /package/src/ui/elements/{derived → derived ( To Be Moved)}/slider/index.js +0 -0
  105. /package/src/ui/elements/{derived → derived ( To Be Moved)}/slider/vSlider.js +0 -0
  106. /package/src/ui/elements/{derived → derived ( To Be Moved)}/splitter/__ZikoUISplitter__.js +0 -0
  107. /package/src/ui/elements/{derived → derived ( To Be Moved)}/splitter/hsplitter.js +0 -0
  108. /package/src/ui/elements/{derived → derived ( To Be Moved)}/splitter/index.js +0 -0
  109. /package/src/ui/elements/{derived → derived ( To Be Moved)}/splitter/vsplitter.js +0 -0
  110. /package/src/ui/elements/{derived → derived ( To Be Moved)}/tabs/index.js +0 -0
  111. /package/src/ui/elements/{primitives/embaded → embaded}/html.js +0 -0
  112. /package/src/ui/elements/{primitives/embaded → embaded}/index.js +0 -0
  113. /package/src/ui/elements/{primitives/embaded → embaded}/pdf.js +0 -0
  114. /package/src/ui/elements/{primitives/embaded → embaded}/youtube.js +0 -0
  115. /package/src/ui/elements/{primitives/hydrate.js → hydrate.js} +0 -0
  116. /package/src/ui/elements/{primitives/io → io}/Form/index.js.txt +0 -0
  117. /package/src/ui/elements/{primitives/io → io}/Inputs/index.js +0 -0
  118. /package/src/ui/elements/{primitives/io → io}/Inputs/input-camera/index.js +0 -0
  119. /package/src/ui/elements/{primitives/io → io}/Inputs/input-checkbox/index.js +0 -0
  120. /package/src/ui/elements/{primitives/io → io}/Inputs/input-color/index.js +0 -0
  121. /package/src/ui/elements/{primitives/io → io}/Inputs/input-date-time/index.js +0 -0
  122. /package/src/ui/elements/{primitives/io → io}/Inputs/input-date-time/input-date-time.js +0 -0
  123. /package/src/ui/elements/{primitives/io → io}/Inputs/input-date-time/input-date.js +0 -0
  124. /package/src/ui/elements/{primitives/io → io}/Inputs/input-date-time/input-time.js +0 -0
  125. /package/src/ui/elements/{primitives/io → io}/Inputs/input-email-password/index.js +0 -0
  126. /package/src/ui/elements/{primitives/io → io}/Inputs/input-email-password/input-email.js +0 -0
  127. /package/src/ui/elements/{primitives/io → io}/Inputs/input-email-password/input-password.js +0 -0
  128. /package/src/ui/elements/{primitives/io → io}/Inputs/input-file/index.js +0 -0
  129. /package/src/ui/elements/{primitives/io → io}/Inputs/input-file/input-file.js +0 -0
  130. /package/src/ui/elements/{primitives/io → io}/Inputs/input-file/input-image.js +0 -0
  131. /package/src/ui/elements/{primitives/io → io}/Inputs/input-number/index.js +0 -0
  132. /package/src/ui/elements/{primitives/io → io}/Inputs/input-radio/index.js +0 -0
  133. /package/src/ui/elements/{primitives/io → io}/Inputs/input-search/index.js +0 -0
  134. /package/src/ui/elements/{primitives/io → io}/Inputs/input-slider/index.js +0 -0
  135. /package/src/ui/elements/{primitives/io → io}/Select/index.js +0 -0
  136. /package/src/ui/elements/{primitives/io → io}/Textarea/index.js +0 -0
  137. /package/src/ui/elements/{primitives/io → io}/index.js +0 -0
  138. /package/src/ui/elements/{primitives/list → list}/elements.js +0 -0
  139. /package/src/ui/elements/{primitives/media → media}/Audio/index.js +0 -0
  140. /package/src/ui/elements/{primitives/media → media}/Image/figure.js +0 -0
  141. /package/src/ui/elements/{primitives/media → media}/Image/image.js +0 -0
  142. /package/src/ui/elements/{primitives/media → media}/Image/index.js +0 -0
  143. /package/src/ui/elements/{primitives/media → media}/Video/index.js +0 -0
  144. /package/src/ui/elements/{primitives/media → media}/__ZikoUIDynamicMediaELement__.js +0 -0
  145. /package/src/ui/elements/{primitives/media → media}/index.js +0 -0
  146. /package/src/ui/elements/{primitives/misc → misc}/hyperscript.js +0 -0
  147. /package/src/ui/elements/{primitives/misc → misc}/suspense.js +0 -0
  148. /package/src/ui/elements/{primitives/misc → misc}/xml-wrapper.js +0 -0
  149. /package/src/ui/elements/{primitives/table → table}/elements.js +0 -0
  150. /package/src/ui/elements/{primitives/table → table}/index.js +0 -0
  151. /package/src/ui/elements/{primitives/table → table}/utils.js +0 -0
  152. /package/src/ui/elements/{primitives/text → text}/heading.js +0 -0
  153. /package/src/ui/elements/{primitives/text → text}/index.js +0 -0
  154. /package/src/ui/elements/{primitives/text → text}/p.js +0 -0
  155. /package/src/ui/elements/{primitives/text → text}/pre.js +0 -0
  156. /package/src/ui/elements/{primitives/text → text}/text.js +0 -0
package/dist/ziko.js CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Sat Jan 04 2025 21:24:21 GMT+0100 (UTC+01:00)
5
+ Date : Fri Jan 24 2025 23:58:20 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
@@ -1127,229 +1127,6 @@
1127
1127
  preload: preload
1128
1128
  });
1129
1129
 
1130
- const parseInlineElements$1 = text => {
1131
- return text
1132
- .replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
1133
- .replace(/\*(.*?)\*/g, '<em>$1</em>')
1134
- .replace(/\[(.*?)\]\((.*?)\)/g, '<a href="$2">$1</a>')
1135
- .replace(/!\[(.*?)\]\((.*?)\)/g, '<img src="$2" alt="$1">')
1136
- .replace(/`([^`]+)`/g, '<code>$1</code>'); // Inline Code
1137
- };
1138
-
1139
- const parseTable$1 = line => {
1140
- const cells = line.split('|').map(cell => cell.trim()).filter(cell => cell !== '');
1141
- const tableRow = cells.map(cell => `<td>${parseInlineElements$1(cell)}</td>`).join('');
1142
- return `<tr>${tableRow}</tr>\n`;
1143
- };
1144
-
1145
- const parseCodeBlock$1 = (lines, language) => {
1146
- const codeContent = lines.join('\n'); // No need to exclude the triple backticks
1147
- const highlightedCode = language ? `<pre><code data-language="${language}">${codeContent}</code></pre>` : `<pre><code>${codeContent}</code></pre>`;
1148
- return `${highlightedCode}\n`;
1149
- };
1150
-
1151
- const parseList$1 = line => {
1152
- const DIGIT_FOLLOWED_BY_A_DOT_AND_SPACE = /^\d+\.\s/;
1153
- const match = line.match(DIGIT_FOLLOWED_BY_A_DOT_AND_SPACE);
1154
- if (match) {
1155
- let start = +match[1];
1156
- return `<ol${start===1?"":` start="${start}"`}>${parseInlineElements$1(line.slice(match[0].length))}</ol>\n`;
1157
- }
1158
- return `<ul>${parseInlineElements$1(line)}</ul>\n`;
1159
- };
1160
-
1161
- const parseHorizontalRule$1 = () => {
1162
- return '<hr>\n';
1163
- };
1164
-
1165
- const markdown2html = markdownText => {
1166
- const lines = markdownText.split('\n');
1167
- let htmlOutput = '';
1168
- let inTable = false;
1169
- let inCodeBlock = false;
1170
- let codeBlockLines = [];
1171
- let codeBlockLanguage = '';
1172
- for (let i = 0; i < lines.length; i++) {
1173
- let line = lines[i];
1174
- // Table
1175
- if (line.startsWith('|')) {
1176
- if (!inTable) {
1177
- inTable = true;
1178
- htmlOutput += '<table>\n';
1179
- }
1180
- htmlOutput += parseTable$1(line);
1181
- continue;
1182
- } else if (inTable) {
1183
- inTable = false;
1184
- htmlOutput += '</table>\n';
1185
- }
1186
- // Code block
1187
- if (line.startsWith('```')) {
1188
- if (!inCodeBlock) {
1189
- inCodeBlock = true;
1190
- codeBlockLines = [];
1191
- codeBlockLanguage = line.slice(3).trim();
1192
- } else {
1193
- inCodeBlock = false;
1194
- htmlOutput += parseCodeBlock$1(codeBlockLines, codeBlockLanguage);
1195
- }
1196
- continue;
1197
- } else if (inCodeBlock) {
1198
- codeBlockLines.push(line);
1199
- continue;
1200
- }
1201
- // Headings
1202
- if (line.startsWith('# ')) {
1203
- const headingLevel = line.indexOf(' ');
1204
- const headingText = line.slice(headingLevel + 1);
1205
- htmlOutput += `<h${headingLevel}>${parseInlineElements$1(headingText)}</h${headingLevel}>\n`;
1206
- continue;
1207
- }
1208
- // Lists
1209
- if (line.startsWith('- ') || line.startsWith('* ') || line.match(/^\d+\.\s/)) {
1210
- htmlOutput += parseList$1(line);
1211
- continue;
1212
- }
1213
- // Horizontal Rule
1214
- if (line.trim() === '---') {
1215
- htmlOutput += parseHorizontalRule$1();
1216
- continue;
1217
- }
1218
- // Other paragraphs
1219
- htmlOutput += `<p>${parseInlineElements$1(line)}</p>\n`;
1220
- }
1221
- return htmlOutput;
1222
- };
1223
-
1224
- const parseInlineElements = text => {
1225
- return text
1226
- .replace(/\*(.*?)\*/g, '_$1_') // Emphasis
1227
- .replace(/\*\*(.*?)\*\*/g, '*$1*') // Strong
1228
- .replace(/\[(.*?)\]\((.*?)\)/g, 'link:$2[$1]') // Links
1229
- .replace(/!\[(.*?)\]\((.*?)\)/g, 'image::$2[$1]') // Images
1230
- .replace(/`([^`]+)`/g, '``$1``') // Inline Code
1231
- .replace(/^\*\s/, ''); // Remove list item marker at the beginning of the line
1232
- };
1233
-
1234
- const parseTable = line => {
1235
- const cells = line.split('|').map(cell => cell.trim()).filter(cell => cell !== '');
1236
- const tableRow = cells.map(cell => `<td>${parseInlineElements(cell)}</td>`).join('');
1237
- return `<tr>${tableRow}</tr>\n`;
1238
- };
1239
-
1240
- const parseCodeBlock = (lines, language) => {
1241
- const codeContent = lines.join('\n'); // No need to exclude the triple backticks
1242
- const highlightedCode = language ? `<pre><code data-language="${language}">${codeContent}</code></pre>` : `<pre><code>${codeContent}</code></pre>`;
1243
- return `${highlightedCode}\n`;
1244
- };
1245
-
1246
- const parseList = line => {
1247
- const OL_PATTERN = /^(\d+)\.\s/;
1248
- const OL_PATTERN_WITHOUT_START = /^[.]\s/;
1249
- const UL_PATTERN = /^[*]\s/;
1250
-
1251
- if (line.match(OL_PATTERN)) {
1252
- const start = line.match(OL_PATTERN)[1];
1253
- return `<ol start="${start}"><li>${parseInlineElements(line.replace(OL_PATTERN, ''))}</li></ol>\n`;
1254
- }
1255
- if (line.match(OL_PATTERN_WITHOUT_START)) {
1256
- return `<ol><li>${parseInlineElements(line.replace(OL_PATTERN_WITHOUT_START, ''))}</li></ol>\n`;
1257
- }
1258
- if (line.match(UL_PATTERN)) {
1259
- return `<ul><li>${parseInlineElements(line.replace(UL_PATTERN, ''))}</li></ul>\n`;
1260
- }
1261
-
1262
- // If neither ordered nor unordered list pattern matches, treat it as a paragraph
1263
- return `<p>${parseInlineElements(line)}</p>\n`;
1264
- };
1265
-
1266
-
1267
-
1268
-
1269
- const parseBlockquote = line => {
1270
- return `<blockquote>${parseInlineElements(line.slice(2))}</blockquote>\n`;
1271
- };
1272
-
1273
- const parseHorizontalRule = () => {
1274
- return '<hr>\n';
1275
- };
1276
-
1277
- const parseAttributes = line => {
1278
- const attrs = line.match(/\[(.*?)\]/);
1279
- return attrs ? attrs[1].split(',').map(attr => `[${attr.trim()}]`).join('') : '';
1280
- };
1281
-
1282
- const adoc2html = adocText => {
1283
- const lines = adocText.split('\n');
1284
- let htmlOutput = '';
1285
- let inTable = false;
1286
- let inCodeBlock = false;
1287
- let codeBlockLines = [];
1288
- let codeBlockLanguage = '';
1289
- for (let i = 0; i < lines.length; i++) {
1290
- let line = lines[i];
1291
- // Table
1292
- if (line.startsWith('|')) {
1293
- if (!inTable) {
1294
- inTable = true;
1295
- htmlOutput += '<table>\n';
1296
- }
1297
- htmlOutput += parseTable(line);
1298
- continue;
1299
- } else if (inTable) {
1300
- inTable = false;
1301
- htmlOutput += '</table>\n';
1302
- }
1303
- // Code block
1304
- if (line.startsWith('```')) {
1305
- if (!inCodeBlock) {
1306
- inCodeBlock = true;
1307
- codeBlockLines = [];
1308
- codeBlockLanguage = line.slice(3).trim();
1309
- } else {
1310
- inCodeBlock = false;
1311
- htmlOutput += parseCodeBlock(codeBlockLines, codeBlockLanguage);
1312
- }
1313
- continue;
1314
- } else if (inCodeBlock) {
1315
- codeBlockLines.push(line);
1316
- continue;
1317
- }
1318
- // Headings
1319
- if (line.startsWith('=')) {
1320
- const headingLevel = (line.match(/=/g) || []).length;
1321
- const headingText = line.replace(/=/g, '').trim();
1322
- htmlOutput += `<h${headingLevel}>${parseInlineElements(headingText)}</h${headingLevel}>\n`;
1323
- continue;
1324
- }
1325
- // Lists
1326
- if (line.match(/^(\d+)\.\s/) || line.match(/^[*\.]\s/)) {
1327
- htmlOutput += parseList(line);
1328
- continue;
1329
- }
1330
- // Blockquote
1331
- if (line.startsWith('> ')) {
1332
- htmlOutput += parseBlockquote(line);
1333
- continue;
1334
- }
1335
- // Horizontal Rule
1336
- if (line.trim() === '---') {
1337
- htmlOutput += parseHorizontalRule();
1338
- continue;
1339
- }
1340
- // Attributes
1341
- if (line.startsWith('[')) {
1342
- htmlOutput += parseAttributes(line);
1343
- continue;
1344
- }
1345
- // Other paragraphs
1346
- if (line.trim() !== '') { // Exclude empty lines
1347
- htmlOutput += `<p>${parseInlineElements(line)}</p>\n`;
1348
- }
1349
- }
1350
- return htmlOutput;
1351
- };
1352
-
1353
1130
  const csv2arr = (csv, delimiter = ",")=>csv.trim().trimEnd().split("\n").map(n=>n.split(delimiter));
1354
1131
  const csv2matrix = (csv, delimiter = ",")=>new Matrix(csv2arr(csv,delimiter));
1355
1132
  const csv2object = (csv, delimiter = ",") => {
@@ -4495,59 +4272,6 @@
4495
4272
  return T;
4496
4273
  };
4497
4274
 
4498
- class ZikoUseBattery{
4499
- constructor(){
4500
- if(this.isSupported)this.#init();
4501
- }
4502
- async #init(){
4503
- this.__Battery__=await navigator.getBattery();
4504
- }
4505
- get isSupported(){
4506
- return !!navigator.getBattery;
4507
- }
4508
- get current(){
4509
- // Synchrouns Code
4510
- const {
4511
- level,
4512
- charging,
4513
- chargingTime,
4514
- dischargingTime
4515
- }=this.__Battery__;
4516
- return {
4517
- level,
4518
- charging,
4519
- chargingTime,
4520
- dischargingTime
4521
- }
4522
- }
4523
- onChargingChange(callback){
4524
- this.__Battery__?.addEventListener("chargingchange",callback);
4525
- return this;
4526
- }
4527
- onLevelChange(callback){
4528
- this.__Battery__?.addEventListener("levelchange",callback);
4529
- return this;
4530
- }
4531
- }
4532
- const useBattery=()=>new ZikoUseBattery();
4533
-
4534
- class ZikoUseGeolocation{
4535
- constructor(){
4536
- if(this.isSupported)this.#init();
4537
- }
4538
- async #init(){
4539
- navigator.geolocation.getCurrentPosition(e=>this.__Geolocation__=e);
4540
- }
4541
- get isSupported(){
4542
- return !!navigator.geolocation;
4543
- }
4544
- get current(){
4545
- // Synchrouns Code
4546
- return this.__Geolocation__;
4547
- }
4548
- }
4549
- const useGeolocation=()=>new ZikoUseGeolocation();
4550
-
4551
4275
  class ZikoUseChannel{
4552
4276
  constructor(name=""){
4553
4277
  this.channel=new BroadcastChannel(name);
@@ -4823,12 +4547,10 @@
4823
4547
  ZikoHead: ZikoHead$1,
4824
4548
  ZikoUseRoot: ZikoUseRoot,
4825
4549
  ZikoUseStyle: ZikoUseStyle,
4826
- useBattery: useBattery,
4827
4550
  useChannel: useChannel$1,
4828
4551
  useDebounce: useDebounce,
4829
4552
  useEventEmitter: useEventEmitter,
4830
4553
  useFavIcon: useFavIcon$1,
4831
- useGeolocation: useGeolocation,
4832
4554
  useHead: useHead$1,
4833
4555
  useLocaleStorage: useLocaleStorage,
4834
4556
  useMediaQuery: useMediaQuery,
@@ -4908,10 +4630,9 @@
4908
4630
  globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
4909
4631
  element && globalThis.__Ziko__.__Config__.default.render && this.render();
4910
4632
  this.setAttr("data-ref", this.uuid);
4911
- globalThis.__Ziko__.__HYDRATION_MAP__.push({
4912
- ref : this.uuid,
4913
- comp : ()=>this
4914
- });
4633
+ if(globalThis.__Ziko__.__Config__.renderingMode !== "spa" && !globalThis.__Ziko__.__Config__.isSSC) {
4634
+ globalThis.__Ziko__.__HYDRATION_MAP__.set(this.uuid, ()=>this);
4635
+ }
4915
4636
  }
4916
4637
  get element(){
4917
4638
  return this.__ele__;
@@ -4991,7 +4712,7 @@
4991
4712
  return this;
4992
4713
  }
4993
4714
  for (let i = 0; i < ele.length; i++) {
4994
- if (["number", "string"].includes(typeof ele[i])) ele[i] = text$1(ele[i]);
4715
+ if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
4995
4716
  if (ele[i] instanceof ZikoUIElement) {
4996
4717
  ele[i].cache.parent = this;
4997
4718
  this.element[adder](ele[i].element);
@@ -5021,7 +4742,7 @@
5021
4742
  if (index >= this.element.children.length) this.append(...ele);
5022
4743
  else
5023
4744
  for (let i = 0; i < ele.length; i++) {
5024
- if (["number", "string"].includes(typeof ele[i])) ele[i] = text$1(ele[i]);
4745
+ if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
5025
4746
  this.element?.insertBefore(ele[i].element, this.items[index].element);
5026
4747
  this.items.splice(index, 0, ele[i]);
5027
4748
  }
@@ -5440,128 +5161,7 @@
5440
5161
  }
5441
5162
  }
5442
5163
 
5443
- class ZikoUIContainerElement extends ZikoUIElement {
5444
- constructor(element, name = "") {
5445
- super(element, name);
5446
- this.items = [];
5447
- }
5448
- // maintain() {
5449
- // for (let i = 0; i < this.items.length; i++)
5450
- // Object.assign(this, { [[i]]: this.items[i] });
5451
- // this.length = this.items.length;
5452
- // return this;
5453
- // }
5454
- // at(index) {
5455
- // return this.items.at(index);
5456
- // }
5457
- // #addItem(adder, pusher, ...ele) {
5458
- // if (this.cache.isFrozzen) {
5459
- // console.warn("You can't append new item to frozzen element");
5460
- // return this;
5461
- // }
5462
- // for (let i = 0; i < ele.length; i++) {
5463
- // if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
5464
- // if (ele[i] instanceof ZikoUIElement) {
5465
- // ele[i].cache.parent = this;
5466
- // this.element[adder](ele[i].element);
5467
- // ele[i].target = this.element;
5468
- // this.items[pusher](ele[i]);
5469
- // } else if (ele[i] instanceof Object) {
5470
- // if (ele[i]?.style) this.style(ele[i]?.style);
5471
- // if (ele[i]?.attr) {
5472
- // Object.entries(ele[i].attr).forEach((n) =>
5473
- // this.setAttr("" + n[0], n[1]),
5474
- // );
5475
- // }
5476
- // }
5477
- // }
5478
- // this.maintain();
5479
- // return this;
5480
- // }
5481
- // append(...ele) {
5482
- // this.#addItem("append", "push", ...ele);
5483
- // return this;
5484
- // }
5485
- // prepend(...ele) {
5486
- // this.#addItem("prepend", "unshift", ...ele);
5487
- // return this;
5488
- // }
5489
- // insertAt(index, ...ele) {
5490
- // if (index >= this.element.children.length) this.append(...ele);
5491
- // else
5492
- // for (let i = 0; i < ele.length; i++) {
5493
- // if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
5494
- // this.element?.insertBefore(ele[i].element, this.items[index].element);
5495
- // this.items.splice(index, 0, ele[i]);
5496
- // }
5497
- // return this;
5498
- // }
5499
- // remove(...ele) {
5500
- // const remove = (ele) => {
5501
- // if (typeof ele === "number") ele = this.items[ele];
5502
- // if (ele instanceof ZikoUIElement) this.element?.removeChild(ele.element);
5503
- // this.items = this.items.filter((n) => n !== ele);
5504
- // };
5505
- // for (let i = 0; i < ele.length; i++) remove(ele[i]);
5506
- // for (let i = 0; i < this.items.length; i++)
5507
- // Object.assign(this, { [[i]]: this.items[i] });
5508
- // // Remove from item
5509
- // return this;
5510
- // }
5511
- // forEach(callback) {
5512
- // this.items.forEach(callback);
5513
- // return this;
5514
- // }
5515
- // map(callback) {
5516
- // return this.items.map(callback);
5517
- // }
5518
- // find(condition) {
5519
- // return this.items.filter(condition);
5520
- // }
5521
- // filter(condition_callback, if_callback = () => {}, else_callback = () => {}) {
5522
- // const FilterItems = this.items.filter(condition_callback);
5523
- // FilterItems.forEach(if_callback);
5524
- // this.items
5525
- // .filter((item) => !FilterItems.includes(item))
5526
- // .forEach(else_callback);
5527
- // return this;
5528
- // }
5529
- // filterByTextContent(text, exactMatch = false) {
5530
- // this.items.forEach((n) => n.render());
5531
- // this.filter(
5532
- // (n) => !(exactMatch ? n.text === text : n.text.includes(text)),
5533
- // (e) => e.unrender(),
5534
- // );
5535
- // // this.items.filter(n=>{
5536
- // // const content=n.element.textContent;
5537
- // // return !(exactMatch?content===text:content.includes(text))
5538
- // // }).map(n=>n.unrender());
5539
- // // return this;
5540
- // }
5541
- // filterByClass(value) {
5542
- // this.items.map((n) => n.render());
5543
- // this.items
5544
- // .filter((n) => !n.classes.includes(value))
5545
- // .map((n) => n.unrender());
5546
- // return this;
5547
- // }
5548
- // sortByTextContent(value, displays) {
5549
- // let item = this.children;
5550
- // item
5551
- // .filter((n) => !n.textContent.toLowerCase().includes(value.toLowerCase()))
5552
- // .map((n) => {
5553
- // n.style.display = "none";
5554
- // });
5555
- // item
5556
- // .filter((n) => n.textContent.toLowerCase().includes(value.toLowerCase()))
5557
- // .map((n, i) => (n.style.display = displays[i]));
5558
- // //return item.filter(n=>n.style.display!="none")
5559
- // item.filter((n) => n.style.display != "none");
5560
- // return this;
5561
- // }
5562
- }
5563
-
5564
- class __ZikoUIText__ extends ZikoUIContainerElement {
5164
+ class __ZikoUIText__ extends ZikoUIElement {
5565
5165
  constructor(tag, name, lineBreak,...value) {
5566
5166
  super(tag, name);
5567
5167
  this.addValue(...value);
@@ -5666,7 +5266,7 @@
5666
5266
  return true
5667
5267
  }
5668
5268
  }
5669
- const text$1 = (...str) => new ZikoUIText(...str);
5269
+ const text = (...str) => new ZikoUIText(...str);
5670
5270
  const quote = (...str) => new ZikoUIQuote(...str);
5671
5271
  const dfnText = (...str) => new ZikoUIDefintion(...str);
5672
5272
  const supText = (...str) => new ZikoUISupText(...str);
@@ -5747,10 +5347,10 @@
5747
5347
  quote: quote,
5748
5348
  subText: subText,
5749
5349
  supText: supText,
5750
- text: text$1
5350
+ text: text
5751
5351
  });
5752
5352
 
5753
- class ZikoUILI extends ZikoUIContainerElement{
5353
+ class ZikoUILI extends ZikoUIElement{
5754
5354
  constructor(UI){
5755
5355
  super("li","li");
5756
5356
  this.append(UI);
@@ -5759,7 +5359,7 @@
5759
5359
  return true;
5760
5360
  }
5761
5361
  }
5762
- class ZikoUIList extends ZikoUIContainerElement {
5362
+ class ZikoUIList extends ZikoUIElement {
5763
5363
  constructor(element,name) {
5764
5364
  super(element,name);
5765
5365
  delete this.append;
@@ -5771,7 +5371,7 @@
5771
5371
  append(...arr){
5772
5372
  for (let i = 0; i < arr.length; i++) {
5773
5373
  let li = null;
5774
- if(["string","number"].includes(typeof arr[i]))arr[i]=text$1(arr[i]);
5374
+ if(["string","number"].includes(typeof arr[i]))arr[i]=text(arr[i]);
5775
5375
  if (arr[i] instanceof ZikoUIElement)li=new ZikoUILI(arr[i]);
5776
5376
  li.setTarget(this.element);
5777
5377
  this.items.push(li[0]);
@@ -5799,7 +5399,7 @@
5799
5399
  else
5800
5400
  for (let i = 0; i < ele.length; i++) {
5801
5401
  let li = null;
5802
- if(["number","string"].includes(typeof ele[i]))ele[i]=text$1(ele[i]);
5402
+ if(["number","string"].includes(typeof ele[i]))ele[i]=text(ele[i]);
5803
5403
  if (ele[i] instanceof ZikoUIElement)li=new ZikoUILI(ele[i]);
5804
5404
  this.element?.insertBefore(li.element, this.items[index].parent.element);
5805
5405
  this.items.splice(index, 0, ele[i][0]);
@@ -6407,7 +6007,7 @@
6407
6007
  return acc;
6408
6008
  }, {});
6409
6009
 
6410
- class ZikoUIHtmlTag extends ZikoUIContainerElement {
6010
+ class ZikoUIHtmlTag extends ZikoUIElement {
6411
6011
  constructor(element) {
6412
6012
  super(element,"html");
6413
6013
  }
@@ -6460,7 +6060,7 @@
6460
6060
  return true
6461
6061
  }
6462
6062
  }
6463
- class ZikoUILink extends ZikoUIContainerElement{
6063
+ class ZikoUILink extends ZikoUIElement{
6464
6064
  constructor(href){
6465
6065
  super("a","link");
6466
6066
  Object.assign(this.cache,{
@@ -6794,7 +6394,7 @@
6794
6394
  }
6795
6395
  const textarea =()=> new ZikoUITextArea();
6796
6396
 
6797
- let ZikoUIFlex$1 = class ZikoUIFlex extends ZikoUIContainerElement {
6397
+ class ZikoUIFlex extends ZikoUIElement {
6798
6398
  constructor(tag = "div", w = "100%", h = "100%") {
6799
6399
  super(tag ,"Flex");
6800
6400
  this.direction = "cols";
@@ -6842,18 +6442,18 @@
6842
6442
  return this;
6843
6443
  }
6844
6444
  vertical(x, y, order=1) {
6845
- set_vertical$1.call(this,order);
6445
+ set_vertical.call(this,order);
6846
6446
  this.style({
6847
- alignItems: typeof(x)==="number"?map_pos_x$1.call(this,x):x,
6848
- justifyContent: typeof(y)=="number"?map_pos_y$1.call(this,y):y
6447
+ alignItems: typeof(x)==="number"?map_pos_x.call(this,x):x,
6448
+ justifyContent: typeof(y)=="number"?map_pos_y.call(this,y):y
6849
6449
  });
6850
6450
  return this;
6851
6451
  }
6852
6452
  horizontal(x, y, order=1) {
6853
- set_horizontal$1.call(this,order);
6453
+ set_horizontal.call(this,order);
6854
6454
  this.style({
6855
- alignItems: typeof(y)=="number"?map_pos_y$1.call(this,y):y,
6856
- justifyContent: typeof(x)==="number"?map_pos_x$1.call(this,x):x
6455
+ alignItems: typeof(y)=="number"?map_pos_y.call(this,y):y,
6456
+ justifyContent: typeof(x)==="number"?map_pos_x.call(this,x):x
6857
6457
  });
6858
6458
  return this;
6859
6459
  }
@@ -6862,38 +6462,44 @@
6862
6462
  this.style({ display: "flex" });
6863
6463
  return this;
6864
6464
  }
6865
- };
6465
+ }
6866
6466
 
6867
- const Flex$1 = (...ZikoUIElement) =>{
6467
+ const Flex = (...ZikoUIElement) =>{
6868
6468
  let tag="div";
6869
6469
  if(typeof ZikoUIElement[0]==="string"){
6870
6470
  tag=ZikoUIElement[0];
6871
6471
  ZikoUIElement.pop();
6872
6472
  }
6873
- return new ZikoUIFlex$1(tag).append(...ZikoUIElement);
6473
+ return new ZikoUIFlex(tag).append(...ZikoUIElement);
6874
6474
  };
6875
- function set_vertical$1(direction){
6475
+ function set_vertical(direction){
6876
6476
  direction == 1
6877
6477
  ? this.style({ flexDirection: "column" })
6878
6478
  : direction == -1 && this.style({ flexDirection: "column-reverse" });
6879
6479
  return this;
6880
6480
  }
6881
- function set_horizontal$1(direction){
6481
+ function set_horizontal(direction){
6882
6482
  direction == 1
6883
6483
  ? this.style({ flexDirection: "row" })
6884
6484
  : direction == -1 && this.style({ flexDirection: "row-reverse" });
6885
6485
  return this;
6886
6486
  }
6887
- function map_pos_x$1(align){
6487
+ function map_pos_x(align){
6888
6488
  let pos = ["flex-start", "center", "flex-end"];
6889
6489
  if (typeof align === "number") align = pos[align + 1];
6890
6490
  return align;
6891
6491
  }
6892
- function map_pos_y$1(align){
6893
- return map_pos_x$1(-align);
6492
+ function map_pos_y(align){
6493
+ return map_pos_x(-align);
6894
6494
  }
6895
6495
 
6896
- class ZikoUIForm extends ZikoUIFlex$1{
6496
+ var Flex$1 = /*#__PURE__*/Object.freeze({
6497
+ __proto__: null,
6498
+ Flex: Flex,
6499
+ ZikoUIFlex: ZikoUIFlex
6500
+ });
6501
+
6502
+ class ZikoUIForm extends ZikoUIFlex{
6897
6503
  constructor(...items){
6898
6504
  super("form", "Form");
6899
6505
  this.append(...items);
@@ -7011,7 +6617,7 @@
7011
6617
  const tr=(...ZikoUIElement)=>new ZikoUITr(...ZikoUIElement);
7012
6618
  const td=(...UI)=>{
7013
6619
  UI=UI.map(n=>{
7014
- if(!(n instanceof ZikoUIElement))n=text$1(n);
6620
+ if(!(n instanceof ZikoUIElement))n=text(n);
7015
6621
  return n
7016
6622
  });
7017
6623
  return new ZikoUITd(...UI)
@@ -7154,7 +6760,7 @@
7154
6760
  Table: Table$1
7155
6761
  });
7156
6762
 
7157
- class ZikoUIMain extends ZikoUIContainerElement{
6763
+ class ZikoUIMain extends ZikoUIElement{
7158
6764
  constructor(){
7159
6765
  super("main","Main");
7160
6766
  }
@@ -7162,7 +6768,7 @@
7162
6768
  return true
7163
6769
  }
7164
6770
  }
7165
- class ZikoUIHeader extends ZikoUIContainerElement{
6771
+ class ZikoUIHeader extends ZikoUIElement{
7166
6772
  constructor(){
7167
6773
  super("header","Header");
7168
6774
  }
@@ -7170,7 +6776,7 @@
7170
6776
  return true
7171
6777
  }
7172
6778
  }
7173
- class ZikoUINav extends ZikoUIContainerElement{
6779
+ class ZikoUINav extends ZikoUIElement{
7174
6780
  constructor(){
7175
6781
  super("nav","Nav");
7176
6782
  }
@@ -7178,7 +6784,7 @@
7178
6784
  return true
7179
6785
  }
7180
6786
  }
7181
- class ZikoUISection extends ZikoUIContainerElement{
6787
+ class ZikoUISection extends ZikoUIElement{
7182
6788
  constructor(){
7183
6789
  super("section","Section");
7184
6790
  this.style({position:"relative"});
@@ -7187,7 +6793,7 @@
7187
6793
  return true
7188
6794
  }
7189
6795
  }
7190
- class ZikoUIArticle extends ZikoUIContainerElement{
6796
+ class ZikoUIArticle extends ZikoUIElement{
7191
6797
  constructor(){
7192
6798
  super("article","Article");
7193
6799
  }
@@ -7195,7 +6801,7 @@
7195
6801
  return true
7196
6802
  }
7197
6803
  }
7198
- class ZikoUIAside extends ZikoUIContainerElement{
6804
+ class ZikoUIAside extends ZikoUIElement{
7199
6805
  constructor(){
7200
6806
  super("aside","Aside");
7201
6807
  }
@@ -7203,7 +6809,7 @@
7203
6809
  return true
7204
6810
  }
7205
6811
  }
7206
- class ZikoUIFooter extends ZikoUIContainerElement{
6812
+ class ZikoUIFooter extends ZikoUIElement{
7207
6813
  constructor(){
7208
6814
  super("footer","Footer");
7209
6815
  this.element=document?.createElement("footer");
@@ -7238,7 +6844,7 @@
7238
6844
  ZikoUISection: ZikoUISection
7239
6845
  });
7240
6846
 
7241
- class ZikoUIGrid extends ZikoUIContainerElement {
6847
+ class ZikoUIGrid extends ZikoUIElement {
7242
6848
  constructor(tag ="div", w = "50vw", h = "50vh") {
7243
6849
  super(tag,"Grid");
7244
6850
  this.direction = "cols";
@@ -7270,1609 +6876,24 @@
7270
6876
  }
7271
6877
  const Grid$1 = (...ZikoUIElement) => new ZikoUIGrid("div").append(...ZikoUIElement);
7272
6878
 
7273
- class ZikoUICollapbsible extends ZikoUIElement{
7274
- constructor(summary,content,openIcon="😁", closeIcon=openIcon){
7275
- super("details","Collapsible");
7276
- Object.assign(this.cache,{
7277
- icons:{
7278
- open : openIcon,
7279
- close : closeIcon
7280
- }
7281
- });
7282
- this.summary=html("summary",summary).style({
7283
- fontSize:"1.1em",
7284
- padding:"0.625rem",
7285
- fontWeight:"bold",
7286
- listStyleType:`"${openIcon}"`,
7287
- cursor:"pointer",
7288
- });
7289
- this.summary[0].style({
7290
- marginLeft:"0.5em",
7291
- });
7292
- this.content=content.style({
7293
- margin:"0.7em",
7294
- });
7295
- this.element?.append(this.summary.element,this.content.element);
7296
- this.style({
7297
- marginBottom:"0.7em",
7298
- });
7299
- watchAttr(this, e=>{
7300
- if(e.target.isOpen){
7301
- e.target.emit("open");
7302
- if(this?.parent?.isAccordion){
7303
- if(this.parent.cache.autoClose)this.parent.closeExcept(this);
7304
- }
7305
- this.summary.style({
7306
- listStyleType:`"${this.cache.icons.close}"`
7307
- });
7308
- }
7309
- else {
7310
- e.target.emit("close");
7311
- this.summary.style({
7312
- listStyleType:`"${this.cache.icons.open}"`
7313
- });
7314
- }
7315
- });
7316
- }
7317
- get isCollapsible(){
7318
- return true;
7319
- }
7320
- get isOpen(){
7321
- return this.element.open;
7322
- }
7323
- open(details=this){
7324
- this.element.open=true;
7325
- this.emit("open",details);
7326
- return this;
7327
- }
7328
- close(){
7329
- this.element.open=false;
7330
- return this;
7331
- }
7332
- onOpen(callback){
7333
- this.on("open", callback);
7334
- return this;
7335
- }
7336
- onClose(callback){
7337
- this.on("close", callback);
7338
- return this;
7339
- }
7340
- toggle(){
7341
- this.element.open=!this.element.open;
7342
- return this;
7343
- }
7344
- }
7345
-
7346
-
7347
- const Collapsible=(summary, content, openIcon, closeIcon)=>new ZikoUICollapbsible(summary,content,openIcon, closeIcon);
6879
+ var Grid$2 = /*#__PURE__*/Object.freeze({
6880
+ __proto__: null,
6881
+ Grid: Grid$1,
6882
+ ZikoUIGrid: ZikoUIGrid
6883
+ });
7348
6884
 
7349
- class ZikoUIAccordion extends ZikoUIContainerElement{
7350
- constructor(...Collapsible){
7351
- super("div", "Accordion");
7352
- this.append(...Collapsible);
7353
- Object.assign(this.cache,{
7354
- autoClose : true
7355
- });
7356
- }
7357
- get isAccordion(){
7358
- return true;
7359
- }
7360
- closeAll(){
7361
- this.items.forEach(n=>n.close());
7362
- return this;
7363
- }
7364
- closeExcept(...Collapsibles){
7365
- this.items.filter(n=>!Collapsibles.includes(n)).forEach(n=>n.close());
7366
- return this;
7367
- }
7368
- open(CollapsibleOrIndex){
7369
- CollapsibleOrIndex.isCollapsible? CollapsibleOrIndex.open(): this.items[CollapsibleOrIndex].open();
7370
- this.closeExcept(CollapsibleOrIndex.isCollapsible? CollapsibleOrIndex: this.items[CollapsibleOrIndex]);
7371
- return this;
7372
- }
7373
- enableAutoClose(){
7374
- this.cache.autoClose = true;
7375
- return this;
7376
- }
7377
- disableAutoClose(){
7378
- this.cache.autoClose = false;
7379
- return this;
7380
- }
7381
- toggleAutoClose(){
7382
- this.cache.autoClose = !this.cache.autoClose;
7383
- }
7384
- }
7385
- const Accordion = (... Collapsible) => new ZikoUIAccordion(...Collapsible);
7386
-
7387
- class ZikoUIFlex extends ZikoUIContainerElement {
7388
- constructor(tag = "div", w = "100%", h = "100%") {
7389
- super(tag ,"Flex");
7390
- this.direction = "cols";
7391
- if (typeof w == "number") w += "%";
7392
- if (typeof h == "number") h += "%";
7393
- this.style({ width: w, height: h });
7394
- this.style({ display: "flex" });
7395
- // this.render();
7396
- }
7397
- get isFlex(){
7398
- return true;
7399
- }
7400
- resp(px,wrap = true) {
7401
- this.wrap(wrap);
7402
- if (this.element.clientWidth < px) this.vertical();
7403
- else this.horizontal();
7404
- return this;
7405
- }
7406
- setSpaceAround() {
7407
- this.style({ justifyContent: "space-around" });
7408
- return this;
7409
- }
7410
- setSpaceBetween() {
7411
- this.style({ justifyContent: "space-between" });
7412
- return this;
7413
- }
7414
- setBaseline() {
7415
- this.style({ alignItems: "baseline" });
7416
- return this;
7417
- }
7418
- gap(g) {
7419
- if (this.direction === "row") this.style({ columnGap: g });
7420
- else if (this.direction === "column") this.style({ rowGap: g });
7421
- return this;
7422
- }
7423
- wrap(value = "wrap") {
7424
- const values = ["no-wrap", "wrap","wrap-reverse"];
7425
- this.style({
7426
- flexWrap: typeof value === "string" ? value : values[+value],
7427
- });
7428
- return this;
7429
- }
7430
- _justifyContent(align = "center") {
7431
- this.style({ justifyContent: align });
7432
- return this;
7433
- }
7434
- vertical(x, y, order=1) {
7435
- set_vertical.call(this,order);
7436
- this.style({
7437
- alignItems: typeof(x)==="number"?map_pos_x.call(this,x):x,
7438
- justifyContent: typeof(y)=="number"?map_pos_y.call(this,y):y
7439
- });
7440
- return this;
7441
- }
7442
- horizontal(x, y, order=1) {
7443
- set_horizontal.call(this,order);
7444
- this.style({
7445
- alignItems: typeof(y)=="number"?map_pos_y.call(this,y):y,
7446
- justifyContent: typeof(x)==="number"?map_pos_x.call(this,x):x
7447
- });
7448
- return this;
7449
- }
7450
- show() {
7451
- this.isHidden = false;
7452
- this.style({ display: "flex" });
7453
- return this;
7454
- }
7455
- }
7456
-
7457
- const Flex = (...ZikoUIElement) =>{
7458
- let tag="div";
7459
- if(typeof ZikoUIElement[0]==="string"){
7460
- tag=ZikoUIElement[0];
7461
- ZikoUIElement.pop();
7462
- }
7463
- return new ZikoUIFlex(tag).append(...ZikoUIElement);
7464
- };
7465
- function set_vertical(direction){
7466
- direction == 1
7467
- ? this.style({ flexDirection: "column" })
7468
- : direction == -1 && this.style({ flexDirection: "column-reverse" });
7469
- return this;
7470
- }
7471
- function set_horizontal(direction){
7472
- direction == 1
7473
- ? this.style({ flexDirection: "row" })
7474
- : direction == -1 && this.style({ flexDirection: "row-reverse" });
7475
- return this;
7476
- }
7477
- function map_pos_x(align){
7478
- let pos = ["flex-start", "center", "flex-end"];
7479
- if (typeof align === "number") align = pos[align + 1];
7480
- return align;
7481
- }
7482
- function map_pos_y(align){
7483
- return map_pos_x(-align);
7484
- }
7485
-
7486
- class ZikoUICarousel extends ZikoUIFlex{
7487
- constructor(...ZikoUIElement){
7488
- super();
7489
- this.style({
7490
- position:"relative",
7491
- overflow:"hidden",
7492
- touchAction:"none",
7493
- userSelect:"none"
7494
- });
7495
- this.horizontal("space-around",0);
7496
- this.track = Section(...ZikoUIElement).style({ display: "inline-flex" });
7497
- this.track.size(this.track.children.length * 100 + "vw");
7498
- this.track.setTarget(this);
7499
- this.track.items.map((n) =>
7500
- n.style({ pointerEvents: "none", margin: "auto 10px" })
7501
- );
7502
- this.x0 = null;
7503
- this.tx = 0;
7504
- this.onPtrMove(e=>{
7505
- if(e.isDown){
7506
- let x = e.event.pageX;
7507
- let dx = x - this.x0;
7508
- this.track.st.translateX(
7509
- this.tx + dx,
7510
- 0
7511
- );
7512
- }
7513
- });
7514
- this.onPtrDown(e=>{
7515
- console.log(e.event);
7516
- this.x0 = e.event.pageX;
7517
- const transformMatrix = window
7518
- .getComputedStyle(this.track.element)
7519
- .getPropertyValue("transform");
7520
- if (transformMatrix !== "none") {
7521
- this.tx = +transformMatrix.split(",")[4];
7522
- }
7523
- });
7524
- this.onPtrUp(e=>console.log(e.isDown));
7525
- this.onPtrLeave(e=>{
7526
- // Handle outside up
7527
- });
7528
- }
7529
- get isCarousel(){
7530
- return true;
7531
- }
7532
- }
7533
- const Carousel=(...ZikoUIElement)=>new ZikoUICarousel(...ZikoUIElement);
7534
-
7535
- class ZikoUICodeNote extends ZikoUIFlex{
7536
- constructor(){
7537
- super("section");
7538
- Object.assign(this.cache,{
7539
- order:0,
7540
- currentNote:null,
7541
- currentNoteIndex:null
7542
- });
7543
- this.vertical(0,0);
7544
- }
7545
- get isCodeNote(){
7546
- return true;
7547
- }
7548
- setCurrentNote(currentNote){
7549
- this.cache.currentNote=currentNote;
7550
- this.cache.currentNoteIndex=this.items.findIndex(n=>n===currentNote);
7551
- currentNote.focus();
7552
- this.items.forEach(n=>n.Input.style({
7553
- border: "1px solid #ccc"
7554
- }));
7555
- currentNote.Input.style({
7556
- border:"2px lightgreen solid"
7557
- });
7558
- return this;
7559
- }
7560
- addNote(text=""){
7561
- this.append(CodeCell(text));
7562
- return this;
7563
- }
7564
- execute(){
7565
- this.cache.currentNote.execute();
7566
- this.incrementOrder();
7567
- return this;
7568
- }
7569
- incrementOrder(){
7570
- this.cache.order++;
7571
- this.cache.currentNote.setOrder(this.cache.order);
7572
- return this;
7573
- }
7574
- next(){
7575
- if(this.cache.currentNote===this.items.at(-1)){
7576
- this.addNote();
7577
- this.setCurrentNote(this.items.at(-1));
7578
- }
7579
- else this.setCurrentNote(this.items[this.cache.currentNoteIndex+1]);
7580
- return this;
7581
- }
7582
- previous(){
7583
- // add append before
7584
- if(this.cache.currentNote!==this.items[0]){
7585
- this.setCurrentNote(this.items[this.cache.currentNoteIndex-1]);
7586
- }
7587
- return this;
7588
- }
7589
- data(){
7590
- return this.items.map(n=>n.cellData());
7591
- }
7592
- serialize(){
7593
- return JSON.stringify(this.data());
7594
- }
7595
- import(data=[]){
7596
- data.forEach((n,i)=>this.addNote(data[i].input));
7597
- return this;
7598
- }
7599
- }
7600
- const CodeNote=()=>new ZikoUICodeNote();
7601
-
7602
- const Input=(codeText="")=>html("code",codeText).style({
7603
- width:"100%",
7604
- height:"auto",
7605
- padding:"10px",
7606
- boxSizing:"border-box",
7607
- border: "1px solid #ccc",
7608
- outline: "none",
7609
- fontSize: "1rem",
7610
- fontFamily: "Lucida Console, Courier New, monospace",
7611
- padding: "1rem 0.5rem",
7612
- wordBreak:"break-all",
7613
- background:"#f6f8fa",
7614
- color:"#0062C3"
7615
- }).setAttr("contenteditable",true).setAttr("spellcheck",false);
7616
-
7617
- const Output=()=>html("output").style({
7618
- width:"100%",
7619
- height:"auto",
7620
- padding:"5px 0",
7621
- });
7622
- const Left=(ctx)=>Flex$1(
7623
- text$1("[ ]")
7624
- ).style({
7625
- width:"50px",
7626
- //height:getComputedStyle(ctx.Input.element).height,
7627
- height:"50px",
7628
- margin:"10px 4px",
7629
- padding:"5px",
7630
- color:"darkblue",
7631
- borderBottom:"4px solid gold",
7632
- }).horizontal(0,0);
7633
- const BTN_STYLE={
7634
- background:"none",
7635
- width:"25px",
7636
- height:"25px",
7637
- fontSize:"1.2rem",
7638
- cursor:"pointer"
7639
- };
7640
- const Right=(ctx)=>Flex$1(
7641
- text$1('▶️').style(BTN_STYLE).onClick(e=>{
7642
- if(ctx.parent instanceof ZikoUICodeNote)ctx.parent.setCurrentNote(ctx);
7643
- ctx.execute();
7644
- globalThis.__Ziko__.__Config__.default.target=e.target.parent.parent[1][1];
7645
- }),
7646
- text$1('📋').style(BTN_STYLE).onClick(()=>{
7647
- navigator.clipboard.writeText(ctx.codeText);
7648
- }),
7649
- text$1('✖️').style(BTN_STYLE).onClick(()=>ctx.remove()),
7650
- text$1('✖️').style(BTN_STYLE).onClick(()=>ctx.remove()),
7651
- ).style({
7652
- width:"70px",
7653
- height:"50px",
7654
- //background:"cyan",
7655
- margin:"10px 0"
7656
- }).horizontal(0,0).wrap(true);
7657
-
7658
- class ZikoUICodeCell extends ZikoUIFlex{
7659
- constructor(code="",{type="js",order=null}={}){
7660
- super("section");
7661
- Object.assign(this.cache,{
7662
- state:null,
7663
- order,
7664
- type,
7665
- metadata:{
7666
- created:Date.now(),
7667
- updated:null
7668
- }
7669
- });
7670
- this.Input=Input(code);
7671
- this.Output=Output();
7672
- this.InOut=Flex(
7673
- this.Input,
7674
- this.Output
7675
- ).vertical().style({
7676
- width:"100%",
7677
- margin:"10px auto"
7678
- });
7679
- this.RightControl=Right(this);
7680
- this.LeftControl=Left();
7681
- this.append(
7682
- this.LeftControl,
7683
- this.InOut,
7684
- this.RightControl
7685
- );
7686
- this.horizontal(-1,1).style({
7687
- //background:"#444",
7688
- width:"95vw",
7689
- margin:"0 auto",
7690
- border:"1px darkblue dotted"
7691
- });
7692
- let cm_content = this.Input.element.getElementsByClassName("cm-content")[0];
7693
- if( cm_content ){
7694
- cm_content.addEventListener("keydown",e=>{
7695
- if(e.key === "Enter" && e.shiftKey){
7696
- e.preventDefault();
7697
- this.execute(this.cache.order);
7698
- }
7699
- });
7700
- }
7701
- else {
7702
- this.Input.onKeyDown(e=>{
7703
- if(e.kd==="Enter"){
7704
- if(e.event.shiftKey){
7705
- e.event.preventDefault();
7706
- this.execute(this.cache.order);
7707
- }
7708
- }
7709
- if(this.cache.parent instanceof ZikoUICodeNote){
7710
- if(e.kd==="ArrowDown" && e.event.shiftKey ){
7711
- this.cache.parent.next();
7712
- }
7713
- if(e.kd==="ArrowUp" && e.event.shiftKey){
7714
- this.cache.parent.previous();
7715
- }
7716
- }
7717
- }
7718
- );
7719
- this.Input.onFocus(()=>{
7720
- if(this.cache.parent instanceof ZikoUICodeNote){
7721
- this.cache.parent.cache.currentNote=this;
7722
- this.cache.parent.setCurrentNote(this);
7723
- }
7724
- });
7725
- this.Input.onPaste((e)=>{
7726
- //e.event.preventDefault();
7727
- //this.setValue(this.codeText.trim())
7728
- });
7729
- // this.Input.onKeyPress(e=>{
7730
- // if(e.kp==="(")a.Input.element.textContent+=")";
7731
- // if(e.kp==="[")a.Input.element.textContent+="]";
7732
- // if(e.kp==="{")a.Input.element.textContent+="}";
7733
- // })
7734
- }
7735
- }
7736
- get isCodeCell(){
7737
- return true;
7738
- }
7739
- // space &nbsp
7740
- get codeText() {
7741
- return (this.Input.element.getElementsByClassName("cm-content")[0])
7742
- ?this.Input.element.getElementsByClassName("cm-content")[0].innerText.trim()
7743
- :this.Input.element.innerText.trim()
7744
- // return this.Input.element.innerText.trim();
7745
- }
7746
- get codeHTML() {
7747
- return this.Input.element.innerHTML;
7748
- }
7749
- get outputHTML(){
7750
- return this.Output.element.innerHTML;
7751
- }
7752
- setValue(codeText){
7753
- this.Input[0].setValue(codeText);
7754
- return this;
7755
- }
7756
- cellData(){
7757
- return {
7758
- input:this.codeText,
7759
- output:this.outputHTML,
7760
- order:this.cache.order,
7761
- type:this.cache.type
7762
- }
7763
- }
7764
- execute(order){
7765
- this.clearOutput();
7766
- this.evaluate(order);
7767
- this.cache.metadata.updated=Date.now();
7768
- return this;
7769
- }
7770
- #evaluateJs(order){
7771
- try{
7772
- this.LeftControl[0].setValue("pending");
7773
- this.cache.state="pending";
7774
- // globalThis.eval(this.Input.element.innerText);
7775
- globalThis.eval(this.codeText);
7776
-
7777
- }
7778
- catch(err){
7779
- console.log(err);
7780
- text(`Error : ${err.message}`).style({
7781
- color:"red",
7782
- background:"gold",
7783
- border:"2px red solid",
7784
- padding:"10px",
7785
- margin:"10px 0",
7786
- display:"flex",
7787
- justifyContent: "center",
7788
- });
7789
- this.LeftControl[0].setValue("Err");
7790
- this.cache.state="Error";
7791
- }
7792
- finally{
7793
- if(this.cache.state==="pending"){
7794
- this.cache.state="success";
7795
- this.setOrder(order);
7796
- if(this.cache.parent instanceof ZikoUICodeNote){
7797
- this.cache.parent.incrementOrder();
7798
- this.cache.parent.next();
7799
- }
7800
- }
7801
- }
7802
- }
7803
- #evaluateMd(){
7804
-
7805
- }
7806
- #evaluateHtml(){
7807
-
7808
- }
7809
- evaluate(order){
7810
- globalThis.__Ziko__.__Config__.default.target=this.Output.element;
7811
- switch(this.cache.type){
7812
- case "js":this.#evaluateJs(order);break;
7813
- }
7814
- return this;
7815
- }
7816
- clearInput(){
7817
- this.Output.element.innerText="";
7818
- return this;
7819
- }
7820
- clearOutput(){
7821
- this.Output.element.innerText="";
7822
- return this;
7823
- }
7824
- setOrder(order,render=true){
7825
- this.cache.order=order;
7826
- if(render){
7827
- (typeof order === "number")?this.LeftControl[0].setValue(`[${order}]`):this.LeftControl[0].setValue("[-]");
7828
- }
7829
- return this;
7830
- }
7831
- focus(){
7832
- this.Input.element.focus();
7833
- return this;
7834
- }
7835
- }
7836
-
7837
-
7838
- const CodeCell=(codeText,{type,order}={})=>new ZikoUICodeCell(codeText,{type,order});
7839
-
7840
- // Next
7841
- // Previous
7842
- // Vertical
7843
- // Horizontal
7844
- class ZikoUITabs extends ZikoUIFlex{
7845
- #ACTIVE_ELEMENT_INDEX=0;
7846
- constructor(Controllers,Contents){
7847
- super("div","Tabs");
7848
- Object.assign(this.cache,{
7849
- config:{
7850
- controllersPercent : .50
7851
- }
7852
- });
7853
- this.style({
7854
- boxSizing:"border-box",
7855
- backgroundColor: "blanchedalmond",
7856
- border:"1px red solid",
7857
- margin:"30px",
7858
- });
7859
- this.controllersContainer = Flex().size("auto","auto").style({
7860
- boxSizing:"border-box",
7861
- justifyContent:"center",
7862
- alignItems:"center",
7863
- textAlign:"center",
7864
-
7865
- minWidth:"50px",
7866
- minHeight:"50px",
7867
-
7868
- backgroundColor:"darkblue",
7869
- border:"1px darkblue solid",
7870
-
7871
- }).setAttr("role","tablist");
7872
- this.contentContainer = Flex().style({
7873
- boxSizing:"border-box",
7874
- justifyContent:"center",
7875
- alignItems:"center",
7876
- textAlign:"center",
7877
-
7878
- width:"100%",
7879
- height:"100%",
7880
- backgroundColor:"darkslategrey",
7881
- });
7882
- this.append(
7883
- this.controllersContainer,
7884
- this.contentContainer
7885
- );
7886
- if(Controllers.length!==Contents.length)console.error("");
7887
- else {
7888
- this.controllersContainer.append(...Controllers);
7889
- this.contentContainer.append(...Contents);
7890
- }
7891
- this.init();
7892
- this.display(0);
7893
- this.useVertical();
7894
- }
7895
- get isTabs(){
7896
- return true;
7897
- }
7898
- init(){
7899
- // Remove old listener
7900
- for(let i=0;i<this.controllersContainer.length;i++){
7901
- this.controllersContainer[i].setAttr("role","tab").setAttr("aria-controls",`tab${i}`);
7902
- this.contentContainer[i].setAttr("role","tabpanel").setAttr("aria-labelledby",`tab${i}`).setAttr("tabindex",-1);
7903
- }
7904
- this.controllersContainer.forEach(item=>item.onClick(e=>{
7905
- const tab=e.target.element.getAttribute("aria-controls");
7906
- const index=+tab.slice(3);
7907
- this.contentContainer.filter(n=>n.element.getAttribute("aria-labelledby")===tab,()=>{
7908
- if(this.#ACTIVE_ELEMENT_INDEX!==index)this.display(index);
7909
- });
7910
- }));
7911
- return this;
7912
- }
7913
- addPairs(ControllerItem,ContentItem){
7914
- this.controllersContainer.append(ControllerItem);
7915
- this.contentContainer.append(ContentItem);
7916
- const length=this.controllersContainer.length;
7917
- this.controllersContainer.at(-1).setAttr("role","tab").setAttr("aria-controls",`tab${length-1}`);
7918
- this.contentContainer.at(-1).setAttr("role","tabpanel").setAttr("aria-labelledby",`tab${length-1}`).setAttr("tabindex",-1);
7919
- // Add listener
7920
- return this;
7921
- }
7922
- removePairs(index){
7923
-
7924
- }
7925
- display(index){
7926
- this.#ACTIVE_ELEMENT_INDEX=index%this.contentContainer.length;
7927
- const ActiveContent = this.contentContainer.at(this.#ACTIVE_ELEMENT_INDEX);
7928
- this.controllersContainer.forEach(n=>n.setAttr("tabindex",-1).setAttr("aria-selected",false));
7929
- this.controllersContainer.at(this.#ACTIVE_ELEMENT_INDEX).setAttr("tabindex",0).setAttr("aria-selected",true);
7930
-
7931
- this.contentContainer.forEach(n=>n.st.hide());
7932
-
7933
- ActiveContent.st.translateX(100,0);
7934
- ActiveContent.setAttr("tabindex",0).st.show();
7935
- ActiveContent.st.translateX(0,1000);
7936
-
7937
- return this;
7938
- }
7939
- next(i=1){
7940
- this.display(this.#ACTIVE_ELEMENT_INDEX+i);
7941
- return this;
7942
- }
7943
- previous(i=1){
7944
- this.display(this.#ACTIVE_ELEMENT_INDEX-i);
7945
- return this;
7946
- }
7947
- useVertical(){
7948
- this.vertical(0,0);
7949
- this.controllersContainer.horizontal(0,0);
7950
- this.controllersContainer.style({
7951
- width : "100%",
7952
- height : `${this.cache.config.controllersPercent*100}%`
7953
- });
7954
- this.contentContainer.style({
7955
- width : "100%",
7956
- height : `${(1-this.cache.config.controllersPercent)*100}%`
7957
- });
7958
- return this;
7959
- }
7960
- useHorizontal(){
7961
- this.horizontal(0,0);
7962
- this.controllersContainer.vertical(0, 0);
7963
- this.controllersContainer.style({
7964
- height : "100%",
7965
- width : `${this.cache.config.controllersPercent*100}%`
7966
- });
7967
- this.contentContainer.style({
7968
- height : "100%",
7969
- width : `${(1-this.cache.config.controllersPercent)*100}%`
7970
- });
7971
- return this;
7972
- }
7973
- // useHorizontalSwippe(){
7974
- // this.onPtrDown();
7975
- // this.onPtrUp(e=>this.next(Math.sign(e.swippe.delta_x)));
7976
- // return this;
7977
- // }
7978
- // useVerticalSwippe(){
7979
- // this.onPtrDown();
7980
- // this.onPtrUp(e=>this.next(Math.sign(e.swippe.delta_y)));
7981
- // return this;
7982
- // }
7983
- }
7984
-
7985
- const Tabs=(Controllers,Contents)=>new ZikoUITabs(Controllers,Contents);
7986
-
7987
- /*
7988
-
7989
- const cont=(txt = "A")=>btn(txt).style({width:"170px"})
7990
- a=Tabs(
7991
- [cont("A1"),cont("A2"),cont("A3"),cont("A4")],
7992
- [cont("A1"),cont("A2"),cont("A3"),cont("A4")]
7993
- ).vertical().size("400px")
7994
- a.controllersContainer.style({
7995
- overflowX:"auto"
7996
- })
7997
- a.useHorizontal()
7998
-
7999
- */
8000
-
8001
- /*
8002
-
8003
- a=Flex().size("400px","400px").style({background:"red"})
8004
- a.element.animate([
8005
- { borderRadius: "0" , background : "red" },
8006
- { borderRadius: "50% 0" },
8007
- { borderRadius: "50% 50%" },
8008
- { borderRadius: "0 50%" },
8009
- { borderRadius: "0", background : "yellow" },
8010
- ],
8011
- {
8012
- // temporisation
8013
- duration: 2000,
8014
- iterations: Infinity,
8015
- })
8016
-
8017
- */
8018
-
8019
- const palette = {
8020
- success: {
8021
- titleColor:"green",
8022
- contentColor: "#35495e",
8023
- bgColor: "#d4edda", // Fixed
8024
- bgColor:"linear-gradient(-225deg, #DFFFCD 0%, #90F9C4 48%, #39F3BB 100%)",
8025
- borderColor: "#28a745", // Fixed
8026
- icon: "✅"
8027
- },
8028
- info: {
8029
- titleColor:"blue",
8030
- contentColor: "#00204a",
8031
- bgColor: "#93deff", // Fixed
8032
- bgColor:"radial-gradient(circle at 10% 20%, rgb(147, 230, 241) 0%, rgb(145, 192, 241) 45.5%)",
8033
- borderColor: "#005689", // Fixed
8034
- icon: "ℹ️"
8035
- },
8036
- warning: {
8037
- titleColor:"#e4663a",
8038
- contentColor: "#45171d",
8039
- bgColor:"#fdffcd",
8040
- bgColor:"radial-gradient(907px at 3.4% 19.8%, rgb(255, 243, 122) 0%, rgb(255, 102, 145) 97.4%)",
8041
- borderColor: "#efd510",
8042
- icon: "⚠️"
8043
- },
8044
- danger: {
8045
- titleColor:"red",
8046
- contentColor: "#721c24",
8047
- bgColor: "#f8d7da", // Fixed
8048
- bgColor:"linear-gradient(90deg, rgb(255, 157, 129) 24.3%, rgb(255, 138, 138) 78.3%)",
8049
- borderColor: "#c50000", // Fixed
8050
- icon: "❌"
8051
- },
8052
- tips: {
8053
- titleColor:null,
8054
- contentColor: null,
8055
- bgColor: null,
8056
- borderColor: null,
8057
- icon: "💡"
8058
- },
8059
- important: {
8060
- titleColor:null,
8061
- contentColor: null,
8062
- bgColor: null,
8063
- borderColor: null,
8064
- icon: "📌"
8065
- },
8066
-
8067
- };
8068
-
8069
- class ZikoUIAlert extends ZikoUIFlex$1{
8070
- constructor(type, title, content){
8071
- super();
8072
- this.title = h3(title);
8073
- this.icon = text$1(palette[type].icon).style({
8074
- display: "flex",
8075
- justifyContent:"center",
8076
- borderRadius:"50%",
8077
- minWidth:"30px",
8078
- minHeight:"30px",
8079
- });
8080
- this.content = content;
8081
- this.vertical()
8082
- .size("200px", "auto")
8083
- .style({
8084
- borderRadius:"10px",
8085
- padding:"10px"
8086
- });
8087
- this.append(
8088
- Flex$1(
8089
- this.title,
8090
- this.icon
8091
- ).size("100%", "40px").style({}).horizontal("space-between",0),
8092
- this.content
8093
- );
8094
- this.useType(type);
8095
- }
8096
- get isAlert(){
8097
- return true;
8098
- }
8099
- useType(type){
8100
- this.style({
8101
- color:palette[type].color,
8102
- background:palette[type].bgColor,
8103
- border: `1px darkblue solid`,
8104
- borderLeft: `15px ${palette[type].borderColor} solid`,
8105
- });
8106
- this.title.style({
8107
- color:palette[type].titleColor
8108
- });
8109
- this.content.st.color(palette[type].titleColor);
8110
- this.icon.setValue(palette[type].icon).style({
8111
- border:`2px ${palette[type].borderColor} solid`,
8112
- alignItems: type==="warning"?"flex-start":"center",
8113
- });
8114
- return this;
8115
- }
8116
- useSuccess(){
8117
- this.useType("success");
8118
- return this;
8119
- }
8120
- useInfo(){
8121
- this.useType("info");
8122
- return this;
8123
- }
8124
- useWarning(){
8125
- this.useType("warning");
8126
- return this;
8127
- }
8128
- useDanger(){
8129
- this.useType("danger");
8130
- return this;
8131
- }
8132
- }
8133
-
8134
- const successAlert=(title, content)=>new ZikoUIAlert("success", title, content);
8135
- const infoAlert=(title, content)=>new ZikoUIAlert("info", title, content);
8136
- const warningAlert=(title, content)=>new ZikoUIAlert("warning", title, content);
8137
- const dangerAlert=(title, content)=>new ZikoUIAlert("danger", title, content);
8138
-
8139
- class __ZikoUISplitter__ extends ZikoUIElement{
8140
- constructor(flexDirection, resizerCursor, resizerProp){
8141
- super("div", "Splitter");
8142
- Object.assign(this.cache,{
8143
- isResizing : false,
8144
- flexDirection,
8145
- resizerCursor,
8146
- resizerProp
8147
- });
8148
- this.style({
8149
- display:"flex",
8150
- flexDirection : this.cache.flexDirection,
8151
- border: "2px solid #333",
8152
- overflow: "hidden"
8153
- });
8154
- this.resizer = new ZikoUIElement("div", "resizer").style({
8155
- [this.cache.resizerProp]:"5px",
8156
- backgroundColor: "gold",
8157
- cursor: this.cache.resizerCursor,
8158
- touchAction: "none",
8159
- });
8160
- this.onPtrDown(e=>{
8161
- this.cache.isResizing = true;
8162
- this.style({
8163
- cursor : this.cache.resizerCursor // ns-resize
8164
- });
8165
- this.resizer.element.setPointerCapture(e.event.pointerId);
8166
- });
8167
- this.onPtrUp(e=>{
8168
- this.cache.isResizing = false;
8169
- this.style({
8170
- cursor: "default"
8171
- });
8172
- this.resizer.element.releasePointerCapture(e.event.pointerId);
8173
- });
8174
- this.onPtrCancel(()=>{
8175
- this.cache.isResizing = false;
8176
- this.style({
8177
- cursor: "default"
8178
- });
8179
- });
8180
- this.onPtrOut(()=>{
8181
- if (this.cache.isResizing) {
8182
- this.cache.isResizing = false;
8183
- this.style({
8184
- cursor: "default"
8185
- });
8186
- }
8187
- });
8188
- }
8189
- get isSplitter(){
8190
- return true;
8191
- }
8192
- styleResizer(style={}){
8193
- this.resizer.style(style);
8194
- return this;
8195
- }
8196
- }
8197
-
8198
- class ZikoUIHorizontalSplitter extends __ZikoUISplitter__{
8199
- constructor(leftPane, rightPane){
8200
- super("row", "ew-resize", "width");
8201
- this.leftPane = leftPane.style({
8202
- width:"50%",
8203
- flexGrow: 1,
8204
- overflow: "hidden"
8205
- });
8206
- this.rightPane = rightPane.style({
8207
- width:"50%",
8208
- flexGrow: 1,
8209
- overflow: "hidden"
8210
- });
8211
- this.element?.append(
8212
- this.leftPane.element,
8213
- this.resizer.element,
8214
- this.rightPane.element
8215
- );
8216
- this.onPtrMove(e=>{
8217
- if (!this.cache.isResizing) return;
8218
- const containerWidth = this.element.getBoundingClientRect().width; // height
8219
- const pointerRelativeXpos = e.event.clientX - this.element.getBoundingClientRect().x; // y
8220
- let newLeftPaneWidth = (pointerRelativeXpos / containerWidth) * 100;
8221
- let newRightPaneWidth = 100 - newLeftPaneWidth;
8222
- if (newLeftPaneWidth < 0) newLeftPaneWidth = 0;
8223
- if (newRightPaneWidth < 0) newRightPaneWidth = 0;
8224
- this.leftPane.element.style.width = `${newLeftPaneWidth}%`;
8225
- this.rightPane.element.style.width = `${newRightPaneWidth}%`;
8226
- });
8227
- }
8228
- get isHorizontalSplitter(){
8229
- return true;
8230
- }
8231
- }
8232
- const hSplitter=(leftPane, rightPane)=>new ZikoUIHorizontalSplitter(leftPane, rightPane);
8233
-
8234
- class ZikoUIVerticalSplitter extends __ZikoUISplitter__{
8235
- constructor(topPane, bottomPane){
8236
- super("column", "ns-resize", "height");
8237
- this.topPane = topPane.style({
8238
- height:"50%",
8239
- flexGrow: 1,
8240
- overflow: "hidden"
8241
- });
8242
- this.bottomPane = bottomPane.style({
8243
- height:"50%",
8244
- flexGrow: 1,
8245
- overflow: "hidden"
8246
- });
8247
- this.element?.append(
8248
- this.topPane.element,
8249
- this.resizer.element,
8250
- this.bottomPane.element
8251
- );
8252
- this.onPtrMove(e=>{
8253
- if (!this.cache.isResizing) return;
8254
- const containerHeight = this.element.getBoundingClientRect().height; // height
8255
- const pointerRelativeYpos = e.event.clientY - this.element.getBoundingClientRect().y; // y
8256
- let newTopPaneHeight = (pointerRelativeYpos / containerHeight) * 100;
8257
- let newBottomPaneHeight = 100 - newTopPaneHeight;
8258
- if (newTopPaneHeight < 0) newTopPaneHeight = 0;
8259
- if (newBottomPaneHeight < 0) newBottomPaneHeight = 0;
8260
- this.topPane.element.style.height = `${newTopPaneHeight}%`;
8261
- this.bottomPane.element.style.height = `${newBottomPaneHeight}%`;
8262
- });
8263
- }
8264
- get isHorizontalSplitter(){
8265
- return true;
8266
- }
8267
- }
8268
- const vSplitter=(topPane, bottomPane)=>new ZikoUIVerticalSplitter(topPane, bottomPane);
8269
-
8270
- const Splitter = ({orintation = "horizontal",slides = []}) =>{
8271
- if(["v","vertical"].includes(orintation.toLowerCase())) return vSplitter(...slides);
8272
- else if(["h","horizontal"].includes(orintation.toLowerCase())) return hSplitter(...slides);
8273
- else ;
8274
- };
8275
-
8276
- class ZikoUIBreadcrumbs extends ZikoUIElement{
8277
- constructor(...items){
8278
- super("ul", "Breadcrumbs");
8279
- Object.assign(this.cache,{
8280
- separatorTextContent:"/"
8281
- });
8282
- this.style({
8283
- listStyle: "none",
8284
- display: "flex",
8285
- flexWrap: "wrap"
8286
- });
8287
- this.list=html('li').style({
8288
- display: "flex",
8289
- flexWrap: "wrap"
8290
- });
8291
- this.append(...items);
8292
- }
8293
- #addItem(item){
8294
- if(["string","number","boolean"].includes(typeof item))item = text$1(item);
8295
- const li = html("li", item).style({
8296
- display: "flex",
8297
- alignItems: "center"
8298
- });
8299
- if(this.element.children.length>0){
8300
- const separator = text$1(this.cache.separatorTextContent).style({
8301
- padding: "0 4px"
8302
- });
8303
- this.element?.append(separator.element);
8304
- }
8305
- this.element?.append(li.element);
8306
- }
8307
- append(...items){
8308
- items.forEach(n=>this.#addItem(n));
8309
- return this;
8310
- }
8311
- configSeparator(separatorTextContent = this.cache.separator, style = {}){
8312
- this.cache.separatorTextContent = separatorTextContent;
8313
- const separators = [...this.element.children].filter(n=>n.tagName==="SPAN");
8314
- separators.forEach(node=>{
8315
- node.textContent = separatorTextContent;
8316
- Object.assign(node.style, style);
8317
- }
8318
- );
8319
- return this;
8320
- }
8321
- }
8322
- const Breadcrumbs=(...items)=>new ZikoUIBreadcrumbs(...items);
8323
-
8324
- class ZikoUIMenu3d extends ZikoUIFlex$1{
8325
- constructor(controller, content){
8326
- super("div", "menu3d");
8327
- this.controller = controller;
8328
- this.content = content;
8329
- this.cover = null;
8330
- Object.assign(this.cache,{
8331
- config:{
8332
- useTransfo : false,
8333
- isOpen : false,
8334
- position : "left",
8335
- threshold : 40,
8336
- angle : 70,
8337
- overlap : 6,
8338
- width : 300,
8339
- height : 300,
8340
- transitionDuration: '0.5s',
8341
- transitionEasing: 'ease',
8342
- menuTransformOrigin : null,
8343
- menuTransformClosed : null,
8344
- menuTransformOpened : null,
8345
- contentTransformOrigin : null,
8346
- contentTransformClosed : null,
8347
- contentTransformOpened : null,
8348
- }
8349
- });
8350
- this.append(
8351
- this.controller,
8352
- this.content
8353
- );
8354
- this.update();
8355
- }
8356
- get isOpen(){
8357
- return this.cache.config.isOpen;
8358
- }
8359
- update(){
8360
- this.controller.style({
8361
- display:"none",
8362
- padding:"20px",
8363
- overflow:"auto",
8364
- background:"darkblue",
8365
- color: "#eee",
8366
- webkitboxSizing: "border-box",
8367
- mozBoxSizing: "border-box",
8368
- boxSizing:"border-box",
8369
- });
8370
- this.content.style({
8371
- padding:"20px 40px",
8372
- width: "100%",
8373
- height: "100%",
8374
- // overflowY:"auto",
8375
- background:"gold",
8376
- color: "#eee",
8377
- webkitboxSizing: "border-box",
8378
- mozBoxSizing: "border-box",
8379
- boxSizing:"border-box",
8380
- webkitOverflowScrolling:"touch",
8381
- webkitTransformStyle: "preserve-3d"
8382
- });
8383
- this.setupPositions();
8384
- this.setupWrapper();
8385
- this.setupCover();
8386
- this.setupMenu();
8387
- this.setupContent();
8388
- }
8389
- setupPositions() {
8390
- this.cache.config.menuTransformOpened = '';
8391
- this.cache.config.contentTransformClosed = '';
8392
- let menuAngle = this.cache.config.angle;
8393
- let contentAngle = this.cache.config.angle / -2;
8394
- switch( this.cache.config.position ) {
8395
- case "top":
8396
- this.cache.config.menuTransformOrigin = '50% 0%';
8397
- this.cache.config.menuTransformClosed = `rotateX(${menuAngle}deg) translateY(-100%) translateY(${this.cache.config.overlap}px)`;
8398
- this.cache.config.contentTransformOrigin = '50% 0';
8399
- this.cache.config.contentTransformOpened = `translateY(${this.height/2}px) rotateX(${contentAngle}deg)`;
8400
- break;
8401
- case "right":
8402
- this.cache.config.menuTransformOrigin = '100% 50%';
8403
- this.cache.config.menuTransformClosed = 'rotateY( ' + menuAngle + 'deg ) translateX( 100% ) translateX( -2px ) scale( 1.01 )';
8404
- this.cache.config.contentTransformOrigin = '100% 50%';
8405
- this.cache.config.contentTransformOpened = 'translateX( -'+ this.width/2 +'px ) rotateY( ' + contentAngle + 'deg )';
8406
- break;
8407
- case "bottom":
8408
- this.cache.config.menuTransformOrigin = '50% 100%';
8409
- this.cache.config.menuTransformClosed = 'rotateX( ' + -menuAngle + 'deg ) translateY( 100% ) translateY( -'+ this.cache.config.overlap +'px )';
8410
- this.cache.config.contentTransformOrigin = '50% 100%';
8411
- this.cache.config.contentTransformOpened = 'translateY( -'+ this.height/2 +'px ) rotateX( ' + -contentAngle + 'deg )';
8412
- break;
8413
- default:
8414
- this.cache.config.menuTransformOrigin = '100% 50%';
8415
- this.cache.config.menuTransformClosed = 'translateX( -100% ) translateX( '+ this.cache.config.overlap +'px ) scale( 1.01 ) rotateY( ' + -menuAngle + 'deg )';
8416
- this.cache.config.contentTransformOrigin = '0 50%';
8417
- this.cache.config.contentTransformOpened = 'translateX( '+ this.width/2 +'px ) rotateY( ' + -contentAngle + 'deg )';
8418
- break;
8419
- }
8420
- }
8421
- setupWrapper() {
8422
- this.style({
8423
- perspective : "800px",
8424
- perspectiveOrigin : this.cache.config.contentTransformOrigin
8425
- });
8426
- }
8427
- setupCover(){
8428
- if( this.cover ) this.cover.element.parentNode.removeChild( this.cover.element );
8429
- this.cover=new ZikoUIElement("div","div").style({
8430
- position:"absolute",
8431
- display:"block",
8432
- width:"100%",
8433
- height:"100%",
8434
- left:0,
8435
- top:0,
8436
- zIndex:1000,
8437
- visibility:"hidden",
8438
- opacity:0,
8439
- transition: `all ${this.cache.config.transitionDuration} ${this.cache.config.transitionEasing}`
8440
- });
8441
- this.content.element.appendChild( this.cover.element );
8442
- }
8443
- setupMenu() {
8444
- // var style = dom.menu.style;
8445
- switch( this.cache.config.position ) {
8446
- case "top":
8447
- this.controller.style({
8448
- width : "100%",
8449
- height : `${this.height/2}px`
8450
- });break;
8451
- case "right":
8452
- this.controller.style({
8453
- right : 0,
8454
- width : `${this.width/2}px`,
8455
- height : "100%"
8456
- });break;
8457
- case "bottom":
8458
- this.controller.style({
8459
- bottom : "0",
8460
- width : "100%",
8461
- height : `${this.height/2}px`
8462
- });break;
8463
- case "left":
8464
- this.controller.style({
8465
- width : `${this.width/2}px`,
8466
- height : "100%"
8467
- });break;
8468
- }
8469
- this.controller.style({
8470
- position : "fixed",
8471
- display : "block",
8472
- zIndex : 1,
8473
- transform : this.cache.config.menuTransformClosed,
8474
- transformOrigin : this.cache.config.menuTransformOrigin,
8475
- transition : 'all ' + this.cache.config.transitionDuration +' '+ this.cache.config.transitionEasing
8476
- });
8477
- }
8478
- setupContent() {
8479
- this.content.style({
8480
- transform : this.cache.config.contentTransformClosed,
8481
- transformOrigin : this.cache.config.contentTransformOrigin,
8482
- transition : `all ${this.cache.config.transitionDuration} ${this.cache.config.transitionEasing}`
8483
- });
8484
- }
8485
- open(){
8486
- if(!this.cache.config.isOpen){
8487
- this.cache.config.isOpen = true;
8488
- this.cover.style({
8489
- height : this.content.element.scrollHeight + "px",
8490
- visibility : "visible",
8491
- opacity : 1,
8492
- });
8493
- if(this.cache.config.useTransfo)this.content.style({
8494
- transform : this.cache.config.contentTransformOpened,
8495
- userSelect : "default"
8496
- });
8497
- this.controller.style({
8498
- transform : this.cache.config.menuTransformOpened,
8499
- useSelect : "none"
8500
- });
8501
- this.emit("opened");
8502
- }
8503
- }
8504
- close() {
8505
- if( this.cache.config.isOpen ) {
8506
- this.cache.config.isOpen = false;
8507
- this.cover.style({
8508
- // height : this.content.element.scrollHeight + "px",
8509
- visibility : "hidden",
8510
- opacity : 0,
8511
- });
8512
- this.content.style({
8513
- transform : this.cache.config.contentTransformClosed,
8514
- useSelect : "default"
8515
- });
8516
- this.controller.style({
8517
- transform : this.cache.config.menuTransformClosed,
8518
- userSelect : "none"
8519
- });
8520
- }
8521
- this.emit("closed");
8522
- }
8523
- onOpen(callback){
8524
- this.on("opened", callback.bind(this));
8525
- return this;
8526
- }
8527
- onClose(callback){
8528
- this.on("closed", callback.bind(this));
8529
- return this;
8530
- }
8531
- #usePosition(position){
8532
- if(this.cache.config.position!==position){
8533
- this.cache.config.position=position;
8534
- const isOpen = this.isOpen;
8535
- this.close();
8536
- this.update();
8537
- if(isOpen)this.open();
8538
- }
8539
- }
8540
- useRight(){
8541
- this.#usePosition("left");
8542
- return this;
8543
- }
8544
- useRight(){
8545
- this.#usePosition("right");
8546
- return this;
8547
- }
8548
- useTop(){
8549
- this.#usePosition("top");
8550
- return this;
8551
- }
8552
- useBottom(){
8553
- this.#usePosition("bottom");
8554
- return this;
8555
- }
8556
- }
8557
- const menu3d = (controller, content) => new ZikoUIMenu3d(controller, content);
8558
- globalThis.menu3d = menu3d;
8559
-
8560
-
8561
- /*
8562
-
8563
- a = menu3d(Flex(text("Menu")), Flex(text("Content")))
8564
- .size("80vw", "50vh")
8565
- .style({ userSelect: "none" });
8566
- a.onOpen((e) => console.log(e));
8567
- a.open();
8568
- a.controller.onSwipe(0.05, 1, (e) => {
8569
- if (e.event.detail.direction.x === "left") a.close();
8570
- });
8571
- a.content.onSwipe(0.1, 1, (e) => {
8572
- if (e.event.detail.direction.x === "left") a.close();
8573
- if (e.event.detail.direction.x === "right") a.open();
8574
- });
8575
-
8576
-
8577
- */
8578
-
8579
- class ZikoUIModal extends ZikoUIContainerElement{
8580
- constructor(...UIElements){
8581
- super("dialog", "modal");
8582
- this.append(...UIElements);
8583
- Object.assign(this.cache,{
8584
- config:{
8585
- mode:"modal",
8586
- useTransition:true
8587
- }
8588
- });
8589
- this.style({
8590
- display:"flex",
8591
- justifyContent:"center",
8592
- alignItems:"center",
8593
- position: "absolute",
8594
- top: "50%",
8595
- left: "50%",
8596
- transform: "translate(-50%, -50%)",
8597
- padding: "20px",
8598
- border: "none",
8599
- backgroundCcolor: "#f5f5f5",
8600
- boxShadow: "0px 4px 10px rgba(0, 0, 0, 0.1)",
8601
- borderRadius: "8px"
8602
- });
8603
- this.close();
8604
- }
8605
- open(){
8606
- if(!this.element.open){
8607
- switch(this.cache.config.mode){
8608
- case "modal": this.element.showModal(); break;
8609
- case "dialog": this.element.show(); break;
8610
- default : this.element.show(); break;
8611
- }
8612
- // this.style({
8613
- // display : "flex",
8614
- // })
8615
- this.st.fadeIn(1000);
8616
- this.emit("modal:opened");
8617
- }
8618
- return this;
8619
- }
8620
- close(){
8621
- // this.style({
8622
- // display : "none"
8623
- // })
8624
- this.st.fadeOut(1000);
8625
- if(this.element.open){
8626
- this.element.close();
8627
- }
8628
- this.emit("modal:closed");
8629
- return this;
8630
- }
8631
- closeAfter(t = 1000){
8632
- globalThis?.setTimeout(()=>this.close(), t);
8633
- return this;
8634
- }
8635
- onOpen(callback){
8636
- this.on("modal:opened",callback.bind(this));
8637
- return this;
8638
- }
8639
- onClose(callback){
8640
- this.on("modal:closed",callback.bind(this));
8641
- return this;
8642
- }
8643
- useModal(){
8644
- this.cache.config.mode = "modal";
8645
- return this;
8646
- }
8647
- useDialog(){
8648
- this.cache.config.mode = "dialog";
8649
- return this;
8650
- }
8651
- useTransition(enabled = true){
8652
- this.cache.config.useTransition = enabled;
8653
- return this;
8654
- }
8655
- }
8656
-
8657
- const Modal=(...UIElements)=>new ZikoUIModal(...UIElements);
8658
-
8659
- /*
8660
- a=Modal(text("Hello")).style({
8661
- width:"100%",
8662
- height:"100%"
8663
- })
8664
- Flex(a).size("400px","400px").style({border:"1px red solid"})
8665
- */
8666
-
8667
- class __ZikoUISlider__ extends ZikoUISection{
8668
- constructor(){
8669
- super("section","");
8670
- Object.assign(this.cache,{
8671
- currentIndex : 0,
8672
- slideBuilder : null,
8673
- });
8674
- this.container = Flex().size("100%","100%").vertical(0,0).style({
8675
- // width:"100%",
8676
- overflow:"hidden"
8677
- });
8678
- // this.style({
8679
- // // width:"100%",
8680
- // overflow:"hidden"
8681
- // });
8682
- this.container.setAttr({
8683
- ariaRoledescription : "carousel",
8684
- ariaLive: "polite",
8685
- ariaLabel : "Content Slider"
8686
- });
8687
- this.track = Section().size("100%","100%").style({
8688
- transition : "transform 0.3s ease-in-out",
8689
- });
8690
- this.bullets = Flex().style({
8691
- // position : "absolute",
8692
- // top : 0,
8693
- gap : "10px",
8694
- padding:"10px",
8695
- });
8696
- this.container.append(
8697
- this.track,
8698
- this.bullets
8699
- );
8700
- this.append(this.container);
8701
- }
8702
- #updateAriaHidden(){
8703
- for(let i=0;i<this.track.items.length;i++){
8704
- this.track[i].setAttr({
8705
- ariaHidden : (i!==this.cache.currentIndex)
8706
- });
8707
- }
8708
- }
8709
- goto(n = 0){
8710
- this.cache.currentIndex = n;
8711
- this.__updatePos();
8712
- this.#updateAriaHidden();
8713
- }
8714
- next(n = 1){
8715
- this.cache.currentIndex += n;
8716
- this.__updatePos();
8717
- this.#updateAriaHidden();
8718
- return this;
8719
- }
8720
- previous(n = 1){
8721
- this.cache.currentIndex -= n;
8722
- this.__updatePos();
8723
- this.#updateAriaHidden();
8724
- return this;
8725
- }
8726
- #update(){
8727
- const length = this.track.items.length;
8728
- for(let i=0;i<length;i++){
8729
- this.track.items[i].setAttr({
8730
- ariaLabel : `Slide ${i+1} of ${length}`,
8731
- dataSlideIndex : i
8732
- });
8733
- this.bullets.items[i].setAttr({
8734
- dataIndex : i,
8735
- ariaLabel : `Go to slide ${i}`
8736
- });
8737
- this.bullets[i].events.click?.destroy();
8738
- this.bullets[i].onClick(()=>this.goto(i));
8739
- }
8740
- }
8741
- #addSlide(UIElement){
8742
- this.track.append(this.cache.slideBuilder(UIElement).setAttr({
8743
- ariaRoledescription : "slide",
8744
- role : "group",
8745
- ariaLabel : "" // link to update
8746
- }));
8747
- const bullet = text$1().size("15px","15px").style({
8748
- borderRadius:"50%",
8749
- cursor : "pointer",
8750
- border : "3px solid blue",
8751
- background : "white"
8752
- }).setAttr({
8753
- role : "button",
8754
- tabIndex : 0
8755
- })
8756
- .onPtrEnter(e=>e.target.st.background("gold").scale(1.2,1.2))
8757
- .onPtrLeave(e=>e.target.st.background("white").scale(1,1));
8758
- this.bullets.append(
8759
- bullet
8760
- );
8761
- return this;
8762
- }
8763
- addSlides(...slides){
8764
- slides.forEach(n=>this.#addSlide(n));
8765
- this.#update();
8766
- this.#updateAriaHidden();
8767
- return this;
8768
- }
8769
- }
8770
-
8771
- class ZikoUIHorizontalSlider extends __ZikoUISlider__{
8772
- constructor(...slides){
8773
- super("section","hSlider");
8774
- this.container.vertical(0,0);
8775
- Object.assign(this.cache,{
8776
- slideBuilder : (UIElement) => Flex(UIElement).style({
8777
- minWidth : "100%",
8778
- width:"100%",
8779
- height:"100%",
8780
- }).vertical(0,0)
8781
- });
8782
- this.track.size("100%","90%").style({
8783
- display : "flex"
8784
- });
8785
- this.addSlides(...slides);
8786
- this.bullets.horizontal(0,0).style({
8787
- width : "100%",
8788
- height : "10%",
8789
- });
8790
- }
8791
- __updatePos(){
8792
- const width = this.container.width;
8793
- this.track.st.translateX(-this.cache.currentIndex * width);
8794
- }
8795
-
8796
- }
8797
-
8798
- const hSlider=(...slides)=>new ZikoUIHorizontalSlider(...slides);
8799
-
8800
- class ZikoUIVerticalSlider extends __ZikoUISlider__{
8801
- constructor(...slides){
8802
- super("section","vSlider");
8803
- Object.assign(this.cache,{
8804
- slideBuilder : (UIElement) => Flex(UIElement).size("100%","100%").vertical(0, 0)
8805
- });
8806
- this.addSlides(...slides);
8807
- this.container.horizontal(0,0);
8808
- this.track.size("90%","100%");
8809
- this.bullets.vertical(0,0).style({
8810
- height : "100%",
8811
- width : "10%"
8812
- });
8813
- }
8814
- __updatePos(){
8815
- const height = this.container.height;
8816
- this.track.st.translateY(-this.cache.currentIndex * height);
8817
- }
8818
- }
8819
-
8820
- const vSlider=(...slides)=>new ZikoUIVerticalSlider(...slides);
8821
-
8822
- const Slider = ({orintation = "horizontal",slides = []}) =>{
8823
- if(["v","vertical"].includes(orintation.toLowerCase())) return vSlider(...slides);
8824
- else if(["h","horizontal"].includes(orintation.toLowerCase())) return hSlider(...slides);
8825
- else ;
8826
- };
8827
-
8828
- var Derived = /*#__PURE__*/Object.freeze({
8829
- __proto__: null,
8830
- Accordion: Accordion,
8831
- Breadcrumbs: Breadcrumbs,
8832
- Carousel: Carousel,
8833
- CodeCell: CodeCell,
8834
- CodeNote: CodeNote,
8835
- Collapsible: Collapsible,
8836
- Flex: Flex$1,
8837
- Grid: Grid$1,
8838
- Modal: Modal,
8839
- Slider: Slider,
8840
- Splitter: Splitter,
8841
- Tabs: Tabs,
8842
- ZikoUIAccordion: ZikoUIAccordion,
8843
- ZikoUIBreadcrumbs: ZikoUIBreadcrumbs,
8844
- ZikoUICodeNote: ZikoUICodeNote,
8845
- ZikoUIFlex: ZikoUIFlex$1,
8846
- ZikoUIGrid: ZikoUIGrid,
8847
- ZikoUIHorizontalSlider: ZikoUIHorizontalSlider,
8848
- ZikoUIHorizontalSplitter: ZikoUIHorizontalSplitter,
8849
- ZikoUIMenu3d: ZikoUIMenu3d,
8850
- ZikoUIModal: ZikoUIModal,
8851
- ZikoUIVerticalSlider: ZikoUIVerticalSlider,
8852
- ZikoUIVerticalSplitter: ZikoUIVerticalSplitter,
8853
- dangerAlert: dangerAlert,
8854
- hSlider: hSlider,
8855
- hSplitter: hSplitter,
8856
- infoAlert: infoAlert,
8857
- menu3d: menu3d,
8858
- successAlert: successAlert,
8859
- vSlider: vSlider,
8860
- vSplitter: vSplitter,
8861
- warningAlert: warningAlert
8862
- });
8863
-
8864
- const UI$1 = {
8865
- ...Text$1,
8866
- ...List,
8867
- ...Io,
8868
- ...Media,
8869
- ...Table,
8870
- ...Semantic,
8871
- ...Misc,
8872
- ...Derived,
8873
- ZikoUIElement,
8874
- ZikoUIContainerElement
8875
- };
6885
+ const UI$1 = {
6886
+ ...Text$1,
6887
+ ...List,
6888
+ ...Io,
6889
+ ...Media,
6890
+ ...Table,
6891
+ ...Semantic,
6892
+ ...Misc,
6893
+ ...Flex$1,
6894
+ ...Grid$2,
6895
+ ZikoUIElement,
6896
+ };
8876
6897
 
8877
6898
  const svg2str=svg=>(new XMLSerializer()).serializeToString(svg);
8878
6899
  const svg2ascii=svg=>btoa(svg2str(svg));
@@ -9018,9 +7039,11 @@
9018
7039
  }, Array.isArray(obj) ? [] : {});
9019
7040
  }
9020
7041
 
7042
+ // export { markdown2html } from "./markdown.js";
7043
+ // export { adoc2html } from "./adoc.js";
7044
+
9021
7045
  var Converter = /*#__PURE__*/Object.freeze({
9022
7046
  __proto__: null,
9023
- adoc2html: adoc2html,
9024
7047
  arr2str: arr2str,
9025
7048
  csv2arr: csv2arr,
9026
7049
  csv2json: csv2json,
@@ -9035,7 +7058,6 @@
9035
7058
  json2xmlFile: json2xmlFile,
9036
7059
  json2yml: json2yml,
9037
7060
  json2ymlFile: json2ymlFile,
9038
- markdown2html: markdown2html,
9039
7061
  obj2str: obj2str,
9040
7062
  svg2ascii: svg2ascii,
9041
7063
  svg2img: svg2img,
@@ -10408,7 +8430,7 @@
10408
8430
  ...__Calculus__,
10409
8431
  };
10410
8432
 
10411
- class ZikoUISvg extends ZikoUIContainerElement {
8433
+ class ZikoUISvg extends ZikoUIElement {
10412
8434
  constructor(w=360,h=300) {
10413
8435
  super("svg","svg");
10414
8436
  //this.cache={};
@@ -10473,439 +8495,14 @@
10473
8495
 
10474
8496
  const Svg =(w,h)=>new ZikoUISvg(w,h);
10475
8497
 
10476
- class ZikoSvgElement extends ZikoUIElement{
10477
- constructor(type) {
10478
- super();
10479
- Object.assign(this.cache,{
10480
- type
10481
- });
10482
- }
10483
- pos(x,y){
10484
- return this.posX(x).posY(y);
10485
- }
10486
- posX(x){
10487
- if(["circle","ellipse"].includes(this.cache.type))this.element.cx.baseVal.value=x;
10488
- else this.element.x.baseVal.value=x;
10489
- return this;
10490
- }
10491
- posY(y){
10492
- if(["circle","ellipse"].includes(this.cache.type))this.element.cy.baseVal.value=y;
10493
- else this.element.y.baseVal.value=y;
10494
- return this;
10495
- }
10496
- translate(x,y){
10497
- return this;
10498
- }
10499
- color({ stroke, fill }) {
10500
- this.element?.setAttribute("stroke", stroke);
10501
- this.element?.setAttribute("fill", fill);
10502
- return this;
10503
- }
10504
- fill(color = "none") {
10505
- this.element?.setAttribute("fill", color);
10506
- return this;
10507
- }
10508
- stroke(color = "none", width) {
10509
- this.element?.setAttribute("stroke", color);
10510
- width && this.strokeWidth(width);
10511
- return this;
10512
- }
10513
- strokeWidth(width = 1) {
10514
- this.element?.setAttribute("stroke-width", width);
10515
- return this;
10516
- }
10517
- opacity(value = 1) {
10518
- this.element?.setAttribute("opacity", value);
10519
- return this;
10520
- }
10521
- }
10522
-
10523
- class ZikoSvgCircle extends ZikoSvgElement{
10524
- constructor(cx,cy,r){
10525
- super("circle");
10526
- this.element=document.createElementNS(
10527
- "http://www.w3.org/2000/svg",
10528
- "circle",
10529
- );
10530
- this.pos(cx,cy).setR(r);
10531
- }
10532
- setR(r){
10533
- this.element.r.baseVal.value=r;
10534
- return this;
10535
- }
10536
- get r(){
10537
- return this.element.baseVal.value;
10538
- }
10539
- get cx(){
10540
- return this.element.baseVal.value;
10541
- }
10542
- get cy(){
10543
- return this.element.baseVal.value;
10544
- }
10545
- }
10546
- const svgCircle=(x,y,r)=>new ZikoSvgCircle(x,y,r);
10547
-
10548
- class ZikoSvgEllipse extends ZikoSvgElement{
10549
- constructor(cx,cy,rx,ry){
10550
- super("ellipse");
10551
- this.element=document?.createElementNS(
10552
- "http://www.w3.org/2000/svg",
10553
- "ellipse",
10554
- );
10555
- this.pos(cx,cy).setRx(rx).setRy(ry);
10556
- }
10557
- setRx(rx){
10558
- this.element.rx.baseVal.value=rx;
10559
- return this;
10560
- }
10561
- setRy(ry){
10562
- this.element.ry.baseVal.value=ry;
10563
- return this;
10564
- }
10565
- }
10566
- const svgEllipse=(x,y,rx,ry)=>new ZikoSvgEllipse(x,y,rx,ry);
10567
-
10568
- class ZikoSvgForeignObject extends ZikoSvgElement{
10569
- constructor(x=0,y=0,w="100%",h="100%",...ZikoUIElement){
10570
- super("foreignObject");
10571
- this.items=[];
10572
- this.element=document?.createElementNS(
10573
- "http://www.w3.org/2000/svg",
10574
- "foreignObject",
10575
- );
10576
- this.container=Flex$1().setTarget(this.element).vertical(0,0).size("auto","auto");
10577
- this.container.st.scaleY(-1);
10578
- this.posX(x).posY(y).width(w).height(h);
10579
- }
10580
- width(w){
10581
- this.element.etAttribute("width",w);
10582
- return this;
10583
- }
10584
- height(h){
10585
- this.element.etAttribute("height",h);
10586
- return this;
10587
- }
10588
- add(...ZikoUIElement){
10589
- this.container.append(...ZikoUIElement);
10590
- return this;
10591
- }
10592
- remove(...ZikoUIElement){
10593
- this.container.append(...ZikoUIElement);
10594
- return this;
10595
- }
10596
- }
10597
- const svgObject=(x, y, w, h)=>new ZikoSvgForeignObject(x, y, w, h);
10598
-
10599
- class ZikoSvgGroupe extends ZikoSvgElement{
10600
- constructor(...svgElement){
10601
- super();
10602
- this.items=[];
10603
- this.element=document?.createElementNS(
10604
- "http://www.w3.org/2000/svg",
10605
- "g",
10606
- );
10607
- this.add(...svgElement);
10608
- }
10609
- add(...svgElement){
10610
- for(let i=0;i<svgElement.length;i++){
10611
- this.element?.appendChild(svgElement[i].element);
10612
- this.items.push(svgElement[i]);
10613
- }
10614
- if(svgElement.length===1)return svgElement[0]
10615
- return svgElement;
10616
- }
10617
- remove(...svgElement){
10618
- for(let i=0;i<svgElement.length;i++){
10619
- this.element?.removeChild(svgElement[i].element);
10620
- this.items=this.items.filter(n=>n!=svgElement);
10621
- }
10622
- return this;
10623
- }
10624
- }
10625
- const svgGroupe=(...svgElement)=>new ZikoSvgGroupe(...svgElement);
10626
-
10627
- class ZikoSvgImage extends ZikoSvgElement{
10628
- constructor(src="",w="100%",h="100%",x=0,y=0){
10629
- super();
10630
- this.element=document?.createElementNS(
10631
- "http://www.w3.org/2000/svg",
10632
- "image",
10633
- );
10634
- this.setSrc(src).width(w).height(h).x(x).y(y);
10635
- }
10636
- x(x){
10637
- this.element.x.baseVal.value=x;
10638
- return this;
10639
- }
10640
- y(y){
10641
- this.element.y.baseVal.value=y;
10642
- return this;
10643
- }
10644
- width(w){
10645
- this.element?.setAttribute("width",w);
10646
- return this;
10647
- }
10648
- height(h){
10649
- this.element?.setAttribute("height",h);
10650
- return this;
10651
- }
10652
- setSrc(src=""){
10653
- this.element?.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', src);
10654
- return this;
10655
- }
10656
- }
10657
- const svgImage=(src,w,h,x,y)=>new ZikoSvgImage(src,w,h,x,y);
10658
-
10659
- class ZikoSvgLine extends ZikoSvgElement{
10660
- constructor(x1,y1,x2,y2){
10661
- super();
10662
- this.element=document?.createElementNS(
10663
- "http://www.w3.org/2000/svg",
10664
- "line",
10665
- );
10666
- this.x1(x1).y1(y1).x2(x2).y2(y2).stroke("black");
10667
- }
10668
- x1(x1){
10669
- this.element.x1.baseVal.value=x1;
10670
- return this;
10671
- }
10672
- y1(y1){
10673
- this.element.y1.baseVal.value=y1;
10674
- return this;
10675
- }
10676
- x2(x2){
10677
- this.element.x2.baseVal.value=x2;
10678
- return this;
10679
- }
10680
- y2(y2){
10681
- this.element.y2.baseVal.value=y2;
10682
- return this;
10683
- }
10684
- }
10685
- const svgLine=(x1,y1,x2,y2)=>new ZikoSvgLine(x1,y1,x2,y2);
10686
-
10687
- class ZikoSvgLink extends ZikoSvgElement{
10688
- constructor(href,...svgElement){
10689
- super();
10690
- this.items=[];
10691
- this.element=document?.createElementNS(
10692
- "http://www.w3.org/2000/svg",
10693
- "a",
10694
- );
10695
- this.element.etAttribute("href",href);
10696
- this.add(...svgElement);
10697
- }
10698
- add(...svgElement){
10699
- for(let i=0;i<svgElement.length;i++){
10700
- this.element.ppendChild(svgElement[i].element);
10701
- this.items.push(svgElement[i]);
10702
- }
10703
- if(svgElement.length===1)return svgElement[0]
10704
- return svgElement;
10705
- }
10706
- remove(...svgElement){
10707
- for(let i=0;i<svgElement.length;i++){
10708
- this.element.moveChild(svgElement[i].element);
10709
- this.items=this.items.filter(n=>n!=svgElement);
10710
- }
10711
- return this;
10712
- }
10713
- }
10714
- const svgLink=(href,...svgElement)=>new ZikoSvgLink(href,...svgElement);
10715
-
10716
- class ZikoSvgPath extends ZikoSvgElement{
10717
- constructor(){
10718
- super();
10719
- this.element=document?.createElementNS(
10720
- "http://www.w3.org/2000/svg",
10721
- "path",
10722
- );
10723
- this.path="";
10724
-
10725
- }
10726
- setPath(){
10727
- this.element.etAttribute("d",this.path);
10728
- return this;
10729
- }
10730
- clear(){
10731
- this.path="";
10732
- this.setPath();
10733
- return this;
10734
- }
10735
- moveTo(x,y){
10736
- this.path+=`M${x} ${y} `;
10737
- this.setPath();
10738
- return this;
10739
- }
10740
- lineTo(x,y){
10741
- this.path+=`L${x} ${y} `;
10742
- this.setPath();
10743
- return this;
10744
- }
10745
- hr(x){
10746
- this.path+=`H${x} `;
10747
- this.setPath();
10748
- return this;
10749
- }
10750
- vr(y){
10751
- this.path+=`V${y} `;
10752
- this.setPath();
10753
- return this;
10754
- }
10755
- bezier(x1,y1,x2,y2,x,y){
10756
- this.path+=`C ${x1} ${y1},${x2} ${y2},${x} ${y} `;
10757
- this.setPath();
10758
- return this;
10759
- }
10760
- quadratic(x1,y1,x,y){
10761
- this.path+=`Q ${x1} ${y1} ${x} ${y} `;
10762
- this.setPath();
10763
- return this;
10764
- }
10765
- close(){
10766
- this.path+="Z";
10767
- this.setPath();
10768
- return this;
10769
- }
10770
- }
10771
-
10772
- const svgPath=()=>new ZikoSvgPath();
10773
-
10774
- class ZikoSvgPolygon extends ZikoSvgElement{
10775
- constructor(X=[],Y=[]){
10776
- super();
10777
- this.X=X;
10778
- this.Y=Y;
10779
- this.element=document?.createElementNS(
10780
- "http://www.w3.org/2000/svg",
10781
- "polygon",
10782
- );
10783
- this.element?.setAttribute("points","");
10784
- this.addPoints(X,Y);
10785
- }
10786
- addPoint(x,y){
10787
- let p=this.element.parentElement.createSVGPoint();
10788
- p.x=x;
10789
- p.y=y;
10790
- this.element.points.appendItem(p);
10791
- return this;
10792
- }
10793
- addPoints(X,Y){
10794
- for(let i=0;i<X.length;i++){
10795
- let p=this.element.parentElement.createSVGPoint();
10796
- p.x=X[i];
10797
- p.y=Y[i];
10798
- this.element.oints.appendItem(p);
10799
- }
10800
- return this;
10801
- }
10802
- }
10803
- const svgPolygon=(X,Y)=>new ZikoSvgPolygon(X,Y);
10804
-
10805
- class ZikoSvgRectangle extends ZikoSvgElement{
10806
- constructor(x,y,w,h,center=true){
10807
- super();
10808
- this.element=document?.createElementNS(
10809
- "http://www.w3.org/2000/svg",
10810
- "rect",
10811
- );
10812
- this.setX(x).setY(y).width(w).height(h);
10813
- this.rx=this.x+this.w/2;
10814
- this.ty=this.y+this.h/2;
10815
- }
10816
- setX(x){
10817
- this.element.x.baseVal.value=x;
10818
- this.x=x;
10819
- return this;
10820
- }
10821
- setY(y){
10822
- this.element.y.baseVal.value=y;
10823
- this.y=y;
10824
- return this;
10825
- }
10826
- r(rx,ry){
10827
- this.rx=rx;
10828
- this.ry=ry;
10829
- this.setX(this.rx-this.w/2);
10830
- this.setY(this.ry-this.h/2);
10831
- return this;
10832
- }
10833
- width(w){
10834
- this.element.width.baseVal.value=w;
10835
- this.w=w;
10836
- return this;
10837
- }
10838
- height(h){
10839
- this.element.height.baseVal.value=h;
10840
- this.h=h;
10841
- return this;
10842
- }
10843
- }
10844
- const svgRect=(x,y,w,h,center)=>new ZikoSvgRectangle(x,y,w,h,center);
10845
-
10846
- class ZikoSvgText extends ZikoSvgElement{
10847
- constructor(text,x,y){
10848
- super();
10849
- this.element=document?.createElementNS(
10850
- "http://www.w3.org/2000/svg",
10851
- "text",
10852
- );
10853
- this.setText(text);
10854
- this.x(x).y(y);
10855
- }
10856
- x(x){
10857
- this.element?.setAttribute("x",x);
10858
- return this;
10859
- }
10860
- y(y){
10861
- this.element?.setAttribute("y",y);
10862
- return this;
10863
- }
10864
- setText(text=""){
10865
- this.element.textContent=text;
10866
- return this;
10867
- }
10868
- }
10869
- const svgText=(text,x,y)=>new ZikoSvgText(text,x,y);
10870
-
10871
- const svgGrid=(w,h,r=10,c=10)=>{
10872
- let path=svgPath().fill("none").stroke("coral").strokeWidth(0.6);
10873
- console.log({x:w/r,y:h/c});
10874
- for(let i=0;i<w;i++) path.moveTo(0,i*w/r).hr(w);
10875
- for(let j=0;j<h;j++) path.moveTo(j*h/c,0).vr(h);
10876
- return path
10877
- };
10878
-
10879
8498
  var SVG = /*#__PURE__*/Object.freeze({
10880
8499
  __proto__: null,
10881
8500
  Svg: Svg,
10882
- ZikoSvgCircle: ZikoSvgCircle,
10883
- ZikoSvgEllipse: ZikoSvgEllipse,
10884
- ZikoSvgForeignObject: ZikoSvgForeignObject,
10885
- ZikoSvgGroupe: ZikoSvgGroupe,
10886
- ZikoSvgImage: ZikoSvgImage,
10887
- ZikoSvgLine: ZikoSvgLine,
10888
- ZikoSvgLink: ZikoSvgLink,
10889
- ZikoSvgPath: ZikoSvgPath,
10890
- ZikoSvgRectangle: ZikoSvgRectangle,
10891
- ZikoSvgText: ZikoSvgText,
10892
- ZikoUISvg: ZikoUISvg,
10893
- svgCircle: svgCircle,
10894
- svgEllipse: svgEllipse,
10895
- svgGrid: svgGrid,
10896
- svgGroupe: svgGroupe,
10897
- svgImage: svgImage,
10898
- svgLine: svgLine,
10899
- svgLink: svgLink,
10900
- svgObject: svgObject,
10901
- svgPath: svgPath,
10902
- svgPolygon: svgPolygon,
10903
- svgRect: svgRect,
10904
- svgText: svgText
8501
+ ZikoUISvg: ZikoUISvg
10905
8502
  });
10906
8503
 
10907
8504
  // import { convolute } from "../../math/signal/conv.js";
10908
- class ZikoUICanvas extends ZikoUIContainerElement{
8505
+ class ZikoUICanvas extends ZikoUIElement{
10909
8506
  constructor(w,h){
10910
8507
  super("canvas","canvas");
10911
8508
  this.ctx = this.element?.getContext("2d");
@@ -11075,288 +8672,10 @@
11075
8672
 
11076
8673
  const Canvas=(w,h)=>new ZikoUICanvas(w,h);
11077
8674
 
11078
- class ZikoCanvasElement{
11079
- constructor(x,y){
11080
- this.parent=null;
11081
- this.position={
11082
- x,
11083
- y
11084
- };
11085
- this.cache={
11086
- interact:null/*avoid redraw*/,
11087
- config:{
11088
- draggable:false,
11089
- selected:false,
11090
- highlighted:false,
11091
- rendered:false
11092
- },
11093
- style:{
11094
- normal:{
11095
- strokeEnabled:true,
11096
- fillEnabled:false,
11097
- strokeColor:"#111111",
11098
- fillColor:"#777777",
11099
- },
11100
- highlighted:{
11101
- strokeEnabled:true,
11102
- fillEnabled:false,
11103
- strokeColor:null,
11104
- fillColor:null,
11105
- }
11106
- },
11107
- };
11108
- this.history={
11109
- position:[],
11110
- styles:[]
11111
- };
11112
- this.render();
11113
- }
11114
- get px(){
11115
- //_x=====>px
11116
- return (this.position.x??0)+(this.parent?.position?.x??0);
11117
- }
11118
- get py(){
11119
- //_y=====>py
11120
- return (this.position.y??0)+(this.parent?.position?.y??0);
11121
- }
11122
- isIntersectedWith(){
11123
-
11124
- }
11125
- isInStroke(x,y){
11126
- let is;
11127
- if(this.parent){
11128
- this.parent.ctx.setTransform(1,0,0,1,0,0);
11129
- is=this.parent.ctx.isPointInStroke(this.path,x,y);
11130
- this.parent.applyTransformMatrix();
11131
- }
11132
- return is;
11133
- }
11134
- isInPath(x,y){
11135
- let is;
11136
- if(this.parent){
11137
- this.parent.ctx.setTransform(1,0,0,1,0,0);
11138
- is=this.parent.ctx.isPointInPath(this.path,x,y);
11139
- this.parent.applyTransformMatrix();
11140
- }
11141
- return is;
11142
- }
11143
- posX(x){
11144
- this.position.x=x;
11145
- if(this.parent)this.parent.draw();
11146
- return this;
11147
- }
11148
- posY(y){
11149
- this.position.y=y;
11150
- if(this.parent)this.parent.draw();
11151
- return this;
11152
- }
11153
- color({stroke=this.cache.style.normal.strokeColor,fill=this.cache.style.normal.fillColor}={stroke,fill}){
11154
- this.cache.style.normal.strokeColor=stroke;
11155
- this.cache.style.normal.fillColor=fill;
11156
- if(this.parent)this.parent.draw();
11157
- return this;
11158
- }
11159
- translate(dx=0,dy=0){
11160
- this.position.x+=dx;
11161
- this.position.y+=dy;
11162
- if(this.parent)this.parent.draw();
11163
- return;
11164
- }
11165
- applyNormalStyle(ctx){
11166
- ctx.strokeStyle=this.cache.style.normal.strokeColor;
11167
- ctx.fillStyle=this.cache.style.normal.fillColor;
11168
- return this;
11169
- }
11170
- applyHighlightedStyle(ctx){
11171
- ctx.strokeStyle=this.cache.style.highlighted.strokeColor;
11172
- ctx.fillStyle=this.cache.style.highlighted.fillColor;
11173
- return this;
11174
- }
11175
- stroke(color=this.cache.style.normal.strokeColor,enabled=true){
11176
- this.cache.style.normal.strokeEnabled=enabled;
11177
- this.cache.style.normal.strokeColor=color;
11178
- if(this.parent)this.parent.draw();
11179
- return this
11180
- }
11181
- fill(color=this.cache.style.normal.fillColor,enabled=true){
11182
- this.cache.style.normal.fillEnabled=enabled;
11183
- this.cache.style.normal.filleColor=color;
11184
- if(this.parent)this.parent.draw();
11185
- return this;
11186
- }
11187
- render(render=true){
11188
- this.cache.config.rendered=render;
11189
- return this;
11190
- }
11191
- }
11192
-
11193
- class CanvasArc extends ZikoCanvasElement{
11194
- constructor(x,y,r,angle){
11195
- super(x,y);
11196
- this.r=r;
11197
- this.angle=angle;
11198
- this.path=null;
11199
- }
11200
- draw(ctx){
11201
- if(this.cache.config.rendered){
11202
- ctx.save();
11203
- this.applyNormalStyle(ctx);
11204
- ctx.beginPath();
11205
- this.path=new Path2D();
11206
- this.path.arc(this.px, this.py, this.r, 0, this.angle);
11207
- const{strokeEnabled,fillEnabled}=this.cache.style.normal;
11208
- if(strokeEnabled)ctx.stroke(this.path);
11209
- if(fillEnabled)ctx.fill(this.path);
11210
- ctx.closePath();
11211
- ctx.restore();
11212
- }
11213
- return this;
11214
- }
11215
- radius(r){
11216
- this.r=r;
11217
- if(this.parent)this.parent.draw();
11218
- return this;
11219
- }
11220
- // distanceFromCenter(x,y){
11221
- // return Math.sqrt(
11222
- // (this._x-x)**2-(this._y-y)**2
11223
- // )
11224
- // }
11225
- // isIn(x,y,strict=false){
11226
- // return strict?this.distanceFromCenter(x,y)<this.r:this.distanceFromCenter(x,y)<=this.r;
11227
- // }
11228
- // isInEdges(x,y){
11229
- // return this.distanceFromCenter(x,y)===this.r;
11230
- // }
11231
- }
11232
- const canvasArc=(x,y,r,phi)=>new CanvasArc(x,y,r,phi);
11233
- const canvasCircle=(x,y,r)=>new CanvasArc(x,y,r,2*Math.PI);
11234
-
11235
- class CanvasPoints extends ZikoCanvasElement{
11236
- constructor(ptsX,ptsY){
11237
- super();
11238
- this.pointsMatrix=null;
11239
- this.path=new Path2D();
11240
- this.fromXY(ptsX,ptsY);
11241
- }
11242
- get points(){
11243
- return this.pointsMatrix.T.arr;
11244
- }
11245
- draw(ctx){
11246
- if(this.cache.config.rendered){
11247
- ctx.save();
11248
- this.applyNormalStyle(ctx);
11249
- ctx.beginPath();
11250
- this.path.moveTo(this.points[1][0]+this._x,this.points[1][1]+this._y);
11251
- for(let i=1;i<this.points.length;i++){
11252
- this.path.lineTo(this.points[i][0]+this._x,this.points[i][1]+this._y);
11253
- }
11254
- ctx.stroke(this.path);
11255
- ctx.restore();
11256
- }
11257
- return this;
11258
- }
11259
- fromXY(X,Y){
11260
- this.pointsMatrix=matrix([X,Y]);
11261
- return this;
11262
- }
11263
- push(ptsX,ptsY){
11264
- this.pointsMatrix.hstack(matrix([ptsX,ptsY]));
11265
- if(this.parent)this.parent.draw();
11266
- return this;
11267
- }
11268
- isIn(x,y){
11269
- let is;
11270
- if(this.parent){
11271
- this.parent.ctx.setTransform(1,0,0,1,0,0);
11272
- is=this.parent.ctx.isPointInPath(this.path,x,y);
11273
- this.parent.applyTransformMatrix();
11274
- }
11275
- return is;
11276
- }
11277
- }
11278
-
11279
- const canvasPoints=(ptsX=[],ptsY=[])=>new CanvasPoints(ptsX,ptsY);
11280
-
11281
- class CanvasLine extends ZikoCanvasElement{
11282
- constructor(x0,y0,x1,y1){
11283
- super();
11284
- this.x0=x0;
11285
- this.x1=x1;
11286
- this.y0=y0;
11287
- this.y1=y1;
11288
- delete this.fill;
11289
- }
11290
- draw(ctx){
11291
- if(this.cache.config.rendered){
11292
- ctx.save();
11293
- this.applyNormalStyle(ctx);
11294
- ctx.beginPath();
11295
- ctx.moveTo(this.x0+this._x,this.y0+this._y_);
11296
- ctx.lineTo(this.x1+this._x,this.y1+this._y);
11297
- ctx.stroke();
11298
- if(this.cache.style.normal.strokeEnabled)ctx.stroke();
11299
- ctx.restore();
11300
- }
11301
- return this;
11302
- }
11303
- }
11304
- const canvasLine=(x0,y0,x1,y1)=>new CanvasLine(x0,y0,x1,y1);
11305
-
11306
- class CanvasRect extends ZikoCanvasElement{
11307
- constructor(x,y,w,h){
11308
- super(x,y);
11309
- this.w=w;
11310
- this.h=h;
11311
- this.path=new Path2D();
11312
- }
11313
- draw(ctx){
11314
- if(this.cache.config.rendered){
11315
- ctx.save();
11316
- this.applyNormalStyle(ctx);
11317
- ctx.beginPath();
11318
- this.path.rect(this.px, this.py,this.w,this.h);
11319
- const{strokeEnabled,fillEnabled}=this.cache.style.normal;
11320
- if(strokeEnabled)ctx.stroke(this.path);
11321
- if(fillEnabled)ctx.fill(this.path);
11322
- ctx.closePath();
11323
- ctx.restore();
11324
- }
11325
- return this;
11326
- }
11327
- width(w){
11328
- this.w=w;
11329
- if(this.parent)this.parent.draw();
11330
- return this;
11331
- }
11332
- height(h){
11333
- this.h=h;
11334
- if(this.parent)this.parent.draw();
11335
- return this;
11336
- }
11337
- // distanceFromCenter(x,y){
11338
- // return Math.sqrt(
11339
- // (this.position.x-x)**2-(this.position.y-y)**2
11340
- // )
11341
- // }
11342
- // isIn(x,y,strict=false){
11343
- // return strict?this.distanceFromCenter(x,y)<this.r:this.distanceFromCenter(x,y)<=this.r;
11344
- // }
11345
- // isInEdges(x,y){
11346
- // return this.distanceFromCenter(x,y)===this.r;
11347
- // }
11348
- }
11349
- const canvasRect=(x,y,w,h)=>new CanvasRect(x,y,w,h);
11350
-
11351
8675
  var CANVAS = /*#__PURE__*/Object.freeze({
11352
8676
  __proto__: null,
11353
8677
  Canvas: Canvas,
11354
- ZikoUICanvas: ZikoUICanvas,
11355
- canvasArc: canvasArc,
11356
- canvasCircle: canvasCircle,
11357
- canvasLine: canvasLine,
11358
- canvasPoints: canvasPoints,
11359
- canvasRect: canvasRect
8678
+ ZikoUICanvas: ZikoUICanvas
11360
8679
  });
11361
8680
 
11362
8681
  const Graphics = {
@@ -11661,7 +8980,7 @@
11661
8980
  constructor({head, wrapper, target, routes}){
11662
8981
  super({head, wrapper, target});
11663
8982
  this.routes=new Map([
11664
- ["404",text$1("Error 404")],
8983
+ ["404",text("Error 404")],
11665
8984
  ...Object.entries(routes)
11666
8985
  ]);
11667
8986
  this.clear();
@@ -11741,7 +9060,7 @@
11741
9060
  }
11742
9061
 
11743
9062
  const __UI__={};
11744
- const __HYDRATION_MAP__ = [];
9063
+ const __HYDRATION_MAP__ = new Map();
11745
9064
  const __Config__={
11746
9065
  default:{
11747
9066
  target:null,
@@ -11755,7 +9074,9 @@
11755
9074
  const values=Object.values(pairs);
11756
9075
  for(let i=0;i<keys.length;i++)this.default[keys[i]]=values[i];
11757
9076
  },
11758
- init:()=>document.documentElement.setAttribute("data-engine","zikojs")
9077
+ init:()=>document.documentElement.setAttribute("data-engine","zikojs"),
9078
+ renderingMode :"spa",
9079
+ isSSC : false,
11759
9080
  };
11760
9081
 
11761
9082
  var Global = /*#__PURE__*/Object.freeze({
@@ -11896,24 +9217,18 @@
11896
9217
  Data.RemoveAll();
11897
9218
  }
11898
9219
 
11899
- exports.Accordion = Accordion;
11900
9220
  exports.App = App$1;
11901
9221
  exports.Article = Article;
11902
9222
  exports.Aside = Aside;
11903
9223
  exports.Base = Base;
11904
- exports.Breadcrumbs = Breadcrumbs;
11905
9224
  exports.Canvas = Canvas;
11906
- exports.Carousel = Carousel;
11907
- exports.CodeCell = CodeCell;
11908
- exports.CodeNote = CodeNote;
11909
- exports.Collapsible = Collapsible;
11910
9225
  exports.Combinaison = Combinaison;
11911
9226
  exports.Complex = Complex;
11912
9227
  exports.E = E;
11913
9228
  exports.EPSILON = EPSILON;
11914
9229
  exports.Ease = Ease;
11915
9230
  exports.FileBasedRouting = FileBasedRouting;
11916
- exports.Flex = Flex$1;
9231
+ exports.Flex = Flex;
11917
9232
  exports.Footer = Footer;
11918
9233
  exports.Form = Form;
11919
9234
  exports.Grid = Grid$1;
@@ -11923,7 +9238,6 @@
11923
9238
  exports.Logic = Logic$1;
11924
9239
  exports.Main = Main;
11925
9240
  exports.Matrix = Matrix;
11926
- exports.Modal = Modal;
11927
9241
  exports.Nav = Nav;
11928
9242
  exports.PI = PI$1;
11929
9243
  exports.Permutation = Permutation;
@@ -11931,13 +9245,10 @@
11931
9245
  exports.SPA = SPA;
11932
9246
  exports.SVGWrapper = SVGWrapper;
11933
9247
  exports.Section = Section;
11934
- exports.Slider = Slider;
11935
- exports.Splitter = Splitter;
11936
9248
  exports.Str = Str;
11937
9249
  exports.Suspense = Suspense;
11938
9250
  exports.Svg = Svg;
11939
9251
  exports.Table = Table$1;
11940
- exports.Tabs = Tabs;
11941
9252
  exports.Utils = Utils$1;
11942
9253
  exports.ZikoApp = ZikoApp;
11943
9254
  exports.ZikoCustomEvent = ZikoCustomEvent;
@@ -11955,40 +9266,24 @@
11955
9266
  exports.ZikoJsonStyleSheet = ZikoJsonStyleSheet;
11956
9267
  exports.ZikoMutationObserver = ZikoMutationObserver;
11957
9268
  exports.ZikoSPA = ZikoSPA;
11958
- exports.ZikoSvgCircle = ZikoSvgCircle;
11959
- exports.ZikoSvgEllipse = ZikoSvgEllipse;
11960
- exports.ZikoSvgForeignObject = ZikoSvgForeignObject;
11961
- exports.ZikoSvgGroupe = ZikoSvgGroupe;
11962
- exports.ZikoSvgImage = ZikoSvgImage;
11963
- exports.ZikoSvgLine = ZikoSvgLine;
11964
- exports.ZikoSvgLink = ZikoSvgLink;
11965
- exports.ZikoSvgPath = ZikoSvgPath;
11966
- exports.ZikoSvgRectangle = ZikoSvgRectangle;
11967
- exports.ZikoSvgText = ZikoSvgText;
11968
9269
  exports.ZikoUIAbbrText = ZikoUIAbbrText;
11969
- exports.ZikoUIAccordion = ZikoUIAccordion;
11970
9270
  exports.ZikoUIArticle = ZikoUIArticle;
11971
9271
  exports.ZikoUIAside = ZikoUIAside;
11972
9272
  exports.ZikoUIAudio = ZikoUIAudio;
11973
9273
  exports.ZikoUIBlockQuote = ZikoUIBlockQuote;
11974
9274
  exports.ZikoUIBr = ZikoUIBr;
11975
- exports.ZikoUIBreadcrumbs = ZikoUIBreadcrumbs;
11976
9275
  exports.ZikoUICanvas = ZikoUICanvas;
11977
- exports.ZikoUICodeNote = ZikoUICodeNote;
11978
9276
  exports.ZikoUICodeText = ZikoUICodeText;
11979
- exports.ZikoUIContainerElement = ZikoUIContainerElement;
11980
9277
  exports.ZikoUIDefintion = ZikoUIDefintion;
11981
9278
  exports.ZikoUIElement = ZikoUIElement;
11982
9279
  exports.ZikoUIFigure = ZikoUIFigure;
11983
- exports.ZikoUIFlex = ZikoUIFlex$1;
9280
+ exports.ZikoUIFlex = ZikoUIFlex;
11984
9281
  exports.ZikoUIFooter = ZikoUIFooter;
11985
9282
  exports.ZikoUIForm = ZikoUIForm;
11986
9283
  exports.ZikoUIGrid = ZikoUIGrid;
11987
9284
  exports.ZikoUIHTMLWrapper = ZikoUIHTMLWrapper;
11988
9285
  exports.ZikoUIHeader = ZikoUIHeader;
11989
9286
  exports.ZikoUIHeading = ZikoUIHeading;
11990
- exports.ZikoUIHorizontalSlider = ZikoUIHorizontalSlider;
11991
- exports.ZikoUIHorizontalSplitter = ZikoUIHorizontalSplitter;
11992
9287
  exports.ZikoUIHr = ZikoUIHr;
11993
9288
  exports.ZikoUIHtmlTag = ZikoUIHtmlTag;
11994
9289
  exports.ZikoUIImage = ZikoUIImage;
@@ -12010,8 +9305,6 @@
12010
9305
  exports.ZikoUILabel = ZikoUILabel;
12011
9306
  exports.ZikoUILink = ZikoUILink;
12012
9307
  exports.ZikoUIMain = ZikoUIMain;
12013
- exports.ZikoUIMenu3d = ZikoUIMenu3d;
12014
- exports.ZikoUIModal = ZikoUIModal;
12015
9308
  exports.ZikoUINav = ZikoUINav;
12016
9309
  exports.ZikoUIParagraphe = ZikoUIParagraphe;
12017
9310
  exports.ZikoUIQuote = ZikoUIQuote;
@@ -12024,8 +9317,6 @@
12024
9317
  exports.ZikoUISvg = ZikoUISvg;
12025
9318
  exports.ZikoUIText = ZikoUIText;
12026
9319
  exports.ZikoUITextArea = ZikoUITextArea;
12027
- exports.ZikoUIVerticalSlider = ZikoUIVerticalSlider;
12028
- exports.ZikoUIVerticalSplitter = ZikoUIVerticalSplitter;
12029
9320
  exports.ZikoUIVideo = ZikoUIVideo;
12030
9321
  exports.ZikoUIXMLWrapper = ZikoUIXMLWrapper;
12031
9322
  exports.ZikoUseRoot = ZikoUseRoot;
@@ -12040,7 +9331,6 @@
12040
9331
  exports.acosh = acosh;
12041
9332
  exports.acot = acot;
12042
9333
  exports.add = add;
12043
- exports.adoc2html = adoc2html;
12044
9334
  exports.arange = arange;
12045
9335
  exports.arr2str = arr2str;
12046
9336
  exports.asin = asin;
@@ -12055,11 +9345,6 @@
12055
9345
  exports.br = br;
12056
9346
  exports.brs = brs;
12057
9347
  exports.btn = btn;
12058
- exports.canvasArc = canvasArc;
12059
- exports.canvasCircle = canvasCircle;
12060
- exports.canvasLine = canvasLine;
12061
- exports.canvasPoints = canvasPoints;
12062
- exports.canvasRect = canvasRect;
12063
9348
  exports.cartesianProduct = cartesianProduct;
12064
9349
  exports.ceil = ceil;
12065
9350
  exports.checkbox = checkbox;
@@ -12080,7 +9365,6 @@
12080
9365
  exports.csv2matrix = csv2matrix;
12081
9366
  exports.csv2object = csv2object;
12082
9367
  exports.csv2sql = csv2sql;
12083
- exports.dangerAlert = dangerAlert;
12084
9368
  exports.datalist = datalist;
12085
9369
  exports.default = Ziko;
12086
9370
  exports.defineParamsGetter = defineParamsGetter;
@@ -12100,8 +9384,6 @@
12100
9384
  exports.h4 = h4;
12101
9385
  exports.h5 = h5;
12102
9386
  exports.h6 = h6;
12103
- exports.hSlider = hSlider;
12104
- exports.hSplitter = hSplitter;
12105
9387
  exports.hTags = hTags;
12106
9388
  exports.hr = hr;
12107
9389
  exports.hrs = hrs;
@@ -12109,7 +9391,6 @@
12109
9391
  exports.hypot = hypot;
12110
9392
  exports.image = image;
12111
9393
  exports.inRange = inRange;
12112
- exports.infoAlert = infoAlert;
12113
9394
  exports.input = input;
12114
9395
  exports.inputCamera = inputCamera;
12115
9396
  exports.inputColor = inputColor;
@@ -12139,13 +9420,11 @@
12139
9420
  exports.luDecomposition = luDecomposition;
12140
9421
  exports.map = map;
12141
9422
  exports.mapfun = mapfun$1;
12142
- exports.markdown2html = markdown2html;
12143
9423
  exports.matrix = matrix;
12144
9424
  exports.matrix2 = matrix2;
12145
9425
  exports.matrix3 = matrix3;
12146
9426
  exports.matrix4 = matrix4;
12147
9427
  exports.max = max;
12148
- exports.menu3d = menu3d;
12149
9428
  exports.min = min;
12150
9429
  exports.modulo = modulo;
12151
9430
  exports.mul = mul;
@@ -12184,34 +9463,20 @@
12184
9463
  exports.sub = sub;
12185
9464
  exports.subSet = subSet;
12186
9465
  exports.subText = subText;
12187
- exports.successAlert = successAlert;
12188
9466
  exports.sum = sum;
12189
9467
  exports.supText = supText;
12190
9468
  exports.svg2ascii = svg2ascii;
12191
9469
  exports.svg2img = svg2img;
12192
9470
  exports.svg2imgUrl = svg2imgUrl;
12193
9471
  exports.svg2str = svg2str;
12194
- exports.svgCircle = svgCircle;
12195
- exports.svgEllipse = svgEllipse;
12196
- exports.svgGrid = svgGrid;
12197
- exports.svgGroupe = svgGroupe;
12198
- exports.svgImage = svgImage;
12199
- exports.svgLine = svgLine;
12200
- exports.svgLink = svgLink;
12201
- exports.svgObject = svgObject;
12202
- exports.svgPath = svgPath;
12203
- exports.svgPolygon = svgPolygon;
12204
- exports.svgRect = svgRect;
12205
- exports.svgText = svgText;
12206
9472
  exports.tan = tan;
12207
9473
  exports.tanh = tanh;
12208
- exports.text = text$1;
9474
+ exports.text = text;
12209
9475
  exports.textarea = textarea;
12210
9476
  exports.timeTaken = timeTaken;
12211
9477
  exports.time_memory_Taken = time_memory_Taken;
12212
9478
  exports.ul = ul;
12213
9479
  exports.useAnimation = useAnimation;
12214
- exports.useBattery = useBattery;
12215
9480
  exports.useChannel = useChannel$1;
12216
9481
  exports.useClickEvent = useClickEvent;
12217
9482
  exports.useClipboardEvent = useClipboardEvent;
@@ -12223,7 +9488,6 @@
12223
9488
  exports.useFavIcon = useFavIcon$1;
12224
9489
  exports.useFocusEvent = useFocusEvent;
12225
9490
  exports.useFps = useFps;
12226
- exports.useGeolocation = useGeolocation;
12227
9491
  exports.useHashEvent = useHashEvent;
12228
9492
  exports.useHead = useHead$1;
12229
9493
  exports.useInputEvent = useInputEvent;
@@ -12245,13 +9509,10 @@
12245
9509
  exports.useTitle = useTitle$1;
12246
9510
  exports.useType = useType;
12247
9511
  exports.useWheelEvent = useWheelEvent;
12248
- exports.vSlider = vSlider;
12249
- exports.vSplitter = vSplitter;
12250
9512
  exports.video = video;
12251
9513
  exports.wait = wait;
12252
9514
  exports.waitForUIElm = waitForUIElm;
12253
9515
  exports.waitForUIElmSync = waitForUIElmSync;
12254
- exports.warningAlert = warningAlert;
12255
9516
  exports.watch = watch;
12256
9517
  exports.watchAttr = watchAttr;
12257
9518
  exports.watchChildren = watchChildren;