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.
- package/dist/ziko.cjs +78 -2817
- package/dist/ziko.js +78 -2817
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +76 -2755
- package/package.json +1 -1
- package/src/app/globals.js +4 -2
- package/src/data/converter/index.js +2 -6
- package/src/graphics/canvas/index.js +176 -2
- package/src/graphics/canvas/utils/floodFill.js +0 -1
- package/src/graphics/svg/index.js +69 -2
- package/src/reactivity/hooks/index.js +1 -1
- package/src/ui/elements/{primitives/ZikoUIElement.js → ZikoUIElement.js} +8 -9
- package/src/ui/elements/derived ( To Be Moved)/index.js +12 -0
- package/src/ui/elements/{derived/flex → flex}/index.js +2 -2
- package/src/ui/elements/{derived/grid → grid}/index.js +2 -2
- package/src/ui/elements/{primitives/index.js → index.js} +3 -1
- package/src/ui/elements/{primitives/io → io}/Form/index.js +1 -1
- package/src/ui/elements/{primitives/io → io}/Inputs/__helpers__.js +1 -1
- package/src/ui/elements/{primitives/io → io}/Inputs/input/index.js +1 -1
- package/src/ui/elements/{primitives/list → list}/index.js +2 -3
- package/src/ui/elements/{primitives/misc → misc}/index.js +2 -3
- package/src/ui/elements/{primitives/semantic → semantic}/index.js +8 -8
- package/src/ui/elements/{primitives/table → table}/table.js +1 -1
- package/src/ui/elements/{primitives/text → text}/__ZikoUIText__.js +3 -4
- package/src/ui/index.js +21 -21
- package/src/ui/utils/index.js +1 -1
- package/src/data/parser/markdown.js +0 -0
- package/src/graphics/canvas/canvas.js +0 -176
- package/src/graphics/svg/svg.js +0 -69
- package/src/reactivity/hooks/Interactions/useSerial.js +0 -0
- package/src/types.js +0 -73
- package/src/ui/elements/derived/index.js +0 -12
- package/src/ui/elements/primitives/ZikoUIContainerElement.js +0 -123
- /package/src/{global → _global (To Be Replaced )}/_themes/dark.js +0 -0
- /package/src/{global → _global (To Be Replaced )}/_themes/index.js +0 -0
- /package/src/{global → _global (To Be Replaced )}/_themes/light.js +0 -0
- /package/src/{global → _global (To Be Replaced )}/app/index.js +0 -0
- /package/src/{global → _global (To Be Replaced )}/component/index.js +0 -0
- /package/src/{global → _global (To Be Replaced )}/globals/index.js +0 -0
- /package/src/{global → _global (To Be Replaced )}/index.js +0 -0
- /package/src/{global → _global (To Be Replaced )}/params/index.js +0 -0
- /package/src/{global → _global (To Be Replaced )}/router/index.js +0 -0
- /package/src/{global → _global (To Be Replaced )}/seo/index.js +0 -0
- /package/src/{global → _global (To Be Replaced )}/style/index.js +0 -0
- /package/src/data/converter/{adoc.js → __(To Be Moved)adoc.js} +0 -0
- /package/src/data/converter/{markdown.js → __(To Be Moved)markdown.js} +0 -0
- /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/arc.js +0 -0
- /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/image.js +0 -0
- /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/line.js +0 -0
- /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/path.js +0 -0
- /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/points.js +0 -0
- /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/polygon.js +0 -0
- /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/polyline.js +0 -0
- /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/rect.js +0 -0
- /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Basic/text.js +0 -0
- /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Chart/histogram.js +0 -0
- /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Chart/plot.js +0 -0
- /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Chart/scatter.js +0 -0
- /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Chart/stem.js +0 -0
- /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/Element.js +0 -0
- /package/src/graphics/canvas/{elements → elements ( To Be Moved )}/index.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/circle.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/ellipse.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/foreign-object.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/groupe.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/image.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/index.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/line.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/link.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/path.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/polygon.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/polyline.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/rect.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Basic/text.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Derived/grid.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/Derived/index.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/index.js +0 -0
- /package/src/graphics/svg/{Elements → Elements ( To Be Moved )}/ziko-svg-element.js +0 -0
- /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/index.js +0 -0
- /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/useBattery.js +0 -0
- /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/useCamera.js +0 -0
- /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/useGeolocation.js +0 -0
- /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/useMicro.js +0 -0
- /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/useOrientation.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/accordion/accordion.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/accordion/collapsible.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/accordion/index.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/alert/alert.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/alert/index.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/alert/palette.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/carousel/index.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/code-note/SubElements.js.txt +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/code-note/code-cell.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/code-note/code-note.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/code-note/index.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/code-note/sub-elements.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/menu/index.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/menu/menu3d.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/modal/index.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/pagination/breadcrumbs.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/pagination/index.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/slider/__ZikoUISlider__.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/slider/hSlider.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/slider/index.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/slider/vSlider.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/splitter/__ZikoUISplitter__.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/splitter/hsplitter.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/splitter/index.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/splitter/vsplitter.js +0 -0
- /package/src/ui/elements/{derived → derived ( To Be Moved)}/tabs/index.js +0 -0
- /package/src/ui/elements/{primitives/embaded → embaded}/html.js +0 -0
- /package/src/ui/elements/{primitives/embaded → embaded}/index.js +0 -0
- /package/src/ui/elements/{primitives/embaded → embaded}/pdf.js +0 -0
- /package/src/ui/elements/{primitives/embaded → embaded}/youtube.js +0 -0
- /package/src/ui/elements/{primitives/hydrate.js → hydrate.js} +0 -0
- /package/src/ui/elements/{primitives/io → io}/Form/index.js.txt +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/index.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-camera/index.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-checkbox/index.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-color/index.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-date-time/index.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-date-time/input-date-time.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-date-time/input-date.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-date-time/input-time.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-email-password/index.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-email-password/input-email.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-email-password/input-password.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-file/index.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-file/input-file.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-file/input-image.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-number/index.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-radio/index.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-search/index.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Inputs/input-slider/index.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Select/index.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/Textarea/index.js +0 -0
- /package/src/ui/elements/{primitives/io → io}/index.js +0 -0
- /package/src/ui/elements/{primitives/list → list}/elements.js +0 -0
- /package/src/ui/elements/{primitives/media → media}/Audio/index.js +0 -0
- /package/src/ui/elements/{primitives/media → media}/Image/figure.js +0 -0
- /package/src/ui/elements/{primitives/media → media}/Image/image.js +0 -0
- /package/src/ui/elements/{primitives/media → media}/Image/index.js +0 -0
- /package/src/ui/elements/{primitives/media → media}/Video/index.js +0 -0
- /package/src/ui/elements/{primitives/media → media}/__ZikoUIDynamicMediaELement__.js +0 -0
- /package/src/ui/elements/{primitives/media → media}/index.js +0 -0
- /package/src/ui/elements/{primitives/misc → misc}/hyperscript.js +0 -0
- /package/src/ui/elements/{primitives/misc → misc}/suspense.js +0 -0
- /package/src/ui/elements/{primitives/misc → misc}/xml-wrapper.js +0 -0
- /package/src/ui/elements/{primitives/table → table}/elements.js +0 -0
- /package/src/ui/elements/{primitives/table → table}/index.js +0 -0
- /package/src/ui/elements/{primitives/table → table}/utils.js +0 -0
- /package/src/ui/elements/{primitives/text → text}/heading.js +0 -0
- /package/src/ui/elements/{primitives/text → text}/index.js +0 -0
- /package/src/ui/elements/{primitives/text → text}/p.js +0 -0
- /package/src/ui/elements/{primitives/text → text}/pre.js +0 -0
- /package/src/ui/elements/{primitives/text → text}/text.js +0 -0
package/dist/ziko.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date :
|
|
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
|
|
@@ -1121,229 +1121,6 @@ var Api = /*#__PURE__*/Object.freeze({
|
|
|
1121
1121
|
preload: preload
|
|
1122
1122
|
});
|
|
1123
1123
|
|
|
1124
|
-
const parseInlineElements$1 = text => {
|
|
1125
|
-
return text
|
|
1126
|
-
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
|
|
1127
|
-
.replace(/\*(.*?)\*/g, '<em>$1</em>')
|
|
1128
|
-
.replace(/\[(.*?)\]\((.*?)\)/g, '<a href="$2">$1</a>')
|
|
1129
|
-
.replace(/!\[(.*?)\]\((.*?)\)/g, '<img src="$2" alt="$1">')
|
|
1130
|
-
.replace(/`([^`]+)`/g, '<code>$1</code>'); // Inline Code
|
|
1131
|
-
};
|
|
1132
|
-
|
|
1133
|
-
const parseTable$1 = line => {
|
|
1134
|
-
const cells = line.split('|').map(cell => cell.trim()).filter(cell => cell !== '');
|
|
1135
|
-
const tableRow = cells.map(cell => `<td>${parseInlineElements$1(cell)}</td>`).join('');
|
|
1136
|
-
return `<tr>${tableRow}</tr>\n`;
|
|
1137
|
-
};
|
|
1138
|
-
|
|
1139
|
-
const parseCodeBlock$1 = (lines, language) => {
|
|
1140
|
-
const codeContent = lines.join('\n'); // No need to exclude the triple backticks
|
|
1141
|
-
const highlightedCode = language ? `<pre><code data-language="${language}">${codeContent}</code></pre>` : `<pre><code>${codeContent}</code></pre>`;
|
|
1142
|
-
return `${highlightedCode}\n`;
|
|
1143
|
-
};
|
|
1144
|
-
|
|
1145
|
-
const parseList$1 = line => {
|
|
1146
|
-
const DIGIT_FOLLOWED_BY_A_DOT_AND_SPACE = /^\d+\.\s/;
|
|
1147
|
-
const match = line.match(DIGIT_FOLLOWED_BY_A_DOT_AND_SPACE);
|
|
1148
|
-
if (match) {
|
|
1149
|
-
let start = +match[1];
|
|
1150
|
-
return `<ol${start===1?"":` start="${start}"`}>${parseInlineElements$1(line.slice(match[0].length))}</ol>\n`;
|
|
1151
|
-
}
|
|
1152
|
-
return `<ul>${parseInlineElements$1(line)}</ul>\n`;
|
|
1153
|
-
};
|
|
1154
|
-
|
|
1155
|
-
const parseHorizontalRule$1 = () => {
|
|
1156
|
-
return '<hr>\n';
|
|
1157
|
-
};
|
|
1158
|
-
|
|
1159
|
-
const markdown2html = markdownText => {
|
|
1160
|
-
const lines = markdownText.split('\n');
|
|
1161
|
-
let htmlOutput = '';
|
|
1162
|
-
let inTable = false;
|
|
1163
|
-
let inCodeBlock = false;
|
|
1164
|
-
let codeBlockLines = [];
|
|
1165
|
-
let codeBlockLanguage = '';
|
|
1166
|
-
for (let i = 0; i < lines.length; i++) {
|
|
1167
|
-
let line = lines[i];
|
|
1168
|
-
// Table
|
|
1169
|
-
if (line.startsWith('|')) {
|
|
1170
|
-
if (!inTable) {
|
|
1171
|
-
inTable = true;
|
|
1172
|
-
htmlOutput += '<table>\n';
|
|
1173
|
-
}
|
|
1174
|
-
htmlOutput += parseTable$1(line);
|
|
1175
|
-
continue;
|
|
1176
|
-
} else if (inTable) {
|
|
1177
|
-
inTable = false;
|
|
1178
|
-
htmlOutput += '</table>\n';
|
|
1179
|
-
}
|
|
1180
|
-
// Code block
|
|
1181
|
-
if (line.startsWith('```')) {
|
|
1182
|
-
if (!inCodeBlock) {
|
|
1183
|
-
inCodeBlock = true;
|
|
1184
|
-
codeBlockLines = [];
|
|
1185
|
-
codeBlockLanguage = line.slice(3).trim();
|
|
1186
|
-
} else {
|
|
1187
|
-
inCodeBlock = false;
|
|
1188
|
-
htmlOutput += parseCodeBlock$1(codeBlockLines, codeBlockLanguage);
|
|
1189
|
-
}
|
|
1190
|
-
continue;
|
|
1191
|
-
} else if (inCodeBlock) {
|
|
1192
|
-
codeBlockLines.push(line);
|
|
1193
|
-
continue;
|
|
1194
|
-
}
|
|
1195
|
-
// Headings
|
|
1196
|
-
if (line.startsWith('# ')) {
|
|
1197
|
-
const headingLevel = line.indexOf(' ');
|
|
1198
|
-
const headingText = line.slice(headingLevel + 1);
|
|
1199
|
-
htmlOutput += `<h${headingLevel}>${parseInlineElements$1(headingText)}</h${headingLevel}>\n`;
|
|
1200
|
-
continue;
|
|
1201
|
-
}
|
|
1202
|
-
// Lists
|
|
1203
|
-
if (line.startsWith('- ') || line.startsWith('* ') || line.match(/^\d+\.\s/)) {
|
|
1204
|
-
htmlOutput += parseList$1(line);
|
|
1205
|
-
continue;
|
|
1206
|
-
}
|
|
1207
|
-
// Horizontal Rule
|
|
1208
|
-
if (line.trim() === '---') {
|
|
1209
|
-
htmlOutput += parseHorizontalRule$1();
|
|
1210
|
-
continue;
|
|
1211
|
-
}
|
|
1212
|
-
// Other paragraphs
|
|
1213
|
-
htmlOutput += `<p>${parseInlineElements$1(line)}</p>\n`;
|
|
1214
|
-
}
|
|
1215
|
-
return htmlOutput;
|
|
1216
|
-
};
|
|
1217
|
-
|
|
1218
|
-
const parseInlineElements = text => {
|
|
1219
|
-
return text
|
|
1220
|
-
.replace(/\*(.*?)\*/g, '_$1_') // Emphasis
|
|
1221
|
-
.replace(/\*\*(.*?)\*\*/g, '*$1*') // Strong
|
|
1222
|
-
.replace(/\[(.*?)\]\((.*?)\)/g, 'link:$2[$1]') // Links
|
|
1223
|
-
.replace(/!\[(.*?)\]\((.*?)\)/g, 'image::$2[$1]') // Images
|
|
1224
|
-
.replace(/`([^`]+)`/g, '``$1``') // Inline Code
|
|
1225
|
-
.replace(/^\*\s/, ''); // Remove list item marker at the beginning of the line
|
|
1226
|
-
};
|
|
1227
|
-
|
|
1228
|
-
const parseTable = line => {
|
|
1229
|
-
const cells = line.split('|').map(cell => cell.trim()).filter(cell => cell !== '');
|
|
1230
|
-
const tableRow = cells.map(cell => `<td>${parseInlineElements(cell)}</td>`).join('');
|
|
1231
|
-
return `<tr>${tableRow}</tr>\n`;
|
|
1232
|
-
};
|
|
1233
|
-
|
|
1234
|
-
const parseCodeBlock = (lines, language) => {
|
|
1235
|
-
const codeContent = lines.join('\n'); // No need to exclude the triple backticks
|
|
1236
|
-
const highlightedCode = language ? `<pre><code data-language="${language}">${codeContent}</code></pre>` : `<pre><code>${codeContent}</code></pre>`;
|
|
1237
|
-
return `${highlightedCode}\n`;
|
|
1238
|
-
};
|
|
1239
|
-
|
|
1240
|
-
const parseList = line => {
|
|
1241
|
-
const OL_PATTERN = /^(\d+)\.\s/;
|
|
1242
|
-
const OL_PATTERN_WITHOUT_START = /^[.]\s/;
|
|
1243
|
-
const UL_PATTERN = /^[*]\s/;
|
|
1244
|
-
|
|
1245
|
-
if (line.match(OL_PATTERN)) {
|
|
1246
|
-
const start = line.match(OL_PATTERN)[1];
|
|
1247
|
-
return `<ol start="${start}"><li>${parseInlineElements(line.replace(OL_PATTERN, ''))}</li></ol>\n`;
|
|
1248
|
-
}
|
|
1249
|
-
if (line.match(OL_PATTERN_WITHOUT_START)) {
|
|
1250
|
-
return `<ol><li>${parseInlineElements(line.replace(OL_PATTERN_WITHOUT_START, ''))}</li></ol>\n`;
|
|
1251
|
-
}
|
|
1252
|
-
if (line.match(UL_PATTERN)) {
|
|
1253
|
-
return `<ul><li>${parseInlineElements(line.replace(UL_PATTERN, ''))}</li></ul>\n`;
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
// If neither ordered nor unordered list pattern matches, treat it as a paragraph
|
|
1257
|
-
return `<p>${parseInlineElements(line)}</p>\n`;
|
|
1258
|
-
};
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
const parseBlockquote = line => {
|
|
1264
|
-
return `<blockquote>${parseInlineElements(line.slice(2))}</blockquote>\n`;
|
|
1265
|
-
};
|
|
1266
|
-
|
|
1267
|
-
const parseHorizontalRule = () => {
|
|
1268
|
-
return '<hr>\n';
|
|
1269
|
-
};
|
|
1270
|
-
|
|
1271
|
-
const parseAttributes = line => {
|
|
1272
|
-
const attrs = line.match(/\[(.*?)\]/);
|
|
1273
|
-
return attrs ? attrs[1].split(',').map(attr => `[${attr.trim()}]`).join('') : '';
|
|
1274
|
-
};
|
|
1275
|
-
|
|
1276
|
-
const adoc2html = adocText => {
|
|
1277
|
-
const lines = adocText.split('\n');
|
|
1278
|
-
let htmlOutput = '';
|
|
1279
|
-
let inTable = false;
|
|
1280
|
-
let inCodeBlock = false;
|
|
1281
|
-
let codeBlockLines = [];
|
|
1282
|
-
let codeBlockLanguage = '';
|
|
1283
|
-
for (let i = 0; i < lines.length; i++) {
|
|
1284
|
-
let line = lines[i];
|
|
1285
|
-
// Table
|
|
1286
|
-
if (line.startsWith('|')) {
|
|
1287
|
-
if (!inTable) {
|
|
1288
|
-
inTable = true;
|
|
1289
|
-
htmlOutput += '<table>\n';
|
|
1290
|
-
}
|
|
1291
|
-
htmlOutput += parseTable(line);
|
|
1292
|
-
continue;
|
|
1293
|
-
} else if (inTable) {
|
|
1294
|
-
inTable = false;
|
|
1295
|
-
htmlOutput += '</table>\n';
|
|
1296
|
-
}
|
|
1297
|
-
// Code block
|
|
1298
|
-
if (line.startsWith('```')) {
|
|
1299
|
-
if (!inCodeBlock) {
|
|
1300
|
-
inCodeBlock = true;
|
|
1301
|
-
codeBlockLines = [];
|
|
1302
|
-
codeBlockLanguage = line.slice(3).trim();
|
|
1303
|
-
} else {
|
|
1304
|
-
inCodeBlock = false;
|
|
1305
|
-
htmlOutput += parseCodeBlock(codeBlockLines, codeBlockLanguage);
|
|
1306
|
-
}
|
|
1307
|
-
continue;
|
|
1308
|
-
} else if (inCodeBlock) {
|
|
1309
|
-
codeBlockLines.push(line);
|
|
1310
|
-
continue;
|
|
1311
|
-
}
|
|
1312
|
-
// Headings
|
|
1313
|
-
if (line.startsWith('=')) {
|
|
1314
|
-
const headingLevel = (line.match(/=/g) || []).length;
|
|
1315
|
-
const headingText = line.replace(/=/g, '').trim();
|
|
1316
|
-
htmlOutput += `<h${headingLevel}>${parseInlineElements(headingText)}</h${headingLevel}>\n`;
|
|
1317
|
-
continue;
|
|
1318
|
-
}
|
|
1319
|
-
// Lists
|
|
1320
|
-
if (line.match(/^(\d+)\.\s/) || line.match(/^[*\.]\s/)) {
|
|
1321
|
-
htmlOutput += parseList(line);
|
|
1322
|
-
continue;
|
|
1323
|
-
}
|
|
1324
|
-
// Blockquote
|
|
1325
|
-
if (line.startsWith('> ')) {
|
|
1326
|
-
htmlOutput += parseBlockquote(line);
|
|
1327
|
-
continue;
|
|
1328
|
-
}
|
|
1329
|
-
// Horizontal Rule
|
|
1330
|
-
if (line.trim() === '---') {
|
|
1331
|
-
htmlOutput += parseHorizontalRule();
|
|
1332
|
-
continue;
|
|
1333
|
-
}
|
|
1334
|
-
// Attributes
|
|
1335
|
-
if (line.startsWith('[')) {
|
|
1336
|
-
htmlOutput += parseAttributes(line);
|
|
1337
|
-
continue;
|
|
1338
|
-
}
|
|
1339
|
-
// Other paragraphs
|
|
1340
|
-
if (line.trim() !== '') { // Exclude empty lines
|
|
1341
|
-
htmlOutput += `<p>${parseInlineElements(line)}</p>\n`;
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
return htmlOutput;
|
|
1345
|
-
};
|
|
1346
|
-
|
|
1347
1124
|
const csv2arr = (csv, delimiter = ",")=>csv.trim().trimEnd().split("\n").map(n=>n.split(delimiter));
|
|
1348
1125
|
const csv2matrix = (csv, delimiter = ",")=>new Matrix(csv2arr(csv,delimiter));
|
|
1349
1126
|
const csv2object = (csv, delimiter = ",") => {
|
|
@@ -4489,59 +4266,6 @@ const useThread = (func, callback , close) => {
|
|
|
4489
4266
|
return T;
|
|
4490
4267
|
};
|
|
4491
4268
|
|
|
4492
|
-
class ZikoUseBattery{
|
|
4493
|
-
constructor(){
|
|
4494
|
-
if(this.isSupported)this.#init();
|
|
4495
|
-
}
|
|
4496
|
-
async #init(){
|
|
4497
|
-
this.__Battery__=await navigator.getBattery();
|
|
4498
|
-
}
|
|
4499
|
-
get isSupported(){
|
|
4500
|
-
return !!navigator.getBattery;
|
|
4501
|
-
}
|
|
4502
|
-
get current(){
|
|
4503
|
-
// Synchrouns Code
|
|
4504
|
-
const {
|
|
4505
|
-
level,
|
|
4506
|
-
charging,
|
|
4507
|
-
chargingTime,
|
|
4508
|
-
dischargingTime
|
|
4509
|
-
}=this.__Battery__;
|
|
4510
|
-
return {
|
|
4511
|
-
level,
|
|
4512
|
-
charging,
|
|
4513
|
-
chargingTime,
|
|
4514
|
-
dischargingTime
|
|
4515
|
-
}
|
|
4516
|
-
}
|
|
4517
|
-
onChargingChange(callback){
|
|
4518
|
-
this.__Battery__?.addEventListener("chargingchange",callback);
|
|
4519
|
-
return this;
|
|
4520
|
-
}
|
|
4521
|
-
onLevelChange(callback){
|
|
4522
|
-
this.__Battery__?.addEventListener("levelchange",callback);
|
|
4523
|
-
return this;
|
|
4524
|
-
}
|
|
4525
|
-
}
|
|
4526
|
-
const useBattery=()=>new ZikoUseBattery();
|
|
4527
|
-
|
|
4528
|
-
class ZikoUseGeolocation{
|
|
4529
|
-
constructor(){
|
|
4530
|
-
if(this.isSupported)this.#init();
|
|
4531
|
-
}
|
|
4532
|
-
async #init(){
|
|
4533
|
-
navigator.geolocation.getCurrentPosition(e=>this.__Geolocation__=e);
|
|
4534
|
-
}
|
|
4535
|
-
get isSupported(){
|
|
4536
|
-
return !!navigator.geolocation;
|
|
4537
|
-
}
|
|
4538
|
-
get current(){
|
|
4539
|
-
// Synchrouns Code
|
|
4540
|
-
return this.__Geolocation__;
|
|
4541
|
-
}
|
|
4542
|
-
}
|
|
4543
|
-
const useGeolocation=()=>new ZikoUseGeolocation();
|
|
4544
|
-
|
|
4545
4269
|
class ZikoUseChannel{
|
|
4546
4270
|
constructor(name=""){
|
|
4547
4271
|
this.channel=new BroadcastChannel(name);
|
|
@@ -4817,12 +4541,10 @@ var Hooks = /*#__PURE__*/Object.freeze({
|
|
|
4817
4541
|
ZikoHead: ZikoHead$1,
|
|
4818
4542
|
ZikoUseRoot: ZikoUseRoot,
|
|
4819
4543
|
ZikoUseStyle: ZikoUseStyle,
|
|
4820
|
-
useBattery: useBattery,
|
|
4821
4544
|
useChannel: useChannel$1,
|
|
4822
4545
|
useDebounce: useDebounce,
|
|
4823
4546
|
useEventEmitter: useEventEmitter,
|
|
4824
4547
|
useFavIcon: useFavIcon$1,
|
|
4825
|
-
useGeolocation: useGeolocation,
|
|
4826
4548
|
useHead: useHead$1,
|
|
4827
4549
|
useLocaleStorage: useLocaleStorage,
|
|
4828
4550
|
useMediaQuery: useMediaQuery,
|
|
@@ -4902,10 +4624,9 @@ class ZikoUIElement {
|
|
|
4902
4624
|
globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
|
|
4903
4625
|
element && globalThis.__Ziko__.__Config__.default.render && this.render();
|
|
4904
4626
|
this.setAttr("data-ref", this.uuid);
|
|
4905
|
-
globalThis.__Ziko__.
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
});
|
|
4627
|
+
if(globalThis.__Ziko__.__Config__.renderingMode !== "spa" && !globalThis.__Ziko__.__Config__.isSSC) {
|
|
4628
|
+
globalThis.__Ziko__.__HYDRATION_MAP__.set(this.uuid, ()=>this);
|
|
4629
|
+
}
|
|
4909
4630
|
}
|
|
4910
4631
|
get element(){
|
|
4911
4632
|
return this.__ele__;
|
|
@@ -4985,7 +4706,7 @@ class ZikoUIElement {
|
|
|
4985
4706
|
return this;
|
|
4986
4707
|
}
|
|
4987
4708
|
for (let i = 0; i < ele.length; i++) {
|
|
4988
|
-
if (["number", "string"].includes(typeof ele[i])) ele[i] = text
|
|
4709
|
+
if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
4989
4710
|
if (ele[i] instanceof ZikoUIElement) {
|
|
4990
4711
|
ele[i].cache.parent = this;
|
|
4991
4712
|
this.element[adder](ele[i].element);
|
|
@@ -5015,7 +4736,7 @@ class ZikoUIElement {
|
|
|
5015
4736
|
if (index >= this.element.children.length) this.append(...ele);
|
|
5016
4737
|
else
|
|
5017
4738
|
for (let i = 0; i < ele.length; i++) {
|
|
5018
|
-
if (["number", "string"].includes(typeof ele[i])) ele[i] = text
|
|
4739
|
+
if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
5019
4740
|
this.element?.insertBefore(ele[i].element, this.items[index].element);
|
|
5020
4741
|
this.items.splice(index, 0, ele[i]);
|
|
5021
4742
|
}
|
|
@@ -5434,128 +5155,7 @@ class ZikoUIElement {
|
|
|
5434
5155
|
}
|
|
5435
5156
|
}
|
|
5436
5157
|
|
|
5437
|
-
class
|
|
5438
|
-
constructor(element, name = "") {
|
|
5439
|
-
super(element, name);
|
|
5440
|
-
this.items = [];
|
|
5441
|
-
}
|
|
5442
|
-
// maintain() {
|
|
5443
|
-
// for (let i = 0; i < this.items.length; i++)
|
|
5444
|
-
// Object.assign(this, { [[i]]: this.items[i] });
|
|
5445
|
-
// this.length = this.items.length;
|
|
5446
|
-
// return this;
|
|
5447
|
-
// }
|
|
5448
|
-
// at(index) {
|
|
5449
|
-
// return this.items.at(index);
|
|
5450
|
-
// }
|
|
5451
|
-
// #addItem(adder, pusher, ...ele) {
|
|
5452
|
-
// if (this.cache.isFrozzen) {
|
|
5453
|
-
// console.warn("You can't append new item to frozzen element");
|
|
5454
|
-
// return this;
|
|
5455
|
-
// }
|
|
5456
|
-
// for (let i = 0; i < ele.length; i++) {
|
|
5457
|
-
// if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
5458
|
-
// if (ele[i] instanceof ZikoUIElement) {
|
|
5459
|
-
// ele[i].cache.parent = this;
|
|
5460
|
-
// this.element[adder](ele[i].element);
|
|
5461
|
-
// ele[i].target = this.element;
|
|
5462
|
-
// this.items[pusher](ele[i]);
|
|
5463
|
-
// } else if (ele[i] instanceof Object) {
|
|
5464
|
-
// if (ele[i]?.style) this.style(ele[i]?.style);
|
|
5465
|
-
// if (ele[i]?.attr) {
|
|
5466
|
-
// Object.entries(ele[i].attr).forEach((n) =>
|
|
5467
|
-
// this.setAttr("" + n[0], n[1]),
|
|
5468
|
-
// );
|
|
5469
|
-
// }
|
|
5470
|
-
// }
|
|
5471
|
-
// }
|
|
5472
|
-
// this.maintain();
|
|
5473
|
-
// return this;
|
|
5474
|
-
// }
|
|
5475
|
-
// append(...ele) {
|
|
5476
|
-
// this.#addItem("append", "push", ...ele);
|
|
5477
|
-
// return this;
|
|
5478
|
-
// }
|
|
5479
|
-
// prepend(...ele) {
|
|
5480
|
-
// this.#addItem("prepend", "unshift", ...ele);
|
|
5481
|
-
// return this;
|
|
5482
|
-
// }
|
|
5483
|
-
// insertAt(index, ...ele) {
|
|
5484
|
-
// if (index >= this.element.children.length) this.append(...ele);
|
|
5485
|
-
// else
|
|
5486
|
-
// for (let i = 0; i < ele.length; i++) {
|
|
5487
|
-
// if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
5488
|
-
// this.element?.insertBefore(ele[i].element, this.items[index].element);
|
|
5489
|
-
// this.items.splice(index, 0, ele[i]);
|
|
5490
|
-
// }
|
|
5491
|
-
// return this;
|
|
5492
|
-
// }
|
|
5493
|
-
// remove(...ele) {
|
|
5494
|
-
// const remove = (ele) => {
|
|
5495
|
-
// if (typeof ele === "number") ele = this.items[ele];
|
|
5496
|
-
// if (ele instanceof ZikoUIElement) this.element?.removeChild(ele.element);
|
|
5497
|
-
// this.items = this.items.filter((n) => n !== ele);
|
|
5498
|
-
// };
|
|
5499
|
-
// for (let i = 0; i < ele.length; i++) remove(ele[i]);
|
|
5500
|
-
// for (let i = 0; i < this.items.length; i++)
|
|
5501
|
-
// Object.assign(this, { [[i]]: this.items[i] });
|
|
5502
|
-
// // Remove from item
|
|
5503
|
-
// return this;
|
|
5504
|
-
// }
|
|
5505
|
-
// forEach(callback) {
|
|
5506
|
-
// this.items.forEach(callback);
|
|
5507
|
-
// return this;
|
|
5508
|
-
// }
|
|
5509
|
-
// map(callback) {
|
|
5510
|
-
// return this.items.map(callback);
|
|
5511
|
-
// }
|
|
5512
|
-
// find(condition) {
|
|
5513
|
-
// return this.items.filter(condition);
|
|
5514
|
-
// }
|
|
5515
|
-
// filter(condition_callback, if_callback = () => {}, else_callback = () => {}) {
|
|
5516
|
-
// const FilterItems = this.items.filter(condition_callback);
|
|
5517
|
-
// FilterItems.forEach(if_callback);
|
|
5518
|
-
// this.items
|
|
5519
|
-
// .filter((item) => !FilterItems.includes(item))
|
|
5520
|
-
// .forEach(else_callback);
|
|
5521
|
-
// return this;
|
|
5522
|
-
// }
|
|
5523
|
-
// filterByTextContent(text, exactMatch = false) {
|
|
5524
|
-
// this.items.forEach((n) => n.render());
|
|
5525
|
-
// this.filter(
|
|
5526
|
-
// (n) => !(exactMatch ? n.text === text : n.text.includes(text)),
|
|
5527
|
-
// (e) => e.unrender(),
|
|
5528
|
-
// );
|
|
5529
|
-
// // this.items.filter(n=>{
|
|
5530
|
-
// // const content=n.element.textContent;
|
|
5531
|
-
// // return !(exactMatch?content===text:content.includes(text))
|
|
5532
|
-
// // }).map(n=>n.unrender());
|
|
5533
|
-
// // return this;
|
|
5534
|
-
// }
|
|
5535
|
-
// filterByClass(value) {
|
|
5536
|
-
// this.items.map((n) => n.render());
|
|
5537
|
-
// this.items
|
|
5538
|
-
// .filter((n) => !n.classes.includes(value))
|
|
5539
|
-
// .map((n) => n.unrender());
|
|
5540
|
-
// return this;
|
|
5541
|
-
// }
|
|
5542
|
-
// sortByTextContent(value, displays) {
|
|
5543
|
-
// let item = this.children;
|
|
5544
|
-
// item
|
|
5545
|
-
// .filter((n) => !n.textContent.toLowerCase().includes(value.toLowerCase()))
|
|
5546
|
-
// .map((n) => {
|
|
5547
|
-
// n.style.display = "none";
|
|
5548
|
-
// });
|
|
5549
|
-
// item
|
|
5550
|
-
// .filter((n) => n.textContent.toLowerCase().includes(value.toLowerCase()))
|
|
5551
|
-
// .map((n, i) => (n.style.display = displays[i]));
|
|
5552
|
-
// //return item.filter(n=>n.style.display!="none")
|
|
5553
|
-
// item.filter((n) => n.style.display != "none");
|
|
5554
|
-
// return this;
|
|
5555
|
-
// }
|
|
5556
|
-
}
|
|
5557
|
-
|
|
5558
|
-
class __ZikoUIText__ extends ZikoUIContainerElement {
|
|
5158
|
+
class __ZikoUIText__ extends ZikoUIElement {
|
|
5559
5159
|
constructor(tag, name, lineBreak,...value) {
|
|
5560
5160
|
super(tag, name);
|
|
5561
5161
|
this.addValue(...value);
|
|
@@ -5660,7 +5260,7 @@ class ZikoUIAbbrText extends __ZikoUIText__ {
|
|
|
5660
5260
|
return true
|
|
5661
5261
|
}
|
|
5662
5262
|
}
|
|
5663
|
-
const text
|
|
5263
|
+
const text = (...str) => new ZikoUIText(...str);
|
|
5664
5264
|
const quote = (...str) => new ZikoUIQuote(...str);
|
|
5665
5265
|
const dfnText = (...str) => new ZikoUIDefintion(...str);
|
|
5666
5266
|
const supText = (...str) => new ZikoUISupText(...str);
|
|
@@ -5741,10 +5341,10 @@ var Text$1 = /*#__PURE__*/Object.freeze({
|
|
|
5741
5341
|
quote: quote,
|
|
5742
5342
|
subText: subText,
|
|
5743
5343
|
supText: supText,
|
|
5744
|
-
text: text
|
|
5344
|
+
text: text
|
|
5745
5345
|
});
|
|
5746
5346
|
|
|
5747
|
-
class ZikoUILI extends
|
|
5347
|
+
class ZikoUILI extends ZikoUIElement{
|
|
5748
5348
|
constructor(UI){
|
|
5749
5349
|
super("li","li");
|
|
5750
5350
|
this.append(UI);
|
|
@@ -5753,7 +5353,7 @@ class ZikoUILI extends ZikoUIContainerElement{
|
|
|
5753
5353
|
return true;
|
|
5754
5354
|
}
|
|
5755
5355
|
}
|
|
5756
|
-
class ZikoUIList extends
|
|
5356
|
+
class ZikoUIList extends ZikoUIElement {
|
|
5757
5357
|
constructor(element,name) {
|
|
5758
5358
|
super(element,name);
|
|
5759
5359
|
delete this.append;
|
|
@@ -5765,7 +5365,7 @@ class ZikoUIList extends ZikoUIContainerElement {
|
|
|
5765
5365
|
append(...arr){
|
|
5766
5366
|
for (let i = 0; i < arr.length; i++) {
|
|
5767
5367
|
let li = null;
|
|
5768
|
-
if(["string","number"].includes(typeof arr[i]))arr[i]=text
|
|
5368
|
+
if(["string","number"].includes(typeof arr[i]))arr[i]=text(arr[i]);
|
|
5769
5369
|
if (arr[i] instanceof ZikoUIElement)li=new ZikoUILI(arr[i]);
|
|
5770
5370
|
li.setTarget(this.element);
|
|
5771
5371
|
this.items.push(li[0]);
|
|
@@ -5793,7 +5393,7 @@ class ZikoUIList extends ZikoUIContainerElement {
|
|
|
5793
5393
|
else
|
|
5794
5394
|
for (let i = 0; i < ele.length; i++) {
|
|
5795
5395
|
let li = null;
|
|
5796
|
-
if(["number","string"].includes(typeof ele[i]))ele[i]=text
|
|
5396
|
+
if(["number","string"].includes(typeof ele[i]))ele[i]=text(ele[i]);
|
|
5797
5397
|
if (ele[i] instanceof ZikoUIElement)li=new ZikoUILI(ele[i]);
|
|
5798
5398
|
this.element?.insertBefore(li.element, this.items[index].parent.element);
|
|
5799
5399
|
this.items.splice(index, 0, ele[i][0]);
|
|
@@ -6401,7 +6001,7 @@ const sTags = SVGTags.reduce((acc, key) => {
|
|
|
6401
6001
|
return acc;
|
|
6402
6002
|
}, {});
|
|
6403
6003
|
|
|
6404
|
-
class ZikoUIHtmlTag extends
|
|
6004
|
+
class ZikoUIHtmlTag extends ZikoUIElement {
|
|
6405
6005
|
constructor(element) {
|
|
6406
6006
|
super(element,"html");
|
|
6407
6007
|
}
|
|
@@ -6454,7 +6054,7 @@ class ZikoUIBr extends ZikoUIElement {
|
|
|
6454
6054
|
return true
|
|
6455
6055
|
}
|
|
6456
6056
|
}
|
|
6457
|
-
class ZikoUILink extends
|
|
6057
|
+
class ZikoUILink extends ZikoUIElement{
|
|
6458
6058
|
constructor(href){
|
|
6459
6059
|
super("a","link");
|
|
6460
6060
|
Object.assign(this.cache,{
|
|
@@ -6788,7 +6388,7 @@ class ZikoUITextArea extends ZikoUIElement {
|
|
|
6788
6388
|
}
|
|
6789
6389
|
const textarea =()=> new ZikoUITextArea();
|
|
6790
6390
|
|
|
6791
|
-
|
|
6391
|
+
class ZikoUIFlex extends ZikoUIElement {
|
|
6792
6392
|
constructor(tag = "div", w = "100%", h = "100%") {
|
|
6793
6393
|
super(tag ,"Flex");
|
|
6794
6394
|
this.direction = "cols";
|
|
@@ -6836,18 +6436,18 @@ let ZikoUIFlex$1 = class ZikoUIFlex extends ZikoUIContainerElement {
|
|
|
6836
6436
|
return this;
|
|
6837
6437
|
}
|
|
6838
6438
|
vertical(x, y, order=1) {
|
|
6839
|
-
set_vertical
|
|
6439
|
+
set_vertical.call(this,order);
|
|
6840
6440
|
this.style({
|
|
6841
|
-
alignItems: typeof(x)==="number"?map_pos_x
|
|
6842
|
-
justifyContent: typeof(y)=="number"?map_pos_y
|
|
6441
|
+
alignItems: typeof(x)==="number"?map_pos_x.call(this,x):x,
|
|
6442
|
+
justifyContent: typeof(y)=="number"?map_pos_y.call(this,y):y
|
|
6843
6443
|
});
|
|
6844
6444
|
return this;
|
|
6845
6445
|
}
|
|
6846
6446
|
horizontal(x, y, order=1) {
|
|
6847
|
-
set_horizontal
|
|
6447
|
+
set_horizontal.call(this,order);
|
|
6848
6448
|
this.style({
|
|
6849
|
-
alignItems: typeof(y)=="number"?map_pos_y
|
|
6850
|
-
justifyContent: typeof(x)==="number"?map_pos_x
|
|
6449
|
+
alignItems: typeof(y)=="number"?map_pos_y.call(this,y):y,
|
|
6450
|
+
justifyContent: typeof(x)==="number"?map_pos_x.call(this,x):x
|
|
6851
6451
|
});
|
|
6852
6452
|
return this;
|
|
6853
6453
|
}
|
|
@@ -6856,38 +6456,44 @@ let ZikoUIFlex$1 = class ZikoUIFlex extends ZikoUIContainerElement {
|
|
|
6856
6456
|
this.style({ display: "flex" });
|
|
6857
6457
|
return this;
|
|
6858
6458
|
}
|
|
6859
|
-
}
|
|
6459
|
+
}
|
|
6860
6460
|
|
|
6861
|
-
const Flex
|
|
6461
|
+
const Flex = (...ZikoUIElement) =>{
|
|
6862
6462
|
let tag="div";
|
|
6863
6463
|
if(typeof ZikoUIElement[0]==="string"){
|
|
6864
6464
|
tag=ZikoUIElement[0];
|
|
6865
6465
|
ZikoUIElement.pop();
|
|
6866
6466
|
}
|
|
6867
|
-
return new ZikoUIFlex
|
|
6467
|
+
return new ZikoUIFlex(tag).append(...ZikoUIElement);
|
|
6868
6468
|
};
|
|
6869
|
-
function set_vertical
|
|
6469
|
+
function set_vertical(direction){
|
|
6870
6470
|
direction == 1
|
|
6871
6471
|
? this.style({ flexDirection: "column" })
|
|
6872
6472
|
: direction == -1 && this.style({ flexDirection: "column-reverse" });
|
|
6873
6473
|
return this;
|
|
6874
6474
|
}
|
|
6875
|
-
function set_horizontal
|
|
6475
|
+
function set_horizontal(direction){
|
|
6876
6476
|
direction == 1
|
|
6877
6477
|
? this.style({ flexDirection: "row" })
|
|
6878
6478
|
: direction == -1 && this.style({ flexDirection: "row-reverse" });
|
|
6879
6479
|
return this;
|
|
6880
6480
|
}
|
|
6881
|
-
function map_pos_x
|
|
6481
|
+
function map_pos_x(align){
|
|
6882
6482
|
let pos = ["flex-start", "center", "flex-end"];
|
|
6883
6483
|
if (typeof align === "number") align = pos[align + 1];
|
|
6884
6484
|
return align;
|
|
6885
6485
|
}
|
|
6886
|
-
function map_pos_y
|
|
6887
|
-
return map_pos_x
|
|
6486
|
+
function map_pos_y(align){
|
|
6487
|
+
return map_pos_x(-align);
|
|
6888
6488
|
}
|
|
6889
6489
|
|
|
6890
|
-
|
|
6490
|
+
var Flex$1 = /*#__PURE__*/Object.freeze({
|
|
6491
|
+
__proto__: null,
|
|
6492
|
+
Flex: Flex,
|
|
6493
|
+
ZikoUIFlex: ZikoUIFlex
|
|
6494
|
+
});
|
|
6495
|
+
|
|
6496
|
+
class ZikoUIForm extends ZikoUIFlex{
|
|
6891
6497
|
constructor(...items){
|
|
6892
6498
|
super("form", "Form");
|
|
6893
6499
|
this.append(...items);
|
|
@@ -7005,7 +6611,7 @@ class ZikoUICaption extends ZikoUIElement{
|
|
|
7005
6611
|
const tr=(...ZikoUIElement)=>new ZikoUITr(...ZikoUIElement);
|
|
7006
6612
|
const td=(...UI)=>{
|
|
7007
6613
|
UI=UI.map(n=>{
|
|
7008
|
-
if(!(n instanceof ZikoUIElement))n=text
|
|
6614
|
+
if(!(n instanceof ZikoUIElement))n=text(n);
|
|
7009
6615
|
return n
|
|
7010
6616
|
});
|
|
7011
6617
|
return new ZikoUITd(...UI)
|
|
@@ -7148,7 +6754,7 @@ var Table = /*#__PURE__*/Object.freeze({
|
|
|
7148
6754
|
Table: Table$1
|
|
7149
6755
|
});
|
|
7150
6756
|
|
|
7151
|
-
class ZikoUIMain extends
|
|
6757
|
+
class ZikoUIMain extends ZikoUIElement{
|
|
7152
6758
|
constructor(){
|
|
7153
6759
|
super("main","Main");
|
|
7154
6760
|
}
|
|
@@ -7156,7 +6762,7 @@ class ZikoUIMain extends ZikoUIContainerElement{
|
|
|
7156
6762
|
return true
|
|
7157
6763
|
}
|
|
7158
6764
|
}
|
|
7159
|
-
class ZikoUIHeader extends
|
|
6765
|
+
class ZikoUIHeader extends ZikoUIElement{
|
|
7160
6766
|
constructor(){
|
|
7161
6767
|
super("header","Header");
|
|
7162
6768
|
}
|
|
@@ -7164,7 +6770,7 @@ class ZikoUIMain extends ZikoUIContainerElement{
|
|
|
7164
6770
|
return true
|
|
7165
6771
|
}
|
|
7166
6772
|
}
|
|
7167
|
-
class ZikoUINav extends
|
|
6773
|
+
class ZikoUINav extends ZikoUIElement{
|
|
7168
6774
|
constructor(){
|
|
7169
6775
|
super("nav","Nav");
|
|
7170
6776
|
}
|
|
@@ -7172,7 +6778,7 @@ class ZikoUIMain extends ZikoUIContainerElement{
|
|
|
7172
6778
|
return true
|
|
7173
6779
|
}
|
|
7174
6780
|
}
|
|
7175
|
-
class ZikoUISection extends
|
|
6781
|
+
class ZikoUISection extends ZikoUIElement{
|
|
7176
6782
|
constructor(){
|
|
7177
6783
|
super("section","Section");
|
|
7178
6784
|
this.style({position:"relative"});
|
|
@@ -7181,7 +6787,7 @@ class ZikoUIMain extends ZikoUIContainerElement{
|
|
|
7181
6787
|
return true
|
|
7182
6788
|
}
|
|
7183
6789
|
}
|
|
7184
|
-
class ZikoUIArticle extends
|
|
6790
|
+
class ZikoUIArticle extends ZikoUIElement{
|
|
7185
6791
|
constructor(){
|
|
7186
6792
|
super("article","Article");
|
|
7187
6793
|
}
|
|
@@ -7189,7 +6795,7 @@ class ZikoUIMain extends ZikoUIContainerElement{
|
|
|
7189
6795
|
return true
|
|
7190
6796
|
}
|
|
7191
6797
|
}
|
|
7192
|
-
class ZikoUIAside extends
|
|
6798
|
+
class ZikoUIAside extends ZikoUIElement{
|
|
7193
6799
|
constructor(){
|
|
7194
6800
|
super("aside","Aside");
|
|
7195
6801
|
}
|
|
@@ -7197,7 +6803,7 @@ class ZikoUIMain extends ZikoUIContainerElement{
|
|
|
7197
6803
|
return true
|
|
7198
6804
|
}
|
|
7199
6805
|
}
|
|
7200
|
-
class ZikoUIFooter extends
|
|
6806
|
+
class ZikoUIFooter extends ZikoUIElement{
|
|
7201
6807
|
constructor(){
|
|
7202
6808
|
super("footer","Footer");
|
|
7203
6809
|
this.element=document?.createElement("footer");
|
|
@@ -7232,7 +6838,7 @@ var Semantic = /*#__PURE__*/Object.freeze({
|
|
|
7232
6838
|
ZikoUISection: ZikoUISection
|
|
7233
6839
|
});
|
|
7234
6840
|
|
|
7235
|
-
class ZikoUIGrid extends
|
|
6841
|
+
class ZikoUIGrid extends ZikoUIElement {
|
|
7236
6842
|
constructor(tag ="div", w = "50vw", h = "50vh") {
|
|
7237
6843
|
super(tag,"Grid");
|
|
7238
6844
|
this.direction = "cols";
|
|
@@ -7264,1609 +6870,24 @@ class ZikoUIGrid extends ZikoUIContainerElement {
|
|
|
7264
6870
|
}
|
|
7265
6871
|
const Grid$1 = (...ZikoUIElement) => new ZikoUIGrid("div").append(...ZikoUIElement);
|
|
7266
6872
|
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
open : openIcon,
|
|
7273
|
-
close : closeIcon
|
|
7274
|
-
}
|
|
7275
|
-
});
|
|
7276
|
-
this.summary=html("summary",summary).style({
|
|
7277
|
-
fontSize:"1.1em",
|
|
7278
|
-
padding:"0.625rem",
|
|
7279
|
-
fontWeight:"bold",
|
|
7280
|
-
listStyleType:`"${openIcon}"`,
|
|
7281
|
-
cursor:"pointer",
|
|
7282
|
-
});
|
|
7283
|
-
this.summary[0].style({
|
|
7284
|
-
marginLeft:"0.5em",
|
|
7285
|
-
});
|
|
7286
|
-
this.content=content.style({
|
|
7287
|
-
margin:"0.7em",
|
|
7288
|
-
});
|
|
7289
|
-
this.element?.append(this.summary.element,this.content.element);
|
|
7290
|
-
this.style({
|
|
7291
|
-
marginBottom:"0.7em",
|
|
7292
|
-
});
|
|
7293
|
-
watchAttr(this, e=>{
|
|
7294
|
-
if(e.target.isOpen){
|
|
7295
|
-
e.target.emit("open");
|
|
7296
|
-
if(this?.parent?.isAccordion){
|
|
7297
|
-
if(this.parent.cache.autoClose)this.parent.closeExcept(this);
|
|
7298
|
-
}
|
|
7299
|
-
this.summary.style({
|
|
7300
|
-
listStyleType:`"${this.cache.icons.close}"`
|
|
7301
|
-
});
|
|
7302
|
-
}
|
|
7303
|
-
else {
|
|
7304
|
-
e.target.emit("close");
|
|
7305
|
-
this.summary.style({
|
|
7306
|
-
listStyleType:`"${this.cache.icons.open}"`
|
|
7307
|
-
});
|
|
7308
|
-
}
|
|
7309
|
-
});
|
|
7310
|
-
}
|
|
7311
|
-
get isCollapsible(){
|
|
7312
|
-
return true;
|
|
7313
|
-
}
|
|
7314
|
-
get isOpen(){
|
|
7315
|
-
return this.element.open;
|
|
7316
|
-
}
|
|
7317
|
-
open(details=this){
|
|
7318
|
-
this.element.open=true;
|
|
7319
|
-
this.emit("open",details);
|
|
7320
|
-
return this;
|
|
7321
|
-
}
|
|
7322
|
-
close(){
|
|
7323
|
-
this.element.open=false;
|
|
7324
|
-
return this;
|
|
7325
|
-
}
|
|
7326
|
-
onOpen(callback){
|
|
7327
|
-
this.on("open", callback);
|
|
7328
|
-
return this;
|
|
7329
|
-
}
|
|
7330
|
-
onClose(callback){
|
|
7331
|
-
this.on("close", callback);
|
|
7332
|
-
return this;
|
|
7333
|
-
}
|
|
7334
|
-
toggle(){
|
|
7335
|
-
this.element.open=!this.element.open;
|
|
7336
|
-
return this;
|
|
7337
|
-
}
|
|
7338
|
-
}
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
const Collapsible=(summary, content, openIcon, closeIcon)=>new ZikoUICollapbsible(summary,content,openIcon, closeIcon);
|
|
6873
|
+
var Grid$2 = /*#__PURE__*/Object.freeze({
|
|
6874
|
+
__proto__: null,
|
|
6875
|
+
Grid: Grid$1,
|
|
6876
|
+
ZikoUIGrid: ZikoUIGrid
|
|
6877
|
+
});
|
|
7342
6878
|
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
this.items.forEach(n=>n.close());
|
|
7356
|
-
return this;
|
|
7357
|
-
}
|
|
7358
|
-
closeExcept(...Collapsibles){
|
|
7359
|
-
this.items.filter(n=>!Collapsibles.includes(n)).forEach(n=>n.close());
|
|
7360
|
-
return this;
|
|
7361
|
-
}
|
|
7362
|
-
open(CollapsibleOrIndex){
|
|
7363
|
-
CollapsibleOrIndex.isCollapsible? CollapsibleOrIndex.open(): this.items[CollapsibleOrIndex].open();
|
|
7364
|
-
this.closeExcept(CollapsibleOrIndex.isCollapsible? CollapsibleOrIndex: this.items[CollapsibleOrIndex]);
|
|
7365
|
-
return this;
|
|
7366
|
-
}
|
|
7367
|
-
enableAutoClose(){
|
|
7368
|
-
this.cache.autoClose = true;
|
|
7369
|
-
return this;
|
|
7370
|
-
}
|
|
7371
|
-
disableAutoClose(){
|
|
7372
|
-
this.cache.autoClose = false;
|
|
7373
|
-
return this;
|
|
7374
|
-
}
|
|
7375
|
-
toggleAutoClose(){
|
|
7376
|
-
this.cache.autoClose = !this.cache.autoClose;
|
|
7377
|
-
}
|
|
7378
|
-
}
|
|
7379
|
-
const Accordion = (... Collapsible) => new ZikoUIAccordion(...Collapsible);
|
|
7380
|
-
|
|
7381
|
-
class ZikoUIFlex extends ZikoUIContainerElement {
|
|
7382
|
-
constructor(tag = "div", w = "100%", h = "100%") {
|
|
7383
|
-
super(tag ,"Flex");
|
|
7384
|
-
this.direction = "cols";
|
|
7385
|
-
if (typeof w == "number") w += "%";
|
|
7386
|
-
if (typeof h == "number") h += "%";
|
|
7387
|
-
this.style({ width: w, height: h });
|
|
7388
|
-
this.style({ display: "flex" });
|
|
7389
|
-
// this.render();
|
|
7390
|
-
}
|
|
7391
|
-
get isFlex(){
|
|
7392
|
-
return true;
|
|
7393
|
-
}
|
|
7394
|
-
resp(px,wrap = true) {
|
|
7395
|
-
this.wrap(wrap);
|
|
7396
|
-
if (this.element.clientWidth < px) this.vertical();
|
|
7397
|
-
else this.horizontal();
|
|
7398
|
-
return this;
|
|
7399
|
-
}
|
|
7400
|
-
setSpaceAround() {
|
|
7401
|
-
this.style({ justifyContent: "space-around" });
|
|
7402
|
-
return this;
|
|
7403
|
-
}
|
|
7404
|
-
setSpaceBetween() {
|
|
7405
|
-
this.style({ justifyContent: "space-between" });
|
|
7406
|
-
return this;
|
|
7407
|
-
}
|
|
7408
|
-
setBaseline() {
|
|
7409
|
-
this.style({ alignItems: "baseline" });
|
|
7410
|
-
return this;
|
|
7411
|
-
}
|
|
7412
|
-
gap(g) {
|
|
7413
|
-
if (this.direction === "row") this.style({ columnGap: g });
|
|
7414
|
-
else if (this.direction === "column") this.style({ rowGap: g });
|
|
7415
|
-
return this;
|
|
7416
|
-
}
|
|
7417
|
-
wrap(value = "wrap") {
|
|
7418
|
-
const values = ["no-wrap", "wrap","wrap-reverse"];
|
|
7419
|
-
this.style({
|
|
7420
|
-
flexWrap: typeof value === "string" ? value : values[+value],
|
|
7421
|
-
});
|
|
7422
|
-
return this;
|
|
7423
|
-
}
|
|
7424
|
-
_justifyContent(align = "center") {
|
|
7425
|
-
this.style({ justifyContent: align });
|
|
7426
|
-
return this;
|
|
7427
|
-
}
|
|
7428
|
-
vertical(x, y, order=1) {
|
|
7429
|
-
set_vertical.call(this,order);
|
|
7430
|
-
this.style({
|
|
7431
|
-
alignItems: typeof(x)==="number"?map_pos_x.call(this,x):x,
|
|
7432
|
-
justifyContent: typeof(y)=="number"?map_pos_y.call(this,y):y
|
|
7433
|
-
});
|
|
7434
|
-
return this;
|
|
7435
|
-
}
|
|
7436
|
-
horizontal(x, y, order=1) {
|
|
7437
|
-
set_horizontal.call(this,order);
|
|
7438
|
-
this.style({
|
|
7439
|
-
alignItems: typeof(y)=="number"?map_pos_y.call(this,y):y,
|
|
7440
|
-
justifyContent: typeof(x)==="number"?map_pos_x.call(this,x):x
|
|
7441
|
-
});
|
|
7442
|
-
return this;
|
|
7443
|
-
}
|
|
7444
|
-
show() {
|
|
7445
|
-
this.isHidden = false;
|
|
7446
|
-
this.style({ display: "flex" });
|
|
7447
|
-
return this;
|
|
7448
|
-
}
|
|
7449
|
-
}
|
|
7450
|
-
|
|
7451
|
-
const Flex = (...ZikoUIElement) =>{
|
|
7452
|
-
let tag="div";
|
|
7453
|
-
if(typeof ZikoUIElement[0]==="string"){
|
|
7454
|
-
tag=ZikoUIElement[0];
|
|
7455
|
-
ZikoUIElement.pop();
|
|
7456
|
-
}
|
|
7457
|
-
return new ZikoUIFlex(tag).append(...ZikoUIElement);
|
|
7458
|
-
};
|
|
7459
|
-
function set_vertical(direction){
|
|
7460
|
-
direction == 1
|
|
7461
|
-
? this.style({ flexDirection: "column" })
|
|
7462
|
-
: direction == -1 && this.style({ flexDirection: "column-reverse" });
|
|
7463
|
-
return this;
|
|
7464
|
-
}
|
|
7465
|
-
function set_horizontal(direction){
|
|
7466
|
-
direction == 1
|
|
7467
|
-
? this.style({ flexDirection: "row" })
|
|
7468
|
-
: direction == -1 && this.style({ flexDirection: "row-reverse" });
|
|
7469
|
-
return this;
|
|
7470
|
-
}
|
|
7471
|
-
function map_pos_x(align){
|
|
7472
|
-
let pos = ["flex-start", "center", "flex-end"];
|
|
7473
|
-
if (typeof align === "number") align = pos[align + 1];
|
|
7474
|
-
return align;
|
|
7475
|
-
}
|
|
7476
|
-
function map_pos_y(align){
|
|
7477
|
-
return map_pos_x(-align);
|
|
7478
|
-
}
|
|
7479
|
-
|
|
7480
|
-
class ZikoUICarousel extends ZikoUIFlex{
|
|
7481
|
-
constructor(...ZikoUIElement){
|
|
7482
|
-
super();
|
|
7483
|
-
this.style({
|
|
7484
|
-
position:"relative",
|
|
7485
|
-
overflow:"hidden",
|
|
7486
|
-
touchAction:"none",
|
|
7487
|
-
userSelect:"none"
|
|
7488
|
-
});
|
|
7489
|
-
this.horizontal("space-around",0);
|
|
7490
|
-
this.track = Section(...ZikoUIElement).style({ display: "inline-flex" });
|
|
7491
|
-
this.track.size(this.track.children.length * 100 + "vw");
|
|
7492
|
-
this.track.setTarget(this);
|
|
7493
|
-
this.track.items.map((n) =>
|
|
7494
|
-
n.style({ pointerEvents: "none", margin: "auto 10px" })
|
|
7495
|
-
);
|
|
7496
|
-
this.x0 = null;
|
|
7497
|
-
this.tx = 0;
|
|
7498
|
-
this.onPtrMove(e=>{
|
|
7499
|
-
if(e.isDown){
|
|
7500
|
-
let x = e.event.pageX;
|
|
7501
|
-
let dx = x - this.x0;
|
|
7502
|
-
this.track.st.translateX(
|
|
7503
|
-
this.tx + dx,
|
|
7504
|
-
0
|
|
7505
|
-
);
|
|
7506
|
-
}
|
|
7507
|
-
});
|
|
7508
|
-
this.onPtrDown(e=>{
|
|
7509
|
-
console.log(e.event);
|
|
7510
|
-
this.x0 = e.event.pageX;
|
|
7511
|
-
const transformMatrix = window
|
|
7512
|
-
.getComputedStyle(this.track.element)
|
|
7513
|
-
.getPropertyValue("transform");
|
|
7514
|
-
if (transformMatrix !== "none") {
|
|
7515
|
-
this.tx = +transformMatrix.split(",")[4];
|
|
7516
|
-
}
|
|
7517
|
-
});
|
|
7518
|
-
this.onPtrUp(e=>console.log(e.isDown));
|
|
7519
|
-
this.onPtrLeave(e=>{
|
|
7520
|
-
// Handle outside up
|
|
7521
|
-
});
|
|
7522
|
-
}
|
|
7523
|
-
get isCarousel(){
|
|
7524
|
-
return true;
|
|
7525
|
-
}
|
|
7526
|
-
}
|
|
7527
|
-
const Carousel=(...ZikoUIElement)=>new ZikoUICarousel(...ZikoUIElement);
|
|
7528
|
-
|
|
7529
|
-
class ZikoUICodeNote extends ZikoUIFlex{
|
|
7530
|
-
constructor(){
|
|
7531
|
-
super("section");
|
|
7532
|
-
Object.assign(this.cache,{
|
|
7533
|
-
order:0,
|
|
7534
|
-
currentNote:null,
|
|
7535
|
-
currentNoteIndex:null
|
|
7536
|
-
});
|
|
7537
|
-
this.vertical(0,0);
|
|
7538
|
-
}
|
|
7539
|
-
get isCodeNote(){
|
|
7540
|
-
return true;
|
|
7541
|
-
}
|
|
7542
|
-
setCurrentNote(currentNote){
|
|
7543
|
-
this.cache.currentNote=currentNote;
|
|
7544
|
-
this.cache.currentNoteIndex=this.items.findIndex(n=>n===currentNote);
|
|
7545
|
-
currentNote.focus();
|
|
7546
|
-
this.items.forEach(n=>n.Input.style({
|
|
7547
|
-
border: "1px solid #ccc"
|
|
7548
|
-
}));
|
|
7549
|
-
currentNote.Input.style({
|
|
7550
|
-
border:"2px lightgreen solid"
|
|
7551
|
-
});
|
|
7552
|
-
return this;
|
|
7553
|
-
}
|
|
7554
|
-
addNote(text=""){
|
|
7555
|
-
this.append(CodeCell(text));
|
|
7556
|
-
return this;
|
|
7557
|
-
}
|
|
7558
|
-
execute(){
|
|
7559
|
-
this.cache.currentNote.execute();
|
|
7560
|
-
this.incrementOrder();
|
|
7561
|
-
return this;
|
|
7562
|
-
}
|
|
7563
|
-
incrementOrder(){
|
|
7564
|
-
this.cache.order++;
|
|
7565
|
-
this.cache.currentNote.setOrder(this.cache.order);
|
|
7566
|
-
return this;
|
|
7567
|
-
}
|
|
7568
|
-
next(){
|
|
7569
|
-
if(this.cache.currentNote===this.items.at(-1)){
|
|
7570
|
-
this.addNote();
|
|
7571
|
-
this.setCurrentNote(this.items.at(-1));
|
|
7572
|
-
}
|
|
7573
|
-
else this.setCurrentNote(this.items[this.cache.currentNoteIndex+1]);
|
|
7574
|
-
return this;
|
|
7575
|
-
}
|
|
7576
|
-
previous(){
|
|
7577
|
-
// add append before
|
|
7578
|
-
if(this.cache.currentNote!==this.items[0]){
|
|
7579
|
-
this.setCurrentNote(this.items[this.cache.currentNoteIndex-1]);
|
|
7580
|
-
}
|
|
7581
|
-
return this;
|
|
7582
|
-
}
|
|
7583
|
-
data(){
|
|
7584
|
-
return this.items.map(n=>n.cellData());
|
|
7585
|
-
}
|
|
7586
|
-
serialize(){
|
|
7587
|
-
return JSON.stringify(this.data());
|
|
7588
|
-
}
|
|
7589
|
-
import(data=[]){
|
|
7590
|
-
data.forEach((n,i)=>this.addNote(data[i].input));
|
|
7591
|
-
return this;
|
|
7592
|
-
}
|
|
7593
|
-
}
|
|
7594
|
-
const CodeNote=()=>new ZikoUICodeNote();
|
|
7595
|
-
|
|
7596
|
-
const Input=(codeText="")=>html("code",codeText).style({
|
|
7597
|
-
width:"100%",
|
|
7598
|
-
height:"auto",
|
|
7599
|
-
padding:"10px",
|
|
7600
|
-
boxSizing:"border-box",
|
|
7601
|
-
border: "1px solid #ccc",
|
|
7602
|
-
outline: "none",
|
|
7603
|
-
fontSize: "1rem",
|
|
7604
|
-
fontFamily: "Lucida Console, Courier New, monospace",
|
|
7605
|
-
padding: "1rem 0.5rem",
|
|
7606
|
-
wordBreak:"break-all",
|
|
7607
|
-
background:"#f6f8fa",
|
|
7608
|
-
color:"#0062C3"
|
|
7609
|
-
}).setAttr("contenteditable",true).setAttr("spellcheck",false);
|
|
7610
|
-
|
|
7611
|
-
const Output=()=>html("output").style({
|
|
7612
|
-
width:"100%",
|
|
7613
|
-
height:"auto",
|
|
7614
|
-
padding:"5px 0",
|
|
7615
|
-
});
|
|
7616
|
-
const Left=(ctx)=>Flex$1(
|
|
7617
|
-
text$1("[ ]")
|
|
7618
|
-
).style({
|
|
7619
|
-
width:"50px",
|
|
7620
|
-
//height:getComputedStyle(ctx.Input.element).height,
|
|
7621
|
-
height:"50px",
|
|
7622
|
-
margin:"10px 4px",
|
|
7623
|
-
padding:"5px",
|
|
7624
|
-
color:"darkblue",
|
|
7625
|
-
borderBottom:"4px solid gold",
|
|
7626
|
-
}).horizontal(0,0);
|
|
7627
|
-
const BTN_STYLE={
|
|
7628
|
-
background:"none",
|
|
7629
|
-
width:"25px",
|
|
7630
|
-
height:"25px",
|
|
7631
|
-
fontSize:"1.2rem",
|
|
7632
|
-
cursor:"pointer"
|
|
7633
|
-
};
|
|
7634
|
-
const Right=(ctx)=>Flex$1(
|
|
7635
|
-
text$1('▶️').style(BTN_STYLE).onClick(e=>{
|
|
7636
|
-
if(ctx.parent instanceof ZikoUICodeNote)ctx.parent.setCurrentNote(ctx);
|
|
7637
|
-
ctx.execute();
|
|
7638
|
-
globalThis.__Ziko__.__Config__.default.target=e.target.parent.parent[1][1];
|
|
7639
|
-
}),
|
|
7640
|
-
text$1('📋').style(BTN_STYLE).onClick(()=>{
|
|
7641
|
-
navigator.clipboard.writeText(ctx.codeText);
|
|
7642
|
-
}),
|
|
7643
|
-
text$1('✖️').style(BTN_STYLE).onClick(()=>ctx.remove()),
|
|
7644
|
-
text$1('✖️').style(BTN_STYLE).onClick(()=>ctx.remove()),
|
|
7645
|
-
).style({
|
|
7646
|
-
width:"70px",
|
|
7647
|
-
height:"50px",
|
|
7648
|
-
//background:"cyan",
|
|
7649
|
-
margin:"10px 0"
|
|
7650
|
-
}).horizontal(0,0).wrap(true);
|
|
7651
|
-
|
|
7652
|
-
class ZikoUICodeCell extends ZikoUIFlex{
|
|
7653
|
-
constructor(code="",{type="js",order=null}={}){
|
|
7654
|
-
super("section");
|
|
7655
|
-
Object.assign(this.cache,{
|
|
7656
|
-
state:null,
|
|
7657
|
-
order,
|
|
7658
|
-
type,
|
|
7659
|
-
metadata:{
|
|
7660
|
-
created:Date.now(),
|
|
7661
|
-
updated:null
|
|
7662
|
-
}
|
|
7663
|
-
});
|
|
7664
|
-
this.Input=Input(code);
|
|
7665
|
-
this.Output=Output();
|
|
7666
|
-
this.InOut=Flex(
|
|
7667
|
-
this.Input,
|
|
7668
|
-
this.Output
|
|
7669
|
-
).vertical().style({
|
|
7670
|
-
width:"100%",
|
|
7671
|
-
margin:"10px auto"
|
|
7672
|
-
});
|
|
7673
|
-
this.RightControl=Right(this);
|
|
7674
|
-
this.LeftControl=Left();
|
|
7675
|
-
this.append(
|
|
7676
|
-
this.LeftControl,
|
|
7677
|
-
this.InOut,
|
|
7678
|
-
this.RightControl
|
|
7679
|
-
);
|
|
7680
|
-
this.horizontal(-1,1).style({
|
|
7681
|
-
//background:"#444",
|
|
7682
|
-
width:"95vw",
|
|
7683
|
-
margin:"0 auto",
|
|
7684
|
-
border:"1px darkblue dotted"
|
|
7685
|
-
});
|
|
7686
|
-
let cm_content = this.Input.element.getElementsByClassName("cm-content")[0];
|
|
7687
|
-
if( cm_content ){
|
|
7688
|
-
cm_content.addEventListener("keydown",e=>{
|
|
7689
|
-
if(e.key === "Enter" && e.shiftKey){
|
|
7690
|
-
e.preventDefault();
|
|
7691
|
-
this.execute(this.cache.order);
|
|
7692
|
-
}
|
|
7693
|
-
});
|
|
7694
|
-
}
|
|
7695
|
-
else {
|
|
7696
|
-
this.Input.onKeyDown(e=>{
|
|
7697
|
-
if(e.kd==="Enter"){
|
|
7698
|
-
if(e.event.shiftKey){
|
|
7699
|
-
e.event.preventDefault();
|
|
7700
|
-
this.execute(this.cache.order);
|
|
7701
|
-
}
|
|
7702
|
-
}
|
|
7703
|
-
if(this.cache.parent instanceof ZikoUICodeNote){
|
|
7704
|
-
if(e.kd==="ArrowDown" && e.event.shiftKey ){
|
|
7705
|
-
this.cache.parent.next();
|
|
7706
|
-
}
|
|
7707
|
-
if(e.kd==="ArrowUp" && e.event.shiftKey){
|
|
7708
|
-
this.cache.parent.previous();
|
|
7709
|
-
}
|
|
7710
|
-
}
|
|
7711
|
-
}
|
|
7712
|
-
);
|
|
7713
|
-
this.Input.onFocus(()=>{
|
|
7714
|
-
if(this.cache.parent instanceof ZikoUICodeNote){
|
|
7715
|
-
this.cache.parent.cache.currentNote=this;
|
|
7716
|
-
this.cache.parent.setCurrentNote(this);
|
|
7717
|
-
}
|
|
7718
|
-
});
|
|
7719
|
-
this.Input.onPaste((e)=>{
|
|
7720
|
-
//e.event.preventDefault();
|
|
7721
|
-
//this.setValue(this.codeText.trim())
|
|
7722
|
-
});
|
|
7723
|
-
// this.Input.onKeyPress(e=>{
|
|
7724
|
-
// if(e.kp==="(")a.Input.element.textContent+=")";
|
|
7725
|
-
// if(e.kp==="[")a.Input.element.textContent+="]";
|
|
7726
|
-
// if(e.kp==="{")a.Input.element.textContent+="}";
|
|
7727
|
-
// })
|
|
7728
|
-
}
|
|
7729
|
-
}
|
|
7730
|
-
get isCodeCell(){
|
|
7731
|
-
return true;
|
|
7732
|
-
}
|
|
7733
|
-
// space  
|
|
7734
|
-
get codeText() {
|
|
7735
|
-
return (this.Input.element.getElementsByClassName("cm-content")[0])
|
|
7736
|
-
?this.Input.element.getElementsByClassName("cm-content")[0].innerText.trim()
|
|
7737
|
-
:this.Input.element.innerText.trim()
|
|
7738
|
-
// return this.Input.element.innerText.trim();
|
|
7739
|
-
}
|
|
7740
|
-
get codeHTML() {
|
|
7741
|
-
return this.Input.element.innerHTML;
|
|
7742
|
-
}
|
|
7743
|
-
get outputHTML(){
|
|
7744
|
-
return this.Output.element.innerHTML;
|
|
7745
|
-
}
|
|
7746
|
-
setValue(codeText){
|
|
7747
|
-
this.Input[0].setValue(codeText);
|
|
7748
|
-
return this;
|
|
7749
|
-
}
|
|
7750
|
-
cellData(){
|
|
7751
|
-
return {
|
|
7752
|
-
input:this.codeText,
|
|
7753
|
-
output:this.outputHTML,
|
|
7754
|
-
order:this.cache.order,
|
|
7755
|
-
type:this.cache.type
|
|
7756
|
-
}
|
|
7757
|
-
}
|
|
7758
|
-
execute(order){
|
|
7759
|
-
this.clearOutput();
|
|
7760
|
-
this.evaluate(order);
|
|
7761
|
-
this.cache.metadata.updated=Date.now();
|
|
7762
|
-
return this;
|
|
7763
|
-
}
|
|
7764
|
-
#evaluateJs(order){
|
|
7765
|
-
try{
|
|
7766
|
-
this.LeftControl[0].setValue("pending");
|
|
7767
|
-
this.cache.state="pending";
|
|
7768
|
-
// globalThis.eval(this.Input.element.innerText);
|
|
7769
|
-
globalThis.eval(this.codeText);
|
|
7770
|
-
|
|
7771
|
-
}
|
|
7772
|
-
catch(err){
|
|
7773
|
-
console.log(err);
|
|
7774
|
-
text(`Error : ${err.message}`).style({
|
|
7775
|
-
color:"red",
|
|
7776
|
-
background:"gold",
|
|
7777
|
-
border:"2px red solid",
|
|
7778
|
-
padding:"10px",
|
|
7779
|
-
margin:"10px 0",
|
|
7780
|
-
display:"flex",
|
|
7781
|
-
justifyContent: "center",
|
|
7782
|
-
});
|
|
7783
|
-
this.LeftControl[0].setValue("Err");
|
|
7784
|
-
this.cache.state="Error";
|
|
7785
|
-
}
|
|
7786
|
-
finally{
|
|
7787
|
-
if(this.cache.state==="pending"){
|
|
7788
|
-
this.cache.state="success";
|
|
7789
|
-
this.setOrder(order);
|
|
7790
|
-
if(this.cache.parent instanceof ZikoUICodeNote){
|
|
7791
|
-
this.cache.parent.incrementOrder();
|
|
7792
|
-
this.cache.parent.next();
|
|
7793
|
-
}
|
|
7794
|
-
}
|
|
7795
|
-
}
|
|
7796
|
-
}
|
|
7797
|
-
#evaluateMd(){
|
|
7798
|
-
|
|
7799
|
-
}
|
|
7800
|
-
#evaluateHtml(){
|
|
7801
|
-
|
|
7802
|
-
}
|
|
7803
|
-
evaluate(order){
|
|
7804
|
-
globalThis.__Ziko__.__Config__.default.target=this.Output.element;
|
|
7805
|
-
switch(this.cache.type){
|
|
7806
|
-
case "js":this.#evaluateJs(order);break;
|
|
7807
|
-
}
|
|
7808
|
-
return this;
|
|
7809
|
-
}
|
|
7810
|
-
clearInput(){
|
|
7811
|
-
this.Output.element.innerText="";
|
|
7812
|
-
return this;
|
|
7813
|
-
}
|
|
7814
|
-
clearOutput(){
|
|
7815
|
-
this.Output.element.innerText="";
|
|
7816
|
-
return this;
|
|
7817
|
-
}
|
|
7818
|
-
setOrder(order,render=true){
|
|
7819
|
-
this.cache.order=order;
|
|
7820
|
-
if(render){
|
|
7821
|
-
(typeof order === "number")?this.LeftControl[0].setValue(`[${order}]`):this.LeftControl[0].setValue("[-]");
|
|
7822
|
-
}
|
|
7823
|
-
return this;
|
|
7824
|
-
}
|
|
7825
|
-
focus(){
|
|
7826
|
-
this.Input.element.focus();
|
|
7827
|
-
return this;
|
|
7828
|
-
}
|
|
7829
|
-
}
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
const CodeCell=(codeText,{type,order}={})=>new ZikoUICodeCell(codeText,{type,order});
|
|
7833
|
-
|
|
7834
|
-
// Next
|
|
7835
|
-
// Previous
|
|
7836
|
-
// Vertical
|
|
7837
|
-
// Horizontal
|
|
7838
|
-
class ZikoUITabs extends ZikoUIFlex{
|
|
7839
|
-
#ACTIVE_ELEMENT_INDEX=0;
|
|
7840
|
-
constructor(Controllers,Contents){
|
|
7841
|
-
super("div","Tabs");
|
|
7842
|
-
Object.assign(this.cache,{
|
|
7843
|
-
config:{
|
|
7844
|
-
controllersPercent : .50
|
|
7845
|
-
}
|
|
7846
|
-
});
|
|
7847
|
-
this.style({
|
|
7848
|
-
boxSizing:"border-box",
|
|
7849
|
-
backgroundColor: "blanchedalmond",
|
|
7850
|
-
border:"1px red solid",
|
|
7851
|
-
margin:"30px",
|
|
7852
|
-
});
|
|
7853
|
-
this.controllersContainer = Flex().size("auto","auto").style({
|
|
7854
|
-
boxSizing:"border-box",
|
|
7855
|
-
justifyContent:"center",
|
|
7856
|
-
alignItems:"center",
|
|
7857
|
-
textAlign:"center",
|
|
7858
|
-
|
|
7859
|
-
minWidth:"50px",
|
|
7860
|
-
minHeight:"50px",
|
|
7861
|
-
|
|
7862
|
-
backgroundColor:"darkblue",
|
|
7863
|
-
border:"1px darkblue solid",
|
|
7864
|
-
|
|
7865
|
-
}).setAttr("role","tablist");
|
|
7866
|
-
this.contentContainer = Flex().style({
|
|
7867
|
-
boxSizing:"border-box",
|
|
7868
|
-
justifyContent:"center",
|
|
7869
|
-
alignItems:"center",
|
|
7870
|
-
textAlign:"center",
|
|
7871
|
-
|
|
7872
|
-
width:"100%",
|
|
7873
|
-
height:"100%",
|
|
7874
|
-
backgroundColor:"darkslategrey",
|
|
7875
|
-
});
|
|
7876
|
-
this.append(
|
|
7877
|
-
this.controllersContainer,
|
|
7878
|
-
this.contentContainer
|
|
7879
|
-
);
|
|
7880
|
-
if(Controllers.length!==Contents.length)console.error("");
|
|
7881
|
-
else {
|
|
7882
|
-
this.controllersContainer.append(...Controllers);
|
|
7883
|
-
this.contentContainer.append(...Contents);
|
|
7884
|
-
}
|
|
7885
|
-
this.init();
|
|
7886
|
-
this.display(0);
|
|
7887
|
-
this.useVertical();
|
|
7888
|
-
}
|
|
7889
|
-
get isTabs(){
|
|
7890
|
-
return true;
|
|
7891
|
-
}
|
|
7892
|
-
init(){
|
|
7893
|
-
// Remove old listener
|
|
7894
|
-
for(let i=0;i<this.controllersContainer.length;i++){
|
|
7895
|
-
this.controllersContainer[i].setAttr("role","tab").setAttr("aria-controls",`tab${i}`);
|
|
7896
|
-
this.contentContainer[i].setAttr("role","tabpanel").setAttr("aria-labelledby",`tab${i}`).setAttr("tabindex",-1);
|
|
7897
|
-
}
|
|
7898
|
-
this.controllersContainer.forEach(item=>item.onClick(e=>{
|
|
7899
|
-
const tab=e.target.element.getAttribute("aria-controls");
|
|
7900
|
-
const index=+tab.slice(3);
|
|
7901
|
-
this.contentContainer.filter(n=>n.element.getAttribute("aria-labelledby")===tab,()=>{
|
|
7902
|
-
if(this.#ACTIVE_ELEMENT_INDEX!==index)this.display(index);
|
|
7903
|
-
});
|
|
7904
|
-
}));
|
|
7905
|
-
return this;
|
|
7906
|
-
}
|
|
7907
|
-
addPairs(ControllerItem,ContentItem){
|
|
7908
|
-
this.controllersContainer.append(ControllerItem);
|
|
7909
|
-
this.contentContainer.append(ContentItem);
|
|
7910
|
-
const length=this.controllersContainer.length;
|
|
7911
|
-
this.controllersContainer.at(-1).setAttr("role","tab").setAttr("aria-controls",`tab${length-1}`);
|
|
7912
|
-
this.contentContainer.at(-1).setAttr("role","tabpanel").setAttr("aria-labelledby",`tab${length-1}`).setAttr("tabindex",-1);
|
|
7913
|
-
// Add listener
|
|
7914
|
-
return this;
|
|
7915
|
-
}
|
|
7916
|
-
removePairs(index){
|
|
7917
|
-
|
|
7918
|
-
}
|
|
7919
|
-
display(index){
|
|
7920
|
-
this.#ACTIVE_ELEMENT_INDEX=index%this.contentContainer.length;
|
|
7921
|
-
const ActiveContent = this.contentContainer.at(this.#ACTIVE_ELEMENT_INDEX);
|
|
7922
|
-
this.controllersContainer.forEach(n=>n.setAttr("tabindex",-1).setAttr("aria-selected",false));
|
|
7923
|
-
this.controllersContainer.at(this.#ACTIVE_ELEMENT_INDEX).setAttr("tabindex",0).setAttr("aria-selected",true);
|
|
7924
|
-
|
|
7925
|
-
this.contentContainer.forEach(n=>n.st.hide());
|
|
7926
|
-
|
|
7927
|
-
ActiveContent.st.translateX(100,0);
|
|
7928
|
-
ActiveContent.setAttr("tabindex",0).st.show();
|
|
7929
|
-
ActiveContent.st.translateX(0,1000);
|
|
7930
|
-
|
|
7931
|
-
return this;
|
|
7932
|
-
}
|
|
7933
|
-
next(i=1){
|
|
7934
|
-
this.display(this.#ACTIVE_ELEMENT_INDEX+i);
|
|
7935
|
-
return this;
|
|
7936
|
-
}
|
|
7937
|
-
previous(i=1){
|
|
7938
|
-
this.display(this.#ACTIVE_ELEMENT_INDEX-i);
|
|
7939
|
-
return this;
|
|
7940
|
-
}
|
|
7941
|
-
useVertical(){
|
|
7942
|
-
this.vertical(0,0);
|
|
7943
|
-
this.controllersContainer.horizontal(0,0);
|
|
7944
|
-
this.controllersContainer.style({
|
|
7945
|
-
width : "100%",
|
|
7946
|
-
height : `${this.cache.config.controllersPercent*100}%`
|
|
7947
|
-
});
|
|
7948
|
-
this.contentContainer.style({
|
|
7949
|
-
width : "100%",
|
|
7950
|
-
height : `${(1-this.cache.config.controllersPercent)*100}%`
|
|
7951
|
-
});
|
|
7952
|
-
return this;
|
|
7953
|
-
}
|
|
7954
|
-
useHorizontal(){
|
|
7955
|
-
this.horizontal(0,0);
|
|
7956
|
-
this.controllersContainer.vertical(0, 0);
|
|
7957
|
-
this.controllersContainer.style({
|
|
7958
|
-
height : "100%",
|
|
7959
|
-
width : `${this.cache.config.controllersPercent*100}%`
|
|
7960
|
-
});
|
|
7961
|
-
this.contentContainer.style({
|
|
7962
|
-
height : "100%",
|
|
7963
|
-
width : `${(1-this.cache.config.controllersPercent)*100}%`
|
|
7964
|
-
});
|
|
7965
|
-
return this;
|
|
7966
|
-
}
|
|
7967
|
-
// useHorizontalSwippe(){
|
|
7968
|
-
// this.onPtrDown();
|
|
7969
|
-
// this.onPtrUp(e=>this.next(Math.sign(e.swippe.delta_x)));
|
|
7970
|
-
// return this;
|
|
7971
|
-
// }
|
|
7972
|
-
// useVerticalSwippe(){
|
|
7973
|
-
// this.onPtrDown();
|
|
7974
|
-
// this.onPtrUp(e=>this.next(Math.sign(e.swippe.delta_y)));
|
|
7975
|
-
// return this;
|
|
7976
|
-
// }
|
|
7977
|
-
}
|
|
7978
|
-
|
|
7979
|
-
const Tabs=(Controllers,Contents)=>new ZikoUITabs(Controllers,Contents);
|
|
7980
|
-
|
|
7981
|
-
/*
|
|
7982
|
-
|
|
7983
|
-
const cont=(txt = "A")=>btn(txt).style({width:"170px"})
|
|
7984
|
-
a=Tabs(
|
|
7985
|
-
[cont("A1"),cont("A2"),cont("A3"),cont("A4")],
|
|
7986
|
-
[cont("A1"),cont("A2"),cont("A3"),cont("A4")]
|
|
7987
|
-
).vertical().size("400px")
|
|
7988
|
-
a.controllersContainer.style({
|
|
7989
|
-
overflowX:"auto"
|
|
7990
|
-
})
|
|
7991
|
-
a.useHorizontal()
|
|
7992
|
-
|
|
7993
|
-
*/
|
|
7994
|
-
|
|
7995
|
-
/*
|
|
7996
|
-
|
|
7997
|
-
a=Flex().size("400px","400px").style({background:"red"})
|
|
7998
|
-
a.element.animate([
|
|
7999
|
-
{ borderRadius: "0" , background : "red" },
|
|
8000
|
-
{ borderRadius: "50% 0" },
|
|
8001
|
-
{ borderRadius: "50% 50%" },
|
|
8002
|
-
{ borderRadius: "0 50%" },
|
|
8003
|
-
{ borderRadius: "0", background : "yellow" },
|
|
8004
|
-
],
|
|
8005
|
-
{
|
|
8006
|
-
// temporisation
|
|
8007
|
-
duration: 2000,
|
|
8008
|
-
iterations: Infinity,
|
|
8009
|
-
})
|
|
8010
|
-
|
|
8011
|
-
*/
|
|
8012
|
-
|
|
8013
|
-
const palette = {
|
|
8014
|
-
success: {
|
|
8015
|
-
titleColor:"green",
|
|
8016
|
-
contentColor: "#35495e",
|
|
8017
|
-
bgColor: "#d4edda", // Fixed
|
|
8018
|
-
bgColor:"linear-gradient(-225deg, #DFFFCD 0%, #90F9C4 48%, #39F3BB 100%)",
|
|
8019
|
-
borderColor: "#28a745", // Fixed
|
|
8020
|
-
icon: "✅"
|
|
8021
|
-
},
|
|
8022
|
-
info: {
|
|
8023
|
-
titleColor:"blue",
|
|
8024
|
-
contentColor: "#00204a",
|
|
8025
|
-
bgColor: "#93deff", // Fixed
|
|
8026
|
-
bgColor:"radial-gradient(circle at 10% 20%, rgb(147, 230, 241) 0%, rgb(145, 192, 241) 45.5%)",
|
|
8027
|
-
borderColor: "#005689", // Fixed
|
|
8028
|
-
icon: "ℹ️"
|
|
8029
|
-
},
|
|
8030
|
-
warning: {
|
|
8031
|
-
titleColor:"#e4663a",
|
|
8032
|
-
contentColor: "#45171d",
|
|
8033
|
-
bgColor:"#fdffcd",
|
|
8034
|
-
bgColor:"radial-gradient(907px at 3.4% 19.8%, rgb(255, 243, 122) 0%, rgb(255, 102, 145) 97.4%)",
|
|
8035
|
-
borderColor: "#efd510",
|
|
8036
|
-
icon: "⚠️"
|
|
8037
|
-
},
|
|
8038
|
-
danger: {
|
|
8039
|
-
titleColor:"red",
|
|
8040
|
-
contentColor: "#721c24",
|
|
8041
|
-
bgColor: "#f8d7da", // Fixed
|
|
8042
|
-
bgColor:"linear-gradient(90deg, rgb(255, 157, 129) 24.3%, rgb(255, 138, 138) 78.3%)",
|
|
8043
|
-
borderColor: "#c50000", // Fixed
|
|
8044
|
-
icon: "❌"
|
|
8045
|
-
},
|
|
8046
|
-
tips: {
|
|
8047
|
-
titleColor:null,
|
|
8048
|
-
contentColor: null,
|
|
8049
|
-
bgColor: null,
|
|
8050
|
-
borderColor: null,
|
|
8051
|
-
icon: "💡"
|
|
8052
|
-
},
|
|
8053
|
-
important: {
|
|
8054
|
-
titleColor:null,
|
|
8055
|
-
contentColor: null,
|
|
8056
|
-
bgColor: null,
|
|
8057
|
-
borderColor: null,
|
|
8058
|
-
icon: "📌"
|
|
8059
|
-
},
|
|
8060
|
-
|
|
8061
|
-
};
|
|
8062
|
-
|
|
8063
|
-
class ZikoUIAlert extends ZikoUIFlex$1{
|
|
8064
|
-
constructor(type, title, content){
|
|
8065
|
-
super();
|
|
8066
|
-
this.title = h3(title);
|
|
8067
|
-
this.icon = text$1(palette[type].icon).style({
|
|
8068
|
-
display: "flex",
|
|
8069
|
-
justifyContent:"center",
|
|
8070
|
-
borderRadius:"50%",
|
|
8071
|
-
minWidth:"30px",
|
|
8072
|
-
minHeight:"30px",
|
|
8073
|
-
});
|
|
8074
|
-
this.content = content;
|
|
8075
|
-
this.vertical()
|
|
8076
|
-
.size("200px", "auto")
|
|
8077
|
-
.style({
|
|
8078
|
-
borderRadius:"10px",
|
|
8079
|
-
padding:"10px"
|
|
8080
|
-
});
|
|
8081
|
-
this.append(
|
|
8082
|
-
Flex$1(
|
|
8083
|
-
this.title,
|
|
8084
|
-
this.icon
|
|
8085
|
-
).size("100%", "40px").style({}).horizontal("space-between",0),
|
|
8086
|
-
this.content
|
|
8087
|
-
);
|
|
8088
|
-
this.useType(type);
|
|
8089
|
-
}
|
|
8090
|
-
get isAlert(){
|
|
8091
|
-
return true;
|
|
8092
|
-
}
|
|
8093
|
-
useType(type){
|
|
8094
|
-
this.style({
|
|
8095
|
-
color:palette[type].color,
|
|
8096
|
-
background:palette[type].bgColor,
|
|
8097
|
-
border: `1px darkblue solid`,
|
|
8098
|
-
borderLeft: `15px ${palette[type].borderColor} solid`,
|
|
8099
|
-
});
|
|
8100
|
-
this.title.style({
|
|
8101
|
-
color:palette[type].titleColor
|
|
8102
|
-
});
|
|
8103
|
-
this.content.st.color(palette[type].titleColor);
|
|
8104
|
-
this.icon.setValue(palette[type].icon).style({
|
|
8105
|
-
border:`2px ${palette[type].borderColor} solid`,
|
|
8106
|
-
alignItems: type==="warning"?"flex-start":"center",
|
|
8107
|
-
});
|
|
8108
|
-
return this;
|
|
8109
|
-
}
|
|
8110
|
-
useSuccess(){
|
|
8111
|
-
this.useType("success");
|
|
8112
|
-
return this;
|
|
8113
|
-
}
|
|
8114
|
-
useInfo(){
|
|
8115
|
-
this.useType("info");
|
|
8116
|
-
return this;
|
|
8117
|
-
}
|
|
8118
|
-
useWarning(){
|
|
8119
|
-
this.useType("warning");
|
|
8120
|
-
return this;
|
|
8121
|
-
}
|
|
8122
|
-
useDanger(){
|
|
8123
|
-
this.useType("danger");
|
|
8124
|
-
return this;
|
|
8125
|
-
}
|
|
8126
|
-
}
|
|
8127
|
-
|
|
8128
|
-
const successAlert=(title, content)=>new ZikoUIAlert("success", title, content);
|
|
8129
|
-
const infoAlert=(title, content)=>new ZikoUIAlert("info", title, content);
|
|
8130
|
-
const warningAlert=(title, content)=>new ZikoUIAlert("warning", title, content);
|
|
8131
|
-
const dangerAlert=(title, content)=>new ZikoUIAlert("danger", title, content);
|
|
8132
|
-
|
|
8133
|
-
class __ZikoUISplitter__ extends ZikoUIElement{
|
|
8134
|
-
constructor(flexDirection, resizerCursor, resizerProp){
|
|
8135
|
-
super("div", "Splitter");
|
|
8136
|
-
Object.assign(this.cache,{
|
|
8137
|
-
isResizing : false,
|
|
8138
|
-
flexDirection,
|
|
8139
|
-
resizerCursor,
|
|
8140
|
-
resizerProp
|
|
8141
|
-
});
|
|
8142
|
-
this.style({
|
|
8143
|
-
display:"flex",
|
|
8144
|
-
flexDirection : this.cache.flexDirection,
|
|
8145
|
-
border: "2px solid #333",
|
|
8146
|
-
overflow: "hidden"
|
|
8147
|
-
});
|
|
8148
|
-
this.resizer = new ZikoUIElement("div", "resizer").style({
|
|
8149
|
-
[this.cache.resizerProp]:"5px",
|
|
8150
|
-
backgroundColor: "gold",
|
|
8151
|
-
cursor: this.cache.resizerCursor,
|
|
8152
|
-
touchAction: "none",
|
|
8153
|
-
});
|
|
8154
|
-
this.onPtrDown(e=>{
|
|
8155
|
-
this.cache.isResizing = true;
|
|
8156
|
-
this.style({
|
|
8157
|
-
cursor : this.cache.resizerCursor // ns-resize
|
|
8158
|
-
});
|
|
8159
|
-
this.resizer.element.setPointerCapture(e.event.pointerId);
|
|
8160
|
-
});
|
|
8161
|
-
this.onPtrUp(e=>{
|
|
8162
|
-
this.cache.isResizing = false;
|
|
8163
|
-
this.style({
|
|
8164
|
-
cursor: "default"
|
|
8165
|
-
});
|
|
8166
|
-
this.resizer.element.releasePointerCapture(e.event.pointerId);
|
|
8167
|
-
});
|
|
8168
|
-
this.onPtrCancel(()=>{
|
|
8169
|
-
this.cache.isResizing = false;
|
|
8170
|
-
this.style({
|
|
8171
|
-
cursor: "default"
|
|
8172
|
-
});
|
|
8173
|
-
});
|
|
8174
|
-
this.onPtrOut(()=>{
|
|
8175
|
-
if (this.cache.isResizing) {
|
|
8176
|
-
this.cache.isResizing = false;
|
|
8177
|
-
this.style({
|
|
8178
|
-
cursor: "default"
|
|
8179
|
-
});
|
|
8180
|
-
}
|
|
8181
|
-
});
|
|
8182
|
-
}
|
|
8183
|
-
get isSplitter(){
|
|
8184
|
-
return true;
|
|
8185
|
-
}
|
|
8186
|
-
styleResizer(style={}){
|
|
8187
|
-
this.resizer.style(style);
|
|
8188
|
-
return this;
|
|
8189
|
-
}
|
|
8190
|
-
}
|
|
8191
|
-
|
|
8192
|
-
class ZikoUIHorizontalSplitter extends __ZikoUISplitter__{
|
|
8193
|
-
constructor(leftPane, rightPane){
|
|
8194
|
-
super("row", "ew-resize", "width");
|
|
8195
|
-
this.leftPane = leftPane.style({
|
|
8196
|
-
width:"50%",
|
|
8197
|
-
flexGrow: 1,
|
|
8198
|
-
overflow: "hidden"
|
|
8199
|
-
});
|
|
8200
|
-
this.rightPane = rightPane.style({
|
|
8201
|
-
width:"50%",
|
|
8202
|
-
flexGrow: 1,
|
|
8203
|
-
overflow: "hidden"
|
|
8204
|
-
});
|
|
8205
|
-
this.element?.append(
|
|
8206
|
-
this.leftPane.element,
|
|
8207
|
-
this.resizer.element,
|
|
8208
|
-
this.rightPane.element
|
|
8209
|
-
);
|
|
8210
|
-
this.onPtrMove(e=>{
|
|
8211
|
-
if (!this.cache.isResizing) return;
|
|
8212
|
-
const containerWidth = this.element.getBoundingClientRect().width; // height
|
|
8213
|
-
const pointerRelativeXpos = e.event.clientX - this.element.getBoundingClientRect().x; // y
|
|
8214
|
-
let newLeftPaneWidth = (pointerRelativeXpos / containerWidth) * 100;
|
|
8215
|
-
let newRightPaneWidth = 100 - newLeftPaneWidth;
|
|
8216
|
-
if (newLeftPaneWidth < 0) newLeftPaneWidth = 0;
|
|
8217
|
-
if (newRightPaneWidth < 0) newRightPaneWidth = 0;
|
|
8218
|
-
this.leftPane.element.style.width = `${newLeftPaneWidth}%`;
|
|
8219
|
-
this.rightPane.element.style.width = `${newRightPaneWidth}%`;
|
|
8220
|
-
});
|
|
8221
|
-
}
|
|
8222
|
-
get isHorizontalSplitter(){
|
|
8223
|
-
return true;
|
|
8224
|
-
}
|
|
8225
|
-
}
|
|
8226
|
-
const hSplitter=(leftPane, rightPane)=>new ZikoUIHorizontalSplitter(leftPane, rightPane);
|
|
8227
|
-
|
|
8228
|
-
class ZikoUIVerticalSplitter extends __ZikoUISplitter__{
|
|
8229
|
-
constructor(topPane, bottomPane){
|
|
8230
|
-
super("column", "ns-resize", "height");
|
|
8231
|
-
this.topPane = topPane.style({
|
|
8232
|
-
height:"50%",
|
|
8233
|
-
flexGrow: 1,
|
|
8234
|
-
overflow: "hidden"
|
|
8235
|
-
});
|
|
8236
|
-
this.bottomPane = bottomPane.style({
|
|
8237
|
-
height:"50%",
|
|
8238
|
-
flexGrow: 1,
|
|
8239
|
-
overflow: "hidden"
|
|
8240
|
-
});
|
|
8241
|
-
this.element?.append(
|
|
8242
|
-
this.topPane.element,
|
|
8243
|
-
this.resizer.element,
|
|
8244
|
-
this.bottomPane.element
|
|
8245
|
-
);
|
|
8246
|
-
this.onPtrMove(e=>{
|
|
8247
|
-
if (!this.cache.isResizing) return;
|
|
8248
|
-
const containerHeight = this.element.getBoundingClientRect().height; // height
|
|
8249
|
-
const pointerRelativeYpos = e.event.clientY - this.element.getBoundingClientRect().y; // y
|
|
8250
|
-
let newTopPaneHeight = (pointerRelativeYpos / containerHeight) * 100;
|
|
8251
|
-
let newBottomPaneHeight = 100 - newTopPaneHeight;
|
|
8252
|
-
if (newTopPaneHeight < 0) newTopPaneHeight = 0;
|
|
8253
|
-
if (newBottomPaneHeight < 0) newBottomPaneHeight = 0;
|
|
8254
|
-
this.topPane.element.style.height = `${newTopPaneHeight}%`;
|
|
8255
|
-
this.bottomPane.element.style.height = `${newBottomPaneHeight}%`;
|
|
8256
|
-
});
|
|
8257
|
-
}
|
|
8258
|
-
get isHorizontalSplitter(){
|
|
8259
|
-
return true;
|
|
8260
|
-
}
|
|
8261
|
-
}
|
|
8262
|
-
const vSplitter=(topPane, bottomPane)=>new ZikoUIVerticalSplitter(topPane, bottomPane);
|
|
8263
|
-
|
|
8264
|
-
const Splitter = ({orintation = "horizontal",slides = []}) =>{
|
|
8265
|
-
if(["v","vertical"].includes(orintation.toLowerCase())) return vSplitter(...slides);
|
|
8266
|
-
else if(["h","horizontal"].includes(orintation.toLowerCase())) return hSplitter(...slides);
|
|
8267
|
-
else ;
|
|
8268
|
-
};
|
|
8269
|
-
|
|
8270
|
-
class ZikoUIBreadcrumbs extends ZikoUIElement{
|
|
8271
|
-
constructor(...items){
|
|
8272
|
-
super("ul", "Breadcrumbs");
|
|
8273
|
-
Object.assign(this.cache,{
|
|
8274
|
-
separatorTextContent:"/"
|
|
8275
|
-
});
|
|
8276
|
-
this.style({
|
|
8277
|
-
listStyle: "none",
|
|
8278
|
-
display: "flex",
|
|
8279
|
-
flexWrap: "wrap"
|
|
8280
|
-
});
|
|
8281
|
-
this.list=html('li').style({
|
|
8282
|
-
display: "flex",
|
|
8283
|
-
flexWrap: "wrap"
|
|
8284
|
-
});
|
|
8285
|
-
this.append(...items);
|
|
8286
|
-
}
|
|
8287
|
-
#addItem(item){
|
|
8288
|
-
if(["string","number","boolean"].includes(typeof item))item = text$1(item);
|
|
8289
|
-
const li = html("li", item).style({
|
|
8290
|
-
display: "flex",
|
|
8291
|
-
alignItems: "center"
|
|
8292
|
-
});
|
|
8293
|
-
if(this.element.children.length>0){
|
|
8294
|
-
const separator = text$1(this.cache.separatorTextContent).style({
|
|
8295
|
-
padding: "0 4px"
|
|
8296
|
-
});
|
|
8297
|
-
this.element?.append(separator.element);
|
|
8298
|
-
}
|
|
8299
|
-
this.element?.append(li.element);
|
|
8300
|
-
}
|
|
8301
|
-
append(...items){
|
|
8302
|
-
items.forEach(n=>this.#addItem(n));
|
|
8303
|
-
return this;
|
|
8304
|
-
}
|
|
8305
|
-
configSeparator(separatorTextContent = this.cache.separator, style = {}){
|
|
8306
|
-
this.cache.separatorTextContent = separatorTextContent;
|
|
8307
|
-
const separators = [...this.element.children].filter(n=>n.tagName==="SPAN");
|
|
8308
|
-
separators.forEach(node=>{
|
|
8309
|
-
node.textContent = separatorTextContent;
|
|
8310
|
-
Object.assign(node.style, style);
|
|
8311
|
-
}
|
|
8312
|
-
);
|
|
8313
|
-
return this;
|
|
8314
|
-
}
|
|
8315
|
-
}
|
|
8316
|
-
const Breadcrumbs=(...items)=>new ZikoUIBreadcrumbs(...items);
|
|
8317
|
-
|
|
8318
|
-
class ZikoUIMenu3d extends ZikoUIFlex$1{
|
|
8319
|
-
constructor(controller, content){
|
|
8320
|
-
super("div", "menu3d");
|
|
8321
|
-
this.controller = controller;
|
|
8322
|
-
this.content = content;
|
|
8323
|
-
this.cover = null;
|
|
8324
|
-
Object.assign(this.cache,{
|
|
8325
|
-
config:{
|
|
8326
|
-
useTransfo : false,
|
|
8327
|
-
isOpen : false,
|
|
8328
|
-
position : "left",
|
|
8329
|
-
threshold : 40,
|
|
8330
|
-
angle : 70,
|
|
8331
|
-
overlap : 6,
|
|
8332
|
-
width : 300,
|
|
8333
|
-
height : 300,
|
|
8334
|
-
transitionDuration: '0.5s',
|
|
8335
|
-
transitionEasing: 'ease',
|
|
8336
|
-
menuTransformOrigin : null,
|
|
8337
|
-
menuTransformClosed : null,
|
|
8338
|
-
menuTransformOpened : null,
|
|
8339
|
-
contentTransformOrigin : null,
|
|
8340
|
-
contentTransformClosed : null,
|
|
8341
|
-
contentTransformOpened : null,
|
|
8342
|
-
}
|
|
8343
|
-
});
|
|
8344
|
-
this.append(
|
|
8345
|
-
this.controller,
|
|
8346
|
-
this.content
|
|
8347
|
-
);
|
|
8348
|
-
this.update();
|
|
8349
|
-
}
|
|
8350
|
-
get isOpen(){
|
|
8351
|
-
return this.cache.config.isOpen;
|
|
8352
|
-
}
|
|
8353
|
-
update(){
|
|
8354
|
-
this.controller.style({
|
|
8355
|
-
display:"none",
|
|
8356
|
-
padding:"20px",
|
|
8357
|
-
overflow:"auto",
|
|
8358
|
-
background:"darkblue",
|
|
8359
|
-
color: "#eee",
|
|
8360
|
-
webkitboxSizing: "border-box",
|
|
8361
|
-
mozBoxSizing: "border-box",
|
|
8362
|
-
boxSizing:"border-box",
|
|
8363
|
-
});
|
|
8364
|
-
this.content.style({
|
|
8365
|
-
padding:"20px 40px",
|
|
8366
|
-
width: "100%",
|
|
8367
|
-
height: "100%",
|
|
8368
|
-
// overflowY:"auto",
|
|
8369
|
-
background:"gold",
|
|
8370
|
-
color: "#eee",
|
|
8371
|
-
webkitboxSizing: "border-box",
|
|
8372
|
-
mozBoxSizing: "border-box",
|
|
8373
|
-
boxSizing:"border-box",
|
|
8374
|
-
webkitOverflowScrolling:"touch",
|
|
8375
|
-
webkitTransformStyle: "preserve-3d"
|
|
8376
|
-
});
|
|
8377
|
-
this.setupPositions();
|
|
8378
|
-
this.setupWrapper();
|
|
8379
|
-
this.setupCover();
|
|
8380
|
-
this.setupMenu();
|
|
8381
|
-
this.setupContent();
|
|
8382
|
-
}
|
|
8383
|
-
setupPositions() {
|
|
8384
|
-
this.cache.config.menuTransformOpened = '';
|
|
8385
|
-
this.cache.config.contentTransformClosed = '';
|
|
8386
|
-
let menuAngle = this.cache.config.angle;
|
|
8387
|
-
let contentAngle = this.cache.config.angle / -2;
|
|
8388
|
-
switch( this.cache.config.position ) {
|
|
8389
|
-
case "top":
|
|
8390
|
-
this.cache.config.menuTransformOrigin = '50% 0%';
|
|
8391
|
-
this.cache.config.menuTransformClosed = `rotateX(${menuAngle}deg) translateY(-100%) translateY(${this.cache.config.overlap}px)`;
|
|
8392
|
-
this.cache.config.contentTransformOrigin = '50% 0';
|
|
8393
|
-
this.cache.config.contentTransformOpened = `translateY(${this.height/2}px) rotateX(${contentAngle}deg)`;
|
|
8394
|
-
break;
|
|
8395
|
-
case "right":
|
|
8396
|
-
this.cache.config.menuTransformOrigin = '100% 50%';
|
|
8397
|
-
this.cache.config.menuTransformClosed = 'rotateY( ' + menuAngle + 'deg ) translateX( 100% ) translateX( -2px ) scale( 1.01 )';
|
|
8398
|
-
this.cache.config.contentTransformOrigin = '100% 50%';
|
|
8399
|
-
this.cache.config.contentTransformOpened = 'translateX( -'+ this.width/2 +'px ) rotateY( ' + contentAngle + 'deg )';
|
|
8400
|
-
break;
|
|
8401
|
-
case "bottom":
|
|
8402
|
-
this.cache.config.menuTransformOrigin = '50% 100%';
|
|
8403
|
-
this.cache.config.menuTransformClosed = 'rotateX( ' + -menuAngle + 'deg ) translateY( 100% ) translateY( -'+ this.cache.config.overlap +'px )';
|
|
8404
|
-
this.cache.config.contentTransformOrigin = '50% 100%';
|
|
8405
|
-
this.cache.config.contentTransformOpened = 'translateY( -'+ this.height/2 +'px ) rotateX( ' + -contentAngle + 'deg )';
|
|
8406
|
-
break;
|
|
8407
|
-
default:
|
|
8408
|
-
this.cache.config.menuTransformOrigin = '100% 50%';
|
|
8409
|
-
this.cache.config.menuTransformClosed = 'translateX( -100% ) translateX( '+ this.cache.config.overlap +'px ) scale( 1.01 ) rotateY( ' + -menuAngle + 'deg )';
|
|
8410
|
-
this.cache.config.contentTransformOrigin = '0 50%';
|
|
8411
|
-
this.cache.config.contentTransformOpened = 'translateX( '+ this.width/2 +'px ) rotateY( ' + -contentAngle + 'deg )';
|
|
8412
|
-
break;
|
|
8413
|
-
}
|
|
8414
|
-
}
|
|
8415
|
-
setupWrapper() {
|
|
8416
|
-
this.style({
|
|
8417
|
-
perspective : "800px",
|
|
8418
|
-
perspectiveOrigin : this.cache.config.contentTransformOrigin
|
|
8419
|
-
});
|
|
8420
|
-
}
|
|
8421
|
-
setupCover(){
|
|
8422
|
-
if( this.cover ) this.cover.element.parentNode.removeChild( this.cover.element );
|
|
8423
|
-
this.cover=new ZikoUIElement("div","div").style({
|
|
8424
|
-
position:"absolute",
|
|
8425
|
-
display:"block",
|
|
8426
|
-
width:"100%",
|
|
8427
|
-
height:"100%",
|
|
8428
|
-
left:0,
|
|
8429
|
-
top:0,
|
|
8430
|
-
zIndex:1000,
|
|
8431
|
-
visibility:"hidden",
|
|
8432
|
-
opacity:0,
|
|
8433
|
-
transition: `all ${this.cache.config.transitionDuration} ${this.cache.config.transitionEasing}`
|
|
8434
|
-
});
|
|
8435
|
-
this.content.element.appendChild( this.cover.element );
|
|
8436
|
-
}
|
|
8437
|
-
setupMenu() {
|
|
8438
|
-
// var style = dom.menu.style;
|
|
8439
|
-
switch( this.cache.config.position ) {
|
|
8440
|
-
case "top":
|
|
8441
|
-
this.controller.style({
|
|
8442
|
-
width : "100%",
|
|
8443
|
-
height : `${this.height/2}px`
|
|
8444
|
-
});break;
|
|
8445
|
-
case "right":
|
|
8446
|
-
this.controller.style({
|
|
8447
|
-
right : 0,
|
|
8448
|
-
width : `${this.width/2}px`,
|
|
8449
|
-
height : "100%"
|
|
8450
|
-
});break;
|
|
8451
|
-
case "bottom":
|
|
8452
|
-
this.controller.style({
|
|
8453
|
-
bottom : "0",
|
|
8454
|
-
width : "100%",
|
|
8455
|
-
height : `${this.height/2}px`
|
|
8456
|
-
});break;
|
|
8457
|
-
case "left":
|
|
8458
|
-
this.controller.style({
|
|
8459
|
-
width : `${this.width/2}px`,
|
|
8460
|
-
height : "100%"
|
|
8461
|
-
});break;
|
|
8462
|
-
}
|
|
8463
|
-
this.controller.style({
|
|
8464
|
-
position : "fixed",
|
|
8465
|
-
display : "block",
|
|
8466
|
-
zIndex : 1,
|
|
8467
|
-
transform : this.cache.config.menuTransformClosed,
|
|
8468
|
-
transformOrigin : this.cache.config.menuTransformOrigin,
|
|
8469
|
-
transition : 'all ' + this.cache.config.transitionDuration +' '+ this.cache.config.transitionEasing
|
|
8470
|
-
});
|
|
8471
|
-
}
|
|
8472
|
-
setupContent() {
|
|
8473
|
-
this.content.style({
|
|
8474
|
-
transform : this.cache.config.contentTransformClosed,
|
|
8475
|
-
transformOrigin : this.cache.config.contentTransformOrigin,
|
|
8476
|
-
transition : `all ${this.cache.config.transitionDuration} ${this.cache.config.transitionEasing}`
|
|
8477
|
-
});
|
|
8478
|
-
}
|
|
8479
|
-
open(){
|
|
8480
|
-
if(!this.cache.config.isOpen){
|
|
8481
|
-
this.cache.config.isOpen = true;
|
|
8482
|
-
this.cover.style({
|
|
8483
|
-
height : this.content.element.scrollHeight + "px",
|
|
8484
|
-
visibility : "visible",
|
|
8485
|
-
opacity : 1,
|
|
8486
|
-
});
|
|
8487
|
-
if(this.cache.config.useTransfo)this.content.style({
|
|
8488
|
-
transform : this.cache.config.contentTransformOpened,
|
|
8489
|
-
userSelect : "default"
|
|
8490
|
-
});
|
|
8491
|
-
this.controller.style({
|
|
8492
|
-
transform : this.cache.config.menuTransformOpened,
|
|
8493
|
-
useSelect : "none"
|
|
8494
|
-
});
|
|
8495
|
-
this.emit("opened");
|
|
8496
|
-
}
|
|
8497
|
-
}
|
|
8498
|
-
close() {
|
|
8499
|
-
if( this.cache.config.isOpen ) {
|
|
8500
|
-
this.cache.config.isOpen = false;
|
|
8501
|
-
this.cover.style({
|
|
8502
|
-
// height : this.content.element.scrollHeight + "px",
|
|
8503
|
-
visibility : "hidden",
|
|
8504
|
-
opacity : 0,
|
|
8505
|
-
});
|
|
8506
|
-
this.content.style({
|
|
8507
|
-
transform : this.cache.config.contentTransformClosed,
|
|
8508
|
-
useSelect : "default"
|
|
8509
|
-
});
|
|
8510
|
-
this.controller.style({
|
|
8511
|
-
transform : this.cache.config.menuTransformClosed,
|
|
8512
|
-
userSelect : "none"
|
|
8513
|
-
});
|
|
8514
|
-
}
|
|
8515
|
-
this.emit("closed");
|
|
8516
|
-
}
|
|
8517
|
-
onOpen(callback){
|
|
8518
|
-
this.on("opened", callback.bind(this));
|
|
8519
|
-
return this;
|
|
8520
|
-
}
|
|
8521
|
-
onClose(callback){
|
|
8522
|
-
this.on("closed", callback.bind(this));
|
|
8523
|
-
return this;
|
|
8524
|
-
}
|
|
8525
|
-
#usePosition(position){
|
|
8526
|
-
if(this.cache.config.position!==position){
|
|
8527
|
-
this.cache.config.position=position;
|
|
8528
|
-
const isOpen = this.isOpen;
|
|
8529
|
-
this.close();
|
|
8530
|
-
this.update();
|
|
8531
|
-
if(isOpen)this.open();
|
|
8532
|
-
}
|
|
8533
|
-
}
|
|
8534
|
-
useRight(){
|
|
8535
|
-
this.#usePosition("left");
|
|
8536
|
-
return this;
|
|
8537
|
-
}
|
|
8538
|
-
useRight(){
|
|
8539
|
-
this.#usePosition("right");
|
|
8540
|
-
return this;
|
|
8541
|
-
}
|
|
8542
|
-
useTop(){
|
|
8543
|
-
this.#usePosition("top");
|
|
8544
|
-
return this;
|
|
8545
|
-
}
|
|
8546
|
-
useBottom(){
|
|
8547
|
-
this.#usePosition("bottom");
|
|
8548
|
-
return this;
|
|
8549
|
-
}
|
|
8550
|
-
}
|
|
8551
|
-
const menu3d = (controller, content) => new ZikoUIMenu3d(controller, content);
|
|
8552
|
-
globalThis.menu3d = menu3d;
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
/*
|
|
8556
|
-
|
|
8557
|
-
a = menu3d(Flex(text("Menu")), Flex(text("Content")))
|
|
8558
|
-
.size("80vw", "50vh")
|
|
8559
|
-
.style({ userSelect: "none" });
|
|
8560
|
-
a.onOpen((e) => console.log(e));
|
|
8561
|
-
a.open();
|
|
8562
|
-
a.controller.onSwipe(0.05, 1, (e) => {
|
|
8563
|
-
if (e.event.detail.direction.x === "left") a.close();
|
|
8564
|
-
});
|
|
8565
|
-
a.content.onSwipe(0.1, 1, (e) => {
|
|
8566
|
-
if (e.event.detail.direction.x === "left") a.close();
|
|
8567
|
-
if (e.event.detail.direction.x === "right") a.open();
|
|
8568
|
-
});
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
*/
|
|
8572
|
-
|
|
8573
|
-
class ZikoUIModal extends ZikoUIContainerElement{
|
|
8574
|
-
constructor(...UIElements){
|
|
8575
|
-
super("dialog", "modal");
|
|
8576
|
-
this.append(...UIElements);
|
|
8577
|
-
Object.assign(this.cache,{
|
|
8578
|
-
config:{
|
|
8579
|
-
mode:"modal",
|
|
8580
|
-
useTransition:true
|
|
8581
|
-
}
|
|
8582
|
-
});
|
|
8583
|
-
this.style({
|
|
8584
|
-
display:"flex",
|
|
8585
|
-
justifyContent:"center",
|
|
8586
|
-
alignItems:"center",
|
|
8587
|
-
position: "absolute",
|
|
8588
|
-
top: "50%",
|
|
8589
|
-
left: "50%",
|
|
8590
|
-
transform: "translate(-50%, -50%)",
|
|
8591
|
-
padding: "20px",
|
|
8592
|
-
border: "none",
|
|
8593
|
-
backgroundCcolor: "#f5f5f5",
|
|
8594
|
-
boxShadow: "0px 4px 10px rgba(0, 0, 0, 0.1)",
|
|
8595
|
-
borderRadius: "8px"
|
|
8596
|
-
});
|
|
8597
|
-
this.close();
|
|
8598
|
-
}
|
|
8599
|
-
open(){
|
|
8600
|
-
if(!this.element.open){
|
|
8601
|
-
switch(this.cache.config.mode){
|
|
8602
|
-
case "modal": this.element.showModal(); break;
|
|
8603
|
-
case "dialog": this.element.show(); break;
|
|
8604
|
-
default : this.element.show(); break;
|
|
8605
|
-
}
|
|
8606
|
-
// this.style({
|
|
8607
|
-
// display : "flex",
|
|
8608
|
-
// })
|
|
8609
|
-
this.st.fadeIn(1000);
|
|
8610
|
-
this.emit("modal:opened");
|
|
8611
|
-
}
|
|
8612
|
-
return this;
|
|
8613
|
-
}
|
|
8614
|
-
close(){
|
|
8615
|
-
// this.style({
|
|
8616
|
-
// display : "none"
|
|
8617
|
-
// })
|
|
8618
|
-
this.st.fadeOut(1000);
|
|
8619
|
-
if(this.element.open){
|
|
8620
|
-
this.element.close();
|
|
8621
|
-
}
|
|
8622
|
-
this.emit("modal:closed");
|
|
8623
|
-
return this;
|
|
8624
|
-
}
|
|
8625
|
-
closeAfter(t = 1000){
|
|
8626
|
-
globalThis?.setTimeout(()=>this.close(), t);
|
|
8627
|
-
return this;
|
|
8628
|
-
}
|
|
8629
|
-
onOpen(callback){
|
|
8630
|
-
this.on("modal:opened",callback.bind(this));
|
|
8631
|
-
return this;
|
|
8632
|
-
}
|
|
8633
|
-
onClose(callback){
|
|
8634
|
-
this.on("modal:closed",callback.bind(this));
|
|
8635
|
-
return this;
|
|
8636
|
-
}
|
|
8637
|
-
useModal(){
|
|
8638
|
-
this.cache.config.mode = "modal";
|
|
8639
|
-
return this;
|
|
8640
|
-
}
|
|
8641
|
-
useDialog(){
|
|
8642
|
-
this.cache.config.mode = "dialog";
|
|
8643
|
-
return this;
|
|
8644
|
-
}
|
|
8645
|
-
useTransition(enabled = true){
|
|
8646
|
-
this.cache.config.useTransition = enabled;
|
|
8647
|
-
return this;
|
|
8648
|
-
}
|
|
8649
|
-
}
|
|
8650
|
-
|
|
8651
|
-
const Modal=(...UIElements)=>new ZikoUIModal(...UIElements);
|
|
8652
|
-
|
|
8653
|
-
/*
|
|
8654
|
-
a=Modal(text("Hello")).style({
|
|
8655
|
-
width:"100%",
|
|
8656
|
-
height:"100%"
|
|
8657
|
-
})
|
|
8658
|
-
Flex(a).size("400px","400px").style({border:"1px red solid"})
|
|
8659
|
-
*/
|
|
8660
|
-
|
|
8661
|
-
class __ZikoUISlider__ extends ZikoUISection{
|
|
8662
|
-
constructor(){
|
|
8663
|
-
super("section","");
|
|
8664
|
-
Object.assign(this.cache,{
|
|
8665
|
-
currentIndex : 0,
|
|
8666
|
-
slideBuilder : null,
|
|
8667
|
-
});
|
|
8668
|
-
this.container = Flex().size("100%","100%").vertical(0,0).style({
|
|
8669
|
-
// width:"100%",
|
|
8670
|
-
overflow:"hidden"
|
|
8671
|
-
});
|
|
8672
|
-
// this.style({
|
|
8673
|
-
// // width:"100%",
|
|
8674
|
-
// overflow:"hidden"
|
|
8675
|
-
// });
|
|
8676
|
-
this.container.setAttr({
|
|
8677
|
-
ariaRoledescription : "carousel",
|
|
8678
|
-
ariaLive: "polite",
|
|
8679
|
-
ariaLabel : "Content Slider"
|
|
8680
|
-
});
|
|
8681
|
-
this.track = Section().size("100%","100%").style({
|
|
8682
|
-
transition : "transform 0.3s ease-in-out",
|
|
8683
|
-
});
|
|
8684
|
-
this.bullets = Flex().style({
|
|
8685
|
-
// position : "absolute",
|
|
8686
|
-
// top : 0,
|
|
8687
|
-
gap : "10px",
|
|
8688
|
-
padding:"10px",
|
|
8689
|
-
});
|
|
8690
|
-
this.container.append(
|
|
8691
|
-
this.track,
|
|
8692
|
-
this.bullets
|
|
8693
|
-
);
|
|
8694
|
-
this.append(this.container);
|
|
8695
|
-
}
|
|
8696
|
-
#updateAriaHidden(){
|
|
8697
|
-
for(let i=0;i<this.track.items.length;i++){
|
|
8698
|
-
this.track[i].setAttr({
|
|
8699
|
-
ariaHidden : (i!==this.cache.currentIndex)
|
|
8700
|
-
});
|
|
8701
|
-
}
|
|
8702
|
-
}
|
|
8703
|
-
goto(n = 0){
|
|
8704
|
-
this.cache.currentIndex = n;
|
|
8705
|
-
this.__updatePos();
|
|
8706
|
-
this.#updateAriaHidden();
|
|
8707
|
-
}
|
|
8708
|
-
next(n = 1){
|
|
8709
|
-
this.cache.currentIndex += n;
|
|
8710
|
-
this.__updatePos();
|
|
8711
|
-
this.#updateAriaHidden();
|
|
8712
|
-
return this;
|
|
8713
|
-
}
|
|
8714
|
-
previous(n = 1){
|
|
8715
|
-
this.cache.currentIndex -= n;
|
|
8716
|
-
this.__updatePos();
|
|
8717
|
-
this.#updateAriaHidden();
|
|
8718
|
-
return this;
|
|
8719
|
-
}
|
|
8720
|
-
#update(){
|
|
8721
|
-
const length = this.track.items.length;
|
|
8722
|
-
for(let i=0;i<length;i++){
|
|
8723
|
-
this.track.items[i].setAttr({
|
|
8724
|
-
ariaLabel : `Slide ${i+1} of ${length}`,
|
|
8725
|
-
dataSlideIndex : i
|
|
8726
|
-
});
|
|
8727
|
-
this.bullets.items[i].setAttr({
|
|
8728
|
-
dataIndex : i,
|
|
8729
|
-
ariaLabel : `Go to slide ${i}`
|
|
8730
|
-
});
|
|
8731
|
-
this.bullets[i].events.click?.destroy();
|
|
8732
|
-
this.bullets[i].onClick(()=>this.goto(i));
|
|
8733
|
-
}
|
|
8734
|
-
}
|
|
8735
|
-
#addSlide(UIElement){
|
|
8736
|
-
this.track.append(this.cache.slideBuilder(UIElement).setAttr({
|
|
8737
|
-
ariaRoledescription : "slide",
|
|
8738
|
-
role : "group",
|
|
8739
|
-
ariaLabel : "" // link to update
|
|
8740
|
-
}));
|
|
8741
|
-
const bullet = text$1().size("15px","15px").style({
|
|
8742
|
-
borderRadius:"50%",
|
|
8743
|
-
cursor : "pointer",
|
|
8744
|
-
border : "3px solid blue",
|
|
8745
|
-
background : "white"
|
|
8746
|
-
}).setAttr({
|
|
8747
|
-
role : "button",
|
|
8748
|
-
tabIndex : 0
|
|
8749
|
-
})
|
|
8750
|
-
.onPtrEnter(e=>e.target.st.background("gold").scale(1.2,1.2))
|
|
8751
|
-
.onPtrLeave(e=>e.target.st.background("white").scale(1,1));
|
|
8752
|
-
this.bullets.append(
|
|
8753
|
-
bullet
|
|
8754
|
-
);
|
|
8755
|
-
return this;
|
|
8756
|
-
}
|
|
8757
|
-
addSlides(...slides){
|
|
8758
|
-
slides.forEach(n=>this.#addSlide(n));
|
|
8759
|
-
this.#update();
|
|
8760
|
-
this.#updateAriaHidden();
|
|
8761
|
-
return this;
|
|
8762
|
-
}
|
|
8763
|
-
}
|
|
8764
|
-
|
|
8765
|
-
class ZikoUIHorizontalSlider extends __ZikoUISlider__{
|
|
8766
|
-
constructor(...slides){
|
|
8767
|
-
super("section","hSlider");
|
|
8768
|
-
this.container.vertical(0,0);
|
|
8769
|
-
Object.assign(this.cache,{
|
|
8770
|
-
slideBuilder : (UIElement) => Flex(UIElement).style({
|
|
8771
|
-
minWidth : "100%",
|
|
8772
|
-
width:"100%",
|
|
8773
|
-
height:"100%",
|
|
8774
|
-
}).vertical(0,0)
|
|
8775
|
-
});
|
|
8776
|
-
this.track.size("100%","90%").style({
|
|
8777
|
-
display : "flex"
|
|
8778
|
-
});
|
|
8779
|
-
this.addSlides(...slides);
|
|
8780
|
-
this.bullets.horizontal(0,0).style({
|
|
8781
|
-
width : "100%",
|
|
8782
|
-
height : "10%",
|
|
8783
|
-
});
|
|
8784
|
-
}
|
|
8785
|
-
__updatePos(){
|
|
8786
|
-
const width = this.container.width;
|
|
8787
|
-
this.track.st.translateX(-this.cache.currentIndex * width);
|
|
8788
|
-
}
|
|
8789
|
-
|
|
8790
|
-
}
|
|
8791
|
-
|
|
8792
|
-
const hSlider=(...slides)=>new ZikoUIHorizontalSlider(...slides);
|
|
8793
|
-
|
|
8794
|
-
class ZikoUIVerticalSlider extends __ZikoUISlider__{
|
|
8795
|
-
constructor(...slides){
|
|
8796
|
-
super("section","vSlider");
|
|
8797
|
-
Object.assign(this.cache,{
|
|
8798
|
-
slideBuilder : (UIElement) => Flex(UIElement).size("100%","100%").vertical(0, 0)
|
|
8799
|
-
});
|
|
8800
|
-
this.addSlides(...slides);
|
|
8801
|
-
this.container.horizontal(0,0);
|
|
8802
|
-
this.track.size("90%","100%");
|
|
8803
|
-
this.bullets.vertical(0,0).style({
|
|
8804
|
-
height : "100%",
|
|
8805
|
-
width : "10%"
|
|
8806
|
-
});
|
|
8807
|
-
}
|
|
8808
|
-
__updatePos(){
|
|
8809
|
-
const height = this.container.height;
|
|
8810
|
-
this.track.st.translateY(-this.cache.currentIndex * height);
|
|
8811
|
-
}
|
|
8812
|
-
}
|
|
8813
|
-
|
|
8814
|
-
const vSlider=(...slides)=>new ZikoUIVerticalSlider(...slides);
|
|
8815
|
-
|
|
8816
|
-
const Slider = ({orintation = "horizontal",slides = []}) =>{
|
|
8817
|
-
if(["v","vertical"].includes(orintation.toLowerCase())) return vSlider(...slides);
|
|
8818
|
-
else if(["h","horizontal"].includes(orintation.toLowerCase())) return hSlider(...slides);
|
|
8819
|
-
else ;
|
|
8820
|
-
};
|
|
8821
|
-
|
|
8822
|
-
var Derived = /*#__PURE__*/Object.freeze({
|
|
8823
|
-
__proto__: null,
|
|
8824
|
-
Accordion: Accordion,
|
|
8825
|
-
Breadcrumbs: Breadcrumbs,
|
|
8826
|
-
Carousel: Carousel,
|
|
8827
|
-
CodeCell: CodeCell,
|
|
8828
|
-
CodeNote: CodeNote,
|
|
8829
|
-
Collapsible: Collapsible,
|
|
8830
|
-
Flex: Flex$1,
|
|
8831
|
-
Grid: Grid$1,
|
|
8832
|
-
Modal: Modal,
|
|
8833
|
-
Slider: Slider,
|
|
8834
|
-
Splitter: Splitter,
|
|
8835
|
-
Tabs: Tabs,
|
|
8836
|
-
ZikoUIAccordion: ZikoUIAccordion,
|
|
8837
|
-
ZikoUIBreadcrumbs: ZikoUIBreadcrumbs,
|
|
8838
|
-
ZikoUICodeNote: ZikoUICodeNote,
|
|
8839
|
-
ZikoUIFlex: ZikoUIFlex$1,
|
|
8840
|
-
ZikoUIGrid: ZikoUIGrid,
|
|
8841
|
-
ZikoUIHorizontalSlider: ZikoUIHorizontalSlider,
|
|
8842
|
-
ZikoUIHorizontalSplitter: ZikoUIHorizontalSplitter,
|
|
8843
|
-
ZikoUIMenu3d: ZikoUIMenu3d,
|
|
8844
|
-
ZikoUIModal: ZikoUIModal,
|
|
8845
|
-
ZikoUIVerticalSlider: ZikoUIVerticalSlider,
|
|
8846
|
-
ZikoUIVerticalSplitter: ZikoUIVerticalSplitter,
|
|
8847
|
-
dangerAlert: dangerAlert,
|
|
8848
|
-
hSlider: hSlider,
|
|
8849
|
-
hSplitter: hSplitter,
|
|
8850
|
-
infoAlert: infoAlert,
|
|
8851
|
-
menu3d: menu3d,
|
|
8852
|
-
successAlert: successAlert,
|
|
8853
|
-
vSlider: vSlider,
|
|
8854
|
-
vSplitter: vSplitter,
|
|
8855
|
-
warningAlert: warningAlert
|
|
8856
|
-
});
|
|
8857
|
-
|
|
8858
|
-
const UI$1 = {
|
|
8859
|
-
...Text$1,
|
|
8860
|
-
...List,
|
|
8861
|
-
...Io,
|
|
8862
|
-
...Media,
|
|
8863
|
-
...Table,
|
|
8864
|
-
...Semantic,
|
|
8865
|
-
...Misc,
|
|
8866
|
-
...Derived,
|
|
8867
|
-
ZikoUIElement,
|
|
8868
|
-
ZikoUIContainerElement
|
|
8869
|
-
};
|
|
6879
|
+
const UI$1 = {
|
|
6880
|
+
...Text$1,
|
|
6881
|
+
...List,
|
|
6882
|
+
...Io,
|
|
6883
|
+
...Media,
|
|
6884
|
+
...Table,
|
|
6885
|
+
...Semantic,
|
|
6886
|
+
...Misc,
|
|
6887
|
+
...Flex$1,
|
|
6888
|
+
...Grid$2,
|
|
6889
|
+
ZikoUIElement,
|
|
6890
|
+
};
|
|
8870
6891
|
|
|
8871
6892
|
const svg2str=svg=>(new XMLSerializer()).serializeToString(svg);
|
|
8872
6893
|
const svg2ascii=svg=>btoa(svg2str(svg));
|
|
@@ -9012,9 +7033,11 @@ function trimKeys(obj) {
|
|
|
9012
7033
|
}, Array.isArray(obj) ? [] : {});
|
|
9013
7034
|
}
|
|
9014
7035
|
|
|
7036
|
+
// export { markdown2html } from "./markdown.js";
|
|
7037
|
+
// export { adoc2html } from "./adoc.js";
|
|
7038
|
+
|
|
9015
7039
|
var Converter = /*#__PURE__*/Object.freeze({
|
|
9016
7040
|
__proto__: null,
|
|
9017
|
-
adoc2html: adoc2html,
|
|
9018
7041
|
arr2str: arr2str,
|
|
9019
7042
|
csv2arr: csv2arr,
|
|
9020
7043
|
csv2json: csv2json,
|
|
@@ -9029,7 +7052,6 @@ var Converter = /*#__PURE__*/Object.freeze({
|
|
|
9029
7052
|
json2xmlFile: json2xmlFile,
|
|
9030
7053
|
json2yml: json2yml,
|
|
9031
7054
|
json2ymlFile: json2ymlFile,
|
|
9032
|
-
markdown2html: markdown2html,
|
|
9033
7055
|
obj2str: obj2str,
|
|
9034
7056
|
svg2ascii: svg2ascii,
|
|
9035
7057
|
svg2img: svg2img,
|
|
@@ -10402,7 +8424,7 @@ const Math$1 = {
|
|
|
10402
8424
|
...__Calculus__,
|
|
10403
8425
|
};
|
|
10404
8426
|
|
|
10405
|
-
class ZikoUISvg extends
|
|
8427
|
+
class ZikoUISvg extends ZikoUIElement {
|
|
10406
8428
|
constructor(w=360,h=300) {
|
|
10407
8429
|
super("svg","svg");
|
|
10408
8430
|
//this.cache={};
|
|
@@ -10467,439 +8489,14 @@ class ZikoUISvg extends ZikoUIContainerElement {
|
|
|
10467
8489
|
|
|
10468
8490
|
const Svg =(w,h)=>new ZikoUISvg(w,h);
|
|
10469
8491
|
|
|
10470
|
-
class ZikoSvgElement extends ZikoUIElement{
|
|
10471
|
-
constructor(type) {
|
|
10472
|
-
super();
|
|
10473
|
-
Object.assign(this.cache,{
|
|
10474
|
-
type
|
|
10475
|
-
});
|
|
10476
|
-
}
|
|
10477
|
-
pos(x,y){
|
|
10478
|
-
return this.posX(x).posY(y);
|
|
10479
|
-
}
|
|
10480
|
-
posX(x){
|
|
10481
|
-
if(["circle","ellipse"].includes(this.cache.type))this.element.cx.baseVal.value=x;
|
|
10482
|
-
else this.element.x.baseVal.value=x;
|
|
10483
|
-
return this;
|
|
10484
|
-
}
|
|
10485
|
-
posY(y){
|
|
10486
|
-
if(["circle","ellipse"].includes(this.cache.type))this.element.cy.baseVal.value=y;
|
|
10487
|
-
else this.element.y.baseVal.value=y;
|
|
10488
|
-
return this;
|
|
10489
|
-
}
|
|
10490
|
-
translate(x,y){
|
|
10491
|
-
return this;
|
|
10492
|
-
}
|
|
10493
|
-
color({ stroke, fill }) {
|
|
10494
|
-
this.element?.setAttribute("stroke", stroke);
|
|
10495
|
-
this.element?.setAttribute("fill", fill);
|
|
10496
|
-
return this;
|
|
10497
|
-
}
|
|
10498
|
-
fill(color = "none") {
|
|
10499
|
-
this.element?.setAttribute("fill", color);
|
|
10500
|
-
return this;
|
|
10501
|
-
}
|
|
10502
|
-
stroke(color = "none", width) {
|
|
10503
|
-
this.element?.setAttribute("stroke", color);
|
|
10504
|
-
width && this.strokeWidth(width);
|
|
10505
|
-
return this;
|
|
10506
|
-
}
|
|
10507
|
-
strokeWidth(width = 1) {
|
|
10508
|
-
this.element?.setAttribute("stroke-width", width);
|
|
10509
|
-
return this;
|
|
10510
|
-
}
|
|
10511
|
-
opacity(value = 1) {
|
|
10512
|
-
this.element?.setAttribute("opacity", value);
|
|
10513
|
-
return this;
|
|
10514
|
-
}
|
|
10515
|
-
}
|
|
10516
|
-
|
|
10517
|
-
class ZikoSvgCircle extends ZikoSvgElement{
|
|
10518
|
-
constructor(cx,cy,r){
|
|
10519
|
-
super("circle");
|
|
10520
|
-
this.element=document.createElementNS(
|
|
10521
|
-
"http://www.w3.org/2000/svg",
|
|
10522
|
-
"circle",
|
|
10523
|
-
);
|
|
10524
|
-
this.pos(cx,cy).setR(r);
|
|
10525
|
-
}
|
|
10526
|
-
setR(r){
|
|
10527
|
-
this.element.r.baseVal.value=r;
|
|
10528
|
-
return this;
|
|
10529
|
-
}
|
|
10530
|
-
get r(){
|
|
10531
|
-
return this.element.baseVal.value;
|
|
10532
|
-
}
|
|
10533
|
-
get cx(){
|
|
10534
|
-
return this.element.baseVal.value;
|
|
10535
|
-
}
|
|
10536
|
-
get cy(){
|
|
10537
|
-
return this.element.baseVal.value;
|
|
10538
|
-
}
|
|
10539
|
-
}
|
|
10540
|
-
const svgCircle=(x,y,r)=>new ZikoSvgCircle(x,y,r);
|
|
10541
|
-
|
|
10542
|
-
class ZikoSvgEllipse extends ZikoSvgElement{
|
|
10543
|
-
constructor(cx,cy,rx,ry){
|
|
10544
|
-
super("ellipse");
|
|
10545
|
-
this.element=document?.createElementNS(
|
|
10546
|
-
"http://www.w3.org/2000/svg",
|
|
10547
|
-
"ellipse",
|
|
10548
|
-
);
|
|
10549
|
-
this.pos(cx,cy).setRx(rx).setRy(ry);
|
|
10550
|
-
}
|
|
10551
|
-
setRx(rx){
|
|
10552
|
-
this.element.rx.baseVal.value=rx;
|
|
10553
|
-
return this;
|
|
10554
|
-
}
|
|
10555
|
-
setRy(ry){
|
|
10556
|
-
this.element.ry.baseVal.value=ry;
|
|
10557
|
-
return this;
|
|
10558
|
-
}
|
|
10559
|
-
}
|
|
10560
|
-
const svgEllipse=(x,y,rx,ry)=>new ZikoSvgEllipse(x,y,rx,ry);
|
|
10561
|
-
|
|
10562
|
-
class ZikoSvgForeignObject extends ZikoSvgElement{
|
|
10563
|
-
constructor(x=0,y=0,w="100%",h="100%",...ZikoUIElement){
|
|
10564
|
-
super("foreignObject");
|
|
10565
|
-
this.items=[];
|
|
10566
|
-
this.element=document?.createElementNS(
|
|
10567
|
-
"http://www.w3.org/2000/svg",
|
|
10568
|
-
"foreignObject",
|
|
10569
|
-
);
|
|
10570
|
-
this.container=Flex$1().setTarget(this.element).vertical(0,0).size("auto","auto");
|
|
10571
|
-
this.container.st.scaleY(-1);
|
|
10572
|
-
this.posX(x).posY(y).width(w).height(h);
|
|
10573
|
-
}
|
|
10574
|
-
width(w){
|
|
10575
|
-
this.element.etAttribute("width",w);
|
|
10576
|
-
return this;
|
|
10577
|
-
}
|
|
10578
|
-
height(h){
|
|
10579
|
-
this.element.etAttribute("height",h);
|
|
10580
|
-
return this;
|
|
10581
|
-
}
|
|
10582
|
-
add(...ZikoUIElement){
|
|
10583
|
-
this.container.append(...ZikoUIElement);
|
|
10584
|
-
return this;
|
|
10585
|
-
}
|
|
10586
|
-
remove(...ZikoUIElement){
|
|
10587
|
-
this.container.append(...ZikoUIElement);
|
|
10588
|
-
return this;
|
|
10589
|
-
}
|
|
10590
|
-
}
|
|
10591
|
-
const svgObject=(x, y, w, h)=>new ZikoSvgForeignObject(x, y, w, h);
|
|
10592
|
-
|
|
10593
|
-
class ZikoSvgGroupe extends ZikoSvgElement{
|
|
10594
|
-
constructor(...svgElement){
|
|
10595
|
-
super();
|
|
10596
|
-
this.items=[];
|
|
10597
|
-
this.element=document?.createElementNS(
|
|
10598
|
-
"http://www.w3.org/2000/svg",
|
|
10599
|
-
"g",
|
|
10600
|
-
);
|
|
10601
|
-
this.add(...svgElement);
|
|
10602
|
-
}
|
|
10603
|
-
add(...svgElement){
|
|
10604
|
-
for(let i=0;i<svgElement.length;i++){
|
|
10605
|
-
this.element?.appendChild(svgElement[i].element);
|
|
10606
|
-
this.items.push(svgElement[i]);
|
|
10607
|
-
}
|
|
10608
|
-
if(svgElement.length===1)return svgElement[0]
|
|
10609
|
-
return svgElement;
|
|
10610
|
-
}
|
|
10611
|
-
remove(...svgElement){
|
|
10612
|
-
for(let i=0;i<svgElement.length;i++){
|
|
10613
|
-
this.element?.removeChild(svgElement[i].element);
|
|
10614
|
-
this.items=this.items.filter(n=>n!=svgElement);
|
|
10615
|
-
}
|
|
10616
|
-
return this;
|
|
10617
|
-
}
|
|
10618
|
-
}
|
|
10619
|
-
const svgGroupe=(...svgElement)=>new ZikoSvgGroupe(...svgElement);
|
|
10620
|
-
|
|
10621
|
-
class ZikoSvgImage extends ZikoSvgElement{
|
|
10622
|
-
constructor(src="",w="100%",h="100%",x=0,y=0){
|
|
10623
|
-
super();
|
|
10624
|
-
this.element=document?.createElementNS(
|
|
10625
|
-
"http://www.w3.org/2000/svg",
|
|
10626
|
-
"image",
|
|
10627
|
-
);
|
|
10628
|
-
this.setSrc(src).width(w).height(h).x(x).y(y);
|
|
10629
|
-
}
|
|
10630
|
-
x(x){
|
|
10631
|
-
this.element.x.baseVal.value=x;
|
|
10632
|
-
return this;
|
|
10633
|
-
}
|
|
10634
|
-
y(y){
|
|
10635
|
-
this.element.y.baseVal.value=y;
|
|
10636
|
-
return this;
|
|
10637
|
-
}
|
|
10638
|
-
width(w){
|
|
10639
|
-
this.element?.setAttribute("width",w);
|
|
10640
|
-
return this;
|
|
10641
|
-
}
|
|
10642
|
-
height(h){
|
|
10643
|
-
this.element?.setAttribute("height",h);
|
|
10644
|
-
return this;
|
|
10645
|
-
}
|
|
10646
|
-
setSrc(src=""){
|
|
10647
|
-
this.element?.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', src);
|
|
10648
|
-
return this;
|
|
10649
|
-
}
|
|
10650
|
-
}
|
|
10651
|
-
const svgImage=(src,w,h,x,y)=>new ZikoSvgImage(src,w,h,x,y);
|
|
10652
|
-
|
|
10653
|
-
class ZikoSvgLine extends ZikoSvgElement{
|
|
10654
|
-
constructor(x1,y1,x2,y2){
|
|
10655
|
-
super();
|
|
10656
|
-
this.element=document?.createElementNS(
|
|
10657
|
-
"http://www.w3.org/2000/svg",
|
|
10658
|
-
"line",
|
|
10659
|
-
);
|
|
10660
|
-
this.x1(x1).y1(y1).x2(x2).y2(y2).stroke("black");
|
|
10661
|
-
}
|
|
10662
|
-
x1(x1){
|
|
10663
|
-
this.element.x1.baseVal.value=x1;
|
|
10664
|
-
return this;
|
|
10665
|
-
}
|
|
10666
|
-
y1(y1){
|
|
10667
|
-
this.element.y1.baseVal.value=y1;
|
|
10668
|
-
return this;
|
|
10669
|
-
}
|
|
10670
|
-
x2(x2){
|
|
10671
|
-
this.element.x2.baseVal.value=x2;
|
|
10672
|
-
return this;
|
|
10673
|
-
}
|
|
10674
|
-
y2(y2){
|
|
10675
|
-
this.element.y2.baseVal.value=y2;
|
|
10676
|
-
return this;
|
|
10677
|
-
}
|
|
10678
|
-
}
|
|
10679
|
-
const svgLine=(x1,y1,x2,y2)=>new ZikoSvgLine(x1,y1,x2,y2);
|
|
10680
|
-
|
|
10681
|
-
class ZikoSvgLink extends ZikoSvgElement{
|
|
10682
|
-
constructor(href,...svgElement){
|
|
10683
|
-
super();
|
|
10684
|
-
this.items=[];
|
|
10685
|
-
this.element=document?.createElementNS(
|
|
10686
|
-
"http://www.w3.org/2000/svg",
|
|
10687
|
-
"a",
|
|
10688
|
-
);
|
|
10689
|
-
this.element.etAttribute("href",href);
|
|
10690
|
-
this.add(...svgElement);
|
|
10691
|
-
}
|
|
10692
|
-
add(...svgElement){
|
|
10693
|
-
for(let i=0;i<svgElement.length;i++){
|
|
10694
|
-
this.element.ppendChild(svgElement[i].element);
|
|
10695
|
-
this.items.push(svgElement[i]);
|
|
10696
|
-
}
|
|
10697
|
-
if(svgElement.length===1)return svgElement[0]
|
|
10698
|
-
return svgElement;
|
|
10699
|
-
}
|
|
10700
|
-
remove(...svgElement){
|
|
10701
|
-
for(let i=0;i<svgElement.length;i++){
|
|
10702
|
-
this.element.moveChild(svgElement[i].element);
|
|
10703
|
-
this.items=this.items.filter(n=>n!=svgElement);
|
|
10704
|
-
}
|
|
10705
|
-
return this;
|
|
10706
|
-
}
|
|
10707
|
-
}
|
|
10708
|
-
const svgLink=(href,...svgElement)=>new ZikoSvgLink(href,...svgElement);
|
|
10709
|
-
|
|
10710
|
-
class ZikoSvgPath extends ZikoSvgElement{
|
|
10711
|
-
constructor(){
|
|
10712
|
-
super();
|
|
10713
|
-
this.element=document?.createElementNS(
|
|
10714
|
-
"http://www.w3.org/2000/svg",
|
|
10715
|
-
"path",
|
|
10716
|
-
);
|
|
10717
|
-
this.path="";
|
|
10718
|
-
|
|
10719
|
-
}
|
|
10720
|
-
setPath(){
|
|
10721
|
-
this.element.etAttribute("d",this.path);
|
|
10722
|
-
return this;
|
|
10723
|
-
}
|
|
10724
|
-
clear(){
|
|
10725
|
-
this.path="";
|
|
10726
|
-
this.setPath();
|
|
10727
|
-
return this;
|
|
10728
|
-
}
|
|
10729
|
-
moveTo(x,y){
|
|
10730
|
-
this.path+=`M${x} ${y} `;
|
|
10731
|
-
this.setPath();
|
|
10732
|
-
return this;
|
|
10733
|
-
}
|
|
10734
|
-
lineTo(x,y){
|
|
10735
|
-
this.path+=`L${x} ${y} `;
|
|
10736
|
-
this.setPath();
|
|
10737
|
-
return this;
|
|
10738
|
-
}
|
|
10739
|
-
hr(x){
|
|
10740
|
-
this.path+=`H${x} `;
|
|
10741
|
-
this.setPath();
|
|
10742
|
-
return this;
|
|
10743
|
-
}
|
|
10744
|
-
vr(y){
|
|
10745
|
-
this.path+=`V${y} `;
|
|
10746
|
-
this.setPath();
|
|
10747
|
-
return this;
|
|
10748
|
-
}
|
|
10749
|
-
bezier(x1,y1,x2,y2,x,y){
|
|
10750
|
-
this.path+=`C ${x1} ${y1},${x2} ${y2},${x} ${y} `;
|
|
10751
|
-
this.setPath();
|
|
10752
|
-
return this;
|
|
10753
|
-
}
|
|
10754
|
-
quadratic(x1,y1,x,y){
|
|
10755
|
-
this.path+=`Q ${x1} ${y1} ${x} ${y} `;
|
|
10756
|
-
this.setPath();
|
|
10757
|
-
return this;
|
|
10758
|
-
}
|
|
10759
|
-
close(){
|
|
10760
|
-
this.path+="Z";
|
|
10761
|
-
this.setPath();
|
|
10762
|
-
return this;
|
|
10763
|
-
}
|
|
10764
|
-
}
|
|
10765
|
-
|
|
10766
|
-
const svgPath=()=>new ZikoSvgPath();
|
|
10767
|
-
|
|
10768
|
-
class ZikoSvgPolygon extends ZikoSvgElement{
|
|
10769
|
-
constructor(X=[],Y=[]){
|
|
10770
|
-
super();
|
|
10771
|
-
this.X=X;
|
|
10772
|
-
this.Y=Y;
|
|
10773
|
-
this.element=document?.createElementNS(
|
|
10774
|
-
"http://www.w3.org/2000/svg",
|
|
10775
|
-
"polygon",
|
|
10776
|
-
);
|
|
10777
|
-
this.element?.setAttribute("points","");
|
|
10778
|
-
this.addPoints(X,Y);
|
|
10779
|
-
}
|
|
10780
|
-
addPoint(x,y){
|
|
10781
|
-
let p=this.element.parentElement.createSVGPoint();
|
|
10782
|
-
p.x=x;
|
|
10783
|
-
p.y=y;
|
|
10784
|
-
this.element.points.appendItem(p);
|
|
10785
|
-
return this;
|
|
10786
|
-
}
|
|
10787
|
-
addPoints(X,Y){
|
|
10788
|
-
for(let i=0;i<X.length;i++){
|
|
10789
|
-
let p=this.element.parentElement.createSVGPoint();
|
|
10790
|
-
p.x=X[i];
|
|
10791
|
-
p.y=Y[i];
|
|
10792
|
-
this.element.oints.appendItem(p);
|
|
10793
|
-
}
|
|
10794
|
-
return this;
|
|
10795
|
-
}
|
|
10796
|
-
}
|
|
10797
|
-
const svgPolygon=(X,Y)=>new ZikoSvgPolygon(X,Y);
|
|
10798
|
-
|
|
10799
|
-
class ZikoSvgRectangle extends ZikoSvgElement{
|
|
10800
|
-
constructor(x,y,w,h,center=true){
|
|
10801
|
-
super();
|
|
10802
|
-
this.element=document?.createElementNS(
|
|
10803
|
-
"http://www.w3.org/2000/svg",
|
|
10804
|
-
"rect",
|
|
10805
|
-
);
|
|
10806
|
-
this.setX(x).setY(y).width(w).height(h);
|
|
10807
|
-
this.rx=this.x+this.w/2;
|
|
10808
|
-
this.ty=this.y+this.h/2;
|
|
10809
|
-
}
|
|
10810
|
-
setX(x){
|
|
10811
|
-
this.element.x.baseVal.value=x;
|
|
10812
|
-
this.x=x;
|
|
10813
|
-
return this;
|
|
10814
|
-
}
|
|
10815
|
-
setY(y){
|
|
10816
|
-
this.element.y.baseVal.value=y;
|
|
10817
|
-
this.y=y;
|
|
10818
|
-
return this;
|
|
10819
|
-
}
|
|
10820
|
-
r(rx,ry){
|
|
10821
|
-
this.rx=rx;
|
|
10822
|
-
this.ry=ry;
|
|
10823
|
-
this.setX(this.rx-this.w/2);
|
|
10824
|
-
this.setY(this.ry-this.h/2);
|
|
10825
|
-
return this;
|
|
10826
|
-
}
|
|
10827
|
-
width(w){
|
|
10828
|
-
this.element.width.baseVal.value=w;
|
|
10829
|
-
this.w=w;
|
|
10830
|
-
return this;
|
|
10831
|
-
}
|
|
10832
|
-
height(h){
|
|
10833
|
-
this.element.height.baseVal.value=h;
|
|
10834
|
-
this.h=h;
|
|
10835
|
-
return this;
|
|
10836
|
-
}
|
|
10837
|
-
}
|
|
10838
|
-
const svgRect=(x,y,w,h,center)=>new ZikoSvgRectangle(x,y,w,h,center);
|
|
10839
|
-
|
|
10840
|
-
class ZikoSvgText extends ZikoSvgElement{
|
|
10841
|
-
constructor(text,x,y){
|
|
10842
|
-
super();
|
|
10843
|
-
this.element=document?.createElementNS(
|
|
10844
|
-
"http://www.w3.org/2000/svg",
|
|
10845
|
-
"text",
|
|
10846
|
-
);
|
|
10847
|
-
this.setText(text);
|
|
10848
|
-
this.x(x).y(y);
|
|
10849
|
-
}
|
|
10850
|
-
x(x){
|
|
10851
|
-
this.element?.setAttribute("x",x);
|
|
10852
|
-
return this;
|
|
10853
|
-
}
|
|
10854
|
-
y(y){
|
|
10855
|
-
this.element?.setAttribute("y",y);
|
|
10856
|
-
return this;
|
|
10857
|
-
}
|
|
10858
|
-
setText(text=""){
|
|
10859
|
-
this.element.textContent=text;
|
|
10860
|
-
return this;
|
|
10861
|
-
}
|
|
10862
|
-
}
|
|
10863
|
-
const svgText=(text,x,y)=>new ZikoSvgText(text,x,y);
|
|
10864
|
-
|
|
10865
|
-
const svgGrid=(w,h,r=10,c=10)=>{
|
|
10866
|
-
let path=svgPath().fill("none").stroke("coral").strokeWidth(0.6);
|
|
10867
|
-
console.log({x:w/r,y:h/c});
|
|
10868
|
-
for(let i=0;i<w;i++) path.moveTo(0,i*w/r).hr(w);
|
|
10869
|
-
for(let j=0;j<h;j++) path.moveTo(j*h/c,0).vr(h);
|
|
10870
|
-
return path
|
|
10871
|
-
};
|
|
10872
|
-
|
|
10873
8492
|
var SVG = /*#__PURE__*/Object.freeze({
|
|
10874
8493
|
__proto__: null,
|
|
10875
8494
|
Svg: Svg,
|
|
10876
|
-
|
|
10877
|
-
ZikoSvgEllipse: ZikoSvgEllipse,
|
|
10878
|
-
ZikoSvgForeignObject: ZikoSvgForeignObject,
|
|
10879
|
-
ZikoSvgGroupe: ZikoSvgGroupe,
|
|
10880
|
-
ZikoSvgImage: ZikoSvgImage,
|
|
10881
|
-
ZikoSvgLine: ZikoSvgLine,
|
|
10882
|
-
ZikoSvgLink: ZikoSvgLink,
|
|
10883
|
-
ZikoSvgPath: ZikoSvgPath,
|
|
10884
|
-
ZikoSvgRectangle: ZikoSvgRectangle,
|
|
10885
|
-
ZikoSvgText: ZikoSvgText,
|
|
10886
|
-
ZikoUISvg: ZikoUISvg,
|
|
10887
|
-
svgCircle: svgCircle,
|
|
10888
|
-
svgEllipse: svgEllipse,
|
|
10889
|
-
svgGrid: svgGrid,
|
|
10890
|
-
svgGroupe: svgGroupe,
|
|
10891
|
-
svgImage: svgImage,
|
|
10892
|
-
svgLine: svgLine,
|
|
10893
|
-
svgLink: svgLink,
|
|
10894
|
-
svgObject: svgObject,
|
|
10895
|
-
svgPath: svgPath,
|
|
10896
|
-
svgPolygon: svgPolygon,
|
|
10897
|
-
svgRect: svgRect,
|
|
10898
|
-
svgText: svgText
|
|
8495
|
+
ZikoUISvg: ZikoUISvg
|
|
10899
8496
|
});
|
|
10900
8497
|
|
|
10901
8498
|
// import { convolute } from "../../math/signal/conv.js";
|
|
10902
|
-
class ZikoUICanvas extends
|
|
8499
|
+
class ZikoUICanvas extends ZikoUIElement{
|
|
10903
8500
|
constructor(w,h){
|
|
10904
8501
|
super("canvas","canvas");
|
|
10905
8502
|
this.ctx = this.element?.getContext("2d");
|
|
@@ -11069,288 +8666,10 @@ class ZikoUICanvas extends ZikoUIContainerElement{
|
|
|
11069
8666
|
|
|
11070
8667
|
const Canvas=(w,h)=>new ZikoUICanvas(w,h);
|
|
11071
8668
|
|
|
11072
|
-
class ZikoCanvasElement{
|
|
11073
|
-
constructor(x,y){
|
|
11074
|
-
this.parent=null;
|
|
11075
|
-
this.position={
|
|
11076
|
-
x,
|
|
11077
|
-
y
|
|
11078
|
-
};
|
|
11079
|
-
this.cache={
|
|
11080
|
-
interact:null/*avoid redraw*/,
|
|
11081
|
-
config:{
|
|
11082
|
-
draggable:false,
|
|
11083
|
-
selected:false,
|
|
11084
|
-
highlighted:false,
|
|
11085
|
-
rendered:false
|
|
11086
|
-
},
|
|
11087
|
-
style:{
|
|
11088
|
-
normal:{
|
|
11089
|
-
strokeEnabled:true,
|
|
11090
|
-
fillEnabled:false,
|
|
11091
|
-
strokeColor:"#111111",
|
|
11092
|
-
fillColor:"#777777",
|
|
11093
|
-
},
|
|
11094
|
-
highlighted:{
|
|
11095
|
-
strokeEnabled:true,
|
|
11096
|
-
fillEnabled:false,
|
|
11097
|
-
strokeColor:null,
|
|
11098
|
-
fillColor:null,
|
|
11099
|
-
}
|
|
11100
|
-
},
|
|
11101
|
-
};
|
|
11102
|
-
this.history={
|
|
11103
|
-
position:[],
|
|
11104
|
-
styles:[]
|
|
11105
|
-
};
|
|
11106
|
-
this.render();
|
|
11107
|
-
}
|
|
11108
|
-
get px(){
|
|
11109
|
-
//_x=====>px
|
|
11110
|
-
return (this.position.x??0)+(this.parent?.position?.x??0);
|
|
11111
|
-
}
|
|
11112
|
-
get py(){
|
|
11113
|
-
//_y=====>py
|
|
11114
|
-
return (this.position.y??0)+(this.parent?.position?.y??0);
|
|
11115
|
-
}
|
|
11116
|
-
isIntersectedWith(){
|
|
11117
|
-
|
|
11118
|
-
}
|
|
11119
|
-
isInStroke(x,y){
|
|
11120
|
-
let is;
|
|
11121
|
-
if(this.parent){
|
|
11122
|
-
this.parent.ctx.setTransform(1,0,0,1,0,0);
|
|
11123
|
-
is=this.parent.ctx.isPointInStroke(this.path,x,y);
|
|
11124
|
-
this.parent.applyTransformMatrix();
|
|
11125
|
-
}
|
|
11126
|
-
return is;
|
|
11127
|
-
}
|
|
11128
|
-
isInPath(x,y){
|
|
11129
|
-
let is;
|
|
11130
|
-
if(this.parent){
|
|
11131
|
-
this.parent.ctx.setTransform(1,0,0,1,0,0);
|
|
11132
|
-
is=this.parent.ctx.isPointInPath(this.path,x,y);
|
|
11133
|
-
this.parent.applyTransformMatrix();
|
|
11134
|
-
}
|
|
11135
|
-
return is;
|
|
11136
|
-
}
|
|
11137
|
-
posX(x){
|
|
11138
|
-
this.position.x=x;
|
|
11139
|
-
if(this.parent)this.parent.draw();
|
|
11140
|
-
return this;
|
|
11141
|
-
}
|
|
11142
|
-
posY(y){
|
|
11143
|
-
this.position.y=y;
|
|
11144
|
-
if(this.parent)this.parent.draw();
|
|
11145
|
-
return this;
|
|
11146
|
-
}
|
|
11147
|
-
color({stroke=this.cache.style.normal.strokeColor,fill=this.cache.style.normal.fillColor}={stroke,fill}){
|
|
11148
|
-
this.cache.style.normal.strokeColor=stroke;
|
|
11149
|
-
this.cache.style.normal.fillColor=fill;
|
|
11150
|
-
if(this.parent)this.parent.draw();
|
|
11151
|
-
return this;
|
|
11152
|
-
}
|
|
11153
|
-
translate(dx=0,dy=0){
|
|
11154
|
-
this.position.x+=dx;
|
|
11155
|
-
this.position.y+=dy;
|
|
11156
|
-
if(this.parent)this.parent.draw();
|
|
11157
|
-
return;
|
|
11158
|
-
}
|
|
11159
|
-
applyNormalStyle(ctx){
|
|
11160
|
-
ctx.strokeStyle=this.cache.style.normal.strokeColor;
|
|
11161
|
-
ctx.fillStyle=this.cache.style.normal.fillColor;
|
|
11162
|
-
return this;
|
|
11163
|
-
}
|
|
11164
|
-
applyHighlightedStyle(ctx){
|
|
11165
|
-
ctx.strokeStyle=this.cache.style.highlighted.strokeColor;
|
|
11166
|
-
ctx.fillStyle=this.cache.style.highlighted.fillColor;
|
|
11167
|
-
return this;
|
|
11168
|
-
}
|
|
11169
|
-
stroke(color=this.cache.style.normal.strokeColor,enabled=true){
|
|
11170
|
-
this.cache.style.normal.strokeEnabled=enabled;
|
|
11171
|
-
this.cache.style.normal.strokeColor=color;
|
|
11172
|
-
if(this.parent)this.parent.draw();
|
|
11173
|
-
return this
|
|
11174
|
-
}
|
|
11175
|
-
fill(color=this.cache.style.normal.fillColor,enabled=true){
|
|
11176
|
-
this.cache.style.normal.fillEnabled=enabled;
|
|
11177
|
-
this.cache.style.normal.filleColor=color;
|
|
11178
|
-
if(this.parent)this.parent.draw();
|
|
11179
|
-
return this;
|
|
11180
|
-
}
|
|
11181
|
-
render(render=true){
|
|
11182
|
-
this.cache.config.rendered=render;
|
|
11183
|
-
return this;
|
|
11184
|
-
}
|
|
11185
|
-
}
|
|
11186
|
-
|
|
11187
|
-
class CanvasArc extends ZikoCanvasElement{
|
|
11188
|
-
constructor(x,y,r,angle){
|
|
11189
|
-
super(x,y);
|
|
11190
|
-
this.r=r;
|
|
11191
|
-
this.angle=angle;
|
|
11192
|
-
this.path=null;
|
|
11193
|
-
}
|
|
11194
|
-
draw(ctx){
|
|
11195
|
-
if(this.cache.config.rendered){
|
|
11196
|
-
ctx.save();
|
|
11197
|
-
this.applyNormalStyle(ctx);
|
|
11198
|
-
ctx.beginPath();
|
|
11199
|
-
this.path=new Path2D();
|
|
11200
|
-
this.path.arc(this.px, this.py, this.r, 0, this.angle);
|
|
11201
|
-
const{strokeEnabled,fillEnabled}=this.cache.style.normal;
|
|
11202
|
-
if(strokeEnabled)ctx.stroke(this.path);
|
|
11203
|
-
if(fillEnabled)ctx.fill(this.path);
|
|
11204
|
-
ctx.closePath();
|
|
11205
|
-
ctx.restore();
|
|
11206
|
-
}
|
|
11207
|
-
return this;
|
|
11208
|
-
}
|
|
11209
|
-
radius(r){
|
|
11210
|
-
this.r=r;
|
|
11211
|
-
if(this.parent)this.parent.draw();
|
|
11212
|
-
return this;
|
|
11213
|
-
}
|
|
11214
|
-
// distanceFromCenter(x,y){
|
|
11215
|
-
// return Math.sqrt(
|
|
11216
|
-
// (this._x-x)**2-(this._y-y)**2
|
|
11217
|
-
// )
|
|
11218
|
-
// }
|
|
11219
|
-
// isIn(x,y,strict=false){
|
|
11220
|
-
// return strict?this.distanceFromCenter(x,y)<this.r:this.distanceFromCenter(x,y)<=this.r;
|
|
11221
|
-
// }
|
|
11222
|
-
// isInEdges(x,y){
|
|
11223
|
-
// return this.distanceFromCenter(x,y)===this.r;
|
|
11224
|
-
// }
|
|
11225
|
-
}
|
|
11226
|
-
const canvasArc=(x,y,r,phi)=>new CanvasArc(x,y,r,phi);
|
|
11227
|
-
const canvasCircle=(x,y,r)=>new CanvasArc(x,y,r,2*Math.PI);
|
|
11228
|
-
|
|
11229
|
-
class CanvasPoints extends ZikoCanvasElement{
|
|
11230
|
-
constructor(ptsX,ptsY){
|
|
11231
|
-
super();
|
|
11232
|
-
this.pointsMatrix=null;
|
|
11233
|
-
this.path=new Path2D();
|
|
11234
|
-
this.fromXY(ptsX,ptsY);
|
|
11235
|
-
}
|
|
11236
|
-
get points(){
|
|
11237
|
-
return this.pointsMatrix.T.arr;
|
|
11238
|
-
}
|
|
11239
|
-
draw(ctx){
|
|
11240
|
-
if(this.cache.config.rendered){
|
|
11241
|
-
ctx.save();
|
|
11242
|
-
this.applyNormalStyle(ctx);
|
|
11243
|
-
ctx.beginPath();
|
|
11244
|
-
this.path.moveTo(this.points[1][0]+this._x,this.points[1][1]+this._y);
|
|
11245
|
-
for(let i=1;i<this.points.length;i++){
|
|
11246
|
-
this.path.lineTo(this.points[i][0]+this._x,this.points[i][1]+this._y);
|
|
11247
|
-
}
|
|
11248
|
-
ctx.stroke(this.path);
|
|
11249
|
-
ctx.restore();
|
|
11250
|
-
}
|
|
11251
|
-
return this;
|
|
11252
|
-
}
|
|
11253
|
-
fromXY(X,Y){
|
|
11254
|
-
this.pointsMatrix=matrix([X,Y]);
|
|
11255
|
-
return this;
|
|
11256
|
-
}
|
|
11257
|
-
push(ptsX,ptsY){
|
|
11258
|
-
this.pointsMatrix.hstack(matrix([ptsX,ptsY]));
|
|
11259
|
-
if(this.parent)this.parent.draw();
|
|
11260
|
-
return this;
|
|
11261
|
-
}
|
|
11262
|
-
isIn(x,y){
|
|
11263
|
-
let is;
|
|
11264
|
-
if(this.parent){
|
|
11265
|
-
this.parent.ctx.setTransform(1,0,0,1,0,0);
|
|
11266
|
-
is=this.parent.ctx.isPointInPath(this.path,x,y);
|
|
11267
|
-
this.parent.applyTransformMatrix();
|
|
11268
|
-
}
|
|
11269
|
-
return is;
|
|
11270
|
-
}
|
|
11271
|
-
}
|
|
11272
|
-
|
|
11273
|
-
const canvasPoints=(ptsX=[],ptsY=[])=>new CanvasPoints(ptsX,ptsY);
|
|
11274
|
-
|
|
11275
|
-
class CanvasLine extends ZikoCanvasElement{
|
|
11276
|
-
constructor(x0,y0,x1,y1){
|
|
11277
|
-
super();
|
|
11278
|
-
this.x0=x0;
|
|
11279
|
-
this.x1=x1;
|
|
11280
|
-
this.y0=y0;
|
|
11281
|
-
this.y1=y1;
|
|
11282
|
-
delete this.fill;
|
|
11283
|
-
}
|
|
11284
|
-
draw(ctx){
|
|
11285
|
-
if(this.cache.config.rendered){
|
|
11286
|
-
ctx.save();
|
|
11287
|
-
this.applyNormalStyle(ctx);
|
|
11288
|
-
ctx.beginPath();
|
|
11289
|
-
ctx.moveTo(this.x0+this._x,this.y0+this._y_);
|
|
11290
|
-
ctx.lineTo(this.x1+this._x,this.y1+this._y);
|
|
11291
|
-
ctx.stroke();
|
|
11292
|
-
if(this.cache.style.normal.strokeEnabled)ctx.stroke();
|
|
11293
|
-
ctx.restore();
|
|
11294
|
-
}
|
|
11295
|
-
return this;
|
|
11296
|
-
}
|
|
11297
|
-
}
|
|
11298
|
-
const canvasLine=(x0,y0,x1,y1)=>new CanvasLine(x0,y0,x1,y1);
|
|
11299
|
-
|
|
11300
|
-
class CanvasRect extends ZikoCanvasElement{
|
|
11301
|
-
constructor(x,y,w,h){
|
|
11302
|
-
super(x,y);
|
|
11303
|
-
this.w=w;
|
|
11304
|
-
this.h=h;
|
|
11305
|
-
this.path=new Path2D();
|
|
11306
|
-
}
|
|
11307
|
-
draw(ctx){
|
|
11308
|
-
if(this.cache.config.rendered){
|
|
11309
|
-
ctx.save();
|
|
11310
|
-
this.applyNormalStyle(ctx);
|
|
11311
|
-
ctx.beginPath();
|
|
11312
|
-
this.path.rect(this.px, this.py,this.w,this.h);
|
|
11313
|
-
const{strokeEnabled,fillEnabled}=this.cache.style.normal;
|
|
11314
|
-
if(strokeEnabled)ctx.stroke(this.path);
|
|
11315
|
-
if(fillEnabled)ctx.fill(this.path);
|
|
11316
|
-
ctx.closePath();
|
|
11317
|
-
ctx.restore();
|
|
11318
|
-
}
|
|
11319
|
-
return this;
|
|
11320
|
-
}
|
|
11321
|
-
width(w){
|
|
11322
|
-
this.w=w;
|
|
11323
|
-
if(this.parent)this.parent.draw();
|
|
11324
|
-
return this;
|
|
11325
|
-
}
|
|
11326
|
-
height(h){
|
|
11327
|
-
this.h=h;
|
|
11328
|
-
if(this.parent)this.parent.draw();
|
|
11329
|
-
return this;
|
|
11330
|
-
}
|
|
11331
|
-
// distanceFromCenter(x,y){
|
|
11332
|
-
// return Math.sqrt(
|
|
11333
|
-
// (this.position.x-x)**2-(this.position.y-y)**2
|
|
11334
|
-
// )
|
|
11335
|
-
// }
|
|
11336
|
-
// isIn(x,y,strict=false){
|
|
11337
|
-
// return strict?this.distanceFromCenter(x,y)<this.r:this.distanceFromCenter(x,y)<=this.r;
|
|
11338
|
-
// }
|
|
11339
|
-
// isInEdges(x,y){
|
|
11340
|
-
// return this.distanceFromCenter(x,y)===this.r;
|
|
11341
|
-
// }
|
|
11342
|
-
}
|
|
11343
|
-
const canvasRect=(x,y,w,h)=>new CanvasRect(x,y,w,h);
|
|
11344
|
-
|
|
11345
8669
|
var CANVAS = /*#__PURE__*/Object.freeze({
|
|
11346
8670
|
__proto__: null,
|
|
11347
8671
|
Canvas: Canvas,
|
|
11348
|
-
ZikoUICanvas: ZikoUICanvas
|
|
11349
|
-
canvasArc: canvasArc,
|
|
11350
|
-
canvasCircle: canvasCircle,
|
|
11351
|
-
canvasLine: canvasLine,
|
|
11352
|
-
canvasPoints: canvasPoints,
|
|
11353
|
-
canvasRect: canvasRect
|
|
8672
|
+
ZikoUICanvas: ZikoUICanvas
|
|
11354
8673
|
});
|
|
11355
8674
|
|
|
11356
8675
|
const Graphics = {
|
|
@@ -11655,7 +8974,7 @@ class ZikoSPA extends ZikoApp{
|
|
|
11655
8974
|
constructor({head, wrapper, target, routes}){
|
|
11656
8975
|
super({head, wrapper, target});
|
|
11657
8976
|
this.routes=new Map([
|
|
11658
|
-
["404",text
|
|
8977
|
+
["404",text("Error 404")],
|
|
11659
8978
|
...Object.entries(routes)
|
|
11660
8979
|
]);
|
|
11661
8980
|
this.clear();
|
|
@@ -11735,7 +9054,7 @@ function defineParamsGetter(target ){
|
|
|
11735
9054
|
}
|
|
11736
9055
|
|
|
11737
9056
|
const __UI__={};
|
|
11738
|
-
const __HYDRATION_MAP__ =
|
|
9057
|
+
const __HYDRATION_MAP__ = new Map();
|
|
11739
9058
|
const __Config__={
|
|
11740
9059
|
default:{
|
|
11741
9060
|
target:null,
|
|
@@ -11749,7 +9068,9 @@ const __Config__={
|
|
|
11749
9068
|
const values=Object.values(pairs);
|
|
11750
9069
|
for(let i=0;i<keys.length;i++)this.default[keys[i]]=values[i];
|
|
11751
9070
|
},
|
|
11752
|
-
init:()=>document.documentElement.setAttribute("data-engine","zikojs")
|
|
9071
|
+
init:()=>document.documentElement.setAttribute("data-engine","zikojs"),
|
|
9072
|
+
renderingMode :"spa",
|
|
9073
|
+
isSSC : false,
|
|
11753
9074
|
};
|
|
11754
9075
|
|
|
11755
9076
|
var Global = /*#__PURE__*/Object.freeze({
|
|
@@ -11890,4 +9211,4 @@ function RemoveAll(){
|
|
|
11890
9211
|
Data.RemoveAll();
|
|
11891
9212
|
}
|
|
11892
9213
|
|
|
11893
|
-
export {
|
|
9214
|
+
export { App$1 as App, Article, Aside, Base, Canvas, Combinaison, Complex, E, EPSILON, Ease, FileBasedRouting, Flex, Footer, Form, Grid$1 as Grid, HTMLWrapper, Header, LinearSystem, Logic$1 as Logic, Main, Matrix, Nav, PI$1 as PI, Permutation, Random, SPA, SVGWrapper, Section, Str, Suspense, Svg, Table$1 as Table, Utils$1 as Utils, ZikoApp, ZikoCustomEvent, ZikoEvent, ZikoEventClick, ZikoEventClipboard, ZikoEventHash, ZikoEventInput, ZikoEventKey, ZikoEventMouse, ZikoEventPointer, ZikoEventSwipe, ZikoEventWheel, ZikoHead$1 as ZikoHead, ZikoJsonStyleSheet, ZikoMutationObserver, ZikoSPA, ZikoUIAbbrText, ZikoUIArticle, ZikoUIAside, ZikoUIAudio, ZikoUIBlockQuote, ZikoUIBr, ZikoUICanvas, ZikoUICodeText, ZikoUIDefintion, ZikoUIElement, ZikoUIFigure, ZikoUIFlex, ZikoUIFooter, ZikoUIForm, ZikoUIGrid, ZikoUIHTMLWrapper, ZikoUIHeader, ZikoUIHeading, ZikoUIHr, ZikoUIHtmlTag, ZikoUIImage, ZikoUIInput, ZikoUIInputCheckbox, ZikoUIInputColor, ZikoUIInputDatalist$1 as ZikoUIInputDatalist, ZikoUIInputDate, ZikoUIInputDateTime, ZikoUIInputEmail, ZikoUIInputImage, ZikoUIInputNumber, ZikoUIInputOption, ZikoUIInputPassword, ZikoUIInputRadio, ZikoUIInputSearch, ZikoUIInputSlider$1 as ZikoUIInputSlider, ZikoUIInputTime, ZikoUILabel, ZikoUILink, ZikoUIMain, ZikoUINav, ZikoUIParagraphe, ZikoUIQuote, ZikoUISVGWrapper, ZikoUISection, ZikoUISelect, ZikoUISubText, ZikoUISupText, ZikoUISuspense, ZikoUISvg, ZikoUIText, ZikoUITextArea, ZikoUIVideo, ZikoUIXMLWrapper, ZikoUseRoot, ZikoUseStyle, __Config__, __HYDRATION_MAP__, __UI__, abbrText, abs, accum, acos, acosh, acot, add, arange, arr2str, asin, asinh, atan, atan2, atanh, audio, bessel, beta, blockQuote, br, brs, btn, cartesianProduct, ceil, checkbox, choleskyDecomposition, clamp, codeText, combinaison, complex, cos, cosh, cot, coth, count, countWords, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, datalist, Ziko as default, defineParamsGetter, deg2rad, dfnText, div, e, fact, figure, floor, gamma, geomspace, h, h1, h2, h3, h4, h5, h6, hTags, hr, hrs, html, hypot, image, inRange, input, inputCamera, inputColor, inputDate, inputDateTime, inputEmail, inputImage, inputNumber, inputPassword, inputTime, isApproximatlyEqual, json2arr, json2css, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, jsonStyleSheet, lerp, li, link, linspace, ln, logspace, luDecomposition, map, mapfun$1 as mapfun, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, obj2str, ol, ones, p, pgcd, pow, powerSet, ppcm, preload, prod, qrDecomposition, quote, rad2deg, radio, removeExtraSpace, round, s, sTags, search, sec, select, sig, sign, sin, sinc, sinh, slider, sqrt, sqrtn, str, sub, subSet, subText, sum, supText, svg2ascii, svg2img, svg2imgUrl, svg2str, tan, tanh, text, textarea, timeTaken, time_memory_Taken, ul, useAnimation, useChannel$1 as useChannel, useClickEvent, useClipboardEvent, useCustomEvent, useDebounce, useDragEvent, useDropEvent, useEventEmitter, useFavIcon$1 as useFavIcon, useFocusEvent, useFps, useHashEvent, useHead$1 as useHead, useInputEvent, useKeyEvent, useLocaleStorage, useMediaQuery, useMeta$1 as useMeta, useMouseEvent, usePointerEvent, useRoot, useRootValue, useSessionStorage, useStyle, useSuccesifKeys, useSwipeEvent, useThread, useThrottle, useTimeLoop, useTitle$1 as useTitle, useType, useWheelEvent, video, wait, waitForUIElm, waitForUIElmSync, watch, watchAttr, watchChildren, watchIntersection, watchScreen, watchSize, zeros };
|