ziko 0.37.0 → 0.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/dist/ziko.cjs +1722 -3956
  2. package/dist/ziko.js +6150 -8384
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +1713 -3840
  5. package/package.json +16 -13
  6. package/readme.md +79 -5
  7. package/src/__helpers__/composition-dep/compose-class.js +46 -0
  8. package/src/__helpers__/register/index.js +6 -0
  9. package/src/__helpers__/register/register-to-class.js +16 -0
  10. package/src/__helpers__/register/register-to-instance.js +18 -0
  11. package/src/__ziko__/__cache__.js +6 -0
  12. package/src/__ziko__/__config__.js +19 -0
  13. package/src/__ziko__/__hydration__.js +8 -0
  14. package/src/__ziko__/__ui__.js +22 -0
  15. package/src/__ziko__/index.js +17 -0
  16. package/src/__ziko__/params.js +40 -0
  17. package/src/app/globals.js +14 -0
  18. package/src/app/index.js +4 -4
  19. package/src/app/spa-file-based-routing.js +2 -2
  20. package/src/app/ziko-app.js +1 -1
  21. package/src/data/converter/svg.js +2 -2
  22. package/src/hooks/index.js +3 -0
  23. package/src/hooks/use-derived.js +61 -0
  24. package/src/hooks/use-reactive.js +7 -0
  25. package/src/hooks/use-state.js +52 -0
  26. package/src/index.js +1 -78
  27. package/src/math/complex/index.js +3 -0
  28. package/src/math/functions/index.js +23 -23
  29. package/src/math/functions/proxy.js +58 -0
  30. package/src/math/utils/mapfun.js +17 -21
  31. package/src/no-module.js +32 -0
  32. package/src/time/{animation.js → animation/index.js} +2 -2
  33. package/src/time/decorators/index.js +17 -0
  34. package/src/time/index.js +11 -12
  35. package/src/time/utils/index.js +0 -1
  36. package/src/ui/{methods → __methods__}/dom.js +15 -14
  37. package/src/ui/__methods__/index.js +4 -0
  38. package/src/ui/{utils → __utils__}/index.js +1 -1
  39. package/src/ui/constructors/{ziko-ui-element.js → ZikoUIElement.js} +17 -117
  40. package/src/ui/constructors/ZikoUIElementMethodesToBeMoved-dep.js +96 -0
  41. package/src/ui/{style → constructors/style}/index.js +3 -3
  42. package/src/ui/{elements/flex → flex}/index.js +1 -1
  43. package/src/{graphics/canvas/index.js → ui/graphics/canvas.js} +4 -5
  44. package/src/ui/graphics/index.js +2 -0
  45. package/src/{graphics/svg/index.js → ui/graphics/svg.js} +1 -1
  46. package/src/ui/{elements/grid → grid}/index.js +1 -1
  47. package/src/ui/index.js +9 -40
  48. package/src/ui/{elements/misc/suspense.js → suspense/index.js} +1 -15
  49. package/src/ui/tags/index.js +27 -17
  50. package/src/ui/text/index.js +15 -0
  51. package/src/ui/{elements/misc/xml-wrapper.js → wrapper/index.js} +1 -1
  52. package/src/use/index.js +3 -7
  53. package/src/__helpers__/composition/compose-class.js +0 -28
  54. package/src/graphics/canvas/_canvas_offscreen +0 -0
  55. package/src/graphics/canvas/utils/color.js +0 -8
  56. package/src/graphics/canvas/utils/floodFill.js +0 -57
  57. package/src/graphics/index.js +0 -10
  58. package/src/time/utils/decorators.js +0 -17
  59. package/src/ui/elements/embaded/html.js +0 -20
  60. package/src/ui/elements/embaded/index.js +0 -3
  61. package/src/ui/elements/embaded/pdf.js +0 -17
  62. package/src/ui/elements/embaded/youtube.js +0 -24
  63. package/src/ui/elements/hydrate.js +0 -0
  64. package/src/ui/elements/index.js +0 -10
  65. package/src/ui/elements/io/Form/index.js +0 -42
  66. package/src/ui/elements/io/Form/index.js.txt +0 -104
  67. package/src/ui/elements/io/Inputs/__helpers__.js +0 -52
  68. package/src/ui/elements/io/Inputs/index.js +0 -12
  69. package/src/ui/elements/io/Inputs/input/index.js +0 -99
  70. package/src/ui/elements/io/Inputs/input-camera/index.js +0 -26
  71. package/src/ui/elements/io/Inputs/input-checkbox/index.js +0 -26
  72. package/src/ui/elements/io/Inputs/input-color/index.js +0 -16
  73. package/src/ui/elements/io/Inputs/input-date-time/index.js +0 -3
  74. package/src/ui/elements/io/Inputs/input-date-time/input-date-time.js +0 -14
  75. package/src/ui/elements/io/Inputs/input-date-time/input-date.js +0 -14
  76. package/src/ui/elements/io/Inputs/input-date-time/input-time.js +0 -14
  77. package/src/ui/elements/io/Inputs/input-email-password/index.js +0 -2
  78. package/src/ui/elements/io/Inputs/input-email-password/input-email.js +0 -15
  79. package/src/ui/elements/io/Inputs/input-email-password/input-password.js +0 -14
  80. package/src/ui/elements/io/Inputs/input-file/index.js +0 -1
  81. package/src/ui/elements/io/Inputs/input-file/input-file.js +0 -0
  82. package/src/ui/elements/io/Inputs/input-file/input-image.js +0 -43
  83. package/src/ui/elements/io/Inputs/input-number/index.js +0 -37
  84. package/src/ui/elements/io/Inputs/input-radio/index.js +0 -26
  85. package/src/ui/elements/io/Inputs/input-search/index.js +0 -45
  86. package/src/ui/elements/io/Inputs/input-slider/index.js +0 -34
  87. package/src/ui/elements/io/Select/index.js +0 -20
  88. package/src/ui/elements/io/Textarea/index.js +0 -18
  89. package/src/ui/elements/io/index.js +0 -4
  90. package/src/ui/elements/list/elements.js +0 -0
  91. package/src/ui/elements/list/index.js +0 -138
  92. package/src/ui/elements/media/Audio/index.js +0 -17
  93. package/src/ui/elements/media/Image/figure.js +0 -19
  94. package/src/ui/elements/media/Image/image.js +0 -37
  95. package/src/ui/elements/media/Image/index.js +0 -2
  96. package/src/ui/elements/media/Video/index.js +0 -27
  97. package/src/ui/elements/media/__ZikoUIDynamicMediaELement__.js +0 -47
  98. package/src/ui/elements/media/index.js +0 -3
  99. package/src/ui/elements/misc/hyperscript.js +0 -144
  100. package/src/ui/elements/misc/index.js +0 -101
  101. package/src/ui/elements/semantic/index.js +0 -42
  102. package/src/ui/elements/table/elements.js +0 -94
  103. package/src/ui/elements/table/index.js +0 -3
  104. package/src/ui/elements/table/table.js +0 -115
  105. package/src/ui/elements/table/utils.js +0 -12
  106. package/src/ui/elements/text/__ZikoUIText__.js +0 -70
  107. package/src/ui/elements/text/heading.js +0 -36
  108. package/src/ui/elements/text/index.js +0 -3
  109. package/src/ui/elements/text/p.js +0 -26
  110. package/src/ui/elements/text/pre.js +0 -0
  111. package/src/ui/elements/text/text.js +0 -81
  112. package/src/use/use-debounce.js +0 -4
  113. package/src/use/use-state.js +0 -22
  114. package/src/use/use-throttle.js +0 -9
  115. /package/src/__helpers__/{composition → composition-dep}/compose-instance.js +0 -0
  116. /package/src/__helpers__/{composition → composition-dep}/compose.js +0 -0
  117. /package/src/__helpers__/{composition → composition-dep}/index.js +0 -0
  118. /package/src/reactivity/hooks/{Head → head}/_useCssText.js +0 -0
  119. /package/src/reactivity/hooks/{Head → head}/index.js +0 -0
  120. /package/src/reactivity/hooks/{Head → head}/useFavIcon.js +0 -0
  121. /package/src/reactivity/hooks/{Head → head}/useHead.js +0 -0
  122. /package/src/reactivity/hooks/{Head → head}/useMeta.js +0 -0
  123. /package/src/reactivity/hooks/{Head → head}/useTitle.js +0 -0
  124. /package/src/time/{loop.js → loop/index.js} +0 -0
  125. /package/src/ui/{methods → __methods__}/events.js +0 -0
  126. /package/src/ui/{methods → __methods__}/indexing.js +0 -0
  127. /package/src/ui/{methods → __methods__}/observer.js +0 -0
  128. /package/src/ui/{methods → __methods__}/style.js +0 -0
  129. /package/src/ui/constructors/{ziko-ui-node.js → ZikoUINode.js} +0 -0
  130. /package/src/ui/tags/{tags.js → tags-list.js} +0 -0
@@ -1,115 +0,0 @@
1
- import ZikoUIElement from "../../constructors/ziko-ui-element.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
- }
17
- get isTable(){
18
- return true;
19
- }
20
- get caption(){
21
- return this.structure.caption;
22
- }
23
- get header(){
24
-
25
- }
26
- get body(){
27
-
28
- }
29
- get footer(){
30
-
31
- }
32
- setCaption(c){
33
- this.removeCaption();
34
- this.structure.caption=caption(c);
35
- this.append(this.structure.caption);
36
- return this;
37
- }
38
- removeCaption(){
39
- if(this.structure.caption)this.removeItem(...this.items.filter(n=>n instanceof ZikoUICaption));
40
- this.structure.caption=null;
41
- return this;
42
- }
43
- setHeader(...c){
44
- this.tHead=thead(...c);
45
- this.append(this.tHead);
46
- return this;
47
- }
48
- removeHeader(){
49
- this.removeItem(...this.items.filter(n=>n instanceof ZikoUICaption));
50
- return this;
51
- }
52
- setFooter(c){
53
- this.structure.caption=caption(c);
54
- this.append(this.structure.caption);
55
- return this;
56
- }
57
- removeFooter(){
58
- this.removeItem(...this.items.filter(n=>n instanceof ZikoUICaption));
59
- return this;
60
- }
61
- fromMatrix(bodyMatrix) {
62
- (bodyMatrix instanceof Array)?this.bodyMatrix=matrix(bodyMatrix):this.bodyMatrix=bodyMatrix;
63
- if(this.structure.body)this.remove(this.structure.body);
64
- this.structure.body=tbody()
65
- this.append(this.structure.body);
66
- this.structure.body.append(...MatrixToTableUI(this.bodyMatrix))
67
- //this.structure.body.append(...MatrixToTableUI(matrix))
68
- //this.cellStyles({ padding: "0.2rem 0.4rem", textAlign: "center" });
69
- return this;
70
- }
71
- transpose() {
72
- this.fromMatrix(this.bodyMatrix.T);
73
- return this;
74
- }
75
- hstack(m) {
76
- if(m instanceof ZikoUITable)m=m.bodyMatrix
77
- this.fromMatrix(this.bodyMatrix.clone.hstack(m));
78
- return this;
79
- }
80
- vstack(m) {
81
- if(m instanceof ZikoUITable)m=m.bodyMatrix
82
- this.fromMatrix(this.bodyMatrix.clone.vstack(m));
83
- return this;
84
- }
85
- slice(r0=0,c0=0,r1=this.bodyMatrix.rows-1,c1=this.bodyMatrix.cols-1) {
86
- this.fromMatrix(this.bodyMatrix.slice(r0,c0,r1,c1));
87
- return this;
88
- }
89
- sortByCols(n, config = { type: "num", order: "asc" }) {
90
- this.fromMatrix(this.bodyMatrix.clone.sortTable(n, config));
91
- return this;
92
- }
93
- sortByRows(n, config = { type: "num", order: "asc" }) {
94
- this.fromMatrix(this.bodyMatrix.T.clone.sortTable(n, config).T);
95
- return this;
96
- }
97
- filterByRows(item) {
98
- this.fromMatrix(this.bodyMatrix.clone.filterByRows(item));
99
- return this;
100
- }
101
- filterByCols(item) {
102
- this.fromMatrix(this.bodyMatrix.clone.filterByCols(item));
103
- return this;
104
- }
105
- forEachRow(callback){
106
- this.structure.body.forEach(callback);
107
- return this;
108
- }
109
- forEachItem(callback){
110
- this.structure.body.forEach(n=>n.forEach(callback));
111
- return this;
112
- }
113
- }
114
- const Table=(matrix,config)=>new ZikoUITable(matrix,config)
115
- export {Table}
@@ -1,12 +0,0 @@
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
- }
@@ -1,70 +0,0 @@
1
- import ZikoUIElement from "../../constructors/ziko-ui-element.js";
2
- import {
3
- ZikoUISubText,
4
- ZikoUISupText
5
- } from "./text.js";
6
- import {
7
- Complex,
8
- Matrix
9
- } from "../../../math/index.js";
10
- import {
11
- arr2str,
12
- obj2str
13
- } from "../../../data/index.js";
14
- class __ZikoUIText__ extends ZikoUIElement {
15
- constructor(tag, name, lineBreak,...value) {
16
- super(tag, name);
17
- this.addValue(...value);
18
- this.style({margin:0,padding:0});
19
- Object.assign(this.cache,{
20
- lineBreak,
21
- })
22
- }
23
- get isText(){
24
- return true;
25
- }
26
- get value(){
27
- return this.element.textContent;
28
- }
29
- clear() {
30
- this.element.childNodes.forEach((e) => e.remove());
31
- this.element.textContent = "";
32
- return this;
33
- }
34
- addValue(...value) {
35
- value.forEach((item,i) => {
36
- if (typeof item === "string" || typeof item === "number") this.element?.appendChild(globalThis?.document.createTextNode(item));
37
- else if (item instanceof ZikoUIElement) this.element?.appendChild(item.element);
38
- else if (item instanceof Complex || item instanceof Matrix) this.element?.appendChild(new Text(item.toString()));
39
- else if (item instanceof Array) this.element?.appendChild(new Text(arr2str(item)));
40
- else if (item instanceof Object) this.element?.appendChild(new Text(obj2str(item)));
41
-
42
- // if(
43
- // (item !== value[value.length - 1])
44
- // && !(value[i+1] instanceof ZikoUIElement)
45
- // && !(value[i-1] instanceof ZikoUIElement)
46
- // ) this.element?.appendChild(new Text(" "))
47
-
48
- if(this.cache.lineBreak)this.element?.appendChild(globalThis.document?.createElement("br"));
49
- });
50
- // if(this.element?.innerHTML){
51
- // this.element.innerHTML = this.element.innerHTML.replace(/\n/g, '<br>').replace(/(?<!<[^>]+) /g, '&nbsp;');
52
- // }
53
- return this
54
- }
55
- setValue(...value) {
56
- this.clear();
57
- this.addValue(...value);
58
- return this;
59
- }
60
- }
61
- class __ZikoUIInlineText__ extends __ZikoUIText__{
62
- constructor(tag, name,...value){
63
- super(tag, name, ...value)
64
- this.cache.breakLine=false;
65
- }
66
- }
67
- export {
68
- __ZikoUIText__,
69
- __ZikoUIInlineText__
70
- }
@@ -1,36 +0,0 @@
1
- import ZikoUIElement from "../../constructors/ziko-ui-element.js";
2
- class ZikoUIHeading extends ZikoUIElement {
3
- constructor(type = 1, value = "") {
4
- super(`h${type}`,`h${type}`);
5
- this.element.textContent = value;
6
- }
7
- get isHeading(){
8
- return true;
9
- }
10
- get value() {
11
- return this.element.innerText;
12
- }
13
- setValue(text = "") {
14
- this.element.innerText = text;
15
- return;
16
- }
17
- addValue(text = "") {
18
- this.element.innerText += text;
19
- return this;
20
- }
21
- }
22
- const h1=(text="")=>new ZikoUIHeading(1, text);
23
- const h2=(text="")=>new ZikoUIHeading(2, text);
24
- const h3=(text="")=>new ZikoUIHeading(3, text);
25
- const h4=(text="")=>new ZikoUIHeading(4, text);
26
- const h5=(text="")=>new ZikoUIHeading(5, text);
27
- const h6=(text="")=>new ZikoUIHeading(6, text);
28
- export{
29
- h1,
30
- h2,
31
- h3,
32
- h4,
33
- h5,
34
- h6,
35
- ZikoUIHeading
36
- }
@@ -1,3 +0,0 @@
1
- export * from "./text";
2
- export * from "./p";
3
- export *from "./heading";
@@ -1,26 +0,0 @@
1
- import { __ZikoUIText__ } from "./__ZikoUIText__.js";
2
- class ZikoUIParagraphe extends __ZikoUIText__ {
3
- constructor(...value) {
4
- super("p", "p", true, ...value);
5
- }
6
- get isPara(){
7
- return true;
8
- }
9
- }
10
- class ZikoUIBlockQuote extends __ZikoUIText__ {
11
- constructor(cite,quote) {
12
- super("blockquote", "blockquote", true, quote);
13
- this.setAttr("cite", cite);
14
- }
15
- get isBlockQuote(){
16
- return true;
17
- }
18
- }
19
- const p = (...ZikoUIElement) => new ZikoUIParagraphe(...ZikoUIElement);
20
- const blockQuote = (cite, quote) => new ZikoUIBlockQuote(cite, quote);
21
- export {
22
- p,
23
- blockQuote,
24
- ZikoUIParagraphe,
25
- ZikoUIBlockQuote
26
- }
File without changes
@@ -1,81 +0,0 @@
1
- import { __ZikoUIText__ } from "./__ZikoUIText__.js";
2
- class ZikoUIText extends __ZikoUIText__ {
3
- constructor(...value) {
4
- super("span", "text", false, ...value);
5
- }
6
- }
7
- class ZikoUIQuote extends __ZikoUIText__ {
8
- constructor(...value) {
9
- super("q", "quote", false, ...value);
10
- this.style({
11
- fontStyle: "italic"
12
- })
13
- }
14
- get isQuote(){
15
- return true
16
- }
17
- }
18
- class ZikoUIDefintion extends __ZikoUIText__ {
19
- constructor(...value) {
20
- super("dfn", "dfnText", false, ...value);
21
- }
22
- get isDfnText(){
23
- return true
24
- }
25
- }
26
- class ZikoUISupText extends __ZikoUIText__ {
27
- constructor(sup) {
28
- super("sup", "supText", false, sup);
29
- }
30
- get isSupText(){
31
- return true
32
- }
33
- }
34
- class ZikoUISubText extends __ZikoUIText__ {
35
- constructor(...value) {
36
- super("sub", "subText", false, ...value);
37
- }
38
- get isSubText(){
39
- return true
40
- }
41
- }
42
- class ZikoUICodeText extends __ZikoUIText__ {
43
- constructor(...value) {
44
- super("code", "codeText", false, ...value);
45
- }
46
- get isCodeText(){
47
- return true
48
- }
49
- }
50
- class ZikoUIAbbrText extends __ZikoUIText__ {
51
- constructor(abbr, title) {
52
- super("abbr", "abbrText", false, abbr);
53
- this.setAttr("title", title);
54
- }
55
- get isAbbrText(){
56
- return true
57
- }
58
- }
59
- const text = (...str) => new ZikoUIText(...str);
60
- const quote = (...str) => new ZikoUIQuote(...str);
61
- const dfnText = (...str) => new ZikoUIDefintion(...str);
62
- const supText = (...str) => new ZikoUISupText(...str);
63
- const subText = (...str) => new ZikoUISubText(...str);
64
- const codeText = (...str) => new ZikoUICodeText(...str);
65
- const abbrText = (abbr, title) => new ZikoUIAbbrText(abbr, title);
66
- export {
67
- ZikoUIText,
68
- ZikoUIQuote,
69
- ZikoUIDefintion,
70
- ZikoUISupText,
71
- ZikoUISubText,
72
- ZikoUICodeText,
73
- ZikoUIAbbrText,
74
- text,
75
- quote,
76
- dfnText,
77
- supText,
78
- subText,
79
- codeText,
80
- abbrText
81
- }
@@ -1,4 +0,0 @@
1
- export const useDebounce=(fn,delay=1000)=>{
2
- let id;
3
- return(...args)=> id ? clearTimeout(id) : setTimeout(()=>fn(...args),delay)
4
- }
@@ -1,22 +0,0 @@
1
- export function useState(initialValue) {
2
- let value = initialValue;
3
- const subscribers = new Set();
4
-
5
- function getValue() {
6
- return {
7
- value,
8
- isStateGetter: () => true,
9
- _subscribe: (fn) => subscribers.add(fn),
10
- };
11
- }
12
-
13
- function setValue(newValue) {
14
- if (typeof newValue === "function") newValue = newValue(value);
15
- if (newValue !== value) {
16
- value = newValue;
17
- subscribers.forEach(fn => fn(value));
18
- }
19
- }
20
-
21
- return [getValue, setValue];
22
- }
@@ -1,9 +0,0 @@
1
- export const useThrottle=(fn,delay)=>{
2
- let lastTime=0;
3
- return (...args)=>{
4
- const now=new Date().getTime()
5
- if(now-lastTime<delay)return;
6
- lastTime=now;
7
- fn(...args);
8
- }
9
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes