ziko 0.0.22 → 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 +93 -2819
- package/dist/ziko.js +93 -2819
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +90 -2757
- package/package.json +1 -1
- package/src/app/globals.js +5 -1
- 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/index.js +2 -1
- package/src/reactivity/hooks/index.js +1 -1
- package/src/ui/elements/{primitives/ZikoUIElement.js → ZikoUIElement.js} +20 -12
- 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/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/starter/bin/index.js +0 -11
- /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/{data/parser/markdown.js → ui/elements/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,
|
|
@@ -4845,7 +4567,7 @@ const Reactivity={
|
|
|
4845
4567
|
};
|
|
4846
4568
|
|
|
4847
4569
|
class ZikoUIElement {
|
|
4848
|
-
constructor(element
|
|
4570
|
+
constructor(element, name="", {el_type="html", useDefaultStyle=false}={}){
|
|
4849
4571
|
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
|
|
4850
4572
|
if(typeof element === "string") {
|
|
4851
4573
|
switch(el_type){
|
|
@@ -4854,8 +4576,10 @@ class ZikoUIElement {
|
|
|
4854
4576
|
default : throw Error("Not supported")
|
|
4855
4577
|
}
|
|
4856
4578
|
}
|
|
4579
|
+
else {
|
|
4580
|
+
this.target = element.parentElement;
|
|
4581
|
+
}
|
|
4857
4582
|
if(element)this.__ele__ = element;
|
|
4858
|
-
this.uuid=this.constructor.name+"-"+Random.string(10);
|
|
4859
4583
|
this.cache = {
|
|
4860
4584
|
name,
|
|
4861
4585
|
parent:null,
|
|
@@ -4886,23 +4610,29 @@ class ZikoUIElement {
|
|
|
4886
4610
|
resize:null,
|
|
4887
4611
|
intersection:null
|
|
4888
4612
|
};
|
|
4613
|
+
this.uuid = `${this.cache.name}-${Random.string(16)}`;
|
|
4889
4614
|
this.cache.style.linkTo(this);
|
|
4890
|
-
this.style({
|
|
4615
|
+
useDefaultStyle && this.style({
|
|
4891
4616
|
position: "relative",
|
|
4892
4617
|
boxSizing:"border-box",
|
|
4893
4618
|
margin:0,
|
|
4894
4619
|
padding:0,
|
|
4620
|
+
width : "auto",
|
|
4621
|
+
height : "auto"
|
|
4895
4622
|
});
|
|
4896
4623
|
this.items = [];
|
|
4897
|
-
this.size("auto", "auto");
|
|
4898
4624
|
globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
|
|
4899
4625
|
element && globalThis.__Ziko__.__Config__.default.render && this.render();
|
|
4626
|
+
this.setAttr("data-ref", this.uuid);
|
|
4627
|
+
if(globalThis.__Ziko__.__Config__.renderingMode !== "spa" && !globalThis.__Ziko__.__Config__.isSSC) {
|
|
4628
|
+
globalThis.__Ziko__.__HYDRATION_MAP__.set(this.uuid, ()=>this);
|
|
4629
|
+
}
|
|
4900
4630
|
}
|
|
4901
4631
|
get element(){
|
|
4902
|
-
return this.__ele__
|
|
4632
|
+
return this.__ele__;
|
|
4903
4633
|
}
|
|
4904
4634
|
get isZikoUIElement(){
|
|
4905
|
-
return true
|
|
4635
|
+
return true;
|
|
4906
4636
|
}
|
|
4907
4637
|
get st(){
|
|
4908
4638
|
return this.cache.style;
|
|
@@ -4911,7 +4641,7 @@ class ZikoUIElement {
|
|
|
4911
4641
|
return this.cache.attributes;
|
|
4912
4642
|
}
|
|
4913
4643
|
get evt(){
|
|
4914
|
-
return this.
|
|
4644
|
+
return this.events;
|
|
4915
4645
|
}
|
|
4916
4646
|
get html(){
|
|
4917
4647
|
return this.element.innerHTML;
|
|
@@ -4976,7 +4706,7 @@ class ZikoUIElement {
|
|
|
4976
4706
|
return this;
|
|
4977
4707
|
}
|
|
4978
4708
|
for (let i = 0; i < ele.length; i++) {
|
|
4979
|
-
if (["number", "string"].includes(typeof ele[i])) ele[i] = text
|
|
4709
|
+
if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
4980
4710
|
if (ele[i] instanceof ZikoUIElement) {
|
|
4981
4711
|
ele[i].cache.parent = this;
|
|
4982
4712
|
this.element[adder](ele[i].element);
|
|
@@ -5006,7 +4736,7 @@ class ZikoUIElement {
|
|
|
5006
4736
|
if (index >= this.element.children.length) this.append(...ele);
|
|
5007
4737
|
else
|
|
5008
4738
|
for (let i = 0; i < ele.length; i++) {
|
|
5009
|
-
if (["number", "string"].includes(typeof ele[i])) ele[i] = text
|
|
4739
|
+
if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
5010
4740
|
this.element?.insertBefore(ele[i].element, this.items[index].element);
|
|
5011
4741
|
this.items.splice(index, 0, ele[i]);
|
|
5012
4742
|
}
|
|
@@ -5425,128 +5155,7 @@ class ZikoUIElement {
|
|
|
5425
5155
|
}
|
|
5426
5156
|
}
|
|
5427
5157
|
|
|
5428
|
-
class
|
|
5429
|
-
constructor(element, name = "") {
|
|
5430
|
-
super(element, name);
|
|
5431
|
-
this.items = [];
|
|
5432
|
-
}
|
|
5433
|
-
// maintain() {
|
|
5434
|
-
// for (let i = 0; i < this.items.length; i++)
|
|
5435
|
-
// Object.assign(this, { [[i]]: this.items[i] });
|
|
5436
|
-
// this.length = this.items.length;
|
|
5437
|
-
// return this;
|
|
5438
|
-
// }
|
|
5439
|
-
// at(index) {
|
|
5440
|
-
// return this.items.at(index);
|
|
5441
|
-
// }
|
|
5442
|
-
// #addItem(adder, pusher, ...ele) {
|
|
5443
|
-
// if (this.cache.isFrozzen) {
|
|
5444
|
-
// console.warn("You can't append new item to frozzen element");
|
|
5445
|
-
// return this;
|
|
5446
|
-
// }
|
|
5447
|
-
// for (let i = 0; i < ele.length; i++) {
|
|
5448
|
-
// if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
5449
|
-
// if (ele[i] instanceof ZikoUIElement) {
|
|
5450
|
-
// ele[i].cache.parent = this;
|
|
5451
|
-
// this.element[adder](ele[i].element);
|
|
5452
|
-
// ele[i].target = this.element;
|
|
5453
|
-
// this.items[pusher](ele[i]);
|
|
5454
|
-
// } else if (ele[i] instanceof Object) {
|
|
5455
|
-
// if (ele[i]?.style) this.style(ele[i]?.style);
|
|
5456
|
-
// if (ele[i]?.attr) {
|
|
5457
|
-
// Object.entries(ele[i].attr).forEach((n) =>
|
|
5458
|
-
// this.setAttr("" + n[0], n[1]),
|
|
5459
|
-
// );
|
|
5460
|
-
// }
|
|
5461
|
-
// }
|
|
5462
|
-
// }
|
|
5463
|
-
// this.maintain();
|
|
5464
|
-
// return this;
|
|
5465
|
-
// }
|
|
5466
|
-
// append(...ele) {
|
|
5467
|
-
// this.#addItem("append", "push", ...ele);
|
|
5468
|
-
// return this;
|
|
5469
|
-
// }
|
|
5470
|
-
// prepend(...ele) {
|
|
5471
|
-
// this.#addItem("prepend", "unshift", ...ele);
|
|
5472
|
-
// return this;
|
|
5473
|
-
// }
|
|
5474
|
-
// insertAt(index, ...ele) {
|
|
5475
|
-
// if (index >= this.element.children.length) this.append(...ele);
|
|
5476
|
-
// else
|
|
5477
|
-
// for (let i = 0; i < ele.length; i++) {
|
|
5478
|
-
// if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
5479
|
-
// this.element?.insertBefore(ele[i].element, this.items[index].element);
|
|
5480
|
-
// this.items.splice(index, 0, ele[i]);
|
|
5481
|
-
// }
|
|
5482
|
-
// return this;
|
|
5483
|
-
// }
|
|
5484
|
-
// remove(...ele) {
|
|
5485
|
-
// const remove = (ele) => {
|
|
5486
|
-
// if (typeof ele === "number") ele = this.items[ele];
|
|
5487
|
-
// if (ele instanceof ZikoUIElement) this.element?.removeChild(ele.element);
|
|
5488
|
-
// this.items = this.items.filter((n) => n !== ele);
|
|
5489
|
-
// };
|
|
5490
|
-
// for (let i = 0; i < ele.length; i++) remove(ele[i]);
|
|
5491
|
-
// for (let i = 0; i < this.items.length; i++)
|
|
5492
|
-
// Object.assign(this, { [[i]]: this.items[i] });
|
|
5493
|
-
// // Remove from item
|
|
5494
|
-
// return this;
|
|
5495
|
-
// }
|
|
5496
|
-
// forEach(callback) {
|
|
5497
|
-
// this.items.forEach(callback);
|
|
5498
|
-
// return this;
|
|
5499
|
-
// }
|
|
5500
|
-
// map(callback) {
|
|
5501
|
-
// return this.items.map(callback);
|
|
5502
|
-
// }
|
|
5503
|
-
// find(condition) {
|
|
5504
|
-
// return this.items.filter(condition);
|
|
5505
|
-
// }
|
|
5506
|
-
// filter(condition_callback, if_callback = () => {}, else_callback = () => {}) {
|
|
5507
|
-
// const FilterItems = this.items.filter(condition_callback);
|
|
5508
|
-
// FilterItems.forEach(if_callback);
|
|
5509
|
-
// this.items
|
|
5510
|
-
// .filter((item) => !FilterItems.includes(item))
|
|
5511
|
-
// .forEach(else_callback);
|
|
5512
|
-
// return this;
|
|
5513
|
-
// }
|
|
5514
|
-
// filterByTextContent(text, exactMatch = false) {
|
|
5515
|
-
// this.items.forEach((n) => n.render());
|
|
5516
|
-
// this.filter(
|
|
5517
|
-
// (n) => !(exactMatch ? n.text === text : n.text.includes(text)),
|
|
5518
|
-
// (e) => e.unrender(),
|
|
5519
|
-
// );
|
|
5520
|
-
// // this.items.filter(n=>{
|
|
5521
|
-
// // const content=n.element.textContent;
|
|
5522
|
-
// // return !(exactMatch?content===text:content.includes(text))
|
|
5523
|
-
// // }).map(n=>n.unrender());
|
|
5524
|
-
// // return this;
|
|
5525
|
-
// }
|
|
5526
|
-
// filterByClass(value) {
|
|
5527
|
-
// this.items.map((n) => n.render());
|
|
5528
|
-
// this.items
|
|
5529
|
-
// .filter((n) => !n.classes.includes(value))
|
|
5530
|
-
// .map((n) => n.unrender());
|
|
5531
|
-
// return this;
|
|
5532
|
-
// }
|
|
5533
|
-
// sortByTextContent(value, displays) {
|
|
5534
|
-
// let item = this.children;
|
|
5535
|
-
// item
|
|
5536
|
-
// .filter((n) => !n.textContent.toLowerCase().includes(value.toLowerCase()))
|
|
5537
|
-
// .map((n) => {
|
|
5538
|
-
// n.style.display = "none";
|
|
5539
|
-
// });
|
|
5540
|
-
// item
|
|
5541
|
-
// .filter((n) => n.textContent.toLowerCase().includes(value.toLowerCase()))
|
|
5542
|
-
// .map((n, i) => (n.style.display = displays[i]));
|
|
5543
|
-
// //return item.filter(n=>n.style.display!="none")
|
|
5544
|
-
// item.filter((n) => n.style.display != "none");
|
|
5545
|
-
// return this;
|
|
5546
|
-
// }
|
|
5547
|
-
}
|
|
5548
|
-
|
|
5549
|
-
class __ZikoUIText__ extends ZikoUIContainerElement {
|
|
5158
|
+
class __ZikoUIText__ extends ZikoUIElement {
|
|
5550
5159
|
constructor(tag, name, lineBreak,...value) {
|
|
5551
5160
|
super(tag, name);
|
|
5552
5161
|
this.addValue(...value);
|
|
@@ -5651,7 +5260,7 @@ class ZikoUIAbbrText extends __ZikoUIText__ {
|
|
|
5651
5260
|
return true
|
|
5652
5261
|
}
|
|
5653
5262
|
}
|
|
5654
|
-
const text
|
|
5263
|
+
const text = (...str) => new ZikoUIText(...str);
|
|
5655
5264
|
const quote = (...str) => new ZikoUIQuote(...str);
|
|
5656
5265
|
const dfnText = (...str) => new ZikoUIDefintion(...str);
|
|
5657
5266
|
const supText = (...str) => new ZikoUISupText(...str);
|
|
@@ -5732,10 +5341,10 @@ var Text$1 = /*#__PURE__*/Object.freeze({
|
|
|
5732
5341
|
quote: quote,
|
|
5733
5342
|
subText: subText,
|
|
5734
5343
|
supText: supText,
|
|
5735
|
-
text: text
|
|
5344
|
+
text: text
|
|
5736
5345
|
});
|
|
5737
5346
|
|
|
5738
|
-
class ZikoUILI extends
|
|
5347
|
+
class ZikoUILI extends ZikoUIElement{
|
|
5739
5348
|
constructor(UI){
|
|
5740
5349
|
super("li","li");
|
|
5741
5350
|
this.append(UI);
|
|
@@ -5744,7 +5353,7 @@ class ZikoUILI extends ZikoUIContainerElement{
|
|
|
5744
5353
|
return true;
|
|
5745
5354
|
}
|
|
5746
5355
|
}
|
|
5747
|
-
class ZikoUIList extends
|
|
5356
|
+
class ZikoUIList extends ZikoUIElement {
|
|
5748
5357
|
constructor(element,name) {
|
|
5749
5358
|
super(element,name);
|
|
5750
5359
|
delete this.append;
|
|
@@ -5756,7 +5365,7 @@ class ZikoUIList extends ZikoUIContainerElement {
|
|
|
5756
5365
|
append(...arr){
|
|
5757
5366
|
for (let i = 0; i < arr.length; i++) {
|
|
5758
5367
|
let li = null;
|
|
5759
|
-
if(["string","number"].includes(typeof arr[i]))arr[i]=text
|
|
5368
|
+
if(["string","number"].includes(typeof arr[i]))arr[i]=text(arr[i]);
|
|
5760
5369
|
if (arr[i] instanceof ZikoUIElement)li=new ZikoUILI(arr[i]);
|
|
5761
5370
|
li.setTarget(this.element);
|
|
5762
5371
|
this.items.push(li[0]);
|
|
@@ -5784,7 +5393,7 @@ class ZikoUIList extends ZikoUIContainerElement {
|
|
|
5784
5393
|
else
|
|
5785
5394
|
for (let i = 0; i < ele.length; i++) {
|
|
5786
5395
|
let li = null;
|
|
5787
|
-
if(["number","string"].includes(typeof ele[i]))ele[i]=text
|
|
5396
|
+
if(["number","string"].includes(typeof ele[i]))ele[i]=text(ele[i]);
|
|
5788
5397
|
if (ele[i] instanceof ZikoUIElement)li=new ZikoUILI(ele[i]);
|
|
5789
5398
|
this.element?.insertBefore(li.element, this.items[index].parent.element);
|
|
5790
5399
|
this.items.splice(index, 0, ele[i][0]);
|
|
@@ -6392,7 +6001,7 @@ const sTags = SVGTags.reduce((acc, key) => {
|
|
|
6392
6001
|
return acc;
|
|
6393
6002
|
}, {});
|
|
6394
6003
|
|
|
6395
|
-
class ZikoUIHtmlTag extends
|
|
6004
|
+
class ZikoUIHtmlTag extends ZikoUIElement {
|
|
6396
6005
|
constructor(element) {
|
|
6397
6006
|
super(element,"html");
|
|
6398
6007
|
}
|
|
@@ -6445,7 +6054,7 @@ class ZikoUIBr extends ZikoUIElement {
|
|
|
6445
6054
|
return true
|
|
6446
6055
|
}
|
|
6447
6056
|
}
|
|
6448
|
-
class ZikoUILink extends
|
|
6057
|
+
class ZikoUILink extends ZikoUIElement{
|
|
6449
6058
|
constructor(href){
|
|
6450
6059
|
super("a","link");
|
|
6451
6060
|
Object.assign(this.cache,{
|
|
@@ -6779,7 +6388,7 @@ class ZikoUITextArea extends ZikoUIElement {
|
|
|
6779
6388
|
}
|
|
6780
6389
|
const textarea =()=> new ZikoUITextArea();
|
|
6781
6390
|
|
|
6782
|
-
|
|
6391
|
+
class ZikoUIFlex extends ZikoUIElement {
|
|
6783
6392
|
constructor(tag = "div", w = "100%", h = "100%") {
|
|
6784
6393
|
super(tag ,"Flex");
|
|
6785
6394
|
this.direction = "cols";
|
|
@@ -6827,18 +6436,18 @@ let ZikoUIFlex$1 = class ZikoUIFlex extends ZikoUIContainerElement {
|
|
|
6827
6436
|
return this;
|
|
6828
6437
|
}
|
|
6829
6438
|
vertical(x, y, order=1) {
|
|
6830
|
-
set_vertical
|
|
6439
|
+
set_vertical.call(this,order);
|
|
6831
6440
|
this.style({
|
|
6832
|
-
alignItems: typeof(x)==="number"?map_pos_x
|
|
6833
|
-
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
|
|
6834
6443
|
});
|
|
6835
6444
|
return this;
|
|
6836
6445
|
}
|
|
6837
6446
|
horizontal(x, y, order=1) {
|
|
6838
|
-
set_horizontal
|
|
6447
|
+
set_horizontal.call(this,order);
|
|
6839
6448
|
this.style({
|
|
6840
|
-
alignItems: typeof(y)=="number"?map_pos_y
|
|
6841
|
-
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
|
|
6842
6451
|
});
|
|
6843
6452
|
return this;
|
|
6844
6453
|
}
|
|
@@ -6847,38 +6456,44 @@ let ZikoUIFlex$1 = class ZikoUIFlex extends ZikoUIContainerElement {
|
|
|
6847
6456
|
this.style({ display: "flex" });
|
|
6848
6457
|
return this;
|
|
6849
6458
|
}
|
|
6850
|
-
}
|
|
6459
|
+
}
|
|
6851
6460
|
|
|
6852
|
-
const Flex
|
|
6461
|
+
const Flex = (...ZikoUIElement) =>{
|
|
6853
6462
|
let tag="div";
|
|
6854
6463
|
if(typeof ZikoUIElement[0]==="string"){
|
|
6855
6464
|
tag=ZikoUIElement[0];
|
|
6856
6465
|
ZikoUIElement.pop();
|
|
6857
6466
|
}
|
|
6858
|
-
return new ZikoUIFlex
|
|
6467
|
+
return new ZikoUIFlex(tag).append(...ZikoUIElement);
|
|
6859
6468
|
};
|
|
6860
|
-
function set_vertical
|
|
6469
|
+
function set_vertical(direction){
|
|
6861
6470
|
direction == 1
|
|
6862
6471
|
? this.style({ flexDirection: "column" })
|
|
6863
6472
|
: direction == -1 && this.style({ flexDirection: "column-reverse" });
|
|
6864
6473
|
return this;
|
|
6865
6474
|
}
|
|
6866
|
-
function set_horizontal
|
|
6475
|
+
function set_horizontal(direction){
|
|
6867
6476
|
direction == 1
|
|
6868
6477
|
? this.style({ flexDirection: "row" })
|
|
6869
6478
|
: direction == -1 && this.style({ flexDirection: "row-reverse" });
|
|
6870
6479
|
return this;
|
|
6871
6480
|
}
|
|
6872
|
-
function map_pos_x
|
|
6481
|
+
function map_pos_x(align){
|
|
6873
6482
|
let pos = ["flex-start", "center", "flex-end"];
|
|
6874
6483
|
if (typeof align === "number") align = pos[align + 1];
|
|
6875
6484
|
return align;
|
|
6876
6485
|
}
|
|
6877
|
-
function map_pos_y
|
|
6878
|
-
return map_pos_x
|
|
6486
|
+
function map_pos_y(align){
|
|
6487
|
+
return map_pos_x(-align);
|
|
6879
6488
|
}
|
|
6880
6489
|
|
|
6881
|
-
|
|
6490
|
+
var Flex$1 = /*#__PURE__*/Object.freeze({
|
|
6491
|
+
__proto__: null,
|
|
6492
|
+
Flex: Flex,
|
|
6493
|
+
ZikoUIFlex: ZikoUIFlex
|
|
6494
|
+
});
|
|
6495
|
+
|
|
6496
|
+
class ZikoUIForm extends ZikoUIFlex{
|
|
6882
6497
|
constructor(...items){
|
|
6883
6498
|
super("form", "Form");
|
|
6884
6499
|
this.append(...items);
|
|
@@ -6996,7 +6611,7 @@ class ZikoUICaption extends ZikoUIElement{
|
|
|
6996
6611
|
const tr=(...ZikoUIElement)=>new ZikoUITr(...ZikoUIElement);
|
|
6997
6612
|
const td=(...UI)=>{
|
|
6998
6613
|
UI=UI.map(n=>{
|
|
6999
|
-
if(!(n instanceof ZikoUIElement))n=text
|
|
6614
|
+
if(!(n instanceof ZikoUIElement))n=text(n);
|
|
7000
6615
|
return n
|
|
7001
6616
|
});
|
|
7002
6617
|
return new ZikoUITd(...UI)
|
|
@@ -7139,7 +6754,7 @@ var Table = /*#__PURE__*/Object.freeze({
|
|
|
7139
6754
|
Table: Table$1
|
|
7140
6755
|
});
|
|
7141
6756
|
|
|
7142
|
-
class ZikoUIMain extends
|
|
6757
|
+
class ZikoUIMain extends ZikoUIElement{
|
|
7143
6758
|
constructor(){
|
|
7144
6759
|
super("main","Main");
|
|
7145
6760
|
}
|
|
@@ -7147,7 +6762,7 @@ class ZikoUIMain extends ZikoUIContainerElement{
|
|
|
7147
6762
|
return true
|
|
7148
6763
|
}
|
|
7149
6764
|
}
|
|
7150
|
-
class ZikoUIHeader extends
|
|
6765
|
+
class ZikoUIHeader extends ZikoUIElement{
|
|
7151
6766
|
constructor(){
|
|
7152
6767
|
super("header","Header");
|
|
7153
6768
|
}
|
|
@@ -7155,7 +6770,7 @@ class ZikoUIMain extends ZikoUIContainerElement{
|
|
|
7155
6770
|
return true
|
|
7156
6771
|
}
|
|
7157
6772
|
}
|
|
7158
|
-
class ZikoUINav extends
|
|
6773
|
+
class ZikoUINav extends ZikoUIElement{
|
|
7159
6774
|
constructor(){
|
|
7160
6775
|
super("nav","Nav");
|
|
7161
6776
|
}
|
|
@@ -7163,7 +6778,7 @@ class ZikoUIMain extends ZikoUIContainerElement{
|
|
|
7163
6778
|
return true
|
|
7164
6779
|
}
|
|
7165
6780
|
}
|
|
7166
|
-
class ZikoUISection extends
|
|
6781
|
+
class ZikoUISection extends ZikoUIElement{
|
|
7167
6782
|
constructor(){
|
|
7168
6783
|
super("section","Section");
|
|
7169
6784
|
this.style({position:"relative"});
|
|
@@ -7172,7 +6787,7 @@ class ZikoUIMain extends ZikoUIContainerElement{
|
|
|
7172
6787
|
return true
|
|
7173
6788
|
}
|
|
7174
6789
|
}
|
|
7175
|
-
class ZikoUIArticle extends
|
|
6790
|
+
class ZikoUIArticle extends ZikoUIElement{
|
|
7176
6791
|
constructor(){
|
|
7177
6792
|
super("article","Article");
|
|
7178
6793
|
}
|
|
@@ -7180,7 +6795,7 @@ class ZikoUIMain extends ZikoUIContainerElement{
|
|
|
7180
6795
|
return true
|
|
7181
6796
|
}
|
|
7182
6797
|
}
|
|
7183
|
-
class ZikoUIAside extends
|
|
6798
|
+
class ZikoUIAside extends ZikoUIElement{
|
|
7184
6799
|
constructor(){
|
|
7185
6800
|
super("aside","Aside");
|
|
7186
6801
|
}
|
|
@@ -7188,7 +6803,7 @@ class ZikoUIMain extends ZikoUIContainerElement{
|
|
|
7188
6803
|
return true
|
|
7189
6804
|
}
|
|
7190
6805
|
}
|
|
7191
|
-
class ZikoUIFooter extends
|
|
6806
|
+
class ZikoUIFooter extends ZikoUIElement{
|
|
7192
6807
|
constructor(){
|
|
7193
6808
|
super("footer","Footer");
|
|
7194
6809
|
this.element=document?.createElement("footer");
|
|
@@ -7223,7 +6838,7 @@ var Semantic = /*#__PURE__*/Object.freeze({
|
|
|
7223
6838
|
ZikoUISection: ZikoUISection
|
|
7224
6839
|
});
|
|
7225
6840
|
|
|
7226
|
-
class ZikoUIGrid extends
|
|
6841
|
+
class ZikoUIGrid extends ZikoUIElement {
|
|
7227
6842
|
constructor(tag ="div", w = "50vw", h = "50vh") {
|
|
7228
6843
|
super(tag,"Grid");
|
|
7229
6844
|
this.direction = "cols";
|
|
@@ -7255,1609 +6870,24 @@ class ZikoUIGrid extends ZikoUIContainerElement {
|
|
|
7255
6870
|
}
|
|
7256
6871
|
const Grid$1 = (...ZikoUIElement) => new ZikoUIGrid("div").append(...ZikoUIElement);
|
|
7257
6872
|
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
open : openIcon,
|
|
7264
|
-
close : closeIcon
|
|
7265
|
-
}
|
|
7266
|
-
});
|
|
7267
|
-
this.summary=html("summary",summary).style({
|
|
7268
|
-
fontSize:"1.1em",
|
|
7269
|
-
padding:"0.625rem",
|
|
7270
|
-
fontWeight:"bold",
|
|
7271
|
-
listStyleType:`"${openIcon}"`,
|
|
7272
|
-
cursor:"pointer",
|
|
7273
|
-
});
|
|
7274
|
-
this.summary[0].style({
|
|
7275
|
-
marginLeft:"0.5em",
|
|
7276
|
-
});
|
|
7277
|
-
this.content=content.style({
|
|
7278
|
-
margin:"0.7em",
|
|
7279
|
-
});
|
|
7280
|
-
this.element?.append(this.summary.element,this.content.element);
|
|
7281
|
-
this.style({
|
|
7282
|
-
marginBottom:"0.7em",
|
|
7283
|
-
});
|
|
7284
|
-
watchAttr(this, e=>{
|
|
7285
|
-
if(e.target.isOpen){
|
|
7286
|
-
e.target.emit("open");
|
|
7287
|
-
if(this?.parent?.isAccordion){
|
|
7288
|
-
if(this.parent.cache.autoClose)this.parent.closeExcept(this);
|
|
7289
|
-
}
|
|
7290
|
-
this.summary.style({
|
|
7291
|
-
listStyleType:`"${this.cache.icons.close}"`
|
|
7292
|
-
});
|
|
7293
|
-
}
|
|
7294
|
-
else {
|
|
7295
|
-
e.target.emit("close");
|
|
7296
|
-
this.summary.style({
|
|
7297
|
-
listStyleType:`"${this.cache.icons.open}"`
|
|
7298
|
-
});
|
|
7299
|
-
}
|
|
7300
|
-
});
|
|
7301
|
-
}
|
|
7302
|
-
get isCollapsible(){
|
|
7303
|
-
return true;
|
|
7304
|
-
}
|
|
7305
|
-
get isOpen(){
|
|
7306
|
-
return this.element.open;
|
|
7307
|
-
}
|
|
7308
|
-
open(details=this){
|
|
7309
|
-
this.element.open=true;
|
|
7310
|
-
this.emit("open",details);
|
|
7311
|
-
return this;
|
|
7312
|
-
}
|
|
7313
|
-
close(){
|
|
7314
|
-
this.element.open=false;
|
|
7315
|
-
return this;
|
|
7316
|
-
}
|
|
7317
|
-
onOpen(callback){
|
|
7318
|
-
this.on("open", callback);
|
|
7319
|
-
return this;
|
|
7320
|
-
}
|
|
7321
|
-
onClose(callback){
|
|
7322
|
-
this.on("close", callback);
|
|
7323
|
-
return this;
|
|
7324
|
-
}
|
|
7325
|
-
toggle(){
|
|
7326
|
-
this.element.open=!this.element.open;
|
|
7327
|
-
return this;
|
|
7328
|
-
}
|
|
7329
|
-
}
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
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
|
+
});
|
|
7333
6878
|
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
this.items.forEach(n=>n.close());
|
|
7347
|
-
return this;
|
|
7348
|
-
}
|
|
7349
|
-
closeExcept(...Collapsibles){
|
|
7350
|
-
this.items.filter(n=>!Collapsibles.includes(n)).forEach(n=>n.close());
|
|
7351
|
-
return this;
|
|
7352
|
-
}
|
|
7353
|
-
open(CollapsibleOrIndex){
|
|
7354
|
-
CollapsibleOrIndex.isCollapsible? CollapsibleOrIndex.open(): this.items[CollapsibleOrIndex].open();
|
|
7355
|
-
this.closeExcept(CollapsibleOrIndex.isCollapsible? CollapsibleOrIndex: this.items[CollapsibleOrIndex]);
|
|
7356
|
-
return this;
|
|
7357
|
-
}
|
|
7358
|
-
enableAutoClose(){
|
|
7359
|
-
this.cache.autoClose = true;
|
|
7360
|
-
return this;
|
|
7361
|
-
}
|
|
7362
|
-
disableAutoClose(){
|
|
7363
|
-
this.cache.autoClose = false;
|
|
7364
|
-
return this;
|
|
7365
|
-
}
|
|
7366
|
-
toggleAutoClose(){
|
|
7367
|
-
this.cache.autoClose = !this.cache.autoClose;
|
|
7368
|
-
}
|
|
7369
|
-
}
|
|
7370
|
-
const Accordion = (... Collapsible) => new ZikoUIAccordion(...Collapsible);
|
|
7371
|
-
|
|
7372
|
-
class ZikoUIFlex extends ZikoUIContainerElement {
|
|
7373
|
-
constructor(tag = "div", w = "100%", h = "100%") {
|
|
7374
|
-
super(tag ,"Flex");
|
|
7375
|
-
this.direction = "cols";
|
|
7376
|
-
if (typeof w == "number") w += "%";
|
|
7377
|
-
if (typeof h == "number") h += "%";
|
|
7378
|
-
this.style({ width: w, height: h });
|
|
7379
|
-
this.style({ display: "flex" });
|
|
7380
|
-
// this.render();
|
|
7381
|
-
}
|
|
7382
|
-
get isFlex(){
|
|
7383
|
-
return true;
|
|
7384
|
-
}
|
|
7385
|
-
resp(px,wrap = true) {
|
|
7386
|
-
this.wrap(wrap);
|
|
7387
|
-
if (this.element.clientWidth < px) this.vertical();
|
|
7388
|
-
else this.horizontal();
|
|
7389
|
-
return this;
|
|
7390
|
-
}
|
|
7391
|
-
setSpaceAround() {
|
|
7392
|
-
this.style({ justifyContent: "space-around" });
|
|
7393
|
-
return this;
|
|
7394
|
-
}
|
|
7395
|
-
setSpaceBetween() {
|
|
7396
|
-
this.style({ justifyContent: "space-between" });
|
|
7397
|
-
return this;
|
|
7398
|
-
}
|
|
7399
|
-
setBaseline() {
|
|
7400
|
-
this.style({ alignItems: "baseline" });
|
|
7401
|
-
return this;
|
|
7402
|
-
}
|
|
7403
|
-
gap(g) {
|
|
7404
|
-
if (this.direction === "row") this.style({ columnGap: g });
|
|
7405
|
-
else if (this.direction === "column") this.style({ rowGap: g });
|
|
7406
|
-
return this;
|
|
7407
|
-
}
|
|
7408
|
-
wrap(value = "wrap") {
|
|
7409
|
-
const values = ["no-wrap", "wrap","wrap-reverse"];
|
|
7410
|
-
this.style({
|
|
7411
|
-
flexWrap: typeof value === "string" ? value : values[+value],
|
|
7412
|
-
});
|
|
7413
|
-
return this;
|
|
7414
|
-
}
|
|
7415
|
-
_justifyContent(align = "center") {
|
|
7416
|
-
this.style({ justifyContent: align });
|
|
7417
|
-
return this;
|
|
7418
|
-
}
|
|
7419
|
-
vertical(x, y, order=1) {
|
|
7420
|
-
set_vertical.call(this,order);
|
|
7421
|
-
this.style({
|
|
7422
|
-
alignItems: typeof(x)==="number"?map_pos_x.call(this,x):x,
|
|
7423
|
-
justifyContent: typeof(y)=="number"?map_pos_y.call(this,y):y
|
|
7424
|
-
});
|
|
7425
|
-
return this;
|
|
7426
|
-
}
|
|
7427
|
-
horizontal(x, y, order=1) {
|
|
7428
|
-
set_horizontal.call(this,order);
|
|
7429
|
-
this.style({
|
|
7430
|
-
alignItems: typeof(y)=="number"?map_pos_y.call(this,y):y,
|
|
7431
|
-
justifyContent: typeof(x)==="number"?map_pos_x.call(this,x):x
|
|
7432
|
-
});
|
|
7433
|
-
return this;
|
|
7434
|
-
}
|
|
7435
|
-
show() {
|
|
7436
|
-
this.isHidden = false;
|
|
7437
|
-
this.style({ display: "flex" });
|
|
7438
|
-
return this;
|
|
7439
|
-
}
|
|
7440
|
-
}
|
|
7441
|
-
|
|
7442
|
-
const Flex = (...ZikoUIElement) =>{
|
|
7443
|
-
let tag="div";
|
|
7444
|
-
if(typeof ZikoUIElement[0]==="string"){
|
|
7445
|
-
tag=ZikoUIElement[0];
|
|
7446
|
-
ZikoUIElement.pop();
|
|
7447
|
-
}
|
|
7448
|
-
return new ZikoUIFlex(tag).append(...ZikoUIElement);
|
|
7449
|
-
};
|
|
7450
|
-
function set_vertical(direction){
|
|
7451
|
-
direction == 1
|
|
7452
|
-
? this.style({ flexDirection: "column" })
|
|
7453
|
-
: direction == -1 && this.style({ flexDirection: "column-reverse" });
|
|
7454
|
-
return this;
|
|
7455
|
-
}
|
|
7456
|
-
function set_horizontal(direction){
|
|
7457
|
-
direction == 1
|
|
7458
|
-
? this.style({ flexDirection: "row" })
|
|
7459
|
-
: direction == -1 && this.style({ flexDirection: "row-reverse" });
|
|
7460
|
-
return this;
|
|
7461
|
-
}
|
|
7462
|
-
function map_pos_x(align){
|
|
7463
|
-
let pos = ["flex-start", "center", "flex-end"];
|
|
7464
|
-
if (typeof align === "number") align = pos[align + 1];
|
|
7465
|
-
return align;
|
|
7466
|
-
}
|
|
7467
|
-
function map_pos_y(align){
|
|
7468
|
-
return map_pos_x(-align);
|
|
7469
|
-
}
|
|
7470
|
-
|
|
7471
|
-
class ZikoUICarousel extends ZikoUIFlex{
|
|
7472
|
-
constructor(...ZikoUIElement){
|
|
7473
|
-
super();
|
|
7474
|
-
this.style({
|
|
7475
|
-
position:"relative",
|
|
7476
|
-
overflow:"hidden",
|
|
7477
|
-
touchAction:"none",
|
|
7478
|
-
userSelect:"none"
|
|
7479
|
-
});
|
|
7480
|
-
this.horizontal("space-around",0);
|
|
7481
|
-
this.track = Section(...ZikoUIElement).style({ display: "inline-flex" });
|
|
7482
|
-
this.track.size(this.track.children.length * 100 + "vw");
|
|
7483
|
-
this.track.setTarget(this);
|
|
7484
|
-
this.track.items.map((n) =>
|
|
7485
|
-
n.style({ pointerEvents: "none", margin: "auto 10px" })
|
|
7486
|
-
);
|
|
7487
|
-
this.x0 = null;
|
|
7488
|
-
this.tx = 0;
|
|
7489
|
-
this.onPtrMove(e=>{
|
|
7490
|
-
if(e.isDown){
|
|
7491
|
-
let x = e.event.pageX;
|
|
7492
|
-
let dx = x - this.x0;
|
|
7493
|
-
this.track.st.translateX(
|
|
7494
|
-
this.tx + dx,
|
|
7495
|
-
0
|
|
7496
|
-
);
|
|
7497
|
-
}
|
|
7498
|
-
});
|
|
7499
|
-
this.onPtrDown(e=>{
|
|
7500
|
-
console.log(e.event);
|
|
7501
|
-
this.x0 = e.event.pageX;
|
|
7502
|
-
const transformMatrix = window
|
|
7503
|
-
.getComputedStyle(this.track.element)
|
|
7504
|
-
.getPropertyValue("transform");
|
|
7505
|
-
if (transformMatrix !== "none") {
|
|
7506
|
-
this.tx = +transformMatrix.split(",")[4];
|
|
7507
|
-
}
|
|
7508
|
-
});
|
|
7509
|
-
this.onPtrUp(e=>console.log(e.isDown));
|
|
7510
|
-
this.onPtrLeave(e=>{
|
|
7511
|
-
// Handle outside up
|
|
7512
|
-
});
|
|
7513
|
-
}
|
|
7514
|
-
get isCarousel(){
|
|
7515
|
-
return true;
|
|
7516
|
-
}
|
|
7517
|
-
}
|
|
7518
|
-
const Carousel=(...ZikoUIElement)=>new ZikoUICarousel(...ZikoUIElement);
|
|
7519
|
-
|
|
7520
|
-
class ZikoUICodeNote extends ZikoUIFlex{
|
|
7521
|
-
constructor(){
|
|
7522
|
-
super("section");
|
|
7523
|
-
Object.assign(this.cache,{
|
|
7524
|
-
order:0,
|
|
7525
|
-
currentNote:null,
|
|
7526
|
-
currentNoteIndex:null
|
|
7527
|
-
});
|
|
7528
|
-
this.vertical(0,0);
|
|
7529
|
-
}
|
|
7530
|
-
get isCodeNote(){
|
|
7531
|
-
return true;
|
|
7532
|
-
}
|
|
7533
|
-
setCurrentNote(currentNote){
|
|
7534
|
-
this.cache.currentNote=currentNote;
|
|
7535
|
-
this.cache.currentNoteIndex=this.items.findIndex(n=>n===currentNote);
|
|
7536
|
-
currentNote.focus();
|
|
7537
|
-
this.items.forEach(n=>n.Input.style({
|
|
7538
|
-
border: "1px solid #ccc"
|
|
7539
|
-
}));
|
|
7540
|
-
currentNote.Input.style({
|
|
7541
|
-
border:"2px lightgreen solid"
|
|
7542
|
-
});
|
|
7543
|
-
return this;
|
|
7544
|
-
}
|
|
7545
|
-
addNote(text=""){
|
|
7546
|
-
this.append(CodeCell(text));
|
|
7547
|
-
return this;
|
|
7548
|
-
}
|
|
7549
|
-
execute(){
|
|
7550
|
-
this.cache.currentNote.execute();
|
|
7551
|
-
this.incrementOrder();
|
|
7552
|
-
return this;
|
|
7553
|
-
}
|
|
7554
|
-
incrementOrder(){
|
|
7555
|
-
this.cache.order++;
|
|
7556
|
-
this.cache.currentNote.setOrder(this.cache.order);
|
|
7557
|
-
return this;
|
|
7558
|
-
}
|
|
7559
|
-
next(){
|
|
7560
|
-
if(this.cache.currentNote===this.items.at(-1)){
|
|
7561
|
-
this.addNote();
|
|
7562
|
-
this.setCurrentNote(this.items.at(-1));
|
|
7563
|
-
}
|
|
7564
|
-
else this.setCurrentNote(this.items[this.cache.currentNoteIndex+1]);
|
|
7565
|
-
return this;
|
|
7566
|
-
}
|
|
7567
|
-
previous(){
|
|
7568
|
-
// add append before
|
|
7569
|
-
if(this.cache.currentNote!==this.items[0]){
|
|
7570
|
-
this.setCurrentNote(this.items[this.cache.currentNoteIndex-1]);
|
|
7571
|
-
}
|
|
7572
|
-
return this;
|
|
7573
|
-
}
|
|
7574
|
-
data(){
|
|
7575
|
-
return this.items.map(n=>n.cellData());
|
|
7576
|
-
}
|
|
7577
|
-
serialize(){
|
|
7578
|
-
return JSON.stringify(this.data());
|
|
7579
|
-
}
|
|
7580
|
-
import(data=[]){
|
|
7581
|
-
data.forEach((n,i)=>this.addNote(data[i].input));
|
|
7582
|
-
return this;
|
|
7583
|
-
}
|
|
7584
|
-
}
|
|
7585
|
-
const CodeNote=()=>new ZikoUICodeNote();
|
|
7586
|
-
|
|
7587
|
-
const Input=(codeText="")=>html("code",codeText).style({
|
|
7588
|
-
width:"100%",
|
|
7589
|
-
height:"auto",
|
|
7590
|
-
padding:"10px",
|
|
7591
|
-
boxSizing:"border-box",
|
|
7592
|
-
border: "1px solid #ccc",
|
|
7593
|
-
outline: "none",
|
|
7594
|
-
fontSize: "1rem",
|
|
7595
|
-
fontFamily: "Lucida Console, Courier New, monospace",
|
|
7596
|
-
padding: "1rem 0.5rem",
|
|
7597
|
-
wordBreak:"break-all",
|
|
7598
|
-
background:"#f6f8fa",
|
|
7599
|
-
color:"#0062C3"
|
|
7600
|
-
}).setAttr("contenteditable",true).setAttr("spellcheck",false);
|
|
7601
|
-
|
|
7602
|
-
const Output=()=>html("output").style({
|
|
7603
|
-
width:"100%",
|
|
7604
|
-
height:"auto",
|
|
7605
|
-
padding:"5px 0",
|
|
7606
|
-
});
|
|
7607
|
-
const Left=(ctx)=>Flex$1(
|
|
7608
|
-
text$1("[ ]")
|
|
7609
|
-
).style({
|
|
7610
|
-
width:"50px",
|
|
7611
|
-
//height:getComputedStyle(ctx.Input.element).height,
|
|
7612
|
-
height:"50px",
|
|
7613
|
-
margin:"10px 4px",
|
|
7614
|
-
padding:"5px",
|
|
7615
|
-
color:"darkblue",
|
|
7616
|
-
borderBottom:"4px solid gold",
|
|
7617
|
-
}).horizontal(0,0);
|
|
7618
|
-
const BTN_STYLE={
|
|
7619
|
-
background:"none",
|
|
7620
|
-
width:"25px",
|
|
7621
|
-
height:"25px",
|
|
7622
|
-
fontSize:"1.2rem",
|
|
7623
|
-
cursor:"pointer"
|
|
7624
|
-
};
|
|
7625
|
-
const Right=(ctx)=>Flex$1(
|
|
7626
|
-
text$1('▶️').style(BTN_STYLE).onClick(e=>{
|
|
7627
|
-
if(ctx.parent instanceof ZikoUICodeNote)ctx.parent.setCurrentNote(ctx);
|
|
7628
|
-
ctx.execute();
|
|
7629
|
-
globalThis.__Ziko__.__Config__.default.target=e.target.parent.parent[1][1];
|
|
7630
|
-
}),
|
|
7631
|
-
text$1('📋').style(BTN_STYLE).onClick(()=>{
|
|
7632
|
-
navigator.clipboard.writeText(ctx.codeText);
|
|
7633
|
-
}),
|
|
7634
|
-
text$1('✖️').style(BTN_STYLE).onClick(()=>ctx.remove()),
|
|
7635
|
-
text$1('✖️').style(BTN_STYLE).onClick(()=>ctx.remove()),
|
|
7636
|
-
).style({
|
|
7637
|
-
width:"70px",
|
|
7638
|
-
height:"50px",
|
|
7639
|
-
//background:"cyan",
|
|
7640
|
-
margin:"10px 0"
|
|
7641
|
-
}).horizontal(0,0).wrap(true);
|
|
7642
|
-
|
|
7643
|
-
class ZikoUICodeCell extends ZikoUIFlex{
|
|
7644
|
-
constructor(code="",{type="js",order=null}={}){
|
|
7645
|
-
super("section");
|
|
7646
|
-
Object.assign(this.cache,{
|
|
7647
|
-
state:null,
|
|
7648
|
-
order,
|
|
7649
|
-
type,
|
|
7650
|
-
metadata:{
|
|
7651
|
-
created:Date.now(),
|
|
7652
|
-
updated:null
|
|
7653
|
-
}
|
|
7654
|
-
});
|
|
7655
|
-
this.Input=Input(code);
|
|
7656
|
-
this.Output=Output();
|
|
7657
|
-
this.InOut=Flex(
|
|
7658
|
-
this.Input,
|
|
7659
|
-
this.Output
|
|
7660
|
-
).vertical().style({
|
|
7661
|
-
width:"100%",
|
|
7662
|
-
margin:"10px auto"
|
|
7663
|
-
});
|
|
7664
|
-
this.RightControl=Right(this);
|
|
7665
|
-
this.LeftControl=Left();
|
|
7666
|
-
this.append(
|
|
7667
|
-
this.LeftControl,
|
|
7668
|
-
this.InOut,
|
|
7669
|
-
this.RightControl
|
|
7670
|
-
);
|
|
7671
|
-
this.horizontal(-1,1).style({
|
|
7672
|
-
//background:"#444",
|
|
7673
|
-
width:"95vw",
|
|
7674
|
-
margin:"0 auto",
|
|
7675
|
-
border:"1px darkblue dotted"
|
|
7676
|
-
});
|
|
7677
|
-
let cm_content = this.Input.element.getElementsByClassName("cm-content")[0];
|
|
7678
|
-
if( cm_content ){
|
|
7679
|
-
cm_content.addEventListener("keydown",e=>{
|
|
7680
|
-
if(e.key === "Enter" && e.shiftKey){
|
|
7681
|
-
e.preventDefault();
|
|
7682
|
-
this.execute(this.cache.order);
|
|
7683
|
-
}
|
|
7684
|
-
});
|
|
7685
|
-
}
|
|
7686
|
-
else {
|
|
7687
|
-
this.Input.onKeyDown(e=>{
|
|
7688
|
-
if(e.kd==="Enter"){
|
|
7689
|
-
if(e.event.shiftKey){
|
|
7690
|
-
e.event.preventDefault();
|
|
7691
|
-
this.execute(this.cache.order);
|
|
7692
|
-
}
|
|
7693
|
-
}
|
|
7694
|
-
if(this.cache.parent instanceof ZikoUICodeNote){
|
|
7695
|
-
if(e.kd==="ArrowDown" && e.event.shiftKey ){
|
|
7696
|
-
this.cache.parent.next();
|
|
7697
|
-
}
|
|
7698
|
-
if(e.kd==="ArrowUp" && e.event.shiftKey){
|
|
7699
|
-
this.cache.parent.previous();
|
|
7700
|
-
}
|
|
7701
|
-
}
|
|
7702
|
-
}
|
|
7703
|
-
);
|
|
7704
|
-
this.Input.onFocus(()=>{
|
|
7705
|
-
if(this.cache.parent instanceof ZikoUICodeNote){
|
|
7706
|
-
this.cache.parent.cache.currentNote=this;
|
|
7707
|
-
this.cache.parent.setCurrentNote(this);
|
|
7708
|
-
}
|
|
7709
|
-
});
|
|
7710
|
-
this.Input.onPaste((e)=>{
|
|
7711
|
-
//e.event.preventDefault();
|
|
7712
|
-
//this.setValue(this.codeText.trim())
|
|
7713
|
-
});
|
|
7714
|
-
// this.Input.onKeyPress(e=>{
|
|
7715
|
-
// if(e.kp==="(")a.Input.element.textContent+=")";
|
|
7716
|
-
// if(e.kp==="[")a.Input.element.textContent+="]";
|
|
7717
|
-
// if(e.kp==="{")a.Input.element.textContent+="}";
|
|
7718
|
-
// })
|
|
7719
|
-
}
|
|
7720
|
-
}
|
|
7721
|
-
get isCodeCell(){
|
|
7722
|
-
return true;
|
|
7723
|
-
}
|
|
7724
|
-
// space  
|
|
7725
|
-
get codeText() {
|
|
7726
|
-
return (this.Input.element.getElementsByClassName("cm-content")[0])
|
|
7727
|
-
?this.Input.element.getElementsByClassName("cm-content")[0].innerText.trim()
|
|
7728
|
-
:this.Input.element.innerText.trim()
|
|
7729
|
-
// return this.Input.element.innerText.trim();
|
|
7730
|
-
}
|
|
7731
|
-
get codeHTML() {
|
|
7732
|
-
return this.Input.element.innerHTML;
|
|
7733
|
-
}
|
|
7734
|
-
get outputHTML(){
|
|
7735
|
-
return this.Output.element.innerHTML;
|
|
7736
|
-
}
|
|
7737
|
-
setValue(codeText){
|
|
7738
|
-
this.Input[0].setValue(codeText);
|
|
7739
|
-
return this;
|
|
7740
|
-
}
|
|
7741
|
-
cellData(){
|
|
7742
|
-
return {
|
|
7743
|
-
input:this.codeText,
|
|
7744
|
-
output:this.outputHTML,
|
|
7745
|
-
order:this.cache.order,
|
|
7746
|
-
type:this.cache.type
|
|
7747
|
-
}
|
|
7748
|
-
}
|
|
7749
|
-
execute(order){
|
|
7750
|
-
this.clearOutput();
|
|
7751
|
-
this.evaluate(order);
|
|
7752
|
-
this.cache.metadata.updated=Date.now();
|
|
7753
|
-
return this;
|
|
7754
|
-
}
|
|
7755
|
-
#evaluateJs(order){
|
|
7756
|
-
try{
|
|
7757
|
-
this.LeftControl[0].setValue("pending");
|
|
7758
|
-
this.cache.state="pending";
|
|
7759
|
-
// globalThis.eval(this.Input.element.innerText);
|
|
7760
|
-
globalThis.eval(this.codeText);
|
|
7761
|
-
|
|
7762
|
-
}
|
|
7763
|
-
catch(err){
|
|
7764
|
-
console.log(err);
|
|
7765
|
-
text(`Error : ${err.message}`).style({
|
|
7766
|
-
color:"red",
|
|
7767
|
-
background:"gold",
|
|
7768
|
-
border:"2px red solid",
|
|
7769
|
-
padding:"10px",
|
|
7770
|
-
margin:"10px 0",
|
|
7771
|
-
display:"flex",
|
|
7772
|
-
justifyContent: "center",
|
|
7773
|
-
});
|
|
7774
|
-
this.LeftControl[0].setValue("Err");
|
|
7775
|
-
this.cache.state="Error";
|
|
7776
|
-
}
|
|
7777
|
-
finally{
|
|
7778
|
-
if(this.cache.state==="pending"){
|
|
7779
|
-
this.cache.state="success";
|
|
7780
|
-
this.setOrder(order);
|
|
7781
|
-
if(this.cache.parent instanceof ZikoUICodeNote){
|
|
7782
|
-
this.cache.parent.incrementOrder();
|
|
7783
|
-
this.cache.parent.next();
|
|
7784
|
-
}
|
|
7785
|
-
}
|
|
7786
|
-
}
|
|
7787
|
-
}
|
|
7788
|
-
#evaluateMd(){
|
|
7789
|
-
|
|
7790
|
-
}
|
|
7791
|
-
#evaluateHtml(){
|
|
7792
|
-
|
|
7793
|
-
}
|
|
7794
|
-
evaluate(order){
|
|
7795
|
-
globalThis.__Ziko__.__Config__.default.target=this.Output.element;
|
|
7796
|
-
switch(this.cache.type){
|
|
7797
|
-
case "js":this.#evaluateJs(order);break;
|
|
7798
|
-
}
|
|
7799
|
-
return this;
|
|
7800
|
-
}
|
|
7801
|
-
clearInput(){
|
|
7802
|
-
this.Output.element.innerText="";
|
|
7803
|
-
return this;
|
|
7804
|
-
}
|
|
7805
|
-
clearOutput(){
|
|
7806
|
-
this.Output.element.innerText="";
|
|
7807
|
-
return this;
|
|
7808
|
-
}
|
|
7809
|
-
setOrder(order,render=true){
|
|
7810
|
-
this.cache.order=order;
|
|
7811
|
-
if(render){
|
|
7812
|
-
(typeof order === "number")?this.LeftControl[0].setValue(`[${order}]`):this.LeftControl[0].setValue("[-]");
|
|
7813
|
-
}
|
|
7814
|
-
return this;
|
|
7815
|
-
}
|
|
7816
|
-
focus(){
|
|
7817
|
-
this.Input.element.focus();
|
|
7818
|
-
return this;
|
|
7819
|
-
}
|
|
7820
|
-
}
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
const CodeCell=(codeText,{type,order}={})=>new ZikoUICodeCell(codeText,{type,order});
|
|
7824
|
-
|
|
7825
|
-
// Next
|
|
7826
|
-
// Previous
|
|
7827
|
-
// Vertical
|
|
7828
|
-
// Horizontal
|
|
7829
|
-
class ZikoUITabs extends ZikoUIFlex{
|
|
7830
|
-
#ACTIVE_ELEMENT_INDEX=0;
|
|
7831
|
-
constructor(Controllers,Contents){
|
|
7832
|
-
super("div","Tabs");
|
|
7833
|
-
Object.assign(this.cache,{
|
|
7834
|
-
config:{
|
|
7835
|
-
controllersPercent : .50
|
|
7836
|
-
}
|
|
7837
|
-
});
|
|
7838
|
-
this.style({
|
|
7839
|
-
boxSizing:"border-box",
|
|
7840
|
-
backgroundColor: "blanchedalmond",
|
|
7841
|
-
border:"1px red solid",
|
|
7842
|
-
margin:"30px",
|
|
7843
|
-
});
|
|
7844
|
-
this.controllersContainer = Flex().size("auto","auto").style({
|
|
7845
|
-
boxSizing:"border-box",
|
|
7846
|
-
justifyContent:"center",
|
|
7847
|
-
alignItems:"center",
|
|
7848
|
-
textAlign:"center",
|
|
7849
|
-
|
|
7850
|
-
minWidth:"50px",
|
|
7851
|
-
minHeight:"50px",
|
|
7852
|
-
|
|
7853
|
-
backgroundColor:"darkblue",
|
|
7854
|
-
border:"1px darkblue solid",
|
|
7855
|
-
|
|
7856
|
-
}).setAttr("role","tablist");
|
|
7857
|
-
this.contentContainer = Flex().style({
|
|
7858
|
-
boxSizing:"border-box",
|
|
7859
|
-
justifyContent:"center",
|
|
7860
|
-
alignItems:"center",
|
|
7861
|
-
textAlign:"center",
|
|
7862
|
-
|
|
7863
|
-
width:"100%",
|
|
7864
|
-
height:"100%",
|
|
7865
|
-
backgroundColor:"darkslategrey",
|
|
7866
|
-
});
|
|
7867
|
-
this.append(
|
|
7868
|
-
this.controllersContainer,
|
|
7869
|
-
this.contentContainer
|
|
7870
|
-
);
|
|
7871
|
-
if(Controllers.length!==Contents.length)console.error("");
|
|
7872
|
-
else {
|
|
7873
|
-
this.controllersContainer.append(...Controllers);
|
|
7874
|
-
this.contentContainer.append(...Contents);
|
|
7875
|
-
}
|
|
7876
|
-
this.init();
|
|
7877
|
-
this.display(0);
|
|
7878
|
-
this.useVertical();
|
|
7879
|
-
}
|
|
7880
|
-
get isTabs(){
|
|
7881
|
-
return true;
|
|
7882
|
-
}
|
|
7883
|
-
init(){
|
|
7884
|
-
// Remove old listener
|
|
7885
|
-
for(let i=0;i<this.controllersContainer.length;i++){
|
|
7886
|
-
this.controllersContainer[i].setAttr("role","tab").setAttr("aria-controls",`tab${i}`);
|
|
7887
|
-
this.contentContainer[i].setAttr("role","tabpanel").setAttr("aria-labelledby",`tab${i}`).setAttr("tabindex",-1);
|
|
7888
|
-
}
|
|
7889
|
-
this.controllersContainer.forEach(item=>item.onClick(e=>{
|
|
7890
|
-
const tab=e.target.element.getAttribute("aria-controls");
|
|
7891
|
-
const index=+tab.slice(3);
|
|
7892
|
-
this.contentContainer.filter(n=>n.element.getAttribute("aria-labelledby")===tab,()=>{
|
|
7893
|
-
if(this.#ACTIVE_ELEMENT_INDEX!==index)this.display(index);
|
|
7894
|
-
});
|
|
7895
|
-
}));
|
|
7896
|
-
return this;
|
|
7897
|
-
}
|
|
7898
|
-
addPairs(ControllerItem,ContentItem){
|
|
7899
|
-
this.controllersContainer.append(ControllerItem);
|
|
7900
|
-
this.contentContainer.append(ContentItem);
|
|
7901
|
-
const length=this.controllersContainer.length;
|
|
7902
|
-
this.controllersContainer.at(-1).setAttr("role","tab").setAttr("aria-controls",`tab${length-1}`);
|
|
7903
|
-
this.contentContainer.at(-1).setAttr("role","tabpanel").setAttr("aria-labelledby",`tab${length-1}`).setAttr("tabindex",-1);
|
|
7904
|
-
// Add listener
|
|
7905
|
-
return this;
|
|
7906
|
-
}
|
|
7907
|
-
removePairs(index){
|
|
7908
|
-
|
|
7909
|
-
}
|
|
7910
|
-
display(index){
|
|
7911
|
-
this.#ACTIVE_ELEMENT_INDEX=index%this.contentContainer.length;
|
|
7912
|
-
const ActiveContent = this.contentContainer.at(this.#ACTIVE_ELEMENT_INDEX);
|
|
7913
|
-
this.controllersContainer.forEach(n=>n.setAttr("tabindex",-1).setAttr("aria-selected",false));
|
|
7914
|
-
this.controllersContainer.at(this.#ACTIVE_ELEMENT_INDEX).setAttr("tabindex",0).setAttr("aria-selected",true);
|
|
7915
|
-
|
|
7916
|
-
this.contentContainer.forEach(n=>n.st.hide());
|
|
7917
|
-
|
|
7918
|
-
ActiveContent.st.translateX(100,0);
|
|
7919
|
-
ActiveContent.setAttr("tabindex",0).st.show();
|
|
7920
|
-
ActiveContent.st.translateX(0,1000);
|
|
7921
|
-
|
|
7922
|
-
return this;
|
|
7923
|
-
}
|
|
7924
|
-
next(i=1){
|
|
7925
|
-
this.display(this.#ACTIVE_ELEMENT_INDEX+i);
|
|
7926
|
-
return this;
|
|
7927
|
-
}
|
|
7928
|
-
previous(i=1){
|
|
7929
|
-
this.display(this.#ACTIVE_ELEMENT_INDEX-i);
|
|
7930
|
-
return this;
|
|
7931
|
-
}
|
|
7932
|
-
useVertical(){
|
|
7933
|
-
this.vertical(0,0);
|
|
7934
|
-
this.controllersContainer.horizontal(0,0);
|
|
7935
|
-
this.controllersContainer.style({
|
|
7936
|
-
width : "100%",
|
|
7937
|
-
height : `${this.cache.config.controllersPercent*100}%`
|
|
7938
|
-
});
|
|
7939
|
-
this.contentContainer.style({
|
|
7940
|
-
width : "100%",
|
|
7941
|
-
height : `${(1-this.cache.config.controllersPercent)*100}%`
|
|
7942
|
-
});
|
|
7943
|
-
return this;
|
|
7944
|
-
}
|
|
7945
|
-
useHorizontal(){
|
|
7946
|
-
this.horizontal(0,0);
|
|
7947
|
-
this.controllersContainer.vertical(0, 0);
|
|
7948
|
-
this.controllersContainer.style({
|
|
7949
|
-
height : "100%",
|
|
7950
|
-
width : `${this.cache.config.controllersPercent*100}%`
|
|
7951
|
-
});
|
|
7952
|
-
this.contentContainer.style({
|
|
7953
|
-
height : "100%",
|
|
7954
|
-
width : `${(1-this.cache.config.controllersPercent)*100}%`
|
|
7955
|
-
});
|
|
7956
|
-
return this;
|
|
7957
|
-
}
|
|
7958
|
-
// useHorizontalSwippe(){
|
|
7959
|
-
// this.onPtrDown();
|
|
7960
|
-
// this.onPtrUp(e=>this.next(Math.sign(e.swippe.delta_x)));
|
|
7961
|
-
// return this;
|
|
7962
|
-
// }
|
|
7963
|
-
// useVerticalSwippe(){
|
|
7964
|
-
// this.onPtrDown();
|
|
7965
|
-
// this.onPtrUp(e=>this.next(Math.sign(e.swippe.delta_y)));
|
|
7966
|
-
// return this;
|
|
7967
|
-
// }
|
|
7968
|
-
}
|
|
7969
|
-
|
|
7970
|
-
const Tabs=(Controllers,Contents)=>new ZikoUITabs(Controllers,Contents);
|
|
7971
|
-
|
|
7972
|
-
/*
|
|
7973
|
-
|
|
7974
|
-
const cont=(txt = "A")=>btn(txt).style({width:"170px"})
|
|
7975
|
-
a=Tabs(
|
|
7976
|
-
[cont("A1"),cont("A2"),cont("A3"),cont("A4")],
|
|
7977
|
-
[cont("A1"),cont("A2"),cont("A3"),cont("A4")]
|
|
7978
|
-
).vertical().size("400px")
|
|
7979
|
-
a.controllersContainer.style({
|
|
7980
|
-
overflowX:"auto"
|
|
7981
|
-
})
|
|
7982
|
-
a.useHorizontal()
|
|
7983
|
-
|
|
7984
|
-
*/
|
|
7985
|
-
|
|
7986
|
-
/*
|
|
7987
|
-
|
|
7988
|
-
a=Flex().size("400px","400px").style({background:"red"})
|
|
7989
|
-
a.element.animate([
|
|
7990
|
-
{ borderRadius: "0" , background : "red" },
|
|
7991
|
-
{ borderRadius: "50% 0" },
|
|
7992
|
-
{ borderRadius: "50% 50%" },
|
|
7993
|
-
{ borderRadius: "0 50%" },
|
|
7994
|
-
{ borderRadius: "0", background : "yellow" },
|
|
7995
|
-
],
|
|
7996
|
-
{
|
|
7997
|
-
// temporisation
|
|
7998
|
-
duration: 2000,
|
|
7999
|
-
iterations: Infinity,
|
|
8000
|
-
})
|
|
8001
|
-
|
|
8002
|
-
*/
|
|
8003
|
-
|
|
8004
|
-
const palette = {
|
|
8005
|
-
success: {
|
|
8006
|
-
titleColor:"green",
|
|
8007
|
-
contentColor: "#35495e",
|
|
8008
|
-
bgColor: "#d4edda", // Fixed
|
|
8009
|
-
bgColor:"linear-gradient(-225deg, #DFFFCD 0%, #90F9C4 48%, #39F3BB 100%)",
|
|
8010
|
-
borderColor: "#28a745", // Fixed
|
|
8011
|
-
icon: "✅"
|
|
8012
|
-
},
|
|
8013
|
-
info: {
|
|
8014
|
-
titleColor:"blue",
|
|
8015
|
-
contentColor: "#00204a",
|
|
8016
|
-
bgColor: "#93deff", // Fixed
|
|
8017
|
-
bgColor:"radial-gradient(circle at 10% 20%, rgb(147, 230, 241) 0%, rgb(145, 192, 241) 45.5%)",
|
|
8018
|
-
borderColor: "#005689", // Fixed
|
|
8019
|
-
icon: "ℹ️"
|
|
8020
|
-
},
|
|
8021
|
-
warning: {
|
|
8022
|
-
titleColor:"#e4663a",
|
|
8023
|
-
contentColor: "#45171d",
|
|
8024
|
-
bgColor:"#fdffcd",
|
|
8025
|
-
bgColor:"radial-gradient(907px at 3.4% 19.8%, rgb(255, 243, 122) 0%, rgb(255, 102, 145) 97.4%)",
|
|
8026
|
-
borderColor: "#efd510",
|
|
8027
|
-
icon: "⚠️"
|
|
8028
|
-
},
|
|
8029
|
-
danger: {
|
|
8030
|
-
titleColor:"red",
|
|
8031
|
-
contentColor: "#721c24",
|
|
8032
|
-
bgColor: "#f8d7da", // Fixed
|
|
8033
|
-
bgColor:"linear-gradient(90deg, rgb(255, 157, 129) 24.3%, rgb(255, 138, 138) 78.3%)",
|
|
8034
|
-
borderColor: "#c50000", // Fixed
|
|
8035
|
-
icon: "❌"
|
|
8036
|
-
},
|
|
8037
|
-
tips: {
|
|
8038
|
-
titleColor:null,
|
|
8039
|
-
contentColor: null,
|
|
8040
|
-
bgColor: null,
|
|
8041
|
-
borderColor: null,
|
|
8042
|
-
icon: "💡"
|
|
8043
|
-
},
|
|
8044
|
-
important: {
|
|
8045
|
-
titleColor:null,
|
|
8046
|
-
contentColor: null,
|
|
8047
|
-
bgColor: null,
|
|
8048
|
-
borderColor: null,
|
|
8049
|
-
icon: "📌"
|
|
8050
|
-
},
|
|
8051
|
-
|
|
8052
|
-
};
|
|
8053
|
-
|
|
8054
|
-
class ZikoUIAlert extends ZikoUIFlex$1{
|
|
8055
|
-
constructor(type, title, content){
|
|
8056
|
-
super();
|
|
8057
|
-
this.title = h3(title);
|
|
8058
|
-
this.icon = text$1(palette[type].icon).style({
|
|
8059
|
-
display: "flex",
|
|
8060
|
-
justifyContent:"center",
|
|
8061
|
-
borderRadius:"50%",
|
|
8062
|
-
minWidth:"30px",
|
|
8063
|
-
minHeight:"30px",
|
|
8064
|
-
});
|
|
8065
|
-
this.content = content;
|
|
8066
|
-
this.vertical()
|
|
8067
|
-
.size("200px", "auto")
|
|
8068
|
-
.style({
|
|
8069
|
-
borderRadius:"10px",
|
|
8070
|
-
padding:"10px"
|
|
8071
|
-
});
|
|
8072
|
-
this.append(
|
|
8073
|
-
Flex$1(
|
|
8074
|
-
this.title,
|
|
8075
|
-
this.icon
|
|
8076
|
-
).size("100%", "40px").style({}).horizontal("space-between",0),
|
|
8077
|
-
this.content
|
|
8078
|
-
);
|
|
8079
|
-
this.useType(type);
|
|
8080
|
-
}
|
|
8081
|
-
get isAlert(){
|
|
8082
|
-
return true;
|
|
8083
|
-
}
|
|
8084
|
-
useType(type){
|
|
8085
|
-
this.style({
|
|
8086
|
-
color:palette[type].color,
|
|
8087
|
-
background:palette[type].bgColor,
|
|
8088
|
-
border: `1px darkblue solid`,
|
|
8089
|
-
borderLeft: `15px ${palette[type].borderColor} solid`,
|
|
8090
|
-
});
|
|
8091
|
-
this.title.style({
|
|
8092
|
-
color:palette[type].titleColor
|
|
8093
|
-
});
|
|
8094
|
-
this.content.st.color(palette[type].titleColor);
|
|
8095
|
-
this.icon.setValue(palette[type].icon).style({
|
|
8096
|
-
border:`2px ${palette[type].borderColor} solid`,
|
|
8097
|
-
alignItems: type==="warning"?"flex-start":"center",
|
|
8098
|
-
});
|
|
8099
|
-
return this;
|
|
8100
|
-
}
|
|
8101
|
-
useSuccess(){
|
|
8102
|
-
this.useType("success");
|
|
8103
|
-
return this;
|
|
8104
|
-
}
|
|
8105
|
-
useInfo(){
|
|
8106
|
-
this.useType("info");
|
|
8107
|
-
return this;
|
|
8108
|
-
}
|
|
8109
|
-
useWarning(){
|
|
8110
|
-
this.useType("warning");
|
|
8111
|
-
return this;
|
|
8112
|
-
}
|
|
8113
|
-
useDanger(){
|
|
8114
|
-
this.useType("danger");
|
|
8115
|
-
return this;
|
|
8116
|
-
}
|
|
8117
|
-
}
|
|
8118
|
-
|
|
8119
|
-
const successAlert=(title, content)=>new ZikoUIAlert("success", title, content);
|
|
8120
|
-
const infoAlert=(title, content)=>new ZikoUIAlert("info", title, content);
|
|
8121
|
-
const warningAlert=(title, content)=>new ZikoUIAlert("warning", title, content);
|
|
8122
|
-
const dangerAlert=(title, content)=>new ZikoUIAlert("danger", title, content);
|
|
8123
|
-
|
|
8124
|
-
class __ZikoUISplitter__ extends ZikoUIElement{
|
|
8125
|
-
constructor(flexDirection, resizerCursor, resizerProp){
|
|
8126
|
-
super("div", "Splitter");
|
|
8127
|
-
Object.assign(this.cache,{
|
|
8128
|
-
isResizing : false,
|
|
8129
|
-
flexDirection,
|
|
8130
|
-
resizerCursor,
|
|
8131
|
-
resizerProp
|
|
8132
|
-
});
|
|
8133
|
-
this.style({
|
|
8134
|
-
display:"flex",
|
|
8135
|
-
flexDirection : this.cache.flexDirection,
|
|
8136
|
-
border: "2px solid #333",
|
|
8137
|
-
overflow: "hidden"
|
|
8138
|
-
});
|
|
8139
|
-
this.resizer = new ZikoUIElement("div", "resizer").style({
|
|
8140
|
-
[this.cache.resizerProp]:"5px",
|
|
8141
|
-
backgroundColor: "gold",
|
|
8142
|
-
cursor: this.cache.resizerCursor,
|
|
8143
|
-
touchAction: "none",
|
|
8144
|
-
});
|
|
8145
|
-
this.onPtrDown(e=>{
|
|
8146
|
-
this.cache.isResizing = true;
|
|
8147
|
-
this.style({
|
|
8148
|
-
cursor : this.cache.resizerCursor // ns-resize
|
|
8149
|
-
});
|
|
8150
|
-
this.resizer.element.setPointerCapture(e.event.pointerId);
|
|
8151
|
-
});
|
|
8152
|
-
this.onPtrUp(e=>{
|
|
8153
|
-
this.cache.isResizing = false;
|
|
8154
|
-
this.style({
|
|
8155
|
-
cursor: "default"
|
|
8156
|
-
});
|
|
8157
|
-
this.resizer.element.releasePointerCapture(e.event.pointerId);
|
|
8158
|
-
});
|
|
8159
|
-
this.onPtrCancel(()=>{
|
|
8160
|
-
this.cache.isResizing = false;
|
|
8161
|
-
this.style({
|
|
8162
|
-
cursor: "default"
|
|
8163
|
-
});
|
|
8164
|
-
});
|
|
8165
|
-
this.onPtrOut(()=>{
|
|
8166
|
-
if (this.cache.isResizing) {
|
|
8167
|
-
this.cache.isResizing = false;
|
|
8168
|
-
this.style({
|
|
8169
|
-
cursor: "default"
|
|
8170
|
-
});
|
|
8171
|
-
}
|
|
8172
|
-
});
|
|
8173
|
-
}
|
|
8174
|
-
get isSplitter(){
|
|
8175
|
-
return true;
|
|
8176
|
-
}
|
|
8177
|
-
styleResizer(style={}){
|
|
8178
|
-
this.resizer.style(style);
|
|
8179
|
-
return this;
|
|
8180
|
-
}
|
|
8181
|
-
}
|
|
8182
|
-
|
|
8183
|
-
class ZikoUIHorizontalSplitter extends __ZikoUISplitter__{
|
|
8184
|
-
constructor(leftPane, rightPane){
|
|
8185
|
-
super("row", "ew-resize", "width");
|
|
8186
|
-
this.leftPane = leftPane.style({
|
|
8187
|
-
width:"50%",
|
|
8188
|
-
flexGrow: 1,
|
|
8189
|
-
overflow: "hidden"
|
|
8190
|
-
});
|
|
8191
|
-
this.rightPane = rightPane.style({
|
|
8192
|
-
width:"50%",
|
|
8193
|
-
flexGrow: 1,
|
|
8194
|
-
overflow: "hidden"
|
|
8195
|
-
});
|
|
8196
|
-
this.element?.append(
|
|
8197
|
-
this.leftPane.element,
|
|
8198
|
-
this.resizer.element,
|
|
8199
|
-
this.rightPane.element
|
|
8200
|
-
);
|
|
8201
|
-
this.onPtrMove(e=>{
|
|
8202
|
-
if (!this.cache.isResizing) return;
|
|
8203
|
-
const containerWidth = this.element.getBoundingClientRect().width; // height
|
|
8204
|
-
const pointerRelativeXpos = e.event.clientX - this.element.getBoundingClientRect().x; // y
|
|
8205
|
-
let newLeftPaneWidth = (pointerRelativeXpos / containerWidth) * 100;
|
|
8206
|
-
let newRightPaneWidth = 100 - newLeftPaneWidth;
|
|
8207
|
-
if (newLeftPaneWidth < 0) newLeftPaneWidth = 0;
|
|
8208
|
-
if (newRightPaneWidth < 0) newRightPaneWidth = 0;
|
|
8209
|
-
this.leftPane.element.style.width = `${newLeftPaneWidth}%`;
|
|
8210
|
-
this.rightPane.element.style.width = `${newRightPaneWidth}%`;
|
|
8211
|
-
});
|
|
8212
|
-
}
|
|
8213
|
-
get isHorizontalSplitter(){
|
|
8214
|
-
return true;
|
|
8215
|
-
}
|
|
8216
|
-
}
|
|
8217
|
-
const hSplitter=(leftPane, rightPane)=>new ZikoUIHorizontalSplitter(leftPane, rightPane);
|
|
8218
|
-
|
|
8219
|
-
class ZikoUIVerticalSplitter extends __ZikoUISplitter__{
|
|
8220
|
-
constructor(topPane, bottomPane){
|
|
8221
|
-
super("column", "ns-resize", "height");
|
|
8222
|
-
this.topPane = topPane.style({
|
|
8223
|
-
height:"50%",
|
|
8224
|
-
flexGrow: 1,
|
|
8225
|
-
overflow: "hidden"
|
|
8226
|
-
});
|
|
8227
|
-
this.bottomPane = bottomPane.style({
|
|
8228
|
-
height:"50%",
|
|
8229
|
-
flexGrow: 1,
|
|
8230
|
-
overflow: "hidden"
|
|
8231
|
-
});
|
|
8232
|
-
this.element?.append(
|
|
8233
|
-
this.topPane.element,
|
|
8234
|
-
this.resizer.element,
|
|
8235
|
-
this.bottomPane.element
|
|
8236
|
-
);
|
|
8237
|
-
this.onPtrMove(e=>{
|
|
8238
|
-
if (!this.cache.isResizing) return;
|
|
8239
|
-
const containerHeight = this.element.getBoundingClientRect().height; // height
|
|
8240
|
-
const pointerRelativeYpos = e.event.clientY - this.element.getBoundingClientRect().y; // y
|
|
8241
|
-
let newTopPaneHeight = (pointerRelativeYpos / containerHeight) * 100;
|
|
8242
|
-
let newBottomPaneHeight = 100 - newTopPaneHeight;
|
|
8243
|
-
if (newTopPaneHeight < 0) newTopPaneHeight = 0;
|
|
8244
|
-
if (newBottomPaneHeight < 0) newBottomPaneHeight = 0;
|
|
8245
|
-
this.topPane.element.style.height = `${newTopPaneHeight}%`;
|
|
8246
|
-
this.bottomPane.element.style.height = `${newBottomPaneHeight}%`;
|
|
8247
|
-
});
|
|
8248
|
-
}
|
|
8249
|
-
get isHorizontalSplitter(){
|
|
8250
|
-
return true;
|
|
8251
|
-
}
|
|
8252
|
-
}
|
|
8253
|
-
const vSplitter=(topPane, bottomPane)=>new ZikoUIVerticalSplitter(topPane, bottomPane);
|
|
8254
|
-
|
|
8255
|
-
const Splitter = ({orintation = "horizontal",slides = []}) =>{
|
|
8256
|
-
if(["v","vertical"].includes(orintation.toLowerCase())) return vSplitter(...slides);
|
|
8257
|
-
else if(["h","horizontal"].includes(orintation.toLowerCase())) return hSplitter(...slides);
|
|
8258
|
-
else ;
|
|
8259
|
-
};
|
|
8260
|
-
|
|
8261
|
-
class ZikoUIBreadcrumbs extends ZikoUIElement{
|
|
8262
|
-
constructor(...items){
|
|
8263
|
-
super("ul", "Breadcrumbs");
|
|
8264
|
-
Object.assign(this.cache,{
|
|
8265
|
-
separatorTextContent:"/"
|
|
8266
|
-
});
|
|
8267
|
-
this.style({
|
|
8268
|
-
listStyle: "none",
|
|
8269
|
-
display: "flex",
|
|
8270
|
-
flexWrap: "wrap"
|
|
8271
|
-
});
|
|
8272
|
-
this.list=html('li').style({
|
|
8273
|
-
display: "flex",
|
|
8274
|
-
flexWrap: "wrap"
|
|
8275
|
-
});
|
|
8276
|
-
this.append(...items);
|
|
8277
|
-
}
|
|
8278
|
-
#addItem(item){
|
|
8279
|
-
if(["string","number","boolean"].includes(typeof item))item = text$1(item);
|
|
8280
|
-
const li = html("li", item).style({
|
|
8281
|
-
display: "flex",
|
|
8282
|
-
alignItems: "center"
|
|
8283
|
-
});
|
|
8284
|
-
if(this.element.children.length>0){
|
|
8285
|
-
const separator = text$1(this.cache.separatorTextContent).style({
|
|
8286
|
-
padding: "0 4px"
|
|
8287
|
-
});
|
|
8288
|
-
this.element?.append(separator.element);
|
|
8289
|
-
}
|
|
8290
|
-
this.element?.append(li.element);
|
|
8291
|
-
}
|
|
8292
|
-
append(...items){
|
|
8293
|
-
items.forEach(n=>this.#addItem(n));
|
|
8294
|
-
return this;
|
|
8295
|
-
}
|
|
8296
|
-
configSeparator(separatorTextContent = this.cache.separator, style = {}){
|
|
8297
|
-
this.cache.separatorTextContent = separatorTextContent;
|
|
8298
|
-
const separators = [...this.element.children].filter(n=>n.tagName==="SPAN");
|
|
8299
|
-
separators.forEach(node=>{
|
|
8300
|
-
node.textContent = separatorTextContent;
|
|
8301
|
-
Object.assign(node.style, style);
|
|
8302
|
-
}
|
|
8303
|
-
);
|
|
8304
|
-
return this;
|
|
8305
|
-
}
|
|
8306
|
-
}
|
|
8307
|
-
const Breadcrumbs=(...items)=>new ZikoUIBreadcrumbs(...items);
|
|
8308
|
-
|
|
8309
|
-
class ZikoUIMenu3d extends ZikoUIFlex$1{
|
|
8310
|
-
constructor(controller, content){
|
|
8311
|
-
super("div", "menu3d");
|
|
8312
|
-
this.controller = controller;
|
|
8313
|
-
this.content = content;
|
|
8314
|
-
this.cover = null;
|
|
8315
|
-
Object.assign(this.cache,{
|
|
8316
|
-
config:{
|
|
8317
|
-
useTransfo : false,
|
|
8318
|
-
isOpen : false,
|
|
8319
|
-
position : "left",
|
|
8320
|
-
threshold : 40,
|
|
8321
|
-
angle : 70,
|
|
8322
|
-
overlap : 6,
|
|
8323
|
-
width : 300,
|
|
8324
|
-
height : 300,
|
|
8325
|
-
transitionDuration: '0.5s',
|
|
8326
|
-
transitionEasing: 'ease',
|
|
8327
|
-
menuTransformOrigin : null,
|
|
8328
|
-
menuTransformClosed : null,
|
|
8329
|
-
menuTransformOpened : null,
|
|
8330
|
-
contentTransformOrigin : null,
|
|
8331
|
-
contentTransformClosed : null,
|
|
8332
|
-
contentTransformOpened : null,
|
|
8333
|
-
}
|
|
8334
|
-
});
|
|
8335
|
-
this.append(
|
|
8336
|
-
this.controller,
|
|
8337
|
-
this.content
|
|
8338
|
-
);
|
|
8339
|
-
this.update();
|
|
8340
|
-
}
|
|
8341
|
-
get isOpen(){
|
|
8342
|
-
return this.cache.config.isOpen;
|
|
8343
|
-
}
|
|
8344
|
-
update(){
|
|
8345
|
-
this.controller.style({
|
|
8346
|
-
display:"none",
|
|
8347
|
-
padding:"20px",
|
|
8348
|
-
overflow:"auto",
|
|
8349
|
-
background:"darkblue",
|
|
8350
|
-
color: "#eee",
|
|
8351
|
-
webkitboxSizing: "border-box",
|
|
8352
|
-
mozBoxSizing: "border-box",
|
|
8353
|
-
boxSizing:"border-box",
|
|
8354
|
-
});
|
|
8355
|
-
this.content.style({
|
|
8356
|
-
padding:"20px 40px",
|
|
8357
|
-
width: "100%",
|
|
8358
|
-
height: "100%",
|
|
8359
|
-
// overflowY:"auto",
|
|
8360
|
-
background:"gold",
|
|
8361
|
-
color: "#eee",
|
|
8362
|
-
webkitboxSizing: "border-box",
|
|
8363
|
-
mozBoxSizing: "border-box",
|
|
8364
|
-
boxSizing:"border-box",
|
|
8365
|
-
webkitOverflowScrolling:"touch",
|
|
8366
|
-
webkitTransformStyle: "preserve-3d"
|
|
8367
|
-
});
|
|
8368
|
-
this.setupPositions();
|
|
8369
|
-
this.setupWrapper();
|
|
8370
|
-
this.setupCover();
|
|
8371
|
-
this.setupMenu();
|
|
8372
|
-
this.setupContent();
|
|
8373
|
-
}
|
|
8374
|
-
setupPositions() {
|
|
8375
|
-
this.cache.config.menuTransformOpened = '';
|
|
8376
|
-
this.cache.config.contentTransformClosed = '';
|
|
8377
|
-
let menuAngle = this.cache.config.angle;
|
|
8378
|
-
let contentAngle = this.cache.config.angle / -2;
|
|
8379
|
-
switch( this.cache.config.position ) {
|
|
8380
|
-
case "top":
|
|
8381
|
-
this.cache.config.menuTransformOrigin = '50% 0%';
|
|
8382
|
-
this.cache.config.menuTransformClosed = `rotateX(${menuAngle}deg) translateY(-100%) translateY(${this.cache.config.overlap}px)`;
|
|
8383
|
-
this.cache.config.contentTransformOrigin = '50% 0';
|
|
8384
|
-
this.cache.config.contentTransformOpened = `translateY(${this.height/2}px) rotateX(${contentAngle}deg)`;
|
|
8385
|
-
break;
|
|
8386
|
-
case "right":
|
|
8387
|
-
this.cache.config.menuTransformOrigin = '100% 50%';
|
|
8388
|
-
this.cache.config.menuTransformClosed = 'rotateY( ' + menuAngle + 'deg ) translateX( 100% ) translateX( -2px ) scale( 1.01 )';
|
|
8389
|
-
this.cache.config.contentTransformOrigin = '100% 50%';
|
|
8390
|
-
this.cache.config.contentTransformOpened = 'translateX( -'+ this.width/2 +'px ) rotateY( ' + contentAngle + 'deg )';
|
|
8391
|
-
break;
|
|
8392
|
-
case "bottom":
|
|
8393
|
-
this.cache.config.menuTransformOrigin = '50% 100%';
|
|
8394
|
-
this.cache.config.menuTransformClosed = 'rotateX( ' + -menuAngle + 'deg ) translateY( 100% ) translateY( -'+ this.cache.config.overlap +'px )';
|
|
8395
|
-
this.cache.config.contentTransformOrigin = '50% 100%';
|
|
8396
|
-
this.cache.config.contentTransformOpened = 'translateY( -'+ this.height/2 +'px ) rotateX( ' + -contentAngle + 'deg )';
|
|
8397
|
-
break;
|
|
8398
|
-
default:
|
|
8399
|
-
this.cache.config.menuTransformOrigin = '100% 50%';
|
|
8400
|
-
this.cache.config.menuTransformClosed = 'translateX( -100% ) translateX( '+ this.cache.config.overlap +'px ) scale( 1.01 ) rotateY( ' + -menuAngle + 'deg )';
|
|
8401
|
-
this.cache.config.contentTransformOrigin = '0 50%';
|
|
8402
|
-
this.cache.config.contentTransformOpened = 'translateX( '+ this.width/2 +'px ) rotateY( ' + -contentAngle + 'deg )';
|
|
8403
|
-
break;
|
|
8404
|
-
}
|
|
8405
|
-
}
|
|
8406
|
-
setupWrapper() {
|
|
8407
|
-
this.style({
|
|
8408
|
-
perspective : "800px",
|
|
8409
|
-
perspectiveOrigin : this.cache.config.contentTransformOrigin
|
|
8410
|
-
});
|
|
8411
|
-
}
|
|
8412
|
-
setupCover(){
|
|
8413
|
-
if( this.cover ) this.cover.element.parentNode.removeChild( this.cover.element );
|
|
8414
|
-
this.cover=new ZikoUIElement("div","div").style({
|
|
8415
|
-
position:"absolute",
|
|
8416
|
-
display:"block",
|
|
8417
|
-
width:"100%",
|
|
8418
|
-
height:"100%",
|
|
8419
|
-
left:0,
|
|
8420
|
-
top:0,
|
|
8421
|
-
zIndex:1000,
|
|
8422
|
-
visibility:"hidden",
|
|
8423
|
-
opacity:0,
|
|
8424
|
-
transition: `all ${this.cache.config.transitionDuration} ${this.cache.config.transitionEasing}`
|
|
8425
|
-
});
|
|
8426
|
-
this.content.element.appendChild( this.cover.element );
|
|
8427
|
-
}
|
|
8428
|
-
setupMenu() {
|
|
8429
|
-
// var style = dom.menu.style;
|
|
8430
|
-
switch( this.cache.config.position ) {
|
|
8431
|
-
case "top":
|
|
8432
|
-
this.controller.style({
|
|
8433
|
-
width : "100%",
|
|
8434
|
-
height : `${this.height/2}px`
|
|
8435
|
-
});break;
|
|
8436
|
-
case "right":
|
|
8437
|
-
this.controller.style({
|
|
8438
|
-
right : 0,
|
|
8439
|
-
width : `${this.width/2}px`,
|
|
8440
|
-
height : "100%"
|
|
8441
|
-
});break;
|
|
8442
|
-
case "bottom":
|
|
8443
|
-
this.controller.style({
|
|
8444
|
-
bottom : "0",
|
|
8445
|
-
width : "100%",
|
|
8446
|
-
height : `${this.height/2}px`
|
|
8447
|
-
});break;
|
|
8448
|
-
case "left":
|
|
8449
|
-
this.controller.style({
|
|
8450
|
-
width : `${this.width/2}px`,
|
|
8451
|
-
height : "100%"
|
|
8452
|
-
});break;
|
|
8453
|
-
}
|
|
8454
|
-
this.controller.style({
|
|
8455
|
-
position : "fixed",
|
|
8456
|
-
display : "block",
|
|
8457
|
-
zIndex : 1,
|
|
8458
|
-
transform : this.cache.config.menuTransformClosed,
|
|
8459
|
-
transformOrigin : this.cache.config.menuTransformOrigin,
|
|
8460
|
-
transition : 'all ' + this.cache.config.transitionDuration +' '+ this.cache.config.transitionEasing
|
|
8461
|
-
});
|
|
8462
|
-
}
|
|
8463
|
-
setupContent() {
|
|
8464
|
-
this.content.style({
|
|
8465
|
-
transform : this.cache.config.contentTransformClosed,
|
|
8466
|
-
transformOrigin : this.cache.config.contentTransformOrigin,
|
|
8467
|
-
transition : `all ${this.cache.config.transitionDuration} ${this.cache.config.transitionEasing}`
|
|
8468
|
-
});
|
|
8469
|
-
}
|
|
8470
|
-
open(){
|
|
8471
|
-
if(!this.cache.config.isOpen){
|
|
8472
|
-
this.cache.config.isOpen = true;
|
|
8473
|
-
this.cover.style({
|
|
8474
|
-
height : this.content.element.scrollHeight + "px",
|
|
8475
|
-
visibility : "visible",
|
|
8476
|
-
opacity : 1,
|
|
8477
|
-
});
|
|
8478
|
-
if(this.cache.config.useTransfo)this.content.style({
|
|
8479
|
-
transform : this.cache.config.contentTransformOpened,
|
|
8480
|
-
userSelect : "default"
|
|
8481
|
-
});
|
|
8482
|
-
this.controller.style({
|
|
8483
|
-
transform : this.cache.config.menuTransformOpened,
|
|
8484
|
-
useSelect : "none"
|
|
8485
|
-
});
|
|
8486
|
-
this.emit("opened");
|
|
8487
|
-
}
|
|
8488
|
-
}
|
|
8489
|
-
close() {
|
|
8490
|
-
if( this.cache.config.isOpen ) {
|
|
8491
|
-
this.cache.config.isOpen = false;
|
|
8492
|
-
this.cover.style({
|
|
8493
|
-
// height : this.content.element.scrollHeight + "px",
|
|
8494
|
-
visibility : "hidden",
|
|
8495
|
-
opacity : 0,
|
|
8496
|
-
});
|
|
8497
|
-
this.content.style({
|
|
8498
|
-
transform : this.cache.config.contentTransformClosed,
|
|
8499
|
-
useSelect : "default"
|
|
8500
|
-
});
|
|
8501
|
-
this.controller.style({
|
|
8502
|
-
transform : this.cache.config.menuTransformClosed,
|
|
8503
|
-
userSelect : "none"
|
|
8504
|
-
});
|
|
8505
|
-
}
|
|
8506
|
-
this.emit("closed");
|
|
8507
|
-
}
|
|
8508
|
-
onOpen(callback){
|
|
8509
|
-
this.on("opened", callback.bind(this));
|
|
8510
|
-
return this;
|
|
8511
|
-
}
|
|
8512
|
-
onClose(callback){
|
|
8513
|
-
this.on("closed", callback.bind(this));
|
|
8514
|
-
return this;
|
|
8515
|
-
}
|
|
8516
|
-
#usePosition(position){
|
|
8517
|
-
if(this.cache.config.position!==position){
|
|
8518
|
-
this.cache.config.position=position;
|
|
8519
|
-
const isOpen = this.isOpen;
|
|
8520
|
-
this.close();
|
|
8521
|
-
this.update();
|
|
8522
|
-
if(isOpen)this.open();
|
|
8523
|
-
}
|
|
8524
|
-
}
|
|
8525
|
-
useRight(){
|
|
8526
|
-
this.#usePosition("left");
|
|
8527
|
-
return this;
|
|
8528
|
-
}
|
|
8529
|
-
useRight(){
|
|
8530
|
-
this.#usePosition("right");
|
|
8531
|
-
return this;
|
|
8532
|
-
}
|
|
8533
|
-
useTop(){
|
|
8534
|
-
this.#usePosition("top");
|
|
8535
|
-
return this;
|
|
8536
|
-
}
|
|
8537
|
-
useBottom(){
|
|
8538
|
-
this.#usePosition("bottom");
|
|
8539
|
-
return this;
|
|
8540
|
-
}
|
|
8541
|
-
}
|
|
8542
|
-
const menu3d = (controller, content) => new ZikoUIMenu3d(controller, content);
|
|
8543
|
-
globalThis.menu3d = menu3d;
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
/*
|
|
8547
|
-
|
|
8548
|
-
a = menu3d(Flex(text("Menu")), Flex(text("Content")))
|
|
8549
|
-
.size("80vw", "50vh")
|
|
8550
|
-
.style({ userSelect: "none" });
|
|
8551
|
-
a.onOpen((e) => console.log(e));
|
|
8552
|
-
a.open();
|
|
8553
|
-
a.controller.onSwipe(0.05, 1, (e) => {
|
|
8554
|
-
if (e.event.detail.direction.x === "left") a.close();
|
|
8555
|
-
});
|
|
8556
|
-
a.content.onSwipe(0.1, 1, (e) => {
|
|
8557
|
-
if (e.event.detail.direction.x === "left") a.close();
|
|
8558
|
-
if (e.event.detail.direction.x === "right") a.open();
|
|
8559
|
-
});
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
*/
|
|
8563
|
-
|
|
8564
|
-
class ZikoUIModal extends ZikoUIContainerElement{
|
|
8565
|
-
constructor(...UIElements){
|
|
8566
|
-
super("dialog", "modal");
|
|
8567
|
-
this.append(...UIElements);
|
|
8568
|
-
Object.assign(this.cache,{
|
|
8569
|
-
config:{
|
|
8570
|
-
mode:"modal",
|
|
8571
|
-
useTransition:true
|
|
8572
|
-
}
|
|
8573
|
-
});
|
|
8574
|
-
this.style({
|
|
8575
|
-
display:"flex",
|
|
8576
|
-
justifyContent:"center",
|
|
8577
|
-
alignItems:"center",
|
|
8578
|
-
position: "absolute",
|
|
8579
|
-
top: "50%",
|
|
8580
|
-
left: "50%",
|
|
8581
|
-
transform: "translate(-50%, -50%)",
|
|
8582
|
-
padding: "20px",
|
|
8583
|
-
border: "none",
|
|
8584
|
-
backgroundCcolor: "#f5f5f5",
|
|
8585
|
-
boxShadow: "0px 4px 10px rgba(0, 0, 0, 0.1)",
|
|
8586
|
-
borderRadius: "8px"
|
|
8587
|
-
});
|
|
8588
|
-
this.close();
|
|
8589
|
-
}
|
|
8590
|
-
open(){
|
|
8591
|
-
if(!this.element.open){
|
|
8592
|
-
switch(this.cache.config.mode){
|
|
8593
|
-
case "modal": this.element.showModal(); break;
|
|
8594
|
-
case "dialog": this.element.show(); break;
|
|
8595
|
-
default : this.element.show(); break;
|
|
8596
|
-
}
|
|
8597
|
-
// this.style({
|
|
8598
|
-
// display : "flex",
|
|
8599
|
-
// })
|
|
8600
|
-
this.st.fadeIn(1000);
|
|
8601
|
-
this.emit("modal:opened");
|
|
8602
|
-
}
|
|
8603
|
-
return this;
|
|
8604
|
-
}
|
|
8605
|
-
close(){
|
|
8606
|
-
// this.style({
|
|
8607
|
-
// display : "none"
|
|
8608
|
-
// })
|
|
8609
|
-
this.st.fadeOut(1000);
|
|
8610
|
-
if(this.element.open){
|
|
8611
|
-
this.element.close();
|
|
8612
|
-
}
|
|
8613
|
-
this.emit("modal:closed");
|
|
8614
|
-
return this;
|
|
8615
|
-
}
|
|
8616
|
-
closeAfter(t = 1000){
|
|
8617
|
-
globalThis?.setTimeout(()=>this.close(), t);
|
|
8618
|
-
return this;
|
|
8619
|
-
}
|
|
8620
|
-
onOpen(callback){
|
|
8621
|
-
this.on("modal:opened",callback.bind(this));
|
|
8622
|
-
return this;
|
|
8623
|
-
}
|
|
8624
|
-
onClose(callback){
|
|
8625
|
-
this.on("modal:closed",callback.bind(this));
|
|
8626
|
-
return this;
|
|
8627
|
-
}
|
|
8628
|
-
useModal(){
|
|
8629
|
-
this.cache.config.mode = "modal";
|
|
8630
|
-
return this;
|
|
8631
|
-
}
|
|
8632
|
-
useDialog(){
|
|
8633
|
-
this.cache.config.mode = "dialog";
|
|
8634
|
-
return this;
|
|
8635
|
-
}
|
|
8636
|
-
useTransition(enabled = true){
|
|
8637
|
-
this.cache.config.useTransition = enabled;
|
|
8638
|
-
return this;
|
|
8639
|
-
}
|
|
8640
|
-
}
|
|
8641
|
-
|
|
8642
|
-
const Modal=(...UIElements)=>new ZikoUIModal(...UIElements);
|
|
8643
|
-
|
|
8644
|
-
/*
|
|
8645
|
-
a=Modal(text("Hello")).style({
|
|
8646
|
-
width:"100%",
|
|
8647
|
-
height:"100%"
|
|
8648
|
-
})
|
|
8649
|
-
Flex(a).size("400px","400px").style({border:"1px red solid"})
|
|
8650
|
-
*/
|
|
8651
|
-
|
|
8652
|
-
class __ZikoUISlider__ extends ZikoUISection{
|
|
8653
|
-
constructor(){
|
|
8654
|
-
super("section","");
|
|
8655
|
-
Object.assign(this.cache,{
|
|
8656
|
-
currentIndex : 0,
|
|
8657
|
-
slideBuilder : null,
|
|
8658
|
-
});
|
|
8659
|
-
this.container = Flex().size("100%","100%").vertical(0,0).style({
|
|
8660
|
-
// width:"100%",
|
|
8661
|
-
overflow:"hidden"
|
|
8662
|
-
});
|
|
8663
|
-
// this.style({
|
|
8664
|
-
// // width:"100%",
|
|
8665
|
-
// overflow:"hidden"
|
|
8666
|
-
// });
|
|
8667
|
-
this.container.setAttr({
|
|
8668
|
-
ariaRoledescription : "carousel",
|
|
8669
|
-
ariaLive: "polite",
|
|
8670
|
-
ariaLabel : "Content Slider"
|
|
8671
|
-
});
|
|
8672
|
-
this.track = Section().size("100%","100%").style({
|
|
8673
|
-
transition : "transform 0.3s ease-in-out",
|
|
8674
|
-
});
|
|
8675
|
-
this.bullets = Flex().style({
|
|
8676
|
-
// position : "absolute",
|
|
8677
|
-
// top : 0,
|
|
8678
|
-
gap : "10px",
|
|
8679
|
-
padding:"10px",
|
|
8680
|
-
});
|
|
8681
|
-
this.container.append(
|
|
8682
|
-
this.track,
|
|
8683
|
-
this.bullets
|
|
8684
|
-
);
|
|
8685
|
-
this.append(this.container);
|
|
8686
|
-
}
|
|
8687
|
-
#updateAriaHidden(){
|
|
8688
|
-
for(let i=0;i<this.track.items.length;i++){
|
|
8689
|
-
this.track[i].setAttr({
|
|
8690
|
-
ariaHidden : (i!==this.cache.currentIndex)
|
|
8691
|
-
});
|
|
8692
|
-
}
|
|
8693
|
-
}
|
|
8694
|
-
goto(n = 0){
|
|
8695
|
-
this.cache.currentIndex = n;
|
|
8696
|
-
this.__updatePos();
|
|
8697
|
-
this.#updateAriaHidden();
|
|
8698
|
-
}
|
|
8699
|
-
next(n = 1){
|
|
8700
|
-
this.cache.currentIndex += n;
|
|
8701
|
-
this.__updatePos();
|
|
8702
|
-
this.#updateAriaHidden();
|
|
8703
|
-
return this;
|
|
8704
|
-
}
|
|
8705
|
-
previous(n = 1){
|
|
8706
|
-
this.cache.currentIndex -= n;
|
|
8707
|
-
this.__updatePos();
|
|
8708
|
-
this.#updateAriaHidden();
|
|
8709
|
-
return this;
|
|
8710
|
-
}
|
|
8711
|
-
#update(){
|
|
8712
|
-
const length = this.track.items.length;
|
|
8713
|
-
for(let i=0;i<length;i++){
|
|
8714
|
-
this.track.items[i].setAttr({
|
|
8715
|
-
ariaLabel : `Slide ${i+1} of ${length}`,
|
|
8716
|
-
dataSlideIndex : i
|
|
8717
|
-
});
|
|
8718
|
-
this.bullets.items[i].setAttr({
|
|
8719
|
-
dataIndex : i,
|
|
8720
|
-
ariaLabel : `Go to slide ${i}`
|
|
8721
|
-
});
|
|
8722
|
-
this.bullets[i].events.click?.destroy();
|
|
8723
|
-
this.bullets[i].onClick(()=>this.goto(i));
|
|
8724
|
-
}
|
|
8725
|
-
}
|
|
8726
|
-
#addSlide(UIElement){
|
|
8727
|
-
this.track.append(this.cache.slideBuilder(UIElement).setAttr({
|
|
8728
|
-
ariaRoledescription : "slide",
|
|
8729
|
-
role : "group",
|
|
8730
|
-
ariaLabel : "" // link to update
|
|
8731
|
-
}));
|
|
8732
|
-
const bullet = text$1().size("15px","15px").style({
|
|
8733
|
-
borderRadius:"50%",
|
|
8734
|
-
cursor : "pointer",
|
|
8735
|
-
border : "3px solid blue",
|
|
8736
|
-
background : "white"
|
|
8737
|
-
}).setAttr({
|
|
8738
|
-
role : "button",
|
|
8739
|
-
tabIndex : 0
|
|
8740
|
-
})
|
|
8741
|
-
.onPtrEnter(e=>e.target.st.background("gold").scale(1.2,1.2))
|
|
8742
|
-
.onPtrLeave(e=>e.target.st.background("white").scale(1,1));
|
|
8743
|
-
this.bullets.append(
|
|
8744
|
-
bullet
|
|
8745
|
-
);
|
|
8746
|
-
return this;
|
|
8747
|
-
}
|
|
8748
|
-
addSlides(...slides){
|
|
8749
|
-
slides.forEach(n=>this.#addSlide(n));
|
|
8750
|
-
this.#update();
|
|
8751
|
-
this.#updateAriaHidden();
|
|
8752
|
-
return this;
|
|
8753
|
-
}
|
|
8754
|
-
}
|
|
8755
|
-
|
|
8756
|
-
class ZikoUIHorizontalSlider extends __ZikoUISlider__{
|
|
8757
|
-
constructor(...slides){
|
|
8758
|
-
super("section","hSlider");
|
|
8759
|
-
this.container.vertical(0,0);
|
|
8760
|
-
Object.assign(this.cache,{
|
|
8761
|
-
slideBuilder : (UIElement) => Flex(UIElement).style({
|
|
8762
|
-
minWidth : "100%",
|
|
8763
|
-
width:"100%",
|
|
8764
|
-
height:"100%",
|
|
8765
|
-
}).vertical(0,0)
|
|
8766
|
-
});
|
|
8767
|
-
this.track.size("100%","90%").style({
|
|
8768
|
-
display : "flex"
|
|
8769
|
-
});
|
|
8770
|
-
this.addSlides(...slides);
|
|
8771
|
-
this.bullets.horizontal(0,0).style({
|
|
8772
|
-
width : "100%",
|
|
8773
|
-
height : "10%",
|
|
8774
|
-
});
|
|
8775
|
-
}
|
|
8776
|
-
__updatePos(){
|
|
8777
|
-
const width = this.container.width;
|
|
8778
|
-
this.track.st.translateX(-this.cache.currentIndex * width);
|
|
8779
|
-
}
|
|
8780
|
-
|
|
8781
|
-
}
|
|
8782
|
-
|
|
8783
|
-
const hSlider=(...slides)=>new ZikoUIHorizontalSlider(...slides);
|
|
8784
|
-
|
|
8785
|
-
class ZikoUIVerticalSlider extends __ZikoUISlider__{
|
|
8786
|
-
constructor(...slides){
|
|
8787
|
-
super("section","vSlider");
|
|
8788
|
-
Object.assign(this.cache,{
|
|
8789
|
-
slideBuilder : (UIElement) => Flex(UIElement).size("100%","100%").vertical(0, 0)
|
|
8790
|
-
});
|
|
8791
|
-
this.addSlides(...slides);
|
|
8792
|
-
this.container.horizontal(0,0);
|
|
8793
|
-
this.track.size("90%","100%");
|
|
8794
|
-
this.bullets.vertical(0,0).style({
|
|
8795
|
-
height : "100%",
|
|
8796
|
-
width : "10%"
|
|
8797
|
-
});
|
|
8798
|
-
}
|
|
8799
|
-
__updatePos(){
|
|
8800
|
-
const height = this.container.height;
|
|
8801
|
-
this.track.st.translateY(-this.cache.currentIndex * height);
|
|
8802
|
-
}
|
|
8803
|
-
}
|
|
8804
|
-
|
|
8805
|
-
const vSlider=(...slides)=>new ZikoUIVerticalSlider(...slides);
|
|
8806
|
-
|
|
8807
|
-
const Slider = ({orintation = "horizontal",slides = []}) =>{
|
|
8808
|
-
if(["v","vertical"].includes(orintation.toLowerCase())) return vSlider(...slides);
|
|
8809
|
-
else if(["h","horizontal"].includes(orintation.toLowerCase())) return hSlider(...slides);
|
|
8810
|
-
else ;
|
|
8811
|
-
};
|
|
8812
|
-
|
|
8813
|
-
var Derived = /*#__PURE__*/Object.freeze({
|
|
8814
|
-
__proto__: null,
|
|
8815
|
-
Accordion: Accordion,
|
|
8816
|
-
Breadcrumbs: Breadcrumbs,
|
|
8817
|
-
Carousel: Carousel,
|
|
8818
|
-
CodeCell: CodeCell,
|
|
8819
|
-
CodeNote: CodeNote,
|
|
8820
|
-
Collapsible: Collapsible,
|
|
8821
|
-
Flex: Flex$1,
|
|
8822
|
-
Grid: Grid$1,
|
|
8823
|
-
Modal: Modal,
|
|
8824
|
-
Slider: Slider,
|
|
8825
|
-
Splitter: Splitter,
|
|
8826
|
-
Tabs: Tabs,
|
|
8827
|
-
ZikoUIAccordion: ZikoUIAccordion,
|
|
8828
|
-
ZikoUIBreadcrumbs: ZikoUIBreadcrumbs,
|
|
8829
|
-
ZikoUICodeNote: ZikoUICodeNote,
|
|
8830
|
-
ZikoUIFlex: ZikoUIFlex$1,
|
|
8831
|
-
ZikoUIGrid: ZikoUIGrid,
|
|
8832
|
-
ZikoUIHorizontalSlider: ZikoUIHorizontalSlider,
|
|
8833
|
-
ZikoUIHorizontalSplitter: ZikoUIHorizontalSplitter,
|
|
8834
|
-
ZikoUIMenu3d: ZikoUIMenu3d,
|
|
8835
|
-
ZikoUIModal: ZikoUIModal,
|
|
8836
|
-
ZikoUIVerticalSlider: ZikoUIVerticalSlider,
|
|
8837
|
-
ZikoUIVerticalSplitter: ZikoUIVerticalSplitter,
|
|
8838
|
-
dangerAlert: dangerAlert,
|
|
8839
|
-
hSlider: hSlider,
|
|
8840
|
-
hSplitter: hSplitter,
|
|
8841
|
-
infoAlert: infoAlert,
|
|
8842
|
-
menu3d: menu3d,
|
|
8843
|
-
successAlert: successAlert,
|
|
8844
|
-
vSlider: vSlider,
|
|
8845
|
-
vSplitter: vSplitter,
|
|
8846
|
-
warningAlert: warningAlert
|
|
8847
|
-
});
|
|
8848
|
-
|
|
8849
|
-
const UI$1 = {
|
|
8850
|
-
...Text$1,
|
|
8851
|
-
...List,
|
|
8852
|
-
...Io,
|
|
8853
|
-
...Media,
|
|
8854
|
-
...Table,
|
|
8855
|
-
...Semantic,
|
|
8856
|
-
...Misc,
|
|
8857
|
-
...Derived,
|
|
8858
|
-
ZikoUIElement,
|
|
8859
|
-
ZikoUIContainerElement
|
|
8860
|
-
};
|
|
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
|
+
};
|
|
8861
6891
|
|
|
8862
6892
|
const svg2str=svg=>(new XMLSerializer()).serializeToString(svg);
|
|
8863
6893
|
const svg2ascii=svg=>btoa(svg2str(svg));
|
|
@@ -9003,9 +7033,11 @@ function trimKeys(obj) {
|
|
|
9003
7033
|
}, Array.isArray(obj) ? [] : {});
|
|
9004
7034
|
}
|
|
9005
7035
|
|
|
7036
|
+
// export { markdown2html } from "./markdown.js";
|
|
7037
|
+
// export { adoc2html } from "./adoc.js";
|
|
7038
|
+
|
|
9006
7039
|
var Converter = /*#__PURE__*/Object.freeze({
|
|
9007
7040
|
__proto__: null,
|
|
9008
|
-
adoc2html: adoc2html,
|
|
9009
7041
|
arr2str: arr2str,
|
|
9010
7042
|
csv2arr: csv2arr,
|
|
9011
7043
|
csv2json: csv2json,
|
|
@@ -9020,7 +7052,6 @@ var Converter = /*#__PURE__*/Object.freeze({
|
|
|
9020
7052
|
json2xmlFile: json2xmlFile,
|
|
9021
7053
|
json2yml: json2yml,
|
|
9022
7054
|
json2ymlFile: json2ymlFile,
|
|
9023
|
-
markdown2html: markdown2html,
|
|
9024
7055
|
obj2str: obj2str,
|
|
9025
7056
|
svg2ascii: svg2ascii,
|
|
9026
7057
|
svg2img: svg2img,
|
|
@@ -10393,7 +8424,7 @@ const Math$1 = {
|
|
|
10393
8424
|
...__Calculus__,
|
|
10394
8425
|
};
|
|
10395
8426
|
|
|
10396
|
-
class ZikoUISvg extends
|
|
8427
|
+
class ZikoUISvg extends ZikoUIElement {
|
|
10397
8428
|
constructor(w=360,h=300) {
|
|
10398
8429
|
super("svg","svg");
|
|
10399
8430
|
//this.cache={};
|
|
@@ -10458,439 +8489,14 @@ class ZikoUISvg extends ZikoUIContainerElement {
|
|
|
10458
8489
|
|
|
10459
8490
|
const Svg =(w,h)=>new ZikoUISvg(w,h);
|
|
10460
8491
|
|
|
10461
|
-
class ZikoSvgElement extends ZikoUIElement{
|
|
10462
|
-
constructor(type) {
|
|
10463
|
-
super();
|
|
10464
|
-
Object.assign(this.cache,{
|
|
10465
|
-
type
|
|
10466
|
-
});
|
|
10467
|
-
}
|
|
10468
|
-
pos(x,y){
|
|
10469
|
-
return this.posX(x).posY(y);
|
|
10470
|
-
}
|
|
10471
|
-
posX(x){
|
|
10472
|
-
if(["circle","ellipse"].includes(this.cache.type))this.element.cx.baseVal.value=x;
|
|
10473
|
-
else this.element.x.baseVal.value=x;
|
|
10474
|
-
return this;
|
|
10475
|
-
}
|
|
10476
|
-
posY(y){
|
|
10477
|
-
if(["circle","ellipse"].includes(this.cache.type))this.element.cy.baseVal.value=y;
|
|
10478
|
-
else this.element.y.baseVal.value=y;
|
|
10479
|
-
return this;
|
|
10480
|
-
}
|
|
10481
|
-
translate(x,y){
|
|
10482
|
-
return this;
|
|
10483
|
-
}
|
|
10484
|
-
color({ stroke, fill }) {
|
|
10485
|
-
this.element?.setAttribute("stroke", stroke);
|
|
10486
|
-
this.element?.setAttribute("fill", fill);
|
|
10487
|
-
return this;
|
|
10488
|
-
}
|
|
10489
|
-
fill(color = "none") {
|
|
10490
|
-
this.element?.setAttribute("fill", color);
|
|
10491
|
-
return this;
|
|
10492
|
-
}
|
|
10493
|
-
stroke(color = "none", width) {
|
|
10494
|
-
this.element?.setAttribute("stroke", color);
|
|
10495
|
-
width && this.strokeWidth(width);
|
|
10496
|
-
return this;
|
|
10497
|
-
}
|
|
10498
|
-
strokeWidth(width = 1) {
|
|
10499
|
-
this.element?.setAttribute("stroke-width", width);
|
|
10500
|
-
return this;
|
|
10501
|
-
}
|
|
10502
|
-
opacity(value = 1) {
|
|
10503
|
-
this.element?.setAttribute("opacity", value);
|
|
10504
|
-
return this;
|
|
10505
|
-
}
|
|
10506
|
-
}
|
|
10507
|
-
|
|
10508
|
-
class ZikoSvgCircle extends ZikoSvgElement{
|
|
10509
|
-
constructor(cx,cy,r){
|
|
10510
|
-
super("circle");
|
|
10511
|
-
this.element=document.createElementNS(
|
|
10512
|
-
"http://www.w3.org/2000/svg",
|
|
10513
|
-
"circle",
|
|
10514
|
-
);
|
|
10515
|
-
this.pos(cx,cy).setR(r);
|
|
10516
|
-
}
|
|
10517
|
-
setR(r){
|
|
10518
|
-
this.element.r.baseVal.value=r;
|
|
10519
|
-
return this;
|
|
10520
|
-
}
|
|
10521
|
-
get r(){
|
|
10522
|
-
return this.element.baseVal.value;
|
|
10523
|
-
}
|
|
10524
|
-
get cx(){
|
|
10525
|
-
return this.element.baseVal.value;
|
|
10526
|
-
}
|
|
10527
|
-
get cy(){
|
|
10528
|
-
return this.element.baseVal.value;
|
|
10529
|
-
}
|
|
10530
|
-
}
|
|
10531
|
-
const svgCircle=(x,y,r)=>new ZikoSvgCircle(x,y,r);
|
|
10532
|
-
|
|
10533
|
-
class ZikoSvgEllipse extends ZikoSvgElement{
|
|
10534
|
-
constructor(cx,cy,rx,ry){
|
|
10535
|
-
super("ellipse");
|
|
10536
|
-
this.element=document?.createElementNS(
|
|
10537
|
-
"http://www.w3.org/2000/svg",
|
|
10538
|
-
"ellipse",
|
|
10539
|
-
);
|
|
10540
|
-
this.pos(cx,cy).setRx(rx).setRy(ry);
|
|
10541
|
-
}
|
|
10542
|
-
setRx(rx){
|
|
10543
|
-
this.element.rx.baseVal.value=rx;
|
|
10544
|
-
return this;
|
|
10545
|
-
}
|
|
10546
|
-
setRy(ry){
|
|
10547
|
-
this.element.ry.baseVal.value=ry;
|
|
10548
|
-
return this;
|
|
10549
|
-
}
|
|
10550
|
-
}
|
|
10551
|
-
const svgEllipse=(x,y,rx,ry)=>new ZikoSvgEllipse(x,y,rx,ry);
|
|
10552
|
-
|
|
10553
|
-
class ZikoSvgForeignObject extends ZikoSvgElement{
|
|
10554
|
-
constructor(x=0,y=0,w="100%",h="100%",...ZikoUIElement){
|
|
10555
|
-
super("foreignObject");
|
|
10556
|
-
this.items=[];
|
|
10557
|
-
this.element=document?.createElementNS(
|
|
10558
|
-
"http://www.w3.org/2000/svg",
|
|
10559
|
-
"foreignObject",
|
|
10560
|
-
);
|
|
10561
|
-
this.container=Flex$1().setTarget(this.element).vertical(0,0).size("auto","auto");
|
|
10562
|
-
this.container.st.scaleY(-1);
|
|
10563
|
-
this.posX(x).posY(y).width(w).height(h);
|
|
10564
|
-
}
|
|
10565
|
-
width(w){
|
|
10566
|
-
this.element.etAttribute("width",w);
|
|
10567
|
-
return this;
|
|
10568
|
-
}
|
|
10569
|
-
height(h){
|
|
10570
|
-
this.element.etAttribute("height",h);
|
|
10571
|
-
return this;
|
|
10572
|
-
}
|
|
10573
|
-
add(...ZikoUIElement){
|
|
10574
|
-
this.container.append(...ZikoUIElement);
|
|
10575
|
-
return this;
|
|
10576
|
-
}
|
|
10577
|
-
remove(...ZikoUIElement){
|
|
10578
|
-
this.container.append(...ZikoUIElement);
|
|
10579
|
-
return this;
|
|
10580
|
-
}
|
|
10581
|
-
}
|
|
10582
|
-
const svgObject=(x, y, w, h)=>new ZikoSvgForeignObject(x, y, w, h);
|
|
10583
|
-
|
|
10584
|
-
class ZikoSvgGroupe extends ZikoSvgElement{
|
|
10585
|
-
constructor(...svgElement){
|
|
10586
|
-
super();
|
|
10587
|
-
this.items=[];
|
|
10588
|
-
this.element=document?.createElementNS(
|
|
10589
|
-
"http://www.w3.org/2000/svg",
|
|
10590
|
-
"g",
|
|
10591
|
-
);
|
|
10592
|
-
this.add(...svgElement);
|
|
10593
|
-
}
|
|
10594
|
-
add(...svgElement){
|
|
10595
|
-
for(let i=0;i<svgElement.length;i++){
|
|
10596
|
-
this.element?.appendChild(svgElement[i].element);
|
|
10597
|
-
this.items.push(svgElement[i]);
|
|
10598
|
-
}
|
|
10599
|
-
if(svgElement.length===1)return svgElement[0]
|
|
10600
|
-
return svgElement;
|
|
10601
|
-
}
|
|
10602
|
-
remove(...svgElement){
|
|
10603
|
-
for(let i=0;i<svgElement.length;i++){
|
|
10604
|
-
this.element?.removeChild(svgElement[i].element);
|
|
10605
|
-
this.items=this.items.filter(n=>n!=svgElement);
|
|
10606
|
-
}
|
|
10607
|
-
return this;
|
|
10608
|
-
}
|
|
10609
|
-
}
|
|
10610
|
-
const svgGroupe=(...svgElement)=>new ZikoSvgGroupe(...svgElement);
|
|
10611
|
-
|
|
10612
|
-
class ZikoSvgImage extends ZikoSvgElement{
|
|
10613
|
-
constructor(src="",w="100%",h="100%",x=0,y=0){
|
|
10614
|
-
super();
|
|
10615
|
-
this.element=document?.createElementNS(
|
|
10616
|
-
"http://www.w3.org/2000/svg",
|
|
10617
|
-
"image",
|
|
10618
|
-
);
|
|
10619
|
-
this.setSrc(src).width(w).height(h).x(x).y(y);
|
|
10620
|
-
}
|
|
10621
|
-
x(x){
|
|
10622
|
-
this.element.x.baseVal.value=x;
|
|
10623
|
-
return this;
|
|
10624
|
-
}
|
|
10625
|
-
y(y){
|
|
10626
|
-
this.element.y.baseVal.value=y;
|
|
10627
|
-
return this;
|
|
10628
|
-
}
|
|
10629
|
-
width(w){
|
|
10630
|
-
this.element?.setAttribute("width",w);
|
|
10631
|
-
return this;
|
|
10632
|
-
}
|
|
10633
|
-
height(h){
|
|
10634
|
-
this.element?.setAttribute("height",h);
|
|
10635
|
-
return this;
|
|
10636
|
-
}
|
|
10637
|
-
setSrc(src=""){
|
|
10638
|
-
this.element?.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', src);
|
|
10639
|
-
return this;
|
|
10640
|
-
}
|
|
10641
|
-
}
|
|
10642
|
-
const svgImage=(src,w,h,x,y)=>new ZikoSvgImage(src,w,h,x,y);
|
|
10643
|
-
|
|
10644
|
-
class ZikoSvgLine extends ZikoSvgElement{
|
|
10645
|
-
constructor(x1,y1,x2,y2){
|
|
10646
|
-
super();
|
|
10647
|
-
this.element=document?.createElementNS(
|
|
10648
|
-
"http://www.w3.org/2000/svg",
|
|
10649
|
-
"line",
|
|
10650
|
-
);
|
|
10651
|
-
this.x1(x1).y1(y1).x2(x2).y2(y2).stroke("black");
|
|
10652
|
-
}
|
|
10653
|
-
x1(x1){
|
|
10654
|
-
this.element.x1.baseVal.value=x1;
|
|
10655
|
-
return this;
|
|
10656
|
-
}
|
|
10657
|
-
y1(y1){
|
|
10658
|
-
this.element.y1.baseVal.value=y1;
|
|
10659
|
-
return this;
|
|
10660
|
-
}
|
|
10661
|
-
x2(x2){
|
|
10662
|
-
this.element.x2.baseVal.value=x2;
|
|
10663
|
-
return this;
|
|
10664
|
-
}
|
|
10665
|
-
y2(y2){
|
|
10666
|
-
this.element.y2.baseVal.value=y2;
|
|
10667
|
-
return this;
|
|
10668
|
-
}
|
|
10669
|
-
}
|
|
10670
|
-
const svgLine=(x1,y1,x2,y2)=>new ZikoSvgLine(x1,y1,x2,y2);
|
|
10671
|
-
|
|
10672
|
-
class ZikoSvgLink extends ZikoSvgElement{
|
|
10673
|
-
constructor(href,...svgElement){
|
|
10674
|
-
super();
|
|
10675
|
-
this.items=[];
|
|
10676
|
-
this.element=document?.createElementNS(
|
|
10677
|
-
"http://www.w3.org/2000/svg",
|
|
10678
|
-
"a",
|
|
10679
|
-
);
|
|
10680
|
-
this.element.etAttribute("href",href);
|
|
10681
|
-
this.add(...svgElement);
|
|
10682
|
-
}
|
|
10683
|
-
add(...svgElement){
|
|
10684
|
-
for(let i=0;i<svgElement.length;i++){
|
|
10685
|
-
this.element.ppendChild(svgElement[i].element);
|
|
10686
|
-
this.items.push(svgElement[i]);
|
|
10687
|
-
}
|
|
10688
|
-
if(svgElement.length===1)return svgElement[0]
|
|
10689
|
-
return svgElement;
|
|
10690
|
-
}
|
|
10691
|
-
remove(...svgElement){
|
|
10692
|
-
for(let i=0;i<svgElement.length;i++){
|
|
10693
|
-
this.element.moveChild(svgElement[i].element);
|
|
10694
|
-
this.items=this.items.filter(n=>n!=svgElement);
|
|
10695
|
-
}
|
|
10696
|
-
return this;
|
|
10697
|
-
}
|
|
10698
|
-
}
|
|
10699
|
-
const svgLink=(href,...svgElement)=>new ZikoSvgLink(href,...svgElement);
|
|
10700
|
-
|
|
10701
|
-
class ZikoSvgPath extends ZikoSvgElement{
|
|
10702
|
-
constructor(){
|
|
10703
|
-
super();
|
|
10704
|
-
this.element=document?.createElementNS(
|
|
10705
|
-
"http://www.w3.org/2000/svg",
|
|
10706
|
-
"path",
|
|
10707
|
-
);
|
|
10708
|
-
this.path="";
|
|
10709
|
-
|
|
10710
|
-
}
|
|
10711
|
-
setPath(){
|
|
10712
|
-
this.element.etAttribute("d",this.path);
|
|
10713
|
-
return this;
|
|
10714
|
-
}
|
|
10715
|
-
clear(){
|
|
10716
|
-
this.path="";
|
|
10717
|
-
this.setPath();
|
|
10718
|
-
return this;
|
|
10719
|
-
}
|
|
10720
|
-
moveTo(x,y){
|
|
10721
|
-
this.path+=`M${x} ${y} `;
|
|
10722
|
-
this.setPath();
|
|
10723
|
-
return this;
|
|
10724
|
-
}
|
|
10725
|
-
lineTo(x,y){
|
|
10726
|
-
this.path+=`L${x} ${y} `;
|
|
10727
|
-
this.setPath();
|
|
10728
|
-
return this;
|
|
10729
|
-
}
|
|
10730
|
-
hr(x){
|
|
10731
|
-
this.path+=`H${x} `;
|
|
10732
|
-
this.setPath();
|
|
10733
|
-
return this;
|
|
10734
|
-
}
|
|
10735
|
-
vr(y){
|
|
10736
|
-
this.path+=`V${y} `;
|
|
10737
|
-
this.setPath();
|
|
10738
|
-
return this;
|
|
10739
|
-
}
|
|
10740
|
-
bezier(x1,y1,x2,y2,x,y){
|
|
10741
|
-
this.path+=`C ${x1} ${y1},${x2} ${y2},${x} ${y} `;
|
|
10742
|
-
this.setPath();
|
|
10743
|
-
return this;
|
|
10744
|
-
}
|
|
10745
|
-
quadratic(x1,y1,x,y){
|
|
10746
|
-
this.path+=`Q ${x1} ${y1} ${x} ${y} `;
|
|
10747
|
-
this.setPath();
|
|
10748
|
-
return this;
|
|
10749
|
-
}
|
|
10750
|
-
close(){
|
|
10751
|
-
this.path+="Z";
|
|
10752
|
-
this.setPath();
|
|
10753
|
-
return this;
|
|
10754
|
-
}
|
|
10755
|
-
}
|
|
10756
|
-
|
|
10757
|
-
const svgPath=()=>new ZikoSvgPath();
|
|
10758
|
-
|
|
10759
|
-
class ZikoSvgPolygon extends ZikoSvgElement{
|
|
10760
|
-
constructor(X=[],Y=[]){
|
|
10761
|
-
super();
|
|
10762
|
-
this.X=X;
|
|
10763
|
-
this.Y=Y;
|
|
10764
|
-
this.element=document?.createElementNS(
|
|
10765
|
-
"http://www.w3.org/2000/svg",
|
|
10766
|
-
"polygon",
|
|
10767
|
-
);
|
|
10768
|
-
this.element?.setAttribute("points","");
|
|
10769
|
-
this.addPoints(X,Y);
|
|
10770
|
-
}
|
|
10771
|
-
addPoint(x,y){
|
|
10772
|
-
let p=this.element.parentElement.createSVGPoint();
|
|
10773
|
-
p.x=x;
|
|
10774
|
-
p.y=y;
|
|
10775
|
-
this.element.points.appendItem(p);
|
|
10776
|
-
return this;
|
|
10777
|
-
}
|
|
10778
|
-
addPoints(X,Y){
|
|
10779
|
-
for(let i=0;i<X.length;i++){
|
|
10780
|
-
let p=this.element.parentElement.createSVGPoint();
|
|
10781
|
-
p.x=X[i];
|
|
10782
|
-
p.y=Y[i];
|
|
10783
|
-
this.element.oints.appendItem(p);
|
|
10784
|
-
}
|
|
10785
|
-
return this;
|
|
10786
|
-
}
|
|
10787
|
-
}
|
|
10788
|
-
const svgPolygon=(X,Y)=>new ZikoSvgPolygon(X,Y);
|
|
10789
|
-
|
|
10790
|
-
class ZikoSvgRectangle extends ZikoSvgElement{
|
|
10791
|
-
constructor(x,y,w,h,center=true){
|
|
10792
|
-
super();
|
|
10793
|
-
this.element=document?.createElementNS(
|
|
10794
|
-
"http://www.w3.org/2000/svg",
|
|
10795
|
-
"rect",
|
|
10796
|
-
);
|
|
10797
|
-
this.setX(x).setY(y).width(w).height(h);
|
|
10798
|
-
this.rx=this.x+this.w/2;
|
|
10799
|
-
this.ty=this.y+this.h/2;
|
|
10800
|
-
}
|
|
10801
|
-
setX(x){
|
|
10802
|
-
this.element.x.baseVal.value=x;
|
|
10803
|
-
this.x=x;
|
|
10804
|
-
return this;
|
|
10805
|
-
}
|
|
10806
|
-
setY(y){
|
|
10807
|
-
this.element.y.baseVal.value=y;
|
|
10808
|
-
this.y=y;
|
|
10809
|
-
return this;
|
|
10810
|
-
}
|
|
10811
|
-
r(rx,ry){
|
|
10812
|
-
this.rx=rx;
|
|
10813
|
-
this.ry=ry;
|
|
10814
|
-
this.setX(this.rx-this.w/2);
|
|
10815
|
-
this.setY(this.ry-this.h/2);
|
|
10816
|
-
return this;
|
|
10817
|
-
}
|
|
10818
|
-
width(w){
|
|
10819
|
-
this.element.width.baseVal.value=w;
|
|
10820
|
-
this.w=w;
|
|
10821
|
-
return this;
|
|
10822
|
-
}
|
|
10823
|
-
height(h){
|
|
10824
|
-
this.element.height.baseVal.value=h;
|
|
10825
|
-
this.h=h;
|
|
10826
|
-
return this;
|
|
10827
|
-
}
|
|
10828
|
-
}
|
|
10829
|
-
const svgRect=(x,y,w,h,center)=>new ZikoSvgRectangle(x,y,w,h,center);
|
|
10830
|
-
|
|
10831
|
-
class ZikoSvgText extends ZikoSvgElement{
|
|
10832
|
-
constructor(text,x,y){
|
|
10833
|
-
super();
|
|
10834
|
-
this.element=document?.createElementNS(
|
|
10835
|
-
"http://www.w3.org/2000/svg",
|
|
10836
|
-
"text",
|
|
10837
|
-
);
|
|
10838
|
-
this.setText(text);
|
|
10839
|
-
this.x(x).y(y);
|
|
10840
|
-
}
|
|
10841
|
-
x(x){
|
|
10842
|
-
this.element?.setAttribute("x",x);
|
|
10843
|
-
return this;
|
|
10844
|
-
}
|
|
10845
|
-
y(y){
|
|
10846
|
-
this.element?.setAttribute("y",y);
|
|
10847
|
-
return this;
|
|
10848
|
-
}
|
|
10849
|
-
setText(text=""){
|
|
10850
|
-
this.element.textContent=text;
|
|
10851
|
-
return this;
|
|
10852
|
-
}
|
|
10853
|
-
}
|
|
10854
|
-
const svgText=(text,x,y)=>new ZikoSvgText(text,x,y);
|
|
10855
|
-
|
|
10856
|
-
const svgGrid=(w,h,r=10,c=10)=>{
|
|
10857
|
-
let path=svgPath().fill("none").stroke("coral").strokeWidth(0.6);
|
|
10858
|
-
console.log({x:w/r,y:h/c});
|
|
10859
|
-
for(let i=0;i<w;i++) path.moveTo(0,i*w/r).hr(w);
|
|
10860
|
-
for(let j=0;j<h;j++) path.moveTo(j*h/c,0).vr(h);
|
|
10861
|
-
return path
|
|
10862
|
-
};
|
|
10863
|
-
|
|
10864
8492
|
var SVG = /*#__PURE__*/Object.freeze({
|
|
10865
8493
|
__proto__: null,
|
|
10866
8494
|
Svg: Svg,
|
|
10867
|
-
|
|
10868
|
-
ZikoSvgEllipse: ZikoSvgEllipse,
|
|
10869
|
-
ZikoSvgForeignObject: ZikoSvgForeignObject,
|
|
10870
|
-
ZikoSvgGroupe: ZikoSvgGroupe,
|
|
10871
|
-
ZikoSvgImage: ZikoSvgImage,
|
|
10872
|
-
ZikoSvgLine: ZikoSvgLine,
|
|
10873
|
-
ZikoSvgLink: ZikoSvgLink,
|
|
10874
|
-
ZikoSvgPath: ZikoSvgPath,
|
|
10875
|
-
ZikoSvgRectangle: ZikoSvgRectangle,
|
|
10876
|
-
ZikoSvgText: ZikoSvgText,
|
|
10877
|
-
ZikoUISvg: ZikoUISvg,
|
|
10878
|
-
svgCircle: svgCircle,
|
|
10879
|
-
svgEllipse: svgEllipse,
|
|
10880
|
-
svgGrid: svgGrid,
|
|
10881
|
-
svgGroupe: svgGroupe,
|
|
10882
|
-
svgImage: svgImage,
|
|
10883
|
-
svgLine: svgLine,
|
|
10884
|
-
svgLink: svgLink,
|
|
10885
|
-
svgObject: svgObject,
|
|
10886
|
-
svgPath: svgPath,
|
|
10887
|
-
svgPolygon: svgPolygon,
|
|
10888
|
-
svgRect: svgRect,
|
|
10889
|
-
svgText: svgText
|
|
8495
|
+
ZikoUISvg: ZikoUISvg
|
|
10890
8496
|
});
|
|
10891
8497
|
|
|
10892
8498
|
// import { convolute } from "../../math/signal/conv.js";
|
|
10893
|
-
class ZikoUICanvas extends
|
|
8499
|
+
class ZikoUICanvas extends ZikoUIElement{
|
|
10894
8500
|
constructor(w,h){
|
|
10895
8501
|
super("canvas","canvas");
|
|
10896
8502
|
this.ctx = this.element?.getContext("2d");
|
|
@@ -11060,288 +8666,10 @@ class ZikoUICanvas extends ZikoUIContainerElement{
|
|
|
11060
8666
|
|
|
11061
8667
|
const Canvas=(w,h)=>new ZikoUICanvas(w,h);
|
|
11062
8668
|
|
|
11063
|
-
class ZikoCanvasElement{
|
|
11064
|
-
constructor(x,y){
|
|
11065
|
-
this.parent=null;
|
|
11066
|
-
this.position={
|
|
11067
|
-
x,
|
|
11068
|
-
y
|
|
11069
|
-
};
|
|
11070
|
-
this.cache={
|
|
11071
|
-
interact:null/*avoid redraw*/,
|
|
11072
|
-
config:{
|
|
11073
|
-
draggable:false,
|
|
11074
|
-
selected:false,
|
|
11075
|
-
highlighted:false,
|
|
11076
|
-
rendered:false
|
|
11077
|
-
},
|
|
11078
|
-
style:{
|
|
11079
|
-
normal:{
|
|
11080
|
-
strokeEnabled:true,
|
|
11081
|
-
fillEnabled:false,
|
|
11082
|
-
strokeColor:"#111111",
|
|
11083
|
-
fillColor:"#777777",
|
|
11084
|
-
},
|
|
11085
|
-
highlighted:{
|
|
11086
|
-
strokeEnabled:true,
|
|
11087
|
-
fillEnabled:false,
|
|
11088
|
-
strokeColor:null,
|
|
11089
|
-
fillColor:null,
|
|
11090
|
-
}
|
|
11091
|
-
},
|
|
11092
|
-
};
|
|
11093
|
-
this.history={
|
|
11094
|
-
position:[],
|
|
11095
|
-
styles:[]
|
|
11096
|
-
};
|
|
11097
|
-
this.render();
|
|
11098
|
-
}
|
|
11099
|
-
get px(){
|
|
11100
|
-
//_x=====>px
|
|
11101
|
-
return (this.position.x??0)+(this.parent?.position?.x??0);
|
|
11102
|
-
}
|
|
11103
|
-
get py(){
|
|
11104
|
-
//_y=====>py
|
|
11105
|
-
return (this.position.y??0)+(this.parent?.position?.y??0);
|
|
11106
|
-
}
|
|
11107
|
-
isIntersectedWith(){
|
|
11108
|
-
|
|
11109
|
-
}
|
|
11110
|
-
isInStroke(x,y){
|
|
11111
|
-
let is;
|
|
11112
|
-
if(this.parent){
|
|
11113
|
-
this.parent.ctx.setTransform(1,0,0,1,0,0);
|
|
11114
|
-
is=this.parent.ctx.isPointInStroke(this.path,x,y);
|
|
11115
|
-
this.parent.applyTransformMatrix();
|
|
11116
|
-
}
|
|
11117
|
-
return is;
|
|
11118
|
-
}
|
|
11119
|
-
isInPath(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.isPointInPath(this.path,x,y);
|
|
11124
|
-
this.parent.applyTransformMatrix();
|
|
11125
|
-
}
|
|
11126
|
-
return is;
|
|
11127
|
-
}
|
|
11128
|
-
posX(x){
|
|
11129
|
-
this.position.x=x;
|
|
11130
|
-
if(this.parent)this.parent.draw();
|
|
11131
|
-
return this;
|
|
11132
|
-
}
|
|
11133
|
-
posY(y){
|
|
11134
|
-
this.position.y=y;
|
|
11135
|
-
if(this.parent)this.parent.draw();
|
|
11136
|
-
return this;
|
|
11137
|
-
}
|
|
11138
|
-
color({stroke=this.cache.style.normal.strokeColor,fill=this.cache.style.normal.fillColor}={stroke,fill}){
|
|
11139
|
-
this.cache.style.normal.strokeColor=stroke;
|
|
11140
|
-
this.cache.style.normal.fillColor=fill;
|
|
11141
|
-
if(this.parent)this.parent.draw();
|
|
11142
|
-
return this;
|
|
11143
|
-
}
|
|
11144
|
-
translate(dx=0,dy=0){
|
|
11145
|
-
this.position.x+=dx;
|
|
11146
|
-
this.position.y+=dy;
|
|
11147
|
-
if(this.parent)this.parent.draw();
|
|
11148
|
-
return;
|
|
11149
|
-
}
|
|
11150
|
-
applyNormalStyle(ctx){
|
|
11151
|
-
ctx.strokeStyle=this.cache.style.normal.strokeColor;
|
|
11152
|
-
ctx.fillStyle=this.cache.style.normal.fillColor;
|
|
11153
|
-
return this;
|
|
11154
|
-
}
|
|
11155
|
-
applyHighlightedStyle(ctx){
|
|
11156
|
-
ctx.strokeStyle=this.cache.style.highlighted.strokeColor;
|
|
11157
|
-
ctx.fillStyle=this.cache.style.highlighted.fillColor;
|
|
11158
|
-
return this;
|
|
11159
|
-
}
|
|
11160
|
-
stroke(color=this.cache.style.normal.strokeColor,enabled=true){
|
|
11161
|
-
this.cache.style.normal.strokeEnabled=enabled;
|
|
11162
|
-
this.cache.style.normal.strokeColor=color;
|
|
11163
|
-
if(this.parent)this.parent.draw();
|
|
11164
|
-
return this
|
|
11165
|
-
}
|
|
11166
|
-
fill(color=this.cache.style.normal.fillColor,enabled=true){
|
|
11167
|
-
this.cache.style.normal.fillEnabled=enabled;
|
|
11168
|
-
this.cache.style.normal.filleColor=color;
|
|
11169
|
-
if(this.parent)this.parent.draw();
|
|
11170
|
-
return this;
|
|
11171
|
-
}
|
|
11172
|
-
render(render=true){
|
|
11173
|
-
this.cache.config.rendered=render;
|
|
11174
|
-
return this;
|
|
11175
|
-
}
|
|
11176
|
-
}
|
|
11177
|
-
|
|
11178
|
-
class CanvasArc extends ZikoCanvasElement{
|
|
11179
|
-
constructor(x,y,r,angle){
|
|
11180
|
-
super(x,y);
|
|
11181
|
-
this.r=r;
|
|
11182
|
-
this.angle=angle;
|
|
11183
|
-
this.path=null;
|
|
11184
|
-
}
|
|
11185
|
-
draw(ctx){
|
|
11186
|
-
if(this.cache.config.rendered){
|
|
11187
|
-
ctx.save();
|
|
11188
|
-
this.applyNormalStyle(ctx);
|
|
11189
|
-
ctx.beginPath();
|
|
11190
|
-
this.path=new Path2D();
|
|
11191
|
-
this.path.arc(this.px, this.py, this.r, 0, this.angle);
|
|
11192
|
-
const{strokeEnabled,fillEnabled}=this.cache.style.normal;
|
|
11193
|
-
if(strokeEnabled)ctx.stroke(this.path);
|
|
11194
|
-
if(fillEnabled)ctx.fill(this.path);
|
|
11195
|
-
ctx.closePath();
|
|
11196
|
-
ctx.restore();
|
|
11197
|
-
}
|
|
11198
|
-
return this;
|
|
11199
|
-
}
|
|
11200
|
-
radius(r){
|
|
11201
|
-
this.r=r;
|
|
11202
|
-
if(this.parent)this.parent.draw();
|
|
11203
|
-
return this;
|
|
11204
|
-
}
|
|
11205
|
-
// distanceFromCenter(x,y){
|
|
11206
|
-
// return Math.sqrt(
|
|
11207
|
-
// (this._x-x)**2-(this._y-y)**2
|
|
11208
|
-
// )
|
|
11209
|
-
// }
|
|
11210
|
-
// isIn(x,y,strict=false){
|
|
11211
|
-
// return strict?this.distanceFromCenter(x,y)<this.r:this.distanceFromCenter(x,y)<=this.r;
|
|
11212
|
-
// }
|
|
11213
|
-
// isInEdges(x,y){
|
|
11214
|
-
// return this.distanceFromCenter(x,y)===this.r;
|
|
11215
|
-
// }
|
|
11216
|
-
}
|
|
11217
|
-
const canvasArc=(x,y,r,phi)=>new CanvasArc(x,y,r,phi);
|
|
11218
|
-
const canvasCircle=(x,y,r)=>new CanvasArc(x,y,r,2*Math.PI);
|
|
11219
|
-
|
|
11220
|
-
class CanvasPoints extends ZikoCanvasElement{
|
|
11221
|
-
constructor(ptsX,ptsY){
|
|
11222
|
-
super();
|
|
11223
|
-
this.pointsMatrix=null;
|
|
11224
|
-
this.path=new Path2D();
|
|
11225
|
-
this.fromXY(ptsX,ptsY);
|
|
11226
|
-
}
|
|
11227
|
-
get points(){
|
|
11228
|
-
return this.pointsMatrix.T.arr;
|
|
11229
|
-
}
|
|
11230
|
-
draw(ctx){
|
|
11231
|
-
if(this.cache.config.rendered){
|
|
11232
|
-
ctx.save();
|
|
11233
|
-
this.applyNormalStyle(ctx);
|
|
11234
|
-
ctx.beginPath();
|
|
11235
|
-
this.path.moveTo(this.points[1][0]+this._x,this.points[1][1]+this._y);
|
|
11236
|
-
for(let i=1;i<this.points.length;i++){
|
|
11237
|
-
this.path.lineTo(this.points[i][0]+this._x,this.points[i][1]+this._y);
|
|
11238
|
-
}
|
|
11239
|
-
ctx.stroke(this.path);
|
|
11240
|
-
ctx.restore();
|
|
11241
|
-
}
|
|
11242
|
-
return this;
|
|
11243
|
-
}
|
|
11244
|
-
fromXY(X,Y){
|
|
11245
|
-
this.pointsMatrix=matrix([X,Y]);
|
|
11246
|
-
return this;
|
|
11247
|
-
}
|
|
11248
|
-
push(ptsX,ptsY){
|
|
11249
|
-
this.pointsMatrix.hstack(matrix([ptsX,ptsY]));
|
|
11250
|
-
if(this.parent)this.parent.draw();
|
|
11251
|
-
return this;
|
|
11252
|
-
}
|
|
11253
|
-
isIn(x,y){
|
|
11254
|
-
let is;
|
|
11255
|
-
if(this.parent){
|
|
11256
|
-
this.parent.ctx.setTransform(1,0,0,1,0,0);
|
|
11257
|
-
is=this.parent.ctx.isPointInPath(this.path,x,y);
|
|
11258
|
-
this.parent.applyTransformMatrix();
|
|
11259
|
-
}
|
|
11260
|
-
return is;
|
|
11261
|
-
}
|
|
11262
|
-
}
|
|
11263
|
-
|
|
11264
|
-
const canvasPoints=(ptsX=[],ptsY=[])=>new CanvasPoints(ptsX,ptsY);
|
|
11265
|
-
|
|
11266
|
-
class CanvasLine extends ZikoCanvasElement{
|
|
11267
|
-
constructor(x0,y0,x1,y1){
|
|
11268
|
-
super();
|
|
11269
|
-
this.x0=x0;
|
|
11270
|
-
this.x1=x1;
|
|
11271
|
-
this.y0=y0;
|
|
11272
|
-
this.y1=y1;
|
|
11273
|
-
delete this.fill;
|
|
11274
|
-
}
|
|
11275
|
-
draw(ctx){
|
|
11276
|
-
if(this.cache.config.rendered){
|
|
11277
|
-
ctx.save();
|
|
11278
|
-
this.applyNormalStyle(ctx);
|
|
11279
|
-
ctx.beginPath();
|
|
11280
|
-
ctx.moveTo(this.x0+this._x,this.y0+this._y_);
|
|
11281
|
-
ctx.lineTo(this.x1+this._x,this.y1+this._y);
|
|
11282
|
-
ctx.stroke();
|
|
11283
|
-
if(this.cache.style.normal.strokeEnabled)ctx.stroke();
|
|
11284
|
-
ctx.restore();
|
|
11285
|
-
}
|
|
11286
|
-
return this;
|
|
11287
|
-
}
|
|
11288
|
-
}
|
|
11289
|
-
const canvasLine=(x0,y0,x1,y1)=>new CanvasLine(x0,y0,x1,y1);
|
|
11290
|
-
|
|
11291
|
-
class CanvasRect extends ZikoCanvasElement{
|
|
11292
|
-
constructor(x,y,w,h){
|
|
11293
|
-
super(x,y);
|
|
11294
|
-
this.w=w;
|
|
11295
|
-
this.h=h;
|
|
11296
|
-
this.path=new Path2D();
|
|
11297
|
-
}
|
|
11298
|
-
draw(ctx){
|
|
11299
|
-
if(this.cache.config.rendered){
|
|
11300
|
-
ctx.save();
|
|
11301
|
-
this.applyNormalStyle(ctx);
|
|
11302
|
-
ctx.beginPath();
|
|
11303
|
-
this.path.rect(this.px, this.py,this.w,this.h);
|
|
11304
|
-
const{strokeEnabled,fillEnabled}=this.cache.style.normal;
|
|
11305
|
-
if(strokeEnabled)ctx.stroke(this.path);
|
|
11306
|
-
if(fillEnabled)ctx.fill(this.path);
|
|
11307
|
-
ctx.closePath();
|
|
11308
|
-
ctx.restore();
|
|
11309
|
-
}
|
|
11310
|
-
return this;
|
|
11311
|
-
}
|
|
11312
|
-
width(w){
|
|
11313
|
-
this.w=w;
|
|
11314
|
-
if(this.parent)this.parent.draw();
|
|
11315
|
-
return this;
|
|
11316
|
-
}
|
|
11317
|
-
height(h){
|
|
11318
|
-
this.h=h;
|
|
11319
|
-
if(this.parent)this.parent.draw();
|
|
11320
|
-
return this;
|
|
11321
|
-
}
|
|
11322
|
-
// distanceFromCenter(x,y){
|
|
11323
|
-
// return Math.sqrt(
|
|
11324
|
-
// (this.position.x-x)**2-(this.position.y-y)**2
|
|
11325
|
-
// )
|
|
11326
|
-
// }
|
|
11327
|
-
// isIn(x,y,strict=false){
|
|
11328
|
-
// return strict?this.distanceFromCenter(x,y)<this.r:this.distanceFromCenter(x,y)<=this.r;
|
|
11329
|
-
// }
|
|
11330
|
-
// isInEdges(x,y){
|
|
11331
|
-
// return this.distanceFromCenter(x,y)===this.r;
|
|
11332
|
-
// }
|
|
11333
|
-
}
|
|
11334
|
-
const canvasRect=(x,y,w,h)=>new CanvasRect(x,y,w,h);
|
|
11335
|
-
|
|
11336
8669
|
var CANVAS = /*#__PURE__*/Object.freeze({
|
|
11337
8670
|
__proto__: null,
|
|
11338
8671
|
Canvas: Canvas,
|
|
11339
|
-
ZikoUICanvas: ZikoUICanvas
|
|
11340
|
-
canvasArc: canvasArc,
|
|
11341
|
-
canvasCircle: canvasCircle,
|
|
11342
|
-
canvasLine: canvasLine,
|
|
11343
|
-
canvasPoints: canvasPoints,
|
|
11344
|
-
canvasRect: canvasRect
|
|
8672
|
+
ZikoUICanvas: ZikoUICanvas
|
|
11345
8673
|
});
|
|
11346
8674
|
|
|
11347
8675
|
const Graphics = {
|
|
@@ -11646,7 +8974,7 @@ class ZikoSPA extends ZikoApp{
|
|
|
11646
8974
|
constructor({head, wrapper, target, routes}){
|
|
11647
8975
|
super({head, wrapper, target});
|
|
11648
8976
|
this.routes=new Map([
|
|
11649
|
-
["404",text
|
|
8977
|
+
["404",text("Error 404")],
|
|
11650
8978
|
...Object.entries(routes)
|
|
11651
8979
|
]);
|
|
11652
8980
|
this.clear();
|
|
@@ -11726,6 +9054,7 @@ function defineParamsGetter(target ){
|
|
|
11726
9054
|
}
|
|
11727
9055
|
|
|
11728
9056
|
const __UI__={};
|
|
9057
|
+
const __HYDRATION_MAP__ = new Map();
|
|
11729
9058
|
const __Config__={
|
|
11730
9059
|
default:{
|
|
11731
9060
|
target:null,
|
|
@@ -11739,12 +9068,15 @@ const __Config__={
|
|
|
11739
9068
|
const values=Object.values(pairs);
|
|
11740
9069
|
for(let i=0;i<keys.length;i++)this.default[keys[i]]=values[i];
|
|
11741
9070
|
},
|
|
11742
|
-
init:()=>document.documentElement.setAttribute("data-engine","zikojs")
|
|
9071
|
+
init:()=>document.documentElement.setAttribute("data-engine","zikojs"),
|
|
9072
|
+
renderingMode :"spa",
|
|
9073
|
+
isSSC : false,
|
|
11743
9074
|
};
|
|
11744
9075
|
|
|
11745
9076
|
var Global = /*#__PURE__*/Object.freeze({
|
|
11746
9077
|
__proto__: null,
|
|
11747
9078
|
__Config__: __Config__,
|
|
9079
|
+
__HYDRATION_MAP__: __HYDRATION_MAP__,
|
|
11748
9080
|
__UI__: __UI__
|
|
11749
9081
|
});
|
|
11750
9082
|
|
|
@@ -11844,6 +9176,7 @@ if ( globalThis.__Ziko__ ) {
|
|
|
11844
9176
|
globalThis.__Ziko__={
|
|
11845
9177
|
...Ziko,
|
|
11846
9178
|
__UI__,
|
|
9179
|
+
__HYDRATION_MAP__,
|
|
11847
9180
|
__Config__,
|
|
11848
9181
|
ExtractAll,
|
|
11849
9182
|
RemoveAll
|
|
@@ -11878,4 +9211,4 @@ function RemoveAll(){
|
|
|
11878
9211
|
Data.RemoveAll();
|
|
11879
9212
|
}
|
|
11880
9213
|
|
|
11881
|
-
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 };
|