ziko 0.0.23 → 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 (156) hide show
  1. package/dist/ziko.cjs +78 -2817
  2. package/dist/ziko.js +78 -2817
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +76 -2755
  5. package/package.json +1 -1
  6. package/src/app/globals.js +4 -2
  7. package/src/data/converter/index.js +2 -6
  8. package/src/data/parser/index.js +1 -1
  9. package/src/graphics/canvas/index.js +176 -2
  10. package/src/graphics/canvas/utils/floodFill.js +0 -1
  11. package/src/graphics/svg/index.js +69 -2
  12. package/src/reactivity/hooks/index.js +1 -1
  13. package/src/ui/elements/{primitives/ZikoUIElement.js → ZikoUIElement.js} +8 -9
  14. package/src/ui/elements/{derived/flex → flex}/index.js +2 -2
  15. package/src/ui/elements/{derived/grid → grid}/index.js +2 -2
  16. package/src/ui/elements/{primitives/index.js → index.js} +3 -1
  17. package/src/ui/elements/{primitives/io → io}/Form/index.js +1 -1
  18. package/src/ui/elements/{primitives/io → io}/Inputs/__helpers__.js +1 -1
  19. package/src/ui/elements/{primitives/io → io}/Inputs/input/index.js +1 -1
  20. package/src/ui/elements/{primitives/list → list}/index.js +2 -3
  21. package/src/ui/elements/{primitives/misc → misc}/index.js +2 -3
  22. package/src/ui/elements/{primitives/semantic → semantic}/index.js +8 -8
  23. package/src/ui/elements/{primitives/table → table}/table.js +1 -1
  24. package/src/ui/elements/{primitives/text → text}/__ZikoUIText__.js +3 -4
  25. package/src/ui/index.js +21 -21
  26. package/src/ui/utils/index.js +1 -1
  27. package/src/data/parser/markdown.js +0 -0
  28. package/src/graphics/canvas/canvas.js +0 -176
  29. package/src/graphics/canvas/elements/Basic/arc.js +0 -43
  30. package/src/graphics/canvas/elements/Basic/image.js +0 -0
  31. package/src/graphics/canvas/elements/Basic/line.js +0 -26
  32. package/src/graphics/canvas/elements/Basic/path.js +0 -0
  33. package/src/graphics/canvas/elements/Basic/points.js +0 -48
  34. package/src/graphics/canvas/elements/Basic/polygon.js +0 -7
  35. package/src/graphics/canvas/elements/Basic/polyline.js +0 -0
  36. package/src/graphics/canvas/elements/Basic/rect.js +0 -46
  37. package/src/graphics/canvas/elements/Basic/text.js +0 -0
  38. package/src/graphics/canvas/elements/Chart/histogram.js +0 -0
  39. package/src/graphics/canvas/elements/Chart/plot.js +0 -0
  40. package/src/graphics/canvas/elements/Chart/scatter.js +0 -2
  41. package/src/graphics/canvas/elements/Chart/stem.js +0 -0
  42. package/src/graphics/canvas/elements/Element.js +0 -115
  43. package/src/graphics/canvas/elements/index.js +0 -13
  44. package/src/graphics/svg/Elements/Basic/circle.js +0 -29
  45. package/src/graphics/svg/Elements/Basic/ellipse.js +0 -24
  46. package/src/graphics/svg/Elements/Basic/foreign-object.js +0 -36
  47. package/src/graphics/svg/Elements/Basic/groupe.js +0 -32
  48. package/src/graphics/svg/Elements/Basic/image.js +0 -36
  49. package/src/graphics/svg/Elements/Basic/index.js +0 -11
  50. package/src/graphics/svg/Elements/Basic/line.js +0 -32
  51. package/src/graphics/svg/Elements/Basic/link.js +0 -33
  52. package/src/graphics/svg/Elements/Basic/path.js +0 -62
  53. package/src/graphics/svg/Elements/Basic/polygon.js +0 -32
  54. package/src/graphics/svg/Elements/Basic/polyline.js +0 -7
  55. package/src/graphics/svg/Elements/Basic/rect.js +0 -46
  56. package/src/graphics/svg/Elements/Basic/text.js +0 -29
  57. package/src/graphics/svg/Elements/Derived/grid.js +0 -9
  58. package/src/graphics/svg/Elements/Derived/index.js +0 -1
  59. package/src/graphics/svg/Elements/index.js +0 -2
  60. package/src/graphics/svg/Elements/ziko-svg-element.js +0 -48
  61. package/src/graphics/svg/svg.js +0 -69
  62. package/src/reactivity/hooks/Interactions/useSerial.js +0 -0
  63. package/src/types.js +0 -73
  64. package/src/ui/elements/derived/accordion/accordion.js +0 -42
  65. package/src/ui/elements/derived/accordion/collapsible.js +0 -82
  66. package/src/ui/elements/derived/accordion/index.js +0 -2
  67. package/src/ui/elements/derived/alert/alert.js +0 -80
  68. package/src/ui/elements/derived/alert/index.js +0 -1
  69. package/src/ui/elements/derived/alert/palette.js +0 -52
  70. package/src/ui/elements/derived/carousel/index.js +0 -51
  71. package/src/ui/elements/derived/code-note/SubElements.js.txt +0 -105
  72. package/src/ui/elements/derived/code-note/code-cell.js +0 -195
  73. package/src/ui/elements/derived/code-note/code-note.js +0 -72
  74. package/src/ui/elements/derived/code-note/index.js +0 -2
  75. package/src/ui/elements/derived/code-note/sub-elements.js +0 -67
  76. package/src/ui/elements/derived/index.js +0 -12
  77. package/src/ui/elements/derived/menu/index.js +0 -1
  78. package/src/ui/elements/derived/menu/menu3d.js +0 -260
  79. package/src/ui/elements/derived/modal/index.js +0 -92
  80. package/src/ui/elements/derived/pagination/breadcrumbs.js +0 -54
  81. package/src/ui/elements/derived/pagination/index.js +0 -1
  82. package/src/ui/elements/derived/slider/__ZikoUISlider__.js +0 -112
  83. package/src/ui/elements/derived/slider/hSlider.js +0 -34
  84. package/src/ui/elements/derived/slider/index.js +0 -12
  85. package/src/ui/elements/derived/slider/vSlider.js +0 -27
  86. package/src/ui/elements/derived/splitter/__ZikoUISplitter__.js +0 -62
  87. package/src/ui/elements/derived/splitter/hsplitter.js +0 -40
  88. package/src/ui/elements/derived/splitter/index.js +0 -12
  89. package/src/ui/elements/derived/splitter/vsplitter.js +0 -40
  90. package/src/ui/elements/derived/tabs/index.js +0 -180
  91. package/src/ui/elements/primitives/ZikoUIContainerElement.js +0 -123
  92. /package/src/{global → _global (To Be Replaced )}/_themes/dark.js +0 -0
  93. /package/src/{global → _global (To Be Replaced )}/_themes/index.js +0 -0
  94. /package/src/{global → _global (To Be Replaced )}/_themes/light.js +0 -0
  95. /package/src/{global → _global (To Be Replaced )}/app/index.js +0 -0
  96. /package/src/{global → _global (To Be Replaced )}/component/index.js +0 -0
  97. /package/src/{global → _global (To Be Replaced )}/globals/index.js +0 -0
  98. /package/src/{global → _global (To Be Replaced )}/index.js +0 -0
  99. /package/src/{global → _global (To Be Replaced )}/params/index.js +0 -0
  100. /package/src/{global → _global (To Be Replaced )}/router/index.js +0 -0
  101. /package/src/{global → _global (To Be Replaced )}/seo/index.js +0 -0
  102. /package/src/{global → _global (To Be Replaced )}/style/index.js +0 -0
  103. /package/src/data/converter/{adoc.js → __(To Be Moved)adoc.js} +0 -0
  104. /package/src/data/converter/{markdown.js → __(To Be Moved)markdown.js} +0 -0
  105. /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/index.js +0 -0
  106. /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/useBattery.js +0 -0
  107. /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/useCamera.js +0 -0
  108. /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/useGeolocation.js +0 -0
  109. /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/useMicro.js +0 -0
  110. /package/src/reactivity/hooks/{Sensors → Sensors ( To Be Moved )}/useOrientation.js +0 -0
  111. /package/src/ui/elements/{primitives/embaded → embaded}/html.js +0 -0
  112. /package/src/ui/elements/{primitives/embaded → embaded}/index.js +0 -0
  113. /package/src/ui/elements/{primitives/embaded → embaded}/pdf.js +0 -0
  114. /package/src/ui/elements/{primitives/embaded → embaded}/youtube.js +0 -0
  115. /package/src/ui/elements/{primitives/hydrate.js → hydrate.js} +0 -0
  116. /package/src/ui/elements/{primitives/io → io}/Form/index.js.txt +0 -0
  117. /package/src/ui/elements/{primitives/io → io}/Inputs/index.js +0 -0
  118. /package/src/ui/elements/{primitives/io → io}/Inputs/input-camera/index.js +0 -0
  119. /package/src/ui/elements/{primitives/io → io}/Inputs/input-checkbox/index.js +0 -0
  120. /package/src/ui/elements/{primitives/io → io}/Inputs/input-color/index.js +0 -0
  121. /package/src/ui/elements/{primitives/io → io}/Inputs/input-date-time/index.js +0 -0
  122. /package/src/ui/elements/{primitives/io → io}/Inputs/input-date-time/input-date-time.js +0 -0
  123. /package/src/ui/elements/{primitives/io → io}/Inputs/input-date-time/input-date.js +0 -0
  124. /package/src/ui/elements/{primitives/io → io}/Inputs/input-date-time/input-time.js +0 -0
  125. /package/src/ui/elements/{primitives/io → io}/Inputs/input-email-password/index.js +0 -0
  126. /package/src/ui/elements/{primitives/io → io}/Inputs/input-email-password/input-email.js +0 -0
  127. /package/src/ui/elements/{primitives/io → io}/Inputs/input-email-password/input-password.js +0 -0
  128. /package/src/ui/elements/{primitives/io → io}/Inputs/input-file/index.js +0 -0
  129. /package/src/ui/elements/{primitives/io → io}/Inputs/input-file/input-file.js +0 -0
  130. /package/src/ui/elements/{primitives/io → io}/Inputs/input-file/input-image.js +0 -0
  131. /package/src/ui/elements/{primitives/io → io}/Inputs/input-number/index.js +0 -0
  132. /package/src/ui/elements/{primitives/io → io}/Inputs/input-radio/index.js +0 -0
  133. /package/src/ui/elements/{primitives/io → io}/Inputs/input-search/index.js +0 -0
  134. /package/src/ui/elements/{primitives/io → io}/Inputs/input-slider/index.js +0 -0
  135. /package/src/ui/elements/{primitives/io → io}/Select/index.js +0 -0
  136. /package/src/ui/elements/{primitives/io → io}/Textarea/index.js +0 -0
  137. /package/src/ui/elements/{primitives/io → io}/index.js +0 -0
  138. /package/src/ui/elements/{primitives/list → list}/elements.js +0 -0
  139. /package/src/ui/elements/{primitives/media → media}/Audio/index.js +0 -0
  140. /package/src/ui/elements/{primitives/media → media}/Image/figure.js +0 -0
  141. /package/src/ui/elements/{primitives/media → media}/Image/image.js +0 -0
  142. /package/src/ui/elements/{primitives/media → media}/Image/index.js +0 -0
  143. /package/src/ui/elements/{primitives/media → media}/Video/index.js +0 -0
  144. /package/src/ui/elements/{primitives/media → media}/__ZikoUIDynamicMediaELement__.js +0 -0
  145. /package/src/ui/elements/{primitives/media → media}/index.js +0 -0
  146. /package/src/ui/elements/{primitives/misc → misc}/hyperscript.js +0 -0
  147. /package/src/ui/elements/{primitives/misc → misc}/suspense.js +0 -0
  148. /package/src/ui/elements/{primitives/misc → misc}/xml-wrapper.js +0 -0
  149. /package/src/ui/elements/{primitives/table → table}/elements.js +0 -0
  150. /package/src/ui/elements/{primitives/table → table}/index.js +0 -0
  151. /package/src/ui/elements/{primitives/table → table}/utils.js +0 -0
  152. /package/src/ui/elements/{primitives/text → text}/heading.js +0 -0
  153. /package/src/ui/elements/{primitives/text → text}/index.js +0 -0
  154. /package/src/ui/elements/{primitives/text → text}/p.js +0 -0
  155. /package/src/ui/elements/{primitives/text → text}/pre.js +0 -0
  156. /package/src/ui/elements/{primitives/text → text}/text.js +0 -0
@@ -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
- }
@@ -1,195 +0,0 @@
1
- import { Flex, ZikoUIFlex } from "../Flex";
2
- import { ZikoUICodeNote } from "./code-note";
3
- import {
4
- Input,
5
- Output,
6
- Right,
7
- Left
8
- } from "./sub-elements";
9
- class ZikoUICodeCell extends ZikoUIFlex{
10
- constructor(code="",{type="js",order=null}={}){
11
- super("section")
12
- Object.assign(this.cache,{
13
- state:null,
14
- order,
15
- type,
16
- metadata:{
17
- created:Date.now(),
18
- updated:null
19
- }
20
- })
21
- this.Input=Input(code);
22
- this.Output=Output();
23
- this.InOut=Flex(
24
- this.Input,
25
- this.Output
26
- ).vertical().style({
27
- width:"100%",
28
- margin:"10px auto"
29
- });
30
- this.RightControl=Right(this);
31
- this.LeftControl=Left(this)
32
- this.append(
33
- this.LeftControl,
34
- this.InOut,
35
- this.RightControl
36
- )
37
- this.horizontal(-1,1).style({
38
- //background:"#444",
39
- width:"95vw",
40
- margin:"0 auto",
41
- border:"1px darkblue dotted"
42
- })
43
- let cm_content = this.Input.element.getElementsByClassName("cm-content")[0];
44
- if( cm_content ){
45
- cm_content.addEventListener("keydown",e=>{
46
- if(e.key === "Enter" && e.shiftKey){
47
- e.preventDefault();
48
- this.execute(this.cache.order);
49
- }
50
- })
51
- }
52
- else{
53
- this.Input.onKeyDown(e=>{
54
- if(e.kd==="Enter"){
55
- if(e.event.shiftKey){
56
- e.event.preventDefault();
57
- this.execute(this.cache.order);
58
- }
59
- else {
60
- //console.log(this.Input.element.firstChild.firstChild.textContent.at(-1))
61
- }
62
- }
63
- if(this.cache.parent instanceof ZikoUICodeNote){
64
- if(e.kd==="ArrowDown" && e.event.shiftKey ){
65
- this.cache.parent.next();
66
- }
67
- if(e.kd==="ArrowUp" && e.event.shiftKey){
68
- this.cache.parent.previous();
69
- }
70
- }
71
- }
72
- )
73
- this.Input.onFocus(()=>{
74
- if(this.cache.parent instanceof ZikoUICodeNote){
75
- this.cache.parent.cache.currentNote=this;
76
- this.cache.parent.setCurrentNote(this);
77
- }
78
- })
79
- this.Input.onPaste((e)=>{
80
- //e.event.preventDefault();
81
- //this.setValue(this.codeText.trim())
82
- })
83
- // this.Input.onKeyPress(e=>{
84
- // if(e.kp==="(")a.Input.element.textContent+=")";
85
- // if(e.kp==="[")a.Input.element.textContent+="]";
86
- // if(e.kp==="{")a.Input.element.textContent+="}";
87
- // })
88
- }
89
- }
90
- get isCodeCell(){
91
- return true;
92
- }
93
- // space &nbsp
94
- get codeText() {
95
- return (this.Input.element.getElementsByClassName("cm-content")[0])
96
- ?this.Input.element.getElementsByClassName("cm-content")[0].innerText.trim()
97
- :this.Input.element.innerText.trim()
98
- // return this.Input.element.innerText.trim();
99
- }
100
- get codeHTML() {
101
- return this.Input.element.innerHTML;
102
- }
103
- get outputHTML(){
104
- return this.Output.element.innerHTML;
105
- }
106
- setValue(codeText){
107
- this.Input[0].setValue(codeText);
108
- return this;
109
- }
110
- cellData(){
111
- return {
112
- input:this.codeText,
113
- output:this.outputHTML,
114
- order:this.cache.order,
115
- type:this.cache.type
116
- }
117
- }
118
- execute(order){
119
- this.clearOutput();
120
- this.evaluate(order);
121
- this.cache.metadata.updated=Date.now();
122
- return this;
123
- }
124
- #evaluateJs(order){
125
- try{
126
- this.LeftControl[0].setValue("pending");
127
- this.cache.state="pending";
128
- // globalThis.eval(this.Input.element.innerText);
129
- globalThis.eval(this.codeText);
130
-
131
- }
132
- catch(err){
133
- console.log(err)
134
- text(`Error : ${err.message}`).style({
135
- color:"red",
136
- background:"gold",
137
- border:"2px red solid",
138
- padding:"10px",
139
- margin:"10px 0",
140
- display:"flex",
141
- justifyContent: "center",
142
- });
143
- this.LeftControl[0].setValue("Err");
144
- this.cache.state="Error";
145
- }
146
- finally{
147
- if(this.cache.state==="pending"){
148
- this.cache.state="success";
149
- this.setOrder(order);
150
- if(this.cache.parent instanceof ZikoUICodeNote){
151
- this.cache.parent.incrementOrder();
152
- this.cache.parent.next();
153
- }
154
- }
155
- }
156
- }
157
- #evaluateMd(){
158
-
159
- }
160
- #evaluateHtml(){
161
-
162
- }
163
- evaluate(order){
164
- globalThis.__Ziko__.__Config__.default.target=this.Output.element;
165
- switch(this.cache.type){
166
- case "js":this.#evaluateJs(order);break;
167
- }
168
- return this;
169
- }
170
- clearInput(){
171
- this.Output.element.innerText="";
172
- return this;
173
- }
174
- clearOutput(){
175
- this.Output.element.innerText="";
176
- return this;
177
- }
178
- setOrder(order,render=true){
179
- this.cache.order=order;
180
- if(render){
181
- (typeof order === "number")?this.LeftControl[0].setValue(`[${order}]`):this.LeftControl[0].setValue("[-]");
182
- }
183
- return this;
184
- }
185
- focus(){
186
- this.Input.element.focus();
187
- return this;
188
- }
189
- }
190
-
191
-
192
- const CodeCell=(codeText,{type,order}={})=>new ZikoUICodeCell(codeText,{type,order});
193
- export{
194
- CodeCell
195
- }
@@ -1,72 +0,0 @@
1
- import { ZikoUIFlex } from "../Flex";
2
- import { CodeCell } from "./code-cell";
3
- class ZikoUICodeNote extends ZikoUIFlex{
4
- constructor(){
5
- super("section");
6
- Object.assign(this.cache,{
7
- order:0,
8
- currentNote:null,
9
- currentNoteIndex:null
10
- })
11
- this.vertical(0,0);
12
- }
13
- get isCodeNote(){
14
- return true;
15
- }
16
- setCurrentNote(currentNote){
17
- this.cache.currentNote=currentNote;
18
- this.cache.currentNoteIndex=this.items.findIndex(n=>n===currentNote);
19
- currentNote.focus();
20
- this.items.forEach(n=>n.Input.style({
21
- border: "1px solid #ccc"
22
- }))
23
- currentNote.Input.style({
24
- border:"2px lightgreen solid"
25
- });
26
- return this;
27
- }
28
- addNote(text=""){
29
- this.append(CodeCell(text));
30
- return this;
31
- }
32
- execute(){
33
- this.cache.currentNote.execute();
34
- this.incrementOrder();
35
- return this;
36
- }
37
- incrementOrder(){
38
- this.cache.order++;
39
- this.cache.currentNote.setOrder(this.cache.order);
40
- return this;
41
- }
42
- next(){
43
- if(this.cache.currentNote===this.items.at(-1)){
44
- this.addNote();
45
- this.setCurrentNote(this.items.at(-1));
46
- }
47
- else this.setCurrentNote(this.items[this.cache.currentNoteIndex+1]);
48
- return this;
49
- }
50
- previous(){
51
- // add append before
52
- if(this.cache.currentNote!==this.items[0]){
53
- this.setCurrentNote(this.items[this.cache.currentNoteIndex-1]);
54
- }
55
- return this;
56
- }
57
- data(){
58
- return this.items.map(n=>n.cellData());
59
- }
60
- serialize(){
61
- return JSON.stringify(this.data());
62
- }
63
- import(data=[]){
64
- data.forEach((n,i)=>this.addNote(data[i].input));
65
- return this;
66
- }
67
- }
68
- const CodeNote=()=>new ZikoUICodeNote();
69
- export{
70
- CodeNote,
71
- ZikoUICodeNote
72
- }
@@ -1,2 +0,0 @@
1
- export * from "./code-cell.js";
2
- export * from "./code-note.js";
@@ -1,67 +0,0 @@
1
- import { html } from "../../primitives/misc/index.js";
2
- import { Flex } from "../flex";
3
- import { text } from "../../primitives/text/index.js";
4
- import { ZikoUICodeNote } from "./code-note.js";
5
-
6
-
7
- const Input=(codeText="")=>html("code",codeText).style({
8
- width:"100%",
9
- height:"auto",
10
- padding:"10px",
11
- boxSizing:"border-box",
12
- border: "1px solid #ccc",
13
- outline: "none",
14
- fontSize: "1rem",
15
- fontFamily: "Lucida Console, Courier New, monospace",
16
- padding: "1rem 0.5rem",
17
- wordBreak:"break-all",
18
- background:"#f6f8fa",
19
- color:"#0062C3"
20
- }).setAttr("contenteditable",true).setAttr("spellcheck",false);
21
-
22
- const Output=()=>html("output").style({
23
- width:"100%",
24
- height:"auto",
25
- padding:"5px 0",
26
- })
27
- const Left=(ctx)=>Flex(
28
- text("[ ]")
29
- ).style({
30
- width:"50px",
31
- //height:getComputedStyle(ctx.Input.element).height,
32
- height:"50px",
33
- margin:"10px 4px",
34
- padding:"5px",
35
- color:"darkblue",
36
- borderBottom:"4px solid gold",
37
- }).horizontal(0,0);
38
- const BTN_STYLE={
39
- background:"none",
40
- width:"25px",
41
- height:"25px",
42
- fontSize:"1.2rem",
43
- cursor:"pointer"
44
- }
45
- const Right=(ctx)=>Flex(
46
- text('▶️').style(BTN_STYLE).onClick(e=>{
47
- if(ctx.parent instanceof ZikoUICodeNote)ctx.parent.setCurrentNote(ctx);
48
- ctx.execute();
49
- globalThis.__Ziko__.__Config__.default.target=e.target.parent.parent[1][1];
50
- }),
51
- text('📋').style(BTN_STYLE).onClick(()=>{
52
- navigator.clipboard.writeText(ctx.codeText)
53
- }),
54
- text('✖️').style(BTN_STYLE).onClick(()=>ctx.remove()),
55
- text('✖️').style(BTN_STYLE).onClick(()=>ctx.remove()),
56
- ).style({
57
- width:"70px",
58
- height:"50px",
59
- //background:"cyan",
60
- margin:"10px 0"
61
- }).horizontal(0,0).wrap(true);
62
- export{
63
- Input,
64
- Output,
65
- Right,
66
- Left
67
- }
@@ -1,12 +0,0 @@
1
- export * from "./flex";
2
- export * from "./grid";
3
- export * from "./accordion";
4
- export * from "./carousel";
5
- export * from "./code-note";
6
- export * from "./tabs";
7
- export * from "./alert";
8
- export * from "./splitter";
9
- export * from "./pagination";
10
- export * from "./menu";
11
- export * from "./modal"
12
- export * from "./slider"
@@ -1 +0,0 @@
1
- export * from "./menu3d.js"