ziko 0.37.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/ziko.cjs +1160 -3365
  2. package/dist/ziko.js +6179 -8384
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +1153 -3251
  5. package/package.json +15 -13
  6. package/readme.md +79 -5
  7. package/src/__ziko__/__cache__.js +6 -0
  8. package/src/__ziko__/__config__.js +19 -0
  9. package/src/__ziko__/__hydration__.js +8 -0
  10. package/src/__ziko__/__ui__.js +22 -0
  11. package/src/__ziko__/index.js +16 -0
  12. package/src/__ziko__/params.js +40 -0
  13. package/src/app/globals.js +14 -0
  14. package/src/app/index.js +4 -4
  15. package/src/app/spa-file-based-routing.js +2 -2
  16. package/src/app/ziko-app.js +1 -1
  17. package/src/data/converter/svg.js +2 -2
  18. package/src/hooks/index.js +3 -0
  19. package/src/hooks/use-derived.js +61 -0
  20. package/src/hooks/use-reactive.js +7 -0
  21. package/src/hooks/use-state.js +47 -0
  22. package/src/index.js +1 -78
  23. package/src/math/complex/index.js +3 -0
  24. package/src/math/functions/index.js +23 -23
  25. package/src/math/functions/proxy.js +58 -0
  26. package/src/math/utils/mapfun.js +17 -21
  27. package/src/no-module.js +32 -0
  28. package/src/time/{animation.js → animation/index.js} +2 -2
  29. package/src/time/decorators/index.js +17 -0
  30. package/src/time/index.js +11 -12
  31. package/src/time/utils/index.js +0 -1
  32. package/src/ui/{methods → __methods__}/dom.js +15 -14
  33. package/src/ui/{utils → __utils__}/index.js +1 -1
  34. package/src/ui/constructors/{ziko-ui-element.js → ZikoUIElement.js} +9 -98
  35. package/src/ui/constructors/ZikoUIElementMethodesToBeMoved.js +96 -0
  36. package/src/ui/{style → constructors/style}/index.js +3 -3
  37. package/src/ui/{elements/flex → flex}/index.js +1 -1
  38. package/src/{graphics/canvas/index.js → ui/graphics/canvas.js} +4 -5
  39. package/src/ui/graphics/index.js +2 -0
  40. package/src/{graphics/svg/index.js → ui/graphics/svg.js} +1 -1
  41. package/src/ui/{elements/grid → grid}/index.js +1 -1
  42. package/src/ui/index.js +9 -40
  43. package/src/ui/{elements/misc/suspense.js → suspense/index.js} +1 -15
  44. package/src/ui/tags/index.js +3 -3
  45. package/src/ui/text/index.js +15 -0
  46. package/src/ui/{elements/misc/xml-wrapper.js → wrapper/index.js} +1 -1
  47. package/src/use/index.js +3 -7
  48. package/src/graphics/canvas/_canvas_offscreen +0 -0
  49. package/src/graphics/canvas/utils/color.js +0 -8
  50. package/src/graphics/canvas/utils/floodFill.js +0 -57
  51. package/src/graphics/index.js +0 -10
  52. package/src/time/utils/decorators.js +0 -17
  53. package/src/ui/elements/embaded/html.js +0 -20
  54. package/src/ui/elements/embaded/index.js +0 -3
  55. package/src/ui/elements/embaded/pdf.js +0 -17
  56. package/src/ui/elements/embaded/youtube.js +0 -24
  57. package/src/ui/elements/hydrate.js +0 -0
  58. package/src/ui/elements/index.js +0 -10
  59. package/src/ui/elements/io/Form/index.js +0 -42
  60. package/src/ui/elements/io/Form/index.js.txt +0 -104
  61. package/src/ui/elements/io/Inputs/__helpers__.js +0 -52
  62. package/src/ui/elements/io/Inputs/index.js +0 -12
  63. package/src/ui/elements/io/Inputs/input/index.js +0 -99
  64. package/src/ui/elements/io/Inputs/input-camera/index.js +0 -26
  65. package/src/ui/elements/io/Inputs/input-checkbox/index.js +0 -26
  66. package/src/ui/elements/io/Inputs/input-color/index.js +0 -16
  67. package/src/ui/elements/io/Inputs/input-date-time/index.js +0 -3
  68. package/src/ui/elements/io/Inputs/input-date-time/input-date-time.js +0 -14
  69. package/src/ui/elements/io/Inputs/input-date-time/input-date.js +0 -14
  70. package/src/ui/elements/io/Inputs/input-date-time/input-time.js +0 -14
  71. package/src/ui/elements/io/Inputs/input-email-password/index.js +0 -2
  72. package/src/ui/elements/io/Inputs/input-email-password/input-email.js +0 -15
  73. package/src/ui/elements/io/Inputs/input-email-password/input-password.js +0 -14
  74. package/src/ui/elements/io/Inputs/input-file/index.js +0 -1
  75. package/src/ui/elements/io/Inputs/input-file/input-file.js +0 -0
  76. package/src/ui/elements/io/Inputs/input-file/input-image.js +0 -43
  77. package/src/ui/elements/io/Inputs/input-number/index.js +0 -37
  78. package/src/ui/elements/io/Inputs/input-radio/index.js +0 -26
  79. package/src/ui/elements/io/Inputs/input-search/index.js +0 -45
  80. package/src/ui/elements/io/Inputs/input-slider/index.js +0 -34
  81. package/src/ui/elements/io/Select/index.js +0 -20
  82. package/src/ui/elements/io/Textarea/index.js +0 -18
  83. package/src/ui/elements/io/index.js +0 -4
  84. package/src/ui/elements/list/elements.js +0 -0
  85. package/src/ui/elements/list/index.js +0 -138
  86. package/src/ui/elements/media/Audio/index.js +0 -17
  87. package/src/ui/elements/media/Image/figure.js +0 -19
  88. package/src/ui/elements/media/Image/image.js +0 -37
  89. package/src/ui/elements/media/Image/index.js +0 -2
  90. package/src/ui/elements/media/Video/index.js +0 -27
  91. package/src/ui/elements/media/__ZikoUIDynamicMediaELement__.js +0 -47
  92. package/src/ui/elements/media/index.js +0 -3
  93. package/src/ui/elements/misc/hyperscript.js +0 -144
  94. package/src/ui/elements/misc/index.js +0 -101
  95. package/src/ui/elements/semantic/index.js +0 -42
  96. package/src/ui/elements/table/elements.js +0 -94
  97. package/src/ui/elements/table/index.js +0 -3
  98. package/src/ui/elements/table/table.js +0 -115
  99. package/src/ui/elements/table/utils.js +0 -12
  100. package/src/ui/elements/text/__ZikoUIText__.js +0 -70
  101. package/src/ui/elements/text/heading.js +0 -36
  102. package/src/ui/elements/text/index.js +0 -3
  103. package/src/ui/elements/text/p.js +0 -26
  104. package/src/ui/elements/text/pre.js +0 -0
  105. package/src/ui/elements/text/text.js +0 -81
  106. package/src/use/use-debounce.js +0 -4
  107. package/src/use/use-state.js +0 -22
  108. package/src/use/use-throttle.js +0 -9
  109. /package/src/reactivity/hooks/{Head → head}/_useCssText.js +0 -0
  110. /package/src/reactivity/hooks/{Head → head}/index.js +0 -0
  111. /package/src/reactivity/hooks/{Head → head}/useFavIcon.js +0 -0
  112. /package/src/reactivity/hooks/{Head → head}/useHead.js +0 -0
  113. /package/src/reactivity/hooks/{Head → head}/useMeta.js +0 -0
  114. /package/src/reactivity/hooks/{Head → head}/useTitle.js +0 -0
  115. /package/src/time/{loop.js → loop/index.js} +0 -0
  116. /package/src/ui/{methods → __methods__}/events.js +0 -0
  117. /package/src/ui/{methods → __methods__}/indexing.js +0 -0
  118. /package/src/ui/{methods → __methods__}/observer.js +0 -0
  119. /package/src/ui/{methods → __methods__}/style.js +0 -0
  120. /package/src/ui/constructors/{ziko-ui-node.js → ZikoUINode.js} +0 -0
  121. /package/src/ui/tags/{tags.js → tags-list.js} +0 -0
@@ -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
+ }
@@ -1,4 +1,4 @@
1
- import ZikoUIElement from "../../constructors/ziko-ui-element.js";
1
+ import ZikoUIElement from "../constructors/ZikoUIElement.js";
2
2
  class ZikoUIXMLWrapper extends ZikoUIElement{
3
3
  constructor(XMLContent, type){
4
4
  super("div", "")
package/src/use/index.js CHANGED
@@ -1,10 +1,6 @@
1
- export * from "./use-state.js"
2
- export * from './use-debounce.js';
3
- export * from './use-throttle.js';
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'
File without changes
@@ -1,8 +0,0 @@
1
- const hex2rgba = (hex) => {
2
- return {
3
- r: parseInt(hex.slice(1, 3), 16),
4
- g: parseInt(hex.slice(3, 5), 16),
5
- b: parseInt(hex.slice(5, 7), 16),
6
- a: 255,
7
- };
8
- };
@@ -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;
@@ -1,10 +0,0 @@
1
- export * from "./svg"
2
- export * from "./canvas"
3
- import * as SVG from "./svg"
4
- import * as CANVAS from "./canvas"
5
-
6
- const Graphics = {
7
- ...SVG,
8
- ...CANVAS
9
- }
10
- export default Graphics
@@ -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,3 +0,0 @@
1
- export * from "./html.js"
2
- export * from "./pdf.js"
3
- export * from "./youtube.js"
@@ -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
@@ -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
- }
@@ -1,104 +0,0 @@
1
- import { ZikoUIFlex } from "../../custom-elements/Flex";
2
-
3
- class ZikoUIForm extends ZikoUIFlex {
4
- constructor(...items) {
5
- super("form", "Form");
6
- this.append(...items);
7
- this.setMethod("POST");
8
- // this.setAction("/");
9
- // this.addCSRFToken(); // Add CSRF token field by default
10
- }
11
- setAction(action = "/") {
12
- // Ensure the action URL is trusted before setting it
13
- if (this.isTrustedURL(action)) {
14
- this.setAttr("action", action);
15
- } else {
16
- throw new Error('Untrusted action URL.');
17
- }
18
- return this;
19
- }
20
- setMethod(method = "post") {
21
- const validMethods = ["post", "get"];
22
- if (validMethods.includes(method.toLowerCase())) {
23
- this.setAttr("method", method);
24
- } else {
25
- throw new Error('Invalid HTTP method.');
26
- }
27
- return this;
28
- }
29
-
30
- get data() {
31
- const formData = new FormData(this.element);
32
- this.items.forEach(n => {
33
- if (n.isInput || n.isSelect || n.isTextarea) {
34
- // Sanitize input values before appending
35
- formData.append(n.element.name, this.#sanitizeInput(n.value));
36
- }
37
- });
38
- return formData;
39
- }
40
-
41
- // Sanitize input data to prevent XSS
42
- #sanitizeInput(input) {
43
- const div = document?.createElement('div');
44
- div.textContent = input;
45
- return div.innerHTML;
46
- }
47
-
48
- // Include a CSRF token in the form
49
- addCSRFToken() {
50
- const token = this.getCSRFTokenFromServer();
51
- const hiddenInput = document?.createElement('input');
52
- hiddenInput.type = 'hidden';
53
- hiddenInput.name = 'csrf_token';
54
- hiddenInput.value = token;
55
- this.element?.append(hiddenInput);
56
- }
57
-
58
- // Method to fetch CSRF token from the server (mocked here)
59
- getCSRFTokenFromServer() {
60
- // Replace with real token fetching logic
61
- return 'mocked_csrf_token';
62
- }
63
-
64
- sendFormData() {
65
- fetch(this.element.action, {
66
- method: this.element.method,
67
- body: this.data,
68
- headers: {
69
- 'X-CSRF-Token': this.getByName('csrf_token'), // Add CSRF token header
70
- }
71
- })
72
- .then(response => {
73
- if (!response.ok) {
74
- throw new Error('Network response was not ok');
75
- }
76
- return response.json();
77
- })
78
- .then(data => console.log('Success:', data))
79
- .catch(error => {
80
- console.error('Error:', error.message || error);
81
- });
82
- return this;
83
- }
84
-
85
- getByName(name) {
86
- return this.data.get(name);
87
- }
88
-
89
- // Check if the action URL is trusted
90
- isTrustedURL(url) {
91
- const trustedDomains = ['/','yourdomain.com', 'anothertrustedsite.com'];
92
- try {
93
- const urlObj = new URL(url);
94
- return trustedDomains.includes(urlObj.hostname);
95
- } catch (e) {
96
- return false;
97
- }
98
- }
99
- }
100
- const Form = (...items) => new ZikoUIForm(...items);
101
- export {
102
- Form,
103
- ZikoUIForm
104
- };
@@ -1,52 +0,0 @@
1
- import ZikoUIElement from "../../../constructors/ziko-ui-element.js";
2
- import { Random } from "../../../../math/index.js";
3
- class ZikoUILabel extends ZikoUIElement{
4
- constructor(){
5
- super();
6
- this.element=document?.createElement("label");
7
- }
8
- get isLabel(){
9
- return true;
10
- }
11
- }
12
- class ZikoUIInputOption extends ZikoUIElement {
13
- constructor(value = "") {
14
- super();
15
- this.element = document?.createElement("option");
16
- if(value instanceof Object&&"value" in value){
17
- this.setValue(value.value);
18
- this.setText(value?.text??value.value)
19
- }
20
- else this.setValue(value);
21
- }
22
- setValue(str = "") {
23
- this.element.value = str;
24
- return this;
25
- }
26
- setText(text=""){
27
- if(text)this.element.textContent=text;
28
- return this;
29
- }
30
- }
31
- class ZikoUIInputDatalist extends ZikoUIElement {
32
- constructor(...options){
33
- super();
34
- this.element = document?.createElement("datalist");
35
- this.addOptions(...options).setId("ziko-datalist-id"+Random.string(10));
36
- }
37
- get isDatalist(){
38
- return true;
39
- }
40
- addOptions(...options) {
41
- options.map((n) => this.append(new ZikoUIInputOption(n)));
42
- return this;
43
- }
44
- }
45
-
46
- const datalist = (...options) => new ZikoUIInputDatalist(...options);
47
- export{
48
- datalist,
49
- ZikoUIInputDatalist,
50
- ZikoUILabel,
51
- ZikoUIInputOption
52
- }
@@ -1,12 +0,0 @@
1
- export * from "./input/index.js";
2
- export * from "./input-number/index.js";
3
- export * from "./input-slider/index.js";
4
- export * from "./input-color/index.js";
5
- export * from "./input-search/index.js";
6
- export * from "./input-checkbox/index.js";
7
- export * from "./input-radio/index.js";
8
- export * from "./input-email-password/index.js";
9
- export * from "./input-date-time/index.js";
10
- export * from "./input-file/index.js";
11
- export * from "./input-camera/index.js";
12
- export * from "./__helpers__.js";
@@ -1,99 +0,0 @@
1
- import ZikoUIElement from "../../../../constructors/ziko-ui-element.js";
2
- import { useInputEvent } from "../../../../../reactivity/index.js";
3
- class ZikoUIInput extends ZikoUIElement {
4
- constructor(type, name , value = "", datalist) {
5
- super("input", "input");
6
- Object.assign(this.events, { input: null });
7
- this.setValue(value);
8
- this.setAttr("type", type);
9
- this.setAttr("name", name);
10
- // this.setAttr("tab-index","0")
11
- if (datalist) this.linkDatalist(datalist);
12
- }
13
- get isInput() {
14
- return true;
15
- }
16
- setName(name){
17
- this.setAttr("name", name);
18
- return this;
19
- }
20
- onInput(...callbacks) {
21
- if (!this.events.input) this.events.input = useInputEvent(this);
22
- this.events.input.onInput(...callbacks);
23
- return this;
24
- }
25
- onChange(...callbacks) {
26
- if (!this.events.input) this.events.input = useInputEvent(this);
27
- this.events.input.onChange(...callbacks);
28
- return this;
29
- }
30
- linkDatalist(datalist) {
31
- let id;
32
- if (datalist instanceof ZikoUIInputDatalist) id = datalist.Id;
33
- else if (datalist instanceof Array) {
34
- const Datalist = new ZikoUIInputDatalist(...datalist);
35
- id = Datalist.Id;
36
- console.log(Datalist);
37
- } else id = datalist;
38
- this.element?.setAttribute("list", id);
39
- return this;
40
- }
41
- get value() {
42
- return this.element.value;
43
- }
44
- // _setType(type) {
45
- // this.element.type = type;
46
- // return this;
47
- // }
48
- setValue(value = "") {
49
- this.element.value = value;
50
- return this;
51
- }
52
- useState(state) {
53
- this.setValue(state);
54
- return [{ value: this.value }, (e) => this.setValue(e)];
55
- }
56
- setPlaceholder(value) {
57
- if (value) this.element.placeholder = value;
58
- return this;
59
- }
60
- get isValide() {
61
- return this.element.checkValidity();
62
- }
63
- setRequired(required = true) {
64
- this.element.required = required;
65
- return this;
66
- }
67
- select() {
68
- this.element.select();
69
- return this;
70
- }
71
- copy() {
72
- this.element.select();
73
- document.execCommand("copy");
74
- return this;
75
- }
76
- cut() {
77
- this.element.select();
78
- document.execCommand("cut");
79
- return this;
80
- }
81
- accept(value) {
82
- this.element.accept = value;
83
- return this;
84
- }
85
- }
86
-
87
- const input = (value, datalist) => {
88
- if (value instanceof Object) {
89
- const { datalist, placeholder } = value;
90
- value = value.value ?? "";
91
- return new ZikoUIInput("text", "input", value, datalist).setPlaceholder(placeholder);
92
- }
93
- return new ZikoUIInput("text", "input", value, datalist);
94
- };
95
-
96
- export{
97
- ZikoUIInput,
98
- input
99
- }
@@ -1,26 +0,0 @@
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
- get isInputCamera(){
10
- return true;
11
- }
12
- start(){
13
- navigator.mediaDevices.getUserMedia(this.constraints).then((mediaStream)=>{
14
- this.element.srcObject = mediaStream;
15
- this.element.onloadedmetadata = () =>{
16
- this.element.play();
17
- };
18
- })
19
- .catch(function(err) { console.log(err.name + ": " + err.message); });
20
- return this;
21
- }
22
- }
23
- const inputCamera=()=>new ZikoUIWebcame();
24
- export{
25
- inputCamera
26
- }
@@ -1,26 +0,0 @@
1
- import { ZikoUIInput } from "../input";
2
- class ZikoUIInputCheckbox extends ZikoUIInput {
3
- constructor() {
4
- super("checkbox", "inputCheckbox");
5
- this.cursor("pointer");
6
- }
7
- get isInputCheckbox(){
8
- return true;
9
- }
10
- get checked() {
11
- return this.element.checked;
12
- }
13
- check(checked = true) {
14
- this.element.checked = checked;
15
- return this;
16
- }
17
- color(color) {
18
- this.element.style.accentColor = color;
19
- return this;
20
- }
21
- }
22
- const checkbox = () => new ZikoUIInputCheckbox();
23
- export{
24
- ZikoUIInputCheckbox,
25
- checkbox
26
- }
@@ -1,16 +0,0 @@
1
- import { ZikoUIInput } from "../input";
2
- class ZikoUIInputColor extends ZikoUIInput {
3
- constructor() {
4
- super("color", "inputColor");
5
- this.background(this.value);
6
- this.onInput(() => this.background(this.value));
7
- }
8
- get isInputColor(){
9
- return true;
10
- }
11
- }
12
- const inputColor = () => new ZikoUIInputColor();
13
- export{
14
- ZikoUIInputColor,
15
- inputColor
16
- }
@@ -1,3 +0,0 @@
1
- export * from "./input-date";
2
- export * from "./input-time";
3
- export * from "./input-date-time";
@@ -1,14 +0,0 @@
1
- import { ZikoUIInput } from "../input";
2
- class ZikoUIInputDateTime extends ZikoUIInput {
3
- constructor() {
4
- super("datetime-local", "inputDateTime");
5
- }
6
- get isInputDateTime(){
7
- return true;
8
- }
9
- }
10
- const inputDateTime = () => new ZikoUIInputDateTime();
11
- export{
12
- ZikoUIInputDateTime,
13
- inputDateTime
14
- }
@@ -1,14 +0,0 @@
1
- import { ZikoUIInput } from "../input";
2
- class ZikoUIInputDate extends ZikoUIInput {
3
- constructor() {
4
- super("date", "inputDate");
5
- }
6
- get isInputDate(){
7
- return true;
8
- }
9
- }
10
- const inputDate = () => new ZikoUIInputDate();
11
- export{
12
- ZikoUIInputDate,
13
- inputDate
14
- }
@@ -1,14 +0,0 @@
1
- import { ZikoUIInput } from "../input";
2
- class ZikoUIInputTime extends ZikoUIInput {
3
- constructor() {
4
- super("time", "inputTime");
5
- }
6
- get isInputTime(){
7
- return true;
8
- }
9
- }
10
- const inputTime = () => new ZikoUIInputTime();
11
- export{
12
- ZikoUIInputTime,
13
- inputTime
14
- }
@@ -1,2 +0,0 @@
1
- export * from "./input-email";
2
- export * from "./input-password";
@@ -1,15 +0,0 @@
1
-
2
- import { ZikoUIInput } from "../input";
3
- class ZikoUIInputEmail extends ZikoUIInput {
4
- constructor() {
5
- super("email", "inputEmail");
6
- }
7
- get isInputEmail(){
8
- return true;
9
- }
10
- }
11
- const inputEmail = () => new ZikoUIInputEmail();
12
- export{
13
- ZikoUIInputEmail,
14
- inputEmail
15
- }