ziko 0.0.24 → 0.0.26

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 (80) hide show
  1. package/README.md +1 -1
  2. package/dist/ziko.cjs +50 -8
  3. package/dist/ziko.js +53 -11
  4. package/dist/ziko.min.js +2 -2
  5. package/dist/ziko.mjs +53 -11
  6. package/package.json +1 -1
  7. package/src/data/parser/index.js +1 -1
  8. package/src/reactivity/events/click.js +43 -1
  9. package/src/ui/elements/ZikoUIElement.js +6 -6
  10. package/src/ui/elements/text/__ZikoUIText__.js +3 -3
  11. package/src/graphics/canvas/elements ( To Be Moved )/Basic/arc.js +0 -43
  12. package/src/graphics/canvas/elements ( To Be Moved )/Basic/image.js +0 -0
  13. package/src/graphics/canvas/elements ( To Be Moved )/Basic/line.js +0 -26
  14. package/src/graphics/canvas/elements ( To Be Moved )/Basic/path.js +0 -0
  15. package/src/graphics/canvas/elements ( To Be Moved )/Basic/points.js +0 -48
  16. package/src/graphics/canvas/elements ( To Be Moved )/Basic/polygon.js +0 -7
  17. package/src/graphics/canvas/elements ( To Be Moved )/Basic/polyline.js +0 -0
  18. package/src/graphics/canvas/elements ( To Be Moved )/Basic/rect.js +0 -46
  19. package/src/graphics/canvas/elements ( To Be Moved )/Basic/text.js +0 -0
  20. package/src/graphics/canvas/elements ( To Be Moved )/Chart/histogram.js +0 -0
  21. package/src/graphics/canvas/elements ( To Be Moved )/Chart/plot.js +0 -0
  22. package/src/graphics/canvas/elements ( To Be Moved )/Chart/scatter.js +0 -2
  23. package/src/graphics/canvas/elements ( To Be Moved )/Chart/stem.js +0 -0
  24. package/src/graphics/canvas/elements ( To Be Moved )/Element.js +0 -115
  25. package/src/graphics/canvas/elements ( To Be Moved )/index.js +0 -13
  26. package/src/graphics/svg/Elements ( To Be Moved )/Basic/circle.js +0 -29
  27. package/src/graphics/svg/Elements ( To Be Moved )/Basic/ellipse.js +0 -24
  28. package/src/graphics/svg/Elements ( To Be Moved )/Basic/foreign-object.js +0 -36
  29. package/src/graphics/svg/Elements ( To Be Moved )/Basic/groupe.js +0 -32
  30. package/src/graphics/svg/Elements ( To Be Moved )/Basic/image.js +0 -36
  31. package/src/graphics/svg/Elements ( To Be Moved )/Basic/index.js +0 -11
  32. package/src/graphics/svg/Elements ( To Be Moved )/Basic/line.js +0 -32
  33. package/src/graphics/svg/Elements ( To Be Moved )/Basic/link.js +0 -33
  34. package/src/graphics/svg/Elements ( To Be Moved )/Basic/path.js +0 -62
  35. package/src/graphics/svg/Elements ( To Be Moved )/Basic/polygon.js +0 -32
  36. package/src/graphics/svg/Elements ( To Be Moved )/Basic/polyline.js +0 -7
  37. package/src/graphics/svg/Elements ( To Be Moved )/Basic/rect.js +0 -46
  38. package/src/graphics/svg/Elements ( To Be Moved )/Basic/text.js +0 -29
  39. package/src/graphics/svg/Elements ( To Be Moved )/Derived/grid.js +0 -9
  40. package/src/graphics/svg/Elements ( To Be Moved )/Derived/index.js +0 -1
  41. package/src/graphics/svg/Elements ( To Be Moved )/index.js +0 -2
  42. package/src/graphics/svg/Elements ( To Be Moved )/ziko-svg-element.js +0 -48
  43. package/src/ui/elements/derived ( To Be Moved)/accordion/accordion.js +0 -42
  44. package/src/ui/elements/derived ( To Be Moved)/accordion/collapsible.js +0 -82
  45. package/src/ui/elements/derived ( To Be Moved)/accordion/index.js +0 -2
  46. package/src/ui/elements/derived ( To Be Moved)/alert/alert.js +0 -80
  47. package/src/ui/elements/derived ( To Be Moved)/alert/index.js +0 -1
  48. package/src/ui/elements/derived ( To Be Moved)/alert/palette.js +0 -52
  49. package/src/ui/elements/derived ( To Be Moved)/carousel/index.js +0 -51
  50. package/src/ui/elements/derived ( To Be Moved)/code-note/SubElements.js.txt +0 -105
  51. package/src/ui/elements/derived ( To Be Moved)/code-note/code-cell.js +0 -195
  52. package/src/ui/elements/derived ( To Be Moved)/code-note/code-note.js +0 -72
  53. package/src/ui/elements/derived ( To Be Moved)/code-note/index.js +0 -2
  54. package/src/ui/elements/derived ( To Be Moved)/code-note/sub-elements.js +0 -67
  55. package/src/ui/elements/derived ( To Be Moved)/index.js +0 -12
  56. package/src/ui/elements/derived ( To Be Moved)/menu/index.js +0 -1
  57. package/src/ui/elements/derived ( To Be Moved)/menu/menu3d.js +0 -260
  58. package/src/ui/elements/derived ( To Be Moved)/modal/index.js +0 -92
  59. package/src/ui/elements/derived ( To Be Moved)/pagination/breadcrumbs.js +0 -54
  60. package/src/ui/elements/derived ( To Be Moved)/pagination/index.js +0 -1
  61. package/src/ui/elements/derived ( To Be Moved)/slider/__ZikoUISlider__.js +0 -112
  62. package/src/ui/elements/derived ( To Be Moved)/slider/hSlider.js +0 -34
  63. package/src/ui/elements/derived ( To Be Moved)/slider/index.js +0 -12
  64. package/src/ui/elements/derived ( To Be Moved)/slider/vSlider.js +0 -27
  65. package/src/ui/elements/derived ( To Be Moved)/splitter/__ZikoUISplitter__.js +0 -62
  66. package/src/ui/elements/derived ( To Be Moved)/splitter/hsplitter.js +0 -40
  67. package/src/ui/elements/derived ( To Be Moved)/splitter/index.js +0 -12
  68. package/src/ui/elements/derived ( To Be Moved)/splitter/vsplitter.js +0 -40
  69. package/src/ui/elements/derived ( To Be Moved)/tabs/index.js +0 -180
  70. /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/_themes/dark.js +0 -0
  71. /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/_themes/index.js +0 -0
  72. /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/_themes/light.js +0 -0
  73. /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/app/index.js +0 -0
  74. /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/component/index.js +0 -0
  75. /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/globals/index.js +0 -0
  76. /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/index.js +0 -0
  77. /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/params/index.js +0 -0
  78. /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/router/index.js +0 -0
  79. /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/seo/index.js +0 -0
  80. /package/src/{_global (To Be Replaced ) → _global (To Be Removed )}/style/index.js +0 -0
@@ -1,32 +0,0 @@
1
- import ZikoSvgElement from "../ziko-svg-element.js";
2
- class ZikoSvgGroupe extends ZikoSvgElement{
3
- constructor(...svgElement){
4
- super();
5
- this.items=[];
6
- this.element=document?.createElementNS(
7
- "http://www.w3.org/2000/svg",
8
- "g",
9
- );
10
- this.add(...svgElement)
11
- }
12
- add(...svgElement){
13
- for(let i=0;i<svgElement.length;i++){
14
- this.element?.appendChild(svgElement[i].element);
15
- this.items.push(svgElement[i])
16
- }
17
- if(svgElement.length===1)return svgElement[0]
18
- return svgElement;
19
- }
20
- remove(...svgElement){
21
- for(let i=0;i<svgElement.length;i++){
22
- this.element?.removeChild(svgElement[i].element);
23
- this.items=this.items.filter(n=>n!=svgElement)
24
- }
25
- return this;
26
- }
27
- }
28
- const svgGroupe=(...svgElement)=>new ZikoSvgGroupe(...svgElement)
29
- export {
30
- svgGroupe,
31
- ZikoSvgGroupe
32
- }
@@ -1,36 +0,0 @@
1
- import ZikoSvgElement from "../ziko-svg-element.js";
2
- class ZikoSvgImage extends ZikoSvgElement{
3
- constructor(src="",w="100%",h="100%",x=0,y=0){
4
- super()
5
- this.element=document?.createElementNS(
6
- "http://www.w3.org/2000/svg",
7
- "image",
8
- );
9
- this.setSrc(src).width(w).height(h).x(x).y(y);
10
- }
11
- x(x){
12
- this.element.x.baseVal.value=x;
13
- return this;
14
- }
15
- y(y){
16
- this.element.y.baseVal.value=y;
17
- return this;
18
- }
19
- width(w){
20
- this.element?.setAttribute("width",w);
21
- return this;
22
- }
23
- height(h){
24
- this.element?.setAttribute("height",h);
25
- return this;
26
- }
27
- setSrc(src=""){
28
- this.element?.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', src)
29
- return this;
30
- }
31
- }
32
- const svgImage=(src,w,h,x,y)=>new ZikoSvgImage(src,w,h,x,y);
33
- export {
34
- svgImage,
35
- ZikoSvgImage
36
- }
@@ -1,11 +0,0 @@
1
- export * from "./circle.js";
2
- export * from "./ellipse.js";
3
- export * from "./foreign-object.js";
4
- export * from "./groupe.js";
5
- export * from "./image.js";
6
- export * from "./line.js";
7
- export * from "./link.js";
8
- export * from "./path.js";
9
- export * from "./polygon.js";
10
- export * from "./rect.js";
11
- export * from "./text.js";
@@ -1,32 +0,0 @@
1
- import ZikoSvgElement from "../ziko-svg-element.js";
2
- class ZikoSvgLine extends ZikoSvgElement{
3
- constructor(x1,y1,x2,y2){
4
- super()
5
- this.element=document?.createElementNS(
6
- "http://www.w3.org/2000/svg",
7
- "line",
8
- );
9
- this.x1(x1).y1(y1).x2(x2).y2(y2).stroke("black");
10
- }
11
- x1(x1){
12
- this.element.x1.baseVal.value=x1;
13
- return this;
14
- }
15
- y1(y1){
16
- this.element.y1.baseVal.value=y1;
17
- return this;
18
- }
19
- x2(x2){
20
- this.element.x2.baseVal.value=x2;
21
- return this;
22
- }
23
- y2(y2){
24
- this.element.y2.baseVal.value=y2;
25
- return this;
26
- }
27
- }
28
- const svgLine=(x1,y1,x2,y2)=>new ZikoSvgLine(x1,y1,x2,y2);
29
- export{
30
- svgLine,
31
- ZikoSvgLine
32
- }
@@ -1,33 +0,0 @@
1
- import ZikoSvgElement from "../ziko-svg-element.js";
2
- class ZikoSvgLink extends ZikoSvgElement{
3
- constructor(href,...svgElement){
4
- super();
5
- this.items=[];
6
- this.element=document?.createElementNS(
7
- "http://www.w3.org/2000/svg",
8
- "a",
9
- );
10
- this.element.etAttribute("href",href)
11
- this.add(...svgElement)
12
- }
13
- add(...svgElement){
14
- for(let i=0;i<svgElement.length;i++){
15
- this.element.ppendChild(svgElement[i].element);
16
- this.items.push(svgElement[i])
17
- }
18
- if(svgElement.length===1)return svgElement[0]
19
- return svgElement;
20
- }
21
- remove(...svgElement){
22
- for(let i=0;i<svgElement.length;i++){
23
- this.element.moveChild(svgElement[i].element);
24
- this.items=this.items.filter(n=>n!=svgElement)
25
- }
26
- return this;
27
- }
28
- }
29
- const svgLink=(href,...svgElement)=>new ZikoSvgLink(href,...svgElement)
30
- export{
31
- svgLink,
32
- ZikoSvgLink
33
- }
@@ -1,62 +0,0 @@
1
- import ZikoSvgElement from "../ziko-svg-element.js";
2
- class ZikoSvgPath extends ZikoSvgElement{
3
- constructor(){
4
- super()
5
- this.element=document?.createElementNS(
6
- "http://www.w3.org/2000/svg",
7
- "path",
8
- );
9
- this.path="";
10
-
11
- }
12
- setPath(){
13
- this.element.etAttribute("d",this.path);
14
- return this;
15
- }
16
- clear(){
17
- this.path="";
18
- this.setPath();
19
- return this;
20
- }
21
- moveTo(x,y){
22
- this.path+=`M${x} ${y} `;
23
- this.setPath();
24
- return this;
25
- }
26
- lineTo(x,y){
27
- this.path+=`L${x} ${y} `;
28
- this.setPath();
29
- return this;
30
- }
31
- hr(x){
32
- this.path+=`H${x} `;
33
- this.setPath();
34
- return this;
35
- }
36
- vr(y){
37
- this.path+=`V${y} `;
38
- this.setPath();
39
- return this;
40
- }
41
- bezier(x1,y1,x2,y2,x,y){
42
- this.path+=`C ${x1} ${y1},${x2} ${y2},${x} ${y} `;
43
- this.setPath();
44
- return this;
45
- }
46
- quadratic(x1,y1,x,y){
47
- this.path+=`Q ${x1} ${y1} ${x} ${y} `;
48
- this.setPath();
49
- return this;
50
- }
51
- close(){
52
- this.path+="Z";
53
- this.setPath();
54
- return this;
55
- }
56
- }
57
-
58
- const svgPath=()=>new ZikoSvgPath();
59
- export{
60
- svgPath,
61
- ZikoSvgPath
62
- }
@@ -1,32 +0,0 @@
1
- import ZikoSvgElement from "../ziko-svg-element.js";
2
- class ZikoSvgPolygon extends ZikoSvgElement{
3
- constructor(X=[],Y=[]){
4
- super()
5
- this.X=X;
6
- this.Y=Y
7
- this.element=document?.createElementNS(
8
- "http://www.w3.org/2000/svg",
9
- "polygon",
10
- );
11
- this.element?.setAttribute("points","");
12
- this.addPoints(X,Y)
13
- }
14
- addPoint(x,y){
15
- let p=this.element.parentElement.createSVGPoint();
16
- p.x=x;
17
- p.y=y;
18
- this.element.points.appendItem(p);
19
- return this;
20
- }
21
- addPoints(X,Y){
22
- for(let i=0;i<X.length;i++){
23
- let p=this.element.parentElement.createSVGPoint();
24
- p.x=X[i];
25
- p.y=Y[i];
26
- this.element.oints.appendItem(p)
27
- }
28
- return this;
29
- }
30
- }
31
- const svgPolygon=(X,Y)=>new ZikoSvgPolygon(X,Y);
32
- export{ svgPolygon }
@@ -1,7 +0,0 @@
1
- import ZikoSvgElement from "../ZikoSvgElement.js";
2
- class ZikoSvgPolyLine extends ZikoSvgElement{}
3
- const svgPolyLine=(X,Y)=>new ZikoSvgPolyLine(X,Y);
4
- export {
5
- svgPolyLine,
6
- ZikoSvgPolyLine
7
- }
@@ -1,46 +0,0 @@
1
-
2
- import ZikoSvgELement from "../ziko-svg-element.js";
3
- class ZikoSvgRectangle extends ZikoSvgELement{
4
- constructor(x,y,w,h,center=true){
5
- super()
6
- this.element=document?.createElementNS(
7
- "http://www.w3.org/2000/svg",
8
- "rect",
9
- );
10
- this.setX(x).setY(y).width(w).height(h);
11
- this.rx=this.x+this.w/2;
12
- this.ty=this.y+this.h/2;
13
- }
14
- setX(x){
15
- this.element.x.baseVal.value=x;
16
- this.x=x;
17
- return this;
18
- }
19
- setY(y){
20
- this.element.y.baseVal.value=y;
21
- this.y=y;
22
- return this;
23
- }
24
- r(rx,ry){
25
- this.rx=rx;
26
- this.ry=ry;
27
- this.setX(this.rx-this.w/2);
28
- this.setY(this.ry-this.h/2);
29
- return this;
30
- }
31
- width(w){
32
- this.element.width.baseVal.value=w;
33
- this.w=w;
34
- return this;
35
- }
36
- height(h){
37
- this.element.height.baseVal.value=h;
38
- this.h=h;
39
- return this;
40
- }
41
- }
42
- const svgRect=(x,y,w,h,center)=>new ZikoSvgRectangle(x,y,w,h,center);
43
- export{
44
- svgRect,
45
- ZikoSvgRectangle
46
- }
@@ -1,29 +0,0 @@
1
- import ZikoSvgElement from "../ziko-svg-element.js";
2
- class ZikoSvgText extends ZikoSvgElement{
3
- constructor(text,x,y){
4
- super()
5
- this.element=document?.createElementNS(
6
- "http://www.w3.org/2000/svg",
7
- "text",
8
- );
9
- this.setText(text)
10
- this.x(x).y(y);
11
- }
12
- x(x){
13
- this.element?.setAttribute("x",x);
14
- return this;
15
- }
16
- y(y){
17
- this.element?.setAttribute("y",y);
18
- return this;
19
- }
20
- setText(text=""){
21
- this.element.textContent=text;
22
- return this;
23
- }
24
- }
25
- const svgText=(text,x,y)=>new ZikoSvgText(text,x,y);
26
- export{
27
- svgText,
28
- ZikoSvgText
29
- }
@@ -1,9 +0,0 @@
1
- import { svgPath } from "../basic/path"
2
- const svgGrid=(w,h,r=10,c=10)=>{
3
- let path=svgPath().fill("none").stroke("coral").strokeWidth(0.6)
4
- console.log({x:w/r,y:h/c})
5
- for(let i=0;i<w;i++) path.moveTo(0,i*w/r).hr(w)
6
- for(let j=0;j<h;j++) path.moveTo(j*h/c,0).vr(h)
7
- return path
8
- }
9
- export{ svgGrid };
@@ -1 +0,0 @@
1
- export * from "./grid.js"
@@ -1,2 +0,0 @@
1
- export * from "./basic/index.js"
2
- export { svgGrid } from "./derived/grid.js";
@@ -1,48 +0,0 @@
1
- import { ZikoUIElement } from "../../../ui";
2
- class ZikoSvgElement extends ZikoUIElement{
3
- constructor(type) {
4
- super()
5
- Object.assign(this.cache,{
6
- type
7
- })
8
- }
9
- pos(x,y){
10
- return this.posX(x).posY(y);
11
- }
12
- posX(x){
13
- if(["circle","ellipse"].includes(this.cache.type))this.element.cx.baseVal.value=x;
14
- else this.element.x.baseVal.value=x;
15
- return this;
16
- }
17
- posY(y){
18
- if(["circle","ellipse"].includes(this.cache.type))this.element.cy.baseVal.value=y;
19
- else this.element.y.baseVal.value=y;
20
- return this;
21
- }
22
- translate(x,y){
23
- return this;
24
- }
25
- color({ stroke, fill }) {
26
- this.element?.setAttribute("stroke", stroke);
27
- this.element?.setAttribute("fill", fill);
28
- return this;
29
- }
30
- fill(color = "none") {
31
- this.element?.setAttribute("fill", color);
32
- return this;
33
- }
34
- stroke(color = "none", width) {
35
- this.element?.setAttribute("stroke", color);
36
- width && this.strokeWidth(width);
37
- return this;
38
- }
39
- strokeWidth(width = 1) {
40
- this.element?.setAttribute("stroke-width", width);
41
- return this;
42
- }
43
- opacity(value = 1) {
44
- this.element?.setAttribute("opacity", value);
45
- return this;
46
- }
47
- }
48
- export default ZikoSvgElement;
@@ -1,42 +0,0 @@
1
- import ZikoUIContainerElement from "../../primitives/ZikoUIContainerElement.js";
2
- class ZikoUIAccordion extends ZikoUIContainerElement{
3
- constructor(...Collapsible){
4
- super("div", "Accordion")
5
- this.append(...Collapsible);
6
- Object.assign(this.cache,{
7
- autoClose : true
8
- })
9
- }
10
- get isAccordion(){
11
- return true;
12
- }
13
- closeAll(){
14
- this.items.forEach(n=>n.close());
15
- return this;
16
- }
17
- closeExcept(...Collapsibles){
18
- this.items.filter(n=>!Collapsibles.includes(n)).forEach(n=>n.close())
19
- return this;
20
- }
21
- open(CollapsibleOrIndex){
22
- CollapsibleOrIndex.isCollapsible? CollapsibleOrIndex.open(): this.items[CollapsibleOrIndex].open();
23
- this.closeExcept(CollapsibleOrIndex.isCollapsible? CollapsibleOrIndex: this.items[CollapsibleOrIndex]);
24
- return this;
25
- }
26
- enableAutoClose(){
27
- this.cache.autoClose = true;
28
- return this;
29
- }
30
- disableAutoClose(){
31
- this.cache.autoClose = false;
32
- return this;
33
- }
34
- toggleAutoClose(){
35
- this.cache.autoClose = !this.cache.autoClose;
36
- }
37
- }
38
- const Accordion = (... Collapsible) => new ZikoUIAccordion(...Collapsible);
39
- export{
40
- Accordion,
41
- ZikoUIAccordion
42
- }
@@ -1,82 +0,0 @@
1
- import ZikoUIElement from "../../primitives/ZikoUIElement.js";
2
- import { html } from "../../primitives/misc/index.js";
3
- import { watchAttr } from "../../../../reactivity/index.js";
4
- class ZikoUICollapbsible extends ZikoUIElement{
5
- constructor(summary,content,openIcon="😁", closeIcon=openIcon){
6
- super("details","Collapsible")
7
- Object.assign(this.cache,{
8
- icons:{
9
- open : openIcon,
10
- close : closeIcon
11
- }
12
- })
13
- this.summary=html("summary",summary).style({
14
- fontSize:"1.1em",
15
- padding:"0.625rem",
16
- fontWeight:"bold",
17
- listStyleType:`"${openIcon}"`,
18
- cursor:"pointer",
19
- });
20
- this.summary[0].style({
21
- marginLeft:"0.5em",
22
- })
23
- this.content=content.style({
24
- margin:"0.7em",
25
- });
26
- this.element?.append(this.summary.element,this.content.element)
27
- this.style({
28
- marginBottom:"0.7em",
29
- })
30
- watchAttr(this, e=>{
31
- if(e.target.isOpen){
32
- e.target.emit("open");
33
- if(this?.parent?.isAccordion){
34
- if(this.parent.cache.autoClose)this.parent.closeExcept(this);
35
- }
36
- this.summary.style({
37
- listStyleType:`"${this.cache.icons.close}"`
38
- })
39
- }
40
- else{
41
- e.target.emit("close");
42
- this.summary.style({
43
- listStyleType:`"${this.cache.icons.open}"`
44
- })
45
- }
46
- })
47
- }
48
- get isCollapsible(){
49
- return true;
50
- }
51
- get isOpen(){
52
- return this.element.open;
53
- }
54
- open(details=this){
55
- this.element.open=true;
56
- this.emit("open",details)
57
- return this;
58
- }
59
- close(){
60
- this.element.open=false;
61
- return this;
62
- }
63
- onOpen(callback){
64
- this.on("open", callback)
65
- return this;
66
- }
67
- onClose(callback){
68
- this.on("close", callback)
69
- return this;
70
- }
71
- toggle(){
72
- this.element.open=!this.element.open;
73
- return this;
74
- }
75
- }
76
-
77
-
78
- const Collapsible=(summary, content, openIcon, closeIcon)=>new ZikoUICollapbsible(summary,content,openIcon, closeIcon);
79
- export{
80
- Collapsible
81
- }
82
-
@@ -1,2 +0,0 @@
1
- export * from "./collapsible.js"
2
- export * from "./accordion.js"
@@ -1,80 +0,0 @@
1
- import { Flex,ZikoUIFlex } from "../flex";
2
- import { palette } from "./palette.js";
3
- import { text, h3 } from "../../primitives/text/index";
4
- class ZikoUIAlert extends ZikoUIFlex{
5
- constructor(type, title, content){
6
- super()
7
- this.title = h3(title);
8
- this.icon = text(palette[type].icon).style({
9
- display: "flex",
10
- justifyContent:"center",
11
- borderRadius:"50%",
12
- minWidth:"30px",
13
- minHeight:"30px",
14
- });
15
- this.content = content;
16
- this.vertical()
17
- .size("200px", "auto")
18
- .style({
19
- borderRadius:"10px",
20
- padding:"10px"
21
- });
22
- this.append(
23
- Flex(
24
- this.title,
25
- this.icon
26
- ).size("100%", "40px").style({}).horizontal("space-between",0),
27
- this.content
28
- )
29
- this.useType(type);
30
- }
31
- get isAlert(){
32
- return true;
33
- }
34
- useType(type){
35
- this.style({
36
- color:palette[type].color,
37
- background:palette[type].bgColor,
38
- border: `1px darkblue solid`,
39
- borderLeft: `15px ${palette[type].borderColor} solid`,
40
- })
41
- this.title.style({
42
- color:palette[type].titleColor
43
- });
44
- this.content.st.color(palette[type].titleColor)
45
- this.icon.setValue(palette[type].icon).style({
46
- border:`2px ${palette[type].borderColor} solid`,
47
- alignItems: type==="warning"?"flex-start":"center",
48
- });
49
- return this;
50
- }
51
- useSuccess(){
52
- this.useType("success");
53
- return this;
54
- }
55
- useInfo(){
56
- this.useType("info");
57
- return this;
58
- }
59
- useWarning(){
60
- this.useType("warning");
61
- return this;
62
- }
63
- useDanger(){
64
- this.useType("danger");
65
- return this;
66
- }
67
- }
68
-
69
- const successAlert=(title, content)=>new ZikoUIAlert("success", title, content);
70
- const infoAlert=(title, content)=>new ZikoUIAlert("info", title, content);
71
- const warningAlert=(title, content)=>new ZikoUIAlert("warning", title, content);
72
- const dangerAlert=(title, content)=>new ZikoUIAlert("danger", title, content);
73
-
74
- export{
75
- successAlert,
76
- infoAlert,
77
- warningAlert,
78
- dangerAlert
79
- }
80
-
@@ -1 +0,0 @@
1
- export * from "./Alert.js"
@@ -1,52 +0,0 @@
1
- const palette = {
2
- success: {
3
- titleColor:"green",
4
- contentColor: "#35495e",
5
- bgColor: "#d4edda", // Fixed
6
- bgColor:"linear-gradient(-225deg, #DFFFCD 0%, #90F9C4 48%, #39F3BB 100%)",
7
- borderColor: "#28a745", // Fixed
8
- icon: "✅"
9
- },
10
- info: {
11
- titleColor:"blue",
12
- contentColor: "#00204a",
13
- bgColor: "#93deff", // Fixed
14
- bgColor:"radial-gradient(circle at 10% 20%, rgb(147, 230, 241) 0%, rgb(145, 192, 241) 45.5%)",
15
- borderColor: "#005689", // Fixed
16
- icon: "ℹ️"
17
- },
18
- warning: {
19
- titleColor:"#e4663a",
20
- contentColor: "#45171d",
21
- bgColor:"#fdffcd",
22
- bgColor:"radial-gradient(907px at 3.4% 19.8%, rgb(255, 243, 122) 0%, rgb(255, 102, 145) 97.4%)",
23
- borderColor: "#efd510",
24
- icon: "⚠️"
25
- },
26
- danger: {
27
- titleColor:"red",
28
- contentColor: "#721c24",
29
- bgColor: "#f8d7da", // Fixed
30
- bgColor:"linear-gradient(90deg, rgb(255, 157, 129) 24.3%, rgb(255, 138, 138) 78.3%)",
31
- borderColor: "#c50000", // Fixed
32
- icon: "❌"
33
- },
34
- tips: {
35
- titleColor:null,
36
- contentColor: null,
37
- bgColor: null,
38
- borderColor: null,
39
- icon: "💡"
40
- },
41
- important: {
42
- titleColor:null,
43
- contentColor: null,
44
- bgColor: null,
45
- borderColor: null,
46
- icon: "📌"
47
- },
48
-
49
- };
50
- export{
51
- palette
52
- }