ziko 0.49.7 → 0.50.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ziko.cjs +817 -976
- package/dist/ziko.js +817 -976
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +808 -961
- package/package.json +4 -1
- package/src/{reactivity → --reactivity-deprecated}/hooks/index.js +3 -3
- package/src/{reactivity → --reactivity-deprecated}/index.js +1 -1
- package/src/__ziko__/__state__.js +1 -1
- package/src/app/ziko-app.js +6 -6
- package/src/data/api/fetchdom.js +27 -11
- package/src/events/binders/custom-event.js +12 -8
- package/src/events/binders/index.js +97 -13
- package/src/events/custom-events-registry/index.js +3 -0
- package/src/events/custom-events-registry/swipe.js +76 -0
- package/src/events/custom-events-registry/view.js +74 -0
- package/src/events/details-setter/index.js +2 -0
- package/src/events/details-setter/key.js +14 -0
- package/src/events/{binders → details-setter}/pointer.js +1 -15
- package/src/events/{__Events__.js → events-map/index.js} +16 -4
- package/src/events/index.js +1 -1
- package/src/events/types/__Shared__.d.ts +3 -3
- package/src/events/types/clipboard.d.ts +2 -2
- package/src/events/types/focus.d.ts +2 -2
- package/src/events/types/pointer.d.ts +2 -2
- package/src/events/utils.js +31 -0
- package/src/events/ziko-event.js +108 -0
- package/src/hooks/index.js +1 -1
- package/src/hooks/{use-channel.js → use-ipc.js} +3 -3
- package/src/hooks/use-storage.js +2 -2
- package/src/index.js +1 -1
- package/src/ui/__methods__/dom.js +0 -20
- package/src/ui/__methods__/events.js +26 -8
- package/src/ui/__methods__/index.js +3 -0
- package/src/ui/__methods__/lifecycle.js +54 -0
- package/src/ui/constructors/UIElement.js +8 -32
- package/src/ui/constructors/UIElementCore.js +3 -136
- package/src/ui/{constructors/UIElement-lite.js → mini/UIElement.js} +1 -1
- package/src/ui/suspense/index.js +1 -2
- package/types/data/api/index.d.ts +15 -0
- package/types/data/index.d.ts +1 -0
- package/types/data/string/checkers.d.ts +51 -0
- package/types/data/string/converters.d.ts +101 -0
- package/types/data/string/index.d.ts +2 -0
- package/types/hooks/index.d.ts +1 -1
- package/types/hooks/{use-channel.d.ts → use-ipc.d.ts} +2 -2
- package/types/index.d.ts +2 -1
- package/src/events/__ZikoEvent__.js +0 -165
- package/src/events/binders/click.js +0 -20
- package/src/events/binders/clipboard.js +0 -16
- package/src/events/binders/drag.js +0 -16
- package/src/events/binders/focus.js +0 -16
- package/src/events/binders/hash.js +0 -16
- package/src/events/binders/key.js +0 -27
- package/src/events/binders/mouse.js +0 -16
- package/src/events/binders/touch.js +0 -16
- package/src/events/binders/wheel.js +0 -16
- package/src/events/custom-events/index.js +0 -1
- package/src/events/custom-events/swipe.js +0 -58
- package/src/events/custom-events/view.js +0 -43
- package/src/events/index.d.ts.txt +0 -3
- /package/src/{reactivity → --reactivity-deprecated}/events/Input.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/events/ZikoEvent.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/events/__note__ +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/events/custom-event.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/events/hash.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/events/index.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/events/media.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/events/mouse.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/events/swipe.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/events/touch.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/Contexte/index.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/Contexte/useSuccesifKeys.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/UI/index.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/UI/useCssLink.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/UI/useLinearGradient.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/UI/useMediaQuery.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/UI/useRadialGradient.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/UI/useRoot.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/UI/useStyle.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/UI/useTheme.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/head/_useCssText.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/head/index.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/head/useFavIcon.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/head/useHead.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/head/useMeta.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/head/useTitle.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/hooks/todo.md +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/idea +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/observer/attributes.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/observer/children.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/observer/index.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/observer/intersection.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/observer/mutation.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/observer/resize.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/observer/screen.js +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/observer/screen.js.txt +0 -0
- /package/src/{reactivity → --reactivity-deprecated}/observer/screen.txt +0 -0
- /package/src/{use → --use-deprecated}/index.js +0 -0
- /package/src/{use → --use-deprecated}/use-channel.js.txt +0 -0
- /package/src/{use → --use-deprecated}/use-event-emmiter.js.txt +0 -0
- /package/src/{use → --use-deprecated}/use-favicon.js +0 -0
- /package/src/{use → --use-deprecated}/use-link.js +0 -0
- /package/src/{use → --use-deprecated}/use-meta.js +0 -0
- /package/src/{use → --use-deprecated}/use-root.js +0 -0
- /package/src/{use → --use-deprecated}/use-storage.js.txt +0 -0
- /package/src/{use → --use-deprecated}/use-thread.js +0 -0
- /package/src/{use → --use-deprecated}/use-title.js +0 -0
- /package/src/events/{custom-events → custom-events-registry}/click-away.js +0 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getEvent,
|
|
3
|
+
event_controller,
|
|
4
|
+
toggle_event_listener
|
|
5
|
+
} from './utils.js'
|
|
6
|
+
class ZikoEvent {
|
|
7
|
+
constructor(signature, target = null, Events = [], details_setter, customizer){
|
|
8
|
+
this.target = target;
|
|
9
|
+
this.cache = {
|
|
10
|
+
signature,
|
|
11
|
+
currentEvent : null,
|
|
12
|
+
event: null,
|
|
13
|
+
options : {},
|
|
14
|
+
preventDefault : {},
|
|
15
|
+
stopPropagation : {},
|
|
16
|
+
stopImmediatePropagation : {},
|
|
17
|
+
paused : {},
|
|
18
|
+
callbacks : {},
|
|
19
|
+
__controllers__:{}
|
|
20
|
+
}
|
|
21
|
+
if (Events) this._register_events(Events, details_setter, customizer);
|
|
22
|
+
}
|
|
23
|
+
_register_events(Events, details_setter, customizer, REGISTER_METHODES = true) {
|
|
24
|
+
const events = Events?.map(n => getEvent(n));
|
|
25
|
+
events?.forEach((event, i) => {
|
|
26
|
+
this.cache.preventDefault[event] = false;
|
|
27
|
+
this.cache.options[event] = {};
|
|
28
|
+
this.cache.paused[event] = false;
|
|
29
|
+
this.cache.__controllers__[event] = (e) =>
|
|
30
|
+
event_controller.call(this, e, event, details_setter, customizer);
|
|
31
|
+
if (REGISTER_METHODES) {
|
|
32
|
+
this[`on${Events[i]}`] = (callback) =>
|
|
33
|
+
this.__onEvent(event, this.cache.options[event], {}, callback);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
__onEvent(event, options, dispose, callback) {
|
|
39
|
+
if (!callback) return this;
|
|
40
|
+
this.cache.callbacks[event] = callback;
|
|
41
|
+
this.__handle(event, this.cache.__controllers__[event], options, dispose);
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
get targetElement(){
|
|
45
|
+
return this.target?.element;
|
|
46
|
+
}
|
|
47
|
+
get isParent(){
|
|
48
|
+
return this.target?.element === this.event?.srcElement;
|
|
49
|
+
}
|
|
50
|
+
get item(){
|
|
51
|
+
return this.target.find(n => n.element == this.event?.srcElement)?.[0];
|
|
52
|
+
}
|
|
53
|
+
get currentEvent(){
|
|
54
|
+
return this.cache.currentEvent;
|
|
55
|
+
}
|
|
56
|
+
get event(){
|
|
57
|
+
return this.cache.event;
|
|
58
|
+
}
|
|
59
|
+
get detail(){
|
|
60
|
+
return this.cache.event.detail
|
|
61
|
+
}
|
|
62
|
+
setTarget(UI){
|
|
63
|
+
this.target = UI;
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
__handle(event, handler, options){
|
|
67
|
+
this.targetElement?.addEventListener(event, handler, options);
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
#override(method, ...events) {
|
|
71
|
+
const keys = events.length === 0 ? Object.keys(this.cache[method]) : events
|
|
72
|
+
keys.forEach(e => {
|
|
73
|
+
if (this.cache[method].hasOwnProperty(e)) this.cache[method][e] = true;
|
|
74
|
+
});
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
preventDefault(...events) {
|
|
78
|
+
return this.#override('preventDefault', ...events);
|
|
79
|
+
}
|
|
80
|
+
stopPropagation(...events) {
|
|
81
|
+
return this.#override('stopPropagation', ...events);
|
|
82
|
+
}
|
|
83
|
+
stopImmediatePropagation(...events) {
|
|
84
|
+
return this.#override('stopImmediatePropagation', ...events);
|
|
85
|
+
}
|
|
86
|
+
setEventOptions(event, options){
|
|
87
|
+
const evt = getEvent(event);
|
|
88
|
+
this.pause();
|
|
89
|
+
Object.assign(this.cache.options[evt], options);
|
|
90
|
+
this.resume();
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
pause(...events) {
|
|
94
|
+
return toggle_event_listener.call(this, 'removeEventListener', ...events)
|
|
95
|
+
}
|
|
96
|
+
resume(...events) {
|
|
97
|
+
return toggle_event_listener.call(this, 'addEventListener', ...events);
|
|
98
|
+
}
|
|
99
|
+
dispose(){
|
|
100
|
+
this.pause();
|
|
101
|
+
this.target.events[this.cache.signature] = null
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
export {
|
|
106
|
+
ZikoEvent,
|
|
107
|
+
getEvent
|
|
108
|
+
}
|
package/src/hooks/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Random } from "../math/random/index.js";
|
|
2
2
|
|
|
3
|
-
class
|
|
3
|
+
class UseIPC {
|
|
4
4
|
#channel;
|
|
5
5
|
#eventData;
|
|
6
6
|
#handlers;
|
|
@@ -81,5 +81,5 @@ class UseChannel {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
const
|
|
85
|
-
export {
|
|
84
|
+
const useIPC = (name) => new UseIPC(name);
|
|
85
|
+
export { useIPC };
|
package/src/hooks/use-storage.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useIPC } from "./use-ipc.js";
|
|
2
2
|
|
|
3
3
|
class UseStorage {
|
|
4
4
|
constructor(storage, globalKey, initialValue, use_channel = true) {
|
|
5
5
|
this.cache = {
|
|
6
6
|
storage,
|
|
7
7
|
globalKey,
|
|
8
|
-
channel: use_channel ?
|
|
8
|
+
channel: use_channel ? useIPC(`Ziko:useStorage-${globalKey}`) : null,
|
|
9
9
|
oldItemKeys: new Set()
|
|
10
10
|
};
|
|
11
11
|
|
package/src/index.js
CHANGED
|
@@ -35,18 +35,6 @@ export function clear(){
|
|
|
35
35
|
this.element.innerHTML = "";
|
|
36
36
|
return this;
|
|
37
37
|
}
|
|
38
|
-
export function mount(target = this.target) {
|
|
39
|
-
if(this.isBody)return ;
|
|
40
|
-
if(target?.isUIElement)target=target.element;
|
|
41
|
-
this.target=target;
|
|
42
|
-
this.target?.appendChild(this.element);
|
|
43
|
-
return this;
|
|
44
|
-
}
|
|
45
|
-
export function unmount(){
|
|
46
|
-
if(this.cache.parent)this.cache.parent.remove(this);
|
|
47
|
-
else if(this.target?.children?.length && [...this.target?.children].includes(this.element)) this.target.removeChild(this.element);
|
|
48
|
-
return this;
|
|
49
|
-
}
|
|
50
38
|
export function replaceElementWith(new_element){
|
|
51
39
|
this.cache.element.replaceWith(new_element)
|
|
52
40
|
this.cache.element = new_element;
|
|
@@ -54,14 +42,6 @@ export function replaceElementWith(new_element){
|
|
|
54
42
|
// To do : Dispose Events and States
|
|
55
43
|
return this
|
|
56
44
|
}
|
|
57
|
-
export function renderAfter(t = 1) {
|
|
58
|
-
setTimeout(() => this.mount(), t);
|
|
59
|
-
return this;
|
|
60
|
-
}
|
|
61
|
-
export function unrenderAfter(t = 1) {
|
|
62
|
-
setTimeout(() => this.unmount(), t);
|
|
63
|
-
return this;
|
|
64
|
-
}
|
|
65
45
|
export function after(ui){
|
|
66
46
|
if(ui?.isUIElement) ui=ui.element;
|
|
67
47
|
this.element?.after(ui)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EventsMap } from "../../events/events-map/index.js";
|
|
2
2
|
import {
|
|
3
3
|
bind_pointer_event,
|
|
4
4
|
bind_mouse_event,
|
|
@@ -7,9 +7,13 @@ import {
|
|
|
7
7
|
bind_drag_event,
|
|
8
8
|
bind_clipboard_event,
|
|
9
9
|
bind_focus_event,
|
|
10
|
-
bind_wheel_event
|
|
10
|
+
bind_wheel_event,
|
|
11
|
+
bind_view_event,
|
|
12
|
+
bind_swipe_event
|
|
11
13
|
} from "../../events/binders/index.js";
|
|
12
14
|
|
|
15
|
+
import { bind_custom_event } from "../../events/binders/custom-event.js";
|
|
16
|
+
|
|
13
17
|
const binderMap = {
|
|
14
18
|
ptr: bind_pointer_event,
|
|
15
19
|
mouse : bind_mouse_event,
|
|
@@ -18,17 +22,31 @@ const binderMap = {
|
|
|
18
22
|
drag : bind_drag_event,
|
|
19
23
|
clipboard : bind_clipboard_event,
|
|
20
24
|
focus : bind_focus_event,
|
|
21
|
-
wheel : bind_wheel_event
|
|
25
|
+
wheel : bind_wheel_event,
|
|
26
|
+
view : bind_view_event,
|
|
27
|
+
swipe : bind_swipe_event
|
|
22
28
|
};
|
|
23
29
|
|
|
24
|
-
const EventsMethodes = {
|
|
30
|
+
const EventsMethodes = {
|
|
31
|
+
on(event_name,...callbacks){
|
|
32
|
+
if(!this.events.custom)this.events.custom = bind_custom_event(this);
|
|
33
|
+
this.events.custom.on(event_name,...callbacks);
|
|
34
|
+
return this;
|
|
35
|
+
},
|
|
36
|
+
emit(event_name,detail={}){
|
|
37
|
+
if(!this.events.custom)this.events.custom = bind_custom_event(this);
|
|
38
|
+
this.events.custom.emit(event_name,detail);
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
25
42
|
|
|
26
|
-
Object.entries(
|
|
43
|
+
Object.entries(EventsMap).forEach(([name, eventList]) => {
|
|
44
|
+
const lname = name.toLowerCase()
|
|
27
45
|
eventList.forEach(event => {
|
|
28
46
|
const methodName = `on${event}`;
|
|
29
|
-
EventsMethodes[methodName] = function (
|
|
30
|
-
if (!this.events[
|
|
31
|
-
this.events[
|
|
47
|
+
EventsMethodes[methodName] = function (callbacks) {
|
|
48
|
+
if (!this.events[lname]) this.events[lname] = binderMap[lname](this);
|
|
49
|
+
this.events[lname][methodName](callbacks);
|
|
32
50
|
return this;
|
|
33
51
|
};
|
|
34
52
|
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// export function mount(target = this.target) {
|
|
2
|
+
// if(this.isBody) return ;
|
|
3
|
+
// if(target?.isUIElement)target=target.element;
|
|
4
|
+
// this.target=target;
|
|
5
|
+
// this.target?.appendChild(this.element);
|
|
6
|
+
// return this;
|
|
7
|
+
// }
|
|
8
|
+
// export function unmount(){
|
|
9
|
+
// if(this.cache.parent)this.cache.parent.remove(this);
|
|
10
|
+
// else if(this.target?.children?.length && [...this.target?.children].includes(this.element)) this.target.removeChild(this.element);
|
|
11
|
+
// return this;
|
|
12
|
+
// }
|
|
13
|
+
|
|
14
|
+
// export function mountAfter(target = this.target, t = 1) {
|
|
15
|
+
// setTimeout(() => this.mount(), t);
|
|
16
|
+
// return this;
|
|
17
|
+
// }
|
|
18
|
+
// export function unmountAfter(t = 1) {
|
|
19
|
+
// setTimeout(() => this.unmount(), t);
|
|
20
|
+
// return this;
|
|
21
|
+
// }
|
|
22
|
+
|
|
23
|
+
export function mount(target = this.target, delay = 0) {
|
|
24
|
+
if (delay > 0) {
|
|
25
|
+
setTimeout(() => this.mount(target, 0), delay);
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (this.isBody) return this;
|
|
30
|
+
|
|
31
|
+
if (target?.isUIElement) target = target.element;
|
|
32
|
+
this.target = target;
|
|
33
|
+
|
|
34
|
+
this.target?.appendChild(this.element);
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function unmount(delay = 0) {
|
|
39
|
+
if (delay > 0) {
|
|
40
|
+
setTimeout(() => this.unmount(0), delay);
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (this.cache.parent) {
|
|
45
|
+
this.cache.parent.remove(this);
|
|
46
|
+
} else if (
|
|
47
|
+
this.target?.children?.length &&
|
|
48
|
+
[...this.target.children].includes(this.element)
|
|
49
|
+
) {
|
|
50
|
+
this.target.removeChild(this.element);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UIElementCore } from "./UIElementCore.js";
|
|
2
2
|
import { register_to_class } from "../../__helpers__/register/register-to-class.js";
|
|
3
3
|
import {
|
|
4
|
+
LifecycleMethods,
|
|
4
5
|
AttrsMethods,
|
|
5
6
|
DomMethods,
|
|
6
7
|
IndexingMethods,
|
|
@@ -8,13 +9,13 @@ import {
|
|
|
8
9
|
StyleMethods
|
|
9
10
|
} from "../__methods__/index.js";
|
|
10
11
|
import {
|
|
11
|
-
useCustomEvent,
|
|
12
|
+
// useCustomEvent,
|
|
12
13
|
// useSwipeEvent,
|
|
13
14
|
// watchIntersection,
|
|
14
15
|
// watchSize,
|
|
15
16
|
// watchAttr,
|
|
16
17
|
// watchChildren
|
|
17
|
-
} from "
|
|
18
|
+
} from "../../--reactivity-deprecated/events/custom-event.js"
|
|
18
19
|
class UIElement extends UIElementCore{
|
|
19
20
|
constructor({element, name ='', type='html', render = __Ziko__.__Config__.default.render}={}){
|
|
20
21
|
super()
|
|
@@ -22,12 +23,15 @@ class UIElement extends UIElementCore{
|
|
|
22
23
|
// console.log(this)
|
|
23
24
|
register_to_class(
|
|
24
25
|
this,
|
|
26
|
+
LifecycleMethods,
|
|
25
27
|
AttrsMethods,
|
|
26
28
|
DomMethods,
|
|
27
29
|
StyleMethods,
|
|
28
30
|
IndexingMethods,
|
|
29
31
|
EventsMethodes
|
|
30
32
|
);
|
|
33
|
+
|
|
34
|
+
// console.log(EventsMethodes)
|
|
31
35
|
if(element)this.init(element, name, type, render)
|
|
32
36
|
}
|
|
33
37
|
get element(){
|
|
@@ -149,32 +153,12 @@ class UIElement extends UIElementCore{
|
|
|
149
153
|
// get id() {
|
|
150
154
|
// return this.element.getAttribute("id");
|
|
151
155
|
// }
|
|
152
|
-
// onSwipe(width_threshold, height_threshold,...callbacks){
|
|
153
|
-
// if(!this.events.swipe)this.events.swipe = useSwipeEvent(this, width_threshold, height_threshold);
|
|
154
|
-
// this.events.swipe.onSwipe(...callbacks);
|
|
155
|
-
// return this;
|
|
156
|
-
// }
|
|
157
156
|
// To Fix
|
|
158
157
|
// onKeysDown({keys=[],callback}={}){
|
|
159
158
|
// if(!this.events.key)this.events.key = useKeyEvent(this);
|
|
160
159
|
// this.events.key.handleSuccessifKeys({keys,callback});
|
|
161
160
|
// return this;
|
|
162
161
|
// }
|
|
163
|
-
// onSelect(...callbacks){
|
|
164
|
-
// if(!this.events.clipboard)this.events.clipboard = useClipboardEvent(this);
|
|
165
|
-
// this.events.clipboard.onSelect(...callbacks);
|
|
166
|
-
// return this;
|
|
167
|
-
// }
|
|
168
|
-
on(event_name,...callbacks){
|
|
169
|
-
if(!this.events.custom)this.events.custom = useCustomEvent(this);
|
|
170
|
-
this.events.custom.on(event_name,...callbacks);
|
|
171
|
-
return this;
|
|
172
|
-
}
|
|
173
|
-
emit(event_name,detail={}){
|
|
174
|
-
if(!this.events.custom)this.events.custom = useCustomEvent(this);
|
|
175
|
-
this.events.custom.emit(event_name,detail);
|
|
176
|
-
return this;
|
|
177
|
-
}
|
|
178
162
|
// watchAttr(callback){
|
|
179
163
|
// if(!this.observer.attr)this.observer.attr = watchAttr(this,callback);
|
|
180
164
|
// return this;
|
|
@@ -183,16 +167,8 @@ class UIElement extends UIElementCore{
|
|
|
183
167
|
// if(!this.observer.children)this.observer.children = watchChildren(this,callback);
|
|
184
168
|
// return this;
|
|
185
169
|
// }
|
|
186
|
-
// watchSize(callback)
|
|
187
|
-
//
|
|
188
|
-
// this.observer.resize.start();
|
|
189
|
-
// return this;
|
|
190
|
-
// }
|
|
191
|
-
// watchIntersection(callback,config){
|
|
192
|
-
// if(!this.observer.intersection)this.observer.intersection = watchIntersection(this,callback,config);
|
|
193
|
-
// this.observer.intersection.start();
|
|
194
|
-
// return this;
|
|
195
|
-
// }
|
|
170
|
+
// watchSize(callback)Remplaced By on onViewResize
|
|
171
|
+
// watchIntersection(callback,config) Remplaced By onViewEnter and onViewExit
|
|
196
172
|
|
|
197
173
|
}
|
|
198
174
|
export { UIElement }
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {UINode} from "./UINode.js";
|
|
2
|
-
import {__init__global__
|
|
3
|
-
|
|
2
|
+
// import {__init__global__} from '../../__ziko__/index.js';
|
|
3
|
+
import { UIStore } from "../../__ziko__/__ui__.js";
|
|
4
|
+
// __init__global__()
|
|
4
5
|
class UIElementCore extends UINode{
|
|
5
6
|
constructor(){
|
|
6
7
|
super()
|
|
@@ -87,139 +88,5 @@ class UIElementCore extends UINode{
|
|
|
87
88
|
isUIElement(){
|
|
88
89
|
return true;
|
|
89
90
|
}
|
|
90
|
-
// get st(){
|
|
91
|
-
// return this.cache.style;
|
|
92
|
-
// }
|
|
93
|
-
// get attr(){
|
|
94
|
-
// return this.cache.attributes;
|
|
95
|
-
// }
|
|
96
|
-
// get evt(){
|
|
97
|
-
// return this.events;
|
|
98
|
-
// }
|
|
99
|
-
// get html(){
|
|
100
|
-
// return this.element.innerHTML;
|
|
101
|
-
// }
|
|
102
|
-
// get text(){
|
|
103
|
-
// return this.element.textContent;
|
|
104
|
-
// }
|
|
105
|
-
// get isBody(){
|
|
106
|
-
// return this.element === globalThis?.document.body;
|
|
107
|
-
// }
|
|
108
|
-
// get parent(){
|
|
109
|
-
// return this.cache.parent;
|
|
110
|
-
// }
|
|
111
|
-
// get width(){
|
|
112
|
-
// return this.element.getBoundingClientRect().width;
|
|
113
|
-
// }
|
|
114
|
-
// get height(){
|
|
115
|
-
// return this.element.getBoundingClientRect().height;
|
|
116
|
-
// }
|
|
117
|
-
// get top(){
|
|
118
|
-
// return this.element.getBoundingClientRect().top;
|
|
119
|
-
// }
|
|
120
|
-
// get right(){
|
|
121
|
-
// return this.element.getBoundingClientRect().right;
|
|
122
|
-
// }
|
|
123
|
-
// get bottom(){
|
|
124
|
-
// return this.element.getBoundingClientRect().bottom;
|
|
125
|
-
// }
|
|
126
|
-
// get left(){
|
|
127
|
-
// return this.element.getBoundingClientRect().left;
|
|
128
|
-
// }
|
|
129
|
-
// clone(render=false) {
|
|
130
|
-
// // UI.__proto__=this.__proto__;
|
|
131
|
-
// // if(this.items.length){
|
|
132
|
-
// // const items = [...this.items].map(n=>n.clone());
|
|
133
|
-
// // UI.append(...items);
|
|
134
|
-
// // }
|
|
135
|
-
// // else UI.element=this.element.cloneNode(true);
|
|
136
|
-
// // return UI.mount(render);
|
|
137
|
-
// }
|
|
138
|
-
|
|
139
|
-
// freeze(freeze){
|
|
140
|
-
// this.cache.isFrozzen=freeze;
|
|
141
|
-
// return this;
|
|
142
|
-
// }
|
|
143
|
-
// setTarget(tg) {
|
|
144
|
-
// if(this.isBody) return ;
|
|
145
|
-
// if (tg?.isUIElement) tg = tg.element;
|
|
146
|
-
// this.unmount();
|
|
147
|
-
// this.target = tg;
|
|
148
|
-
// this.mount();
|
|
149
|
-
// return this;
|
|
150
|
-
// }
|
|
151
|
-
// describe(label){
|
|
152
|
-
// if(label)this.setAttr("aria-label",label)
|
|
153
|
-
// }
|
|
154
|
-
// get children() {
|
|
155
|
-
// return [...this.element.children];
|
|
156
|
-
// }
|
|
157
|
-
// get cloneElement() {
|
|
158
|
-
// return this.element.cloneNode(true);
|
|
159
|
-
// }
|
|
160
|
-
// setClasses(...value) {
|
|
161
|
-
// this.setAttr("class", value.join(" "));
|
|
162
|
-
// return this;
|
|
163
|
-
// }
|
|
164
|
-
// get classes(){
|
|
165
|
-
// const classes=this.element.getAttribute("class");
|
|
166
|
-
// return classes===null?[]:classes.split(" ");
|
|
167
|
-
// }
|
|
168
|
-
// addClass() {
|
|
169
|
-
// /*this.setAttr("class", value);
|
|
170
|
-
// return this;*/
|
|
171
|
-
// }
|
|
172
|
-
// setId(id) {
|
|
173
|
-
// this.setAttr("id", id);
|
|
174
|
-
// return this;
|
|
175
|
-
// }
|
|
176
|
-
// get id() {
|
|
177
|
-
// return this.element.getAttribute("id");
|
|
178
|
-
// }
|
|
179
|
-
// onSwipe(width_threshold, height_threshold,...callbacks){
|
|
180
|
-
// if(!this.events.swipe)this.events.swipe = useSwipeEvent(this, width_threshold, height_threshold);
|
|
181
|
-
// this.events.swipe.onSwipe(...callbacks);
|
|
182
|
-
// return this;
|
|
183
|
-
// }
|
|
184
|
-
// To Fix
|
|
185
|
-
// onKeysDown({keys=[],callback}={}){
|
|
186
|
-
// if(!this.events.key)this.events.key = useKeyEvent(this);
|
|
187
|
-
// this.events.key.handleSuccessifKeys({keys,callback});
|
|
188
|
-
// return this;
|
|
189
|
-
// }
|
|
190
|
-
// onSelect(...callbacks){
|
|
191
|
-
// if(!this.events.clipboard)this.events.clipboard = useClipboardEvent(this);
|
|
192
|
-
// this.events.clipboard.onSelect(...callbacks);
|
|
193
|
-
// return this;
|
|
194
|
-
// }
|
|
195
|
-
// on(event_name,...callbacks){
|
|
196
|
-
// if(!this.events.custom)this.events.custom = useCustomEvent(this);
|
|
197
|
-
// this.events.custom.on(event_name,...callbacks);
|
|
198
|
-
// return this;
|
|
199
|
-
// }
|
|
200
|
-
// emit(event_name,detail={}){
|
|
201
|
-
// if(!this.events.custom)this.events.custom = useCustomEvent(this);
|
|
202
|
-
// this.events.custom.emit(event_name,detail);
|
|
203
|
-
// return this;
|
|
204
|
-
// }
|
|
205
|
-
// watchAttr(callback){
|
|
206
|
-
// if(!this.observer.attr)this.observer.attr = watchAttr(this,callback);
|
|
207
|
-
// return this;
|
|
208
|
-
// }
|
|
209
|
-
// watchChildren(callback){
|
|
210
|
-
// if(!this.observer.children)this.observer.children = watchChildren(this,callback);
|
|
211
|
-
// return this;
|
|
212
|
-
// }
|
|
213
|
-
// watchSize(callback){
|
|
214
|
-
// if(!this.observer.resize)this.observer.resize = watchSize(this,callback);
|
|
215
|
-
// this.observer.resize.start();
|
|
216
|
-
// return this;
|
|
217
|
-
// }
|
|
218
|
-
// watchIntersection(callback,config){
|
|
219
|
-
// if(!this.observer.intersection)this.observer.intersection = watchIntersection(this,callback,config);
|
|
220
|
-
// this.observer.intersection.start();
|
|
221
|
-
// return this;
|
|
222
|
-
// }
|
|
223
|
-
|
|
224
91
|
}
|
|
225
92
|
export { UIElementCore }
|
package/src/ui/suspense/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {UIElement} from "../
|
|
1
|
+
import {UIElement} from "../mini/UIElement.js";
|
|
2
2
|
class ZikoUISuspense extends UIElement{
|
|
3
3
|
constructor(fallback_ui, callback){
|
|
4
4
|
super({element : "div", name : "suspense"})
|
|
@@ -12,7 +12,6 @@ class ZikoUISuspense extends UIElement{
|
|
|
12
12
|
const ui = await callback()
|
|
13
13
|
fallback_ui.unmount()
|
|
14
14
|
this.append(ui)
|
|
15
|
-
// console.log(content)
|
|
16
15
|
}
|
|
17
16
|
catch(error){
|
|
18
17
|
console.log({error})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// fetchdom.d.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fetches a URL and parses it into a DOM Document asynchronously.
|
|
5
|
+
* @param url The URL to fetch. Defaults to 'https://github.com/zakarialaoui10'.
|
|
6
|
+
* @returns A Promise resolving to the root element of the parsed DOM.
|
|
7
|
+
*/
|
|
8
|
+
export function fetchdom(url?: string): Promise<Element>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Fetches a URL synchronously (using `preload`) and parses it into a DOM Document.
|
|
12
|
+
* @param url The URL to fetch. Defaults to 'https://github.com/zakarialaoui10'.
|
|
13
|
+
* @returns The root element of the parsed DOM.
|
|
14
|
+
*/
|
|
15
|
+
export function fetchdomSync(url?: string): Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type * from './api/index.d.ts'
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// stringUtils.d.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a string is in camelCase.
|
|
5
|
+
* @param text The string to check. Defaults to empty string.
|
|
6
|
+
* @returns True if the string is camelCase, false otherwise.
|
|
7
|
+
*/
|
|
8
|
+
export function is_camelcase(text?: string): boolean;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Checks if a string contains hyphens (hyphen-case).
|
|
12
|
+
* @param text The string to check. Defaults to empty string.
|
|
13
|
+
* @returns True if the string contains hyphens, false otherwise.
|
|
14
|
+
*/
|
|
15
|
+
export function is_hyphencase(text?: string): boolean;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Checks if a string contains underscores (snake_case).
|
|
19
|
+
* @param text The string to check. Defaults to empty string.
|
|
20
|
+
* @returns True if the string contains underscores, false otherwise.
|
|
21
|
+
*/
|
|
22
|
+
export function is_snakeCase(text?: string): boolean;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Checks if a string is in PascalCase.
|
|
26
|
+
* @param text The string to check. Defaults to empty string.
|
|
27
|
+
* @returns True if the string is PascalCase, false otherwise.
|
|
28
|
+
*/
|
|
29
|
+
export function is_pascalcalse(text?: string): boolean;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Checks if a string is a palindrome (case-insensitive).
|
|
33
|
+
* @param text The string to check.
|
|
34
|
+
* @returns True if the string is a palindrome, false otherwise.
|
|
35
|
+
*/
|
|
36
|
+
export function is_palindrome(text: string): boolean;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Checks if two words are anagrams of each other.
|
|
40
|
+
* @param word The first word.
|
|
41
|
+
* @param words The second word.
|
|
42
|
+
* @returns True if the words are anagrams, false otherwise.
|
|
43
|
+
*/
|
|
44
|
+
export function is_anagram(word: string, words: string): boolean;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Checks if a string is an isogram (no repeating letters, case-insensitive).
|
|
48
|
+
* @param text The string to check. Defaults to empty string.
|
|
49
|
+
* @returns True if the string is an isogram, false otherwise.
|
|
50
|
+
*/
|
|
51
|
+
export function is_isogram(text?: string): boolean;
|