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,176 @@
|
|
|
1
|
+
import { Flex, ZikoUIFlex } from "../../Flex";
|
|
2
|
+
import { ZikoUICodeNote } from "./CodeNote";
|
|
3
|
+
import {
|
|
4
|
+
Input,
|
|
5
|
+
Output,
|
|
6
|
+
Right,
|
|
7
|
+
Left
|
|
8
|
+
} from "./SubElements";
|
|
9
|
+
class ZikoUICodeCell extends ZikoUIFlex{
|
|
10
|
+
constructor(code="",{type="js",order=null}={}){
|
|
11
|
+
super("section")
|
|
12
|
+
Object.assign(this.cache,{
|
|
13
|
+
state:null,
|
|
14
|
+
order,
|
|
15
|
+
type,
|
|
16
|
+
metadata:{
|
|
17
|
+
created:Date.now(),
|
|
18
|
+
updated:null
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
this.Input=Input(code);
|
|
22
|
+
this.Output=Output();
|
|
23
|
+
this.InOut=Flex(
|
|
24
|
+
this.Input,
|
|
25
|
+
this.Output
|
|
26
|
+
).vertical().style({
|
|
27
|
+
width:"100%",
|
|
28
|
+
margin:"10px auto"
|
|
29
|
+
});
|
|
30
|
+
this.RightControl=Right(this);
|
|
31
|
+
this.LeftControl=Left(this)
|
|
32
|
+
this.append(
|
|
33
|
+
this.LeftControl,
|
|
34
|
+
this.InOut,
|
|
35
|
+
this.RightControl
|
|
36
|
+
)
|
|
37
|
+
this.horizontal(-1,1).style({
|
|
38
|
+
//background:"#444",
|
|
39
|
+
width:"95vw",
|
|
40
|
+
margin:"0 auto",
|
|
41
|
+
border:"1px darkblue dotted"
|
|
42
|
+
})
|
|
43
|
+
this.Input.onKeyDown(e=>{
|
|
44
|
+
if(e.kd==="Enter"){
|
|
45
|
+
if(e.event.shiftKey){
|
|
46
|
+
e.event.preventDefault();
|
|
47
|
+
this.execute(this.cache.order);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
//console.log(this.Input.element.firstChild.firstChild.textContent.at(-1))
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if(this.cache.parent instanceof ZikoUICodeNote){
|
|
54
|
+
if(e.kd==="ArrowDown" && e.event.shiftKey ){
|
|
55
|
+
this.cache.parent.next();
|
|
56
|
+
}
|
|
57
|
+
if(e.kd==="ArrowUp" && e.event.shiftKey){
|
|
58
|
+
this.cache.parent.previous();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
this.Input.onFocus(()=>{
|
|
64
|
+
if(this.cache.parent instanceof ZikoUICodeNote){
|
|
65
|
+
this.cache.parent.cache.currentNote=this;
|
|
66
|
+
this.cache.parent.setCurrentNote(this);
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
this.Input.onPaste((e)=>{
|
|
70
|
+
//e.event.preventDefault();
|
|
71
|
+
//this.setValue(this.codeText.trim())
|
|
72
|
+
})
|
|
73
|
+
// this.Input.onKeyPress(e=>{
|
|
74
|
+
// if(e.kp==="(")a.Input.element.textContent+=")";
|
|
75
|
+
// if(e.kp==="[")a.Input.element.textContent+="]";
|
|
76
|
+
// if(e.kp==="{")a.Input.element.textContent+="}";
|
|
77
|
+
// })
|
|
78
|
+
}
|
|
79
|
+
// space  
|
|
80
|
+
get codeText() {
|
|
81
|
+
return this.Input.element.innerText.trim();
|
|
82
|
+
}
|
|
83
|
+
get codeHTML() {
|
|
84
|
+
return this.Input.element.innerHTML;
|
|
85
|
+
}
|
|
86
|
+
get outputHTML(){
|
|
87
|
+
return this.Output.element.innerHTML;
|
|
88
|
+
}
|
|
89
|
+
setValue(codeText){
|
|
90
|
+
this.Input[0].setValue(codeText);
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
cellData(){
|
|
94
|
+
return {
|
|
95
|
+
input:this.codeText,
|
|
96
|
+
output:this.outputHTML,
|
|
97
|
+
order:this.cache.order,
|
|
98
|
+
type:this.cache.type
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
execute(order){
|
|
102
|
+
this.clearOutput();
|
|
103
|
+
this.evaluate(order);
|
|
104
|
+
this.cache.metadata.updated=Date.now();
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
#evaluateJs(order){
|
|
108
|
+
try{
|
|
109
|
+
this.LeftControl[0].setValue("pending");
|
|
110
|
+
this.cache.state="pending";
|
|
111
|
+
globalThis.eval(this.Input.element.innerText);
|
|
112
|
+
}
|
|
113
|
+
catch(err){
|
|
114
|
+
console.log(err)
|
|
115
|
+
text(`Error : ${err.message}`).style({
|
|
116
|
+
color:"red",
|
|
117
|
+
background:"gold",
|
|
118
|
+
border:"2px red solid",
|
|
119
|
+
padding:"10px",
|
|
120
|
+
margin:"10px 0",
|
|
121
|
+
display:"flex",
|
|
122
|
+
justifyContent: "center",
|
|
123
|
+
});
|
|
124
|
+
this.LeftControl[0].setValue("Err");
|
|
125
|
+
this.cache.state="Error";
|
|
126
|
+
}
|
|
127
|
+
finally{
|
|
128
|
+
if(this.cache.state==="pending"){
|
|
129
|
+
this.cache.state="success";
|
|
130
|
+
this.setOrder(order);
|
|
131
|
+
if(this.cache.parent instanceof ZikoUICodeNote){
|
|
132
|
+
this.cache.parent.incrementOrder();
|
|
133
|
+
this.cache.parent.next();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
#evaluateMd(){
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
#evaluateHtml(){
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
evaluate(order){
|
|
145
|
+
globalThis.__Target__=this.Output.element;
|
|
146
|
+
switch(this.cache.type){
|
|
147
|
+
case "js":this.#evaluateJs(order);break;
|
|
148
|
+
}
|
|
149
|
+
return this;
|
|
150
|
+
}
|
|
151
|
+
clearInput(){
|
|
152
|
+
this.Output.element.innerText="";
|
|
153
|
+
return this;
|
|
154
|
+
}
|
|
155
|
+
clearOutput(){
|
|
156
|
+
this.Output.element.innerText="";
|
|
157
|
+
return this;
|
|
158
|
+
}
|
|
159
|
+
setOrder(order,render=true){
|
|
160
|
+
this.cache.order=order;
|
|
161
|
+
if(render){
|
|
162
|
+
(typeof order === "number")?this.LeftControl[0].setValue(`[${order}]`):this.LeftControl[0].setValue("[-]");
|
|
163
|
+
}
|
|
164
|
+
return this;
|
|
165
|
+
}
|
|
166
|
+
focus(){
|
|
167
|
+
this.Input.element.focus();
|
|
168
|
+
return this;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
const CodeCell=(codeText,{type,order}={})=>new ZikoUICodeCell(codeText,{type,order});
|
|
174
|
+
export{
|
|
175
|
+
CodeCell
|
|
176
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ZikoUIFlex } from "../../Flex";
|
|
2
|
+
import { CodeCell } from "./CodeCell";
|
|
3
|
+
class ZikoUICodeNote extends ZikoUIFlex{
|
|
4
|
+
constructor(){
|
|
5
|
+
super("section");
|
|
6
|
+
Object.assign(this.cache,{
|
|
7
|
+
order:0,
|
|
8
|
+
currentNote:null,
|
|
9
|
+
currentNoteIndex:null
|
|
10
|
+
})
|
|
11
|
+
this.vertical(0,0);
|
|
12
|
+
}
|
|
13
|
+
setCurrentNote(currentNote){
|
|
14
|
+
this.cache.currentNote=currentNote;
|
|
15
|
+
this.cache.currentNoteIndex=this.items.findIndex(n=>n===currentNote);
|
|
16
|
+
currentNote.focus();
|
|
17
|
+
this.items.forEach(n=>n.Input.style({
|
|
18
|
+
border: "1px solid #ccc"
|
|
19
|
+
}))
|
|
20
|
+
currentNote.Input.style({
|
|
21
|
+
border:"2px lightgreen solid"
|
|
22
|
+
});
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
addNote(text=""){
|
|
26
|
+
this.append(CodeCell(text));
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
execute(){
|
|
30
|
+
this.cache.currentNote.execute();
|
|
31
|
+
this.incrementOrder();
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
incrementOrder(){
|
|
35
|
+
this.cache.order++;
|
|
36
|
+
this.cache.currentNote.setOrder(this.cache.order);
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
next(){
|
|
40
|
+
if(this.cache.currentNote===this.items.at(-1)){
|
|
41
|
+
this.addNote();
|
|
42
|
+
this.setCurrentNote(this.items.at(-1));
|
|
43
|
+
}
|
|
44
|
+
else this.setCurrentNote(this.items[this.cache.currentNoteIndex+1]);
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
previous(){
|
|
48
|
+
// add append before
|
|
49
|
+
if(this.cache.currentNote!==this.items[0]){
|
|
50
|
+
this.setCurrentNote(this.items[this.cache.currentNoteIndex-1]);
|
|
51
|
+
}
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
data(){
|
|
55
|
+
return this.items.map(n=>n.cellData());
|
|
56
|
+
}
|
|
57
|
+
serialize(){
|
|
58
|
+
return JSON.stringify(this.data());
|
|
59
|
+
}
|
|
60
|
+
import(data=[]){
|
|
61
|
+
data.forEach((n,i)=>this.addNote(data[i].input));
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const CodeNote=()=>new ZikoUICodeNote();
|
|
66
|
+
export{
|
|
67
|
+
CodeNote,
|
|
68
|
+
ZikoUICodeNote
|
|
69
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ZikoHtml } from "../../../Misc";
|
|
2
|
+
import { Flex } from "../../Flex";
|
|
3
|
+
import { text } from "../../../Text";
|
|
4
|
+
import { ZikoUICodeNote } from "./CodeNote";
|
|
5
|
+
const Input=(codeText="")=>ZikoHtml("code",codeText).style({
|
|
6
|
+
width:"100%",
|
|
7
|
+
height:"auto",
|
|
8
|
+
padding:"10px",
|
|
9
|
+
boxSizing:"border-box",
|
|
10
|
+
border: "1px solid #ccc",
|
|
11
|
+
outline: "none",
|
|
12
|
+
fontSize: "1rem",
|
|
13
|
+
fontFamily: "Lucida Console, Courier New, monospace",
|
|
14
|
+
padding: "1rem 0.5rem",
|
|
15
|
+
wordBreak:"break-all",
|
|
16
|
+
background:"#f6f8fa",
|
|
17
|
+
color:"#0062C3"
|
|
18
|
+
}).setAttr("contenteditable",true).setAttr("spellcheck",false);
|
|
19
|
+
const Output=()=>ZikoHtml("output").style({
|
|
20
|
+
width:"100%",
|
|
21
|
+
height:"auto",
|
|
22
|
+
padding:"5px 0",
|
|
23
|
+
})
|
|
24
|
+
const Left=(ctx)=>Flex(
|
|
25
|
+
text("[ ]")
|
|
26
|
+
).style({
|
|
27
|
+
width:"50px",
|
|
28
|
+
//height:getComputedStyle(ctx.Input.element).height,
|
|
29
|
+
height:"50px",
|
|
30
|
+
margin:"10px 4px",
|
|
31
|
+
padding:"5px",
|
|
32
|
+
color:"darkblue",
|
|
33
|
+
borderBottom:"4px solid gold",
|
|
34
|
+
}).horizontal(0,0);
|
|
35
|
+
const BTN_STYLE={
|
|
36
|
+
background:"none",
|
|
37
|
+
width:"25px",
|
|
38
|
+
height:"25px",
|
|
39
|
+
fontSize:"1.2rem",
|
|
40
|
+
cursor:"pointer"
|
|
41
|
+
}
|
|
42
|
+
const Right=(ctx)=>Flex(
|
|
43
|
+
text('▶️').style(BTN_STYLE).onClick(e=>{
|
|
44
|
+
if(ctx.parent instanceof ZikoUICodeNote)ctx.parent.setCurrentNote(ctx);
|
|
45
|
+
ctx.execute();
|
|
46
|
+
globalThis.__Target__=e.target.parent.parent[1][1];
|
|
47
|
+
}),
|
|
48
|
+
text('📋').style(BTN_STYLE).onClick(()=>{
|
|
49
|
+
navigator.clipboard.writeText(ctx.codeText)
|
|
50
|
+
}),
|
|
51
|
+
text('✖️').style(BTN_STYLE).onClick(()=>ctx.remove()),
|
|
52
|
+
text('✖️').style(BTN_STYLE).onClick(()=>ctx.remove()),
|
|
53
|
+
).style({
|
|
54
|
+
width:"70px",
|
|
55
|
+
height:"50px",
|
|
56
|
+
//background:"cyan",
|
|
57
|
+
margin:"10px 0"
|
|
58
|
+
}).horizontal(0,0).wrap(true);
|
|
59
|
+
export{
|
|
60
|
+
Input,
|
|
61
|
+
Output,
|
|
62
|
+
Right,
|
|
63
|
+
Left
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// dipslay table
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Next
|
|
2
|
+
// Previous
|
|
3
|
+
// Vertical
|
|
4
|
+
// Horizontal
|
|
5
|
+
import { Flex, ZikoUIFlex } from "../../Flex";
|
|
6
|
+
class ZikoUITabs extends ZikoUIFlex{
|
|
7
|
+
#ACTIVE_ELEMENT_INDEX=0;
|
|
8
|
+
constructor(Controllers,Contents){
|
|
9
|
+
super("div","Tabs");
|
|
10
|
+
this.style({
|
|
11
|
+
boxSizing:"border-box",
|
|
12
|
+
backgroundColor: "blanchedalmond",
|
|
13
|
+
border:"1px red solid",
|
|
14
|
+
margin:"30px",
|
|
15
|
+
})
|
|
16
|
+
this.append(
|
|
17
|
+
Flex().size("auto","auto").style({
|
|
18
|
+
boxSizing:"border-box",
|
|
19
|
+
justifyContent:"center",
|
|
20
|
+
alignItems:"center",
|
|
21
|
+
textAlign:"center",
|
|
22
|
+
|
|
23
|
+
minWidth:"50px",
|
|
24
|
+
minHeight:"50px",
|
|
25
|
+
|
|
26
|
+
backgroundColor:"darkblue",
|
|
27
|
+
border:"1px darkblue solid",
|
|
28
|
+
|
|
29
|
+
}),
|
|
30
|
+
Flex().style({
|
|
31
|
+
boxSizing:"border-box",
|
|
32
|
+
justifyContent:"center",
|
|
33
|
+
alignItems:"center",
|
|
34
|
+
textAlign:"center",
|
|
35
|
+
|
|
36
|
+
width:"100%",
|
|
37
|
+
height:"100%",
|
|
38
|
+
backgroundColor:"darkslategrey",
|
|
39
|
+
})
|
|
40
|
+
)
|
|
41
|
+
this.Controller=this.items[0].setAttr("role","tablist");
|
|
42
|
+
this.Content=this.items[1];
|
|
43
|
+
if(Controllers.length!==Contents.length)console.error("")
|
|
44
|
+
else {
|
|
45
|
+
this.Controller.append(...Controllers);
|
|
46
|
+
this.Content.append(...Contents);
|
|
47
|
+
// Add transition
|
|
48
|
+
}
|
|
49
|
+
this.init()
|
|
50
|
+
this.display(0);
|
|
51
|
+
}
|
|
52
|
+
init(){
|
|
53
|
+
// Remove old listener
|
|
54
|
+
for(let i=0;i<this.Controller.length;i++){
|
|
55
|
+
this.Controller[i].setAttr("role","tab").setAttr("aria-controls",`tab${i}`);
|
|
56
|
+
this.Content[i].setAttr("role","tabpanel").setAttr("aria-labelledby",`tab${i}`).setAttr("tabindex",-1);
|
|
57
|
+
}
|
|
58
|
+
this.Controller.forEach(item=>item.onClick(e=>{
|
|
59
|
+
const tab=e.target.element.getAttribute("aria-controls");
|
|
60
|
+
const index=+tab.slice(3)
|
|
61
|
+
this.Content.filter(n=>n.element.getAttribute("aria-labelledby")===tab,()=>{
|
|
62
|
+
if(this.#ACTIVE_ELEMENT_INDEX!==index)this.display(index);
|
|
63
|
+
})
|
|
64
|
+
}))
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
addPairs(ControllerItem,ContentItem){
|
|
68
|
+
this.Controller.append(ControllerItem);
|
|
69
|
+
this.Content.append(ContentItem);
|
|
70
|
+
const length=this.Controller.length;
|
|
71
|
+
this.Controller.at(-1).setAttr("role","tab").setAttr("aria-controls",`tab${length-1}`);
|
|
72
|
+
this.Content.at(-1).setAttr("role","tabpanel").setAttr("aria-labelledby",`tab${length-1}`).setAttr("tabindex",-1);
|
|
73
|
+
// Add listener
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
removePairs(index){
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
display(index){
|
|
80
|
+
this.#ACTIVE_ELEMENT_INDEX=index%this.Content.length;
|
|
81
|
+
this.Controller.forEach(n=>n.setAttr("tabindex",-1).setAttr("aria-selected",false));
|
|
82
|
+
this.Controller.at(this.#ACTIVE_ELEMENT_INDEX).setAttr("tabindex",0).setAttr("aria-selected",true);
|
|
83
|
+
(async ()=>{
|
|
84
|
+
await this.Content.forEach(n=>n.st.hide());
|
|
85
|
+
await this.Content.at(this.#ACTIVE_ELEMENT_INDEX).setAttr("tabindex",0).st.show();
|
|
86
|
+
})()
|
|
87
|
+
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
next(i=1){
|
|
91
|
+
this.display(this.#ACTIVE_ELEMENT_INDEX+i);
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
previous(i=1){
|
|
95
|
+
this.display(this.#ACTIVE_ELEMENT_INDEX-i);
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
useHorizontalSwippe(){
|
|
99
|
+
this.onPtrDown();
|
|
100
|
+
this.onPtrUp(e=>this.next(Math.sign(e.swippe.delta_x)));
|
|
101
|
+
return this;
|
|
102
|
+
}
|
|
103
|
+
useVerticalSwippe(){
|
|
104
|
+
this.onPtrDown();
|
|
105
|
+
this.onPtrUp(e=>this.next(Math.sign(e.swippe.delta_y)));
|
|
106
|
+
return this;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const Tabs=(Controllers,Contents)=>new ZikoUITabs(Controllers,Contents)
|
|
111
|
+
export {Tabs}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import ZikoUIElement from "../ZikoUIElement.js"
|
|
2
|
+
function set_vertical(direction){
|
|
3
|
+
direction == 1
|
|
4
|
+
? this.style({ flexDirection: "column" })
|
|
5
|
+
: direction == -1 && this.style({ flexDirection: "column-reverse" });
|
|
6
|
+
return this;
|
|
7
|
+
}
|
|
8
|
+
function set_horizontal(direction){
|
|
9
|
+
direction == 1
|
|
10
|
+
? this.style({ flexDirection: "row" })
|
|
11
|
+
: direction == -1 && this.style({ flexDirection: "row-reverse" });
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
function map_pos_x(align){
|
|
15
|
+
let pos = ["flex-start", "center", "flex-end"];
|
|
16
|
+
if (typeof align === "number") align = pos[align + 1];
|
|
17
|
+
return align;
|
|
18
|
+
}
|
|
19
|
+
function map_pos_y(align){
|
|
20
|
+
return map_pos_x(-align);
|
|
21
|
+
}
|
|
22
|
+
class ZikoUIFlex extends ZikoUIElement {
|
|
23
|
+
constructor(tag , w = "100%", h = "100%") {
|
|
24
|
+
super(tag,"Flex");
|
|
25
|
+
this.direction = "cols";
|
|
26
|
+
if (typeof w == "number") w += "%";
|
|
27
|
+
if (typeof h == "number") h += "%";
|
|
28
|
+
this.style({ width: w, height: h });
|
|
29
|
+
this.style({ display: "flex" });
|
|
30
|
+
this.render();
|
|
31
|
+
}
|
|
32
|
+
resp(px,wrap = true) {
|
|
33
|
+
this.wrap(wrap);
|
|
34
|
+
if (this.element.clientWidth < px) this.vertical();
|
|
35
|
+
else this.horizontal();
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
setSpaceAround() {
|
|
39
|
+
this.style({ justifyContent: "space-around" });
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
setSpaceBetween() {
|
|
43
|
+
this.style({ justifyContent: "space-between" });
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
setBaseline() {
|
|
47
|
+
this.style({ alignItems: "baseline" });
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
gap(g) {
|
|
51
|
+
if (this.direction === "row") this.style({ columnGap: g });
|
|
52
|
+
else if (this.direction === "column") this.style({ rowGap: g });
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
wrap(value = "wrap") {
|
|
56
|
+
const values = ["no-wrap", "wrap","wrap-reverse"];
|
|
57
|
+
this.style({
|
|
58
|
+
flexWrap: typeof value === "string" ? value : values[+value],
|
|
59
|
+
});
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
_justifyContent(align = "center") {
|
|
63
|
+
this.style({ justifyContent: align });
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
vertical(x, y, order=1) {
|
|
67
|
+
set_vertical.call(this,order)
|
|
68
|
+
this.style({
|
|
69
|
+
alignItems: typeof(x)==="number"?map_pos_x.call(this,x):x,
|
|
70
|
+
justifyContent: typeof(y)=="number"?map_pos_y.call(this,y):y
|
|
71
|
+
});
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
horizontal(x, y, order=1) {
|
|
75
|
+
set_horizontal.call(this,order)
|
|
76
|
+
this.style({
|
|
77
|
+
alignItems: typeof(y)=="number"?map_pos_y.call(this,y):y,
|
|
78
|
+
justifyContent: typeof(x)==="number"?map_pos_x.call(this,x):x
|
|
79
|
+
});
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
show() {
|
|
83
|
+
this.isHidden = false;
|
|
84
|
+
this.style({ display: "flex" });
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const Flex = (...ZikoUIElement) =>{
|
|
90
|
+
let tag="div";
|
|
91
|
+
if(typeof ZikoUIElement[0]==="string"){
|
|
92
|
+
tag=ZikoUIElement[0];
|
|
93
|
+
ZikoUIElement.pop();
|
|
94
|
+
}
|
|
95
|
+
return new ZikoUIFlex(tag).append(...ZikoUIElement);
|
|
96
|
+
}
|
|
97
|
+
export{Flex,ZikoUIFlex}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import ZikoUIElement from "../ZikoUIElement.js"
|
|
2
|
+
class ZikoUIGrid extends ZikoUIElement {
|
|
3
|
+
constructor(tag ="div", w = "50vw", h = "50vh") {
|
|
4
|
+
super(tag,"Grid");
|
|
5
|
+
this.direction = "cols";
|
|
6
|
+
if (typeof w == "number") w += "%";
|
|
7
|
+
if (typeof h == "number") h += "%";
|
|
8
|
+
this.style({ border: "1px solid black", width: w, height: h });
|
|
9
|
+
this.style({ display: "grid" });
|
|
10
|
+
this.render();
|
|
11
|
+
}
|
|
12
|
+
columns(n) {
|
|
13
|
+
let temp = "";
|
|
14
|
+
for (let i = 0; i < n; i++) temp = temp.concat(" auto");
|
|
15
|
+
this.#templateColumns(temp);
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
#templateColumns(temp = "auto auto") {
|
|
19
|
+
this.style({ gridTemplateColumns: temp });
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
gap(w = 10, h = w) {
|
|
23
|
+
if(typeof (w) === "number")w += "px";
|
|
24
|
+
if(typeof (h) === "number")h += "px";
|
|
25
|
+
this.style({gridColumnGap: w,gridRowGap: h});
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const Grid = (...ZikoUIElement) => new ZikoUIGrid("div").append(...ZikoUIElement);
|
|
30
|
+
export {Grid,ZikoUIGrid};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import ZikoUIElement from "../../ZikoUIElement.js";
|
|
2
|
+
class ZikoUIBtn extends ZikoUIElement {
|
|
3
|
+
constructor(value = "button") {
|
|
4
|
+
super();
|
|
5
|
+
this.element = document.createElement("button");
|
|
6
|
+
this.setValue(value);
|
|
7
|
+
this.render();
|
|
8
|
+
this.st.cursor("pointer");
|
|
9
|
+
}
|
|
10
|
+
setValue(value) {
|
|
11
|
+
if (value instanceof ZikoUIElement) value.setTarget(this.element);
|
|
12
|
+
else {
|
|
13
|
+
this.element.appendChild(document.createTextNode(""));
|
|
14
|
+
this.element.childNodes[0].data = value;
|
|
15
|
+
}
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
get value() {
|
|
19
|
+
return this.element.innerText;
|
|
20
|
+
}
|
|
21
|
+
toggleValues(...values) {
|
|
22
|
+
values = values.map((n) => "" + n);
|
|
23
|
+
let index = values.indexOf("" + this.value);
|
|
24
|
+
if (index != -1 && index != values.length - 1)
|
|
25
|
+
this.setValue(values[index + 1]);
|
|
26
|
+
else this.setValue(values[0]);
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const btn = (value) => new ZikoUIBtn(value);
|
|
31
|
+
export{btn}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import ZikoUIElement from "../../ZikoUIElement.js";
|
|
2
|
+
class ZikoUILabel extends ZikoUIElement{
|
|
3
|
+
constructor(){
|
|
4
|
+
super();
|
|
5
|
+
this.element=document.createElement("label");
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
class ZikoUIInputOption extends ZikoUIElement {
|
|
9
|
+
constructor(value = "") {
|
|
10
|
+
super();
|
|
11
|
+
this.element = document.createElement("option");
|
|
12
|
+
if(value instanceof Object&&"value" in value){
|
|
13
|
+
this.setValue(value.value);
|
|
14
|
+
this.setText(value?.text??value.value)
|
|
15
|
+
}
|
|
16
|
+
else this.setValue(value);
|
|
17
|
+
}
|
|
18
|
+
setValue(str = "") {
|
|
19
|
+
this.element.value = str;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
setText(text=""){
|
|
23
|
+
if(text)this.element.textContent=text;
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//const op=(n)=>new ZikoUIInputOption(n)
|
|
28
|
+
export{ZikoUILabel,ZikoUIInputOption}
|