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,334 @@
|
|
|
1
|
+
import ZikoUIElement from "../../ZikoUIElement.js";
|
|
2
|
+
import { Input } from "../../../Reactivity/Events/index.js";
|
|
3
|
+
import { ZikoUIInputOption,ZikoUILabel } from "./elements.js";
|
|
4
|
+
import { btn } from "./btn.js";
|
|
5
|
+
import { Random } from "../../../Math/Random/index.js";
|
|
6
|
+
//import { select } from "./select.js";
|
|
7
|
+
//import { debounce,throttle} from "../../Data/decorators.js";
|
|
8
|
+
|
|
9
|
+
class ZikoUIInput extends ZikoUIElement {
|
|
10
|
+
constructor(value = "",datalist) {
|
|
11
|
+
super();
|
|
12
|
+
this.element = document.createElement("input");
|
|
13
|
+
Object.assign(this.events,{input:null})
|
|
14
|
+
this.setValue(value);
|
|
15
|
+
if(datalist)this.linkDatalist(datalist)
|
|
16
|
+
this.render();
|
|
17
|
+
}
|
|
18
|
+
onInput(...callbacks){
|
|
19
|
+
if(!this.events.input)this.events.input = Input(this);
|
|
20
|
+
this.events.input.onInput(...callbacks);
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
onChange(...callbacks){
|
|
24
|
+
if(!this.events.input)this.events.input = Input(this);
|
|
25
|
+
this.events.input.onChange(...callbacks);
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
linkDatalist(datalist) {
|
|
29
|
+
let id;
|
|
30
|
+
if(datalist instanceof ZikoUIInputDatalist)id=datalist.Id
|
|
31
|
+
else if(datalist instanceof Array){
|
|
32
|
+
const Datalist=new ZikoUIInputDatalist(...datalist);
|
|
33
|
+
id=Datalist.Id;
|
|
34
|
+
console.log(Datalist)
|
|
35
|
+
}
|
|
36
|
+
else id=datalist;
|
|
37
|
+
this.element.setAttribute("list", id);
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
get value() {
|
|
41
|
+
return this.element.value;
|
|
42
|
+
}
|
|
43
|
+
_setType(type) {
|
|
44
|
+
this.element.type = type;
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
setValue(value="") {
|
|
48
|
+
this.element.value = value;
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
useState(state){
|
|
52
|
+
this.setValue(state)
|
|
53
|
+
return [{value:this.value},e=>this.setValue(e)]
|
|
54
|
+
}
|
|
55
|
+
setPlaceholder(value) {
|
|
56
|
+
if(value)this.element.placeholder = value;
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
get isValide() {
|
|
60
|
+
return this.element.checkValidity();
|
|
61
|
+
}
|
|
62
|
+
setRequired(required = true) {
|
|
63
|
+
this.element.required = required;
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
select() {
|
|
67
|
+
this.element.select();
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
copy() {
|
|
71
|
+
this.element.select();
|
|
72
|
+
document.execCommand("copy");
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
cut() {
|
|
76
|
+
this.element.select();
|
|
77
|
+
document.execCommand("cut");
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
accept(value) {
|
|
81
|
+
this.element.accept = value;
|
|
82
|
+
return this;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
class ZikoUIInputSearch extends ZikoUIInput {
|
|
86
|
+
constructor() {
|
|
87
|
+
super();
|
|
88
|
+
this._setType("search");
|
|
89
|
+
this.Length = 0;
|
|
90
|
+
}
|
|
91
|
+
onsearch(callback) {
|
|
92
|
+
this.element.addEventListener("search", () => callback());
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
connect(...UIElement) {
|
|
96
|
+
/*
|
|
97
|
+
let memory = new Array(UIElement.length).fill([]);
|
|
98
|
+
UIElement.map((n, i) => {
|
|
99
|
+
//console.log(n)
|
|
100
|
+
n.items.map((m, j) => {
|
|
101
|
+
memory[i][j] = m.element.style.display;
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
UIElement.map((n, i) =>
|
|
105
|
+
this.onInput(() => {
|
|
106
|
+
n.filterByTextContent(this.value, memory[i]);
|
|
107
|
+
this.Length = n.children.filter(
|
|
108
|
+
(n) => n.style.display != "none"
|
|
109
|
+
).length;
|
|
110
|
+
})
|
|
111
|
+
);
|
|
112
|
+
*/
|
|
113
|
+
return this;
|
|
114
|
+
}
|
|
115
|
+
displayLength(UIElement) {
|
|
116
|
+
this.element.addEventListener("keyup", () =>
|
|
117
|
+
UIElement.setValue(this.Length)
|
|
118
|
+
);
|
|
119
|
+
return this;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
class ZikoUIInputNumber extends ZikoUIInput {
|
|
123
|
+
constructor(min, max ,step = 1) {
|
|
124
|
+
super();
|
|
125
|
+
this._setType("number");
|
|
126
|
+
this.setMin(min).setMax(max).setStep(step);
|
|
127
|
+
this.render();
|
|
128
|
+
}
|
|
129
|
+
get value() {
|
|
130
|
+
return +this.element.value;
|
|
131
|
+
}
|
|
132
|
+
setMin(min) {
|
|
133
|
+
this.element.min = min;
|
|
134
|
+
return this;
|
|
135
|
+
}
|
|
136
|
+
setMax(max) {
|
|
137
|
+
this.element.max = max;
|
|
138
|
+
return this;
|
|
139
|
+
}
|
|
140
|
+
setStep(step) {
|
|
141
|
+
this.element.step = step;
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
class ZikoUIInputSlider extends ZikoUIInputNumber {
|
|
146
|
+
constructor(val = 0, min = 0, max = 10, step = 1) {
|
|
147
|
+
super();
|
|
148
|
+
this._setType("range");
|
|
149
|
+
this.setMin(min).setMax(max).setValue(val).setStep(step);
|
|
150
|
+
this.render();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
class ZikoUIInputColor extends ZikoUIInput {
|
|
154
|
+
constructor() {
|
|
155
|
+
super();
|
|
156
|
+
this._setType("color");
|
|
157
|
+
this.background(this.value);
|
|
158
|
+
this.render();
|
|
159
|
+
this.onInput(() => this.background(this.value));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
class ZikoUIInputPassword extends ZikoUIInput {
|
|
163
|
+
constructor() {
|
|
164
|
+
super();
|
|
165
|
+
this._setType("password");
|
|
166
|
+
this.render();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
class ZikoUIInputEmail extends ZikoUIInput {
|
|
170
|
+
constructor() {
|
|
171
|
+
super();
|
|
172
|
+
this._setType("email");
|
|
173
|
+
this.render();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
class ZikoUIInputTime extends ZikoUIInput {
|
|
177
|
+
constructor() {
|
|
178
|
+
super();
|
|
179
|
+
this._setType("time");
|
|
180
|
+
this.render();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
class ZikoUIInputDate extends ZikoUIInput {
|
|
184
|
+
constructor() {
|
|
185
|
+
super();
|
|
186
|
+
this._setType("date");
|
|
187
|
+
this.render();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
class ZikoUIInputDateTime extends ZikoUIInput {
|
|
191
|
+
constructor() {
|
|
192
|
+
super();
|
|
193
|
+
this._setType("datetime-local");
|
|
194
|
+
this.render();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
class ZikoUIInputCheckbox extends ZikoUIInput {
|
|
198
|
+
constructor() {
|
|
199
|
+
super();
|
|
200
|
+
this._setType("checkbox");
|
|
201
|
+
this.cursor("pointer");
|
|
202
|
+
}
|
|
203
|
+
get checked() {
|
|
204
|
+
return this.element.checked;
|
|
205
|
+
}
|
|
206
|
+
check(checked = true) {
|
|
207
|
+
this.element.checked = checked;
|
|
208
|
+
return this;
|
|
209
|
+
}
|
|
210
|
+
color(color) {
|
|
211
|
+
this.element.style.accentColor = color;
|
|
212
|
+
return this;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
class ZikoUIInputRadio extends ZikoUIInput {
|
|
216
|
+
constructor() {
|
|
217
|
+
super();
|
|
218
|
+
this._setType("radio");
|
|
219
|
+
this.cursor("pointer");
|
|
220
|
+
}
|
|
221
|
+
get checked() {
|
|
222
|
+
return this.element.checked;
|
|
223
|
+
}
|
|
224
|
+
check(checked = true) {
|
|
225
|
+
this.element.checked = checked;
|
|
226
|
+
return this;
|
|
227
|
+
}
|
|
228
|
+
color(color) {
|
|
229
|
+
this.element.style.accentColor = color;
|
|
230
|
+
return this;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
class ZikoUIInputImage extends ZikoUIElement {
|
|
236
|
+
constructor(text = "File") {
|
|
237
|
+
super();
|
|
238
|
+
this._aux_element = btn(text).setTarget(this.Target);
|
|
239
|
+
this.element = document.createElement("input");
|
|
240
|
+
this.element.setAttribute("type", "file");
|
|
241
|
+
this.element.setAttribute("accept", "image");
|
|
242
|
+
this._aux_element.onClick(() => this.element.click());
|
|
243
|
+
this.element.onChange = this.handleImage.bind(this);
|
|
244
|
+
}
|
|
245
|
+
handleImage(e) {
|
|
246
|
+
const reader = new FileReader();
|
|
247
|
+
const img = new Image();
|
|
248
|
+
reader.onload = function (event) {
|
|
249
|
+
img.src = event.target.result;
|
|
250
|
+
console.log(img.src);
|
|
251
|
+
};
|
|
252
|
+
reader.readAsDataURL(e.target.files[0]);
|
|
253
|
+
this.img = img;
|
|
254
|
+
}
|
|
255
|
+
get value() {
|
|
256
|
+
return this.img;
|
|
257
|
+
}
|
|
258
|
+
render(bool = true) {
|
|
259
|
+
if (bool) this.Target.appendChild(this._aux_element.element);
|
|
260
|
+
else this.remove();
|
|
261
|
+
return this;
|
|
262
|
+
}
|
|
263
|
+
remove() {
|
|
264
|
+
if (this.Target.children.length) this.Target.removeChild(this._aux_element.element);
|
|
265
|
+
return this;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
class ZikoUIInputDatalist extends ZikoUIElement {
|
|
270
|
+
constructor(...options){
|
|
271
|
+
super();
|
|
272
|
+
this.element = document.createElement("datalist");
|
|
273
|
+
this.addOptions(...options).setId("ziko-datalist-id"+Random.string(10));
|
|
274
|
+
this.render();
|
|
275
|
+
}
|
|
276
|
+
addOptions(...options) {
|
|
277
|
+
options.map((n) => this.append(new ZikoUIInputOption(n)));
|
|
278
|
+
return this;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
const input = (value,datalist) => {
|
|
282
|
+
if(value instanceof Object){
|
|
283
|
+
const {datalist,placeholder}=value;
|
|
284
|
+
value=value.value??"";
|
|
285
|
+
return new ZikoUIInput(value,datalist).setPlaceholder(placeholder);
|
|
286
|
+
}
|
|
287
|
+
return new ZikoUIInput(value,datalist);
|
|
288
|
+
}
|
|
289
|
+
const datalist = (...options) => new ZikoUIInputDatalist(...options);
|
|
290
|
+
const slider = (value, min, max, step) =>{
|
|
291
|
+
if(value instanceof Object){
|
|
292
|
+
const {min=0,max=10,step=1}=value;
|
|
293
|
+
value=value?.value??5;
|
|
294
|
+
return new ZikoUIInputSlider(value, min, max, step);
|
|
295
|
+
}
|
|
296
|
+
return new ZikoUIInputSlider(value, min, max, step);
|
|
297
|
+
}
|
|
298
|
+
const inputNumber = (min,max,step) =>{
|
|
299
|
+
if(min instanceof Object){
|
|
300
|
+
const {value,max=10,step=1,placeholder=""}=min;
|
|
301
|
+
min=min?.min??0;
|
|
302
|
+
return new ZikoUIInputSlider(min, max, step).setValue(value).setPlaceholder(placeholder);
|
|
303
|
+
}
|
|
304
|
+
return new ZikoUIInputNumber(min,max,step);
|
|
305
|
+
}
|
|
306
|
+
const search = (...a) => new ZikoUIInputSearch().connect(...a);
|
|
307
|
+
const inputImage = (text) => new ZikoUIInputImage(text);
|
|
308
|
+
const inputPassword = () => new ZikoUIInputPassword();
|
|
309
|
+
const inputEmail = () => new ZikoUIInputEmail();
|
|
310
|
+
const inputColor = () => new ZikoUIInputColor();
|
|
311
|
+
const inputTime = () => new ZikoUIInputTime();
|
|
312
|
+
const inputDate = () => new ZikoUIInputDate();
|
|
313
|
+
const inputDateTime = () => new ZikoUIInputDateTime();
|
|
314
|
+
const checkbox = () => new ZikoUIInputCheckbox();
|
|
315
|
+
const radio = () => new ZikoUIInputRadio();
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
export {
|
|
319
|
+
input,
|
|
320
|
+
search,
|
|
321
|
+
slider,
|
|
322
|
+
checkbox,
|
|
323
|
+
radio,
|
|
324
|
+
datalist,
|
|
325
|
+
inputNumber,
|
|
326
|
+
inputColor,
|
|
327
|
+
inputDate,
|
|
328
|
+
inputDateTime,
|
|
329
|
+
inputEmail,
|
|
330
|
+
inputImage,
|
|
331
|
+
inputPassword,
|
|
332
|
+
inputTime,
|
|
333
|
+
};
|
|
334
|
+
export {textarea} from "./textarea.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import ZikoUIElement from "../../ZikoUIElement.js";
|
|
2
|
+
import { ZikoUIInputOption } from "./elements.js";
|
|
3
|
+
class ZikoUISelect extends ZikoUIElement {
|
|
4
|
+
constructor(){
|
|
5
|
+
super();
|
|
6
|
+
this.element=document.createElement("select");
|
|
7
|
+
this.render()
|
|
8
|
+
}
|
|
9
|
+
addOptions(...options) {
|
|
10
|
+
options.map(n => this.append(new ZikoUIInputOption(n)));
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const select=()=>new ZikoUISelect()
|
|
15
|
+
export{select,ZikoUISelect}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import ZikoUIElement from "../../ZikoUIElement.js";
|
|
2
|
+
|
|
3
|
+
class ZikoUITextArea extends ZikoUIElement {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.element = document.createElement("textarea");
|
|
7
|
+
//Object.assign(this,inputComposer.call(this));
|
|
8
|
+
this.render();
|
|
9
|
+
}
|
|
10
|
+
get value(){
|
|
11
|
+
return this.element.textContent;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const textarea =()=> new ZikoUITextArea();
|
|
16
|
+
export {textarea}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ZikoUIVideo } from "../Media";
|
|
2
|
+
class ZikoUIWebcame extends ZikoUIVideo{
|
|
3
|
+
constructor(){
|
|
4
|
+
super()
|
|
5
|
+
this.element.setAttribute("src", "");
|
|
6
|
+
this.constraints = { audio: true, video: { width: 1280, height: 720 } };
|
|
7
|
+
//this.video=this.element
|
|
8
|
+
}
|
|
9
|
+
start(){
|
|
10
|
+
navigator.mediaDevices.getUserMedia(this.constraints).then((mediaStream)=>{
|
|
11
|
+
this.element.srcObject = mediaStream;
|
|
12
|
+
this.element.onloadedmetadata = () =>{
|
|
13
|
+
this.element.play();
|
|
14
|
+
};
|
|
15
|
+
})
|
|
16
|
+
.catch(function(err) { console.log(err.name + ": " + err.message); });
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const inputCamera=()=>new ZikoUIWebcame();
|
|
21
|
+
export{
|
|
22
|
+
inputCamera
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export {btn} from "./Primitives/btn.js"
|
|
2
|
+
export {
|
|
3
|
+
input,
|
|
4
|
+
search,
|
|
5
|
+
slider,
|
|
6
|
+
checkbox,
|
|
7
|
+
radio,
|
|
8
|
+
datalist,
|
|
9
|
+
inputNumber,
|
|
10
|
+
inputColor,
|
|
11
|
+
inputDate,
|
|
12
|
+
inputDateTime,
|
|
13
|
+
inputEmail,
|
|
14
|
+
inputImage,
|
|
15
|
+
inputPassword,
|
|
16
|
+
inputTime,
|
|
17
|
+
} from "./Primitives/inputs.js"
|
|
18
|
+
export {textarea} from "./Primitives/textarea.js";
|
|
19
|
+
export {select} from "./Primitives/select.js";
|
|
20
|
+
export {inputCamera} from "./camera.js"
|
|
File without changes
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import ZikoUIElement from "../ZikoUIElement.js";
|
|
2
|
+
import {text} from "../Text/index.js";
|
|
3
|
+
class ZikoUILI extends ZikoUIElement{
|
|
4
|
+
constructor(UI){
|
|
5
|
+
super();
|
|
6
|
+
this.element=document.createElement("li");
|
|
7
|
+
this.append(UI);
|
|
8
|
+
this.render()
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
class ZikoUIList extends ZikoUIElement {
|
|
12
|
+
constructor(element,name) {
|
|
13
|
+
super(element,name);
|
|
14
|
+
delete this.append;
|
|
15
|
+
//this.style({ listStylePosition: "inside" });
|
|
16
|
+
}
|
|
17
|
+
append(...arr){
|
|
18
|
+
for (let i = 0; i < arr.length; i++) {
|
|
19
|
+
let li = null;
|
|
20
|
+
if(["string","number"].includes(typeof arr[i]))arr[i]=text(arr[i])
|
|
21
|
+
if (arr[i] instanceof ZikoUIElement)li=new ZikoUILI(arr[i]);
|
|
22
|
+
li.setTarget(this.element)
|
|
23
|
+
this.items.push(li[0]);
|
|
24
|
+
this.maintain();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
remove(...ele) {
|
|
28
|
+
if(ele.length==0){
|
|
29
|
+
if(this.Target.children.length) this.Target.removeChild(this.element);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const remove = (ele) => {
|
|
33
|
+
if(typeof ele === "number") ele=this.items[ele];
|
|
34
|
+
if(ele instanceof ZikoUIElement)this.element.removeChild(ele.parent.element);
|
|
35
|
+
this.items=this.items.filter(n=>n!==ele);
|
|
36
|
+
};
|
|
37
|
+
for (let i = 0; i < ele.length; i++) remove(ele[i]);
|
|
38
|
+
for (let i = 0; i < this.items.length; i++)
|
|
39
|
+
Object.assign(this, { [[i]]: this.items[i] });
|
|
40
|
+
}
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
insertAt(index, ...ele) {
|
|
44
|
+
if (index >= this.element.children.length) this.append(...ele);
|
|
45
|
+
else
|
|
46
|
+
for (let i = 0; i < ele.length; i++) {
|
|
47
|
+
let li = null;
|
|
48
|
+
if(["number","string"].includes(typeof ele[i]))ele[i]=text(ele[i]);
|
|
49
|
+
if (ele[i] instanceof ZikoUIElement)li=new ZikoUILI(ele[i]);
|
|
50
|
+
this.element.insertBefore(li.element, this.items[index].parent.element);
|
|
51
|
+
this.items.splice(index, 0, ele[i][0]);
|
|
52
|
+
}
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
filterByTextContent(text,exactMatch=false){
|
|
56
|
+
this.items.map(n=>n.parent.render());
|
|
57
|
+
this.items.filter(n=>{
|
|
58
|
+
const content=n.element.textContent
|
|
59
|
+
return !(exactMatch?content===text:content.includes(text))
|
|
60
|
+
}).map(n=>n.parent.render(false));
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
sortByTextContent(order=1){
|
|
64
|
+
this.items.map(n=>n.parent.render(false));
|
|
65
|
+
// To Fix
|
|
66
|
+
this.sortedItems=this.items.sort((a,b)=>order*a.element.textContent.localeCompare(b.element.textContent))
|
|
67
|
+
this.append(...this.sortedItems);
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
filterByClass(value) {
|
|
71
|
+
this.items.map(n=>n.parent.render(true));
|
|
72
|
+
this.items.filter(n=>!n.Classes.includes(value)).map(n=>n.parent.render(false));
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
delete(value) {
|
|
76
|
+
const valueIndex = [...this.element.children].indexOf(value);
|
|
77
|
+
return valueIndex;
|
|
78
|
+
/*if(valueIndex >= 0) {
|
|
79
|
+
return this.list.splice(valueIndex, 1);
|
|
80
|
+
}*/
|
|
81
|
+
}
|
|
82
|
+
push(){
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
pop(){
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
unshift(){
|
|
89
|
+
|
|
90
|
+
}
|
|
91
|
+
shift(){
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
sort(){
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
filter(){
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
slice(){
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
class ZikoUIOList extends ZikoUIList{
|
|
105
|
+
constructor(...arr){
|
|
106
|
+
super("ol","ol");
|
|
107
|
+
this.append(...arr);
|
|
108
|
+
this.render();
|
|
109
|
+
}
|
|
110
|
+
type(tp = 1) {
|
|
111
|
+
this.element.setAttribute("type", tp);
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
114
|
+
start(st = 1) {
|
|
115
|
+
this.element.setAttribute("start", st);
|
|
116
|
+
return this;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
class ZikoUIUList extends ZikoUIList{
|
|
120
|
+
constructor(...arr){
|
|
121
|
+
super("ul","ul");
|
|
122
|
+
this.append(...arr);
|
|
123
|
+
this.render();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const li=UI=>new ZikoUILI(UI)
|
|
127
|
+
const ol = (...arr) => new ZikoUIOList(...arr);
|
|
128
|
+
const ul = (...arr) => new ZikoUIUList(...arr);
|
|
129
|
+
|
|
130
|
+
export{ol,ul,li}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import ZikoUIElement from "../../ZikoUIElement";
|
|
2
|
+
class ZikoUIAudio extends ZikoUIElement {
|
|
3
|
+
constructor(src) {
|
|
4
|
+
super("audio","audio");
|
|
5
|
+
this.element.setAttribute("src", src);
|
|
6
|
+
this.render();
|
|
7
|
+
this.controls();
|
|
8
|
+
}
|
|
9
|
+
useControls(enabled = true) {
|
|
10
|
+
this.element.controls = enabled;
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
play() {
|
|
14
|
+
this.element.play();
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
pause() {
|
|
18
|
+
this.element.pause();
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const audio = (src) => new ZikoUIAudio(src);
|
|
23
|
+
export {
|
|
24
|
+
audio,
|
|
25
|
+
ZikoUIAudio
|
|
26
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import ZikoUIElement from "../../ZikoUIElement";
|
|
2
|
+
class ZikoUIFigure extends ZikoUIElement{
|
|
3
|
+
constructor(src,caption){
|
|
4
|
+
super("figure","figure")
|
|
5
|
+
this.img=src.width("100%").element;
|
|
6
|
+
this.caption=document.createElement("figcaption");
|
|
7
|
+
this.caption.append(caption.element)
|
|
8
|
+
this.element.append(this.img);
|
|
9
|
+
this.element.append(this.caption);
|
|
10
|
+
this.render();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const figure =(image,caption) =>new ZikoUIFigure(image,caption);
|
|
14
|
+
export{
|
|
15
|
+
figure,
|
|
16
|
+
ZikoUIFigure
|
|
17
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import ZikoUIElement from "../../ZikoUIElement.js";
|
|
2
|
+
class ZikoUIImage extends ZikoUIElement {
|
|
3
|
+
constructor(src, w, h) {
|
|
4
|
+
super("image","image");
|
|
5
|
+
this.value=src;
|
|
6
|
+
if (src.nodeName === "IMG")this.element.setAttribute("src", src.src);
|
|
7
|
+
else this.element.setAttribute("src", src);
|
|
8
|
+
if (typeof w == "number") w += "%";
|
|
9
|
+
if (typeof h == "number") h += "%";
|
|
10
|
+
this.style({ border: "1px solid black", width: w, height: h });
|
|
11
|
+
this.render();
|
|
12
|
+
}
|
|
13
|
+
updateSrc(url){
|
|
14
|
+
this.value=url;
|
|
15
|
+
this.element.src=url;
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
toggleSrc(...values){
|
|
19
|
+
values=values.map(n=>""+n);
|
|
20
|
+
let index=values.indexOf(""+this.value);
|
|
21
|
+
if(index!=-1&&index!=(values.length-1))this.updateSrc(values[index+1]);
|
|
22
|
+
else this.updateSrc(values[0]);
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
alt(alt){
|
|
26
|
+
this.element.alt=alt;
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const image = (src, width, height) => new ZikoUIImage(src, width, height);
|
|
31
|
+
export{
|
|
32
|
+
image,
|
|
33
|
+
ZikoUIImage
|
|
34
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import ZikoUIElement from "../../ZikoUIElement.js";
|
|
2
|
+
class ZikoUIVideo extends ZikoUIElement {
|
|
3
|
+
constructor(src="", w = "100%", h = "50vh") {
|
|
4
|
+
super("video","video");
|
|
5
|
+
if (src.nodeName === "VIDEO") this.element.setAttribute("src", src.src);
|
|
6
|
+
else this.element.setAttribute("src", src);
|
|
7
|
+
if (typeof w == "number") w += "%";
|
|
8
|
+
if (typeof h == "number") h += "%";
|
|
9
|
+
this.style({ width: w, height: h });
|
|
10
|
+
this.render();
|
|
11
|
+
}
|
|
12
|
+
useControls(enabled = true) {
|
|
13
|
+
this.element.controls = enabled;
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
play() {
|
|
17
|
+
this.element.play();
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
pause() {
|
|
21
|
+
this.element.pause();
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
poster(src=""){
|
|
25
|
+
this.element.poster=src;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
usePIP(e){
|
|
29
|
+
this.element.requestPictureInPicture(e);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const video = (src, width, height) => new ZikoUIVideo(src, width, height);
|
|
34
|
+
export {
|
|
35
|
+
video,
|
|
36
|
+
ZikoUIVideo
|
|
37
|
+
}
|