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
@@ -1,144 +0,0 @@
1
- import ZikoUIElement from '../../constructors/ziko-ui-element.js';
2
- const _h=(tag, type, attributes, ...children)=>{
3
- const { name, style, ...attrs } = attributes;
4
- let element = new ZikoUIElement(tag, name, type);
5
- style && element.style(style);
6
- attrs && element.setAttr(attrs);
7
- children && element.append(...children);
8
- return element;
9
- }
10
- const h=(tag, attributes = {}, ...children)=> _h(tag, "html", attributes, ...children);
11
- const s=(tag, attributes = {}, ...children)=> _h(tag, "svg", attributes, ...children);
12
-
13
- const HTMLTags = [
14
- 'a',
15
- 'abb',
16
- 'address',
17
- 'area',
18
- 'article',
19
- 'aside',
20
- 'audio',
21
- 'b',
22
- 'base',
23
- 'bdi',
24
- 'bdo',
25
- 'blockquote',
26
- 'br',
27
- 'button',
28
- 'canvas',
29
- 'caption',
30
- 'cite',
31
- 'code',
32
- 'col',
33
- 'colgroup',
34
- 'data',
35
- 'datalist',
36
- 'dd',
37
- 'del',
38
- 'details',
39
- 'dfn',
40
- 'dialog',
41
- 'div',
42
- 'dl',
43
- 'dt',
44
- 'em',
45
- 'embed',
46
- 'fieldset',
47
- 'figcaption',
48
- 'figure',
49
- 'footer',
50
- 'form',
51
- 'h1',
52
- 'h2',
53
- 'h3',
54
- 'h4',
55
- 'h5',
56
- 'h6',
57
- 'header',
58
- 'hgroup',
59
- 'hr',
60
- 'i',
61
- 'iframe',
62
- 'img',
63
- 'ipnut',
64
- 'ins',
65
- 'kbd',
66
- 'label',
67
- 'legend',
68
- 'li',
69
- 'main',
70
- 'map',
71
- 'mark',
72
- 'menu',
73
- 'meter',
74
- 'nav',
75
- 'object',
76
- 'ol',
77
- 'optgroup',
78
- 'option',
79
- 'output',
80
- 'p',
81
- 'param',
82
- 'picture',
83
- 'pre',
84
- 'progress',
85
- 'q',
86
- 'rp',
87
- 'rt',
88
- 'ruby',
89
- 's',
90
- 'samp',
91
- 'search',
92
- 'section',
93
- 'select',
94
- 'small',
95
- 'source',
96
- 'span',
97
- 'strong',
98
- 'sub',
99
- 'summary',
100
- 'sup',
101
- 'svg',
102
- 'table',
103
- 'tbody',
104
- 'td',
105
- 'template',
106
- 'textarea',
107
- 'tfoot',
108
- 'th',
109
- 'thead',
110
- 'time',
111
- 'title',
112
- 'tr',
113
- 'track',
114
- 'u',
115
- 'ul',
116
- 'var',
117
- 'video',
118
- 'wbr'
119
- ];
120
-
121
- const SVGTags = [
122
- "svg", "g", "defs", "symbol", "use", "image", "switch",
123
- "rect", "circle", "ellipse", "line", "polyline", "polygon", "path",
124
- "text", "tspan", "textPath", "altGlyph", "altGlyphDef", "altGlyphItem", "glyph", "glyphRef",
125
- "linearGradient", "radialGradient", "pattern", "solidColor",
126
- "filter", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix",
127
- "feDiffuseLighting", "feDisplacementMap", "feDropShadow", "feFlood", "feFuncA", "feFuncR", "feFuncG", "feFuncB",
128
- "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "feSpecularLighting",
129
- "feTile", "feTurbulence",
130
- "animate", "animateMotion", "animateTransform", "set",
131
- "script",
132
- "desc", "title", "metadata", "foreignObject"
133
- ];
134
-
135
- const hTags = HTMLTags.reduce((acc, key) => {
136
- acc[key] = (attr, ...children) => h(key, attr, ...children);
137
- return acc;
138
- }, {});
139
- const sTags = SVGTags.reduce((acc, key) => {
140
- acc[key] = (attr, ...children) => h(key, attr, ...children);
141
- return acc;
142
- }, {});
143
-
144
- export { h, s, hTags, sTags };
@@ -1,101 +0,0 @@
1
- import ZikoUIElement from "../../constructors/ziko-ui-element.js";
2
- class ZikoUIHtmlTag extends ZikoUIElement {
3
- constructor(element) {
4
- super(element,"html");
5
- }
6
- }
7
- class ZikoUIBtn extends ZikoUIElement {
8
- constructor(value = "button") {
9
- super("button","btn");
10
- this.setValue(value);
11
- this.st.cursor("pointer");
12
- globalThis.__Ziko__.__Config__.default.render && this.render();
13
- }
14
- get isBtn(){
15
- return true
16
- }
17
- setValue(value) {
18
- if (value instanceof ZikoUIElement) value.setTarget(this.element);
19
- else {
20
- this.element?.appendChild(document.createTextNode(""));
21
- this.element.childNodes[0].data = value;
22
- }
23
- return this;
24
- }
25
- get value() {
26
- return this.element.innerText;
27
- }
28
- toggleValues(...values) {
29
- values = values.map((n) => "" + n);
30
- let index = values.indexOf("" + this.value);
31
- if (index != -1 && index != values.length - 1)
32
- this.setValue(values[index + 1]);
33
- else this.setValue(values[0]);
34
- return this;
35
- }
36
- }
37
- class ZikoUIBr extends ZikoUIElement {
38
- constructor() {
39
- super("br","br");
40
- }
41
- get isBr(){
42
- return true
43
- }
44
- }
45
- class ZikoUIHr extends ZikoUIElement {
46
- constructor() {
47
- super("hr","hr");
48
- this.setAttr("role", "none");
49
- }
50
- get isHr(){
51
- return true
52
- }
53
- }
54
- class ZikoUILink extends ZikoUIElement{
55
- constructor(href){
56
- super("a","link");
57
- Object.assign(this.cache,{
58
- defaultStyle:{
59
- color:"#0275d8",
60
- textDecoration: "none"
61
- },
62
- hoverStyle:{
63
- color:"#01447e",
64
- textDecoration: "underline"
65
- },
66
- })
67
- this.setHref(href);
68
- this.style(this.cache.defaultStyle);
69
- this.onPtrEnter(()=>this.style(this.cache.hoverStyle));
70
- this.onPtrLeave(()=>this.style(this.cache.defaultStyle));
71
- }
72
- setHref(href){
73
- this.element.href=href;
74
- }
75
- get isLink(){
76
- return true
77
- }
78
- }
79
- const br = () => new ZikoUIBr();
80
- const hr = () => new ZikoUIHr();
81
- const brs = (n=1)=> new Array(n).fill(new ZikoUIBr());
82
- const hrs = (n=1)=> new Array(n).fill(new ZikoUIHr());
83
- const link=(href,...UIElement)=>new ZikoUILink(href).append(...UIElement);
84
- const html=(tag,...UIElement)=>new ZikoUIHtmlTag(tag).append(...UIElement);
85
- const btn = (value) => new ZikoUIBtn(value);
86
- export * from "./xml-wrapper.js";
87
- export * from "./suspense.js"
88
- export * from "./hyperscript.js"
89
- export{
90
- html,
91
- btn,
92
- br,
93
- hr,
94
- brs,
95
- hrs,
96
- link,
97
- ZikoUIHtmlTag,
98
- ZikoUIBr,
99
- ZikoUIHr,
100
- ZikoUILink
101
- }
@@ -1,42 +0,0 @@
1
- import ZikoUIElement from "../../constructors/ziko-ui-element.js";
2
- const elements = ['Main', 'Header', 'Nav', 'Section', 'Article', 'Aside', 'Footer']
3
-
4
- // Storage for Classes and component functions
5
- const Classes = {};
6
- const Components = {};
7
-
8
- // Auto-generate Classes and factory functions
9
- for (let i=0; i<elements.length; i++) {
10
- Classes[`ZikoUI${elements[i]}`] = class extends ZikoUIElement {
11
- constructor() {
12
- super(elements[i].toLowerCase());
13
- this.style({ position: "relative" });
14
- }
15
- get [`is${elements[i]}`]() {
16
- return true;
17
- }
18
- };
19
-
20
- Components[elements[i]] = (...children) =>
21
- new Classes[`ZikoUI${elements[i]}`]().append(...children);
22
- }
23
-
24
- export const {
25
- Main,
26
- Header,
27
- Nav,
28
- Section,
29
- Article,
30
- Aside,
31
- Footer
32
- } = Components;
33
-
34
- export const {
35
- ZikoUIMain,
36
- ZikoUIHeader,
37
- ZikoUINav,
38
- ZikoUISection,
39
- ZikoUIArticle,
40
- ZikoUIAside,
41
- ZikoUIFooter
42
- } = Classes;
@@ -1,94 +0,0 @@
1
- import ZikoUIElement from "../../constructors/ziko-ui-element.js"
2
- import { text } from "../text/text.js";
3
- class ZikoUITh extends ZikoUIElement{
4
- constructor(...ZikoUIElement){
5
- super()
6
- this.element=document?.createElement("Th");
7
- this.append(...ZikoUIElement)
8
- }
9
- }
10
- class ZikoUITr extends ZikoUIElement{
11
- constructor(...ZikoUIElement){
12
- super()
13
- this.element=document?.createElement("Tr");
14
- this.append(...ZikoUIElement)
15
- }
16
- }
17
- class ZikoUITd extends ZikoUIElement{
18
- constructor(...ZikoUIElement){
19
- super()
20
- this.element=document?.createElement("Td");
21
- this.append(...ZikoUIElement)
22
- }
23
- }
24
- class ZikoUIThead extends ZikoUIElement{
25
- constructor(...ZikoUITr){
26
- super()
27
- this.element=document?.createElement("Thead");
28
- this.append(...ZikoUITr)
29
- }
30
- }
31
- class ZikoUITbody extends ZikoUIElement{
32
- constructor(...ZikoUITr){
33
- super()
34
- this.element=document?.createElement("Tbody");
35
- this.append(...ZikoUITr)
36
- }
37
- }
38
- class ZikoUITfoot extends ZikoUIElement{
39
- constructor(...ZikoUITr){
40
- super()
41
- this.element=document?.createElement("Tfoot");
42
- this.append(...ZikoUITr)
43
- }
44
- }
45
- export class ZikoUICaption extends ZikoUIElement{
46
- constructor(ZikoUIElement){
47
- super()
48
- this.element=document?.createElement("Caption");
49
- this.append(ZikoUIElement)
50
- }
51
- }
52
- class ZikoUICol extends ZikoUIElement{
53
- constructor(...ZikoUIElement){
54
- super()
55
- this.element=document?.createElement("Col");
56
- this.append(...ZikoUIElement)
57
- }
58
- }
59
- class ZikoUIColgroup extends ZikoUIElement{
60
- constructor(...ZikoUIElement){
61
- super()
62
- this.element=document?.createElement("Colgroup");
63
- this.append(...ZikoUIElement)
64
- }
65
- }
66
-
67
- const tr=(...ZikoUIElement)=>new ZikoUITr(...ZikoUIElement)
68
- const th=(...UI)=>{
69
- UI=UI.map(n=>{
70
- if(!(n instanceof ZikoUIElement))n=text(n)
71
- return n
72
- })
73
- return new ZikoUITh(...UI)
74
- }
75
- const td=(...UI)=>{
76
- UI=UI.map(n=>{
77
- if(!(n instanceof ZikoUIElement))n=text(n)
78
- return n
79
- })
80
- return new ZikoUITd(...UI)
81
- }
82
- const thead=(...ZikoUITd)=>{
83
- ZikoUITd=ZikoUITd.map(n=>{
84
- if(!(n instanceof ZikoUIElement))n=td(n)
85
- return n
86
- })
87
- return new ZikoUIThead(...UI)
88
- }
89
- const tbody=(...ZikoUITr)=>new ZikoUITbody(...ZikoUITr)
90
- const tfoot=(...ZikoUITr)=>new ZikoUITfoot(...ZikoUITr)
91
- const caption=(ZikoUITr)=>new ZikoUICaption(ZikoUITr)
92
-
93
-
94
- export {th,tr,td,thead,tbody,tfoot,caption}
@@ -1,3 +0,0 @@
1
- export{
2
- Table
3
- } from "./table.js"
@@ -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