ziko 0.34.2 → 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.
Files changed (34) hide show
  1. package/dist/ziko.cjs +162 -162
  2. package/dist/ziko.js +194 -248
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +194 -248
  5. package/package.json +6 -4
  6. package/src/index.js +2 -2
  7. package/src/reactivity/hooks/UI/index.js +2 -2
  8. package/src/reactivity/hooks/index.js +1 -1
  9. package/src/ui/{elements/ZikoUIElement.js → constructors/ziko-ui-element.js} +12 -7
  10. package/src/ui/constructors/ziko-ui-node.js +15 -0
  11. package/src/ui/elements/flex/index.js +1 -1
  12. package/src/ui/elements/grid/index.js +1 -1
  13. package/src/ui/elements/io/Inputs/__helpers__.js +1 -1
  14. package/src/ui/elements/io/Inputs/input/index.js +1 -1
  15. package/src/ui/elements/io/Inputs/input-file/input-image.js +1 -1
  16. package/src/ui/elements/io/Select/index.js +1 -1
  17. package/src/ui/elements/io/Textarea/index.js +1 -1
  18. package/src/ui/elements/list/index.js +1 -1
  19. package/src/ui/elements/media/Image/figure.js +1 -1
  20. package/src/ui/elements/media/Image/image.js +1 -1
  21. package/src/ui/elements/media/__ZikoUIDynamicMediaELement__.js +1 -1
  22. package/src/ui/elements/misc/hyperscript.js +1 -1
  23. package/src/ui/elements/misc/index.js +1 -1
  24. package/src/ui/elements/misc/suspense.js +1 -1
  25. package/src/ui/elements/misc/xml-wrapper.js +1 -1
  26. package/src/ui/elements/semantic/index.js +1 -1
  27. package/src/ui/elements/table/elements.js +1 -1
  28. package/src/ui/elements/table/table.js +1 -1
  29. package/src/ui/elements/text/__ZikoUIText__.js +1 -1
  30. package/src/ui/elements/text/heading.js +1 -1
  31. package/src/ui/index.js +1 -1
  32. package/src/ui/tags/index.js +1 -1
  33. package/src/ui/utils/index.js +1 -1
  34. package/src/watch/dom-observer/ziko-observer.js +15 -0
package/dist/ziko.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Mon Aug 04 2025 13:51:44 GMT+0100 (UTC+01:00)
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
- let ZikoUseStyle$1 = class ZikoUseStyle {
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.__ele__;
3434
+ return this.cache.element;
3490
3435
  }
3491
3436
  isInteractive(){
3492
- return [true, false][Math.floor(2*Math.random())];
3437
+ return this.cache.isInteractive;
3493
3438
  }
3494
- get isZikoUIElement(){
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$1 ? this.st.style(styles.current): this.st.style(styles);
3497
+ styles instanceof ZikoUseStyle ? this.st.style(styles.current): this.st.style(styles);
3552
3498
  return this;
3553
3499
  }
3554
3500
  size(width,height){
@@ -7664,167 +7610,6 @@ const Graphics = {
7664
7610
  ...CANVAS
7665
7611
  };
7666
7612
 
7667
- class ZikoUseChannel{
7668
- constructor(name = ""){
7669
- this.channel = new BroadcastChannel(name);
7670
- this.EVENTS_DATAS_PAIRS = new Map();
7671
- this.EVENTS_HANDLERS_PAIRS = new Map();
7672
- this.LAST_RECEIVED_EVENT = "";
7673
- this.UUID="ziko-channel"+Random.string(10);
7674
- this.SUBSCRIBERS = new Set([this.UUID]);
7675
- }
7676
- get broadcast(){
7677
- // update receiver
7678
- return this;
7679
- }
7680
- emit(event, data){
7681
- this.EVENTS_DATAS_PAIRS.set(event,data);
7682
- this.#maintainEmit(event);
7683
- return this;
7684
- }
7685
- on(event,handler=console.log){
7686
- this.EVENTS_HANDLERS_PAIRS.set(event,handler);
7687
- this.#maintainOn();
7688
- return this;
7689
- }
7690
- #maintainOn(){
7691
- this.channel.onmessage = (e) => {
7692
- this.LAST_RECEIVED_EVENT=e.data.last_sended_event;
7693
- const USER_ID=e.data.userId;
7694
- this.SUBSCRIBERS.add(USER_ID);
7695
- const Data=e.data.EVENTS_DATAS_PAIRS.get(this.LAST_RECEIVED_EVENT);
7696
- const Handler=this.EVENTS_HANDLERS_PAIRS.get(this.LAST_RECEIVED_EVENT);
7697
- if(Data && Handler)Handler(Data);
7698
- };
7699
- return this;
7700
- }
7701
- #maintainEmit(event){
7702
- this.channel.postMessage({
7703
- EVENTS_DATAS_PAIRS:this.EVENTS_DATAS_PAIRS,
7704
- last_sended_event:event,
7705
- userId:this.UUID
7706
- });
7707
- return this;
7708
- }
7709
- close(){
7710
- this.channel.close();
7711
- return this;
7712
- }
7713
- }
7714
- const useChannel = name => new ZikoUseChannel(name);
7715
-
7716
- // To do : remove old items
7717
- class ZikoUseStorage{
7718
- constructor(storage, globalKey, initialValue){
7719
- this.cache={
7720
- storage,
7721
- globalKey,
7722
- channel:useChannel(`Ziko:useStorage-${globalKey}`),
7723
- oldItemKeys:new Set()
7724
- };
7725
- this.#init(initialValue);
7726
- this.#maintain();
7727
- }
7728
- get items(){
7729
- return JSON.parse(this.cache.storage[this.cache.globalKey]??null);
7730
- }
7731
- #maintain() {
7732
- for(let i in this.items)Object.assign(this, { [[i]]: this.items[i] });
7733
- }
7734
- #init(initialValue){
7735
- this.cache.channel=useChannel(`Ziko:useStorage-${this.cache.globalKey}`);
7736
- this.cache.channel.on("Ziko-Storage-Updated",()=>this.#maintain());
7737
- if(!initialValue)return;
7738
- if(this.cache.storage[this.cache.globalKey]){
7739
- Object.keys(this.items).forEach(key=>this.cache.oldItemKeys.add(key));
7740
- console.group("Ziko:useStorage");
7741
- console.warn(`Storage key '${this.cache.globalKey}' already exists. we will not overwrite it.`);
7742
- console.info(`%cWe'll keep the existing data.`,"background-color:#2222dd; color:gold;");
7743
- console.group("");
7744
- }
7745
- else this.set(initialValue);
7746
- }
7747
- set(data){
7748
- this.cache.storage.setItem(this.cache.globalKey,JSON.stringify(data));
7749
- this.cache.channel.emit("Ziko-Storage-Updated",{});
7750
- Object.keys(data).forEach(key=>this.cache.oldItemKeys.add(key));
7751
- this.#maintain();
7752
- return this
7753
- }
7754
- add(data){
7755
- const db={
7756
- ...this.items,
7757
- ...data
7758
- };
7759
- this.cache.storage.setItem(this.cache.globalKey,JSON.stringify(db));
7760
- this.#maintain();
7761
- return this;
7762
- }
7763
- remove(...keys){
7764
- const db={...this.items};
7765
- for(let i=0;i<keys.length;i++){
7766
- delete db[keys[i]];
7767
- delete this[keys[i]];
7768
- }
7769
- this.set(db);
7770
- return this;
7771
- }
7772
- get(key){
7773
- return this.items[key];
7774
- }
7775
- clear(){
7776
- this.cache.storage.removeItem(this.cache.globalKey);
7777
- this.#maintain();
7778
- return this;
7779
- }
7780
-
7781
- }
7782
- const useLocaleStorage=(key,initialValue)=>new ZikoUseStorage(localStorage,key,initialValue);
7783
- const useSessionStorage=(key,initialValue)=>new ZikoUseStorage(sessionStorage,key,initialValue);
7784
-
7785
- class ZikoUseThreed {
7786
- #workerContent;
7787
- constructor() {
7788
- this.#workerContent = (
7789
- function (msg) {
7790
- try {
7791
- const func = new Function("return " + msg.data.fun)();
7792
- let result = func();
7793
- postMessage({ result });
7794
- } catch (error) {
7795
- postMessage({ error: error.message });
7796
- } finally {
7797
- if (msg.data.close) self.close();
7798
- }
7799
- }
7800
- ).toString();
7801
- this.blob = new Blob(["this.onmessage = " + this.#workerContent], { type: "text/javascript" });
7802
- this.worker = new Worker(window.URL.createObjectURL(this.blob));
7803
- }
7804
- call(func, callback, close = true) {
7805
- this.worker.postMessage({
7806
- fun: func.toString(),
7807
- close
7808
- });
7809
- this.worker.onmessage = function (e) {
7810
- if (e.data.error) {
7811
- console.error(e.data.error);
7812
- } else {
7813
- callback(e.data.result);
7814
- }
7815
- };
7816
- return this;
7817
- }
7818
- }
7819
-
7820
- const useThread = (func, callback , close) => {
7821
- const T = new ZikoUseThreed();
7822
- if (func) {
7823
- T.call(func, callback , close);
7824
- }
7825
- return T;
7826
- };
7827
-
7828
7613
  class ZikoUseFavIcon{
7829
7614
  constructor(FavIcon,useEventEmitter=true){
7830
7615
  this.#init();
@@ -8265,6 +8050,167 @@ const App={
8265
8050
  // ...Params
8266
8051
  };
8267
8052
 
8053
+ class ZikoUseChannel{
8054
+ constructor(name = ""){
8055
+ this.channel = new BroadcastChannel(name);
8056
+ this.EVENTS_DATAS_PAIRS = new Map();
8057
+ this.EVENTS_HANDLERS_PAIRS = new Map();
8058
+ this.LAST_RECEIVED_EVENT = "";
8059
+ this.UUID="ziko-channel"+Random.string(10);
8060
+ this.SUBSCRIBERS = new Set([this.UUID]);
8061
+ }
8062
+ get broadcast(){
8063
+ // update receiver
8064
+ return this;
8065
+ }
8066
+ emit(event, data){
8067
+ this.EVENTS_DATAS_PAIRS.set(event,data);
8068
+ this.#maintainEmit(event);
8069
+ return this;
8070
+ }
8071
+ on(event,handler=console.log){
8072
+ this.EVENTS_HANDLERS_PAIRS.set(event,handler);
8073
+ this.#maintainOn();
8074
+ return this;
8075
+ }
8076
+ #maintainOn(){
8077
+ this.channel.onmessage = (e) => {
8078
+ this.LAST_RECEIVED_EVENT=e.data.last_sended_event;
8079
+ const USER_ID=e.data.userId;
8080
+ this.SUBSCRIBERS.add(USER_ID);
8081
+ const Data=e.data.EVENTS_DATAS_PAIRS.get(this.LAST_RECEIVED_EVENT);
8082
+ const Handler=this.EVENTS_HANDLERS_PAIRS.get(this.LAST_RECEIVED_EVENT);
8083
+ if(Data && Handler)Handler(Data);
8084
+ };
8085
+ return this;
8086
+ }
8087
+ #maintainEmit(event){
8088
+ this.channel.postMessage({
8089
+ EVENTS_DATAS_PAIRS:this.EVENTS_DATAS_PAIRS,
8090
+ last_sended_event:event,
8091
+ userId:this.UUID
8092
+ });
8093
+ return this;
8094
+ }
8095
+ close(){
8096
+ this.channel.close();
8097
+ return this;
8098
+ }
8099
+ }
8100
+ const useChannel = name => new ZikoUseChannel(name);
8101
+
8102
+ // To do : remove old items
8103
+ class ZikoUseStorage{
8104
+ constructor(storage, globalKey, initialValue){
8105
+ this.cache={
8106
+ storage,
8107
+ globalKey,
8108
+ channel:useChannel(`Ziko:useStorage-${globalKey}`),
8109
+ oldItemKeys:new Set()
8110
+ };
8111
+ this.#init(initialValue);
8112
+ this.#maintain();
8113
+ }
8114
+ get items(){
8115
+ return JSON.parse(this.cache.storage[this.cache.globalKey]??null);
8116
+ }
8117
+ #maintain() {
8118
+ for(let i in this.items)Object.assign(this, { [[i]]: this.items[i] });
8119
+ }
8120
+ #init(initialValue){
8121
+ this.cache.channel=useChannel(`Ziko:useStorage-${this.cache.globalKey}`);
8122
+ this.cache.channel.on("Ziko-Storage-Updated",()=>this.#maintain());
8123
+ if(!initialValue)return;
8124
+ if(this.cache.storage[this.cache.globalKey]){
8125
+ Object.keys(this.items).forEach(key=>this.cache.oldItemKeys.add(key));
8126
+ console.group("Ziko:useStorage");
8127
+ console.warn(`Storage key '${this.cache.globalKey}' already exists. we will not overwrite it.`);
8128
+ console.info(`%cWe'll keep the existing data.`,"background-color:#2222dd; color:gold;");
8129
+ console.group("");
8130
+ }
8131
+ else this.set(initialValue);
8132
+ }
8133
+ set(data){
8134
+ this.cache.storage.setItem(this.cache.globalKey,JSON.stringify(data));
8135
+ this.cache.channel.emit("Ziko-Storage-Updated",{});
8136
+ Object.keys(data).forEach(key=>this.cache.oldItemKeys.add(key));
8137
+ this.#maintain();
8138
+ return this
8139
+ }
8140
+ add(data){
8141
+ const db={
8142
+ ...this.items,
8143
+ ...data
8144
+ };
8145
+ this.cache.storage.setItem(this.cache.globalKey,JSON.stringify(db));
8146
+ this.#maintain();
8147
+ return this;
8148
+ }
8149
+ remove(...keys){
8150
+ const db={...this.items};
8151
+ for(let i=0;i<keys.length;i++){
8152
+ delete db[keys[i]];
8153
+ delete this[keys[i]];
8154
+ }
8155
+ this.set(db);
8156
+ return this;
8157
+ }
8158
+ get(key){
8159
+ return this.items[key];
8160
+ }
8161
+ clear(){
8162
+ this.cache.storage.removeItem(this.cache.globalKey);
8163
+ this.#maintain();
8164
+ return this;
8165
+ }
8166
+
8167
+ }
8168
+ const useLocaleStorage=(key,initialValue)=>new ZikoUseStorage(localStorage,key,initialValue);
8169
+ const useSessionStorage=(key,initialValue)=>new ZikoUseStorage(sessionStorage,key,initialValue);
8170
+
8171
+ class ZikoUseThreed {
8172
+ #workerContent;
8173
+ constructor() {
8174
+ this.#workerContent = (
8175
+ function (msg) {
8176
+ try {
8177
+ const func = new Function("return " + msg.data.fun)();
8178
+ let result = func();
8179
+ postMessage({ result });
8180
+ } catch (error) {
8181
+ postMessage({ error: error.message });
8182
+ } finally {
8183
+ if (msg.data.close) self.close();
8184
+ }
8185
+ }
8186
+ ).toString();
8187
+ this.blob = new Blob(["this.onmessage = " + this.#workerContent], { type: "text/javascript" });
8188
+ this.worker = new Worker(window.URL.createObjectURL(this.blob));
8189
+ }
8190
+ call(func, callback, close = true) {
8191
+ this.worker.postMessage({
8192
+ fun: func.toString(),
8193
+ close
8194
+ });
8195
+ this.worker.onmessage = function (e) {
8196
+ if (e.data.error) {
8197
+ console.error(e.data.error);
8198
+ } else {
8199
+ callback(e.data.result);
8200
+ }
8201
+ };
8202
+ return this;
8203
+ }
8204
+ }
8205
+
8206
+ const useThread = (func, callback , close) => {
8207
+ const T = new ZikoUseThreed();
8208
+ if (func) {
8209
+ T.call(func, callback , close);
8210
+ }
8211
+ return T;
8212
+ };
8213
+
8268
8214
  [
8269
8215
  App,
8270
8216
  Math$1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ziko",
3
- "version": "0.34.2",
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,14 +28,17 @@
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
  },
34
37
  "./events": {
35
38
  "import": "./src/events/index.js"
36
39
  },
37
- "./observer": {
38
- "import": "./src/observer/index.js"
40
+ "./watch": {
41
+ "import": "./src/watch/index.js"
39
42
  },
40
43
  "./use": {
41
44
  "import": "./src/use/index.js"
@@ -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": {},
package/src/index.js CHANGED
@@ -6,8 +6,8 @@ import Data from "./data/index.js";
6
6
  import Reactivity from "./reactivity/index.js";
7
7
  import Graphics from "./graphics/index.js";
8
8
 
9
- import * as Events from "./events/index.js"
10
- import * as Use from "./use/index.js"
9
+ // import * as Events from "./events/index.js"
10
+ // import * as Use from "./use/index.js"
11
11
 
12
12
  import App,{__UI__,__HYDRATION_MAP__, __Config__, __CACHE__, defineParamsGetter, __HYDRATION__} from "./app";
13
13
 
@@ -1,6 +1,6 @@
1
- export * from "./useStyle";
1
+ export * from "./useStyle.js";
2
2
  // export * from "./useTheme";
3
3
  // export * from "../Head/useTitle";
4
4
  // export * from "../Head/useFavIcon";
5
- export * from "./useMediaQuery"
5
+ export * from "./useMediaQuery.js"
6
6
  export * from "./useRoot.js"
@@ -4,5 +4,5 @@ export * from "./head"
4
4
  // export * from "./interactions"
5
5
  // export * from "./sensors"
6
6
  // export * from "./storage"
7
- export * from "./ui"
7
+ export * from "./UI"
8
8
  // export * from "./window"
@@ -1,3 +1,4 @@
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";
@@ -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.__ele__;
103
+ return this.cache.element;
100
104
  }
101
105
  isInteractive(){
102
- return [true, false][Math.floor(2*Math.random())];
106
+ return this.cache.isInteractive;
103
107
  }
104
- get isZikoUIElement(){
108
+ // Remove get
109
+ isZikoUIElement(){
105
110
  return true;
106
111
  }
107
112
  register(){
@@ -0,0 +1,15 @@
1
+ export default class ZikoUINode {
2
+ constructor(node){
3
+ this.cache = {
4
+ node
5
+ }
6
+ }
7
+ isZikoUINode(){
8
+ return true
9
+ }
10
+ get node(){
11
+ return this.cache.node;
12
+ }
13
+ }
14
+
15
+ globalThis.node = (node) => new ZikoUINode(node);
@@ -1,4 +1,4 @@
1
- import ZikoUIElement from "../ZikoUIElement.js";
1
+ import ZikoUIElement from "../../constructors/ziko-ui-element.js";
2
2
  class ZikoUIFlex extends ZikoUIElement {
3
3
  constructor(tag = "div", w = "100%", h = "100%") {
4
4
  super(tag ,"Flex");
@@ -1,4 +1,4 @@
1
- import ZikoUIElement from "../ZikoUIElement.js"
1
+ import ZikoUIElement from "../../constructors/ziko-ui-element.js"
2
2
  class ZikoUIGrid extends ZikoUIElement {
3
3
  constructor(tag ="div", w = "50vw", h = "50vh") {
4
4
  super(tag,"Grid");