ziko 0.0.6 → 0.0.8

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 : Sat Apr 13 2024 14:35:44 GMT+0000 (UTC)
5
+ Date : Mon May 20 2024 20:27:08 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
@@ -10,10 +10,6 @@
10
10
 
11
11
  class ZikoMath {}
12
12
 
13
- /** @module Math */
14
- /**
15
- * @class
16
- */
17
13
  class Complex extends ZikoMath{
18
14
  constructor(a = 0, b = 0) {
19
15
  super();
@@ -177,13 +173,6 @@ class Complex extends ZikoMath{
177
173
  return "<span>" + this.a + " + i * " + this.b + "</span>";
178
174
  }
179
175
  }
180
- /**
181
- * Performs complex number operations on numbers, arrays, ArrayBuffers, or Matrices.
182
- * @param {number|number[]|ArrayBuffer|Matrix} a
183
- * @param {number|number[]|ArrayBuffer|Matrix} b
184
- * @param {number|number[]|ArrayBuffer|Matrix} b
185
- * @returns {Complex|Complex[]}
186
- */
187
176
  const complex=(a,b)=>{
188
177
  if((a instanceof Array||ArrayBuffer.isView(a)) && (b instanceof Array||ArrayBuffer.isView(a)))return a.map((n,i)=>complex(a[i],b[i]));
189
178
  if(a instanceof Matrix && b instanceof Matrix){
@@ -7197,8 +7186,8 @@ class ZikoUITextArea extends ZikoUIElement {
7197
7186
  //import { debounce,throttle} from "../../Data/decorators.js";
7198
7187
 
7199
7188
  class ZikoUIInput extends ZikoUIElement {
7200
- constructor(value = "",datalist) {
7201
- super();
7189
+ constructor(name , value = "",datalist) {
7190
+ super("input",name);
7202
7191
  this.element = document.createElement("input");
7203
7192
  Object.assign(this.events,{input:null});
7204
7193
  this.setValue(value);
@@ -7273,7 +7262,7 @@ class ZikoUIInput extends ZikoUIElement {
7273
7262
  }
7274
7263
  class ZikoUIInputSearch extends ZikoUIInput {
7275
7264
  constructor() {
7276
- super();
7265
+ super("inputSearch");
7277
7266
  this._setType("search");
7278
7267
  this.Length = 0;
7279
7268
  }
@@ -7310,7 +7299,7 @@ class ZikoUIInputSearch extends ZikoUIInput {
7310
7299
  }
7311
7300
  class ZikoUIInputNumber extends ZikoUIInput {
7312
7301
  constructor(min, max ,step = 1) {
7313
- super();
7302
+ super("inpuNumber");
7314
7303
  this._setType("number");
7315
7304
  this.setMin(min).setMax(max).setStep(step);
7316
7305
  }
@@ -7332,14 +7321,14 @@ class ZikoUIInputNumber extends ZikoUIInput {
7332
7321
  }
7333
7322
  class ZikoUIInputSlider extends ZikoUIInputNumber {
7334
7323
  constructor(val = 0, min = 0, max = 10, step = 1) {
7335
- super();
7324
+ super("inputSlider");
7336
7325
  this._setType("range");
7337
7326
  this.setMin(min).setMax(max).setValue(val).setStep(step);
7338
7327
  }
7339
7328
  }
7340
7329
  class ZikoUIInputColor extends ZikoUIInput {
7341
7330
  constructor() {
7342
- super();
7331
+ super("inputColor");
7343
7332
  this._setType("color");
7344
7333
  this.background(this.value);
7345
7334
  this.onInput(() => this.background(this.value));
@@ -7347,37 +7336,37 @@ class ZikoUIInputColor extends ZikoUIInput {
7347
7336
  }
7348
7337
  class ZikoUIInputPassword extends ZikoUIInput {
7349
7338
  constructor() {
7350
- super();
7339
+ super("inputPassword");
7351
7340
  this._setType("password");
7352
7341
  }
7353
7342
  }
7354
7343
  class ZikoUIInputEmail extends ZikoUIInput {
7355
7344
  constructor() {
7356
- super();
7345
+ super("inputEmail");
7357
7346
  this._setType("email");
7358
7347
  }
7359
7348
  }
7360
7349
  class ZikoUIInputTime extends ZikoUIInput {
7361
7350
  constructor() {
7362
- super();
7351
+ super("inputTime");
7363
7352
  this._setType("time");
7364
7353
  }
7365
7354
  }
7366
7355
  class ZikoUIInputDate extends ZikoUIInput {
7367
7356
  constructor() {
7368
- super();
7357
+ super("inputDate");
7369
7358
  this._setType("date");
7370
7359
  }
7371
7360
  }
7372
7361
  class ZikoUIInputDateTime extends ZikoUIInput {
7373
7362
  constructor() {
7374
- super();
7363
+ super("inputDateTime");
7375
7364
  this._setType("datetime-local");
7376
7365
  }
7377
7366
  }
7378
7367
  class ZikoUIInputCheckbox extends ZikoUIInput {
7379
7368
  constructor() {
7380
- super();
7369
+ super("inputCheckbox");
7381
7370
  this._setType("checkbox");
7382
7371
  this.cursor("pointer");
7383
7372
  }
@@ -7395,7 +7384,7 @@ class ZikoUIInputCheckbox extends ZikoUIInput {
7395
7384
  }
7396
7385
  class ZikoUIInputRadio extends ZikoUIInput {
7397
7386
  constructor() {
7398
- super();
7387
+ super("inputRadio");
7399
7388
  this._setType("radio");
7400
7389
  this.cursor("pointer");
7401
7390
  }
@@ -7415,7 +7404,7 @@ class ZikoUIInputRadio extends ZikoUIInput {
7415
7404
 
7416
7405
  class ZikoUIInputImage extends ZikoUIElement {
7417
7406
  constructor(text = "File") {
7418
- super();
7407
+ super("inputImage");
7419
7408
  this._aux_element = btn(text).setTarget(this.Target);
7420
7409
  this.element = document.createElement("input");
7421
7410
  this.element.setAttribute("type", "file");
@@ -9934,6 +9923,39 @@ const __Config__={
9934
9923
  init:()=>document.documentElement.setAttribute("data-engine","zikojs")
9935
9924
  };
9936
9925
 
9926
+ class ZikoUIComponent extends HTMLElement{
9927
+ constructor(){
9928
+ super();
9929
+ this.shadowDOM = this.attachShadow({ mode: 'open' });
9930
+ this.wrapper=document.createElement("div");
9931
+ }
9932
+ connectedCallback() {
9933
+ this.setAttribute('role', 'region');
9934
+ this.setAttribute('data-engine',"zikojs");
9935
+ this.shadowDOM.append(this.wrapper);
9936
+ this.observeContentChanges();
9937
+ }
9938
+ observeContentChanges() {
9939
+ const observer = new MutationObserver((mutations) => {
9940
+ mutations.forEach((mutation) => {
9941
+ if (mutation.type === 'childList' || mutation.type === 'characterData') {
9942
+ this.wrapper.innerHTML="";
9943
+ __Ziko__.__Config__.setDefault({ target: this.wrapper });
9944
+ globalThis.eval(this.innerHTML);
9945
+ }
9946
+ });
9947
+ });
9948
+ observer.observe(this, { childList: true, subtree: true, characterData: true });
9949
+ }
9950
+
9951
+ disconnectedCallback() {
9952
+ console.log('ZikoUIComponent removed from page.');
9953
+ }
9954
+ }
9955
+ if(globalThis.document){
9956
+ globalThis.customElements.define('ziko-ui', ZikoUIComponent);
9957
+ }
9958
+
9937
9959
  class ZikoSeo{
9938
9960
  constructor(app){
9939
9961
  this.app=app;
@@ -10066,4 +10088,4 @@ function RemoveAll(){
10066
10088
  Data.RemoveAll();
10067
10089
  }
10068
10090
 
10069
- export { Accordion, App, Article, Aside, Base, Canvas, Carousel, CodeCell, CodeNote, Combinaison, Complex, DarkThemes, Data, E, EPSILON, Ease, Events, ExtractAll, Fixed, Flex, Footer, Graphics, Grid$1 as Grid, Header, LightThemes, LinearSystem, Logic$1 as Logic, Main, Math$1 as Math, Matrix, Nav, PI, Permutation, Random, RemoveAll, SPA, Section$1 as Section, Signal, Svg, Table, Tabs, Themes, Time, UI$1 as UI, Utils, ZikoUIArticle, ZikoUIAside, ZikoUIAudio, ZikoUIBr, ZikoUICanvas, ZikoUICodeNote, ZikoUIElement, ZikoUIFigure, ZikoUIFooter, ZikoUIHeader, ZikoUIHr, ZikoUIHtmlTag, ZikoUIImage, ZikoUILink, ZikoUIMain, ZikoUINav, ZikoUISection, ZikoUISvg, ZikoUIVideo, __Config__, abs, accum, acos, acosh, acot, add, adoc2html, animation, arange, asin, asinh, atan, atan2, atanh, audio, bessel, beta, br, brs, btn, canvasArc, canvasCircle, canvasLine, canvasPoints, canvasRect, cartesianProduct, ceil, checkbox, choleskyDecomposition, clamp, complex, cos, cosh, cot, coth, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, datalist, Ziko as default, deg2rad, div, e, fact, figure, floor, gamma, geomspace, h1, h2, h3, h4, h5, h6, hr, hrs, html, hypot, image, inRange, input, inputCamera, inputColor, inputDate, inputDateTime, inputEmail, inputImage, inputNumber, inputPassword, inputTime, isApproximatlyEqual, json2arr, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, lerp, li, link, linspace, ln, logspace, loop, luDecomposition, map, mapfun$1 as mapfun, markdown2html, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, ol, ones, p, pgcd, pow, powerSet, ppcm, prod, qrDecomposition, rad2deg, radio, round, search, sec, select, sig, sign, sin, sinc, sinh, slider, sqrt, sqrtn, sub, subSet, sum, svg2ascii, svg2img, svg2imgUrl, svg2str, svgCircle, svgEllipse, svgGroupe, svgImage, svgLine, svgPolygon, svgRect, svgText, tan, tanh, text$1 as text, textarea, timeTaken, time_memory_Taken, ul, useDebounce, useThrottle, video, wait, waitForUIElm, waitForUIElmSync, zeros };
10091
+ export { Accordion, App, Article, Aside, Base, Canvas, Carousel, CodeCell, CodeNote, Combinaison, Complex, DarkThemes, Data, E, EPSILON, Ease, Events, ExtractAll, Fixed, Flex, Footer, Graphics, Grid$1 as Grid, Header, LightThemes, LinearSystem, Logic$1 as Logic, Main, Math$1 as Math, Matrix, Nav, PI, Permutation, Random, RemoveAll, SPA, Section$1 as Section, Signal, Svg, Table, Tabs, Themes, Time, UI$1 as UI, Utils, ZikoUIArticle, ZikoUIAside, ZikoUIAudio, ZikoUIBr, ZikoUICanvas, ZikoUICodeNote, ZikoUIComponent, ZikoUIElement, ZikoUIFigure, ZikoUIFooter, ZikoUIHeader, ZikoUIHr, ZikoUIHtmlTag, ZikoUIImage, ZikoUILink, ZikoUIMain, ZikoUINav, ZikoUISection, ZikoUISvg, ZikoUIVideo, __Config__, abs, accum, acos, acosh, acot, add, adoc2html, animation, arange, asin, asinh, atan, atan2, atanh, audio, bessel, beta, br, brs, btn, canvasArc, canvasCircle, canvasLine, canvasPoints, canvasRect, cartesianProduct, ceil, checkbox, choleskyDecomposition, clamp, complex, cos, cosh, cot, coth, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, datalist, Ziko as default, deg2rad, div, e, fact, figure, floor, gamma, geomspace, h1, h2, h3, h4, h5, h6, hr, hrs, html, hypot, image, inRange, input, inputCamera, inputColor, inputDate, inputDateTime, inputEmail, inputImage, inputNumber, inputPassword, inputTime, isApproximatlyEqual, json2arr, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, lerp, li, link, linspace, ln, logspace, loop, luDecomposition, map, mapfun$1 as mapfun, markdown2html, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, ol, ones, p, pgcd, pow, powerSet, ppcm, prod, qrDecomposition, rad2deg, radio, round, search, sec, select, sig, sign, sin, sinc, sinh, slider, sqrt, sqrtn, sub, subSet, sum, svg2ascii, svg2img, svg2imgUrl, svg2str, svgCircle, svgEllipse, svgGroupe, svgImage, svgLine, svgPolygon, svgRect, svgText, tan, tanh, text$1 as text, textarea, timeTaken, time_memory_Taken, ul, useDebounce, useThrottle, video, wait, waitForUIElm, waitForUIElmSync, zeros };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ziko",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
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",
@@ -7,4 +7,5 @@ const TEMPLATE = path.join(__dirname,"../template");
7
7
  const PROJECT_TITLE = process.argv[2]||"zikojs-project";
8
8
  createFolder(PROJECT_TITLE);
9
9
  copyFolder(TEMPLATE,path.join(process.cwd(),PROJECT_TITLE));
10
- runCommand(`cd ${PROJECT_TITLE} && npm install`);
10
+ runCommand(`cd ${PROJECT_TITLE} && npm install`);
11
+
@@ -1,26 +0,0 @@
1
- # Overview
2
- react-ziko is a tool designed for rendering [ziko](https://github.com/zakarialaoui10/ziko.js) elements within a React application.
3
-
4
- # Install
5
- ```bash
6
- npm i react-ziko
7
- ```
8
- # Usage
9
- ```jsx
10
- import ZikoUI from "react-ziko";
11
- import { text } from "ziko";
12
- const ui = text("Hello World").style({
13
- color:"darkblue"
14
- });
15
- export default function App() {
16
- return (
17
- <main>
18
- <ZikoUI ui={ui.render(false)} />
19
- </main>
20
- );
21
- }
22
-
23
- ```
24
- # Dependencies
25
- - [React](https://react.dev/) :
26
- - [Zikojs](https://github.com/zakarialaoui10/ziko.js) :
@@ -1,22 +0,0 @@
1
- import React, { useRef, useEffect } from "react";
2
- import {ZikoUIElement} from "ziko";
3
- /**
4
- * A React component for rendering ZikoUIElement.
5
- * @param {Object} props - Component props.
6
- * @param {ZikoUIElement} props.ui - The ZikoUIElement to render.
7
- * @returns {JSX.Element} JSX representation of the ZikoUI component.
8
- */
9
- function ZikoUI({ ui }) {
10
- const containerRef = useRef(null);
11
- useEffect(() => {
12
- globalThis.__Ziko__.__Config__.setDefault({render:false})
13
- if (containerRef.current && ui && ui instanceof ZikoUIElement) {
14
- containerRef.current.innerHTML = "";
15
- containerRef.current.appendChild(ui.element);
16
- }
17
- }, [ui]);
18
- return (
19
- <ziko-ui ref={containerRef} data-engine="ziko"></ziko-ui>
20
- );
21
- }
22
- export default ZikoUI;
@@ -1,15 +0,0 @@
1
- <ziko-ui bind:this={containerRef} data-engine="ziko"></ziko-ui>
2
-
3
- <script>
4
- import { onMount } from 'svelte';
5
- import {ZikoUIElement} from "ziko";
6
- let containerRef;
7
-
8
- onMount(() => {
9
- if (containerRef && ui instanceof ZikoUIElement) {
10
- containerRef.innerHTML = "";
11
- containerRef.appendChild(ui.element);
12
- }
13
- });
14
- export let ui;
15
- </script>
@@ -1,23 +0,0 @@
1
- <template>
2
- <ziko-ui ref="containerRef" data-engine="ziko"></ziko-ui>
3
- </template>
4
- <script>
5
- import {ZikoUIElement} from "ziko"
6
- export default {
7
- props: {
8
- ui: Object
9
- },
10
- mounted() {
11
- //globalThis.__Ziko__.__Config__.setDefault({render:false})
12
- if (this.$refs.containerRef && this.ui instanceof ZikoUIElement) {
13
- this.$refs.containerRef.innerHTML = "";
14
- this.$refs.containerRef.appendChild(this.ui.render(false).element);
15
- }
16
- }
17
- };
18
- </script>
19
- <style scoped>
20
- ziko-ui{
21
- display:block;
22
- }
23
- </style>