ziko 0.35.0 → 0.35.1
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 +33 -87
- package/dist/ziko.mjs +33 -87
- package/package.json +4 -2
- package/src/reactivity/hooks/index.js +1 -1
- package/src/ui/constructors/ziko-ui-element.js +13 -8
- 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.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date : Thu Aug 07 2025
|
|
5
|
+
Date : Thu Aug 07 2025 11:37: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
|
|
@@ -1202,6 +1202,22 @@
|
|
|
1202
1202
|
}
|
|
1203
1203
|
};
|
|
1204
1204
|
|
|
1205
|
+
class ZikoUINode {
|
|
1206
|
+
constructor(node){
|
|
1207
|
+
this.cache = {
|
|
1208
|
+
node
|
|
1209
|
+
};
|
|
1210
|
+
}
|
|
1211
|
+
isZikoUINode(){
|
|
1212
|
+
return true
|
|
1213
|
+
}
|
|
1214
|
+
get node(){
|
|
1215
|
+
return this.cache.node;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
globalThis.node = (node) => new ZikoUINode(node);
|
|
1220
|
+
|
|
1205
1221
|
const DomMethods = {
|
|
1206
1222
|
append(...ele) {
|
|
1207
1223
|
__addItem__.call(this, "append", "push", ...ele);
|
|
@@ -1728,7 +1744,7 @@
|
|
|
1728
1744
|
});
|
|
1729
1745
|
});
|
|
1730
1746
|
|
|
1731
|
-
|
|
1747
|
+
class ZikoUseStyle {
|
|
1732
1748
|
constructor(style = {}, use = style.hasOwnProperty("default")? "default" : Object.keys(style)[0], id = 0) {
|
|
1733
1749
|
this.id = "Ziko-Style-" + id;
|
|
1734
1750
|
this.keys = new Set();
|
|
@@ -1800,7 +1816,9 @@
|
|
|
1800
1816
|
if (style && typeof style === "object") return this.#useStyleObject(style);
|
|
1801
1817
|
return this;
|
|
1802
1818
|
}
|
|
1803
|
-
}
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
const useStyle = (styles, use, id) => new ZikoUseStyle(styles, use, id);
|
|
1804
1822
|
|
|
1805
1823
|
const addSuffixeToNumber=(value,suffixe="px")=>{
|
|
1806
1824
|
if(typeof value === "number") value+=suffixe;
|
|
@@ -3236,82 +3254,6 @@
|
|
|
3236
3254
|
|
|
3237
3255
|
const useHead$1=({ title, lang, icon, meta, noscript })=>new ZikoHead$1({ title, lang, icon, meta, noscript });
|
|
3238
3256
|
|
|
3239
|
-
class ZikoUseStyle {
|
|
3240
|
-
constructor(style = {}, use = style.hasOwnProperty("default")? "default" : Object.keys(style)[0], id = 0) {
|
|
3241
|
-
this.id = "Ziko-Style-" + id;
|
|
3242
|
-
this.keys = new Set();
|
|
3243
|
-
this.styles = {
|
|
3244
|
-
default: {
|
|
3245
|
-
fontSize: "1em",
|
|
3246
|
-
color : "green"
|
|
3247
|
-
},
|
|
3248
|
-
other: {
|
|
3249
|
-
fontSize : "2em",
|
|
3250
|
-
color : "cyan"
|
|
3251
|
-
}
|
|
3252
|
-
};
|
|
3253
|
-
style && this.add(style);
|
|
3254
|
-
use && this.use(use);
|
|
3255
|
-
}
|
|
3256
|
-
|
|
3257
|
-
get current() {
|
|
3258
|
-
return [...this.keys].reduce((key, value) => {
|
|
3259
|
-
key[value] = `var(--${value}-${this.id})`;
|
|
3260
|
-
return key;
|
|
3261
|
-
}, {});
|
|
3262
|
-
}
|
|
3263
|
-
|
|
3264
|
-
add(name, style = {}) {
|
|
3265
|
-
if (name && typeof name === 'object' && !Array.isArray(name)) {
|
|
3266
|
-
Object.assign(this.styles, name);
|
|
3267
|
-
} else if (typeof name === 'string') {
|
|
3268
|
-
Object.assign(this.styles, { [name]: style });
|
|
3269
|
-
}
|
|
3270
|
-
return this;
|
|
3271
|
-
}
|
|
3272
|
-
|
|
3273
|
-
#useStyleIndex(index) {
|
|
3274
|
-
const keys = Object.keys(this.styles);
|
|
3275
|
-
for (let a in this.styles[keys[index]]) {
|
|
3276
|
-
if (Object.prototype.hasOwnProperty.call(this.styles[keys[index]], a)) {
|
|
3277
|
-
document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[keys[index]][a]);
|
|
3278
|
-
this.keys.add(a);
|
|
3279
|
-
}
|
|
3280
|
-
}
|
|
3281
|
-
return this;
|
|
3282
|
-
}
|
|
3283
|
-
|
|
3284
|
-
#useStyleName(name) {
|
|
3285
|
-
if (!this.styles[name]) return this;
|
|
3286
|
-
for (let a in this.styles[name]) {
|
|
3287
|
-
if (Object.prototype.hasOwnProperty.call(this.styles[name], a)) {
|
|
3288
|
-
document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[name][a]);
|
|
3289
|
-
this.keys.add(a);
|
|
3290
|
-
}
|
|
3291
|
-
}
|
|
3292
|
-
return this;
|
|
3293
|
-
}
|
|
3294
|
-
|
|
3295
|
-
#useStyleObject(style) {
|
|
3296
|
-
for (let a in style) {
|
|
3297
|
-
if (Object.prototype.hasOwnProperty.call(style, a)) {
|
|
3298
|
-
document.documentElement.style.setProperty(`--${a}-${this.id}`, style[a]);
|
|
3299
|
-
this.keys.add(a);
|
|
3300
|
-
}
|
|
3301
|
-
}
|
|
3302
|
-
return this;
|
|
3303
|
-
}
|
|
3304
|
-
|
|
3305
|
-
use(style) {
|
|
3306
|
-
if (typeof style === "number") return this.#useStyleIndex(style);
|
|
3307
|
-
if (typeof style === "string") return this.#useStyleName(style);
|
|
3308
|
-
if (style && typeof style === "object") return this.#useStyleObject(style);
|
|
3309
|
-
return this;
|
|
3310
|
-
}
|
|
3311
|
-
}
|
|
3312
|
-
|
|
3313
|
-
const useStyle = (styles, use, id) => new ZikoUseStyle(styles, use, id);
|
|
3314
|
-
|
|
3315
3257
|
/*
|
|
3316
3258
|
[
|
|
3317
3259
|
{
|
|
@@ -3410,8 +3352,9 @@
|
|
|
3410
3352
|
...Hooks,
|
|
3411
3353
|
};
|
|
3412
3354
|
|
|
3413
|
-
class ZikoUIElement {
|
|
3355
|
+
class ZikoUIElement extends ZikoUINode{
|
|
3414
3356
|
constructor(element, name="", {el_type="html", useDefaultStyle=false}={}){
|
|
3357
|
+
super();
|
|
3415
3358
|
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
|
|
3416
3359
|
if(typeof element === "string") {
|
|
3417
3360
|
switch(el_type){
|
|
@@ -3423,7 +3366,7 @@
|
|
|
3423
3366
|
else {
|
|
3424
3367
|
this.target = element.parentElement;
|
|
3425
3368
|
}
|
|
3426
|
-
if(element)this.__ele__ = element;
|
|
3369
|
+
// if(element)this.__ele__ = element;
|
|
3427
3370
|
compose(
|
|
3428
3371
|
this,
|
|
3429
3372
|
DomMethods,
|
|
@@ -3435,8 +3378,9 @@
|
|
|
3435
3378
|
// compose(this, ExternalMethods);
|
|
3436
3379
|
// });
|
|
3437
3380
|
// }
|
|
3438
|
-
this.cache
|
|
3381
|
+
Object.assign(this.cache, {
|
|
3439
3382
|
name,
|
|
3383
|
+
isInteractive : [true, false][Math.floor(2*Math.random())],
|
|
3440
3384
|
parent:null,
|
|
3441
3385
|
isBody:false,
|
|
3442
3386
|
isRoot:false,
|
|
@@ -3447,7 +3391,7 @@
|
|
|
3447
3391
|
attributes: {},
|
|
3448
3392
|
filters: {},
|
|
3449
3393
|
temp:{}
|
|
3450
|
-
};
|
|
3394
|
+
});
|
|
3451
3395
|
this.events = {
|
|
3452
3396
|
ptr:null,
|
|
3453
3397
|
mouse:null,
|
|
@@ -3465,6 +3409,7 @@
|
|
|
3465
3409
|
resize:null,
|
|
3466
3410
|
intersection:null
|
|
3467
3411
|
};
|
|
3412
|
+
if(element)Object.assign(this.cache,{element});
|
|
3468
3413
|
this.uuid = `${this.cache.name}-${Random.string(16)}`;
|
|
3469
3414
|
this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
|
|
3470
3415
|
this.cache.style.linkTo(this);
|
|
@@ -3492,12 +3437,13 @@
|
|
|
3492
3437
|
}
|
|
3493
3438
|
}
|
|
3494
3439
|
get element(){
|
|
3495
|
-
return this.
|
|
3440
|
+
return this.cache.element;
|
|
3496
3441
|
}
|
|
3497
3442
|
isInteractive(){
|
|
3498
|
-
return
|
|
3443
|
+
return this.cache.isInteractive;
|
|
3499
3444
|
}
|
|
3500
|
-
get
|
|
3445
|
+
// Remove get
|
|
3446
|
+
isZikoUIElement(){
|
|
3501
3447
|
return true;
|
|
3502
3448
|
}
|
|
3503
3449
|
register(){
|
|
@@ -3554,7 +3500,7 @@
|
|
|
3554
3500
|
return UI.render(render);
|
|
3555
3501
|
}
|
|
3556
3502
|
style(styles){
|
|
3557
|
-
styles instanceof ZikoUseStyle
|
|
3503
|
+
styles instanceof ZikoUseStyle ? this.st.style(styles.current): this.st.style(styles);
|
|
3558
3504
|
return this;
|
|
3559
3505
|
}
|
|
3560
3506
|
size(width,height){
|
package/dist/ziko.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date : Thu Aug 07 2025
|
|
5
|
+
Date : Thu Aug 07 2025 11:37: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,7 +3494,7 @@ 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){
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ziko",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.1",
|
|
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": {},
|
|
@@ -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(){
|
|
@@ -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
|