ziko 0.0.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/LICENSE +21 -0
- package/README.md +316 -0
- package/dist/ziko.cjs +9786 -0
- package/dist/ziko.js +9792 -0
- package/dist/ziko.min.js +9 -0
- package/dist/ziko.mjs +9567 -0
- package/package.json +55 -0
- package/src/App/Accessibility/index.js +0 -0
- package/src/App/Globals/__Target__.js +3 -0
- package/src/App/Globals/__UI__.js +38 -0
- package/src/App/Globals/__init__.js +8 -0
- package/src/App/Globals/index.js +3 -0
- package/src/App/Router/index.js +40 -0
- package/src/App/Seo/index.js +43 -0
- package/src/App/Themes/dark.js +885 -0
- package/src/App/Themes/index.js +11 -0
- package/src/App/Themes/light.js +255 -0
- package/src/App/app.js +37 -0
- package/src/App/index.js +11 -0
- package/src/Data/Api/fetchdom.js +14 -0
- package/src/Data/Api/index.js +4 -0
- package/src/Data/Api/preload.js +11 -0
- package/src/Data/Converter/canvas.js +25 -0
- package/src/Data/Converter/csv.js +33 -0
- package/src/Data/Converter/index.js +25 -0
- package/src/Data/Converter/json.js +80 -0
- package/src/Data/Converter/markdown.js +83 -0
- package/src/Data/Converter/svg.js +11 -0
- package/src/Data/Parser/markdown.js +0 -0
- package/src/Data/Parser/xml.js +47 -0
- package/src/Data/Strings/index.js +26 -0
- package/src/Data/decorators.js +0 -0
- package/src/Data/index.js +64 -0
- package/src/Graphics/Canvas/Elements/Basic/arc.js +43 -0
- package/src/Graphics/Canvas/Elements/Basic/image.js +0 -0
- package/src/Graphics/Canvas/Elements/Basic/line.js +26 -0
- package/src/Graphics/Canvas/Elements/Basic/path.js +0 -0
- package/src/Graphics/Canvas/Elements/Basic/points.js +48 -0
- package/src/Graphics/Canvas/Elements/Basic/polygon.js +7 -0
- package/src/Graphics/Canvas/Elements/Basic/polyline.js +0 -0
- package/src/Graphics/Canvas/Elements/Basic/rect.js +46 -0
- package/src/Graphics/Canvas/Elements/Basic/text.js +0 -0
- package/src/Graphics/Canvas/Elements/Chart/histogram.js +0 -0
- package/src/Graphics/Canvas/Elements/Chart/plot.js +0 -0
- package/src/Graphics/Canvas/Elements/Chart/scatter.js +2 -0
- package/src/Graphics/Canvas/Elements/Chart/stem.js +0 -0
- package/src/Graphics/Canvas/Elements/Element.js +115 -0
- package/src/Graphics/Canvas/Elements/Groupe.js +0 -0
- package/src/Graphics/Canvas/Elements/grid.js +0 -0
- package/src/Graphics/Canvas/Elements/index.js +13 -0
- package/src/Graphics/Canvas/Filter/index.js +0 -0
- package/src/Graphics/Canvas/Paint/index.js +0 -0
- package/src/Graphics/Canvas/Utils/color.js +8 -0
- package/src/Graphics/Canvas/Utils/floodFill.js +58 -0
- package/src/Graphics/Canvas/_canvas_offscreen +0 -0
- package/src/Graphics/Canvas/canvas.js +189 -0
- package/src/Graphics/Canvas/index.js +15 -0
- package/src/Graphics/Svg/Elements/ZikoSvgElement.js +28 -0
- package/src/Graphics/Svg/Elements/circle.js +34 -0
- package/src/Graphics/Svg/Elements/ellipse.js +29 -0
- package/src/Graphics/Svg/Elements/foreignObject.js +46 -0
- package/src/Graphics/Svg/Elements/grid.js +9 -0
- package/src/Graphics/Svg/Elements/groupe.js +29 -0
- package/src/Graphics/Svg/Elements/image.js +33 -0
- package/src/Graphics/Svg/Elements/line.js +29 -0
- package/src/Graphics/Svg/Elements/path.js +59 -0
- package/src/Graphics/Svg/Elements/polygon.js +31 -0
- package/src/Graphics/Svg/Elements/polyline.js +4 -0
- package/src/Graphics/Svg/Elements/rect.js +43 -0
- package/src/Graphics/Svg/Elements/text.js +26 -0
- package/src/Graphics/Svg/index.js +1 -0
- package/src/Graphics/Svg/svg.js +117 -0
- package/src/Graphics/index.js +61 -0
- package/src/Math/Calculus/Special Functions/bessel.js +31 -0
- package/src/Math/Calculus/Special Functions/beta.js +38 -0
- package/src/Math/Calculus/Special Functions/gamma.js +30 -0
- package/src/Math/Calculus/Special Functions/index.js +4 -0
- package/src/Math/Calculus/index.js +1 -0
- package/src/Math/Complex/Fractals/julia.js +0 -0
- package/src/Math/Complex/index.js +191 -0
- package/src/Math/Discret/Combinaison/index.js +34 -0
- package/src/Math/Discret/Conversion/index.js +86 -0
- package/src/Math/Discret/Logic/index.js +46 -0
- package/src/Math/Discret/Permutation/index.js +31 -0
- package/src/Math/Discret/Set/index.js +2 -0
- package/src/Math/Discret/Set/powerSet.js +15 -0
- package/src/Math/Discret/Set/subSet.js +10 -0
- package/src/Math/Discret/index.js +23 -0
- package/src/Math/Functions/index.js +182 -0
- package/src/Math/Matrix/Decomposition.js +90 -0
- package/src/Math/Matrix/LinearSystem.js +10 -0
- package/src/Math/Matrix/Matrix.js +712 -0
- package/src/Math/Matrix/index.js +3 -0
- package/src/Math/Numeric/index.js +0 -0
- package/src/Math/Random/index.js +173 -0
- package/src/Math/Signal/__np.py.txt +40 -0
- package/src/Math/Signal/conv.js +175 -0
- package/src/Math/Signal/fft.js +55 -0
- package/src/Math/Signal/filter.js +39 -0
- package/src/Math/Signal/functions.js +146 -0
- package/src/Math/Signal/index.js +110 -0
- package/src/Math/Statistics/Functions/index.js +100 -0
- package/src/Math/Statistics/index.js +16 -0
- package/src/Math/Utils/arithmetic.js +139 -0
- package/src/Math/Utils/checkers.js +11 -0
- package/src/Math/Utils/comparaison.js +1 -0
- package/src/Math/Utils/conversions.js +7 -0
- package/src/Math/Utils/discret.js +28 -0
- package/src/Math/Utils/index.js +102 -0
- package/src/Math/Utils/mapfun.js +43 -0
- package/src/Math/absract.js +1 -0
- package/src/Math/const.js +3 -0
- package/src/Math/index.js +193 -0
- package/src/Reactivity/Events/Global/Click.js +56 -0
- package/src/Reactivity/Events/Global/Clipboard.js +84 -0
- package/src/Reactivity/Events/Global/CustomEvent.js +53 -0
- package/src/Reactivity/Events/Global/Drag.js +137 -0
- package/src/Reactivity/Events/Global/Focus.js +56 -0
- package/src/Reactivity/Events/Global/Key.js +104 -0
- package/src/Reactivity/Events/Global/Pointer.js +214 -0
- package/src/Reactivity/Events/Partiel/Input.js +59 -0
- package/src/Reactivity/Events/ZikoEvent.js +91 -0
- package/src/Reactivity/Events/index.js +51 -0
- package/src/Reactivity/Observer/index.js +3 -0
- package/src/Reactivity/Observer/intersection.js +40 -0
- package/src/Reactivity/Observer/mutation.js +90 -0
- package/src/Reactivity/Observer/resize.js +47 -0
- package/src/Reactivity/Use/Contexte/index.js +1 -0
- package/src/Reactivity/Use/Contexte/useSuccesifKeys.js +14 -0
- package/src/Reactivity/Use/Decorators/index.js +4 -0
- package/src/Reactivity/Use/Interactions/index.js +4 -0
- package/src/Reactivity/Use/Interactions/useBluetooth.js +48 -0
- package/src/Reactivity/Use/Interactions/useChannel.js +50 -0
- package/src/Reactivity/Use/Interactions/useEventEmmiter.js +64 -0
- package/src/Reactivity/Use/Interactions/useSerial.js +0 -0
- package/src/Reactivity/Use/Interactions/useThread.js +44 -0
- package/src/Reactivity/Use/Interactions/useUsb.js +0 -0
- package/src/Reactivity/Use/Sensors/index.js +2 -0
- package/src/Reactivity/Use/Sensors/useBattery.js +36 -0
- package/src/Reactivity/Use/Sensors/useCamera.js +0 -0
- package/src/Reactivity/Use/Sensors/useGeolocation.js +17 -0
- package/src/Reactivity/Use/Sensors/useMicro.js +0 -0
- package/src/Reactivity/Use/Sensors/useOrientation.js +0 -0
- package/src/Reactivity/Use/Storage/index.js +1 -0
- package/src/Reactivity/Use/Storage/useCookie.js +0 -0
- package/src/Reactivity/Use/Storage/useIndexedDb.js +0 -0
- package/src/Reactivity/Use/Storage/useStorage.js +74 -0
- package/src/Reactivity/Use/UI/index.js +4 -0
- package/src/Reactivity/Use/UI/useCssLink.js +0 -0
- package/src/Reactivity/Use/UI/useCssText.js +21 -0
- package/src/Reactivity/Use/UI/useFavIcon.js +38 -0
- package/src/Reactivity/Use/UI/useLinearGradient.js +0 -0
- package/src/Reactivity/Use/UI/useMediaQuery.js +1 -0
- package/src/Reactivity/Use/UI/useRadialGradient.js +0 -0
- package/src/Reactivity/Use/UI/useStyle.js +54 -0
- package/src/Reactivity/Use/UI/useTheme.js +62 -0
- package/src/Reactivity/Use/UI/useTitle.js +30 -0
- package/src/Reactivity/Use/index.js +82 -0
- package/src/Reactivity/Use/todo.md +26 -0
- package/src/Reactivity/index.js +3 -0
- package/src/Time/animation.js +76 -0
- package/src/Time/index.js +54 -0
- package/src/Time/loop.js +83 -0
- package/src/Time/utils/decorators.js +17 -0
- package/src/Time/utils/ease.js +144 -0
- package/src/Time/utils/index.js +18 -0
- package/src/Time/utils/performance.js +16 -0
- package/src/Time/utils/ui.js +26 -0
- package/src/UI/CustomElement/Elements/Accordion/index.js +62 -0
- package/src/UI/CustomElement/Elements/Carousel/index.js +47 -0
- package/src/UI/CustomElement/Elements/CodeNote/CodeCell.js +176 -0
- package/src/UI/CustomElement/Elements/CodeNote/CodeNote.js +69 -0
- package/src/UI/CustomElement/Elements/CodeNote/SubElements.js +64 -0
- package/src/UI/CustomElement/Elements/CodeNote/index.js +2 -0
- package/src/UI/CustomElement/Elements/Columns.js +1 -0
- package/src/UI/CustomElement/Elements/FAB.js +0 -0
- package/src/UI/CustomElement/Elements/Menu.js +0 -0
- package/src/UI/CustomElement/Elements/Notification.js +0 -0
- package/src/UI/CustomElement/Elements/Popover.js +0 -0
- package/src/UI/CustomElement/Elements/Popup.js +0 -0
- package/src/UI/CustomElement/Elements/Swipper.js +4 -0
- package/src/UI/CustomElement/Elements/Tabs/index.js +111 -0
- package/src/UI/CustomElement/Elements/Timeline.js +0 -0
- package/src/UI/CustomElement/Elements/Toast.js +0 -0
- package/src/UI/CustomElement/Elements/Treeview.js +0 -0
- package/src/UI/CustomElement/Elements/index.js +4 -0
- package/src/UI/CustomElement/Flex.js +97 -0
- package/src/UI/CustomElement/Grid.js +30 -0
- package/src/UI/CustomElement/index.js +3 -0
- package/src/UI/Embaded/index.js +1 -0
- package/src/UI/Inputs/Primitives/btn.js +31 -0
- package/src/UI/Inputs/Primitives/elements.js +28 -0
- package/src/UI/Inputs/Primitives/inputs.js +334 -0
- package/src/UI/Inputs/Primitives/select.js +15 -0
- package/src/UI/Inputs/Primitives/textarea.js +16 -0
- package/src/UI/Inputs/camera.js +23 -0
- package/src/UI/Inputs/index.js +20 -0
- package/src/UI/List/elements.js +0 -0
- package/src/UI/List/index.js +130 -0
- package/src/UI/Media/Audio/index.js +26 -0
- package/src/UI/Media/Image/figure.js +17 -0
- package/src/UI/Media/Image/image.js +34 -0
- package/src/UI/Media/Image/index.js +2 -0
- package/src/UI/Media/Video/index.js +37 -0
- package/src/UI/Media/index.js +3 -0
- package/src/UI/Misc/index.js +49 -0
- package/src/UI/Semantic/index.js +68 -0
- package/src/UI/Style/index.js +499 -0
- package/src/UI/Table/elements.js +94 -0
- package/src/UI/Table/index.js +3 -0
- package/src/UI/Table/table.js +113 -0
- package/src/UI/Table/utils.js +12 -0
- package/src/UI/Text/heading.js +35 -0
- package/src/UI/Text/index.js +3 -0
- package/src/UI/Text/p.js +37 -0
- package/src/UI/Text/pre.js +0 -0
- package/src/UI/Text/text.js +66 -0
- package/src/UI/Utils/index.js +70 -0
- package/src/UI/ZikoUIElement.js +478 -0
- package/src/UI/index.js +154 -0
- package/src/__proto__/Array.js +74 -0
- package/src/__proto__/Function.js +0 -0
- package/src/__proto__/Number.js +76 -0
- package/src/__proto__/Object.js +0 -0
- package/src/__proto__/String.js +0 -0
- package/src/index.js +69 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import ZikoUIElement from "../ZikoUIElement.js"
|
|
2
|
+
import { tbody,caption,ZikoUICaption,thead} from "./elements.js";
|
|
3
|
+
import { matrix } from "../../Math/Matrix/index.js";
|
|
4
|
+
import { MatrixToTableUI } from "./utils.js";
|
|
5
|
+
class ZikoUITable extends ZikoUIElement {
|
|
6
|
+
constructor(body,{caption=null,head=null,foot=null}={}){
|
|
7
|
+
super("table","Table");
|
|
8
|
+
this.structure={
|
|
9
|
+
caption,
|
|
10
|
+
head,
|
|
11
|
+
body:null,
|
|
12
|
+
foot
|
|
13
|
+
}
|
|
14
|
+
if(body)this.fromMatrix(body);
|
|
15
|
+
if(caption)this.setCaption(caption)
|
|
16
|
+
this.render();
|
|
17
|
+
}
|
|
18
|
+
get caption(){
|
|
19
|
+
return this.structure.caption;
|
|
20
|
+
}
|
|
21
|
+
get header(){
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
get body(){
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
get footer(){
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
setCaption(c){
|
|
31
|
+
this.removeCaption();
|
|
32
|
+
this.structure.caption=caption(c);
|
|
33
|
+
this.append(this.structure.caption);
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
removeCaption(){
|
|
37
|
+
if(this.structure.caption)this.removeItem(...this.items.filter(n=>n instanceof ZikoUICaption));
|
|
38
|
+
this.structure.caption=null;
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
setHeader(...c){
|
|
42
|
+
this.tHead=thead(...c);
|
|
43
|
+
this.append(this.tHead);
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
removeHeader(){
|
|
47
|
+
this.removeItem(...this.items.filter(n=>n instanceof ZikoUICaption));
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
setFooter(c){
|
|
51
|
+
this.structure.caption=caption(c);
|
|
52
|
+
this.append(this.structure.caption);
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
removeFooter(){
|
|
56
|
+
this.removeItem(...this.items.filter(n=>n instanceof ZikoUICaption));
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
fromMatrix(bodyMatrix) {
|
|
60
|
+
(bodyMatrix instanceof Array)?this.bodyMatrix=matrix(bodyMatrix):this.bodyMatrix=bodyMatrix;
|
|
61
|
+
if(this.structure.body)this.remove(this.structure.body);
|
|
62
|
+
this.structure.body=tbody()
|
|
63
|
+
this.append(this.structure.body);
|
|
64
|
+
this.structure.body.append(...MatrixToTableUI(this.bodyMatrix))
|
|
65
|
+
//this.structure.body.append(...MatrixToTableUI(matrix))
|
|
66
|
+
//this.cellStyles({ padding: "0.2rem 0.4rem", textAlign: "center" });
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
transpose() {
|
|
70
|
+
this.fromMatrix(this.bodyMatrix.T);
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
hstack(m) {
|
|
74
|
+
if(m instanceof ZikoUITable)m=m.bodyMatrix
|
|
75
|
+
this.fromMatrix(this.bodyMatrix.clone.hstack(m));
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
vstack(m) {
|
|
79
|
+
if(m instanceof ZikoUITable)m=m.bodyMatrix
|
|
80
|
+
this.fromMatrix(this.bodyMatrix.clone.vstack(m));
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
slice(r0=0,c0=0,r1=this.bodyMatrix.rows-1,c1=this.bodyMatrix.cols-1) {
|
|
84
|
+
this.fromMatrix(this.bodyMatrix.slice(r0,c0,r1,c1));
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
sortByCols(n, config = { type: "num", order: "asc" }) {
|
|
88
|
+
this.fromMatrix(this.bodyMatrix.clone.sortTable(n, config));
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
91
|
+
sortByRows(n, config = { type: "num", order: "asc" }) {
|
|
92
|
+
this.fromMatrix(this.bodyMatrix.T.clone.sortTable(n, config).T);
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
filterByRows(item) {
|
|
96
|
+
this.fromMatrix(this.bodyMatrix.clone.filterByRows(item));
|
|
97
|
+
return this;
|
|
98
|
+
}
|
|
99
|
+
filterByCols(item) {
|
|
100
|
+
this.fromMatrix(this.bodyMatrix.clone.filterByCols(item));
|
|
101
|
+
return this;
|
|
102
|
+
}
|
|
103
|
+
forEachRow(callback){
|
|
104
|
+
this.structure.body.forEach(callback);
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
forEachItem(callback){
|
|
108
|
+
this.structure.body.forEach(n=>n.forEach(callback));
|
|
109
|
+
return this;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const Table=(matrix,config)=>new ZikoUITable(matrix,config)
|
|
113
|
+
export {Table}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { td,tr } from "./elements.js";
|
|
2
|
+
export const MatrixToTableUI=matrix=>{
|
|
3
|
+
var Tr = new Array(matrix.rows).fill(null).map(() => tr());
|
|
4
|
+
var Td = matrix.arr.map((n) => n.map(() => null));
|
|
5
|
+
for (let i = 0; i < Td.length; i++) {
|
|
6
|
+
for (let j = 0; j < Td[0].length; j++) {
|
|
7
|
+
Td[i][j] = td(matrix.arr[i][j]);
|
|
8
|
+
Tr[i].append(Td[i][j]);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return Tr
|
|
12
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import ZikoUIElement from "../ZikoUIElement.js";
|
|
2
|
+
class ZikoUIHeading extends ZikoUIElement {
|
|
3
|
+
constructor(type = 1, value = "") {
|
|
4
|
+
super(`h${type}`,`h${type}`);
|
|
5
|
+
this.element = document.createElement("h" + type);
|
|
6
|
+
this.element.textContent = value;
|
|
7
|
+
this.render();
|
|
8
|
+
}
|
|
9
|
+
get value() {
|
|
10
|
+
return this.element.innerText;
|
|
11
|
+
}
|
|
12
|
+
setValue(text = "") {
|
|
13
|
+
this.element.innerText = text;
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
addValue(text = "") {
|
|
17
|
+
this.element.innerText += text;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const h1=(text="")=>new ZikoUIHeading(1, text);
|
|
22
|
+
const h2=(text="")=>new ZikoUIHeading(2, text);
|
|
23
|
+
const h3=(text="")=>new ZikoUIHeading(3, text);
|
|
24
|
+
const h4=(text="")=>new ZikoUIHeading(4, text);
|
|
25
|
+
const h5=(text="")=>new ZikoUIHeading(5, text);
|
|
26
|
+
const h6=(text="")=>new ZikoUIHeading(6, text);
|
|
27
|
+
export{
|
|
28
|
+
h1,
|
|
29
|
+
h2,
|
|
30
|
+
h3,
|
|
31
|
+
h4,
|
|
32
|
+
h5,
|
|
33
|
+
h6,
|
|
34
|
+
ZikoUIHeading
|
|
35
|
+
}
|
package/src/UI/Text/p.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import ZikoUIElement from "../ZikoUIElement.js";
|
|
2
|
+
import {Complex} from "../../Math/Complex/index.js"
|
|
3
|
+
import { text } from "./text.js";
|
|
4
|
+
class ZikoUIParagraphe extends ZikoUIElement {
|
|
5
|
+
constructor(...value) {
|
|
6
|
+
super("p","p");
|
|
7
|
+
this.addValue(...value);
|
|
8
|
+
this.style({margin:0,padding:0});
|
|
9
|
+
this.render();
|
|
10
|
+
}
|
|
11
|
+
addValue(...value) {
|
|
12
|
+
for (let i = 0; i < value.length; i++) {
|
|
13
|
+
if (typeof value[i] == "string" || typeof value[i] == "number") {
|
|
14
|
+
this.element.appendChild(document.createTextNode(value[i]));
|
|
15
|
+
this.element.appendChild(document.createElement("br"));
|
|
16
|
+
} else if (value[i] instanceof ZikoUIElement)
|
|
17
|
+
this.element.appendChild(value[i].element);
|
|
18
|
+
else if (value[i] instanceof Complex)
|
|
19
|
+
text(value.a + " + " + value.b + "i");
|
|
20
|
+
}
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
clear() {
|
|
24
|
+
this.element.childNodes.forEach((e) => e.remove());
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
setValue(...value) {
|
|
28
|
+
this.clear();
|
|
29
|
+
this.addValue(...value);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const p = (...ZikoUIElement) => new ZikoUIParagraphe().append(...ZikoUIElement);
|
|
34
|
+
export {
|
|
35
|
+
p,
|
|
36
|
+
ZikoUIParagraphe
|
|
37
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import ZikoUIElement from "../ZikoUIElement.js";
|
|
2
|
+
import {Complex} from "../../Math/Complex/index.js";
|
|
3
|
+
import { __UI__ } from "../../App/Globals/__UI__.js";
|
|
4
|
+
class ZikoUIText extends ZikoUIElement {
|
|
5
|
+
constructor(...value) {
|
|
6
|
+
super("span","text");
|
|
7
|
+
this.element = document.createElement("span");
|
|
8
|
+
this.text = "";
|
|
9
|
+
this.addValue(...value);
|
|
10
|
+
this.st.display("inline-block");
|
|
11
|
+
this.render();
|
|
12
|
+
}
|
|
13
|
+
clear() {
|
|
14
|
+
this.element.textContent = "";
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
get value() {
|
|
18
|
+
return this.element.textContent;
|
|
19
|
+
}
|
|
20
|
+
setValue(value = "", add = false) {
|
|
21
|
+
if (["string", "number"].includes(typeof value)) {
|
|
22
|
+
this.text = "" + value;
|
|
23
|
+
if (this.text.includes("\n"))
|
|
24
|
+
this.text = this.text
|
|
25
|
+
.split("\n")
|
|
26
|
+
.map((n) => "<span>".concat(n, "</span></br>"))
|
|
27
|
+
.join("");
|
|
28
|
+
}
|
|
29
|
+
if (value instanceof Complex) this.text = "" + value.UI();
|
|
30
|
+
/*
|
|
31
|
+
else if (value instanceof Ziko.Math.Matrix) {
|
|
32
|
+
let string = "[";
|
|
33
|
+
for (let j = 0; j < value.arr.length; j++)
|
|
34
|
+
string +=
|
|
35
|
+
(j != 0 ? " " : "") +
|
|
36
|
+
`[${value.arr[j].map((n) => " " + n.toString() + " ")}],</br>`;
|
|
37
|
+
string = string.substring(0, string.length - 6) + "]";
|
|
38
|
+
this.text = "" + string;
|
|
39
|
+
}
|
|
40
|
+
*/
|
|
41
|
+
//else console.error("not supported yet")
|
|
42
|
+
if (add) this.element.innerHTML += this.text;
|
|
43
|
+
else this.element.innerHTML = this.text;
|
|
44
|
+
if (value instanceof Array || value instanceof Set) {
|
|
45
|
+
if (value instanceof Set) value = [...value];
|
|
46
|
+
this.addValue(...value);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
addValue(...value) {
|
|
50
|
+
value.map((n) => {
|
|
51
|
+
this.setValue(" ", true);
|
|
52
|
+
this.setValue(n, true);
|
|
53
|
+
});
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
toggleValues(...values) {
|
|
57
|
+
values = values.map((n) => "" + n);
|
|
58
|
+
let index = values.indexOf("" + this.value);
|
|
59
|
+
if (index != -1 && index != values.length - 1)
|
|
60
|
+
this.setValue(values[index + 1]);
|
|
61
|
+
else this.setValue(values[0]);
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const text = (...value) => new ZikoUIText(...value)
|
|
66
|
+
export {text}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import ZikoUIElement from "../ZikoUIElement.js";
|
|
2
|
+
const Id = (a) => document.getElementById(a);
|
|
3
|
+
const Class = (a) => [...document.getElementsByClassName(a)];
|
|
4
|
+
const $=(...selector)=>{
|
|
5
|
+
var ele=[]
|
|
6
|
+
for(let i=0;i<selector.length;i++){
|
|
7
|
+
if(typeof selector[i]=="string")ele.push(...document.querySelectorAll(selector[i]));
|
|
8
|
+
if(selector[i] instanceof ZikoUIElement)ele.push(selector[i].element)
|
|
9
|
+
}
|
|
10
|
+
return ele.length===1?ele[0]:ele;
|
|
11
|
+
}
|
|
12
|
+
const addSuffixeToNumber=(value,suffixe="px")=>{
|
|
13
|
+
if(typeof value === "number") value+=suffixe;
|
|
14
|
+
if(value instanceof Array)value=value.map(n=>typeof n==="number"?n+=suffixe:n).join(" ");
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
const style = (el, styles) => {if(el)Object.assign(el.style, styles)};
|
|
18
|
+
|
|
19
|
+
function script(src) {
|
|
20
|
+
const Script = document.createElement("script");
|
|
21
|
+
Script.setAttribute("src", src);
|
|
22
|
+
document.head.appendChild(Script);
|
|
23
|
+
}
|
|
24
|
+
function linkStyle(href) {
|
|
25
|
+
const link = document.createElement("link");
|
|
26
|
+
link.setAttribute("rel", "stylesheet");
|
|
27
|
+
link.setAttribute("href", href);
|
|
28
|
+
document.head.appendChild(link);
|
|
29
|
+
}
|
|
30
|
+
const CloneElement = (UIElement) => {
|
|
31
|
+
var clone = new UIElement.__proto__.constructor()
|
|
32
|
+
//waitForUIElm(UIElement).then(e=>console.log(e)).then(()=>clone = new UIElement.__proto__.constructor())
|
|
33
|
+
//let a = new UIElement.__proto__.constructor()
|
|
34
|
+
return clone;
|
|
35
|
+
};
|
|
36
|
+
const cloneUI=UIElement=>{
|
|
37
|
+
return Object.assign(Object.create(Object.getPrototypeOf(UIElement)),UIElement)
|
|
38
|
+
}
|
|
39
|
+
function isPrimitive(value) {
|
|
40
|
+
return typeof value !== 'object' && typeof value !== 'function' || value === null;
|
|
41
|
+
}
|
|
42
|
+
const waitElm=(UIElement)=>{
|
|
43
|
+
return new Promise(resolve => {
|
|
44
|
+
if (UIElement) {
|
|
45
|
+
return resolve(UIElement);
|
|
46
|
+
}
|
|
47
|
+
const observer = new MutationObserver(() => {
|
|
48
|
+
if (UIElement) {
|
|
49
|
+
resolve(UIElement);
|
|
50
|
+
observer.disconnect();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
observer.observe(document.body, {
|
|
54
|
+
childList: true,
|
|
55
|
+
subtree: true
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
export{
|
|
60
|
+
Id,
|
|
61
|
+
Class,
|
|
62
|
+
style,
|
|
63
|
+
script,
|
|
64
|
+
linkStyle,
|
|
65
|
+
CloneElement,
|
|
66
|
+
cloneUI,
|
|
67
|
+
isPrimitive,
|
|
68
|
+
addSuffixeToNumber,
|
|
69
|
+
waitElm
|
|
70
|
+
}
|