ziko 0.0.21 → 0.0.23
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 +173 -17
- package/dist/ziko.js +173 -17
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +170 -18
- package/package.json +1 -2
- package/src/app/globals.js +2 -0
- package/src/index.js +2 -1
- package/src/ui/elements/primitives/ZikoUIElement.js +22 -8
- package/src/ui/elements/primitives/hydrate.js +0 -0
- package/src/ui/elements/primitives/misc/hyperscript.js +140 -7
- package/starter/bin/index.js +0 -11
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 : Sat Jan 04 2025 21:24:21 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,13 +4845,19 @@ const Reactivity={
|
|
|
4845
4845
|
};
|
|
4846
4846
|
|
|
4847
4847
|
class ZikoUIElement {
|
|
4848
|
-
constructor(element
|
|
4848
|
+
constructor(element, name="", {el_type="html", useDefaultStyle=false}={}){
|
|
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
|
+
}
|
|
4856
|
+
}
|
|
4857
|
+
else {
|
|
4858
|
+
this.target = element.parentElement;
|
|
4852
4859
|
}
|
|
4853
4860
|
if(element)this.__ele__ = element;
|
|
4854
|
-
this.uuid=this.constructor.name+"-"+Random.string(10);
|
|
4855
4861
|
this.cache = {
|
|
4856
4862
|
name,
|
|
4857
4863
|
parent:null,
|
|
@@ -4882,23 +4888,30 @@ class ZikoUIElement {
|
|
|
4882
4888
|
resize:null,
|
|
4883
4889
|
intersection:null
|
|
4884
4890
|
};
|
|
4891
|
+
this.uuid = `${this.cache.name}-${Random.string(16)}`;
|
|
4885
4892
|
this.cache.style.linkTo(this);
|
|
4886
|
-
this.style({
|
|
4893
|
+
useDefaultStyle && this.style({
|
|
4887
4894
|
position: "relative",
|
|
4888
4895
|
boxSizing:"border-box",
|
|
4889
4896
|
margin:0,
|
|
4890
4897
|
padding:0,
|
|
4898
|
+
width : "auto",
|
|
4899
|
+
height : "auto"
|
|
4891
4900
|
});
|
|
4892
4901
|
this.items = [];
|
|
4893
|
-
this.size("auto", "auto");
|
|
4894
4902
|
globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
|
|
4895
4903
|
element && globalThis.__Ziko__.__Config__.default.render && this.render();
|
|
4904
|
+
this.setAttr("data-ref", this.uuid);
|
|
4905
|
+
globalThis.__Ziko__.__HYDRATION_MAP__.push({
|
|
4906
|
+
ref : this.uuid,
|
|
4907
|
+
comp : ()=>this
|
|
4908
|
+
});
|
|
4896
4909
|
}
|
|
4897
4910
|
get element(){
|
|
4898
|
-
return this.__ele__
|
|
4911
|
+
return this.__ele__;
|
|
4899
4912
|
}
|
|
4900
4913
|
get isZikoUIElement(){
|
|
4901
|
-
return true
|
|
4914
|
+
return true;
|
|
4902
4915
|
}
|
|
4903
4916
|
get st(){
|
|
4904
4917
|
return this.cache.style;
|
|
@@ -4907,7 +4920,7 @@ class ZikoUIElement {
|
|
|
4907
4920
|
return this.cache.attributes;
|
|
4908
4921
|
}
|
|
4909
4922
|
get evt(){
|
|
4910
|
-
return this.
|
|
4923
|
+
return this.events;
|
|
4911
4924
|
}
|
|
4912
4925
|
get html(){
|
|
4913
4926
|
return this.element.innerHTML;
|
|
@@ -4972,7 +4985,7 @@ class ZikoUIElement {
|
|
|
4972
4985
|
return this;
|
|
4973
4986
|
}
|
|
4974
4987
|
for (let i = 0; i < ele.length; i++) {
|
|
4975
|
-
if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
4988
|
+
if (["number", "string"].includes(typeof ele[i])) ele[i] = text$1(ele[i]);
|
|
4976
4989
|
if (ele[i] instanceof ZikoUIElement) {
|
|
4977
4990
|
ele[i].cache.parent = this;
|
|
4978
4991
|
this.element[adder](ele[i].element);
|
|
@@ -5002,7 +5015,7 @@ class ZikoUIElement {
|
|
|
5002
5015
|
if (index >= this.element.children.length) this.append(...ele);
|
|
5003
5016
|
else
|
|
5004
5017
|
for (let i = 0; i < ele.length; i++) {
|
|
5005
|
-
if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
5018
|
+
if (["number", "string"].includes(typeof ele[i])) ele[i] = text$1(ele[i]);
|
|
5006
5019
|
this.element?.insertBefore(ele[i].element, this.items[index].element);
|
|
5007
5020
|
this.items.splice(index, 0, ele[i]);
|
|
5008
5021
|
}
|
|
@@ -6246,14 +6259,147 @@ class ZikoUISuspense extends ZikoUIElement{
|
|
|
6246
6259
|
|
|
6247
6260
|
const Suspense = (fallback_ui, callback) => new ZikoUISuspense(fallback_ui, callback);
|
|
6248
6261
|
|
|
6249
|
-
|
|
6250
|
-
const {name, style, ...attrs} = attributes;
|
|
6251
|
-
let element = new ZikoUIElement(tag,name);
|
|
6262
|
+
const _h=(tag, type, attributes, ...children)=>{
|
|
6263
|
+
const { name, style, ...attrs } = attributes;
|
|
6264
|
+
let element = new ZikoUIElement(tag, name, type);
|
|
6252
6265
|
style && element.style(style);
|
|
6253
6266
|
attrs && element.setAttr(attrs);
|
|
6254
6267
|
children && element.append(...children);
|
|
6255
|
-
return element
|
|
6256
|
-
}
|
|
6268
|
+
return element;
|
|
6269
|
+
};
|
|
6270
|
+
const h=(tag, attributes = {}, ...children)=> _h(tag, "html", attributes, ...children);
|
|
6271
|
+
const s=(tag, attributes = {}, ...children)=> _h(tag, "svg", attributes, ...children);
|
|
6272
|
+
|
|
6273
|
+
const HTMLTags = [
|
|
6274
|
+
'a',
|
|
6275
|
+
'abb',
|
|
6276
|
+
'address',
|
|
6277
|
+
'area',
|
|
6278
|
+
'article',
|
|
6279
|
+
'aside',
|
|
6280
|
+
'audio',
|
|
6281
|
+
'b',
|
|
6282
|
+
'base',
|
|
6283
|
+
'bdi',
|
|
6284
|
+
'bdo',
|
|
6285
|
+
'blockquote',
|
|
6286
|
+
'br',
|
|
6287
|
+
'button',
|
|
6288
|
+
'canvas',
|
|
6289
|
+
'caption',
|
|
6290
|
+
'cite',
|
|
6291
|
+
'code',
|
|
6292
|
+
'col',
|
|
6293
|
+
'colgroup',
|
|
6294
|
+
'data',
|
|
6295
|
+
'datalist',
|
|
6296
|
+
'dd',
|
|
6297
|
+
'del',
|
|
6298
|
+
'details',
|
|
6299
|
+
'dfn',
|
|
6300
|
+
'dialog',
|
|
6301
|
+
'div',
|
|
6302
|
+
'dl',
|
|
6303
|
+
'dt',
|
|
6304
|
+
'em',
|
|
6305
|
+
'embed',
|
|
6306
|
+
'fieldset',
|
|
6307
|
+
'figcaption',
|
|
6308
|
+
'figure',
|
|
6309
|
+
'footer',
|
|
6310
|
+
'form',
|
|
6311
|
+
'h1',
|
|
6312
|
+
'h2',
|
|
6313
|
+
'h3',
|
|
6314
|
+
'h4',
|
|
6315
|
+
'h5',
|
|
6316
|
+
'h6',
|
|
6317
|
+
'header',
|
|
6318
|
+
'hgroup',
|
|
6319
|
+
'hr',
|
|
6320
|
+
'i',
|
|
6321
|
+
'iframe',
|
|
6322
|
+
'img',
|
|
6323
|
+
'ipnut',
|
|
6324
|
+
'ins',
|
|
6325
|
+
'kbd',
|
|
6326
|
+
'label',
|
|
6327
|
+
'legend',
|
|
6328
|
+
'li',
|
|
6329
|
+
'main',
|
|
6330
|
+
'map',
|
|
6331
|
+
'mark',
|
|
6332
|
+
'menu',
|
|
6333
|
+
'meter',
|
|
6334
|
+
'nav',
|
|
6335
|
+
'object',
|
|
6336
|
+
'ol',
|
|
6337
|
+
'optgroup',
|
|
6338
|
+
'option',
|
|
6339
|
+
'output',
|
|
6340
|
+
'p',
|
|
6341
|
+
'param',
|
|
6342
|
+
'picture',
|
|
6343
|
+
'pre',
|
|
6344
|
+
'progress',
|
|
6345
|
+
'q',
|
|
6346
|
+
'rp',
|
|
6347
|
+
'rt',
|
|
6348
|
+
'ruby',
|
|
6349
|
+
's',
|
|
6350
|
+
'samp',
|
|
6351
|
+
'search',
|
|
6352
|
+
'section',
|
|
6353
|
+
'select',
|
|
6354
|
+
'small',
|
|
6355
|
+
'source',
|
|
6356
|
+
'span',
|
|
6357
|
+
'strong',
|
|
6358
|
+
'sub',
|
|
6359
|
+
'summary',
|
|
6360
|
+
'sup',
|
|
6361
|
+
'svg',
|
|
6362
|
+
'table',
|
|
6363
|
+
'tbody',
|
|
6364
|
+
'td',
|
|
6365
|
+
'template',
|
|
6366
|
+
'textarea',
|
|
6367
|
+
'tfoot',
|
|
6368
|
+
'th',
|
|
6369
|
+
'thead',
|
|
6370
|
+
'time',
|
|
6371
|
+
'title',
|
|
6372
|
+
'tr',
|
|
6373
|
+
'track',
|
|
6374
|
+
'u',
|
|
6375
|
+
'ul',
|
|
6376
|
+
'var',
|
|
6377
|
+
'video',
|
|
6378
|
+
'wbr'
|
|
6379
|
+
];
|
|
6380
|
+
|
|
6381
|
+
const SVGTags = [
|
|
6382
|
+
"svg", "g", "defs", "symbol", "use", "image", "switch",
|
|
6383
|
+
"rect", "circle", "ellipse", "line", "polyline", "polygon", "path",
|
|
6384
|
+
"text", "tspan", "textPath", "altGlyph", "altGlyphDef", "altGlyphItem", "glyph", "glyphRef",
|
|
6385
|
+
"linearGradient", "radialGradient", "pattern", "solidColor",
|
|
6386
|
+
"filter", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix",
|
|
6387
|
+
"feDiffuseLighting", "feDisplacementMap", "feDropShadow", "feFlood", "feFuncA", "feFuncR", "feFuncG", "feFuncB",
|
|
6388
|
+
"feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "feSpecularLighting",
|
|
6389
|
+
"feTile", "feTurbulence",
|
|
6390
|
+
"animate", "animateMotion", "animateTransform", "set",
|
|
6391
|
+
"script",
|
|
6392
|
+
"desc", "title", "metadata", "foreignObject"
|
|
6393
|
+
];
|
|
6394
|
+
|
|
6395
|
+
const hTags = HTMLTags.reduce((acc, key) => {
|
|
6396
|
+
acc[key] = (attr, ...children) => h(key, attr, ...children);
|
|
6397
|
+
return acc;
|
|
6398
|
+
}, {});
|
|
6399
|
+
const sTags = SVGTags.reduce((acc, key) => {
|
|
6400
|
+
acc[key] = (attr, ...children) => h(key, attr, ...children);
|
|
6401
|
+
return acc;
|
|
6402
|
+
}, {});
|
|
6257
6403
|
|
|
6258
6404
|
class ZikoUIHtmlTag extends ZikoUIContainerElement {
|
|
6259
6405
|
constructor(element) {
|
|
@@ -6358,10 +6504,13 @@ var Misc = /*#__PURE__*/Object.freeze({
|
|
|
6358
6504
|
brs: brs,
|
|
6359
6505
|
btn: btn,
|
|
6360
6506
|
h: h,
|
|
6507
|
+
hTags: hTags,
|
|
6361
6508
|
hr: hr,
|
|
6362
6509
|
hrs: hrs,
|
|
6363
6510
|
html: html,
|
|
6364
|
-
link: link
|
|
6511
|
+
link: link,
|
|
6512
|
+
s: s,
|
|
6513
|
+
sTags: sTags
|
|
6365
6514
|
});
|
|
6366
6515
|
|
|
6367
6516
|
class ZikoUIInputImage extends ZikoUIElement {
|
|
@@ -11586,6 +11735,7 @@ function defineParamsGetter(target ){
|
|
|
11586
11735
|
}
|
|
11587
11736
|
|
|
11588
11737
|
const __UI__={};
|
|
11738
|
+
const __HYDRATION_MAP__ = [];
|
|
11589
11739
|
const __Config__={
|
|
11590
11740
|
default:{
|
|
11591
11741
|
target:null,
|
|
@@ -11605,6 +11755,7 @@ const __Config__={
|
|
|
11605
11755
|
var Global = /*#__PURE__*/Object.freeze({
|
|
11606
11756
|
__proto__: null,
|
|
11607
11757
|
__Config__: __Config__,
|
|
11758
|
+
__HYDRATION_MAP__: __HYDRATION_MAP__,
|
|
11608
11759
|
__UI__: __UI__
|
|
11609
11760
|
});
|
|
11610
11761
|
|
|
@@ -11704,6 +11855,7 @@ if ( globalThis.__Ziko__ ) {
|
|
|
11704
11855
|
globalThis.__Ziko__={
|
|
11705
11856
|
...Ziko,
|
|
11706
11857
|
__UI__,
|
|
11858
|
+
__HYDRATION_MAP__,
|
|
11707
11859
|
__Config__,
|
|
11708
11860
|
ExtractAll,
|
|
11709
11861
|
RemoveAll
|
|
@@ -11738,4 +11890,4 @@ function RemoveAll(){
|
|
|
11738
11890
|
Data.RemoveAll();
|
|
11739
11891
|
}
|
|
11740
11892
|
|
|
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 };
|
|
11893
|
+
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__, __HYDRATION_MAP__, __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.23",
|
|
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": {
|
package/src/app/globals.js
CHANGED
package/src/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import Time from "./time";
|
|
|
5
5
|
import Data from "./data";
|
|
6
6
|
import Reactivity from "./reactivity";
|
|
7
7
|
import Graphics from "./graphics";
|
|
8
|
-
import App,{__UI__, __Config__, defineParamsGetter} from "./app";
|
|
8
|
+
import App,{__UI__,__HYDRATION_MAP__, __Config__, defineParamsGetter} from "./app";
|
|
9
9
|
|
|
10
10
|
export * from "./math";
|
|
11
11
|
export * from "./ui";
|
|
@@ -45,6 +45,7 @@ if ( globalThis.__Ziko__ ) {
|
|
|
45
45
|
globalThis.__Ziko__={
|
|
46
46
|
...Ziko,
|
|
47
47
|
__UI__,
|
|
48
|
+
__HYDRATION_MAP__,
|
|
48
49
|
__Config__,
|
|
49
50
|
ExtractAll,
|
|
50
51
|
RemoveAll
|
|
@@ -19,14 +19,21 @@ 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
|
|
24
|
+
constructor(element, name="", {el_type="html", useDefaultStyle=false}={}){
|
|
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
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else{
|
|
34
|
+
this.target = element.parentElement;
|
|
27
35
|
}
|
|
28
36
|
if(element)this.__ele__ = element;
|
|
29
|
-
this.uuid=this.constructor.name+"-"+Random.string(10);
|
|
30
37
|
this.cache = {
|
|
31
38
|
name,
|
|
32
39
|
parent:null,
|
|
@@ -57,23 +64,30 @@ class ZikoUIElement {
|
|
|
57
64
|
resize:null,
|
|
58
65
|
intersection:null
|
|
59
66
|
}
|
|
67
|
+
this.uuid = `${this.cache.name}-${Random.string(16)}`
|
|
60
68
|
this.cache.style.linkTo(this);
|
|
61
|
-
this.style({
|
|
69
|
+
useDefaultStyle && this.style({
|
|
62
70
|
position: "relative",
|
|
63
71
|
boxSizing:"border-box",
|
|
64
72
|
margin:0,
|
|
65
73
|
padding:0,
|
|
74
|
+
width : "auto",
|
|
75
|
+
height : "auto"
|
|
66
76
|
});
|
|
67
77
|
this.items = [];
|
|
68
|
-
this.size("auto", "auto");
|
|
69
78
|
globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
|
|
70
79
|
element && globalThis.__Ziko__.__Config__.default.render && this.render()
|
|
80
|
+
this.setAttr("data-ref", this.uuid);
|
|
81
|
+
globalThis.__Ziko__.__HYDRATION_MAP__.push({
|
|
82
|
+
ref : this.uuid,
|
|
83
|
+
comp : ()=>this
|
|
84
|
+
})
|
|
71
85
|
}
|
|
72
86
|
get element(){
|
|
73
|
-
return this.__ele__
|
|
87
|
+
return this.__ele__;
|
|
74
88
|
}
|
|
75
89
|
get isZikoUIElement(){
|
|
76
|
-
return true
|
|
90
|
+
return true;
|
|
77
91
|
}
|
|
78
92
|
get st(){
|
|
79
93
|
return this.cache.style;
|
|
@@ -82,7 +96,7 @@ class ZikoUIElement {
|
|
|
82
96
|
return this.cache.attributes;
|
|
83
97
|
}
|
|
84
98
|
get evt(){
|
|
85
|
-
return this.
|
|
99
|
+
return this.events;
|
|
86
100
|
}
|
|
87
101
|
get html(){
|
|
88
102
|
return this.element.innerHTML;
|
|
File without changes
|
|
@@ -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 };
|
package/starter/bin/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import path from "path"
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { createFolder,copyFolder , runCommand } from "./utils/commands.js";
|
|
5
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
const TEMPLATE = path.join(__dirname,"../template");
|
|
7
|
-
const PROJECT_TITLE = process.argv[2]||"zikojs-project";
|
|
8
|
-
createFolder(PROJECT_TITLE);
|
|
9
|
-
copyFolder(TEMPLATE,path.join(process.cwd(),PROJECT_TITLE));
|
|
10
|
-
runCommand(`cd ${PROJECT_TITLE} && npm install`);
|
|
11
|
-
|