ziko 0.0.24 → 0.0.25

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 (65) hide show
  1. package/dist/ziko.cjs +1 -1
  2. package/dist/ziko.js +1 -1
  3. package/dist/ziko.min.js +1 -1
  4. package/dist/ziko.mjs +1 -1
  5. package/package.json +1 -1
  6. package/src/data/parser/index.js +1 -1
  7. package/src/graphics/canvas/elements ( To Be Moved )/Basic/arc.js +0 -43
  8. package/src/graphics/canvas/elements ( To Be Moved )/Basic/image.js +0 -0
  9. package/src/graphics/canvas/elements ( To Be Moved )/Basic/line.js +0 -26
  10. package/src/graphics/canvas/elements ( To Be Moved )/Basic/path.js +0 -0
  11. package/src/graphics/canvas/elements ( To Be Moved )/Basic/points.js +0 -48
  12. package/src/graphics/canvas/elements ( To Be Moved )/Basic/polygon.js +0 -7
  13. package/src/graphics/canvas/elements ( To Be Moved )/Basic/polyline.js +0 -0
  14. package/src/graphics/canvas/elements ( To Be Moved )/Basic/rect.js +0 -46
  15. package/src/graphics/canvas/elements ( To Be Moved )/Basic/text.js +0 -0
  16. package/src/graphics/canvas/elements ( To Be Moved )/Chart/histogram.js +0 -0
  17. package/src/graphics/canvas/elements ( To Be Moved )/Chart/plot.js +0 -0
  18. package/src/graphics/canvas/elements ( To Be Moved )/Chart/scatter.js +0 -2
  19. package/src/graphics/canvas/elements ( To Be Moved )/Chart/stem.js +0 -0
  20. package/src/graphics/canvas/elements ( To Be Moved )/Element.js +0 -115
  21. package/src/graphics/canvas/elements ( To Be Moved )/index.js +0 -13
  22. package/src/graphics/svg/Elements ( To Be Moved )/Basic/circle.js +0 -29
  23. package/src/graphics/svg/Elements ( To Be Moved )/Basic/ellipse.js +0 -24
  24. package/src/graphics/svg/Elements ( To Be Moved )/Basic/foreign-object.js +0 -36
  25. package/src/graphics/svg/Elements ( To Be Moved )/Basic/groupe.js +0 -32
  26. package/src/graphics/svg/Elements ( To Be Moved )/Basic/image.js +0 -36
  27. package/src/graphics/svg/Elements ( To Be Moved )/Basic/index.js +0 -11
  28. package/src/graphics/svg/Elements ( To Be Moved )/Basic/line.js +0 -32
  29. package/src/graphics/svg/Elements ( To Be Moved )/Basic/link.js +0 -33
  30. package/src/graphics/svg/Elements ( To Be Moved )/Basic/path.js +0 -62
  31. package/src/graphics/svg/Elements ( To Be Moved )/Basic/polygon.js +0 -32
  32. package/src/graphics/svg/Elements ( To Be Moved )/Basic/polyline.js +0 -7
  33. package/src/graphics/svg/Elements ( To Be Moved )/Basic/rect.js +0 -46
  34. package/src/graphics/svg/Elements ( To Be Moved )/Basic/text.js +0 -29
  35. package/src/graphics/svg/Elements ( To Be Moved )/Derived/grid.js +0 -9
  36. package/src/graphics/svg/Elements ( To Be Moved )/Derived/index.js +0 -1
  37. package/src/graphics/svg/Elements ( To Be Moved )/index.js +0 -2
  38. package/src/graphics/svg/Elements ( To Be Moved )/ziko-svg-element.js +0 -48
  39. package/src/ui/elements/derived ( To Be Moved)/accordion/accordion.js +0 -42
  40. package/src/ui/elements/derived ( To Be Moved)/accordion/collapsible.js +0 -82
  41. package/src/ui/elements/derived ( To Be Moved)/accordion/index.js +0 -2
  42. package/src/ui/elements/derived ( To Be Moved)/alert/alert.js +0 -80
  43. package/src/ui/elements/derived ( To Be Moved)/alert/index.js +0 -1
  44. package/src/ui/elements/derived ( To Be Moved)/alert/palette.js +0 -52
  45. package/src/ui/elements/derived ( To Be Moved)/carousel/index.js +0 -51
  46. package/src/ui/elements/derived ( To Be Moved)/code-note/SubElements.js.txt +0 -105
  47. package/src/ui/elements/derived ( To Be Moved)/code-note/code-cell.js +0 -195
  48. package/src/ui/elements/derived ( To Be Moved)/code-note/code-note.js +0 -72
  49. package/src/ui/elements/derived ( To Be Moved)/code-note/index.js +0 -2
  50. package/src/ui/elements/derived ( To Be Moved)/code-note/sub-elements.js +0 -67
  51. package/src/ui/elements/derived ( To Be Moved)/index.js +0 -12
  52. package/src/ui/elements/derived ( To Be Moved)/menu/index.js +0 -1
  53. package/src/ui/elements/derived ( To Be Moved)/menu/menu3d.js +0 -260
  54. package/src/ui/elements/derived ( To Be Moved)/modal/index.js +0 -92
  55. package/src/ui/elements/derived ( To Be Moved)/pagination/breadcrumbs.js +0 -54
  56. package/src/ui/elements/derived ( To Be Moved)/pagination/index.js +0 -1
  57. package/src/ui/elements/derived ( To Be Moved)/slider/__ZikoUISlider__.js +0 -112
  58. package/src/ui/elements/derived ( To Be Moved)/slider/hSlider.js +0 -34
  59. package/src/ui/elements/derived ( To Be Moved)/slider/index.js +0 -12
  60. package/src/ui/elements/derived ( To Be Moved)/slider/vSlider.js +0 -27
  61. package/src/ui/elements/derived ( To Be Moved)/splitter/__ZikoUISplitter__.js +0 -62
  62. package/src/ui/elements/derived ( To Be Moved)/splitter/hsplitter.js +0 -40
  63. package/src/ui/elements/derived ( To Be Moved)/splitter/index.js +0 -12
  64. package/src/ui/elements/derived ( To Be Moved)/splitter/vsplitter.js +0 -40
  65. package/src/ui/elements/derived ( To Be Moved)/tabs/index.js +0 -180
@@ -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
- }
@@ -1,51 +0,0 @@
1
- import { ZikoUIFlex } from "../Flex";
2
- import { Section } from "../../primitives/semantic";
3
- class ZikoUICarousel extends ZikoUIFlex{
4
- constructor(...ZikoUIElement){
5
- super()
6
- this.style({
7
- position:"relative",
8
- overflow:"hidden",
9
- touchAction:"none",
10
- userSelect:"none"
11
- });
12
- this.horizontal("space-around",0);
13
- this.track = Section(...ZikoUIElement).style({ display: "inline-flex" });
14
- this.track.size(this.track.children.length * 100 + "vw");
15
- this.track.setTarget(this);
16
- this.track.items.map((n) =>
17
- n.style({ pointerEvents: "none", margin: "auto 10px" })
18
- );
19
- this.x0 = null;
20
- this.tx = 0;
21
- this.onPtrMove(e=>{
22
- if(e.isDown){
23
- let x = e.event.pageX;
24
- let dx = x - this.x0;
25
- this.track.st.translateX(
26
- this.tx + dx,
27
- 0
28
- );
29
- }
30
- })
31
- this.onPtrDown(e=>{
32
- console.log(e.event)
33
- this.x0 = e.event.pageX;
34
- const transformMatrix = window
35
- .getComputedStyle(this.track.element)
36
- .getPropertyValue("transform");
37
- if (transformMatrix !== "none") {
38
- this.tx = +transformMatrix.split(",")[4];
39
- }
40
- })
41
- this.onPtrUp(e=>console.log(e.isDown));
42
- this.onPtrLeave(e=>{
43
- // Handle outside up
44
- });
45
- }
46
- get isCarousel(){
47
- return true;
48
- }
49
- }
50
- const Carousel=(...ZikoUIElement)=>new ZikoUICarousel(...ZikoUIElement);
51
- export {Carousel}
@@ -1,105 +0,0 @@
1
- import { html } from "../../../Misc";
2
- import { Flex } from "../../Flex";
3
- import { text } from "../../../Text";
4
- import { ZikoUICodeNote } from "./CodeNote";
5
- import {EditorView, basicSetup} from "codemirror"
6
- import {javascript} from "@codemirror/lang-javascript"
7
- import {keymap} from "@codemirror/view"
8
- import {indentWithTab} from "@codemirror/commands"
9
- import { style } from "../../../Utils";
10
-
11
- // const Input=(codeText="")=>html("code",codeText).style({
12
- // width:"100%",
13
- // height:"auto",
14
- // padding:"10px",
15
- // boxSizing:"border-box",
16
- // border: "1px solid #ccc",
17
- // outline: "none",
18
- // fontSize: "1rem",
19
- // fontFamily: "Lucida Console, Courier New, monospace",
20
- // padding: "1rem 0.5rem",
21
- // wordBreak:"break-all",
22
- // background:"#f6f8fa",
23
- // color:"#0062C3"
24
- // }).setAttr("contenteditable",true).setAttr("spellcheck",false);
25
-
26
- const Input = (codeText = "") => {
27
- // Create the code element with styles
28
- const inputElement = html("code", codeText)
29
- .style({
30
- // width: "100%",
31
- // height: "auto",
32
- // padding: "10px",
33
- // boxSizing: "border-box",
34
- // border: "1px solid #ccc",
35
- outline: "none",
36
- fontSize: "1rem",
37
- fontFamily: "Lucida Console, Courier New, monospace",
38
- // padding: "1rem 0.5rem",
39
- // wordBreak: "break-all",
40
- // background: "#f6f8fa",
41
- // color: "#0062C3",
42
- })
43
- // .setAttr("contenteditable", true).setAttr("spellcheck", false);
44
-
45
- // Initialize CodeMirror editor view on the created element
46
- let editor=new EditorView({
47
- extensions: [
48
- basicSetup,
49
- javascript(),
50
- keymap.of([indentWithTab])
51
- ],
52
- parent: inputElement.element // Use the element for CodeMirror's parent
53
- });
54
- window.editor = editor
55
- // Return the element to be used elsewhere
56
- return inputElement;
57
- };
58
-
59
-
60
- const Output=()=>html("output").style({
61
- width:"100%",
62
- height:"auto",
63
- padding:"5px 0",
64
- })
65
- const Left=(ctx)=>Flex(
66
- text("[ ]")
67
- ).style({
68
- width:"50px",
69
- //height:getComputedStyle(ctx.Input.element).height,
70
- height:"50px",
71
- margin:"10px 4px",
72
- padding:"5px",
73
- color:"darkblue",
74
- borderBottom:"4px solid gold",
75
- }).horizontal(0,0);
76
- const BTN_STYLE={
77
- background:"none",
78
- width:"25px",
79
- height:"25px",
80
- fontSize:"1.2rem",
81
- cursor:"pointer"
82
- }
83
- const Right=(ctx)=>Flex(
84
- text('▶️').style(BTN_STYLE).onClick(e=>{
85
- if(ctx.parent instanceof ZikoUICodeNote)ctx.parent.setCurrentNote(ctx);
86
- ctx.execute();
87
- globalThis.__Ziko__.__Config__.default.target=e.target.parent.parent[1][1];
88
- }),
89
- text('📋').style(BTN_STYLE).onClick(()=>{
90
- navigator.clipboard.writeText(ctx.codeText)
91
- }),
92
- text('✖️').style(BTN_STYLE).onClick(()=>ctx.remove()),
93
- text('✖️').style(BTN_STYLE).onClick(()=>ctx.remove()),
94
- ).style({
95
- width:"70px",
96
- height:"50px",
97
- //background:"cyan",
98
- margin:"10px 0"
99
- }).horizontal(0,0).wrap(true);
100
- export{
101
- Input,
102
- Output,
103
- Right,
104
- Left
105
- }