ziko 0.0.30 → 0.32.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.cjs +31 -9
- package/dist/ziko.js +31 -9
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +31 -10
- package/package.json +1 -1
- package/src/app/globals.js +13 -3
- package/src/events/__ZikoEvent__.js +7 -3
- package/src/events/custom-event.js +29 -0
- package/src/events/index.js +1 -1
- package/src/events/types/__Shared__.d.ts +7 -0
- package/src/index.js +2 -1
- package/src/reactivity/events/__note__ +1 -0
- package/src/ui/elements/ZikoUIElement.js +15 -5
- package/src/ui/tags/index.js +37 -9
- package/src/ui/tags/tags.js +126 -0
- /package/src/ui/tags/{index.d.ts → index.d.ts.txt} +0 -0
package/dist/ziko.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date :
|
|
5
|
+
Date : Wed Jul 30 2025 15:18:05 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
|
|
@@ -4659,7 +4659,7 @@ class ZikoUIElement {
|
|
|
4659
4659
|
intersection:null
|
|
4660
4660
|
};
|
|
4661
4661
|
this.uuid = `${this.cache.name}-${Random.string(16)}`;
|
|
4662
|
-
this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
|
|
4662
|
+
this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
|
|
4663
4663
|
this.cache.style.linkTo(this);
|
|
4664
4664
|
useDefaultStyle && this.style({
|
|
4665
4665
|
position: "relative",
|
|
@@ -4672,14 +4672,24 @@ class ZikoUIElement {
|
|
|
4672
4672
|
this.items = [];
|
|
4673
4673
|
globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
|
|
4674
4674
|
element && globalThis.__Ziko__.__Config__.default.render && this.render();
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4675
|
+
if(
|
|
4676
|
+
// globalThis.__Ziko__.__Config__.renderingMode !== "spa"
|
|
4677
|
+
// &&
|
|
4678
|
+
// !globalThis.__Ziko__.__Config__.isSSC
|
|
4679
|
+
// &&
|
|
4680
|
+
this.isInteractive()
|
|
4681
|
+
){
|
|
4682
|
+
this.setAttr("ziko-hydration-index", globalThis.__Ziko__.__HYDRATION__.index);
|
|
4683
|
+
globalThis.__Ziko__.__HYDRATION__.map.set(globalThis.__Ziko__.__HYDRATION__.index, ()=>this);
|
|
4684
|
+
globalThis.__Ziko__.__HYDRATION__.increment();
|
|
4685
|
+
}
|
|
4679
4686
|
}
|
|
4680
4687
|
get element(){
|
|
4681
4688
|
return this.__ele__;
|
|
4682
4689
|
}
|
|
4690
|
+
isInteractive(){
|
|
4691
|
+
return [true, false][Math.floor(2*Math.random())];
|
|
4692
|
+
}
|
|
4683
4693
|
get isZikoUIElement(){
|
|
4684
4694
|
return true;
|
|
4685
4695
|
}
|
|
@@ -6935,7 +6945,7 @@ const tags = new Proxy({}, {
|
|
|
6935
6945
|
if (typeof prop !== 'string') return undefined;
|
|
6936
6946
|
let tag = prop.replaceAll("_","-").toLowerCase();
|
|
6937
6947
|
switch(tag){
|
|
6938
|
-
case "html" :
|
|
6948
|
+
case "html" : globalThis?.document?.createElement("html");
|
|
6939
6949
|
case "head" :
|
|
6940
6950
|
case "style" :
|
|
6941
6951
|
case "link" :
|
|
@@ -9146,6 +9156,13 @@ const __UI__={
|
|
|
9146
9156
|
|
|
9147
9157
|
}
|
|
9148
9158
|
};
|
|
9159
|
+
const __HYDRATION__ = {
|
|
9160
|
+
map : new Map(),
|
|
9161
|
+
index : 0,
|
|
9162
|
+
increment : function(){
|
|
9163
|
+
return this.index ++
|
|
9164
|
+
}
|
|
9165
|
+
};
|
|
9149
9166
|
const __HYDRATION_MAP__ = new Map();
|
|
9150
9167
|
const __Config__={
|
|
9151
9168
|
default:{
|
|
@@ -9158,9 +9175,11 @@ const __Config__={
|
|
|
9158
9175
|
setDefault:function(pairs){
|
|
9159
9176
|
const keys=Object.keys(pairs);
|
|
9160
9177
|
const values=Object.values(pairs);
|
|
9161
|
-
for(let i=0;i<keys.length;i++)this.default[keys[i]]=values[i];
|
|
9178
|
+
for(let i=0; i<keys.length; i++) this.default[keys[i]]=values[i];
|
|
9179
|
+
},
|
|
9180
|
+
init:()=>{
|
|
9181
|
+
// document.documentElement.setAttribute("data-engine","zikojs")
|
|
9162
9182
|
},
|
|
9163
|
-
init:()=>document.documentElement.setAttribute("data-engine","zikojs"),
|
|
9164
9183
|
renderingMode :"spa",
|
|
9165
9184
|
isSSC : false,
|
|
9166
9185
|
};
|
|
@@ -9176,6 +9195,7 @@ var Global = /*#__PURE__*/Object.freeze({
|
|
|
9176
9195
|
__CACHE__: __CACHE__,
|
|
9177
9196
|
__Config__: __Config__,
|
|
9178
9197
|
__HYDRATION_MAP__: __HYDRATION_MAP__,
|
|
9198
|
+
__HYDRATION__: __HYDRATION__,
|
|
9179
9199
|
__UI__: __UI__
|
|
9180
9200
|
});
|
|
9181
9201
|
|
|
@@ -9275,6 +9295,7 @@ if ( globalThis.__Ziko__ ) {
|
|
|
9275
9295
|
globalThis.__Ziko__={
|
|
9276
9296
|
...Ziko,
|
|
9277
9297
|
__UI__,
|
|
9298
|
+
__HYDRATION__,
|
|
9278
9299
|
__HYDRATION_MAP__,
|
|
9279
9300
|
__Config__,
|
|
9280
9301
|
__CACHE__,
|
|
@@ -9311,4 +9332,4 @@ function RemoveAll(){
|
|
|
9311
9332
|
Data.RemoveAll();
|
|
9312
9333
|
}
|
|
9313
9334
|
|
|
9314
|
-
export { App$1 as App, Article, Aside, Base, Canvas, Combinaison, Complex, E, EPSILON, Ease, FileBasedRouting, Flex, Footer, Form, Grid$1 as Grid, HTMLWrapper, Header, LinearSystem, Logic$1 as Logic, Main, Matrix, Nav, PI$1 as PI, Permutation, Random, SPA, SVGWrapper, Section, Str, Suspense, Svg, Table$1 as Table, Utils$1 as Utils, ZikoApp, ZikoCustomEvent, ZikoEvent, ZikoEventClick, ZikoEventClipboard, ZikoEventHash, ZikoEventInput, ZikoEventKey, ZikoEventMouse, ZikoEventPointer, ZikoEventSwipe, ZikoEventWheel, ZikoHead$1 as ZikoHead, ZikoJsonStyleSheet, ZikoMutationObserver, ZikoSPA, ZikoUIAbbrText, ZikoUIArticle, ZikoUIAside, ZikoUIAudio, ZikoUIBlockQuote, ZikoUIBr, ZikoUICanvas, ZikoUICodeText, ZikoUIDefintion, ZikoUIElement, ZikoUIFigure, ZikoUIFlex, ZikoUIFooter, ZikoUIForm, ZikoUIGrid, ZikoUIHTMLWrapper, ZikoUIHeader, ZikoUIHeading, ZikoUIHr, ZikoUIHtmlTag, ZikoUIImage, ZikoUIInput, ZikoUIInputCheckbox, ZikoUIInputColor, ZikoUIInputDatalist$1 as ZikoUIInputDatalist, ZikoUIInputDate, ZikoUIInputDateTime, ZikoUIInputEmail, ZikoUIInputImage, ZikoUIInputNumber, ZikoUIInputOption, ZikoUIInputPassword, ZikoUIInputRadio, ZikoUIInputSearch, ZikoUIInputSlider$1 as ZikoUIInputSlider, ZikoUIInputTime, ZikoUILabel, ZikoUILink, ZikoUIMain, ZikoUINav, ZikoUIParagraphe, ZikoUIQuote, ZikoUISVGWrapper, ZikoUISection, ZikoUISelect, ZikoUISubText, ZikoUISupText, ZikoUISuspense, ZikoUISvg, ZikoUIText, ZikoUITextArea, ZikoUIVideo, ZikoUIXMLWrapper, ZikoUseRoot, ZikoUseStyle, __CACHE__, __Config__, __HYDRATION_MAP__, __UI__, abbrText, abs, accum, acos, acosh, acot, add, arange, arr2str, asin, asinh, atan, atan2, atanh, audio, bessel, beta, blockQuote, br, brs, btn, cartesianProduct, ceil, checkbox, choleskyDecomposition, clamp, codeText, combinaison, complex, cos, cosh, cot, coth, count, countWords, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, datalist, Ziko as default, defineParamsGetter, deg2rad, dfnText, div, e, fact, figure, floor, gamma, geomspace, h, h1, h2, h3, h4, h5, h6, hTags, hr, hrs, html, hypot, image, inRange, input, inputCamera, inputColor, inputDate, inputDateTime, inputEmail, inputImage, inputNumber, inputPassword, inputTime, isApproximatlyEqual, json2arr, json2css, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, jsonStyleSheet, lerp, li, link, linspace, ln, logspace, luDecomposition, map, mapfun$1 as mapfun, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, obj2str, ol, ones, p, pgcd, pow, powerSet, ppcm, preload, prod, qrDecomposition, quote, rad2deg, radio, removeExtraSpace, round, s, sTags, search, sec, select, sig, sign, sin, sinc, sinh, slider, sqrt, sqrtn, str, sub, subSet, subText, sum, supText, svg2ascii, svg2img, svg2imgUrl, svg2str, tags, tan, tanh, text, textarea, timeTaken, time_memory_Taken, ul, useAnimation, useChannel$1 as useChannel, useClickEvent, useClipboardEvent, useCustomEvent, useDebounce, useDragEvent, useDropEvent, useEventEmitter, useFavIcon$1 as useFavIcon, useFocusEvent, useFps, useHashEvent, useHead$1 as useHead, useInputEvent, useKeyEvent, useLocaleStorage, useMediaQuery, useMeta$1 as useMeta, useMouseEvent, usePointerEvent, useRoot, useRootValue, useSessionStorage, useStyle, useSuccesifKeys, useSwipeEvent, useThread, useThrottle, useTimeLoop, useTitle$1 as useTitle, useType, useWheelEvent, video, wait, waitForUIElm, waitForUIElmSync, watch, watchAttr, watchChildren, watchIntersection, watchScreen, watchSize, zeros };
|
|
9335
|
+
export { App$1 as App, Article, Aside, Base, Canvas, Combinaison, Complex, E, EPSILON, Ease, FileBasedRouting, Flex, Footer, Form, Grid$1 as Grid, HTMLWrapper, Header, LinearSystem, Logic$1 as Logic, Main, Matrix, Nav, PI$1 as PI, Permutation, Random, SPA, SVGWrapper, Section, Str, Suspense, Svg, Table$1 as Table, Utils$1 as Utils, ZikoApp, ZikoCustomEvent, ZikoEvent, ZikoEventClick, ZikoEventClipboard, ZikoEventHash, ZikoEventInput, ZikoEventKey, ZikoEventMouse, ZikoEventPointer, ZikoEventSwipe, ZikoEventWheel, ZikoHead$1 as ZikoHead, ZikoJsonStyleSheet, ZikoMutationObserver, ZikoSPA, ZikoUIAbbrText, ZikoUIArticle, ZikoUIAside, ZikoUIAudio, ZikoUIBlockQuote, ZikoUIBr, ZikoUICanvas, ZikoUICodeText, ZikoUIDefintion, ZikoUIElement, ZikoUIFigure, ZikoUIFlex, ZikoUIFooter, ZikoUIForm, ZikoUIGrid, ZikoUIHTMLWrapper, ZikoUIHeader, ZikoUIHeading, ZikoUIHr, ZikoUIHtmlTag, ZikoUIImage, ZikoUIInput, ZikoUIInputCheckbox, ZikoUIInputColor, ZikoUIInputDatalist$1 as ZikoUIInputDatalist, ZikoUIInputDate, ZikoUIInputDateTime, ZikoUIInputEmail, ZikoUIInputImage, ZikoUIInputNumber, ZikoUIInputOption, ZikoUIInputPassword, ZikoUIInputRadio, ZikoUIInputSearch, ZikoUIInputSlider$1 as ZikoUIInputSlider, ZikoUIInputTime, ZikoUILabel, ZikoUILink, ZikoUIMain, ZikoUINav, ZikoUIParagraphe, ZikoUIQuote, ZikoUISVGWrapper, ZikoUISection, ZikoUISelect, ZikoUISubText, ZikoUISupText, ZikoUISuspense, ZikoUISvg, ZikoUIText, ZikoUITextArea, ZikoUIVideo, ZikoUIXMLWrapper, ZikoUseRoot, ZikoUseStyle, __CACHE__, __Config__, __HYDRATION_MAP__, __HYDRATION__, __UI__, abbrText, abs, accum, acos, acosh, acot, add, arange, arr2str, asin, asinh, atan, atan2, atanh, audio, bessel, beta, blockQuote, br, brs, btn, cartesianProduct, ceil, checkbox, choleskyDecomposition, clamp, codeText, combinaison, complex, cos, cosh, cot, coth, count, countWords, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, datalist, Ziko as default, defineParamsGetter, deg2rad, dfnText, div, e, fact, figure, floor, gamma, geomspace, h, h1, h2, h3, h4, h5, h6, hTags, hr, hrs, html, hypot, image, inRange, input, inputCamera, inputColor, inputDate, inputDateTime, inputEmail, inputImage, inputNumber, inputPassword, inputTime, isApproximatlyEqual, json2arr, json2css, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, jsonStyleSheet, lerp, li, link, linspace, ln, logspace, luDecomposition, map, mapfun$1 as mapfun, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, obj2str, ol, ones, p, pgcd, pow, powerSet, ppcm, preload, prod, qrDecomposition, quote, rad2deg, radio, removeExtraSpace, round, s, sTags, search, sec, select, sig, sign, sin, sinc, sinh, slider, sqrt, sqrtn, str, sub, subSet, subText, sum, supText, svg2ascii, svg2img, svg2imgUrl, svg2str, tags, tan, tanh, text, textarea, timeTaken, time_memory_Taken, ul, useAnimation, useChannel$1 as useChannel, useClickEvent, useClipboardEvent, useCustomEvent, useDebounce, useDragEvent, useDropEvent, useEventEmitter, useFavIcon$1 as useFavIcon, useFocusEvent, useFps, useHashEvent, useHead$1 as useHead, useInputEvent, useKeyEvent, useLocaleStorage, useMediaQuery, useMeta$1 as useMeta, useMouseEvent, usePointerEvent, useRoot, useRootValue, useSessionStorage, useStyle, useSuccesifKeys, useSwipeEvent, useThread, useThrottle, useTimeLoop, useTitle$1 as useTitle, useType, useWheelEvent, video, wait, waitForUIElm, waitForUIElmSync, watch, watchAttr, watchChildren, watchIntersection, watchScreen, watchSize, zeros };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ziko",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.32.0",
|
|
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",
|
package/src/app/globals.js
CHANGED
|
@@ -20,6 +20,13 @@ const __UI__={
|
|
|
20
20
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
const __HYDRATION__ = {
|
|
24
|
+
map : new Map(),
|
|
25
|
+
index : 0,
|
|
26
|
+
increment : function(){
|
|
27
|
+
return this.index ++
|
|
28
|
+
}
|
|
29
|
+
}
|
|
23
30
|
const __HYDRATION_MAP__ = new Map()
|
|
24
31
|
const __Config__={
|
|
25
32
|
default:{
|
|
@@ -32,9 +39,11 @@ const __Config__={
|
|
|
32
39
|
setDefault:function(pairs){
|
|
33
40
|
const keys=Object.keys(pairs);
|
|
34
41
|
const values=Object.values(pairs);
|
|
35
|
-
for(let i=0;i<keys.length;i++)this.default[keys[i]]=values[i];
|
|
42
|
+
for(let i=0; i<keys.length; i++) this.default[keys[i]]=values[i];
|
|
43
|
+
},
|
|
44
|
+
init:()=>{
|
|
45
|
+
// document.documentElement.setAttribute("data-engine","zikojs")
|
|
36
46
|
},
|
|
37
|
-
init:()=>document.documentElement.setAttribute("data-engine","zikojs"),
|
|
38
47
|
renderingMode :"spa",
|
|
39
48
|
isSSC : false,
|
|
40
49
|
}
|
|
@@ -48,5 +57,6 @@ export {
|
|
|
48
57
|
__UI__,
|
|
49
58
|
__HYDRATION_MAP__,
|
|
50
59
|
__Config__,
|
|
51
|
-
__CACHE__
|
|
60
|
+
__CACHE__,
|
|
61
|
+
__HYDRATION__
|
|
52
62
|
}
|
|
@@ -33,8 +33,11 @@ class __ZikoEvent__ {
|
|
|
33
33
|
callbacks : {},
|
|
34
34
|
__controllers__:{}
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
if(Events)this._register_events(Events, details_setter, customizer);
|
|
37
|
+
}
|
|
38
|
+
_register_events(Events, details_setter, customizer, REGISTER_METHODES = true){
|
|
39
|
+
const events = Events?.map(n=>getEvent(n))
|
|
40
|
+
events?.forEach((event,i)=>{
|
|
38
41
|
Object.assign(this.cache.preventDefault, {[event] : false});
|
|
39
42
|
Object.assign(this.cache.options, {[event] : {}});
|
|
40
43
|
Object.assign(this.cache.paused, {[event] : false});
|
|
@@ -42,8 +45,9 @@ class __ZikoEvent__ {
|
|
|
42
45
|
Object.assign(this.cache.stream.clear, {[event] : false});
|
|
43
46
|
Object.assign(this.cache.stream.history, {[event] : []});
|
|
44
47
|
Object.assign(this.cache.__controllers__, {[event] : e=>event_controller.call(this, e, event, details_setter, customizer)});
|
|
45
|
-
Object.assign(this, { [`on${Events[i]}`] : (...callbacks)=> this.__onEvent(event, this.cache.options[event], {}, ...callbacks)})
|
|
48
|
+
if(REGISTER_METHODES)Object.assign(this, { [`on${Events[i]}`] : (...callbacks)=> this.__onEvent(event, this.cache.options[event], {}, ...callbacks)})
|
|
46
49
|
})
|
|
50
|
+
return this;
|
|
47
51
|
}
|
|
48
52
|
get targetElement(){
|
|
49
53
|
return this.target?.element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { __ZikoEvent__ } from "./__ZikoEvent__.js";
|
|
2
|
+
class ZikoEventCustom extends __ZikoEvent__{
|
|
3
|
+
constructor(target, events, customizer){
|
|
4
|
+
super(target, events, details_setter, customizer)
|
|
5
|
+
}
|
|
6
|
+
_register_events(events){
|
|
7
|
+
super._register_events(events, null, null, false);
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
emit(event_name, details = {}){
|
|
11
|
+
const event=new Event(event_name);
|
|
12
|
+
this.targetElement.dispatchEvent(event);
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
on(event_name, ...callbacks){
|
|
16
|
+
if(!this.cache.options.hasOwnProperty(event_name)) this._register_events([event_name]);
|
|
17
|
+
this.__onEvent(event_name, this.cache.options[event_name], {}, ...callbacks);
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function details_setter(){
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
const bindCustomEvent = (target, events, customizer) => new ZikoEventCustom(target, events, customizer)
|
|
25
|
+
|
|
26
|
+
export{
|
|
27
|
+
bindCustomEvent,
|
|
28
|
+
ZikoEventCustom
|
|
29
|
+
}
|
package/src/events/index.js
CHANGED
|
@@ -47,6 +47,13 @@ export declare class __ZikoEvent__ {
|
|
|
47
47
|
get currentEvent(): string | null;
|
|
48
48
|
get event(): Event | null;
|
|
49
49
|
|
|
50
|
+
_register_events(
|
|
51
|
+
Events: string[] | undefined,
|
|
52
|
+
details_setter: (e: this) => any,
|
|
53
|
+
customizer: (e: this) => any, // To Check
|
|
54
|
+
REGISTER_METHODES?: boolean
|
|
55
|
+
): this;
|
|
56
|
+
|
|
50
57
|
setTarget(UI: any): this;
|
|
51
58
|
|
|
52
59
|
preventDefault(
|
package/src/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import Time from "./time/index.js";
|
|
|
5
5
|
import Data from "./data/index.js";
|
|
6
6
|
import Reactivity from "./reactivity/index.js";
|
|
7
7
|
import Graphics from "./graphics/index.js";
|
|
8
|
-
import App,{__UI__,__HYDRATION_MAP__, __Config__, __CACHE__, defineParamsGetter} from "./app";
|
|
8
|
+
import App,{__UI__,__HYDRATION_MAP__, __Config__, __CACHE__, defineParamsGetter, __HYDRATION__} from "./app";
|
|
9
9
|
|
|
10
10
|
export * from "./math/index.js";
|
|
11
11
|
export * from "./ui/index.js";
|
|
@@ -45,6 +45,7 @@ if ( globalThis.__Ziko__ ) {
|
|
|
45
45
|
globalThis.__Ziko__={
|
|
46
46
|
...Ziko,
|
|
47
47
|
__UI__,
|
|
48
|
+
__HYDRATION__,
|
|
48
49
|
__HYDRATION_MAP__,
|
|
49
50
|
__Config__,
|
|
50
51
|
__CACHE__,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Should removed
|
|
@@ -65,7 +65,7 @@ class ZikoUIElement {
|
|
|
65
65
|
intersection:null
|
|
66
66
|
}
|
|
67
67
|
this.uuid = `${this.cache.name}-${Random.string(16)}`
|
|
68
|
-
this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index()
|
|
68
|
+
this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
|
|
69
69
|
this.cache.style.linkTo(this);
|
|
70
70
|
useDefaultStyle && this.style({
|
|
71
71
|
position: "relative",
|
|
@@ -78,14 +78,24 @@ class ZikoUIElement {
|
|
|
78
78
|
this.items = [];
|
|
79
79
|
globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
|
|
80
80
|
element && globalThis.__Ziko__.__Config__.default.render && this.render()
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
if(
|
|
82
|
+
// globalThis.__Ziko__.__Config__.renderingMode !== "spa"
|
|
83
|
+
// &&
|
|
84
|
+
// !globalThis.__Ziko__.__Config__.isSSC
|
|
85
|
+
// &&
|
|
86
|
+
this.isInteractive()
|
|
87
|
+
){
|
|
88
|
+
this.setAttr("ziko-hydration-index", globalThis.__Ziko__.__HYDRATION__.index);
|
|
89
|
+
globalThis.__Ziko__.__HYDRATION__.map.set(globalThis.__Ziko__.__HYDRATION__.index, ()=>this);
|
|
90
|
+
globalThis.__Ziko__.__HYDRATION__.increment()
|
|
91
|
+
}
|
|
85
92
|
}
|
|
86
93
|
get element(){
|
|
87
94
|
return this.__ele__;
|
|
88
95
|
}
|
|
96
|
+
isInteractive(){
|
|
97
|
+
return [true, false][Math.floor(2*Math.random())];
|
|
98
|
+
}
|
|
89
99
|
get isZikoUIElement(){
|
|
90
100
|
return true;
|
|
91
101
|
}
|
package/src/ui/tags/index.js
CHANGED
|
@@ -1,18 +1,46 @@
|
|
|
1
1
|
import ZikoUIElement from "../elements/ZikoUIElement.js";
|
|
2
|
+
import { HTMLTags, SVGTags } from "./tags.js";
|
|
3
|
+
const _h=(tag, type, attributes, ...children)=>{
|
|
4
|
+
const { name, style, ...attrs } = attributes;
|
|
5
|
+
let element = new ZikoUIElement(tag, name, type);
|
|
6
|
+
style && element.style(style);
|
|
7
|
+
attrs && element.setAttr(attrs);
|
|
8
|
+
children && element.append(...children);
|
|
9
|
+
return element;
|
|
10
|
+
}
|
|
11
|
+
const h=(tag, attributes = {}, ...children)=> _h(tag, "html", attributes, ...children);
|
|
12
|
+
const s=(tag, attributes = {}, ...children)=> _h(tag, "svg", attributes, ...children);
|
|
13
|
+
|
|
2
14
|
const tags = new Proxy({}, {
|
|
3
15
|
get(target, prop) {
|
|
4
16
|
if (typeof prop !== 'string') return undefined;
|
|
5
17
|
let tag = prop.replaceAll("_","-").toLowerCase();
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
if(HTMLTags.includes(tag)) return (...args)=>{
|
|
19
|
+
if(!(args[0] instanceof ZikoUIElement) && args[0] instanceof Object){
|
|
20
|
+
let attributes = args.shift()
|
|
21
|
+
console.log(args)
|
|
22
|
+
return new ZikoUIElement(tag).setAttr(attributes).append(...args)
|
|
23
|
+
}
|
|
24
|
+
return new ZikoUIElement(tag).append(...args);
|
|
25
|
+
}
|
|
26
|
+
if(SVGTags.includes(tag)) return (...args)=>new ZikoUIElement(tag,"",{el_type : "svg"}).append(...args);
|
|
27
|
+
return (...args)=>{
|
|
28
|
+
if(!(args[0] instanceof ZikoUIElement) && args[0] instanceof Object){
|
|
29
|
+
let attributes = args.shift()
|
|
30
|
+
return new ZikoUIElement(tag).setAttr(attributes).append(...args)
|
|
31
|
+
}
|
|
32
|
+
return new ZikoUIElement(tag).append(...args);
|
|
15
33
|
}
|
|
34
|
+
// switch(tag){
|
|
35
|
+
// case "html" : globalThis?.document?.createElement("html")
|
|
36
|
+
// case "head" :
|
|
37
|
+
// case "style" :
|
|
38
|
+
// case "link" :
|
|
39
|
+
// case "meta" :
|
|
40
|
+
// case "srcipt":
|
|
41
|
+
// case "body" : return null; break;
|
|
42
|
+
// default : return new ZikoUIElement(tag);
|
|
43
|
+
// }
|
|
16
44
|
}
|
|
17
45
|
});
|
|
18
46
|
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
const HTMLTags = [
|
|
2
|
+
'a',
|
|
3
|
+
'abb',
|
|
4
|
+
'address',
|
|
5
|
+
'area',
|
|
6
|
+
'article',
|
|
7
|
+
'aside',
|
|
8
|
+
'audio',
|
|
9
|
+
'b',
|
|
10
|
+
'base',
|
|
11
|
+
'bdi',
|
|
12
|
+
'bdo',
|
|
13
|
+
'blockquote',
|
|
14
|
+
'br',
|
|
15
|
+
'button',
|
|
16
|
+
'canvas',
|
|
17
|
+
'caption',
|
|
18
|
+
'cite',
|
|
19
|
+
'code',
|
|
20
|
+
'col',
|
|
21
|
+
'colgroup',
|
|
22
|
+
'data',
|
|
23
|
+
'datalist',
|
|
24
|
+
'dd',
|
|
25
|
+
'del',
|
|
26
|
+
'details',
|
|
27
|
+
'dfn',
|
|
28
|
+
'dialog',
|
|
29
|
+
'div',
|
|
30
|
+
'dl',
|
|
31
|
+
'dt',
|
|
32
|
+
'em',
|
|
33
|
+
'embed',
|
|
34
|
+
'fieldset',
|
|
35
|
+
'figcaption',
|
|
36
|
+
'figure',
|
|
37
|
+
'footer',
|
|
38
|
+
'form',
|
|
39
|
+
'h1',
|
|
40
|
+
'h2',
|
|
41
|
+
'h3',
|
|
42
|
+
'h4',
|
|
43
|
+
'h5',
|
|
44
|
+
'h6',
|
|
45
|
+
'header',
|
|
46
|
+
'hgroup',
|
|
47
|
+
'hr',
|
|
48
|
+
'i',
|
|
49
|
+
'iframe',
|
|
50
|
+
'img',
|
|
51
|
+
'ipnut',
|
|
52
|
+
'ins',
|
|
53
|
+
'kbd',
|
|
54
|
+
'label',
|
|
55
|
+
'legend',
|
|
56
|
+
'li',
|
|
57
|
+
'main',
|
|
58
|
+
'map',
|
|
59
|
+
'mark',
|
|
60
|
+
'menu',
|
|
61
|
+
'meter',
|
|
62
|
+
'nav',
|
|
63
|
+
'object',
|
|
64
|
+
'ol',
|
|
65
|
+
'optgroup',
|
|
66
|
+
'option',
|
|
67
|
+
'output',
|
|
68
|
+
'p',
|
|
69
|
+
'param',
|
|
70
|
+
'picture',
|
|
71
|
+
'pre',
|
|
72
|
+
'progress',
|
|
73
|
+
'q',
|
|
74
|
+
'rp',
|
|
75
|
+
'rt',
|
|
76
|
+
'ruby',
|
|
77
|
+
's',
|
|
78
|
+
'samp',
|
|
79
|
+
'search',
|
|
80
|
+
'section',
|
|
81
|
+
'select',
|
|
82
|
+
'small',
|
|
83
|
+
'source',
|
|
84
|
+
'span',
|
|
85
|
+
'strong',
|
|
86
|
+
'sub',
|
|
87
|
+
'summary',
|
|
88
|
+
'sup',
|
|
89
|
+
'svg',
|
|
90
|
+
'table',
|
|
91
|
+
'tbody',
|
|
92
|
+
'td',
|
|
93
|
+
'template',
|
|
94
|
+
'textarea',
|
|
95
|
+
'tfoot',
|
|
96
|
+
'th',
|
|
97
|
+
'thead',
|
|
98
|
+
'time',
|
|
99
|
+
'title',
|
|
100
|
+
'tr',
|
|
101
|
+
'track',
|
|
102
|
+
'u',
|
|
103
|
+
'ul',
|
|
104
|
+
'var',
|
|
105
|
+
'video',
|
|
106
|
+
'wbr'
|
|
107
|
+
];
|
|
108
|
+
|
|
109
|
+
const SVGTags = [
|
|
110
|
+
"svg", "g", "defs", "symbol", "use", "image", "switch",
|
|
111
|
+
"rect", "circle", "ellipse", "line", "polyline", "polygon", "path",
|
|
112
|
+
"text", "tspan", "textPath", "altGlyph", "altGlyphDef", "altGlyphItem", "glyph", "glyphRef",
|
|
113
|
+
"linearGradient", "radialGradient", "pattern", "solidColor",
|
|
114
|
+
"filter", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix",
|
|
115
|
+
"feDiffuseLighting", "feDisplacementMap", "feDropShadow", "feFlood", "feFuncA", "feFuncR", "feFuncG", "feFuncB",
|
|
116
|
+
"feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "feSpecularLighting",
|
|
117
|
+
"feTile", "feTurbulence",
|
|
118
|
+
"animate", "animateMotion", "animateTransform", "set",
|
|
119
|
+
"script",
|
|
120
|
+
"desc", "title", "metadata", "foreignObject"
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
export{
|
|
124
|
+
HTMLTags,
|
|
125
|
+
SVGTags
|
|
126
|
+
}
|
|
File without changes
|