ziko 0.0.21 → 0.0.22
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/README.md +2 -2
- package/dist/ziko.cjs +154 -11
- package/dist/ziko.js +154 -11
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +152 -12
- package/package.json +1 -2
- package/src/ui/elements/primitives/ZikoUIElement.js +7 -2
- package/src/ui/elements/primitives/misc/hyperscript.js +140 -7
package/dist/ziko.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date : Sun Dec 08 2024
|
|
5
|
+
Date : Sun Dec 08 2024 23:39:16 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
|
|
@@ -4845,10 +4845,14 @@ const Reactivity={
|
|
|
4845
4845
|
};
|
|
4846
4846
|
|
|
4847
4847
|
class ZikoUIElement {
|
|
4848
|
-
constructor(element ,name="") {
|
|
4848
|
+
constructor(element ,name="", el_type="html") {
|
|
4849
4849
|
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
|
|
4850
4850
|
if(typeof element === "string") {
|
|
4851
|
-
|
|
4851
|
+
switch(el_type){
|
|
4852
|
+
case "html" : element = globalThis?.document?.createElement(element); break;
|
|
4853
|
+
case "svg" : element = globalThis?.document?.createElementNS("http://www.w3.org/2000/svg", element);
|
|
4854
|
+
default : throw Error("Not supported")
|
|
4855
|
+
}
|
|
4852
4856
|
}
|
|
4853
4857
|
if(element)this.__ele__ = element;
|
|
4854
4858
|
this.uuid=this.constructor.name+"-"+Random.string(10);
|
|
@@ -4972,7 +4976,7 @@ class ZikoUIElement {
|
|
|
4972
4976
|
return this;
|
|
4973
4977
|
}
|
|
4974
4978
|
for (let i = 0; i < ele.length; i++) {
|
|
4975
|
-
if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
4979
|
+
if (["number", "string"].includes(typeof ele[i])) ele[i] = text$1(ele[i]);
|
|
4976
4980
|
if (ele[i] instanceof ZikoUIElement) {
|
|
4977
4981
|
ele[i].cache.parent = this;
|
|
4978
4982
|
this.element[adder](ele[i].element);
|
|
@@ -5002,7 +5006,7 @@ class ZikoUIElement {
|
|
|
5002
5006
|
if (index >= this.element.children.length) this.append(...ele);
|
|
5003
5007
|
else
|
|
5004
5008
|
for (let i = 0; i < ele.length; i++) {
|
|
5005
|
-
if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
5009
|
+
if (["number", "string"].includes(typeof ele[i])) ele[i] = text$1(ele[i]);
|
|
5006
5010
|
this.element?.insertBefore(ele[i].element, this.items[index].element);
|
|
5007
5011
|
this.items.splice(index, 0, ele[i]);
|
|
5008
5012
|
}
|
|
@@ -6246,14 +6250,147 @@ class ZikoUISuspense extends ZikoUIElement{
|
|
|
6246
6250
|
|
|
6247
6251
|
const Suspense = (fallback_ui, callback) => new ZikoUISuspense(fallback_ui, callback);
|
|
6248
6252
|
|
|
6249
|
-
|
|
6250
|
-
const {name, style, ...attrs} = attributes;
|
|
6251
|
-
let element = new ZikoUIElement(tag,name);
|
|
6253
|
+
const _h=(tag, type, attributes, ...children)=>{
|
|
6254
|
+
const { name, style, ...attrs } = attributes;
|
|
6255
|
+
let element = new ZikoUIElement(tag, name, type);
|
|
6252
6256
|
style && element.style(style);
|
|
6253
6257
|
attrs && element.setAttr(attrs);
|
|
6254
6258
|
children && element.append(...children);
|
|
6255
|
-
return element
|
|
6256
|
-
}
|
|
6259
|
+
return element;
|
|
6260
|
+
};
|
|
6261
|
+
const h=(tag, attributes = {}, ...children)=> _h(tag, "html", attributes, ...children);
|
|
6262
|
+
const s=(tag, attributes = {}, ...children)=> _h(tag, "svg", attributes, ...children);
|
|
6263
|
+
|
|
6264
|
+
const HTMLTags = [
|
|
6265
|
+
'a',
|
|
6266
|
+
'abb',
|
|
6267
|
+
'address',
|
|
6268
|
+
'area',
|
|
6269
|
+
'article',
|
|
6270
|
+
'aside',
|
|
6271
|
+
'audio',
|
|
6272
|
+
'b',
|
|
6273
|
+
'base',
|
|
6274
|
+
'bdi',
|
|
6275
|
+
'bdo',
|
|
6276
|
+
'blockquote',
|
|
6277
|
+
'br',
|
|
6278
|
+
'button',
|
|
6279
|
+
'canvas',
|
|
6280
|
+
'caption',
|
|
6281
|
+
'cite',
|
|
6282
|
+
'code',
|
|
6283
|
+
'col',
|
|
6284
|
+
'colgroup',
|
|
6285
|
+
'data',
|
|
6286
|
+
'datalist',
|
|
6287
|
+
'dd',
|
|
6288
|
+
'del',
|
|
6289
|
+
'details',
|
|
6290
|
+
'dfn',
|
|
6291
|
+
'dialog',
|
|
6292
|
+
'div',
|
|
6293
|
+
'dl',
|
|
6294
|
+
'dt',
|
|
6295
|
+
'em',
|
|
6296
|
+
'embed',
|
|
6297
|
+
'fieldset',
|
|
6298
|
+
'figcaption',
|
|
6299
|
+
'figure',
|
|
6300
|
+
'footer',
|
|
6301
|
+
'form',
|
|
6302
|
+
'h1',
|
|
6303
|
+
'h2',
|
|
6304
|
+
'h3',
|
|
6305
|
+
'h4',
|
|
6306
|
+
'h5',
|
|
6307
|
+
'h6',
|
|
6308
|
+
'header',
|
|
6309
|
+
'hgroup',
|
|
6310
|
+
'hr',
|
|
6311
|
+
'i',
|
|
6312
|
+
'iframe',
|
|
6313
|
+
'img',
|
|
6314
|
+
'ipnut',
|
|
6315
|
+
'ins',
|
|
6316
|
+
'kbd',
|
|
6317
|
+
'label',
|
|
6318
|
+
'legend',
|
|
6319
|
+
'li',
|
|
6320
|
+
'main',
|
|
6321
|
+
'map',
|
|
6322
|
+
'mark',
|
|
6323
|
+
'menu',
|
|
6324
|
+
'meter',
|
|
6325
|
+
'nav',
|
|
6326
|
+
'object',
|
|
6327
|
+
'ol',
|
|
6328
|
+
'optgroup',
|
|
6329
|
+
'option',
|
|
6330
|
+
'output',
|
|
6331
|
+
'p',
|
|
6332
|
+
'param',
|
|
6333
|
+
'picture',
|
|
6334
|
+
'pre',
|
|
6335
|
+
'progress',
|
|
6336
|
+
'q',
|
|
6337
|
+
'rp',
|
|
6338
|
+
'rt',
|
|
6339
|
+
'ruby',
|
|
6340
|
+
's',
|
|
6341
|
+
'samp',
|
|
6342
|
+
'search',
|
|
6343
|
+
'section',
|
|
6344
|
+
'select',
|
|
6345
|
+
'small',
|
|
6346
|
+
'source',
|
|
6347
|
+
'span',
|
|
6348
|
+
'strong',
|
|
6349
|
+
'sub',
|
|
6350
|
+
'summary',
|
|
6351
|
+
'sup',
|
|
6352
|
+
'svg',
|
|
6353
|
+
'table',
|
|
6354
|
+
'tbody',
|
|
6355
|
+
'td',
|
|
6356
|
+
'template',
|
|
6357
|
+
'textarea',
|
|
6358
|
+
'tfoot',
|
|
6359
|
+
'th',
|
|
6360
|
+
'thead',
|
|
6361
|
+
'time',
|
|
6362
|
+
'title',
|
|
6363
|
+
'tr',
|
|
6364
|
+
'track',
|
|
6365
|
+
'u',
|
|
6366
|
+
'ul',
|
|
6367
|
+
'var',
|
|
6368
|
+
'video',
|
|
6369
|
+
'wbr'
|
|
6370
|
+
];
|
|
6371
|
+
|
|
6372
|
+
const SVGTags = [
|
|
6373
|
+
"svg", "g", "defs", "symbol", "use", "image", "switch",
|
|
6374
|
+
"rect", "circle", "ellipse", "line", "polyline", "polygon", "path",
|
|
6375
|
+
"text", "tspan", "textPath", "altGlyph", "altGlyphDef", "altGlyphItem", "glyph", "glyphRef",
|
|
6376
|
+
"linearGradient", "radialGradient", "pattern", "solidColor",
|
|
6377
|
+
"filter", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix",
|
|
6378
|
+
"feDiffuseLighting", "feDisplacementMap", "feDropShadow", "feFlood", "feFuncA", "feFuncR", "feFuncG", "feFuncB",
|
|
6379
|
+
"feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "feSpecularLighting",
|
|
6380
|
+
"feTile", "feTurbulence",
|
|
6381
|
+
"animate", "animateMotion", "animateTransform", "set",
|
|
6382
|
+
"script",
|
|
6383
|
+
"desc", "title", "metadata", "foreignObject"
|
|
6384
|
+
];
|
|
6385
|
+
|
|
6386
|
+
const hTags = HTMLTags.reduce((acc, key) => {
|
|
6387
|
+
acc[key] = (attr, ...children) => h(key, attr, ...children);
|
|
6388
|
+
return acc;
|
|
6389
|
+
}, {});
|
|
6390
|
+
const sTags = SVGTags.reduce((acc, key) => {
|
|
6391
|
+
acc[key] = (attr, ...children) => h(key, attr, ...children);
|
|
6392
|
+
return acc;
|
|
6393
|
+
}, {});
|
|
6257
6394
|
|
|
6258
6395
|
class ZikoUIHtmlTag extends ZikoUIContainerElement {
|
|
6259
6396
|
constructor(element) {
|
|
@@ -6358,10 +6495,13 @@ var Misc = /*#__PURE__*/Object.freeze({
|
|
|
6358
6495
|
brs: brs,
|
|
6359
6496
|
btn: btn,
|
|
6360
6497
|
h: h,
|
|
6498
|
+
hTags: hTags,
|
|
6361
6499
|
hr: hr,
|
|
6362
6500
|
hrs: hrs,
|
|
6363
6501
|
html: html,
|
|
6364
|
-
link: link
|
|
6502
|
+
link: link,
|
|
6503
|
+
s: s,
|
|
6504
|
+
sTags: sTags
|
|
6365
6505
|
});
|
|
6366
6506
|
|
|
6367
6507
|
class ZikoUIInputImage extends ZikoUIElement {
|
|
@@ -11738,4 +11878,4 @@ function RemoveAll(){
|
|
|
11738
11878
|
Data.RemoveAll();
|
|
11739
11879
|
}
|
|
11740
11880
|
|
|
11741
|
-
export { Accordion, App$1 as App, Article, Aside, Base, Breadcrumbs, Canvas, Carousel, CodeCell, CodeNote, Collapsible, Combinaison, Complex, E, EPSILON, Ease, FileBasedRouting, Flex$1 as Flex, Footer, Form, Grid$1 as Grid, HTMLWrapper, Header, LinearSystem, Logic$1 as Logic, Main, Matrix, Modal, Nav, PI$1 as PI, Permutation, Random, SPA, SVGWrapper, Section, Slider, Splitter, Str, Suspense, Svg, Table$1 as Table, Tabs, Utils$1 as Utils, ZikoApp, ZikoCustomEvent, ZikoEvent, ZikoEventClick, ZikoEventClipboard, ZikoEventHash, ZikoEventInput, ZikoEventKey, ZikoEventMouse, ZikoEventPointer, ZikoEventSwipe, ZikoEventWheel, ZikoHead$1 as ZikoHead, ZikoJsonStyleSheet, ZikoMutationObserver, ZikoSPA, ZikoSvgCircle, ZikoSvgEllipse, ZikoSvgForeignObject, ZikoSvgGroupe, ZikoSvgImage, ZikoSvgLine, ZikoSvgLink, ZikoSvgPath, ZikoSvgRectangle, ZikoSvgText, ZikoUIAbbrText, ZikoUIAccordion, ZikoUIArticle, ZikoUIAside, ZikoUIAudio, ZikoUIBlockQuote, ZikoUIBr, ZikoUIBreadcrumbs, ZikoUICanvas, ZikoUICodeNote, ZikoUICodeText, ZikoUIContainerElement, ZikoUIDefintion, ZikoUIElement, ZikoUIFigure, ZikoUIFlex$1 as ZikoUIFlex, ZikoUIFooter, ZikoUIForm, ZikoUIGrid, ZikoUIHTMLWrapper, ZikoUIHeader, ZikoUIHeading, ZikoUIHorizontalSlider, ZikoUIHorizontalSplitter, 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, ZikoUIMenu3d, ZikoUIModal, ZikoUINav, ZikoUIParagraphe, ZikoUIQuote, ZikoUISVGWrapper, ZikoUISection, ZikoUISelect, ZikoUISubText, ZikoUISupText, ZikoUISuspense, ZikoUISvg, ZikoUIText, ZikoUITextArea, ZikoUIVerticalSlider, ZikoUIVerticalSplitter, ZikoUIVideo, ZikoUIXMLWrapper, ZikoUseRoot, ZikoUseStyle, __Config__, __UI__, abbrText, abs, accum, acos, acosh, acot, add, adoc2html, arange, arr2str, asin, asinh, atan, atan2, atanh, audio, bessel, beta, blockQuote, br, brs, btn, canvasArc, canvasCircle, canvasLine, canvasPoints, canvasRect, cartesianProduct, ceil, checkbox, choleskyDecomposition, clamp, codeText, combinaison, complex, cos, cosh, cot, coth, count, countWords, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, dangerAlert, datalist, Ziko as default, defineParamsGetter, deg2rad, dfnText, div, e, fact, figure, floor, gamma, geomspace, h, h1, h2, h3, h4, h5, h6, hSlider, hSplitter, hr, hrs, html, hypot, image, inRange, infoAlert, 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, markdown2html, matrix, matrix2, matrix3, matrix4, max, menu3d, min, modulo, mul, norm, nums, obj2str, ol, ones, p, pgcd, pow, powerSet, ppcm, preload, prod, qrDecomposition, quote, rad2deg, radio, removeExtraSpace, round, search, sec, select, sig, sign, sin, sinc, sinh, slider, sqrt, sqrtn, str, sub, subSet, subText, successAlert, sum, supText, svg2ascii, svg2img, svg2imgUrl, svg2str, svgCircle, svgEllipse, svgGrid, svgGroupe, svgImage, svgLine, svgLink, svgObject, svgPath, svgPolygon, svgRect, svgText, tan, tanh, text$1 as text, textarea, timeTaken, time_memory_Taken, ul, useAnimation, useBattery, useChannel$1 as useChannel, useClickEvent, useClipboardEvent, useCustomEvent, useDebounce, useDragEvent, useDropEvent, useEventEmitter, useFavIcon$1 as useFavIcon, useFocusEvent, useFps, useGeolocation, 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, vSlider, vSplitter, video, wait, waitForUIElm, waitForUIElmSync, warningAlert, watch, watchAttr, watchChildren, watchIntersection, watchScreen, watchSize, zeros };
|
|
11881
|
+
export { Accordion, App$1 as App, Article, Aside, Base, Breadcrumbs, Canvas, Carousel, CodeCell, CodeNote, Collapsible, Combinaison, Complex, E, EPSILON, Ease, FileBasedRouting, Flex$1 as Flex, Footer, Form, Grid$1 as Grid, HTMLWrapper, Header, LinearSystem, Logic$1 as Logic, Main, Matrix, Modal, Nav, PI$1 as PI, Permutation, Random, SPA, SVGWrapper, Section, Slider, Splitter, Str, Suspense, Svg, Table$1 as Table, Tabs, Utils$1 as Utils, ZikoApp, ZikoCustomEvent, ZikoEvent, ZikoEventClick, ZikoEventClipboard, ZikoEventHash, ZikoEventInput, ZikoEventKey, ZikoEventMouse, ZikoEventPointer, ZikoEventSwipe, ZikoEventWheel, ZikoHead$1 as ZikoHead, ZikoJsonStyleSheet, ZikoMutationObserver, ZikoSPA, ZikoSvgCircle, ZikoSvgEllipse, ZikoSvgForeignObject, ZikoSvgGroupe, ZikoSvgImage, ZikoSvgLine, ZikoSvgLink, ZikoSvgPath, ZikoSvgRectangle, ZikoSvgText, ZikoUIAbbrText, ZikoUIAccordion, ZikoUIArticle, ZikoUIAside, ZikoUIAudio, ZikoUIBlockQuote, ZikoUIBr, ZikoUIBreadcrumbs, ZikoUICanvas, ZikoUICodeNote, ZikoUICodeText, ZikoUIContainerElement, ZikoUIDefintion, ZikoUIElement, ZikoUIFigure, ZikoUIFlex$1 as ZikoUIFlex, ZikoUIFooter, ZikoUIForm, ZikoUIGrid, ZikoUIHTMLWrapper, ZikoUIHeader, ZikoUIHeading, ZikoUIHorizontalSlider, ZikoUIHorizontalSplitter, 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, ZikoUIMenu3d, ZikoUIModal, ZikoUINav, ZikoUIParagraphe, ZikoUIQuote, ZikoUISVGWrapper, ZikoUISection, ZikoUISelect, ZikoUISubText, ZikoUISupText, ZikoUISuspense, ZikoUISvg, ZikoUIText, ZikoUITextArea, ZikoUIVerticalSlider, ZikoUIVerticalSplitter, ZikoUIVideo, ZikoUIXMLWrapper, ZikoUseRoot, ZikoUseStyle, __Config__, __UI__, abbrText, abs, accum, acos, acosh, acot, add, adoc2html, arange, arr2str, asin, asinh, atan, atan2, atanh, audio, bessel, beta, blockQuote, br, brs, btn, canvasArc, canvasCircle, canvasLine, canvasPoints, canvasRect, cartesianProduct, ceil, checkbox, choleskyDecomposition, clamp, codeText, combinaison, complex, cos, cosh, cot, coth, count, countWords, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, dangerAlert, datalist, Ziko as default, defineParamsGetter, deg2rad, dfnText, div, e, fact, figure, floor, gamma, geomspace, h, h1, h2, h3, h4, h5, h6, hSlider, hSplitter, hTags, hr, hrs, html, hypot, image, inRange, infoAlert, 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, markdown2html, matrix, matrix2, matrix3, matrix4, max, menu3d, 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, successAlert, sum, supText, svg2ascii, svg2img, svg2imgUrl, svg2str, svgCircle, svgEllipse, svgGrid, svgGroupe, svgImage, svgLine, svgLink, svgObject, svgPath, svgPolygon, svgRect, svgText, tan, tanh, text$1 as text, textarea, timeTaken, time_memory_Taken, ul, useAnimation, useBattery, useChannel$1 as useChannel, useClickEvent, useClipboardEvent, useCustomEvent, useDebounce, useDragEvent, useDropEvent, useEventEmitter, useFavIcon$1 as useFavIcon, useFocusEvent, useFps, useGeolocation, 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, vSlider, vSplitter, video, wait, waitForUIElm, waitForUIElmSync, warningAlert, watch, watchAttr, watchChildren, watchIntersection, watchScreen, watchSize, zeros };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ziko",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"description": "a versatile javaScript framework offering a rich set of UI components, advanced mathematical utilities, reactivity, animations, client side routing and graphics capabilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"front-end",
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
"type": "git",
|
|
49
49
|
"url": "git+https://github.com/zakarialaoui10/ziko.js.git"
|
|
50
50
|
},
|
|
51
|
-
|
|
52
51
|
"author": "zakaria elalaoui",
|
|
53
52
|
"license": "MIT",
|
|
54
53
|
"bugs": {
|
|
@@ -19,11 +19,16 @@ import {
|
|
|
19
19
|
} from "../../../reactivity/index.js"
|
|
20
20
|
import { Random } from "../../../math/index.js";
|
|
21
21
|
import { Str } from "../../../data/index.js";
|
|
22
|
+
import { text } from "./text/text.js";
|
|
22
23
|
class ZikoUIElement {
|
|
23
|
-
constructor(element ,name="") {
|
|
24
|
+
constructor(element ,name="", el_type="html") {
|
|
24
25
|
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
|
|
25
26
|
if(typeof element === "string") {
|
|
26
|
-
|
|
27
|
+
switch(el_type){
|
|
28
|
+
case "html" : element = globalThis?.document?.createElement(element); break;
|
|
29
|
+
case "svg" : element = globalThis?.document?.createElementNS("http://www.w3.org/2000/svg", element);
|
|
30
|
+
default : throw Error("Not supported")
|
|
31
|
+
}
|
|
27
32
|
}
|
|
28
33
|
if(element)this.__ele__ = element;
|
|
29
34
|
this.uuid=this.constructor.name+"-"+Random.string(10);
|
|
@@ -1,11 +1,144 @@
|
|
|
1
|
-
import ZikoUIElement from
|
|
2
|
-
|
|
3
|
-
const {name, style, ...attrs} = attributes
|
|
4
|
-
let element = new ZikoUIElement(tag,name);
|
|
1
|
+
import ZikoUIElement from '../ZikoUIElement.js';
|
|
2
|
+
const _h=(tag, type, attributes, ...children)=>{
|
|
3
|
+
const { name, style, ...attrs } = attributes;
|
|
4
|
+
let element = new ZikoUIElement(tag, name, type);
|
|
5
5
|
style && element.style(style);
|
|
6
6
|
attrs && element.setAttr(attrs);
|
|
7
|
-
children && element.append(...children)
|
|
8
|
-
return element
|
|
7
|
+
children && element.append(...children);
|
|
8
|
+
return element;
|
|
9
9
|
}
|
|
10
|
+
const h=(tag, attributes = {}, ...children)=> _h(tag, "html", attributes, ...children);
|
|
11
|
+
const s=(tag, attributes = {}, ...children)=> _h(tag, "svg", attributes, ...children);
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
const HTMLTags = [
|
|
14
|
+
'a',
|
|
15
|
+
'abb',
|
|
16
|
+
'address',
|
|
17
|
+
'area',
|
|
18
|
+
'article',
|
|
19
|
+
'aside',
|
|
20
|
+
'audio',
|
|
21
|
+
'b',
|
|
22
|
+
'base',
|
|
23
|
+
'bdi',
|
|
24
|
+
'bdo',
|
|
25
|
+
'blockquote',
|
|
26
|
+
'br',
|
|
27
|
+
'button',
|
|
28
|
+
'canvas',
|
|
29
|
+
'caption',
|
|
30
|
+
'cite',
|
|
31
|
+
'code',
|
|
32
|
+
'col',
|
|
33
|
+
'colgroup',
|
|
34
|
+
'data',
|
|
35
|
+
'datalist',
|
|
36
|
+
'dd',
|
|
37
|
+
'del',
|
|
38
|
+
'details',
|
|
39
|
+
'dfn',
|
|
40
|
+
'dialog',
|
|
41
|
+
'div',
|
|
42
|
+
'dl',
|
|
43
|
+
'dt',
|
|
44
|
+
'em',
|
|
45
|
+
'embed',
|
|
46
|
+
'fieldset',
|
|
47
|
+
'figcaption',
|
|
48
|
+
'figure',
|
|
49
|
+
'footer',
|
|
50
|
+
'form',
|
|
51
|
+
'h1',
|
|
52
|
+
'h2',
|
|
53
|
+
'h3',
|
|
54
|
+
'h4',
|
|
55
|
+
'h5',
|
|
56
|
+
'h6',
|
|
57
|
+
'header',
|
|
58
|
+
'hgroup',
|
|
59
|
+
'hr',
|
|
60
|
+
'i',
|
|
61
|
+
'iframe',
|
|
62
|
+
'img',
|
|
63
|
+
'ipnut',
|
|
64
|
+
'ins',
|
|
65
|
+
'kbd',
|
|
66
|
+
'label',
|
|
67
|
+
'legend',
|
|
68
|
+
'li',
|
|
69
|
+
'main',
|
|
70
|
+
'map',
|
|
71
|
+
'mark',
|
|
72
|
+
'menu',
|
|
73
|
+
'meter',
|
|
74
|
+
'nav',
|
|
75
|
+
'object',
|
|
76
|
+
'ol',
|
|
77
|
+
'optgroup',
|
|
78
|
+
'option',
|
|
79
|
+
'output',
|
|
80
|
+
'p',
|
|
81
|
+
'param',
|
|
82
|
+
'picture',
|
|
83
|
+
'pre',
|
|
84
|
+
'progress',
|
|
85
|
+
'q',
|
|
86
|
+
'rp',
|
|
87
|
+
'rt',
|
|
88
|
+
'ruby',
|
|
89
|
+
's',
|
|
90
|
+
'samp',
|
|
91
|
+
'search',
|
|
92
|
+
'section',
|
|
93
|
+
'select',
|
|
94
|
+
'small',
|
|
95
|
+
'source',
|
|
96
|
+
'span',
|
|
97
|
+
'strong',
|
|
98
|
+
'sub',
|
|
99
|
+
'summary',
|
|
100
|
+
'sup',
|
|
101
|
+
'svg',
|
|
102
|
+
'table',
|
|
103
|
+
'tbody',
|
|
104
|
+
'td',
|
|
105
|
+
'template',
|
|
106
|
+
'textarea',
|
|
107
|
+
'tfoot',
|
|
108
|
+
'th',
|
|
109
|
+
'thead',
|
|
110
|
+
'time',
|
|
111
|
+
'title',
|
|
112
|
+
'tr',
|
|
113
|
+
'track',
|
|
114
|
+
'u',
|
|
115
|
+
'ul',
|
|
116
|
+
'var',
|
|
117
|
+
'video',
|
|
118
|
+
'wbr'
|
|
119
|
+
];
|
|
120
|
+
|
|
121
|
+
const SVGTags = [
|
|
122
|
+
"svg", "g", "defs", "symbol", "use", "image", "switch",
|
|
123
|
+
"rect", "circle", "ellipse", "line", "polyline", "polygon", "path",
|
|
124
|
+
"text", "tspan", "textPath", "altGlyph", "altGlyphDef", "altGlyphItem", "glyph", "glyphRef",
|
|
125
|
+
"linearGradient", "radialGradient", "pattern", "solidColor",
|
|
126
|
+
"filter", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix",
|
|
127
|
+
"feDiffuseLighting", "feDisplacementMap", "feDropShadow", "feFlood", "feFuncA", "feFuncR", "feFuncG", "feFuncB",
|
|
128
|
+
"feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "feSpecularLighting",
|
|
129
|
+
"feTile", "feTurbulence",
|
|
130
|
+
"animate", "animateMotion", "animateTransform", "set",
|
|
131
|
+
"script",
|
|
132
|
+
"desc", "title", "metadata", "foreignObject"
|
|
133
|
+
];
|
|
134
|
+
|
|
135
|
+
const hTags = HTMLTags.reduce((acc, key) => {
|
|
136
|
+
acc[key] = (attr, ...children) => h(key, attr, ...children);
|
|
137
|
+
return acc;
|
|
138
|
+
}, {});
|
|
139
|
+
const sTags = SVGTags.reduce((acc, key) => {
|
|
140
|
+
acc[key] = (attr, ...children) => h(key, attr, ...children);
|
|
141
|
+
return acc;
|
|
142
|
+
}, {});
|
|
143
|
+
|
|
144
|
+
export { h, s, hTags, sTags };
|