ziko 0.43.0 → 0.44.0
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.js +3 -3
- package/dist/ziko.mjs +3 -3
- package/package.json +1 -1
- package/src/__helpers__/checkers/index.js +1 -0
- package/src/__helpers__/index.js +3 -2
- package/src/ui/utils/getters.js +0 -0
- package/src/ui/utils/index.js +84 -0
- package/src/__helpers__/composition-dep/compose-class.js +0 -46
- package/src/__helpers__/composition-dep/compose-instance.js +0 -15
- package/src/__helpers__/composition-dep/compose.js +0 -11
- package/src/__helpers__/composition-dep/index.js +0 -3
- package/src/ui/__utils__/index.js +0 -70
package/dist/ziko.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date :
|
|
5
|
+
Date : Thu Aug 28 2025 17:39:15 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
|
|
@@ -1078,7 +1078,7 @@
|
|
|
1078
1078
|
}
|
|
1079
1079
|
}
|
|
1080
1080
|
|
|
1081
|
-
globalThis.node = (node) => new UINode(node);
|
|
1081
|
+
// globalThis.node = (node) => new UINode(node);
|
|
1082
1082
|
|
|
1083
1083
|
function register_to_class(target, ...mixins){
|
|
1084
1084
|
mixins.forEach(n => _register_to_class_(target, n));
|
|
@@ -1222,7 +1222,7 @@
|
|
|
1222
1222
|
index : undefined?.data?.__Ziko__?.__State__?.index ?? 0,
|
|
1223
1223
|
register: function(state){
|
|
1224
1224
|
console.log({
|
|
1225
|
-
hmr :
|
|
1225
|
+
// hmr : import.meta.hot?.data.__Ziko__.__State__.index,
|
|
1226
1226
|
index : this.index
|
|
1227
1227
|
});
|
|
1228
1228
|
this.store.set(this.index++, state);
|
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 28 2025 17:39:15 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
|
|
@@ -1072,7 +1072,7 @@ class UINode {
|
|
|
1072
1072
|
}
|
|
1073
1073
|
}
|
|
1074
1074
|
|
|
1075
|
-
globalThis.node = (node) => new UINode(node);
|
|
1075
|
+
// globalThis.node = (node) => new UINode(node);
|
|
1076
1076
|
|
|
1077
1077
|
function register_to_class(target, ...mixins){
|
|
1078
1078
|
mixins.forEach(n => _register_to_class_(target, n));
|
|
@@ -1216,7 +1216,7 @@ const __State__ = {
|
|
|
1216
1216
|
index : import.meta.hot?.data?.__Ziko__?.__State__?.index ?? 0,
|
|
1217
1217
|
register: function(state){
|
|
1218
1218
|
console.log({
|
|
1219
|
-
hmr : import.meta.hot?.data.__Ziko__.__State__.index,
|
|
1219
|
+
// hmr : import.meta.hot?.data.__Ziko__.__State__.index,
|
|
1220
1220
|
index : this.index
|
|
1221
1221
|
});
|
|
1222
1222
|
this.store.set(this.index++, state);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ziko",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0",
|
|
4
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",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const is_primitive = value => typeof value !== 'object' && typeof value !== 'function' || value === null;
|
package/src/__helpers__/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './register/index.js'
|
|
2
|
+
export * from './checkers/index.js'
|
|
3
|
+
|
|
2
4
|
const __ExtractAll__ =(obj)=> {
|
|
3
5
|
const keys = Object.keys(obj);
|
|
4
6
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -61,4 +63,3 @@ export{
|
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
|
|
64
|
-
export * from "./composition/index.js"
|
|
File without changes
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export function add_vendor_prefix(property) {
|
|
2
|
+
const propertyUC = property.slice(0, 1).toUpperCase() + property.slice(1);
|
|
3
|
+
const vendors = ['Webkit', 'Moz', 'O', 'ms'];
|
|
4
|
+
for(let i = 0, len = vendors.length; i < len; i++) {
|
|
5
|
+
const vendor = vendors[i];
|
|
6
|
+
if(typeof (globalThis?.document?.body).style[vendor + propertyUC] !== 'undefined') return vendor + propertyUC;
|
|
7
|
+
}
|
|
8
|
+
return property;
|
|
9
|
+
}
|
|
10
|
+
export const normalize_css_value = value => typeof value === 'number' ? value+'px' : value;
|
|
11
|
+
export const add_class = (UIElement, name) => UIElement.element.className = UIElement.element.className.replace(/\s+$/gi, '') + ' ' + name;
|
|
12
|
+
export const remove_class =(UIElement, name) => UIElement.element.className = UIElement.element.className.replace(name, '');
|
|
13
|
+
|
|
14
|
+
// const addSuffixeToNumber=(value,suffixe="px")=>{
|
|
15
|
+
// if(typeof value === "number") value+=suffixe;
|
|
16
|
+
// if(value instanceof Array)value=value.map(n=>typeof n==="number"?n+=suffixe:n).join(" ");
|
|
17
|
+
// return value;
|
|
18
|
+
// }
|
|
19
|
+
|
|
20
|
+
// const Id = (a) => document.getElementById(a);
|
|
21
|
+
// const Class = (a) => [...document.getElementsByClassName(a)];
|
|
22
|
+
// const $=(...selector)=>{
|
|
23
|
+
// var ele=[]
|
|
24
|
+
// for(let i=0;i<selector.length;i++){
|
|
25
|
+
// if(typeof selector[i]=="string")ele.push(...document.querySelectorAll(selector[i]));
|
|
26
|
+
// if(selector[i] instanceof UIElement)ele.push(selector[i].element)
|
|
27
|
+
// }
|
|
28
|
+
// return ele.length===1?ele[0]:ele;
|
|
29
|
+
// }
|
|
30
|
+
|
|
31
|
+
const style = (el, styles) => {if(el)Object.assign(el.style, styles)};
|
|
32
|
+
|
|
33
|
+
function script(src) {
|
|
34
|
+
const Script = document?.createElement("script");
|
|
35
|
+
Script.setAttribute("src", src);
|
|
36
|
+
document.head.appendChild(Script);
|
|
37
|
+
}
|
|
38
|
+
function linkStyle(href) {
|
|
39
|
+
const link = document?.createElement("link");
|
|
40
|
+
link.setAttribute("rel", "stylesheet");
|
|
41
|
+
link.setAttribute("href", href);
|
|
42
|
+
document.head.appendChild(link);
|
|
43
|
+
}
|
|
44
|
+
const CloneElement = (UIElement) => {
|
|
45
|
+
var clone = new UIElement.__proto__.constructor()
|
|
46
|
+
//waitForUIElm(UIElement).then(e=>console.log(e)).then(()=>clone = new UIElement.__proto__.constructor())
|
|
47
|
+
//let a = new UIElement.__proto__.constructor()
|
|
48
|
+
return clone;
|
|
49
|
+
};
|
|
50
|
+
const cloneUI=UIElement=>{
|
|
51
|
+
return Object.assign(Object.create(Object.getPrototypeOf(UIElement)),UIElement)
|
|
52
|
+
}
|
|
53
|
+
function isPrimitive(value) {
|
|
54
|
+
return typeof value !== 'object' && typeof value !== 'function' || value === null;
|
|
55
|
+
}
|
|
56
|
+
const waitElm=(UIElement)=>{
|
|
57
|
+
return new Promise(resolve => {
|
|
58
|
+
if (UIElement) {
|
|
59
|
+
return resolve(UIElement);
|
|
60
|
+
}
|
|
61
|
+
const observer = new MutationObserver(() => {
|
|
62
|
+
if (UIElement) {
|
|
63
|
+
resolve(UIElement);
|
|
64
|
+
observer.disconnect();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
observer.observe(document?.body, {
|
|
68
|
+
childList: true,
|
|
69
|
+
subtree: true
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export{
|
|
74
|
+
// Id,
|
|
75
|
+
// Class,
|
|
76
|
+
style,
|
|
77
|
+
script,
|
|
78
|
+
linkStyle,
|
|
79
|
+
CloneElement,
|
|
80
|
+
cloneUI,
|
|
81
|
+
isPrimitive,
|
|
82
|
+
// addSuffixeToNumber,
|
|
83
|
+
waitElm
|
|
84
|
+
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export function composeClass(Class, mixin) {
|
|
2
|
-
const descriptors = Object.getOwnPropertyDescriptors(mixin);
|
|
3
|
-
|
|
4
|
-
class Composed extends Class {
|
|
5
|
-
constructor(...args) {
|
|
6
|
-
super(...args);
|
|
7
|
-
// ⚠️ Do NOT assign mixin functions to `this`
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// Copy prototype properties (methods, getters/setters, non-functions)
|
|
12
|
-
for (const key of Reflect.ownKeys(descriptors)) {
|
|
13
|
-
const desc = descriptors[key];
|
|
14
|
-
|
|
15
|
-
if ('get' in desc || 'set' in desc || typeof desc.value !== 'function') {
|
|
16
|
-
Object.defineProperty(Composed.prototype, key, desc);
|
|
17
|
-
} else if (typeof desc.value === 'function') {
|
|
18
|
-
// Only add method if it does NOT already exist
|
|
19
|
-
if (!Composed.prototype.hasOwnProperty(key)) {
|
|
20
|
-
Object.defineProperty(Composed.prototype, key, desc);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return Composed;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// // Usage
|
|
29
|
-
// class UIBase {
|
|
30
|
-
// log() { console.log('UIBase log'); }
|
|
31
|
-
// }
|
|
32
|
-
|
|
33
|
-
// const mixin = {
|
|
34
|
-
// at() { return 0; },
|
|
35
|
-
// hello() { return 'hello'; }
|
|
36
|
-
// };
|
|
37
|
-
|
|
38
|
-
// const UIComposed = composeClass(UIBase, mixin);
|
|
39
|
-
|
|
40
|
-
// class UI2 extends UIComposed {
|
|
41
|
-
// at() { return 1; } // ✅ correctly overrides mixin
|
|
42
|
-
// }
|
|
43
|
-
|
|
44
|
-
// const ui = new UI2();
|
|
45
|
-
// console.log(ui.at()); // 1
|
|
46
|
-
// console.log(ui.hello()); // 'hello'
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export function composeInstance(instance, mixin) {
|
|
2
|
-
const descriptors = Object.getOwnPropertyDescriptors(mixin);
|
|
3
|
-
|
|
4
|
-
for (const key of Reflect.ownKeys(descriptors)) {
|
|
5
|
-
const desc = descriptors[key];
|
|
6
|
-
|
|
7
|
-
if ('get' in desc || 'set' in desc) {
|
|
8
|
-
Object.defineProperty(instance, key, desc);
|
|
9
|
-
} else if (typeof desc.value === 'function') {
|
|
10
|
-
instance[key] = desc.value.bind(instance);
|
|
11
|
-
} else {
|
|
12
|
-
instance[key] = desc.value;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { composeClass } from "./compose-class.js";
|
|
2
|
-
import { composeInstance } from "./compose-instance.js";
|
|
3
|
-
export function compose(target, ...mixin) {
|
|
4
|
-
if (typeof target === 'function') {
|
|
5
|
-
return mixin.forEach(item =>composeClass(target, item));
|
|
6
|
-
} else if (typeof target === 'object') {
|
|
7
|
-
mixin.forEach(item =>composeInstance(target, item));
|
|
8
|
-
} else {
|
|
9
|
-
throw new TypeError("compose: target must be a class or instance");
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { UIElement } from "../constructors/UIElement.js";
|
|
2
|
-
const Id = (a) => document.getElementById(a);
|
|
3
|
-
const Class = (a) => [...document.getElementsByClassName(a)];
|
|
4
|
-
const $=(...selector)=>{
|
|
5
|
-
var ele=[]
|
|
6
|
-
for(let i=0;i<selector.length;i++){
|
|
7
|
-
if(typeof selector[i]=="string")ele.push(...document.querySelectorAll(selector[i]));
|
|
8
|
-
if(selector[i] instanceof UIElement)ele.push(selector[i].element)
|
|
9
|
-
}
|
|
10
|
-
return ele.length===1?ele[0]:ele;
|
|
11
|
-
}
|
|
12
|
-
const addSuffixeToNumber=(value,suffixe="px")=>{
|
|
13
|
-
if(typeof value === "number") value+=suffixe;
|
|
14
|
-
if(value instanceof Array)value=value.map(n=>typeof n==="number"?n+=suffixe:n).join(" ");
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
const style = (el, styles) => {if(el)Object.assign(el.style, styles)};
|
|
18
|
-
|
|
19
|
-
function script(src) {
|
|
20
|
-
const Script = document?.createElement("script");
|
|
21
|
-
Script.setAttribute("src", src);
|
|
22
|
-
document.head.appendChild(Script);
|
|
23
|
-
}
|
|
24
|
-
function linkStyle(href) {
|
|
25
|
-
const link = document?.createElement("link");
|
|
26
|
-
link.setAttribute("rel", "stylesheet");
|
|
27
|
-
link.setAttribute("href", href);
|
|
28
|
-
document.head.appendChild(link);
|
|
29
|
-
}
|
|
30
|
-
const CloneElement = (UIElement) => {
|
|
31
|
-
var clone = new UIElement.__proto__.constructor()
|
|
32
|
-
//waitForUIElm(UIElement).then(e=>console.log(e)).then(()=>clone = new UIElement.__proto__.constructor())
|
|
33
|
-
//let a = new UIElement.__proto__.constructor()
|
|
34
|
-
return clone;
|
|
35
|
-
};
|
|
36
|
-
const cloneUI=UIElement=>{
|
|
37
|
-
return Object.assign(Object.create(Object.getPrototypeOf(UIElement)),UIElement)
|
|
38
|
-
}
|
|
39
|
-
function isPrimitive(value) {
|
|
40
|
-
return typeof value !== 'object' && typeof value !== 'function' || value === null;
|
|
41
|
-
}
|
|
42
|
-
const waitElm=(UIElement)=>{
|
|
43
|
-
return new Promise(resolve => {
|
|
44
|
-
if (UIElement) {
|
|
45
|
-
return resolve(UIElement);
|
|
46
|
-
}
|
|
47
|
-
const observer = new MutationObserver(() => {
|
|
48
|
-
if (UIElement) {
|
|
49
|
-
resolve(UIElement);
|
|
50
|
-
observer.disconnect();
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
observer.observe(document?.body, {
|
|
54
|
-
childList: true,
|
|
55
|
-
subtree: true
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
export{
|
|
60
|
-
Id,
|
|
61
|
-
Class,
|
|
62
|
-
style,
|
|
63
|
-
script,
|
|
64
|
-
linkStyle,
|
|
65
|
-
CloneElement,
|
|
66
|
-
cloneUI,
|
|
67
|
-
isPrimitive,
|
|
68
|
-
addSuffixeToNumber,
|
|
69
|
-
waitElm
|
|
70
|
-
}
|