ziko 0.36.0 → 0.36.2
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 → README.dep.md} +1 -1
- package/dist/ziko.cjs +118 -81
- package/dist/ziko.js +118 -81
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +119 -81
- package/package.json +5 -3
- package/readme.md +57 -0
- package/src/reactivity/hooks/Head/useFavIcon.js +1 -1
- package/src/reactivity/hooks/Head/useTitle.js +1 -1
- package/src/reactivity/hooks/UI/index.js +1 -1
- package/src/use/index.js +14 -3
- package/src/use/{interactions/use-channel.js → use-channel.js} +1 -1
- package/src/use/use-root.js +78 -0
- package/src/use/{storage/index.js → use-storage.js} +1 -1
- package/src/use/app/index.js +0 -0
- package/src/use/decorators/index.js +0 -2
- package/src/use/interactions/index.js +0 -3
- /package/src/use/{decorators/use-debounce.js → use-debounce.js} +0 -0
- /package/src/use/{interactions/use-event-emmiter.js → use-event-emmiter.js} +0 -0
- /package/src/use/{app/use-favicon.js → use-favicon.js} +0 -0
- /package/src/use/{app/use-link.js → use-link.js} +0 -0
- /package/src/use/{app/use-meta.js → use-meta.js} +0 -0
- /package/src/use/{interactions/use-thread.js → use-thread.js} +0 -0
- /package/src/use/{decorators/use-throttle.js → use-throttle.js} +0 -0
- /package/src/use/{app/use-title.js → use-title.js} +0 -0
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 : Thu Aug 14 2025 10:09:49 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
|
|
@@ -3289,52 +3289,16 @@ class ZikoUseMediaQuery {
|
|
|
3289
3289
|
|
|
3290
3290
|
const useMediaQuery = (mediaQueryRules,fallback) => new ZikoUseMediaQuery(mediaQueryRules,fallback);
|
|
3291
3291
|
|
|
3292
|
-
class ZikoUseRoot{
|
|
3293
|
-
constructor(props){
|
|
3294
|
-
this.props={};
|
|
3295
|
-
props && this.set(props);
|
|
3296
|
-
}
|
|
3297
|
-
get(prop){
|
|
3298
|
-
return this.props[prop]
|
|
3299
|
-
}
|
|
3300
|
-
// getStaticValue(){
|
|
3301
|
-
// return document.documentElement.style.getPropertyValue("--primary-col")
|
|
3302
|
-
// }
|
|
3303
|
-
set(props){
|
|
3304
|
-
Object.entries(props).forEach(([key,value])=>this.#setOneProp(key, value));
|
|
3305
|
-
return this;
|
|
3306
|
-
}
|
|
3307
|
-
#setOneProp(prop, value){
|
|
3308
|
-
const CssProp = `--${Str.camel2hyphencase(prop)}`;
|
|
3309
|
-
document.documentElement.style.setProperty(CssProp,value);
|
|
3310
|
-
Object.assign(this.props, {[prop]: `var(${CssProp})`});
|
|
3311
|
-
Object.assign(this, {[prop] : `var(${CssProp})`});
|
|
3312
|
-
}
|
|
3313
|
-
}
|
|
3314
|
-
|
|
3315
|
-
const useRootValue=CssVar=>{
|
|
3316
|
-
if(!CssVar.startsWith("--")) CssVar = `--${Str.camel2hyphencase(CssVar)}`;
|
|
3317
|
-
return `var(${CssVar})`
|
|
3318
|
-
};
|
|
3319
|
-
// const useRootStaticValue=CssVar=>{
|
|
3320
|
-
// if(!CssVar.startsWith("--")) CssVar = `--${Str.camel2hyphencase(CssVar)}`
|
|
3321
|
-
// return globalThis.document.documentElement.style.getPropertyValue(CssVar)
|
|
3322
|
-
// }
|
|
3323
|
-
const useRoot=(props)=>new ZikoUseRoot(props);
|
|
3324
|
-
|
|
3325
3292
|
// export * from "./window"
|
|
3326
3293
|
|
|
3327
3294
|
var Hooks = /*#__PURE__*/Object.freeze({
|
|
3328
3295
|
__proto__: null,
|
|
3329
3296
|
ZikoHead: ZikoHead$1,
|
|
3330
|
-
ZikoUseRoot: ZikoUseRoot,
|
|
3331
3297
|
ZikoUseStyle: ZikoUseStyle,
|
|
3332
3298
|
useFavIcon: useFavIcon$1,
|
|
3333
3299
|
useHead: useHead$1,
|
|
3334
3300
|
useMediaQuery: useMediaQuery,
|
|
3335
3301
|
useMeta: useMeta$1,
|
|
3336
|
-
useRoot: useRoot,
|
|
3337
|
-
useRootValue: useRootValue,
|
|
3338
3302
|
useStyle: useStyle,
|
|
3339
3303
|
useSuccesifKeys: useSuccesifKeys,
|
|
3340
3304
|
useTitle: useTitle$1
|
|
@@ -8115,6 +8079,123 @@ class ZikoUseChannel{
|
|
|
8115
8079
|
}
|
|
8116
8080
|
const useChannel = name => new ZikoUseChannel(name);
|
|
8117
8081
|
|
|
8082
|
+
class ZikoUseThreed {
|
|
8083
|
+
#workerContent;
|
|
8084
|
+
constructor() {
|
|
8085
|
+
this.#workerContent = (
|
|
8086
|
+
function (msg) {
|
|
8087
|
+
try {
|
|
8088
|
+
const func = new Function("return " + msg.data.fun)();
|
|
8089
|
+
let result = func();
|
|
8090
|
+
postMessage({ result });
|
|
8091
|
+
} catch (error) {
|
|
8092
|
+
postMessage({ error: error.message });
|
|
8093
|
+
} finally {
|
|
8094
|
+
if (msg.data.close) self.close();
|
|
8095
|
+
}
|
|
8096
|
+
}
|
|
8097
|
+
).toString();
|
|
8098
|
+
this.blob = new Blob(["this.onmessage = " + this.#workerContent], { type: "text/javascript" });
|
|
8099
|
+
this.worker = new Worker(window.URL.createObjectURL(this.blob));
|
|
8100
|
+
}
|
|
8101
|
+
call(func, callback, close = true) {
|
|
8102
|
+
this.worker.postMessage({
|
|
8103
|
+
fun: func.toString(),
|
|
8104
|
+
close
|
|
8105
|
+
});
|
|
8106
|
+
this.worker.onmessage = function (e) {
|
|
8107
|
+
if (e.data.error) {
|
|
8108
|
+
console.error(e.data.error);
|
|
8109
|
+
} else {
|
|
8110
|
+
callback(e.data.result);
|
|
8111
|
+
}
|
|
8112
|
+
};
|
|
8113
|
+
return this;
|
|
8114
|
+
}
|
|
8115
|
+
}
|
|
8116
|
+
|
|
8117
|
+
const useThread = (func, callback , close) => {
|
|
8118
|
+
const T = new ZikoUseThreed();
|
|
8119
|
+
if (func) {
|
|
8120
|
+
T.call(func, callback , close);
|
|
8121
|
+
}
|
|
8122
|
+
return T;
|
|
8123
|
+
};
|
|
8124
|
+
|
|
8125
|
+
class ZikoUseRoot {
|
|
8126
|
+
constructor(PropsMap, {namespace = 'Ziko', register, ValidateCssProps = false} = {}){
|
|
8127
|
+
this.currentPropsMap = PropsMap;
|
|
8128
|
+
this.namespace = namespace;
|
|
8129
|
+
this.ValidateCssProps = ValidateCssProps;
|
|
8130
|
+
// this.pairs = {};
|
|
8131
|
+
// this.#maintain()
|
|
8132
|
+
this.use(PropsMap);
|
|
8133
|
+
}
|
|
8134
|
+
use(PropsMap){
|
|
8135
|
+
if(this.ValidateCssProps) ValidateCssProps(PropsMap);
|
|
8136
|
+
this.currentPropsMap = PropsMap;
|
|
8137
|
+
this.#maintain();
|
|
8138
|
+
return this;
|
|
8139
|
+
}
|
|
8140
|
+
#maintain(){
|
|
8141
|
+
const root = globalThis?.document?.documentElement?.style;
|
|
8142
|
+
for(let prop in this.currentPropsMap){
|
|
8143
|
+
const cssProp = this.namespace ? `--${this.namespace}-${prop}` : `--${prop}`;
|
|
8144
|
+
root.setProperty(
|
|
8145
|
+
cssProp,
|
|
8146
|
+
this.currentPropsMap[prop]
|
|
8147
|
+
);
|
|
8148
|
+
console.log({cssProp});
|
|
8149
|
+
// Object.assign(this.pairs, {
|
|
8150
|
+
// [prop] : `var(--${this.namespace}-${prop})`
|
|
8151
|
+
// })
|
|
8152
|
+
Object.defineProperty(this, prop, {
|
|
8153
|
+
value: `var(${cssProp})`,
|
|
8154
|
+
writable: true,
|
|
8155
|
+
configurable: true,
|
|
8156
|
+
enumerable: false
|
|
8157
|
+
});
|
|
8158
|
+
}
|
|
8159
|
+
}
|
|
8160
|
+
}
|
|
8161
|
+
|
|
8162
|
+
function ValidateCssProps(PropsMap){
|
|
8163
|
+
const validProps = new Set(Object.keys(document.documentElement.style));
|
|
8164
|
+
for (let key in PropsMap) {
|
|
8165
|
+
if (!validProps.has(key)) {
|
|
8166
|
+
throw new Error(`Invalid CSS property: "${key}"`);
|
|
8167
|
+
}
|
|
8168
|
+
}
|
|
8169
|
+
}
|
|
8170
|
+
|
|
8171
|
+
const useRoot = (PropsMap, {namespace, register, ValidateCssProps} = {}) => new ZikoUseRoot(PropsMap, {namespace, register, ValidateCssProps});
|
|
8172
|
+
|
|
8173
|
+
// Usage
|
|
8174
|
+
|
|
8175
|
+
/*
|
|
8176
|
+
const Styles = {
|
|
8177
|
+
S1 : {
|
|
8178
|
+
background : 'white',
|
|
8179
|
+
color : 'darkblue'
|
|
8180
|
+
border : '2px darkblue solid"'
|
|
8181
|
+
},
|
|
8182
|
+
S2 : {
|
|
8183
|
+
background : 'darkblue',
|
|
8184
|
+
color : 'white'
|
|
8185
|
+
border : '2px green solid"'
|
|
8186
|
+
}
|
|
8187
|
+
}
|
|
8188
|
+
const {use, border, background, color} = useRoot(Style.S1)
|
|
8189
|
+
|
|
8190
|
+
tags.p("Test useRoot ").style({
|
|
8191
|
+
border,
|
|
8192
|
+
color,
|
|
8193
|
+
background,
|
|
8194
|
+
padding : '10px'
|
|
8195
|
+
})
|
|
8196
|
+
|
|
8197
|
+
*/
|
|
8198
|
+
|
|
8118
8199
|
// To do : remove old items
|
|
8119
8200
|
class ZikoUseStorage{
|
|
8120
8201
|
constructor(storage, globalKey, initialValue){
|
|
@@ -8184,49 +8265,6 @@ class ZikoUseStorage{
|
|
|
8184
8265
|
const useLocaleStorage=(key,initialValue)=>new ZikoUseStorage(localStorage,key,initialValue);
|
|
8185
8266
|
const useSessionStorage=(key,initialValue)=>new ZikoUseStorage(sessionStorage,key,initialValue);
|
|
8186
8267
|
|
|
8187
|
-
class ZikoUseThreed {
|
|
8188
|
-
#workerContent;
|
|
8189
|
-
constructor() {
|
|
8190
|
-
this.#workerContent = (
|
|
8191
|
-
function (msg) {
|
|
8192
|
-
try {
|
|
8193
|
-
const func = new Function("return " + msg.data.fun)();
|
|
8194
|
-
let result = func();
|
|
8195
|
-
postMessage({ result });
|
|
8196
|
-
} catch (error) {
|
|
8197
|
-
postMessage({ error: error.message });
|
|
8198
|
-
} finally {
|
|
8199
|
-
if (msg.data.close) self.close();
|
|
8200
|
-
}
|
|
8201
|
-
}
|
|
8202
|
-
).toString();
|
|
8203
|
-
this.blob = new Blob(["this.onmessage = " + this.#workerContent], { type: "text/javascript" });
|
|
8204
|
-
this.worker = new Worker(window.URL.createObjectURL(this.blob));
|
|
8205
|
-
}
|
|
8206
|
-
call(func, callback, close = true) {
|
|
8207
|
-
this.worker.postMessage({
|
|
8208
|
-
fun: func.toString(),
|
|
8209
|
-
close
|
|
8210
|
-
});
|
|
8211
|
-
this.worker.onmessage = function (e) {
|
|
8212
|
-
if (e.data.error) {
|
|
8213
|
-
console.error(e.data.error);
|
|
8214
|
-
} else {
|
|
8215
|
-
callback(e.data.result);
|
|
8216
|
-
}
|
|
8217
|
-
};
|
|
8218
|
-
return this;
|
|
8219
|
-
}
|
|
8220
|
-
}
|
|
8221
|
-
|
|
8222
|
-
const useThread = (func, callback , close) => {
|
|
8223
|
-
const T = new ZikoUseThreed();
|
|
8224
|
-
if (func) {
|
|
8225
|
-
T.call(func, callback , close);
|
|
8226
|
-
}
|
|
8227
|
-
return T;
|
|
8228
|
-
};
|
|
8229
|
-
|
|
8230
8268
|
[
|
|
8231
8269
|
App,
|
|
8232
8270
|
Math$1,
|
|
@@ -8293,4 +8331,4 @@ function RemoveAll(){
|
|
|
8293
8331
|
Data.RemoveAll();
|
|
8294
8332
|
}
|
|
8295
8333
|
|
|
8296
|
-
export { App$1 as App, Article, Aside, Base, Canvas, Combinaison, Complex, E, EPSILON, Ease, FileBasedRouting, Flex, Footer, Form, Grid$1 as Grid, HTMLWrapper, Header, Logic$1 as Logic, Main, Matrix, Nav, PI$1 as PI, Permutation, Random, SPA, SVGWrapper, Section, Str, Suspense, Svg, Table$1 as Table, Utils$1 as Utils, ZikoApp, ZikoCustomEvent, ZikoEventClick, ZikoEventClipboard, ZikoEventCustom, ZikoEventDrag, ZikoEventFocus, ZikoEventInput, ZikoEventKey, ZikoEventMouse, ZikoEventPointer, ZikoEventSwipe, ZikoEventTouch, ZikoEventWheel, ZikoHead$1 as ZikoHead, ZikoMutationObserver, ZikoSPA, ZikoUIAbbrText, ZikoUIArticle, ZikoUIAside, ZikoUIAudio, ZikoUIBlockQuote, ZikoUIBr, ZikoUICanvas, ZikoUICodeText, ZikoUIDefintion, ZikoUIElement, ZikoUIFigure, ZikoUIFlex, ZikoUIFooter, ZikoUIForm, ZikoUIGrid, ZikoUIHTMLWrapper, ZikoUIHeader, ZikoUIHeading, 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, ZikoUINav, ZikoUIParagraphe, ZikoUIQuote, ZikoUISVGWrapper, ZikoUISection, ZikoUISelect, ZikoUISubText, ZikoUISupText, ZikoUISuspense, ZikoUISvg, ZikoUIText, ZikoUITextArea, ZikoUIVideo, ZikoUIXMLWrapper, ZikoUseRoot, ZikoUseStyle, __CACHE__, __Config__, __HYDRATION_MAP__, __HYDRATION__, __UI__, __ZikoEvent__, abbrText, abs, accum, acos, acosh, acot, add, arange, arr2str, asin, asinh, atan, atan2, atanh, audio, bindClickEvent, bindClipboardEvent, bindCustomEvent, bindDragEvent, bindFocusEvent, bindHashEvent, bindKeyEvent, bindMouseEvent, bindPointerEvent, bindTouchEvent, bindWheelEvent, blockQuote, br, brs, btn, cartesianProduct, ceil, checkbox, clamp, codeText, combinaison, complex, cos, cosh, cot, coth, count, countWords, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, datalist, Ziko as default, defineParamsGetter, deg2rad, dfnText, div, e, fact, figure, floor, geomspace, getEvent, h, h1, h2, h3, h4, h5, h6, hTags, hr, hrs, html, hypot, image, inRange, input, inputCamera, inputColor, inputDate, inputDateTime, inputEmail, inputImage, inputNumber, inputPassword, inputTime, isApproximatlyEqual, json2arr, json2css, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, lerp, li, link, linspace, ln, logspace, map, mapfun$1 as mapfun, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, obj2str, ol, ones, p, pgcd, pow, powerSet, ppcm, preload, prod, quote, rad2deg, radio, removeExtraSpace, round, s, sTags, search, sec, select, sig, sign, sin, sinc, sinh, slider, sqrt, sqrtn, str, sub, subSet, subText, sum, supText, svg2ascii, svg2img, svg2imgUrl, svg2str, tags, tan, tanh, text, textarea, timeTaken, time_memory_Taken, ul, useAnimation, useChannel, useCustomEvent, useEventEmitter, useFavIcon$1 as useFavIcon, useFps, useHashEvent, useHead$1 as useHead, useInputEvent, useLocaleStorage, useMediaQuery, useMeta$1 as useMeta, useRoot,
|
|
8334
|
+
export { App$1 as App, Article, Aside, Base, Canvas, Combinaison, Complex, E, EPSILON, Ease, FileBasedRouting, Flex, Footer, Form, Grid$1 as Grid, HTMLWrapper, Header, Logic$1 as Logic, Main, Matrix, Nav, PI$1 as PI, Permutation, Random, SPA, SVGWrapper, Section, Str, Suspense, Svg, Table$1 as Table, Utils$1 as Utils, ZikoApp, ZikoCustomEvent, ZikoEventClick, ZikoEventClipboard, ZikoEventCustom, ZikoEventDrag, ZikoEventFocus, ZikoEventInput, ZikoEventKey, ZikoEventMouse, ZikoEventPointer, ZikoEventSwipe, ZikoEventTouch, ZikoEventWheel, ZikoHead$1 as ZikoHead, ZikoMutationObserver, ZikoSPA, ZikoUIAbbrText, ZikoUIArticle, ZikoUIAside, ZikoUIAudio, ZikoUIBlockQuote, ZikoUIBr, ZikoUICanvas, ZikoUICodeText, ZikoUIDefintion, ZikoUIElement, ZikoUIFigure, ZikoUIFlex, ZikoUIFooter, ZikoUIForm, ZikoUIGrid, ZikoUIHTMLWrapper, ZikoUIHeader, ZikoUIHeading, 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, ZikoUINav, ZikoUIParagraphe, ZikoUIQuote, ZikoUISVGWrapper, ZikoUISection, ZikoUISelect, ZikoUISubText, ZikoUISupText, ZikoUISuspense, ZikoUISvg, ZikoUIText, ZikoUITextArea, ZikoUIVideo, ZikoUIXMLWrapper, ZikoUseRoot, ZikoUseStyle, __CACHE__, __Config__, __HYDRATION_MAP__, __HYDRATION__, __UI__, __ZikoEvent__, abbrText, abs, accum, acos, acosh, acot, add, arange, arr2str, asin, asinh, atan, atan2, atanh, audio, bindClickEvent, bindClipboardEvent, bindCustomEvent, bindDragEvent, bindFocusEvent, bindHashEvent, bindKeyEvent, bindMouseEvent, bindPointerEvent, bindTouchEvent, bindWheelEvent, blockQuote, br, brs, btn, cartesianProduct, ceil, checkbox, clamp, codeText, combinaison, complex, cos, cosh, cot, coth, count, countWords, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, datalist, Ziko as default, defineParamsGetter, deg2rad, dfnText, div, e, fact, figure, floor, geomspace, getEvent, h, h1, h2, h3, h4, h5, h6, hTags, hr, hrs, html, hypot, image, inRange, input, inputCamera, inputColor, inputDate, inputDateTime, inputEmail, inputImage, inputNumber, inputPassword, inputTime, isApproximatlyEqual, json2arr, json2css, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, lerp, li, link, linspace, ln, logspace, map, mapfun$1 as mapfun, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, obj2str, ol, ones, p, pgcd, pow, powerSet, ppcm, preload, prod, quote, rad2deg, radio, removeExtraSpace, round, s, sTags, search, sec, select, sig, sign, sin, sinc, sinh, slider, sqrt, sqrtn, str, sub, subSet, subText, sum, supText, svg2ascii, svg2img, svg2imgUrl, svg2str, tags, tan, tanh, text, textarea, timeTaken, time_memory_Taken, ul, useAnimation, useChannel, useCustomEvent, useEventEmitter, useFavIcon$1 as useFavIcon, useFps, useHashEvent, useHead$1 as useHead, useInputEvent, useLocaleStorage, useMediaQuery, useMeta$1 as useMeta, useRoot, useSessionStorage, useStyle, useSuccesifKeys, useSwipeEvent, useThread, useTimeLoop, useTitle$1 as useTitle, video, wait, waitForUIElm, waitForUIElmSync, watch, watchAttr, watchChildren, watchIntersection, watchScreen, watchSize, zeros };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ziko",
|
|
3
|
-
"version": "0.36.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.36.2",
|
|
4
|
+
"description": "A versatile JavaScript library offering a rich set of Hyperscript Based UI components, advanced mathematical utilities, interactivity ,animations, client side routing and more ...",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"front-end",
|
|
7
7
|
"framework",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"LICENCE"
|
|
25
25
|
],
|
|
26
26
|
"exports": {
|
|
27
|
+
"./*" : "./src/*",
|
|
27
28
|
".": {
|
|
28
29
|
"import": "./dist/ziko.mjs",
|
|
29
30
|
"require": "./dist/ziko.cjs"
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
"./app": {},
|
|
56
57
|
"./time": {},
|
|
57
58
|
"./components": {}
|
|
59
|
+
|
|
58
60
|
},
|
|
59
61
|
"bin": {
|
|
60
62
|
"create-ziko-app": "starter/bin/index.js"
|
|
@@ -90,4 +92,4 @@
|
|
|
90
92
|
"rollup-plugin-livereload": "^2.0.5",
|
|
91
93
|
"rollup-plugin-serve": "^1.1.1"
|
|
92
94
|
}
|
|
93
|
-
}
|
|
95
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Zikojs
|
|
2
|
+
|
|
3
|
+
A versatile JavaScript library offering a rich set of Hyperscript Based UI components, advanced mathematical utilities, interactivity ,animations, client side routing and more ...
|
|
4
|
+
<div align="center">
|
|
5
|
+
|
|
6
|
+
[](https://github.com/zakarialaoui10/zikojs/blob/HEAD/LICENSE) [](https://www.npmjs.com/package/ziko) [](https://www.npmjs.com/package/ziko)
|
|
7
|
+
<!-- [](https://isitmaintained.com/project/zakarialaoui/ziko 'Average time to resolve an issue') -->
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<!--
|
|
12
|
+
## Philosophy
|
|
13
|
+
Methodes Chaining
|
|
14
|
+
Composition
|
|
15
|
+
-->
|
|
16
|
+
## Demos
|
|
17
|
+
- [ Windows entanglement using zikojs and ziko-gl ](https://www.linkedin.com/feed/update/urn:li:activity:7144023650394918913/)
|
|
18
|
+
|
|
19
|
+
## 🔥 Features
|
|
20
|
+
### 💎 Core
|
|
21
|
+
- 🚫 Zero Dependency
|
|
22
|
+
- 🌳 Partial Tree Shaking
|
|
23
|
+
- 🔢 Rich Math Functions and Utilities
|
|
24
|
+
<!-- - The Math Module supports a new Paradigm -->
|
|
25
|
+
- ✨ Hyperscript-Based Declarative UI (No Template Engines needed)
|
|
26
|
+
- 📱 Single Page Application With File Based Routing
|
|
27
|
+
- 🤝 One Way Interleaving With [Vanjs]()
|
|
28
|
+
- ⏰ Time loop and animations support
|
|
29
|
+
|
|
30
|
+
### 🚀 External :
|
|
31
|
+
- 🧩 Extra UI Components : [Zextra]()
|
|
32
|
+
- 🖥️ Server Side Rendering With File Based Routing and Client Side Hydration : [ziko-server]()
|
|
33
|
+
- 📝 Mdx-Like Markdown Preprocessor : [Mdz]()
|
|
34
|
+
- 🔌 Flexible Integration with Popular Frameworks/Libraries : [Ziko-wrapper]()
|
|
35
|
+
- 🔄 Bi-directional : `React`, `Preact`, `Solid`, `Svelte`, `Vue` , `Vanjs`
|
|
36
|
+
- ➡️ Uni-directional (ZikoJS → X) :
|
|
37
|
+
- `Astro` : (SSR + Client Hydration)
|
|
38
|
+
- 📦 Growing Add-On Ecosystem :
|
|
39
|
+
- Ziko-Gl : WebGL/3D Graphics, Built on Top of [Threejs]()
|
|
40
|
+
- Ziko-Chart
|
|
41
|
+
- Ziko-Code
|
|
42
|
+
- Ziko-Lottie
|
|
43
|
+
- ...
|
|
44
|
+
|
|
45
|
+
## Install :
|
|
46
|
+
```bash
|
|
47
|
+
npm i ziko
|
|
48
|
+
```
|
|
49
|
+
## Quick Start :
|
|
50
|
+
```bash
|
|
51
|
+
npx create-ziko-app [app-title]
|
|
52
|
+
```
|
|
53
|
+
## ⭐️ Show your support <a name="support"></a>
|
|
54
|
+
|
|
55
|
+
If you appreciate the library, kindly demonstrate your support by giving it a star!<br>
|
|
56
|
+
[](https://github.com/zakarialaoui10/ziko.js)
|
|
57
|
+
<!--## Financial support-->
|
package/src/use/index.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
|
|
1
|
+
export * from './use-debounce.js';
|
|
2
|
+
export * from './use-throttle.js';
|
|
3
|
+
|
|
4
|
+
export * from "./use-channel.js";
|
|
5
|
+
export * from "./use-event-emmiter.js";
|
|
6
|
+
export * from "./use-thread.js";
|
|
7
|
+
|
|
8
|
+
export * from './use-root.js';
|
|
9
|
+
// export * from './use-title.js'
|
|
10
|
+
export * from './use-favicon.js'
|
|
11
|
+
// export * from './use-link.js'
|
|
12
|
+
// export * from 'use-meta.js'
|
|
13
|
+
|
|
14
|
+
export * from './use-storage.js'
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
class ZikoUseRoot {
|
|
2
|
+
constructor(PropsMap, {namespace = 'Ziko', register, ValidateCssProps = false} = {}){
|
|
3
|
+
this.currentPropsMap = PropsMap;
|
|
4
|
+
this.namespace = namespace;
|
|
5
|
+
this.ValidateCssProps = ValidateCssProps;
|
|
6
|
+
// this.pairs = {};
|
|
7
|
+
// this.#maintain()
|
|
8
|
+
this.use(PropsMap)
|
|
9
|
+
}
|
|
10
|
+
use(PropsMap){
|
|
11
|
+
if(this.ValidateCssProps) ValidateCssProps(PropsMap)
|
|
12
|
+
this.currentPropsMap = PropsMap;
|
|
13
|
+
this.#maintain()
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
#maintain(){
|
|
17
|
+
const root = globalThis?.document?.documentElement?.style
|
|
18
|
+
for(let prop in this.currentPropsMap){
|
|
19
|
+
const cssProp = this.namespace ? `--${this.namespace}-${prop}` : `--${prop}`
|
|
20
|
+
root.setProperty(
|
|
21
|
+
cssProp,
|
|
22
|
+
this.currentPropsMap[prop]
|
|
23
|
+
);
|
|
24
|
+
console.log({cssProp})
|
|
25
|
+
// Object.assign(this.pairs, {
|
|
26
|
+
// [prop] : `var(--${this.namespace}-${prop})`
|
|
27
|
+
// })
|
|
28
|
+
Object.defineProperty(this, prop, {
|
|
29
|
+
value: `var(${cssProp})`,
|
|
30
|
+
writable: true,
|
|
31
|
+
configurable: true,
|
|
32
|
+
enumerable: false
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function ValidateCssProps(PropsMap){
|
|
39
|
+
const validProps = new Set(Object.keys(document.documentElement.style));
|
|
40
|
+
for (let key in PropsMap) {
|
|
41
|
+
if (!validProps.has(key)) {
|
|
42
|
+
throw new Error(`Invalid CSS property: "${key}"`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const useRoot = (PropsMap, {namespace, register, ValidateCssProps} = {}) => new ZikoUseRoot(PropsMap, {namespace, register, ValidateCssProps});
|
|
48
|
+
|
|
49
|
+
export{
|
|
50
|
+
ZikoUseRoot,
|
|
51
|
+
useRoot
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Usage
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
const Styles = {
|
|
58
|
+
S1 : {
|
|
59
|
+
background : 'white',
|
|
60
|
+
color : 'darkblue'
|
|
61
|
+
border : '2px darkblue solid"'
|
|
62
|
+
},
|
|
63
|
+
S2 : {
|
|
64
|
+
background : 'darkblue',
|
|
65
|
+
color : 'white'
|
|
66
|
+
border : '2px green solid"'
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const {use, border, background, color} = useRoot(Style.S1)
|
|
70
|
+
|
|
71
|
+
tags.p("Test useRoot ").style({
|
|
72
|
+
border,
|
|
73
|
+
color,
|
|
74
|
+
background,
|
|
75
|
+
padding : '10px'
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
*/
|
package/src/use/app/index.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|