ziko 0.35.0 → 0.36.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.cjs +57 -95
- package/dist/ziko.js +57 -95
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +57 -95
- package/package.json +4 -2
- package/src/math/matrix/Matrix.js +13 -4
- package/src/reactivity/hooks/index.js +1 -1
- package/src/ui/constructors/ziko-ui-element.js +24 -12
- package/src/ui/constructors/ziko-ui-node.js +14 -4
- /package/src/reactivity/hooks/{ui → UI}/index.js +0 -0
- /package/src/reactivity/hooks/{ui → UI}/useCssLink.js +0 -0
- /package/src/reactivity/hooks/{ui → UI}/useLinearGradient.js +0 -0
- /package/src/reactivity/hooks/{ui → UI}/useMediaQuery.js +0 -0
- /package/src/reactivity/hooks/{ui → UI}/useRadialGradient.js +0 -0
- /package/src/reactivity/hooks/{ui → UI}/useRoot.js +0 -0
- /package/src/reactivity/hooks/{ui → UI}/useStyle.js +0 -0
- /package/src/reactivity/hooks/{ui → UI}/useTheme.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 : Tue Aug 12 2025 11:00:20 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
|
|
@@ -1196,6 +1196,22 @@ const json2xmlFile=(json,indent)=>{
|
|
|
1196
1196
|
}
|
|
1197
1197
|
};
|
|
1198
1198
|
|
|
1199
|
+
class ZikoUINode {
|
|
1200
|
+
constructor(node){
|
|
1201
|
+
this.cache = {
|
|
1202
|
+
node
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
isZikoUINode(){
|
|
1206
|
+
return true
|
|
1207
|
+
}
|
|
1208
|
+
get node(){
|
|
1209
|
+
return this.cache.node;
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
globalThis.node = (node) => new ZikoUINode(node);
|
|
1214
|
+
|
|
1199
1215
|
const DomMethods = {
|
|
1200
1216
|
append(...ele) {
|
|
1201
1217
|
__addItem__.call(this, "append", "push", ...ele);
|
|
@@ -1722,7 +1738,7 @@ Object.entries(Events$1).forEach(([name, eventList]) => {
|
|
|
1722
1738
|
});
|
|
1723
1739
|
});
|
|
1724
1740
|
|
|
1725
|
-
|
|
1741
|
+
class ZikoUseStyle {
|
|
1726
1742
|
constructor(style = {}, use = style.hasOwnProperty("default")? "default" : Object.keys(style)[0], id = 0) {
|
|
1727
1743
|
this.id = "Ziko-Style-" + id;
|
|
1728
1744
|
this.keys = new Set();
|
|
@@ -1794,7 +1810,9 @@ let ZikoUseStyle$1 = class ZikoUseStyle {
|
|
|
1794
1810
|
if (style && typeof style === "object") return this.#useStyleObject(style);
|
|
1795
1811
|
return this;
|
|
1796
1812
|
}
|
|
1797
|
-
}
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
const useStyle = (styles, use, id) => new ZikoUseStyle(styles, use, id);
|
|
1798
1816
|
|
|
1799
1817
|
const addSuffixeToNumber=(value,suffixe="px")=>{
|
|
1800
1818
|
if(typeof value === "number") value+=suffixe;
|
|
@@ -3230,82 +3248,6 @@ let ZikoHead$1 = class ZikoHead{
|
|
|
3230
3248
|
|
|
3231
3249
|
const useHead$1=({ title, lang, icon, meta, noscript })=>new ZikoHead$1({ title, lang, icon, meta, noscript });
|
|
3232
3250
|
|
|
3233
|
-
class ZikoUseStyle {
|
|
3234
|
-
constructor(style = {}, use = style.hasOwnProperty("default")? "default" : Object.keys(style)[0], id = 0) {
|
|
3235
|
-
this.id = "Ziko-Style-" + id;
|
|
3236
|
-
this.keys = new Set();
|
|
3237
|
-
this.styles = {
|
|
3238
|
-
default: {
|
|
3239
|
-
fontSize: "1em",
|
|
3240
|
-
color : "green"
|
|
3241
|
-
},
|
|
3242
|
-
other: {
|
|
3243
|
-
fontSize : "2em",
|
|
3244
|
-
color : "cyan"
|
|
3245
|
-
}
|
|
3246
|
-
};
|
|
3247
|
-
style && this.add(style);
|
|
3248
|
-
use && this.use(use);
|
|
3249
|
-
}
|
|
3250
|
-
|
|
3251
|
-
get current() {
|
|
3252
|
-
return [...this.keys].reduce((key, value) => {
|
|
3253
|
-
key[value] = `var(--${value}-${this.id})`;
|
|
3254
|
-
return key;
|
|
3255
|
-
}, {});
|
|
3256
|
-
}
|
|
3257
|
-
|
|
3258
|
-
add(name, style = {}) {
|
|
3259
|
-
if (name && typeof name === 'object' && !Array.isArray(name)) {
|
|
3260
|
-
Object.assign(this.styles, name);
|
|
3261
|
-
} else if (typeof name === 'string') {
|
|
3262
|
-
Object.assign(this.styles, { [name]: style });
|
|
3263
|
-
}
|
|
3264
|
-
return this;
|
|
3265
|
-
}
|
|
3266
|
-
|
|
3267
|
-
#useStyleIndex(index) {
|
|
3268
|
-
const keys = Object.keys(this.styles);
|
|
3269
|
-
for (let a in this.styles[keys[index]]) {
|
|
3270
|
-
if (Object.prototype.hasOwnProperty.call(this.styles[keys[index]], a)) {
|
|
3271
|
-
document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[keys[index]][a]);
|
|
3272
|
-
this.keys.add(a);
|
|
3273
|
-
}
|
|
3274
|
-
}
|
|
3275
|
-
return this;
|
|
3276
|
-
}
|
|
3277
|
-
|
|
3278
|
-
#useStyleName(name) {
|
|
3279
|
-
if (!this.styles[name]) return this;
|
|
3280
|
-
for (let a in this.styles[name]) {
|
|
3281
|
-
if (Object.prototype.hasOwnProperty.call(this.styles[name], a)) {
|
|
3282
|
-
document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[name][a]);
|
|
3283
|
-
this.keys.add(a);
|
|
3284
|
-
}
|
|
3285
|
-
}
|
|
3286
|
-
return this;
|
|
3287
|
-
}
|
|
3288
|
-
|
|
3289
|
-
#useStyleObject(style) {
|
|
3290
|
-
for (let a in style) {
|
|
3291
|
-
if (Object.prototype.hasOwnProperty.call(style, a)) {
|
|
3292
|
-
document.documentElement.style.setProperty(`--${a}-${this.id}`, style[a]);
|
|
3293
|
-
this.keys.add(a);
|
|
3294
|
-
}
|
|
3295
|
-
}
|
|
3296
|
-
return this;
|
|
3297
|
-
}
|
|
3298
|
-
|
|
3299
|
-
use(style) {
|
|
3300
|
-
if (typeof style === "number") return this.#useStyleIndex(style);
|
|
3301
|
-
if (typeof style === "string") return this.#useStyleName(style);
|
|
3302
|
-
if (style && typeof style === "object") return this.#useStyleObject(style);
|
|
3303
|
-
return this;
|
|
3304
|
-
}
|
|
3305
|
-
}
|
|
3306
|
-
|
|
3307
|
-
const useStyle = (styles, use, id) => new ZikoUseStyle(styles, use, id);
|
|
3308
|
-
|
|
3309
3251
|
/*
|
|
3310
3252
|
[
|
|
3311
3253
|
{
|
|
@@ -3404,8 +3346,9 @@ const Reactivity={
|
|
|
3404
3346
|
...Hooks,
|
|
3405
3347
|
};
|
|
3406
3348
|
|
|
3407
|
-
class ZikoUIElement {
|
|
3349
|
+
class ZikoUIElement extends ZikoUINode{
|
|
3408
3350
|
constructor(element, name="", {el_type="html", useDefaultStyle=false}={}){
|
|
3351
|
+
super();
|
|
3409
3352
|
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
|
|
3410
3353
|
if(typeof element === "string") {
|
|
3411
3354
|
switch(el_type){
|
|
@@ -3417,7 +3360,7 @@ class ZikoUIElement {
|
|
|
3417
3360
|
else {
|
|
3418
3361
|
this.target = element.parentElement;
|
|
3419
3362
|
}
|
|
3420
|
-
if(element)this.__ele__ = element;
|
|
3363
|
+
// if(element)this.__ele__ = element;
|
|
3421
3364
|
compose(
|
|
3422
3365
|
this,
|
|
3423
3366
|
DomMethods,
|
|
@@ -3429,8 +3372,9 @@ class ZikoUIElement {
|
|
|
3429
3372
|
// compose(this, ExternalMethods);
|
|
3430
3373
|
// });
|
|
3431
3374
|
// }
|
|
3432
|
-
this.cache
|
|
3375
|
+
Object.assign(this.cache, {
|
|
3433
3376
|
name,
|
|
3377
|
+
isInteractive : [true, false][Math.floor(2*Math.random())],
|
|
3434
3378
|
parent:null,
|
|
3435
3379
|
isBody:false,
|
|
3436
3380
|
isRoot:false,
|
|
@@ -3441,7 +3385,7 @@ class ZikoUIElement {
|
|
|
3441
3385
|
attributes: {},
|
|
3442
3386
|
filters: {},
|
|
3443
3387
|
temp:{}
|
|
3444
|
-
};
|
|
3388
|
+
});
|
|
3445
3389
|
this.events = {
|
|
3446
3390
|
ptr:null,
|
|
3447
3391
|
mouse:null,
|
|
@@ -3459,6 +3403,7 @@ class ZikoUIElement {
|
|
|
3459
3403
|
resize:null,
|
|
3460
3404
|
intersection:null
|
|
3461
3405
|
};
|
|
3406
|
+
if(element)Object.assign(this.cache,{element});
|
|
3462
3407
|
this.uuid = `${this.cache.name}-${Random.string(16)}`;
|
|
3463
3408
|
this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
|
|
3464
3409
|
this.cache.style.linkTo(this);
|
|
@@ -3486,12 +3431,13 @@ class ZikoUIElement {
|
|
|
3486
3431
|
}
|
|
3487
3432
|
}
|
|
3488
3433
|
get element(){
|
|
3489
|
-
return this.
|
|
3434
|
+
return this.cache.element;
|
|
3490
3435
|
}
|
|
3491
3436
|
isInteractive(){
|
|
3492
|
-
return
|
|
3437
|
+
return this.cache.isInteractive;
|
|
3493
3438
|
}
|
|
3494
|
-
get
|
|
3439
|
+
// Remove get
|
|
3440
|
+
isZikoUIElement(){
|
|
3495
3441
|
return true;
|
|
3496
3442
|
}
|
|
3497
3443
|
register(){
|
|
@@ -3548,18 +3494,25 @@ class ZikoUIElement {
|
|
|
3548
3494
|
return UI.render(render);
|
|
3549
3495
|
}
|
|
3550
3496
|
style(styles){
|
|
3551
|
-
styles instanceof ZikoUseStyle
|
|
3497
|
+
styles instanceof ZikoUseStyle ? this.st.style(styles.current): this.st.style(styles);
|
|
3552
3498
|
return this;
|
|
3553
3499
|
}
|
|
3554
3500
|
size(width,height){
|
|
3555
3501
|
this.st.size(width,height);
|
|
3556
3502
|
return this;
|
|
3557
3503
|
}
|
|
3504
|
+
[Symbol.iterator]() {
|
|
3505
|
+
return this.items[Symbol.iterator]();
|
|
3506
|
+
}
|
|
3558
3507
|
maintain() {
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3508
|
+
for (let i = 0; i < this.items.length; i++) {
|
|
3509
|
+
Object.defineProperty(this, i, {
|
|
3510
|
+
value: this.items[i],
|
|
3511
|
+
writable: true,
|
|
3512
|
+
configurable: true,
|
|
3513
|
+
enumerable: false
|
|
3514
|
+
});
|
|
3515
|
+
}
|
|
3563
3516
|
}
|
|
3564
3517
|
filter(condition_callback, if_callback = () => {}, else_callback = () => {}) {
|
|
3565
3518
|
const FilterItems = this.items.filter(condition_callback);
|
|
@@ -6031,7 +5984,7 @@ class Matrix extends ZikoMath{
|
|
|
6031
5984
|
this.cols = cols;
|
|
6032
5985
|
this.arr = arr;
|
|
6033
5986
|
}
|
|
6034
|
-
this
|
|
5987
|
+
this.#maintain();
|
|
6035
5988
|
//Object.seal(this);
|
|
6036
5989
|
}
|
|
6037
5990
|
toString(){
|
|
@@ -6068,9 +6021,18 @@ class Matrix extends ZikoMath{
|
|
|
6068
6021
|
get imag() {
|
|
6069
6022
|
return new Matrix(this.cols, this.rows, this.arr.flat(1).imag);
|
|
6070
6023
|
}
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6024
|
+
[Symbol.iterator]() {
|
|
6025
|
+
return this.arr[Symbol.iterator]();
|
|
6026
|
+
}
|
|
6027
|
+
#maintain() {
|
|
6028
|
+
for (let i = 0; i < this.arr.length; i++) {
|
|
6029
|
+
Object.defineProperty(this, i, {
|
|
6030
|
+
value: this.arr[i],
|
|
6031
|
+
writable: true,
|
|
6032
|
+
configurable: true,
|
|
6033
|
+
enumerable: false
|
|
6034
|
+
});
|
|
6035
|
+
}
|
|
6074
6036
|
}
|
|
6075
6037
|
get(row = 0, col = 0) {
|
|
6076
6038
|
if (col == -1) return this.arr[row];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ziko",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
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",
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
"import": "./dist/ziko.mjs",
|
|
29
29
|
"require": "./dist/ziko.cjs"
|
|
30
30
|
},
|
|
31
|
+
"./math": {
|
|
32
|
+
"import" : "./src/math/index.js"
|
|
33
|
+
},
|
|
31
34
|
"./helpers": {
|
|
32
35
|
"import" : "./src/__helpers__.js"
|
|
33
36
|
},
|
|
@@ -48,7 +51,6 @@
|
|
|
48
51
|
"import": "./src/tags/index.js"
|
|
49
52
|
},
|
|
50
53
|
"./src": "./src/index.js",
|
|
51
|
-
"./math": {},
|
|
52
54
|
"./html": {},
|
|
53
55
|
"./app": {},
|
|
54
56
|
"./time": {},
|
|
@@ -38,7 +38,7 @@ class Matrix extends ZikoMath{
|
|
|
38
38
|
this.cols = cols;
|
|
39
39
|
this.arr = arr;
|
|
40
40
|
}
|
|
41
|
-
this
|
|
41
|
+
this.#maintain();
|
|
42
42
|
//Object.seal(this);
|
|
43
43
|
}
|
|
44
44
|
toString(){
|
|
@@ -75,9 +75,18 @@ class Matrix extends ZikoMath{
|
|
|
75
75
|
get imag() {
|
|
76
76
|
return new Matrix(this.cols, this.rows, this.arr.flat(1).imag);
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
[Symbol.iterator]() {
|
|
79
|
+
return this.arr[Symbol.iterator]();
|
|
80
|
+
}
|
|
81
|
+
#maintain() {
|
|
82
|
+
for (let i = 0; i < this.arr.length; i++) {
|
|
83
|
+
Object.defineProperty(this, i, {
|
|
84
|
+
value: this.arr[i],
|
|
85
|
+
writable: true,
|
|
86
|
+
configurable: true,
|
|
87
|
+
enumerable: false
|
|
88
|
+
});
|
|
89
|
+
}
|
|
81
90
|
}
|
|
82
91
|
get(row = 0, col = 0) {
|
|
83
92
|
if (col == -1) return this.arr[row];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import ZikoUINode from "./ziko-ui-node.js";
|
|
1
2
|
import { compose } from "../../__helpers__/index.js";
|
|
2
3
|
import { DomMethods } from "../methods/dom.js";
|
|
3
4
|
import { IndexingMethods } from "../methods/indexing.js";
|
|
4
5
|
import { EventsMethodes } from "../methods/events.js";
|
|
5
|
-
import { ZikoUseStyle } from "../../reactivity/hooks/
|
|
6
|
+
import { ZikoUseStyle } from "../../reactivity/hooks/UI/useStyle.js";
|
|
6
7
|
import { ZikoUIElementStyle } from "../style/index.js";
|
|
7
8
|
import {
|
|
8
9
|
useCustomEvent,
|
|
@@ -14,8 +15,9 @@ import {
|
|
|
14
15
|
} from "../../reactivity/index.js"
|
|
15
16
|
import { Random } from "../../math/index.js";
|
|
16
17
|
import { Str } from "../../data/index.js";
|
|
17
|
-
class ZikoUIElement {
|
|
18
|
+
class ZikoUIElement extends ZikoUINode{
|
|
18
19
|
constructor(element, name="", {el_type="html", useDefaultStyle=false}={}){
|
|
20
|
+
super()
|
|
19
21
|
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
|
|
20
22
|
if(typeof element === "string") {
|
|
21
23
|
switch(el_type){
|
|
@@ -27,7 +29,7 @@ class ZikoUIElement {
|
|
|
27
29
|
else{
|
|
28
30
|
this.target = element.parentElement;
|
|
29
31
|
}
|
|
30
|
-
if(element)this.__ele__ = element;
|
|
32
|
+
// if(element)this.__ele__ = element;
|
|
31
33
|
compose(
|
|
32
34
|
this,
|
|
33
35
|
DomMethods,
|
|
@@ -39,8 +41,9 @@ class ZikoUIElement {
|
|
|
39
41
|
// compose(this, ExternalMethods);
|
|
40
42
|
// });
|
|
41
43
|
// }
|
|
42
|
-
this.cache
|
|
44
|
+
Object.assign(this.cache, {
|
|
43
45
|
name,
|
|
46
|
+
isInteractive : [true, false][Math.floor(2*Math.random())],
|
|
44
47
|
parent:null,
|
|
45
48
|
isBody:false,
|
|
46
49
|
isRoot:false,
|
|
@@ -51,7 +54,7 @@ class ZikoUIElement {
|
|
|
51
54
|
attributes: {},
|
|
52
55
|
filters: {},
|
|
53
56
|
temp:{}
|
|
54
|
-
}
|
|
57
|
+
})
|
|
55
58
|
this.events = {
|
|
56
59
|
ptr:null,
|
|
57
60
|
mouse:null,
|
|
@@ -69,6 +72,7 @@ class ZikoUIElement {
|
|
|
69
72
|
resize:null,
|
|
70
73
|
intersection:null
|
|
71
74
|
}
|
|
75
|
+
if(element)Object.assign(this.cache,{element});
|
|
72
76
|
this.uuid = `${this.cache.name}-${Random.string(16)}`
|
|
73
77
|
this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
|
|
74
78
|
this.cache.style.linkTo(this);
|
|
@@ -96,12 +100,13 @@ class ZikoUIElement {
|
|
|
96
100
|
}
|
|
97
101
|
}
|
|
98
102
|
get element(){
|
|
99
|
-
return this.
|
|
103
|
+
return this.cache.element;
|
|
100
104
|
}
|
|
101
105
|
isInteractive(){
|
|
102
|
-
return
|
|
106
|
+
return this.cache.isInteractive;
|
|
103
107
|
}
|
|
104
|
-
get
|
|
108
|
+
// Remove get
|
|
109
|
+
isZikoUIElement(){
|
|
105
110
|
return true;
|
|
106
111
|
}
|
|
107
112
|
register(){
|
|
@@ -165,11 +170,18 @@ class ZikoUIElement {
|
|
|
165
170
|
this.st.size(width,height);
|
|
166
171
|
return this;
|
|
167
172
|
}
|
|
173
|
+
[Symbol.iterator]() {
|
|
174
|
+
return this.items[Symbol.iterator]();
|
|
175
|
+
}
|
|
168
176
|
maintain() {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
177
|
+
for (let i = 0; i < this.items.length; i++) {
|
|
178
|
+
Object.defineProperty(this, i, {
|
|
179
|
+
value: this.items[i],
|
|
180
|
+
writable: true,
|
|
181
|
+
configurable: true,
|
|
182
|
+
enumerable: false
|
|
183
|
+
});
|
|
184
|
+
}
|
|
173
185
|
}
|
|
174
186
|
filter(condition_callback, if_callback = () => {}, else_callback = () => {}) {
|
|
175
187
|
const FilterItems = this.items.filter(condition_callback);
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
class ZikoUINode {
|
|
2
|
-
constructor(){
|
|
3
|
-
|
|
1
|
+
export default class ZikoUINode {
|
|
2
|
+
constructor(node){
|
|
3
|
+
this.cache = {
|
|
4
|
+
node
|
|
5
|
+
}
|
|
4
6
|
}
|
|
5
|
-
|
|
7
|
+
isZikoUINode(){
|
|
8
|
+
return true
|
|
9
|
+
}
|
|
10
|
+
get node(){
|
|
11
|
+
return this.cache.node;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
globalThis.node = (node) => new ZikoUINode(node);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|