ziko 0.0.22 → 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/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 23:39:16 GMT+0100 (UTC+01:00)
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,7 +4845,7 @@ const Reactivity={
4845
4845
  };
4846
4846
 
4847
4847
  class ZikoUIElement {
4848
- constructor(element ,name="", el_type="html") {
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){
@@ -4854,8 +4854,10 @@ class ZikoUIElement {
4854
4854
  default : throw Error("Not supported")
4855
4855
  }
4856
4856
  }
4857
+ else {
4858
+ this.target = element.parentElement;
4859
+ }
4857
4860
  if(element)this.__ele__ = element;
4858
- this.uuid=this.constructor.name+"-"+Random.string(10);
4859
4861
  this.cache = {
4860
4862
  name,
4861
4863
  parent:null,
@@ -4886,23 +4888,30 @@ class ZikoUIElement {
4886
4888
  resize:null,
4887
4889
  intersection:null
4888
4890
  };
4891
+ this.uuid = `${this.cache.name}-${Random.string(16)}`;
4889
4892
  this.cache.style.linkTo(this);
4890
- this.style({
4893
+ useDefaultStyle && this.style({
4891
4894
  position: "relative",
4892
4895
  boxSizing:"border-box",
4893
4896
  margin:0,
4894
4897
  padding:0,
4898
+ width : "auto",
4899
+ height : "auto"
4895
4900
  });
4896
4901
  this.items = [];
4897
- this.size("auto", "auto");
4898
4902
  globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
4899
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
+ });
4900
4909
  }
4901
4910
  get element(){
4902
- return this.__ele__
4911
+ return this.__ele__;
4903
4912
  }
4904
4913
  get isZikoUIElement(){
4905
- return true
4914
+ return true;
4906
4915
  }
4907
4916
  get st(){
4908
4917
  return this.cache.style;
@@ -4911,7 +4920,7 @@ class ZikoUIElement {
4911
4920
  return this.cache.attributes;
4912
4921
  }
4913
4922
  get evt(){
4914
- return this.cache.events;
4923
+ return this.events;
4915
4924
  }
4916
4925
  get html(){
4917
4926
  return this.element.innerHTML;
@@ -11726,6 +11735,7 @@ function defineParamsGetter(target ){
11726
11735
  }
11727
11736
 
11728
11737
  const __UI__={};
11738
+ const __HYDRATION_MAP__ = [];
11729
11739
  const __Config__={
11730
11740
  default:{
11731
11741
  target:null,
@@ -11745,6 +11755,7 @@ const __Config__={
11745
11755
  var Global = /*#__PURE__*/Object.freeze({
11746
11756
  __proto__: null,
11747
11757
  __Config__: __Config__,
11758
+ __HYDRATION_MAP__: __HYDRATION_MAP__,
11748
11759
  __UI__: __UI__
11749
11760
  });
11750
11761
 
@@ -11844,6 +11855,7 @@ if ( globalThis.__Ziko__ ) {
11844
11855
  globalThis.__Ziko__={
11845
11856
  ...Ziko,
11846
11857
  __UI__,
11858
+ __HYDRATION_MAP__,
11847
11859
  __Config__,
11848
11860
  ExtractAll,
11849
11861
  RemoveAll
@@ -11878,4 +11890,4 @@ function RemoveAll(){
11878
11890
  Data.RemoveAll();
11879
11891
  }
11880
11892
 
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 };
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.22",
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",
@@ -1,4 +1,5 @@
1
1
  const __UI__={}
2
+ const __HYDRATION_MAP__ = []
2
3
  const __Config__={
3
4
  default:{
4
5
  target:null,
@@ -16,5 +17,6 @@ const __Config__={
16
17
  }
17
18
  export {
18
19
  __UI__,
20
+ __HYDRATION_MAP__,
19
21
  __Config__
20
22
  }
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
@@ -21,7 +21,7 @@ import { Random } from "../../../math/index.js";
21
21
  import { Str } from "../../../data/index.js";
22
22
  import { text } from "./text/text.js";
23
23
  class ZikoUIElement {
24
- constructor(element ,name="", el_type="html") {
24
+ constructor(element, name="", {el_type="html", useDefaultStyle=false}={}){
25
25
  this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
26
26
  if(typeof element === "string") {
27
27
  switch(el_type){
@@ -30,8 +30,10 @@ class ZikoUIElement {
30
30
  default : throw Error("Not supported")
31
31
  }
32
32
  }
33
+ else{
34
+ this.target = element.parentElement;
35
+ }
33
36
  if(element)this.__ele__ = element;
34
- this.uuid=this.constructor.name+"-"+Random.string(10);
35
37
  this.cache = {
36
38
  name,
37
39
  parent:null,
@@ -62,23 +64,30 @@ class ZikoUIElement {
62
64
  resize:null,
63
65
  intersection:null
64
66
  }
67
+ this.uuid = `${this.cache.name}-${Random.string(16)}`
65
68
  this.cache.style.linkTo(this);
66
- this.style({
69
+ useDefaultStyle && this.style({
67
70
  position: "relative",
68
71
  boxSizing:"border-box",
69
72
  margin:0,
70
73
  padding:0,
74
+ width : "auto",
75
+ height : "auto"
71
76
  });
72
77
  this.items = [];
73
- this.size("auto", "auto");
74
78
  globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
75
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
+ })
76
85
  }
77
86
  get element(){
78
- return this.__ele__
87
+ return this.__ele__;
79
88
  }
80
89
  get isZikoUIElement(){
81
- return true
90
+ return true;
82
91
  }
83
92
  get st(){
84
93
  return this.cache.style;
@@ -87,7 +96,7 @@ class ZikoUIElement {
87
96
  return this.cache.attributes;
88
97
  }
89
98
  get evt(){
90
- return this.cache.events;
99
+ return this.events;
91
100
  }
92
101
  get html(){
93
102
  return this.element.innerHTML;
File without changes
@@ -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
-