ziko 0.37.0 → 0.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ziko.cjs +1722 -3956
- package/dist/ziko.js +6150 -8384
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +1713 -3840
- package/package.json +16 -13
- package/readme.md +79 -5
- package/src/__helpers__/composition-dep/compose-class.js +46 -0
- package/src/__helpers__/register/index.js +6 -0
- package/src/__helpers__/register/register-to-class.js +16 -0
- package/src/__helpers__/register/register-to-instance.js +18 -0
- package/src/__ziko__/__cache__.js +6 -0
- package/src/__ziko__/__config__.js +19 -0
- package/src/__ziko__/__hydration__.js +8 -0
- package/src/__ziko__/__ui__.js +22 -0
- package/src/__ziko__/index.js +17 -0
- package/src/__ziko__/params.js +40 -0
- package/src/app/globals.js +14 -0
- package/src/app/index.js +4 -4
- package/src/app/spa-file-based-routing.js +2 -2
- package/src/app/ziko-app.js +1 -1
- package/src/data/converter/svg.js +2 -2
- package/src/hooks/index.js +3 -0
- package/src/hooks/use-derived.js +61 -0
- package/src/hooks/use-reactive.js +7 -0
- package/src/hooks/use-state.js +52 -0
- package/src/index.js +1 -78
- package/src/math/complex/index.js +3 -0
- package/src/math/functions/index.js +23 -23
- package/src/math/functions/proxy.js +58 -0
- package/src/math/utils/mapfun.js +17 -21
- package/src/no-module.js +32 -0
- package/src/time/{animation.js → animation/index.js} +2 -2
- package/src/time/decorators/index.js +17 -0
- package/src/time/index.js +11 -12
- package/src/time/utils/index.js +0 -1
- package/src/ui/{methods → __methods__}/dom.js +15 -14
- package/src/ui/__methods__/index.js +4 -0
- package/src/ui/{utils → __utils__}/index.js +1 -1
- package/src/ui/constructors/{ziko-ui-element.js → ZikoUIElement.js} +17 -117
- package/src/ui/constructors/ZikoUIElementMethodesToBeMoved-dep.js +96 -0
- package/src/ui/{style → constructors/style}/index.js +3 -3
- package/src/ui/{elements/flex → flex}/index.js +1 -1
- package/src/{graphics/canvas/index.js → ui/graphics/canvas.js} +4 -5
- package/src/ui/graphics/index.js +2 -0
- package/src/{graphics/svg/index.js → ui/graphics/svg.js} +1 -1
- package/src/ui/{elements/grid → grid}/index.js +1 -1
- package/src/ui/index.js +9 -40
- package/src/ui/{elements/misc/suspense.js → suspense/index.js} +1 -15
- package/src/ui/tags/index.js +27 -17
- package/src/ui/text/index.js +15 -0
- package/src/ui/{elements/misc/xml-wrapper.js → wrapper/index.js} +1 -1
- package/src/use/index.js +3 -7
- package/src/__helpers__/composition/compose-class.js +0 -28
- package/src/graphics/canvas/_canvas_offscreen +0 -0
- package/src/graphics/canvas/utils/color.js +0 -8
- package/src/graphics/canvas/utils/floodFill.js +0 -57
- package/src/graphics/index.js +0 -10
- package/src/time/utils/decorators.js +0 -17
- package/src/ui/elements/embaded/html.js +0 -20
- package/src/ui/elements/embaded/index.js +0 -3
- package/src/ui/elements/embaded/pdf.js +0 -17
- package/src/ui/elements/embaded/youtube.js +0 -24
- package/src/ui/elements/hydrate.js +0 -0
- package/src/ui/elements/index.js +0 -10
- package/src/ui/elements/io/Form/index.js +0 -42
- package/src/ui/elements/io/Form/index.js.txt +0 -104
- package/src/ui/elements/io/Inputs/__helpers__.js +0 -52
- package/src/ui/elements/io/Inputs/index.js +0 -12
- package/src/ui/elements/io/Inputs/input/index.js +0 -99
- package/src/ui/elements/io/Inputs/input-camera/index.js +0 -26
- package/src/ui/elements/io/Inputs/input-checkbox/index.js +0 -26
- package/src/ui/elements/io/Inputs/input-color/index.js +0 -16
- package/src/ui/elements/io/Inputs/input-date-time/index.js +0 -3
- package/src/ui/elements/io/Inputs/input-date-time/input-date-time.js +0 -14
- package/src/ui/elements/io/Inputs/input-date-time/input-date.js +0 -14
- package/src/ui/elements/io/Inputs/input-date-time/input-time.js +0 -14
- package/src/ui/elements/io/Inputs/input-email-password/index.js +0 -2
- package/src/ui/elements/io/Inputs/input-email-password/input-email.js +0 -15
- package/src/ui/elements/io/Inputs/input-email-password/input-password.js +0 -14
- package/src/ui/elements/io/Inputs/input-file/index.js +0 -1
- package/src/ui/elements/io/Inputs/input-file/input-file.js +0 -0
- package/src/ui/elements/io/Inputs/input-file/input-image.js +0 -43
- package/src/ui/elements/io/Inputs/input-number/index.js +0 -37
- package/src/ui/elements/io/Inputs/input-radio/index.js +0 -26
- package/src/ui/elements/io/Inputs/input-search/index.js +0 -45
- package/src/ui/elements/io/Inputs/input-slider/index.js +0 -34
- package/src/ui/elements/io/Select/index.js +0 -20
- package/src/ui/elements/io/Textarea/index.js +0 -18
- package/src/ui/elements/io/index.js +0 -4
- package/src/ui/elements/list/elements.js +0 -0
- package/src/ui/elements/list/index.js +0 -138
- package/src/ui/elements/media/Audio/index.js +0 -17
- package/src/ui/elements/media/Image/figure.js +0 -19
- package/src/ui/elements/media/Image/image.js +0 -37
- package/src/ui/elements/media/Image/index.js +0 -2
- package/src/ui/elements/media/Video/index.js +0 -27
- package/src/ui/elements/media/__ZikoUIDynamicMediaELement__.js +0 -47
- package/src/ui/elements/media/index.js +0 -3
- package/src/ui/elements/misc/hyperscript.js +0 -144
- package/src/ui/elements/misc/index.js +0 -101
- package/src/ui/elements/semantic/index.js +0 -42
- package/src/ui/elements/table/elements.js +0 -94
- package/src/ui/elements/table/index.js +0 -3
- package/src/ui/elements/table/table.js +0 -115
- package/src/ui/elements/table/utils.js +0 -12
- package/src/ui/elements/text/__ZikoUIText__.js +0 -70
- package/src/ui/elements/text/heading.js +0 -36
- package/src/ui/elements/text/index.js +0 -3
- package/src/ui/elements/text/p.js +0 -26
- package/src/ui/elements/text/pre.js +0 -0
- package/src/ui/elements/text/text.js +0 -81
- package/src/use/use-debounce.js +0 -4
- package/src/use/use-state.js +0 -22
- package/src/use/use-throttle.js +0 -9
- /package/src/__helpers__/{composition → composition-dep}/compose-instance.js +0 -0
- /package/src/__helpers__/{composition → composition-dep}/compose.js +0 -0
- /package/src/__helpers__/{composition → composition-dep}/index.js +0 -0
- /package/src/reactivity/hooks/{Head → head}/_useCssText.js +0 -0
- /package/src/reactivity/hooks/{Head → head}/index.js +0 -0
- /package/src/reactivity/hooks/{Head → head}/useFavIcon.js +0 -0
- /package/src/reactivity/hooks/{Head → head}/useHead.js +0 -0
- /package/src/reactivity/hooks/{Head → head}/useMeta.js +0 -0
- /package/src/reactivity/hooks/{Head → head}/useTitle.js +0 -0
- /package/src/time/{loop.js → loop/index.js} +0 -0
- /package/src/ui/{methods → __methods__}/events.js +0 -0
- /package/src/ui/{methods → __methods__}/indexing.js +0 -0
- /package/src/ui/{methods → __methods__}/observer.js +0 -0
- /package/src/ui/{methods → __methods__}/style.js +0 -0
- /package/src/ui/constructors/{ziko-ui-node.js → ZikoUINode.js} +0 -0
- /package/src/ui/tags/{tags.js → tags-list.js} +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
class Ziko{
|
|
2
|
+
get #SwitchedStyleRTL_LTR(){
|
|
3
|
+
const CalculedStyle = globalThis.getComputedStyle(this.element);
|
|
4
|
+
const SwitchedStyle = {}
|
|
5
|
+
if(CalculedStyle.marginRight!=="0px")Object.assign(SwitchedStyle, {marginLeft: CalculedStyle.marginRight});
|
|
6
|
+
if(CalculedStyle.marginLeft!=="0px")Object.assign(SwitchedStyle, {marginRight: CalculedStyle.marginLeft});
|
|
7
|
+
if(CalculedStyle.paddingRight!=="0px")Object.assign(SwitchedStyle, {paddingLeft: CalculedStyle.paddingRight});
|
|
8
|
+
if(CalculedStyle.paddingLeft!=="0px")Object.assign(SwitchedStyle, {paddingRight: CalculedStyle.paddingLeft});
|
|
9
|
+
if(CalculedStyle.left!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.left});
|
|
10
|
+
if(CalculedStyle.right!=="0px")Object.assign(SwitchedStyle, {left: CalculedStyle.right});
|
|
11
|
+
if(CalculedStyle.textAlign === "right")Object.assign(SwitchedStyle, {textAlign: "left"});
|
|
12
|
+
if(CalculedStyle.textAlign === "left")Object.assign(SwitchedStyle, {textAlign: "right"});
|
|
13
|
+
if(CalculedStyle.float === "right")Object.assign(SwitchedStyle, {float: "left"});
|
|
14
|
+
if(CalculedStyle.float === "left")Object.assign(SwitchedStyle, {float: "right"});
|
|
15
|
+
if(CalculedStyle.borderRadiusLeft!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.borderRadiusRight});
|
|
16
|
+
if(CalculedStyle.borderRadiusRight!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.borderRadiusLeft});
|
|
17
|
+
if(["flex","inline-flex"].includes(CalculedStyle.display)){
|
|
18
|
+
if(CalculedStyle.justifyContent === "flex-end")Object.assign(SwitchedStyle, {justifyContent: "flex-start"});
|
|
19
|
+
if(CalculedStyle.justifyContent === "flex-start")Object.assign(SwitchedStyle, {justifyContent: "flex-end"});
|
|
20
|
+
}
|
|
21
|
+
return SwitchedStyle;
|
|
22
|
+
}
|
|
23
|
+
useRtl(switchAll = false){
|
|
24
|
+
switchAll ? this.style({
|
|
25
|
+
...this.#SwitchedStyleRTL_LTR,
|
|
26
|
+
direction : "rtl"
|
|
27
|
+
}) : this.style({direction : "rtl"});
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
useLtr(switchAll = false){
|
|
31
|
+
switchAll ? this.style({
|
|
32
|
+
...this.#SwitchedStyleRTL_LTR,
|
|
33
|
+
direction : "ltr"
|
|
34
|
+
}) : this.style({direction : "ltr"});
|
|
35
|
+
return this;
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
filter(condition_callback, if_callback = () => {}, else_callback = () => {}) {
|
|
41
|
+
const FilterItems = this.items.filter(condition_callback);
|
|
42
|
+
FilterItems.forEach(if_callback);
|
|
43
|
+
this.items
|
|
44
|
+
.filter((item) => !FilterItems.includes(item))
|
|
45
|
+
.forEach(else_callback);
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
filterByTextContent(text, exactMatch = false) {
|
|
49
|
+
this.items.forEach((n) => n.render());
|
|
50
|
+
this.filter(
|
|
51
|
+
(n) => !(exactMatch ? n.text === text : n.text.includes(text)),
|
|
52
|
+
(e) => e.unrender(),
|
|
53
|
+
);
|
|
54
|
+
// this.items.filter(n=>{
|
|
55
|
+
// const content=n.element.textContent;
|
|
56
|
+
// return !(exactMatch?content===text:content.includes(text))
|
|
57
|
+
// }).map(n=>n.unrender());
|
|
58
|
+
// return this;
|
|
59
|
+
}
|
|
60
|
+
filterByClass(value) {
|
|
61
|
+
this.items.map((n) => n.render());
|
|
62
|
+
this.items
|
|
63
|
+
.filter((n) => !n.classes.includes(value))
|
|
64
|
+
.map((n) => n.unrender());
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
sortByTextContent(value, displays) {
|
|
68
|
+
let item = this.children;
|
|
69
|
+
item
|
|
70
|
+
.filter((n) => !n.textContent.toLowerCase().includes(value.toLowerCase()))
|
|
71
|
+
.map((n) => {
|
|
72
|
+
n.style.display = "none";
|
|
73
|
+
});
|
|
74
|
+
item
|
|
75
|
+
.filter((n) => n.textContent.toLowerCase().includes(value.toLowerCase()))
|
|
76
|
+
.map((n, i) => (n.style.display = displays[i]));
|
|
77
|
+
//return item.filter(n=>n.style.display!="none")
|
|
78
|
+
item.filter((n) => n.style.display != "none");
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// setFullScreen(set = true, e) {
|
|
83
|
+
// if(!this.element.requestFullscreen){
|
|
84
|
+
// console.error("Fullscreen API is not supported in this browser.");
|
|
85
|
+
// return this;
|
|
86
|
+
// }
|
|
87
|
+
// if (set) this.element.requestFullscreen(e);
|
|
88
|
+
// else globalThis.document.exitFullscreen();
|
|
89
|
+
// return this;
|
|
90
|
+
// }
|
|
91
|
+
// toggleFullScreen(e) {
|
|
92
|
+
// if (!globalThis.document.fullscreenElement) this.element.requestFullscreen(e);
|
|
93
|
+
// else globalThis.document.exitFullscreen();
|
|
94
|
+
// return this;
|
|
95
|
+
// }
|
|
96
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { addSuffixeToNumber } from "
|
|
2
|
-
import { Matrix,cos,sin} from "
|
|
3
|
-
import { Str } from "
|
|
1
|
+
import { addSuffixeToNumber } from "../../__utils__/index.js";
|
|
2
|
+
import { Matrix,cos,sin} from "../../../math/index.js";
|
|
3
|
+
import { Str } from "../../../data/index.js";
|
|
4
4
|
class ZikoUIElementStyle{
|
|
5
5
|
constructor(defaultStyle={}){
|
|
6
6
|
this.target=null;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {Matrix} from "../../math/matrix/
|
|
3
|
-
// import { convolute } from "../../math/signal/conv.js";
|
|
1
|
+
import ZikoUIElement from "../constructors/ZikoUIElement.js";
|
|
2
|
+
import {Matrix} from "../../math/matrix/Matrix.js"
|
|
4
3
|
class ZikoUICanvas extends ZikoUIElement{
|
|
5
4
|
constructor(w,h){
|
|
6
5
|
super("canvas","canvas");
|
|
@@ -8,12 +7,12 @@ class ZikoUICanvas extends ZikoUIElement{
|
|
|
8
7
|
this.style({
|
|
9
8
|
border:"1px red solid",
|
|
10
9
|
})
|
|
11
|
-
this.transformMatrix=new Matrix([
|
|
10
|
+
this.transformMatrix = new Matrix([
|
|
12
11
|
[1,0,0],
|
|
13
12
|
[0,1,0],
|
|
14
13
|
[0,0,1]
|
|
15
14
|
])
|
|
16
|
-
this.axisMatrix=new Matrix([
|
|
15
|
+
this.axisMatrix = new Matrix([
|
|
17
16
|
[-10,-10],
|
|
18
17
|
[10,10]
|
|
19
18
|
])
|
package/src/ui/index.js
CHANGED
|
@@ -1,40 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from "./tags/index.js"
|
|
11
|
-
|
|
12
|
-
import * as Text from "./elements/text/index.js";
|
|
13
|
-
import * as List from "./elements/list/index.js";
|
|
14
|
-
import * as Io from "./elements/io/index.js";
|
|
15
|
-
import * as Media from "./elements/media/index.js";
|
|
16
|
-
import * as Table from "./elements/table/index.js";
|
|
17
|
-
import * as Semantic from "./elements/semantic/index.js";
|
|
18
|
-
import * as Misc from "./elements/misc/index.js";
|
|
19
|
-
import * as Flex from "./elements/flex/index.js";
|
|
20
|
-
import * as Grid from "./elements/grid/index.js";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import ZikoUIElement from "./constructors/ziko-ui-element.js";
|
|
24
|
-
|
|
25
|
-
export{
|
|
26
|
-
ZikoUIElement
|
|
27
|
-
}
|
|
28
|
-
const UI = {
|
|
29
|
-
...Text,
|
|
30
|
-
...List,
|
|
31
|
-
...Io,
|
|
32
|
-
...Media,
|
|
33
|
-
...Table,
|
|
34
|
-
...Semantic,
|
|
35
|
-
...Misc,
|
|
36
|
-
...Flex,
|
|
37
|
-
...Grid,
|
|
38
|
-
ZikoUIElement,
|
|
39
|
-
}
|
|
40
|
-
export default UI;
|
|
1
|
+
export { default as ZikoUIElement } from "./constructors/ZikoUIElement.js"
|
|
2
|
+
export { default as ZikoUINode } from "./constructors/ZikoUINode.js"
|
|
3
|
+
export * from './tags/index.js';
|
|
4
|
+
export * from './text/index.js';
|
|
5
|
+
export * from './flex/index.js';
|
|
6
|
+
export * from './grid/index.js';
|
|
7
|
+
export * from './suspense/index.js';
|
|
8
|
+
export * from './wrapper/index.js';
|
|
9
|
+
export * from './graphics/index.js'
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
import ZikoUIElement from "
|
|
2
|
-
// function loadComponent() {
|
|
3
|
-
// return new Promise((resolve) => {
|
|
4
|
-
// setTimeout(() => {
|
|
5
|
-
// resolve(p(1000))
|
|
6
|
-
// }, 500);
|
|
7
|
-
// });
|
|
8
|
-
// }
|
|
9
|
-
|
|
10
|
-
// Suspense(p("Loading ..."),()=>fetch('https://jsonplaceholder.typicode.com/todos/1')
|
|
11
|
-
// .then(response => response.json())
|
|
12
|
-
// .then(json => h2(json.title)))
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import ZikoUIElement from "../constructors/ZikoUIElement";
|
|
16
2
|
class ZikoUISuspense extends ZikoUIElement{
|
|
17
3
|
constructor(fallback_ui, callback){
|
|
18
4
|
super("div", "suspense")
|
package/src/ui/tags/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import ZikoUIElement from "../constructors/
|
|
2
|
-
import { HTMLTags, SVGTags } from "./tags.js";
|
|
1
|
+
import ZikoUIElement from "../constructors/ZikoUIElement.js";
|
|
2
|
+
import { HTMLTags, SVGTags } from "./tags-list.js";
|
|
3
|
+
import { isStateGetter } from "../../hooks/use-state.js";
|
|
3
4
|
const _h=(tag, type, attributes, ...children)=>{
|
|
4
5
|
const { name, style, ...attrs } = attributes;
|
|
5
6
|
let element = new ZikoUIElement(tag, name, type);
|
|
@@ -15,23 +16,32 @@ const tags = new Proxy({}, {
|
|
|
15
16
|
get(target, prop) {
|
|
16
17
|
if (typeof prop !== 'string') return undefined;
|
|
17
18
|
let tag = prop.replaceAll("_","-").toLowerCase();
|
|
19
|
+
let type ;
|
|
20
|
+
if(HTMLTags.includes(tag)) type = 'html'
|
|
21
|
+
if(SVGTags.includes(tag)) type = 'svg'
|
|
18
22
|
if(HTMLTags.includes(tag)) return (...args)=>{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
console.log(isStateGetter(args[0]))
|
|
24
|
+
// if(typeof args[0] === 'function') {
|
|
25
|
+
// console.log(args[0], args[0]?.() instanceof StateGetter)
|
|
26
|
+
// globalThis.a = args[0]
|
|
27
|
+
// console.log({t : a.constructor})
|
|
28
|
+
// }
|
|
29
|
+
if(
|
|
30
|
+
['string', 'number'].includes(typeof args[0])
|
|
31
|
+
|| args[0] instanceof ZikoUIElement
|
|
32
|
+
|| (typeof args[0] === 'function' && args[0]().isStateGetter())
|
|
33
|
+
) return new ZikoUIElement(tag, tag, {type}).append(...args);
|
|
34
|
+
return new ZikoUIElement(tag).setAttr(args.shift()).append(...args)
|
|
25
35
|
}
|
|
26
|
-
if(SVGTags.includes(tag)) return (...args)=>new ZikoUIElement(tag,"",{el_type : "svg"}).append(...args);
|
|
27
|
-
return (...args)=>{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
// switch(tag){
|
|
36
|
+
// if(SVGTags.includes(tag)) return (...args) => new ZikoUIElement(tag,"",{el_type : "svg"}).append(...args);
|
|
37
|
+
// return (...args)=>{
|
|
38
|
+
// if(!(args[0] instanceof ZikoUIElement) && args[0] instanceof Object){
|
|
39
|
+
// let attributes = args.shift()
|
|
40
|
+
// return new ZikoUIElement(tag).setAttr(attributes).append(...args)
|
|
41
|
+
// }
|
|
42
|
+
// return new ZikoUIElement(tag).append(...args);
|
|
43
|
+
// }
|
|
44
|
+
// // switch(tag){
|
|
35
45
|
// case "html" : globalThis?.document?.createElement("html")
|
|
36
46
|
// case "head" :
|
|
37
47
|
// case "style" :
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import ZikoUINode from "../constructors/ZikoUINode.js";
|
|
2
|
+
class ZikoUIText extends ZikoUINode {
|
|
3
|
+
constructor(...value) {
|
|
4
|
+
super("span", "text", false, ...value);
|
|
5
|
+
this.element = globalThis?.document?.createTextNode(...value)
|
|
6
|
+
}
|
|
7
|
+
isText(){
|
|
8
|
+
return true
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const text = (...str) => new ZikoUIText(...str);
|
|
12
|
+
export{
|
|
13
|
+
ZikoUIText,
|
|
14
|
+
text
|
|
15
|
+
}
|
package/src/use/index.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from './use-
|
|
3
|
-
export * from './use-
|
|
4
|
-
|
|
5
|
-
export * from "./use-channel.js";
|
|
6
|
-
export * from "./use-event-emmiter.js";
|
|
7
|
-
export * from "./use-thread.js";
|
|
1
|
+
export * from './use-channel.js';
|
|
2
|
+
export * from './use-event-emmiter.js';
|
|
3
|
+
export * from './use-thread.js';
|
|
8
4
|
|
|
9
5
|
export * from './use-root.js';
|
|
10
6
|
// export * from './use-title.js'
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export function composeClass(Class, mixin) {
|
|
2
|
-
const descriptors = Object.getOwnPropertyDescriptors(mixin);
|
|
3
|
-
|
|
4
|
-
class Composed extends Class {
|
|
5
|
-
constructor(...args) {
|
|
6
|
-
super(...args);
|
|
7
|
-
for (const key of Reflect.ownKeys(descriptors)) {
|
|
8
|
-
const desc = descriptors[key];
|
|
9
|
-
|
|
10
|
-
if (typeof desc.value === 'function') {
|
|
11
|
-
this[key] = desc.value.bind(this);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
for (const key of Reflect.ownKeys(descriptors)) {
|
|
18
|
-
const desc = descriptors[key];
|
|
19
|
-
|
|
20
|
-
if ('get' in desc || 'set' in desc) {
|
|
21
|
-
Object.defineProperty(Composed.prototype, key, desc);
|
|
22
|
-
} else if (typeof desc.value !== 'function') {
|
|
23
|
-
Object.defineProperty(Composed.prototype, key, desc);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return Composed;
|
|
28
|
-
}
|
|
File without changes
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
const floodFill=(parent, imageData, newColor, x, y)=>{
|
|
2
|
-
const { width, height, data } = imageData;
|
|
3
|
-
const stack = [];
|
|
4
|
-
const baseColor = parent.getColorAtPixel(imageData, x, y);
|
|
5
|
-
let operator = { x, y };
|
|
6
|
-
|
|
7
|
-
if (parent.colorMatch(baseColor, newColor)) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// Add the clicked location to stack
|
|
12
|
-
stack.push({ x: operator.x, y: operator.y });
|
|
13
|
-
|
|
14
|
-
while (stack.length) {
|
|
15
|
-
operator = stack.pop();
|
|
16
|
-
let contiguousDown = true; // Vertical is assumed to be true
|
|
17
|
-
let contiguousUp = true; // Vertical is assumed to be true
|
|
18
|
-
let contiguousLeft = false;
|
|
19
|
-
let contiguousRight = false;
|
|
20
|
-
|
|
21
|
-
// Move to top most contiguousDown pixel
|
|
22
|
-
while (contiguousUp && operator.y >= 0) {
|
|
23
|
-
operator.y--;
|
|
24
|
-
contiguousUp = parent.colorMatch(parent.getColorAtPixel(imageData, operator.x, operator.y), baseColor);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Move downward
|
|
28
|
-
while (contiguousDown && operator.y < height) {
|
|
29
|
-
parent.setColorAtPixel(imageData, newColor, operator.x, operator.y);
|
|
30
|
-
|
|
31
|
-
// Check left
|
|
32
|
-
if (operator.x - 1 >= 0 && parent.colorMatch(parent.getColorAtPixel(imageData, operator.x - 1, operator.y), baseColor)) {
|
|
33
|
-
if (!contiguousLeft) {
|
|
34
|
-
contiguousLeft = true;
|
|
35
|
-
stack.push({ x: operator.x - 1, y: operator.y });
|
|
36
|
-
}
|
|
37
|
-
} else {
|
|
38
|
-
contiguousLeft = false;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Check right
|
|
42
|
-
if (operator.x + 1 < width && parent.colorMatch(parent.getColorAtPixel(imageData, operator.x + 1, operator.y), baseColor)) {
|
|
43
|
-
if (!contiguousRight) {
|
|
44
|
-
stack.push({ x: operator.x + 1, y: operator.y });
|
|
45
|
-
contiguousRight = true;
|
|
46
|
-
}
|
|
47
|
-
} else {
|
|
48
|
-
contiguousRight = false;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
operator.y++;
|
|
52
|
-
contiguousDown = parent.colorMatch(parent.getColorAtPixel(imageData, operator.x, operator.y), baseColor);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return imageData;
|
|
56
|
-
}
|
|
57
|
-
export default floodFill;
|
package/src/graphics/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const useDebounce=(fn,delay=1000)=>{
|
|
2
|
-
let id;
|
|
3
|
-
return(...args)=>id?clearTimeout(id):setTimeout(()=>fn(...args),delay)
|
|
4
|
-
}
|
|
5
|
-
const useThrottle=(fn,delay)=>{
|
|
6
|
-
let lastTime=0;
|
|
7
|
-
return (...args)=>{
|
|
8
|
-
const now=new Date().getTime()
|
|
9
|
-
if(now-lastTime<delay)return;
|
|
10
|
-
lastTime=now;
|
|
11
|
-
fn(...args);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export{
|
|
15
|
-
useDebounce,
|
|
16
|
-
useThrottle
|
|
17
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import ZikoUIElement from "../ZikoUIElement.js";
|
|
2
|
-
|
|
3
|
-
class ZikoUIHtmlViewer extends ZikoUIElement{
|
|
4
|
-
constructor(src, title){
|
|
5
|
-
super("iframe", "HTMLViewer")
|
|
6
|
-
this.setAttr({
|
|
7
|
-
src,
|
|
8
|
-
title,
|
|
9
|
-
// ariaLabel : "Interactive YouTube video player for zikojs apps",
|
|
10
|
-
role:"application",
|
|
11
|
-
loading:"lazy"
|
|
12
|
-
})
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const HTMLViewer = (src, title) => new ZikoUIHtmlViewer(src, title);
|
|
17
|
-
export{
|
|
18
|
-
HTMLViewer,
|
|
19
|
-
ZikoUIHtmlViewer
|
|
20
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import ZikoUIElement from "../ZikoUIElement.js";
|
|
2
|
-
class ZikoUIPdf extends ZikoUIElement{
|
|
3
|
-
constructor(src, title = "Pdf Document Embaded in Zikojs App"){
|
|
4
|
-
super("embed","PDFViewer")
|
|
5
|
-
this.setAttr({
|
|
6
|
-
src:src,
|
|
7
|
-
type: "application/pdf",
|
|
8
|
-
ariaLabel: title,
|
|
9
|
-
tabIndex: "0",
|
|
10
|
-
})
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
const PDFViewer=(src, title)=>new ZikoUIPdf(src, title);
|
|
14
|
-
export{
|
|
15
|
-
ZikoUIPdf,
|
|
16
|
-
PDFViewer
|
|
17
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import ZikoUIElement from "../ZikoUIElement.js";
|
|
2
|
-
import { Str } from "../../../../data.js";
|
|
3
|
-
class ZikoUIYoutubePlayer extends ZikoUIElement{
|
|
4
|
-
constructor(src, title){
|
|
5
|
-
super("iframe", "YoutubePlayer");
|
|
6
|
-
const id = Str.isUrl(src)?getYouTubeVideoId(src):src
|
|
7
|
-
this.setAttr({
|
|
8
|
-
src:`https://www.youtube.com/embed/${id}`,
|
|
9
|
-
title,
|
|
10
|
-
ariaLabel : title ?? "Interactive YouTube video player for zikojs apps",
|
|
11
|
-
role:"application"
|
|
12
|
-
})
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function getYouTubeVideoId(url) {
|
|
16
|
-
const regex = /(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|embed)\/|.*[?&]v=)|youtu\.be\/|embed\/)([a-zA-Z0-9_-]{11})/;
|
|
17
|
-
const match = url.match(regex);
|
|
18
|
-
return match ? match[1] : null;
|
|
19
|
-
}
|
|
20
|
-
const YoutubePlayer = (id, title) => new ZikoUIYoutubePlayer(id, title);
|
|
21
|
-
export{
|
|
22
|
-
YoutubePlayer,
|
|
23
|
-
ZikoUIYoutubePlayer
|
|
24
|
-
}
|
|
File without changes
|
package/src/ui/elements/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./text/index.js";
|
|
2
|
-
export * from "./list/index.js";
|
|
3
|
-
export * from "./io/index.js";
|
|
4
|
-
export * from "./semantic/index.js";
|
|
5
|
-
export * from "./embaded/index.js";
|
|
6
|
-
export * from "./table/index.js";
|
|
7
|
-
export * from "./media/index.js";
|
|
8
|
-
export * from "./misc/index.js";
|
|
9
|
-
export * from "./flex/index.js"
|
|
10
|
-
export * from "./grid/index.js"
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { ZikoUIFlex } from "../../flex/index.js";
|
|
2
|
-
class ZikoUIForm extends ZikoUIFlex{
|
|
3
|
-
constructor(...items){
|
|
4
|
-
super("form", "Form");
|
|
5
|
-
this.append(...items);
|
|
6
|
-
this.setMethod("POST");
|
|
7
|
-
this.setAction("/");
|
|
8
|
-
}
|
|
9
|
-
setAction(action = "/"){
|
|
10
|
-
this.setAttr("action", action);
|
|
11
|
-
return this;
|
|
12
|
-
}
|
|
13
|
-
setMethod(method = "post"){
|
|
14
|
-
this.setAttr("method", method);
|
|
15
|
-
return this;
|
|
16
|
-
}
|
|
17
|
-
get data(){
|
|
18
|
-
let formData = new FormData(this.element);
|
|
19
|
-
this.items.forEach(n=>{
|
|
20
|
-
if(n.isInput||n.isSelect||n.isTextarea)formData.append(n.element.name, n.value)
|
|
21
|
-
})
|
|
22
|
-
return formData;
|
|
23
|
-
}
|
|
24
|
-
sendFormData(){
|
|
25
|
-
fetch(this.element.action, {
|
|
26
|
-
method: this.element.method,
|
|
27
|
-
body: this.data
|
|
28
|
-
})
|
|
29
|
-
.then(response => response.json())
|
|
30
|
-
.then(data => console.log(data))
|
|
31
|
-
.catch(error => console.error('Error:', error));
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
getByName(name){
|
|
35
|
-
return this.data.get(name);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const Form = (...items) => new ZikoUIForm(...items);
|
|
39
|
-
export{
|
|
40
|
-
Form,
|
|
41
|
-
ZikoUIForm
|
|
42
|
-
}
|