ziko 0.0.25 → 0.0.27
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/README.md +1 -1
- package/dist/ziko.cjs +50 -8
- package/dist/ziko.js +269 -15
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +267 -16
- package/package.json +1 -1
- package/src/app/globals.js +30 -2
- package/src/index.js +2 -1
- package/src/math/index.js +1 -0
- package/src/reactivity/events/ZikoEvent.js +1 -0
- package/src/reactivity/events/click.js +43 -1
- package/src/reactivity/events-exp/__Events__.js +47 -0
- package/src/reactivity/events-exp/__ZikoEvent__.js +160 -0
- package/src/reactivity/events-exp/click.js +19 -0
- package/src/reactivity/events-exp/index.js +5 -0
- package/src/reactivity/events-exp/key.js +27 -0
- package/src/reactivity/events-exp/pointer.js +48 -0
- package/src/reactivity/events-exp/utils.js +7 -0
- package/src/reactivity/index.js +3 -0
- package/src/ui/elements/ZikoUIElement.js +11 -8
- package/src/ui/elements/misc/index.js +0 -1
- package/src/ui/elements/text/__ZikoUIText__.js +3 -3
- /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/_themes/dark.js +0 -0
- /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/_themes/index.js +0 -0
- /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/_themes/light.js +0 -0
- /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/app/index.js +0 -0
- /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/component/index.js +0 -0
- /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/globals/index.js +0 -0
- /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/index.js +0 -0
- /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/params/index.js +0 -0
- /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/router/index.js +0 -0
- /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/seo/index.js +0 -0
- /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/style/index.js +0 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<img src="docs/assets/
|
|
1
|
+
<img src="docs/assets/logo-200.svg" width="100" align="right" alt="zikojs logo">
|
|
2
2
|
|
|
3
3
|
*💡 **Zikojs** a versatile JavaScript library offering a rich set of UI components, advanced mathematical utilities,Reactivity,animations,client side routing and graphics capabilities*
|
|
4
4
|
|
package/dist/ziko.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date :
|
|
5
|
+
Date : Thu Feb 13 2025 17:40: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
|
|
@@ -1947,7 +1947,49 @@ class ZikoEventClick extends ZikoEvent{
|
|
|
1947
1947
|
return this;
|
|
1948
1948
|
}
|
|
1949
1949
|
}
|
|
1950
|
-
const useClickEvent=target=>new ZikoEventClick(target);
|
|
1950
|
+
const useClickEvent=target=>new ZikoEventClick(target);
|
|
1951
|
+
|
|
1952
|
+
|
|
1953
|
+
//
|
|
1954
|
+
|
|
1955
|
+
|
|
1956
|
+
// import { ZikoEvent, EVENT_CONTROLLER } from "./ZikoEvent.js";
|
|
1957
|
+
|
|
1958
|
+
// class ZikoEventClick extends ZikoEvent {
|
|
1959
|
+
// constructor(target) {
|
|
1960
|
+
// super(target);
|
|
1961
|
+
// this.event = null;
|
|
1962
|
+
// this.cache = {
|
|
1963
|
+
// prefixe: "",
|
|
1964
|
+
// preventDefault: { click: false, dbclick: false },
|
|
1965
|
+
// paused: { click: false, dbclick: false },
|
|
1966
|
+
// stream: {
|
|
1967
|
+
// enabled: { click: false, dbclick: false },
|
|
1968
|
+
// clear: { click: false, dbclick: false },
|
|
1969
|
+
// history: { click: [], dbclick: [] }
|
|
1970
|
+
// },
|
|
1971
|
+
// callbacks: { click: [], dbclick: [] }
|
|
1972
|
+
// };
|
|
1973
|
+
|
|
1974
|
+
// this.__controller = {};
|
|
1975
|
+
// ["click", "dbclick"].forEach(evt => {
|
|
1976
|
+
// this.__controller[evt] = (e) => EVENT_CONTROLLER.call(this, e, evt, null, null);
|
|
1977
|
+
// });
|
|
1978
|
+
// }
|
|
1979
|
+
|
|
1980
|
+
// onClick(...callbacks) {
|
|
1981
|
+
// return this.__onEvent("click", {}, ...callbacks);
|
|
1982
|
+
// }
|
|
1983
|
+
|
|
1984
|
+
// onDbClick(...callbacks) {
|
|
1985
|
+
// return this.__onEvent("dbclick", {}, ...callbacks);
|
|
1986
|
+
// }
|
|
1987
|
+
// }
|
|
1988
|
+
|
|
1989
|
+
// const useClickEvent = (target) => new ZikoEventClick(target);
|
|
1990
|
+
|
|
1991
|
+
// export default useClickEvent;
|
|
1992
|
+
// export { useClickEvent, ZikoEventClick };
|
|
1951
1993
|
|
|
1952
1994
|
function pointerdown_controller(e){
|
|
1953
1995
|
EVENT_CONTROLLER.call(
|
|
@@ -4711,7 +4753,7 @@ class ZikoUIElement {
|
|
|
4711
4753
|
}
|
|
4712
4754
|
for (let i = 0; i < ele.length; i++) {
|
|
4713
4755
|
if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
4714
|
-
if (ele[i]
|
|
4756
|
+
if (ele[i]?.isZikoUIElement) {
|
|
4715
4757
|
ele[i].cache.parent = this;
|
|
4716
4758
|
this.element[adder](ele[i].element);
|
|
4717
4759
|
ele[i].target = this.element;
|
|
@@ -4749,7 +4791,7 @@ class ZikoUIElement {
|
|
|
4749
4791
|
remove(...ele) {
|
|
4750
4792
|
const remove = (ele) => {
|
|
4751
4793
|
if (typeof ele === "number") ele = this.items[ele];
|
|
4752
|
-
if (ele
|
|
4794
|
+
if (ele?.isZikoUIElement) this.element?.removeChild(ele.element);
|
|
4753
4795
|
this.items = this.items.filter((n) => n !== ele);
|
|
4754
4796
|
};
|
|
4755
4797
|
for (let i = 0; i < ele.length; i++) remove(ele[i]);
|
|
@@ -4850,7 +4892,7 @@ class ZikoUIElement {
|
|
|
4850
4892
|
}
|
|
4851
4893
|
setTarget(tg) {
|
|
4852
4894
|
if(this.isBody) return ;
|
|
4853
|
-
if (tg
|
|
4895
|
+
if (tg?.isZikoUIElement) tg = tg.element;
|
|
4854
4896
|
this.unrender();
|
|
4855
4897
|
this.target = tg;
|
|
4856
4898
|
this.render();
|
|
@@ -4866,7 +4908,7 @@ class ZikoUIElement {
|
|
|
4866
4908
|
}
|
|
4867
4909
|
render(target = this.target) {
|
|
4868
4910
|
if(this.isBody)return ;
|
|
4869
|
-
if(target
|
|
4911
|
+
if(target?.isZikoUIElement)target=target.element;
|
|
4870
4912
|
this.target=target;
|
|
4871
4913
|
this.target?.appendChild(this.element);
|
|
4872
4914
|
return this;
|
|
@@ -4885,12 +4927,12 @@ class ZikoUIElement {
|
|
|
4885
4927
|
return this;
|
|
4886
4928
|
}
|
|
4887
4929
|
after(ui){
|
|
4888
|
-
if(ui
|
|
4930
|
+
if(ui?.isZikoUIElement) ui=ui.element;
|
|
4889
4931
|
this.element?.after(ui);
|
|
4890
4932
|
return this;
|
|
4891
4933
|
}
|
|
4892
4934
|
before(ui){
|
|
4893
|
-
if(ui
|
|
4935
|
+
if(ui?.isZikoUIElement) ui=ui.element;
|
|
4894
4936
|
this.element?.before(ui);
|
|
4895
4937
|
return this;
|
|
4896
4938
|
}
|
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 Jul 10 2025 11:49:56 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
|
|
@@ -1013,6 +1013,11 @@
|
|
|
1013
1013
|
}
|
|
1014
1014
|
}
|
|
1015
1015
|
|
|
1016
|
+
var __Random__ = /*#__PURE__*/Object.freeze({
|
|
1017
|
+
__proto__: null,
|
|
1018
|
+
Random: Random
|
|
1019
|
+
});
|
|
1020
|
+
|
|
1016
1021
|
const luDecomposition=matrix=>{
|
|
1017
1022
|
if(matrix instanceof Matrix)matrix=matrix.arr;
|
|
1018
1023
|
const n = matrix.length;
|
|
@@ -1808,6 +1813,7 @@
|
|
|
1808
1813
|
function EVENT_CONTROLLER(e,EVENT,setter,push_object){
|
|
1809
1814
|
this.event=e;
|
|
1810
1815
|
if(this.cache.preventDefault[EVENT])e.preventDefault();
|
|
1816
|
+
console.log({setter});
|
|
1811
1817
|
if(setter)setter();
|
|
1812
1818
|
if(this.cache.stream.enabled[EVENT]&&push_object)this.cache.stream.history[EVENT].push(push_object);
|
|
1813
1819
|
this.cache.callbacks[EVENT].map(n=>n(this));
|
|
@@ -1949,7 +1955,49 @@
|
|
|
1949
1955
|
return this;
|
|
1950
1956
|
}
|
|
1951
1957
|
}
|
|
1952
|
-
const useClickEvent=target=>new ZikoEventClick(target);
|
|
1958
|
+
const useClickEvent=target=>new ZikoEventClick(target);
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+
//
|
|
1962
|
+
|
|
1963
|
+
|
|
1964
|
+
// import { ZikoEvent, EVENT_CONTROLLER } from "./ZikoEvent.js";
|
|
1965
|
+
|
|
1966
|
+
// class ZikoEventClick extends ZikoEvent {
|
|
1967
|
+
// constructor(target) {
|
|
1968
|
+
// super(target);
|
|
1969
|
+
// this.event = null;
|
|
1970
|
+
// this.cache = {
|
|
1971
|
+
// prefixe: "",
|
|
1972
|
+
// preventDefault: { click: false, dbclick: false },
|
|
1973
|
+
// paused: { click: false, dbclick: false },
|
|
1974
|
+
// stream: {
|
|
1975
|
+
// enabled: { click: false, dbclick: false },
|
|
1976
|
+
// clear: { click: false, dbclick: false },
|
|
1977
|
+
// history: { click: [], dbclick: [] }
|
|
1978
|
+
// },
|
|
1979
|
+
// callbacks: { click: [], dbclick: [] }
|
|
1980
|
+
// };
|
|
1981
|
+
|
|
1982
|
+
// this.__controller = {};
|
|
1983
|
+
// ["click", "dbclick"].forEach(evt => {
|
|
1984
|
+
// this.__controller[evt] = (e) => EVENT_CONTROLLER.call(this, e, evt, null, null);
|
|
1985
|
+
// });
|
|
1986
|
+
// }
|
|
1987
|
+
|
|
1988
|
+
// onClick(...callbacks) {
|
|
1989
|
+
// return this.__onEvent("click", {}, ...callbacks);
|
|
1990
|
+
// }
|
|
1991
|
+
|
|
1992
|
+
// onDbClick(...callbacks) {
|
|
1993
|
+
// return this.__onEvent("dbclick", {}, ...callbacks);
|
|
1994
|
+
// }
|
|
1995
|
+
// }
|
|
1996
|
+
|
|
1997
|
+
// const useClickEvent = (target) => new ZikoEventClick(target);
|
|
1998
|
+
|
|
1999
|
+
// export default useClickEvent;
|
|
2000
|
+
// export { useClickEvent, ZikoEventClick };
|
|
1953
2001
|
|
|
1954
2002
|
function pointerdown_controller(e){
|
|
1955
2003
|
EVENT_CONTROLLER.call(
|
|
@@ -4566,10 +4614,181 @@
|
|
|
4566
4614
|
useType: useType
|
|
4567
4615
|
});
|
|
4568
4616
|
|
|
4617
|
+
const getEvent=(event = "")=>{
|
|
4618
|
+
if(event.startsWith("Ptr"))return `pointer${event.split("Ptr")[1].toLowerCase()}`;
|
|
4619
|
+
return event.toLowerCase()
|
|
4620
|
+
};
|
|
4621
|
+
|
|
4622
|
+
function event_controller(e, event_name, details_setter, customizer, push_object){
|
|
4623
|
+
this.cache.currentEvent = event_name;
|
|
4624
|
+
this.cache.event = e;
|
|
4625
|
+
details_setter?.call(this);
|
|
4626
|
+
if(customizer?.hasOwnProperty("prototype"))customizer?.call(this);
|
|
4627
|
+
else customizer?.call(null, this);
|
|
4628
|
+
if(this.cache.preventDefault[event_name]) e.preventDefault();
|
|
4629
|
+
if(this.cache.stopPropagation[event_name]) e.stopPropagation();
|
|
4630
|
+
if(this.cache.stopImmediatePropagation[event_name]) e.stopImmediatePropagation();
|
|
4631
|
+
|
|
4632
|
+
if(this.cache.stream.enabled[event_name]&&push_object)this.cache.stream.history[event_name].push(push_object);
|
|
4633
|
+
this.cache.callbacks[event_name]?.map(n=>n(this));
|
|
4634
|
+
}
|
|
4635
|
+
class __ZikoEvent__ {
|
|
4636
|
+
constructor(target = null, Events = [], details_setter, customizer){
|
|
4637
|
+
this.target = target;
|
|
4638
|
+
this.cache = {
|
|
4639
|
+
currentEvent : null,
|
|
4640
|
+
event: null,
|
|
4641
|
+
options : {},
|
|
4642
|
+
preventDefault : {},
|
|
4643
|
+
stopPropagation : {},
|
|
4644
|
+
stopImmediatePropagation : {},
|
|
4645
|
+
event_flow : {},
|
|
4646
|
+
paused : {},
|
|
4647
|
+
stream : {
|
|
4648
|
+
enabled : {},
|
|
4649
|
+
clear : {},
|
|
4650
|
+
history : {}
|
|
4651
|
+
},
|
|
4652
|
+
callbacks : {},
|
|
4653
|
+
__controllers__:{}
|
|
4654
|
+
};
|
|
4655
|
+
const events = Events.map(n=>getEvent(n));
|
|
4656
|
+
events.forEach((event,i)=>{
|
|
4657
|
+
Object.assign(this.cache.preventDefault, {[event] : false});
|
|
4658
|
+
Object.assign(this.cache.options, {[event] : {}});
|
|
4659
|
+
Object.assign(this.cache.paused, {[event] : false});
|
|
4660
|
+
Object.assign(this.cache.stream.enabled, {[event] : false});
|
|
4661
|
+
Object.assign(this.cache.stream.clear, {[event] : false});
|
|
4662
|
+
Object.assign(this.cache.stream.history, {[event] : []});
|
|
4663
|
+
Object.assign(this.cache.__controllers__, {[event] : e=>event_controller.call(this, e, event, details_setter, customizer)});
|
|
4664
|
+
Object.assign(this, { [`on${Events[i]}`] : (...callbacks)=> this.__onEvent(event, this.cache.options[event], {}, ...callbacks)});
|
|
4665
|
+
});
|
|
4666
|
+
}
|
|
4667
|
+
get targetElement(){
|
|
4668
|
+
return this.target?.element;
|
|
4669
|
+
}
|
|
4670
|
+
get isParent(){
|
|
4671
|
+
return this.target?.element === this.event.srcElement;
|
|
4672
|
+
}
|
|
4673
|
+
get item(){
|
|
4674
|
+
return this.target.find(n=>n.element == this.event?.srcElement)?.[0];
|
|
4675
|
+
}
|
|
4676
|
+
get currentEvent(){
|
|
4677
|
+
return this.cache.currentEvent;
|
|
4678
|
+
}
|
|
4679
|
+
get event(){
|
|
4680
|
+
return this.cache.event;
|
|
4681
|
+
}
|
|
4682
|
+
setTarget(UI){
|
|
4683
|
+
this.target=UI;
|
|
4684
|
+
return this;
|
|
4685
|
+
}
|
|
4686
|
+
__handle(event, handler, options, dispose){
|
|
4687
|
+
this.targetElement?.addEventListener(event, handler, options);
|
|
4688
|
+
return this;
|
|
4689
|
+
}
|
|
4690
|
+
__onEvent(event, options, dispose, ...callbacks){
|
|
4691
|
+
if(callbacks.length===0){
|
|
4692
|
+
console.log("00");
|
|
4693
|
+
if(this.cache.callbacks[event]){
|
|
4694
|
+
console.log("Call");
|
|
4695
|
+
// this.cache.callbacks.map(n=>e=>n.call(this,e));
|
|
4696
|
+
this.cache.callbacks[event].map(n=>e=>n.call(this,e));
|
|
4697
|
+
}
|
|
4698
|
+
else {
|
|
4699
|
+
return this;
|
|
4700
|
+
}
|
|
4701
|
+
}
|
|
4702
|
+
else this.cache.callbacks[event] = callbacks.map(n=>e=>n.call(this,e));
|
|
4703
|
+
this.__handle(event, this.cache.__controllers__[event],options, dispose);
|
|
4704
|
+
return this;
|
|
4705
|
+
}
|
|
4706
|
+
#override(methode, overrides, defaultValue){
|
|
4707
|
+
if(defaultValue === "default") Object.assign(this.cache[methode], {...this.cache[methode], ...overrides});
|
|
4708
|
+
const all = defaultValue === "default"
|
|
4709
|
+
? this.cache[methode]
|
|
4710
|
+
: Object.fromEntries(Object.keys(this.cache.preventDefault).map(n=>[n,defaultValue]));
|
|
4711
|
+
Object.assign(this.cache[methode], {...all,...overrides});
|
|
4712
|
+
return this
|
|
4713
|
+
}
|
|
4714
|
+
preventDefault(overrides = {}, defaultValue = "default"){
|
|
4715
|
+
this.#override("preventDefault", overrides, defaultValue);
|
|
4716
|
+
// const all=Object.fromEntries(Object.keys(this.cache.preventDefault).map(n=>[n,defaultValue]))
|
|
4717
|
+
// Object.assign(this.cache.preventDefault, {...all,...overrides});
|
|
4718
|
+
return this;
|
|
4719
|
+
}
|
|
4720
|
+
stopPropagation(overrides = {}, defaultValue = "default"){
|
|
4721
|
+
this.#override("stopPropagation", overrides, defaultValue);
|
|
4722
|
+
return this;
|
|
4723
|
+
}
|
|
4724
|
+
stopImmediatePropagation(overrides = {}, defaultValue = "default"){
|
|
4725
|
+
this.#override("stopImmediatePropagation", overrides, defaultValue);
|
|
4726
|
+
return this;
|
|
4727
|
+
}
|
|
4728
|
+
setEventOptions(event, options){
|
|
4729
|
+
this.pause({[event] : true, }, "default");
|
|
4730
|
+
Object.assign(this.cache.options[getEvent(event)], options);
|
|
4731
|
+
this.resume({[event] : true, }, "default");
|
|
4732
|
+
return this;
|
|
4733
|
+
}
|
|
4734
|
+
pause(overrides = {}, defaultValue = "default"){
|
|
4735
|
+
const all = defaultValue === "default"
|
|
4736
|
+
? this.cache.stream.enabled
|
|
4737
|
+
: Object.entries(Object.keys(this.cache.stream.enabled).map(n=>[n,defaultValue]));
|
|
4738
|
+
overrides={...all,...overrides};
|
|
4739
|
+
for(let key in overrides){
|
|
4740
|
+
if(overrides[key]){
|
|
4741
|
+
this.targetElement?.removeEventListener(key, this.cache.__controllers__[key], this.cache.options[key]);
|
|
4742
|
+
this.cache.paused[key]=true;
|
|
4743
|
+
}
|
|
4744
|
+
}
|
|
4745
|
+
return this;
|
|
4746
|
+
}
|
|
4747
|
+
resume(overrides = {}, defaultValue = "default"){
|
|
4748
|
+
const all = defaultValue === "default"
|
|
4749
|
+
? this.cache.stream.enabled
|
|
4750
|
+
: Object.entries(Object.keys(this.cache.stream.enabled).map(n=>[n,defaultValue]));
|
|
4751
|
+
overrides={...all,...overrides};
|
|
4752
|
+
for(let key in overrides){
|
|
4753
|
+
if(overrides[key]){
|
|
4754
|
+
this.targetElement?.addEventListener(key,this.cache.__controllers__[key], this.cache.options[key]);
|
|
4755
|
+
this.cache.paused[key]=false;
|
|
4756
|
+
}
|
|
4757
|
+
}
|
|
4758
|
+
return this;
|
|
4759
|
+
}
|
|
4760
|
+
stream(overrides = {}, defaultValue = "default"){
|
|
4761
|
+
this.cache.stream.t0=Date.now();
|
|
4762
|
+
const all=Object.fromEntries(Object.keys(this.cache.stream.enabled).map(n=>[n,defaultValue]));
|
|
4763
|
+
overrides={...all,...overrides};
|
|
4764
|
+
Object.assign(this.cache.stream.enabled,overrides);
|
|
4765
|
+
return this;
|
|
4766
|
+
}
|
|
4767
|
+
clear(){
|
|
4768
|
+
|
|
4769
|
+
}
|
|
4770
|
+
dispose(overrides = {}, defaultValue = "default"){
|
|
4771
|
+
this.pause(overrides, defaultValue);
|
|
4772
|
+
|
|
4773
|
+
return this;
|
|
4774
|
+
}
|
|
4775
|
+
}
|
|
4776
|
+
|
|
4777
|
+
// export * from "./click.js";
|
|
4778
|
+
// export * from "./key.js";
|
|
4779
|
+
// export * from "./pointer.js"
|
|
4780
|
+
|
|
4781
|
+
var EventsExp = /*#__PURE__*/Object.freeze({
|
|
4782
|
+
__proto__: null,
|
|
4783
|
+
__ZikoEvent__: __ZikoEvent__,
|
|
4784
|
+
getEvent: getEvent
|
|
4785
|
+
});
|
|
4786
|
+
|
|
4569
4787
|
const Reactivity={
|
|
4570
4788
|
...Events,
|
|
4571
4789
|
...Observer,
|
|
4572
4790
|
...Hooks,
|
|
4791
|
+
...EventsExp,
|
|
4573
4792
|
};
|
|
4574
4793
|
|
|
4575
4794
|
class ZikoUIElement {
|
|
@@ -4617,6 +4836,7 @@
|
|
|
4617
4836
|
intersection:null
|
|
4618
4837
|
};
|
|
4619
4838
|
this.uuid = `${this.cache.name}-${Random.string(16)}`;
|
|
4839
|
+
this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
|
|
4620
4840
|
this.cache.style.linkTo(this);
|
|
4621
4841
|
useDefaultStyle && this.style({
|
|
4622
4842
|
position: "relative",
|
|
@@ -4629,7 +4849,7 @@
|
|
|
4629
4849
|
this.items = [];
|
|
4630
4850
|
globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
|
|
4631
4851
|
element && globalThis.__Ziko__.__Config__.default.render && this.render();
|
|
4632
|
-
this.setAttr("data-
|
|
4852
|
+
this.setAttr("data-ui-index", this.ui_index);
|
|
4633
4853
|
if(globalThis.__Ziko__.__Config__.renderingMode !== "spa" && !globalThis.__Ziko__.__Config__.isSSC) {
|
|
4634
4854
|
globalThis.__Ziko__.__HYDRATION_MAP__.set(this.uuid, ()=>this);
|
|
4635
4855
|
}
|
|
@@ -4713,12 +4933,14 @@
|
|
|
4713
4933
|
}
|
|
4714
4934
|
for (let i = 0; i < ele.length; i++) {
|
|
4715
4935
|
if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
4716
|
-
if
|
|
4936
|
+
if(ele[i] instanceof Node) ele[i] = new ZikoUIElement(ele[i]);
|
|
4937
|
+
if (ele[i]?.isZikoUIElement) {
|
|
4717
4938
|
ele[i].cache.parent = this;
|
|
4718
4939
|
this.element[adder](ele[i].element);
|
|
4719
4940
|
ele[i].target = this.element;
|
|
4720
4941
|
this.items[pusher](ele[i]);
|
|
4721
|
-
}
|
|
4942
|
+
}
|
|
4943
|
+
else if (ele[i] instanceof Object) {
|
|
4722
4944
|
if (ele[i]?.style) this.style(ele[i]?.style);
|
|
4723
4945
|
if (ele[i]?.attr) {
|
|
4724
4946
|
Object.entries(ele[i].attr).forEach((n) =>
|
|
@@ -4751,7 +4973,7 @@
|
|
|
4751
4973
|
remove(...ele) {
|
|
4752
4974
|
const remove = (ele) => {
|
|
4753
4975
|
if (typeof ele === "number") ele = this.items[ele];
|
|
4754
|
-
if (ele
|
|
4976
|
+
if (ele?.isZikoUIElement) this.element?.removeChild(ele.element);
|
|
4755
4977
|
this.items = this.items.filter((n) => n !== ele);
|
|
4756
4978
|
};
|
|
4757
4979
|
for (let i = 0; i < ele.length; i++) remove(ele[i]);
|
|
@@ -4852,7 +5074,7 @@
|
|
|
4852
5074
|
}
|
|
4853
5075
|
setTarget(tg) {
|
|
4854
5076
|
if(this.isBody) return ;
|
|
4855
|
-
if (tg
|
|
5077
|
+
if (tg?.isZikoUIElement) tg = tg.element;
|
|
4856
5078
|
this.unrender();
|
|
4857
5079
|
this.target = tg;
|
|
4858
5080
|
this.render();
|
|
@@ -4868,7 +5090,7 @@
|
|
|
4868
5090
|
}
|
|
4869
5091
|
render(target = this.target) {
|
|
4870
5092
|
if(this.isBody)return ;
|
|
4871
|
-
if(target
|
|
5093
|
+
if(target?.isZikoUIElement)target=target.element;
|
|
4872
5094
|
this.target=target;
|
|
4873
5095
|
this.target?.appendChild(this.element);
|
|
4874
5096
|
return this;
|
|
@@ -4887,12 +5109,12 @@
|
|
|
4887
5109
|
return this;
|
|
4888
5110
|
}
|
|
4889
5111
|
after(ui){
|
|
4890
|
-
if(ui
|
|
5112
|
+
if(ui?.isZikoUIElement) ui=ui.element;
|
|
4891
5113
|
this.element?.after(ui);
|
|
4892
5114
|
return this;
|
|
4893
5115
|
}
|
|
4894
5116
|
before(ui){
|
|
4895
|
-
if(ui
|
|
5117
|
+
if(ui?.isZikoUIElement) ui=ui.element;
|
|
4896
5118
|
this.element?.before(ui);
|
|
4897
5119
|
return this;
|
|
4898
5120
|
}
|
|
@@ -5197,9 +5419,9 @@
|
|
|
5197
5419
|
|
|
5198
5420
|
if(this.cache.lineBreak)this.element?.appendChild(globalThis.document?.createElement("br"));
|
|
5199
5421
|
});
|
|
5200
|
-
if(this.element?.innerHTML){
|
|
5201
|
-
|
|
5202
|
-
}
|
|
5422
|
+
// if(this.element?.innerHTML){
|
|
5423
|
+
// this.element.innerHTML = this.element.innerHTML.replace(/\n/g, '<br>').replace(/(?<!<[^>]+) /g, ' ');
|
|
5424
|
+
// }
|
|
5203
5425
|
return this
|
|
5204
5426
|
}
|
|
5205
5427
|
setValue(...value) {
|
|
@@ -6015,7 +6237,6 @@
|
|
|
6015
6237
|
class ZikoUIBtn extends ZikoUIElement {
|
|
6016
6238
|
constructor(value = "button") {
|
|
6017
6239
|
super("button","btn");
|
|
6018
|
-
this.element = document?.createElement("button");
|
|
6019
6240
|
this.setValue(value);
|
|
6020
6241
|
this.st.cursor("pointer");
|
|
6021
6242
|
globalThis.__Ziko__.__Config__.default.render && this.render();
|
|
@@ -8424,6 +8645,7 @@
|
|
|
8424
8645
|
...__Functions__,
|
|
8425
8646
|
...__Complex__,
|
|
8426
8647
|
...__Matrix__,
|
|
8648
|
+
...__Random__,
|
|
8427
8649
|
...__Utils__,
|
|
8428
8650
|
...__Discrect__,
|
|
8429
8651
|
// ...__Signal__,
|
|
@@ -9059,7 +9281,28 @@
|
|
|
9059
9281
|
});
|
|
9060
9282
|
}
|
|
9061
9283
|
|
|
9062
|
-
const __UI__={
|
|
9284
|
+
const __UI__={
|
|
9285
|
+
__all__(){
|
|
9286
|
+
return Object.values(this)
|
|
9287
|
+
.filter(Array.isArray)
|
|
9288
|
+
.flat();
|
|
9289
|
+
},
|
|
9290
|
+
querySelectorAll(){
|
|
9291
|
+
return this.__all__().filter(n=>n)
|
|
9292
|
+
},
|
|
9293
|
+
getElementByIndex(index){
|
|
9294
|
+
return this.__all__().find(n=>n.ui_index===index);
|
|
9295
|
+
},
|
|
9296
|
+
getElementById(id){
|
|
9297
|
+
return null;
|
|
9298
|
+
},
|
|
9299
|
+
getElementsByClass(){
|
|
9300
|
+
|
|
9301
|
+
},
|
|
9302
|
+
getElementsByTagName(){
|
|
9303
|
+
|
|
9304
|
+
}
|
|
9305
|
+
};
|
|
9063
9306
|
const __HYDRATION_MAP__ = new Map();
|
|
9064
9307
|
const __Config__={
|
|
9065
9308
|
default:{
|
|
@@ -9077,10 +9320,17 @@
|
|
|
9077
9320
|
init:()=>document.documentElement.setAttribute("data-engine","zikojs"),
|
|
9078
9321
|
renderingMode :"spa",
|
|
9079
9322
|
isSSC : false,
|
|
9323
|
+
};
|
|
9324
|
+
const __CACHE__ = {
|
|
9325
|
+
ui_index : 0,
|
|
9326
|
+
get_ui_index:function(){
|
|
9327
|
+
return this.ui_index ++
|
|
9328
|
+
}
|
|
9080
9329
|
};
|
|
9081
9330
|
|
|
9082
9331
|
var Global = /*#__PURE__*/Object.freeze({
|
|
9083
9332
|
__proto__: null,
|
|
9333
|
+
__CACHE__: __CACHE__,
|
|
9084
9334
|
__Config__: __Config__,
|
|
9085
9335
|
__HYDRATION_MAP__: __HYDRATION_MAP__,
|
|
9086
9336
|
__UI__: __UI__
|
|
@@ -9184,6 +9434,7 @@
|
|
|
9184
9434
|
__UI__,
|
|
9185
9435
|
__HYDRATION_MAP__,
|
|
9186
9436
|
__Config__,
|
|
9437
|
+
__CACHE__,
|
|
9187
9438
|
ExtractAll,
|
|
9188
9439
|
RemoveAll
|
|
9189
9440
|
};
|
|
@@ -9321,9 +9572,11 @@
|
|
|
9321
9572
|
exports.ZikoUIXMLWrapper = ZikoUIXMLWrapper;
|
|
9322
9573
|
exports.ZikoUseRoot = ZikoUseRoot;
|
|
9323
9574
|
exports.ZikoUseStyle = ZikoUseStyle;
|
|
9575
|
+
exports.__CACHE__ = __CACHE__;
|
|
9324
9576
|
exports.__Config__ = __Config__;
|
|
9325
9577
|
exports.__HYDRATION_MAP__ = __HYDRATION_MAP__;
|
|
9326
9578
|
exports.__UI__ = __UI__;
|
|
9579
|
+
exports.__ZikoEvent__ = __ZikoEvent__;
|
|
9327
9580
|
exports.abbrText = abbrText;
|
|
9328
9581
|
exports.abs = abs;
|
|
9329
9582
|
exports.accum = accum;
|
|
@@ -9377,6 +9630,7 @@
|
|
|
9377
9630
|
exports.floor = floor;
|
|
9378
9631
|
exports.gamma = gamma;
|
|
9379
9632
|
exports.geomspace = geomspace;
|
|
9633
|
+
exports.getEvent = getEvent;
|
|
9380
9634
|
exports.h = h;
|
|
9381
9635
|
exports.h1 = h1;
|
|
9382
9636
|
exports.h2 = h2;
|