ziko 0.42.0 → 0.43.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 +56 -49
- package/dist/ziko.mjs +56 -49
- package/package.json +1 -1
- package/src/__ziko__/__cache__.js +3 -0
- package/src/__ziko__/__hydration__.js +4 -5
- package/src/__ziko__/__state__.js +1 -1
- package/src/__ziko__/__ui__.js +27 -21
- package/src/__ziko__/index.js +2 -2
- package/src/ui/__utils__/index.js +1 -1
- package/src/ui/constructors/UIElement.js +26 -28
- package/src/ui/constructors/UINode.js +2 -2
- package/src/ui/flex/index.js +1 -1
- package/src/ui/graphics/canvas.js +1 -1
- package/src/ui/graphics/svg.js +1 -1
- package/src/ui/grid/index.js +1 -1
- package/src/ui/index.js +2 -2
- package/src/ui/suspense/index.js +1 -1
- package/src/ui/tags/index.d.ts.txt +1 -1
- package/src/ui/tags/index.js +2 -2
- package/src/ui/text/index.js +1 -1
- package/src/ui/wrapper/index.js +1 -1
package/dist/ziko.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date : Sun Aug 24 2025 12:
|
|
5
|
+
Date : Sun Aug 24 2025 12:52:45 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
|
|
@@ -1150,28 +1150,34 @@
|
|
|
1150
1150
|
});
|
|
1151
1151
|
}
|
|
1152
1152
|
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
.filter(Array.isArray)
|
|
1157
|
-
.flat();
|
|
1158
|
-
},
|
|
1159
|
-
querySelectorAll(){
|
|
1160
|
-
return this.__all__().filter(n=>n)
|
|
1161
|
-
},
|
|
1162
|
-
getElementByIndex(index){
|
|
1163
|
-
return this.__all__().find(n=>n.ui_index===index);
|
|
1164
|
-
},
|
|
1165
|
-
getElementById(id){
|
|
1166
|
-
return null;
|
|
1167
|
-
},
|
|
1168
|
-
getElementsByClass(){
|
|
1169
|
-
|
|
1170
|
-
},
|
|
1171
|
-
getElementsByTagName(){
|
|
1172
|
-
|
|
1153
|
+
class UIStore extends Array {
|
|
1154
|
+
constructor(...args) {
|
|
1155
|
+
super(...args);
|
|
1173
1156
|
}
|
|
1174
|
-
|
|
1157
|
+
getItemById(id) {
|
|
1158
|
+
return this.find(n => n.element.id === id);
|
|
1159
|
+
}
|
|
1160
|
+
getItemsByTagName(tag) {
|
|
1161
|
+
return this.filter(n => n.element.tagName.toLowerCase() === tag.toLowerCase());
|
|
1162
|
+
}
|
|
1163
|
+
getElementsByClassName(className) {
|
|
1164
|
+
return this.filter(n => n.element.classList?.contains(className));
|
|
1165
|
+
}
|
|
1166
|
+
querySelector(selector) {
|
|
1167
|
+
const el = globalThis?.document?.querySelector(selector);
|
|
1168
|
+
if (!el) return null;
|
|
1169
|
+
return this.find(ui => ui.element === el) || null;
|
|
1170
|
+
}
|
|
1171
|
+
querySelectorAll(selector) {
|
|
1172
|
+
const els = globalThis?.document?.querySelectorAll(selector);
|
|
1173
|
+
return Array.from(els)
|
|
1174
|
+
.map(el => this.find(ui => ui.element === el))
|
|
1175
|
+
.filter(Boolean);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
// create the singleton
|
|
1180
|
+
const __UI__ = new UIStore();
|
|
1175
1181
|
|
|
1176
1182
|
const __Config__ = {
|
|
1177
1183
|
default:{
|
|
@@ -1194,10 +1200,10 @@
|
|
|
1194
1200
|
};
|
|
1195
1201
|
|
|
1196
1202
|
const __HYDRATION__ = {
|
|
1197
|
-
|
|
1203
|
+
store : new Map(),
|
|
1198
1204
|
index : 0,
|
|
1199
|
-
|
|
1200
|
-
|
|
1205
|
+
register: function(component){
|
|
1206
|
+
this.store.set(this.index++, component);
|
|
1201
1207
|
}
|
|
1202
1208
|
};
|
|
1203
1209
|
|
|
@@ -1205,6 +1211,9 @@
|
|
|
1205
1211
|
ui_index : 0,
|
|
1206
1212
|
get_ui_index:function(){
|
|
1207
1213
|
return this.ui_index ++
|
|
1214
|
+
},
|
|
1215
|
+
register_ui: function(UIElement){
|
|
1216
|
+
|
|
1208
1217
|
}
|
|
1209
1218
|
};
|
|
1210
1219
|
|
|
@@ -1227,7 +1236,6 @@
|
|
|
1227
1236
|
__UI__,
|
|
1228
1237
|
__HYDRATION__,
|
|
1229
1238
|
__State__,
|
|
1230
|
-
// __HYDRATION_MAP__,
|
|
1231
1239
|
__Config__,
|
|
1232
1240
|
__CACHE__,
|
|
1233
1241
|
};
|
|
@@ -2875,7 +2883,7 @@
|
|
|
2875
2883
|
|
|
2876
2884
|
__init__global__();
|
|
2877
2885
|
class UIElement extends UINode{
|
|
2878
|
-
constructor({element, name ='', type="html", useDefaultStyle=false}={}){
|
|
2886
|
+
constructor({element, name ='', type="html", render = __Ziko__.__Config__.default.render, useDefaultStyle=false}={}){
|
|
2879
2887
|
super();
|
|
2880
2888
|
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
|
|
2881
2889
|
if(typeof element === "string") {
|
|
@@ -2926,8 +2934,8 @@
|
|
|
2926
2934
|
resize:null,
|
|
2927
2935
|
intersection:null
|
|
2928
2936
|
};
|
|
2929
|
-
if(element)Object.assign(this.cache,{element});
|
|
2930
|
-
this.uuid = `${this.cache.name}-${Random.string(16)}
|
|
2937
|
+
if(element) Object.assign(this.cache,{element});
|
|
2938
|
+
// this.uuid = `${this.cache.name}-${Random.string(16)}`
|
|
2931
2939
|
this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
|
|
2932
2940
|
useDefaultStyle && this.style({
|
|
2933
2941
|
position: "relative",
|
|
@@ -2937,9 +2945,9 @@
|
|
|
2937
2945
|
width : "auto",
|
|
2938
2946
|
height : "auto"
|
|
2939
2947
|
});
|
|
2940
|
-
this.items =
|
|
2948
|
+
this.items = new UIStore();
|
|
2941
2949
|
globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
|
|
2942
|
-
element &&
|
|
2950
|
+
element && render && this?.render?.();
|
|
2943
2951
|
if(
|
|
2944
2952
|
// globalThis.__Ziko__.__Config__.renderingMode !== "spa"
|
|
2945
2953
|
// &&
|
|
@@ -2948,9 +2956,9 @@
|
|
|
2948
2956
|
this.isInteractive()
|
|
2949
2957
|
){
|
|
2950
2958
|
this.setAttr("ziko-hydration-index", globalThis.__Ziko__.__HYDRATION__.index);
|
|
2951
|
-
globalThis.__Ziko__.__HYDRATION__.
|
|
2952
|
-
globalThis.__Ziko__.__HYDRATION__.increment();
|
|
2959
|
+
globalThis.__Ziko__.__HYDRATION__.register(() => this);
|
|
2953
2960
|
}
|
|
2961
|
+
globalThis.__Ziko__.__UI__.push(this);
|
|
2954
2962
|
}
|
|
2955
2963
|
get element(){
|
|
2956
2964
|
return this.cache.element;
|
|
@@ -3001,14 +3009,13 @@
|
|
|
3001
3009
|
return this.element.getBoundingClientRect().left;
|
|
3002
3010
|
}
|
|
3003
3011
|
clone(render=false) {
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
return UI.render(render);
|
|
3012
|
+
// UI.__proto__=this.__proto__;
|
|
3013
|
+
// if(this.items.length){
|
|
3014
|
+
// const items = [...this.items].map(n=>n.clone());
|
|
3015
|
+
// UI.append(...items);
|
|
3016
|
+
// }
|
|
3017
|
+
// else UI.element=this.element.cloneNode(true);
|
|
3018
|
+
// return UI.render(render);
|
|
3012
3019
|
}
|
|
3013
3020
|
[Symbol.iterator]() {
|
|
3014
3021
|
return this.items[Symbol.iterator]();
|
|
@@ -3027,14 +3034,14 @@
|
|
|
3027
3034
|
this.cache.isFrozzen=freeze;
|
|
3028
3035
|
return this;
|
|
3029
3036
|
}
|
|
3030
|
-
setTarget(tg) {
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
}
|
|
3037
|
+
// setTarget(tg) {
|
|
3038
|
+
// if(this.isBody) return ;
|
|
3039
|
+
// if (tg?.isZikoUIElement) tg = tg.element;
|
|
3040
|
+
// this.unrender();
|
|
3041
|
+
// this.target = tg;
|
|
3042
|
+
// this.render();
|
|
3043
|
+
// return this;
|
|
3044
|
+
// }
|
|
3038
3045
|
describe(label){
|
|
3039
3046
|
if(label)this.setAttr("aria-label",label);
|
|
3040
3047
|
}
|
package/dist/ziko.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date : Sun Aug 24 2025 12:
|
|
5
|
+
Date : Sun Aug 24 2025 12:52:45 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
|
|
@@ -1144,28 +1144,34 @@ function defineParamsGetter$1(target ){
|
|
|
1144
1144
|
});
|
|
1145
1145
|
}
|
|
1146
1146
|
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
.filter(Array.isArray)
|
|
1151
|
-
.flat();
|
|
1152
|
-
},
|
|
1153
|
-
querySelectorAll(){
|
|
1154
|
-
return this.__all__().filter(n=>n)
|
|
1155
|
-
},
|
|
1156
|
-
getElementByIndex(index){
|
|
1157
|
-
return this.__all__().find(n=>n.ui_index===index);
|
|
1158
|
-
},
|
|
1159
|
-
getElementById(id){
|
|
1160
|
-
return null;
|
|
1161
|
-
},
|
|
1162
|
-
getElementsByClass(){
|
|
1163
|
-
|
|
1164
|
-
},
|
|
1165
|
-
getElementsByTagName(){
|
|
1166
|
-
|
|
1147
|
+
class UIStore extends Array {
|
|
1148
|
+
constructor(...args) {
|
|
1149
|
+
super(...args);
|
|
1167
1150
|
}
|
|
1168
|
-
|
|
1151
|
+
getItemById(id) {
|
|
1152
|
+
return this.find(n => n.element.id === id);
|
|
1153
|
+
}
|
|
1154
|
+
getItemsByTagName(tag) {
|
|
1155
|
+
return this.filter(n => n.element.tagName.toLowerCase() === tag.toLowerCase());
|
|
1156
|
+
}
|
|
1157
|
+
getElementsByClassName(className) {
|
|
1158
|
+
return this.filter(n => n.element.classList?.contains(className));
|
|
1159
|
+
}
|
|
1160
|
+
querySelector(selector) {
|
|
1161
|
+
const el = globalThis?.document?.querySelector(selector);
|
|
1162
|
+
if (!el) return null;
|
|
1163
|
+
return this.find(ui => ui.element === el) || null;
|
|
1164
|
+
}
|
|
1165
|
+
querySelectorAll(selector) {
|
|
1166
|
+
const els = globalThis?.document?.querySelectorAll(selector);
|
|
1167
|
+
return Array.from(els)
|
|
1168
|
+
.map(el => this.find(ui => ui.element === el))
|
|
1169
|
+
.filter(Boolean);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
// create the singleton
|
|
1174
|
+
const __UI__ = new UIStore();
|
|
1169
1175
|
|
|
1170
1176
|
const __Config__ = {
|
|
1171
1177
|
default:{
|
|
@@ -1188,10 +1194,10 @@ const __Config__ = {
|
|
|
1188
1194
|
};
|
|
1189
1195
|
|
|
1190
1196
|
const __HYDRATION__ = {
|
|
1191
|
-
|
|
1197
|
+
store : new Map(),
|
|
1192
1198
|
index : 0,
|
|
1193
|
-
|
|
1194
|
-
|
|
1199
|
+
register: function(component){
|
|
1200
|
+
this.store.set(this.index++, component);
|
|
1195
1201
|
}
|
|
1196
1202
|
};
|
|
1197
1203
|
|
|
@@ -1199,6 +1205,9 @@ const __CACHE__ = {
|
|
|
1199
1205
|
ui_index : 0,
|
|
1200
1206
|
get_ui_index:function(){
|
|
1201
1207
|
return this.ui_index ++
|
|
1208
|
+
},
|
|
1209
|
+
register_ui: function(UIElement){
|
|
1210
|
+
|
|
1202
1211
|
}
|
|
1203
1212
|
};
|
|
1204
1213
|
|
|
@@ -1221,7 +1230,6 @@ function __init__global__(){
|
|
|
1221
1230
|
__UI__,
|
|
1222
1231
|
__HYDRATION__,
|
|
1223
1232
|
__State__,
|
|
1224
|
-
// __HYDRATION_MAP__,
|
|
1225
1233
|
__Config__,
|
|
1226
1234
|
__CACHE__,
|
|
1227
1235
|
};
|
|
@@ -2869,7 +2877,7 @@ const useMediaQuery = (mediaQueryRules,fallback) => new ZikoUseMediaQuery(mediaQ
|
|
|
2869
2877
|
|
|
2870
2878
|
__init__global__();
|
|
2871
2879
|
class UIElement extends UINode{
|
|
2872
|
-
constructor({element, name ='', type="html", useDefaultStyle=false}={}){
|
|
2880
|
+
constructor({element, name ='', type="html", render = __Ziko__.__Config__.default.render, useDefaultStyle=false}={}){
|
|
2873
2881
|
super();
|
|
2874
2882
|
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
|
|
2875
2883
|
if(typeof element === "string") {
|
|
@@ -2920,8 +2928,8 @@ class UIElement extends UINode{
|
|
|
2920
2928
|
resize:null,
|
|
2921
2929
|
intersection:null
|
|
2922
2930
|
};
|
|
2923
|
-
if(element)Object.assign(this.cache,{element});
|
|
2924
|
-
this.uuid = `${this.cache.name}-${Random.string(16)}
|
|
2931
|
+
if(element) Object.assign(this.cache,{element});
|
|
2932
|
+
// this.uuid = `${this.cache.name}-${Random.string(16)}`
|
|
2925
2933
|
this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
|
|
2926
2934
|
useDefaultStyle && this.style({
|
|
2927
2935
|
position: "relative",
|
|
@@ -2931,9 +2939,9 @@ class UIElement extends UINode{
|
|
|
2931
2939
|
width : "auto",
|
|
2932
2940
|
height : "auto"
|
|
2933
2941
|
});
|
|
2934
|
-
this.items =
|
|
2942
|
+
this.items = new UIStore();
|
|
2935
2943
|
globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
|
|
2936
|
-
element &&
|
|
2944
|
+
element && render && this?.render?.();
|
|
2937
2945
|
if(
|
|
2938
2946
|
// globalThis.__Ziko__.__Config__.renderingMode !== "spa"
|
|
2939
2947
|
// &&
|
|
@@ -2942,9 +2950,9 @@ class UIElement extends UINode{
|
|
|
2942
2950
|
this.isInteractive()
|
|
2943
2951
|
){
|
|
2944
2952
|
this.setAttr("ziko-hydration-index", globalThis.__Ziko__.__HYDRATION__.index);
|
|
2945
|
-
globalThis.__Ziko__.__HYDRATION__.
|
|
2946
|
-
globalThis.__Ziko__.__HYDRATION__.increment();
|
|
2953
|
+
globalThis.__Ziko__.__HYDRATION__.register(() => this);
|
|
2947
2954
|
}
|
|
2955
|
+
globalThis.__Ziko__.__UI__.push(this);
|
|
2948
2956
|
}
|
|
2949
2957
|
get element(){
|
|
2950
2958
|
return this.cache.element;
|
|
@@ -2995,14 +3003,13 @@ class UIElement extends UINode{
|
|
|
2995
3003
|
return this.element.getBoundingClientRect().left;
|
|
2996
3004
|
}
|
|
2997
3005
|
clone(render=false) {
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
return UI.render(render);
|
|
3006
|
+
// UI.__proto__=this.__proto__;
|
|
3007
|
+
// if(this.items.length){
|
|
3008
|
+
// const items = [...this.items].map(n=>n.clone());
|
|
3009
|
+
// UI.append(...items);
|
|
3010
|
+
// }
|
|
3011
|
+
// else UI.element=this.element.cloneNode(true);
|
|
3012
|
+
// return UI.render(render);
|
|
3006
3013
|
}
|
|
3007
3014
|
[Symbol.iterator]() {
|
|
3008
3015
|
return this.items[Symbol.iterator]();
|
|
@@ -3021,14 +3028,14 @@ class UIElement extends UINode{
|
|
|
3021
3028
|
this.cache.isFrozzen=freeze;
|
|
3022
3029
|
return this;
|
|
3023
3030
|
}
|
|
3024
|
-
setTarget(tg) {
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
}
|
|
3031
|
+
// setTarget(tg) {
|
|
3032
|
+
// if(this.isBody) return ;
|
|
3033
|
+
// if (tg?.isZikoUIElement) tg = tg.element;
|
|
3034
|
+
// this.unrender();
|
|
3035
|
+
// this.target = tg;
|
|
3036
|
+
// this.render();
|
|
3037
|
+
// return this;
|
|
3038
|
+
// }
|
|
3032
3039
|
describe(label){
|
|
3033
3040
|
if(label)this.setAttr("aria-label",label);
|
|
3034
3041
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ziko",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.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",
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export const __HYDRATION__ = {
|
|
2
|
-
|
|
2
|
+
store : new Map(),
|
|
3
3
|
index : 0,
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
register: function(component){
|
|
5
|
+
this.store.set(this.index++, component)
|
|
6
6
|
}
|
|
7
|
-
}
|
|
8
|
-
export const __HYDRATION_MAP__ = new Map()
|
|
7
|
+
}
|
|
@@ -3,7 +3,7 @@ export const __State__ = {
|
|
|
3
3
|
index : import.meta.hot?.data?.__Ziko__?.__State__?.index ?? 0,
|
|
4
4
|
register: function(state){
|
|
5
5
|
console.log({
|
|
6
|
-
hmr : import.meta.hot?.data.__Ziko__.__State__.index,
|
|
6
|
+
// hmr : import.meta.hot?.data.__Ziko__.__State__.index,
|
|
7
7
|
index : this.index
|
|
8
8
|
})
|
|
9
9
|
this.store.set(this.index++, state)
|
package/src/__ziko__/__ui__.js
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
getElementById(id){
|
|
14
|
-
return null;
|
|
15
|
-
},
|
|
16
|
-
getElementsByClass(){
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
getElementsByTagName(){
|
|
20
|
-
|
|
1
|
+
export class UIStore extends Array {
|
|
2
|
+
constructor(...args) {
|
|
3
|
+
super(...args);
|
|
4
|
+
}
|
|
5
|
+
getItemById(id) {
|
|
6
|
+
return this.find(n => n.element.id === id);
|
|
7
|
+
}
|
|
8
|
+
getItemsByTagName(tag) {
|
|
9
|
+
return this.filter(n => n.element.tagName.toLowerCase() === tag.toLowerCase());
|
|
10
|
+
}
|
|
11
|
+
getElementsByClassName(className) {
|
|
12
|
+
return this.filter(n => n.element.classList?.contains(className));
|
|
21
13
|
}
|
|
22
|
-
|
|
14
|
+
querySelector(selector) {
|
|
15
|
+
const el = globalThis?.document?.querySelector(selector);
|
|
16
|
+
if (!el) return null;
|
|
17
|
+
return this.find(ui => ui.element === el) || null;
|
|
18
|
+
}
|
|
19
|
+
querySelectorAll(selector) {
|
|
20
|
+
const els = globalThis?.document?.querySelectorAll(selector);
|
|
21
|
+
return Array.from(els)
|
|
22
|
+
.map(el => this.find(ui => ui.element === el))
|
|
23
|
+
.filter(Boolean);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// create the singleton
|
|
28
|
+
export const __UI__ = new UIStore();
|
package/src/__ziko__/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineParamsGetter } from './params.js';
|
|
2
2
|
import { __UI__ } from './__ui__.js';
|
|
3
3
|
import { __Config__ } from './__config__.js';
|
|
4
|
-
import { __HYDRATION__
|
|
4
|
+
import { __HYDRATION__ } from './__hydration__.js';
|
|
5
5
|
import { __CACHE__ } from './__cache__.js';
|
|
6
6
|
import { __State__ } from './__state__.js';
|
|
7
7
|
export function __init__global__(){
|
|
@@ -10,10 +10,10 @@ export function __init__global__(){
|
|
|
10
10
|
__UI__,
|
|
11
11
|
__HYDRATION__,
|
|
12
12
|
__State__,
|
|
13
|
-
// __HYDRATION_MAP__,
|
|
14
13
|
__Config__,
|
|
15
14
|
__CACHE__,
|
|
16
15
|
};
|
|
17
16
|
defineParamsGetter(__Ziko__)
|
|
18
17
|
}
|
|
19
18
|
}
|
|
19
|
+
export { UIStore } from './__ui__.js'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import UINode from "./UINode.js";
|
|
1
|
+
import {UINode} from "./UINode.js";
|
|
2
2
|
import { register } from "../../__helpers__/register/index.js";
|
|
3
3
|
import {
|
|
4
4
|
AttrsMethods,
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
EventsMethodes,
|
|
8
8
|
StyleMethods
|
|
9
9
|
} from "../__methods__/index.js";
|
|
10
|
-
|
|
11
10
|
import {
|
|
12
11
|
useCustomEvent,
|
|
13
12
|
useSwipeEvent,
|
|
@@ -16,11 +15,11 @@ import {
|
|
|
16
15
|
watchAttr,
|
|
17
16
|
watchChildren
|
|
18
17
|
} from "../../reactivity/index.js"
|
|
19
|
-
import { Random } from "../../math/index.js";
|
|
20
|
-
import {__init__global__} from '../../__ziko__/index.js';
|
|
18
|
+
// import { Random } from "../../math/index.js";
|
|
19
|
+
import {__init__global__, UIStore} from '../../__ziko__/index.js';
|
|
21
20
|
__init__global__()
|
|
22
21
|
class UIElement extends UINode{
|
|
23
|
-
constructor({element, name ='', type="html", useDefaultStyle=false}={}){
|
|
22
|
+
constructor({element, name ='', type="html", render = __Ziko__.__Config__.default.render, useDefaultStyle=false}={}){
|
|
24
23
|
super()
|
|
25
24
|
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
|
|
26
25
|
if(typeof element === "string") {
|
|
@@ -71,8 +70,8 @@ class UIElement extends UINode{
|
|
|
71
70
|
resize:null,
|
|
72
71
|
intersection:null
|
|
73
72
|
}
|
|
74
|
-
if(element)Object.assign(this.cache,{element});
|
|
75
|
-
this.uuid = `${this.cache.name}-${Random.string(16)}`
|
|
73
|
+
if(element) Object.assign(this.cache,{element});
|
|
74
|
+
// this.uuid = `${this.cache.name}-${Random.string(16)}`
|
|
76
75
|
this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
|
|
77
76
|
useDefaultStyle && this.style({
|
|
78
77
|
position: "relative",
|
|
@@ -82,9 +81,9 @@ class UIElement extends UINode{
|
|
|
82
81
|
width : "auto",
|
|
83
82
|
height : "auto"
|
|
84
83
|
});
|
|
85
|
-
this.items =
|
|
84
|
+
this.items = new UIStore();
|
|
86
85
|
globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
|
|
87
|
-
element &&
|
|
86
|
+
element && render && this?.render?.()
|
|
88
87
|
if(
|
|
89
88
|
// globalThis.__Ziko__.__Config__.renderingMode !== "spa"
|
|
90
89
|
// &&
|
|
@@ -93,9 +92,9 @@ class UIElement extends UINode{
|
|
|
93
92
|
this.isInteractive()
|
|
94
93
|
){
|
|
95
94
|
this.setAttr("ziko-hydration-index", globalThis.__Ziko__.__HYDRATION__.index);
|
|
96
|
-
globalThis.__Ziko__.__HYDRATION__.
|
|
97
|
-
globalThis.__Ziko__.__HYDRATION__.increment()
|
|
95
|
+
globalThis.__Ziko__.__HYDRATION__.register(() => this)
|
|
98
96
|
}
|
|
97
|
+
globalThis.__Ziko__.__UI__.push(this)
|
|
99
98
|
}
|
|
100
99
|
get element(){
|
|
101
100
|
return this.cache.element;
|
|
@@ -146,14 +145,13 @@ class UIElement extends UINode{
|
|
|
146
145
|
return this.element.getBoundingClientRect().left;
|
|
147
146
|
}
|
|
148
147
|
clone(render=false) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return UI.render(render);
|
|
148
|
+
// UI.__proto__=this.__proto__;
|
|
149
|
+
// if(this.items.length){
|
|
150
|
+
// const items = [...this.items].map(n=>n.clone());
|
|
151
|
+
// UI.append(...items);
|
|
152
|
+
// }
|
|
153
|
+
// else UI.element=this.element.cloneNode(true);
|
|
154
|
+
// return UI.render(render);
|
|
157
155
|
}
|
|
158
156
|
[Symbol.iterator]() {
|
|
159
157
|
return this.items[Symbol.iterator]();
|
|
@@ -172,14 +170,14 @@ class UIElement extends UINode{
|
|
|
172
170
|
this.cache.isFrozzen=freeze;
|
|
173
171
|
return this;
|
|
174
172
|
}
|
|
175
|
-
setTarget(tg) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
173
|
+
// setTarget(tg) {
|
|
174
|
+
// if(this.isBody) return ;
|
|
175
|
+
// if (tg?.isZikoUIElement) tg = tg.element;
|
|
176
|
+
// this.unrender();
|
|
177
|
+
// this.target = tg;
|
|
178
|
+
// this.render();
|
|
179
|
+
// return this;
|
|
180
|
+
// }
|
|
183
181
|
describe(label){
|
|
184
182
|
if(label)this.setAttr("aria-label",label)
|
|
185
183
|
}
|
|
@@ -254,4 +252,4 @@ class UIElement extends UINode{
|
|
|
254
252
|
}
|
|
255
253
|
|
|
256
254
|
}
|
|
257
|
-
export
|
|
255
|
+
export { UIElement }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export class UINode {
|
|
2
2
|
constructor(node){
|
|
3
3
|
this.cache = {
|
|
4
4
|
node
|
|
@@ -12,4 +12,4 @@ export default class UINode {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
globalThis.node = (node) => new UINode(node);
|
|
15
|
+
// globalThis.node = (node) => new UINode(node);
|
package/src/ui/flex/index.js
CHANGED
package/src/ui/graphics/svg.js
CHANGED
package/src/ui/grid/index.js
CHANGED
package/src/ui/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from "./constructors/UIElement.js"
|
|
2
|
+
export * from "./constructors/UINode.js"
|
|
3
3
|
export * from './tags/index.js';
|
|
4
4
|
export * from './text/index.js';
|
|
5
5
|
export * from './flex/index.js';
|
package/src/ui/suspense/index.js
CHANGED
package/src/ui/tags/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import UIElement from "../constructors/UIElement.js";
|
|
1
|
+
import {UIElement} from "../constructors/UIElement.js";
|
|
2
2
|
import { HTMLTags, SVGTags } from "./tags-list.js";
|
|
3
|
-
import { isStateGetter } from "../../hooks/use-state.js";
|
|
3
|
+
// import { isStateGetter } from "../../hooks/use-state.js";
|
|
4
4
|
const _h=(tag, type, attributes, ...children)=>{
|
|
5
5
|
const { name, style, ...attrs } = attributes;
|
|
6
6
|
let element = new UIElement(tag, name, type);
|
package/src/ui/text/index.js
CHANGED
package/src/ui/wrapper/index.js
CHANGED