ziko 0.0.13 → 0.0.14

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 : Mon Sep 16 2024 15:20:35 GMT+0100 (UTC+01:00)
5
+ Date : Tue Oct 01 2024 12:12:32 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
@@ -3257,7 +3257,7 @@ class ZikoIntersectionObserver{
3257
3257
  margin
3258
3258
  };
3259
3259
  if(!globalThis.IntersectionObserver){
3260
- console.log("IntersectionObserver Nor Supported");
3260
+ console.log("IntersectionObserver Not Supported");
3261
3261
  return;
3262
3262
  }
3263
3263
  this.observer=new IntersectionObserver((entries)=>{
@@ -5706,7 +5706,7 @@ class ZikoUIElement {
5706
5706
  this.style({
5707
5707
  position: "relative",
5708
5708
  boxSizing:"border-box",
5709
- fontFamily:"verdana",
5709
+ // fontFamily:"verdana",
5710
5710
  margin:0,
5711
5711
  padding:0,
5712
5712
  });
@@ -5861,24 +5861,24 @@ class ZikoUIElement {
5861
5861
  this.element?.animate(keyframe,{duration, iterations, easing});
5862
5862
  return this;
5863
5863
  }
5864
- // Attributes
5864
+ // Attributes
5865
+ #setAttr(name, value){
5866
+ name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
5867
+ if(this?.attr[name] && this?.attr[name]===value) return;
5868
+ this.element.setAttribute(name, value);
5869
+ Object.assign(this.cache.attributes, {[name]:value});
5870
+ }
5865
5871
  setAttr(name, value) {
5866
5872
  if(name instanceof Object){
5867
5873
  const [names,values]=[Object.keys(name),Object.values(name)];
5868
5874
  for(let i=0;i<names.length;i++){
5869
5875
  if(values[i] instanceof Array)value[i] = values[i].join(" ");
5870
- if(this?.attr[name[i]]!==value[i]){
5871
- this.element?.setAttribute(names[i], values[i]);
5872
- Object.assign(this.cache.attributes, Object.fromEntries([[names[i], values[i]]]));
5873
- }
5876
+ this.#setAttr(names[i], values[i]);
5874
5877
  }
5875
5878
  }
5876
5879
  else {
5877
5880
  if(value instanceof Array)value = value.join(" ");
5878
- if(this?.attr[name]!==value){
5879
- this.element?.setAttribute(name, value);
5880
- Object.assign(this.cache.attributes, Object.fromEntries([[name, value]]));
5881
- }
5881
+ this.#setAttr(name, value);
5882
5882
  }
5883
5883
  return this;
5884
5884
  }
@@ -5887,6 +5887,7 @@ class ZikoUIElement {
5887
5887
  return this;
5888
5888
  }
5889
5889
  getAttr(name){
5890
+ name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
5890
5891
  return this.element.attributes[name].value;
5891
5892
  }
5892
5893
  setContentEditable(bool = true) {
@@ -6122,13 +6123,14 @@ class ZikoUIElement {
6122
6123
  }
6123
6124
 
6124
6125
  let ZikoUIImage$1 = class ZikoUIImage extends ZikoUIElement {
6125
- constructor(src, w, h) {
6126
+ constructor(src,alt, w, h) {
6126
6127
  super("img","image");
6127
6128
  this.value=src;
6128
- if (src.nodeName === "IMG")this.element?.setAttribute("src", src.src);
6129
+ if (src.nodeName === "IMG")this.element.setAttribute("src", src.src);
6129
6130
  else this.element?.setAttribute("src", src);
6130
6131
  if (typeof w == "number") w += "%";
6131
6132
  if (typeof h == "number") h += "%";
6133
+ this.setAttr("alt", alt);
6132
6134
  this.style({ border: "1px solid black", width: w, height: h });
6133
6135
  }
6134
6136
  get isImg(){
@@ -6151,7 +6153,7 @@ let ZikoUIImage$1 = class ZikoUIImage extends ZikoUIElement {
6151
6153
  return this;
6152
6154
  }
6153
6155
  };
6154
- const image$1 = (src, width, height) => new ZikoUIImage$1(src, width, height);
6156
+ const image$1 = (src,alt, width, height) => new ZikoUIImage$1(src,alt, width, height);
6155
6157
 
6156
6158
  const svg2str=svg=>(new XMLSerializer()).serializeToString(svg);
6157
6159
  const svg2ascii=svg=>btoa(svg2str(svg));
@@ -8328,6 +8330,7 @@ class ZikoUIBr extends ZikoUIElement {
8328
8330
  class ZikoUIHr extends ZikoUIElement {
8329
8331
  constructor() {
8330
8332
  super("hr","hr");
8333
+ this.setAttr("role", "none");
8331
8334
  }
8332
8335
  get isHr(){
8333
8336
  return true
@@ -8508,6 +8511,7 @@ class ZikoUIInput extends ZikoUIElement {
8508
8511
  this.setValue(value);
8509
8512
  this.setAttr("type", type);
8510
8513
  this.setAttr("name", name);
8514
+ // this.setAttr("tab-index","0")
8511
8515
  if (datalist) this.linkDatalist(datalist);
8512
8516
  }
8513
8517
  get isInput() {
@@ -8844,13 +8848,14 @@ class ZikoUIInputImage extends ZikoUIElement {
8844
8848
  const inputImage = (text) => new ZikoUIInputImage(text);
8845
8849
 
8846
8850
  class ZikoUIImage extends ZikoUIElement {
8847
- constructor(src, w, h) {
8851
+ constructor(src,alt, w, h) {
8848
8852
  super("img","image");
8849
8853
  this.value=src;
8850
- if (src.nodeName === "IMG")this.element?.setAttribute("src", src.src);
8854
+ if (src.nodeName === "IMG")this.element.setAttribute("src", src.src);
8851
8855
  else this.element?.setAttribute("src", src);
8852
8856
  if (typeof w == "number") w += "%";
8853
8857
  if (typeof h == "number") h += "%";
8858
+ this.setAttr("alt", alt);
8854
8859
  this.style({ border: "1px solid black", width: w, height: h });
8855
8860
  }
8856
8861
  get isImg(){
@@ -8873,7 +8878,7 @@ class ZikoUIImage extends ZikoUIElement {
8873
8878
  return this;
8874
8879
  }
8875
8880
  }
8876
- const image = (src, width, height) => new ZikoUIImage(src, width, height);
8881
+ const image = (src,alt, width, height) => new ZikoUIImage(src,alt, width, height);
8877
8882
 
8878
8883
  class ZikoUIFigure extends ZikoUIElement{
8879
8884
  constructor(src,caption){
@@ -9351,6 +9356,72 @@ class ZikoUIAccordion extends ZikoUIContainerElement{
9351
9356
  }
9352
9357
  const Accordion = (... Collapsible) => new ZikoUIAccordion(...Collapsible);
9353
9358
 
9359
+ class ZikoUIMain extends ZikoUIContainerElement{
9360
+ constructor(){
9361
+ super("main","Main");
9362
+ }
9363
+ get isMain(){
9364
+ return true
9365
+ }
9366
+ }
9367
+ class ZikoUIHeader extends ZikoUIContainerElement{
9368
+ constructor(){
9369
+ super("header","Header");
9370
+ }
9371
+ get isHeader(){
9372
+ return true
9373
+ }
9374
+ }
9375
+ class ZikoUINav extends ZikoUIContainerElement{
9376
+ constructor(){
9377
+ super("nav","Nav");
9378
+ }
9379
+ get isNav(){
9380
+ return true
9381
+ }
9382
+ }
9383
+ class ZikoUISection extends ZikoUIContainerElement{
9384
+ constructor(){
9385
+ super("section","Section");
9386
+ this.style({position:"relative"});
9387
+ }
9388
+ get isSection(){
9389
+ return true
9390
+ }
9391
+ }
9392
+ class ZikoUIArticle extends ZikoUIContainerElement{
9393
+ constructor(){
9394
+ super("article","Article");
9395
+ }
9396
+ get isArticle(){
9397
+ return true
9398
+ }
9399
+ }
9400
+ class ZikoUIAside extends ZikoUIContainerElement{
9401
+ constructor(){
9402
+ super("aside","Aside");
9403
+ }
9404
+ get isAside(){
9405
+ return true
9406
+ }
9407
+ }
9408
+ class ZikoUIFooter extends ZikoUIContainerElement{
9409
+ constructor(){
9410
+ super("footer","Footer");
9411
+ this.element=document?.createElement("footer");
9412
+ }
9413
+ get isFooter(){
9414
+ return true
9415
+ }
9416
+ }
9417
+ const Section = (...ZikoUIElement) => new ZikoUISection().append(...ZikoUIElement);
9418
+ const Article = (...ZikoUIElement) => new ZikoUIArticle().append(...ZikoUIElement);
9419
+ const Main = (...ZikoUIElement) => new ZikoUIMain().append(...ZikoUIElement);
9420
+ const Header = (...ZikoUIElement) => new ZikoUIHeader().append(...ZikoUIElement);
9421
+ const Footer = (...ZikoUIElement) => new ZikoUIFooter().append(...ZikoUIElement);
9422
+ const Nav = (...ZikoUIElement) => new ZikoUINav().append(...ZikoUIElement);
9423
+ const Aside = (...ZikoUIElement) => new ZikoUIAside().append(...ZikoUIElement);
9424
+
9354
9425
  class ZikoUICarousel extends ZikoUIFlex{
9355
9426
  constructor(...ZikoUIElement){
9356
9427
  super();
@@ -10526,72 +10597,6 @@ a=Modal(text("Hello")).style({
10526
10597
  Flex(a).size("400px","400px").style({border:"1px red solid"})
10527
10598
  */
10528
10599
 
10529
- class ZikoUIMain extends ZikoUIContainerElement{
10530
- constructor(){
10531
- super("main","Main");
10532
- }
10533
- get isMain(){
10534
- return true
10535
- }
10536
- }
10537
- class ZikoUIHeader extends ZikoUIContainerElement{
10538
- constructor(){
10539
- super("header","Header");
10540
- }
10541
- get isHeader(){
10542
- return true
10543
- }
10544
- }
10545
- class ZikoUINav extends ZikoUIContainerElement{
10546
- constructor(){
10547
- super("nav","Nav");
10548
- }
10549
- get isNav(){
10550
- return true
10551
- }
10552
- }
10553
- class ZikoUISection extends ZikoUIContainerElement{
10554
- constructor(){
10555
- super("section","Section");
10556
- this.style({position:"relative"});
10557
- }
10558
- get isSection(){
10559
- return true
10560
- }
10561
- }
10562
- class ZikoUIArticle extends ZikoUIContainerElement{
10563
- constructor(){
10564
- super("article","Article");
10565
- }
10566
- get isArticle(){
10567
- return true
10568
- }
10569
- }
10570
- class ZikoUIAside extends ZikoUIContainerElement{
10571
- constructor(){
10572
- super("aside","Aside");
10573
- }
10574
- get isAside(){
10575
- return true
10576
- }
10577
- }
10578
- class ZikoUIFooter extends ZikoUIContainerElement{
10579
- constructor(){
10580
- super("footer","Footer");
10581
- this.element=document?.createElement("footer");
10582
- }
10583
- get isFooter(){
10584
- return true
10585
- }
10586
- }
10587
- const Section$1 = (...ZikoUIElement) => new ZikoUISection().append(...ZikoUIElement);
10588
- const Article = (...ZikoUIElement) => new ZikoUIArticle().append(...ZikoUIElement);
10589
- const Main = (...ZikoUIElement) => new ZikoUIMain().append(...ZikoUIElement);
10590
- const Header = (...ZikoUIElement) => new ZikoUIHeader().append(...ZikoUIElement);
10591
- const Footer = (...ZikoUIElement) => new ZikoUIFooter().append(...ZikoUIElement);
10592
- const Nav = (...ZikoUIElement) => new ZikoUINav().append(...ZikoUIElement);
10593
- const Aside = (...ZikoUIElement) => new ZikoUIAside().append(...ZikoUIElement);
10594
-
10595
10600
  class ZikoUITr extends ZikoUIElement{
10596
10601
  constructor(...ZikoUIElement){
10597
10602
  super();
@@ -10769,6 +10774,58 @@ class ZikoUITable extends ZikoUIElement {
10769
10774
  }
10770
10775
  const Table=(matrix,config)=>new ZikoUITable(matrix,config);
10771
10776
 
10777
+ class ZikoUIHtmlViewer extends ZikoUIElement{
10778
+ constructor(src, title){
10779
+ super("iframe", "HTMLViewer");
10780
+ this.setAttr({
10781
+ src,
10782
+ title,
10783
+ // ariaLabel : "Interactive YouTube video player for zikojs apps",
10784
+ role:"application",
10785
+ loading:"lazy"
10786
+ });
10787
+ }
10788
+ }
10789
+
10790
+ const HTMLViewer = (src, title) => new ZikoUIHtmlViewer(src, title);
10791
+ window.HTMLViewer = HTMLViewer;
10792
+
10793
+ class ZikoUIPdf extends ZikoUIElement{
10794
+ constructor(src, title = "Pdf Document Embaded in Zikojs App"){
10795
+ super("embed","PDFViewer");
10796
+ this.setAttr({
10797
+ src:src,
10798
+ type: "application/pdf",
10799
+ ariaLabel: title,
10800
+ tabIndex: "0",
10801
+ laoding:"lazy"
10802
+ });
10803
+ }
10804
+ }
10805
+ const PDFViewer=(src, title)=>new ZikoUIPdf(src, title);
10806
+ window.PDFViewer = PDFViewer;
10807
+
10808
+ class ZikoUIYoutubePlayer extends ZikoUIElement{
10809
+ constructor(src, title){
10810
+ super("iframe", "YoutubePlayer");
10811
+ const id = Str.isUrl(src)?getYouTubeVideoId(src):src;
10812
+ this.setAttr({
10813
+ src:`https://www.youtube.com/embed/${id}`,
10814
+ title,
10815
+ ariaLabel : title ?? "Interactive YouTube video player for zikojs apps",
10816
+ role:"application"
10817
+ });
10818
+ }
10819
+ }
10820
+ function getYouTubeVideoId(url) {
10821
+ const regex = /(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|embed)\/|.*[?&]v=)|youtu\.be\/|embed\/)([a-zA-Z0-9_-]{11})/;
10822
+ const match = url.match(regex);
10823
+ return match ? match[1] : null;
10824
+ }
10825
+ const YoutubePlayer = (id, title) => new ZikoUIYoutubePlayer(id, title);
10826
+ window.YoutubePlayer = YoutubePlayer;
10827
+ window.YB = YoutubePlayer;
10828
+
10772
10829
  const UI$1={
10773
10830
  html,
10774
10831
  text: text$1,
@@ -10821,7 +10878,7 @@ const UI$1={
10821
10878
  Grid: Grid$1,
10822
10879
  Header,
10823
10880
  Main,
10824
- Section: Section$1,
10881
+ Section,
10825
10882
  Article,
10826
10883
  Aside,
10827
10884
  Nav,
@@ -10840,6 +10897,7 @@ const UI$1={
10840
10897
  infoAlert,
10841
10898
  warningAlert,
10842
10899
  dangerAlert,
10900
+ PDFViewer,
10843
10901
  ExtractAll: function () {
10844
10902
  const keys = Object.keys(this);
10845
10903
  for (let i = 0; i < keys.length; i++) {
@@ -11054,7 +11112,7 @@ class ZikoSvgRectangle extends ZikoSvgElement{
11054
11112
  class ZikoSvgCircle extends ZikoSvgElement{
11055
11113
  constructor(cx,cy,r){
11056
11114
  super("circle");
11057
- this.element=document?.createElementttNS(
11115
+ this.element=document.createElementNS(
11058
11116
  "http://www.w3.org/2000/svg",
11059
11117
  "circle",
11060
11118
  );
@@ -11491,7 +11549,7 @@ class ZikoUICanvas extends ZikoUIContainerElement{
11491
11549
  lineWidth(w){
11492
11550
  this.ctx.lineWidth=w/this.transformMatrix[0][0]; return this
11493
11551
  }
11494
- ImageData(x=0,y=0,w=this.Width,h=this.Height){
11552
+ getImageData(x=0,y=0,w=this.Width,h=this.Height){
11495
11553
  return this.ctx.getImageData(x,y,w,h);
11496
11554
  }
11497
11555
  clear(){
@@ -12083,4 +12141,4 @@ function RemoveAll(){
12083
12141
  Data.RemoveAll();
12084
12142
  }
12085
12143
 
12086
- export { Accordion, App, Article, Aside, Base, Breadcrumbs, Canvas, Carousel, CodeCell, CodeNote, Collapsible, Combinaison, Complex, DarkThemes, Data, E, EPSILON, Ease, ExtractAll, Fixed, Flex, Footer, Form, Graphics, Grid$1 as Grid, Header, LightThemes, LinearSystem, Logic$1 as Logic, Main, Math$1 as Math, Matrix, Modal, Nav, PI, Permutation, Random, Reactivity, RemoveAll, SPA, Section$1 as Section, Signal, Str, Svg, Table, Tabs, Themes, Time, UI$1 as UI, Utils, ZikoUIAbbrText, ZikoUIAccordion, ZikoUIArticle, ZikoUIAside, ZikoUIAudio, ZikoUIBlockQuote, ZikoUIBr, ZikoUIBreadcrumbs, ZikoUICanvas, ZikoUICodeNote, ZikoUICodeText, ZikoUIDefintion, ZikoUIElement, ZikoUIFigure, ZikoUIFlex, ZikoUIFooter, ZikoUIForm, ZikoUIGrid, ZikoUIHeader, ZikoUIHeading, 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, ZikoUISection, ZikoUISelect, ZikoUISubText, ZikoUISupText, ZikoUISvg, ZikoUIText, ZikoUITextArea, ZikoUIVerticalSplitter, ZikoUIVideo, __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, complex, cos, cosh, cot, coth, count, countWords, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, dangerAlert, datalist, Ziko as default, deg2rad, dfnText, div, e, fact, figure, floor, gamma, geomspace, h1, h2, h3, h4, h5, h6, hSplitter, hr, hrs, html, hypot, image, inRange, infoAlert, input, inputCamera, inputColor, inputDate, inputDateTime, inputEmail, inputImage, inputNumber, inputPassword, inputTime, isApproximatlyEqual, json2arr, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, 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, 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, svgPolyLine, svgPolygon, svgRect, svgText, tan, tanh, text$1 as text, textarea, timeTaken, time_memory_Taken, ul, useAnimation, useBattery, useBluetooth, useChannel, useClickEvent, useClipboardEvent, useCustomEvent, useDebounce, useDragEvent, useDropEvent, useEventEmitter, useFavIcon, useFocusEvent, useGeolocation, useHashEvent, useInputEvent, useKeyEvenent as useKeyEvent, useLocaleStorage, useMediaQuery, useMouseEvent, usePointerEvent, useSessionStorage, useStyle, useSuccesifKeys, useSwipeEvent, useTheme, useThread, useThrottle, useTimeLoop, useTitle, useWheelEventnent as useWheelEvent, vSplitter, video, wait, waitForUIElm, waitForUIElmSync, warningAlert, watchAttr, watchChildren, watchIntersection, watchScreen, watchSize, zeros };
12144
+ export { Accordion, App, Article, Aside, Base, Breadcrumbs, Canvas, Carousel, CodeCell, CodeNote, Collapsible, Combinaison, Complex, DarkThemes, Data, E, EPSILON, Ease, ExtractAll, Fixed, Flex, Footer, Form, Graphics, Grid$1 as Grid, Header, LightThemes, LinearSystem, Logic$1 as Logic, Main, Math$1 as Math, Matrix, Modal, Nav, PI, Permutation, Random, Reactivity, RemoveAll, SPA, Section, Signal, Str, Svg, Table, Tabs, Themes, Time, UI$1 as UI, Utils, ZikoUIAbbrText, ZikoUIAccordion, ZikoUIArticle, ZikoUIAside, ZikoUIAudio, ZikoUIBlockQuote, ZikoUIBr, ZikoUIBreadcrumbs, ZikoUICanvas, ZikoUICodeNote, ZikoUICodeText, ZikoUIDefintion, ZikoUIElement, ZikoUIFigure, ZikoUIFlex, ZikoUIFooter, ZikoUIForm, ZikoUIGrid, ZikoUIHeader, ZikoUIHeading, 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, ZikoUISection, ZikoUISelect, ZikoUISubText, ZikoUISupText, ZikoUISvg, ZikoUIText, ZikoUITextArea, ZikoUIVerticalSplitter, ZikoUIVideo, __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, complex, cos, cosh, cot, coth, count, countWords, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, dangerAlert, datalist, Ziko as default, deg2rad, dfnText, div, e, fact, figure, floor, gamma, geomspace, h1, h2, h3, h4, h5, h6, hSplitter, hr, hrs, html, hypot, image, inRange, infoAlert, input, inputCamera, inputColor, inputDate, inputDateTime, inputEmail, inputImage, inputNumber, inputPassword, inputTime, isApproximatlyEqual, json2arr, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, 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, 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, svgPolyLine, svgPolygon, svgRect, svgText, tan, tanh, text$1 as text, textarea, timeTaken, time_memory_Taken, ul, useAnimation, useBattery, useBluetooth, useChannel, useClickEvent, useClipboardEvent, useCustomEvent, useDebounce, useDragEvent, useDropEvent, useEventEmitter, useFavIcon, useFocusEvent, useGeolocation, useHashEvent, useInputEvent, useKeyEvenent as useKeyEvent, useLocaleStorage, useMediaQuery, useMouseEvent, usePointerEvent, useSessionStorage, useStyle, useSuccesifKeys, useSwipeEvent, useTheme, useThread, useThrottle, useTimeLoop, useTitle, useWheelEventnent as useWheelEvent, vSplitter, video, wait, waitForUIElm, waitForUIElmSync, warningAlert, watchAttr, watchChildren, watchIntersection, watchScreen, watchSize, zeros };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ziko",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "a versatile JavaScript library offering a rich set of UI components, advanced mathematical utilities,Reactivity,animations,client side routing and graphics capabilities",
5
5
  "keywords": [
6
6
  "Zikojs",
@@ -28,6 +28,9 @@
28
28
  "import": "./dist/ziko.mjs",
29
29
  "require": "./dist/ziko.cjs"
30
30
  },
31
+ "./type": {
32
+ "import": "./src/type.js"
33
+ },
31
34
  "./math": {
32
35
  "import": "./src/math/index.js"
33
36
  },
@@ -57,9 +60,6 @@
57
60
  },
58
61
  "./graphics": {
59
62
  "import": "./src/data/graphics.js"
60
- },
61
- "./jsx-runtime": {
62
- "import": "./src/runtime/jsx-runtime/index.js"
63
63
  }
64
64
  },
65
65
  "bin": {
@@ -124,7 +124,7 @@ class ZikoUICanvas extends ZikoUIContainerElement{
124
124
  this.ctx.lineWidth=w/this.transformMatrix[0][0];;
125
125
  return this
126
126
  }
127
- ImageData(x=0,y=0,w=this.Width,h=this.Height){
127
+ getImageData(x=0,y=0,w=this.Width,h=this.Height){
128
128
  return this.ctx.getImageData(x,y,w,h);
129
129
  }
130
130
  clear(){
@@ -2,7 +2,7 @@ import ZikoSvgElement from "../ZikoSvgElement.js";
2
2
  class ZikoSvgCircle extends ZikoSvgElement{
3
3
  constructor(cx,cy,r){
4
4
  super("circle")
5
- this.element=document?.createElementttNS(
5
+ this.element=document.createElementNS(
6
6
  "http://www.w3.org/2000/svg",
7
7
  "circle",
8
8
  );
@@ -6,7 +6,7 @@ class ZikoIntersectionObserver{
6
6
  margin
7
7
  }
8
8
  if(!globalThis.IntersectionObserver){
9
- console.log("IntersectionObserver Nor Supported")
9
+ console.log("IntersectionObserver Not Supported")
10
10
  return;
11
11
  }
12
12
  this.observer=new IntersectionObserver((entries)=>{
package/src/types.js ADDED
@@ -0,0 +1,71 @@
1
+ import ZikoUIElement from "./user-interface/elements/primitives/ZikoUIElement";
2
+ import ZikoUIContainerElement from "./user-interface/elements/primitives/ZikoUIContainerElement";
3
+
4
+ export {
5
+ ZikoUIElement,
6
+ ZikoUIContainerElement
7
+ }
8
+ export {
9
+ ZikoUIAbbrText,
10
+ ZikoUIAccordion,
11
+ ZikoUIArticle,
12
+ ZikoUIAside,
13
+ ZikoUIAudio,
14
+ ZikoUIBlockQuote,
15
+ ZikoUIBr,
16
+ ZikoUIBreadcrumbs,
17
+ ZikoUICodeNote,
18
+ ZikoUICodeText,
19
+ ZikoUIDefintion,
20
+ ZikoUIFigure,
21
+ ZikoUIFlex,
22
+ ZikoUIFooter,
23
+ ZikoUIForm,
24
+ ZikoUIGrid,
25
+ ZikoUIHeader,
26
+ ZikoUIHeading,
27
+ ZikoUIHorizontalSplitter,
28
+ ZikoUIHr,
29
+ ZikoUIHtmlTag,
30
+ ZikoUIImage,
31
+ ZikoUIInput,
32
+ ZikoUIInputCheckbox,
33
+ ZikoUIInputColor,
34
+ ZikoUIInputDatalist,
35
+ ZikoUIInputDate,
36
+ ZikoUIInputDateTime,
37
+ ZikoUIInputEmail,
38
+ ZikoUIInputImage,
39
+ ZikoUIInputNumber,
40
+ ZikoUIInputOption,
41
+ ZikoUIInputPassword,
42
+ ZikoUIInputRadio,
43
+ ZikoUIInputSearch,
44
+ ZikoUIInputSlider,
45
+ ZikoUIInputTime,
46
+ ZikoUILabel,
47
+ ZikoUILink,
48
+ ZikoUIMain,
49
+ ZikoUIMenu3d,
50
+ ZikoUIModal,
51
+ ZikoUINav,
52
+ ZikoUIParagraphe,
53
+ ZikoUIQuote,
54
+ ZikoUISection,
55
+ ZikoUISelect,
56
+ ZikoUISubText,
57
+ ZikoUISupText,
58
+ ZikoUIText,
59
+ ZikoUITextArea,
60
+ ZikoUIVerticalSplitter,
61
+ ZikoUIVideo,
62
+ } from "./user-interface/index.js"
63
+
64
+ export{
65
+ Matrix,
66
+ LinearSystem,
67
+ Complex,
68
+ Random,
69
+ } from "./math/index.js"
70
+
71
+
@@ -1,4 +1,5 @@
1
1
  import { ZikoUIFlex } from "../../Flex";
2
+ import { Section } from "../../../primitives/semantic";
2
3
  class ZikoUICarousel extends ZikoUIFlex{
3
4
  constructor(...ZikoUIElement){
4
5
  super()
@@ -18,6 +18,7 @@ import {
18
18
  watchChildren
19
19
  } from "../../../reactivity/index.js"
20
20
  import { Random } from "../../../math/index.js";
21
+ import { Str } from "../../../data/index.js";
21
22
  class ZikoUIElement {
22
23
  constructor(element ,name="") {
23
24
  this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
@@ -59,7 +60,7 @@ class ZikoUIElement {
59
60
  this.style({
60
61
  position: "relative",
61
62
  boxSizing:"border-box",
62
- fontFamily:"verdana",
63
+ // fontFamily:"verdana",
63
64
  margin:0,
64
65
  padding:0,
65
66
  });
@@ -214,24 +215,24 @@ class ZikoUIElement {
214
215
  this.element?.animate(keyframe,{duration, iterations, easing});
215
216
  return this;
216
217
  }
217
- // Attributes
218
+ // Attributes
219
+ #setAttr(name, value){
220
+ name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
221
+ if(this?.attr[name] && this?.attr[name]===value) return;
222
+ this.element.setAttribute(name, value)
223
+ Object.assign(this.cache.attributes, {[name]:value});
224
+ }
218
225
  setAttr(name, value) {
219
226
  if(name instanceof Object){
220
227
  const [names,values]=[Object.keys(name),Object.values(name)];
221
228
  for(let i=0;i<names.length;i++){
222
229
  if(values[i] instanceof Array)value[i] = values[i].join(" ");
223
- if(this?.attr[name[i]]!==value[i]){
224
- this.element?.setAttribute(names[i], values[i]);
225
- Object.assign(this.cache.attributes, Object.fromEntries([[names[i], values[i]]]));
226
- }
230
+ this.#setAttr(names[i], values[i])
227
231
  }
228
232
  }
229
233
  else{
230
234
  if(value instanceof Array)value = value.join(" ");
231
- if(this?.attr[name]!==value){
232
- this.element?.setAttribute(name, value);
233
- Object.assign(this.cache.attributes, Object.fromEntries([[name, value]]));
234
- }
235
+ this.#setAttr(name, value)
235
236
  }
236
237
  return this;
237
238
  }
@@ -240,6 +241,7 @@ class ZikoUIElement {
240
241
  return this;
241
242
  }
242
243
  getAttr(name){
244
+ name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
243
245
  return this.element.attributes[name].value;
244
246
  }
245
247
  setContentEditable(bool = true) {
@@ -0,0 +1,21 @@
1
+ import ZikoUIElement from "../ZikoUIElement";
2
+
3
+ class ZikoUIHtmlViewer extends ZikoUIElement{
4
+ constructor(src, title){
5
+ super("iframe", "HTMLViewer")
6
+ this.setAttr({
7
+ src,
8
+ title,
9
+ // ariaLabel : "Interactive YouTube video player for zikojs apps",
10
+ role:"application",
11
+ loading:"lazy"
12
+ })
13
+ }
14
+ }
15
+
16
+ const HTMLViewer = (src, title) => new ZikoUIHtmlViewer(src, title);
17
+ window.HTMLViewer = HTMLViewer
18
+ export{
19
+ YoutubePlayer,
20
+ ZikoUIHtmlViewer
21
+ }
@@ -1 +1,3 @@
1
-
1
+ export * from "./html.js"
2
+ export * from "./pdf.js"
3
+ export * from "./youtube.js"
@@ -0,0 +1,18 @@
1
+ import ZikoUIElement from "../ZikoUIElement.js";
2
+ class ZikoUIPdf extends ZikoUIElement{
3
+ constructor(src, title = "Pdf Document Embaded in Zikojs App"){
4
+ super("embed","PDFViewer")
5
+ this.setAttr({
6
+ src:src,
7
+ type: "application/pdf",
8
+ ariaLabel: title,
9
+ tabIndex: "0",
10
+ })
11
+ }
12
+ }
13
+ const PDFViewer=(src, title)=>new ZikoUIPdf(src, title);
14
+ window.PDFViewer = PDFViewer
15
+ export{
16
+ ZikoUIPdf,
17
+ PDFViewer
18
+ }
@@ -0,0 +1,26 @@
1
+ import ZikoUIElement from "../ZikoUIElement";
2
+ import { Str } from "../../../../data";
3
+ class ZikoUIYoutubePlayer extends ZikoUIElement{
4
+ constructor(src, title){
5
+ super("iframe", "YoutubePlayer");
6
+ const id = Str.isUrl(src)?getYouTubeVideoId(src):src
7
+ this.setAttr({
8
+ src:`https://www.youtube.com/embed/${id}`,
9
+ title,
10
+ ariaLabel : title ?? "Interactive YouTube video player for zikojs apps",
11
+ role:"application"
12
+ })
13
+ }
14
+ }
15
+ function getYouTubeVideoId(url) {
16
+ const regex = /(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|embed)\/|.*[?&]v=)|youtu\.be\/|embed\/)([a-zA-Z0-9_-]{11})/;
17
+ const match = url.match(regex);
18
+ return match ? match[1] : null;
19
+ }
20
+ const YoutubePlayer = (id, title) => new ZikoUIYoutubePlayer(id, title);
21
+ window.YoutubePlayer = YoutubePlayer
22
+ window.YB = YoutubePlayer
23
+ export{
24
+ YoutubePlayer,
25
+ ZikoUIYoutubePlayer
26
+ }
@@ -7,6 +7,7 @@ class ZikoUIInput extends ZikoUIElement {
7
7
  this.setValue(value);
8
8
  this.setAttr("type", type);
9
9
  this.setAttr("name", name);
10
+ // this.setAttr("tab-index","0")
10
11
  if (datalist) this.linkDatalist(datalist);
11
12
  }
12
13
  get isInput() {