ziko 0.0.11 → 0.0.13

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 (278) hide show
  1. package/README.md +6 -3
  2. package/dist/ziko.cjs +5640 -4532
  3. package/dist/ziko.js +5640 -4532
  4. package/dist/ziko.min.js +2 -2
  5. package/dist/ziko.mjs +5602 -4532
  6. package/package.json +39 -12
  7. package/src/__helpers__/index.js +41 -0
  8. package/src/app/accessibility/index.js +0 -0
  9. package/src/app/app.js +46 -0
  10. package/src/app/component/index.js +38 -0
  11. package/src/app/globals/index.js +20 -0
  12. package/src/app/index.js +12 -0
  13. package/src/app/params/index.js +40 -0
  14. package/src/app/router/index.js +67 -0
  15. package/src/app/seo/index.js +43 -0
  16. package/src/app/themes/dark.js +885 -0
  17. package/src/app/themes/index.js +11 -0
  18. package/src/app/themes/light.js +255 -0
  19. package/src/data/api/fetchdom.js +14 -0
  20. package/src/data/api/index.js +4 -0
  21. package/src/data/api/preload.js +11 -0
  22. package/src/data/converter/adoc.js +130 -0
  23. package/src/data/converter/array.js +43 -0
  24. package/src/data/converter/canvas.js +25 -0
  25. package/src/data/converter/csv.js +33 -0
  26. package/src/data/converter/idea.txt +10 -0
  27. package/src/data/converter/index.js +34 -0
  28. package/src/data/converter/json.js +80 -0
  29. package/src/data/converter/markdown.js +95 -0
  30. package/src/data/converter/object.js +70 -0
  31. package/src/data/converter/svg.js +11 -0
  32. package/src/data/decorators.js +0 -0
  33. package/src/data/index.js +74 -0
  34. package/src/data/parser/markdown.js +0 -0
  35. package/src/data/parser/xml.js +47 -0
  36. package/src/data/string/index.js +1 -0
  37. package/src/data/string/patterns.js +12 -0
  38. package/src/data/string/string.js +170 -0
  39. package/src/graphics/canvas/_canvas_offscreen +0 -0
  40. package/src/graphics/canvas/canvas.js +189 -0
  41. package/src/graphics/canvas/elements/Basic/arc.js +43 -0
  42. package/src/graphics/canvas/elements/Basic/image.js +0 -0
  43. package/src/graphics/canvas/elements/Basic/line.js +26 -0
  44. package/src/graphics/canvas/elements/Basic/path.js +0 -0
  45. package/src/graphics/canvas/elements/Basic/points.js +48 -0
  46. package/src/graphics/canvas/elements/Basic/polygon.js +7 -0
  47. package/src/graphics/canvas/elements/Basic/polyline.js +0 -0
  48. package/src/graphics/canvas/elements/Basic/rect.js +46 -0
  49. package/src/graphics/canvas/elements/Basic/text.js +0 -0
  50. package/src/graphics/canvas/elements/Chart/histogram.js +0 -0
  51. package/src/graphics/canvas/elements/Chart/plot.js +0 -0
  52. package/src/graphics/canvas/elements/Chart/scatter.js +2 -0
  53. package/src/graphics/canvas/elements/Chart/stem.js +0 -0
  54. package/src/graphics/canvas/elements/Element.js +115 -0
  55. package/src/graphics/canvas/elements/Groupe.js +0 -0
  56. package/src/graphics/canvas/elements/grid.js +0 -0
  57. package/src/graphics/canvas/elements/index.js +13 -0
  58. package/src/graphics/canvas/filter/index.js +0 -0
  59. package/src/graphics/canvas/index.js +15 -0
  60. package/src/graphics/canvas/paint/index.js +0 -0
  61. package/src/graphics/canvas/utils/color.js +8 -0
  62. package/src/graphics/canvas/utils/floodFill.js +58 -0
  63. package/src/graphics/index.js +69 -0
  64. package/src/graphics/svg/Elements/Basic/circle.js +26 -0
  65. package/src/graphics/svg/Elements/Basic/ellipse.js +21 -0
  66. package/src/graphics/svg/Elements/Basic/foreignObject.js +33 -0
  67. package/src/graphics/svg/Elements/Basic/groupe.js +29 -0
  68. package/src/graphics/svg/Elements/Basic/image.js +33 -0
  69. package/src/graphics/svg/Elements/Basic/line.js +29 -0
  70. package/src/graphics/svg/Elements/Basic/link.js +30 -0
  71. package/src/graphics/svg/Elements/Basic/path.js +59 -0
  72. package/src/graphics/svg/Elements/Basic/polygon.js +32 -0
  73. package/src/graphics/svg/Elements/Basic/polyline.js +4 -0
  74. package/src/graphics/svg/Elements/Basic/rect.js +43 -0
  75. package/src/graphics/svg/Elements/Basic/text.js +26 -0
  76. package/src/graphics/svg/Elements/Derived/grid.js +9 -0
  77. package/src/graphics/svg/Elements/ZikoSvgElement.js +46 -0
  78. package/src/graphics/svg/Elements/index.js +14 -0
  79. package/src/graphics/svg/index.js +2 -0
  80. package/src/graphics/svg/svg.js +115 -0
  81. package/src/index.js +88 -0
  82. package/src/math/absract.js +1 -0
  83. package/src/math/calculus/index.js +1 -0
  84. package/src/math/calculus/special-functions/bessel.js +31 -0
  85. package/src/math/calculus/special-functions/beta.js +38 -0
  86. package/src/math/calculus/special-functions/gamma.js +30 -0
  87. package/src/math/calculus/special-functions/index.js +4 -0
  88. package/src/math/complex/Fractals/julia.js +0 -0
  89. package/src/math/complex/index.js +203 -0
  90. package/src/math/const.js +3 -0
  91. package/src/math/discret/Combinaison/index.js +34 -0
  92. package/src/math/discret/Conversion/index.js +86 -0
  93. package/src/math/discret/Logic/index.js +46 -0
  94. package/src/math/discret/Permutation/index.js +31 -0
  95. package/src/math/discret/Set/index.js +2 -0
  96. package/src/math/discret/Set/power-set.js +15 -0
  97. package/src/math/discret/Set/sub-set.js +10 -0
  98. package/src/math/discret/index.js +23 -0
  99. package/src/math/functions/index.js +182 -0
  100. package/src/math/index.js +189 -0
  101. package/src/math/matrix/Decomposition.js +90 -0
  102. package/src/math/matrix/LinearSystem.js +10 -0
  103. package/src/math/matrix/Matrix.js +717 -0
  104. package/src/math/matrix/index.js +3 -0
  105. package/src/math/numeric/index.js +0 -0
  106. package/src/math/random/index.js +173 -0
  107. package/src/math/signal/__np.py.txt +40 -0
  108. package/src/math/signal/conv.js +175 -0
  109. package/src/math/signal/fft.js +55 -0
  110. package/src/math/signal/filter.js +39 -0
  111. package/src/math/signal/functions.js +146 -0
  112. package/src/math/signal/index.js +110 -0
  113. package/src/math/statistics/Functions/index.js +100 -0
  114. package/src/math/statistics/index.js +16 -0
  115. package/src/math/utils/arithmetic.js +139 -0
  116. package/src/math/utils/checkers.js +29 -0
  117. package/src/math/utils/comparaison.js +1 -0
  118. package/src/math/utils/conversions.js +19 -0
  119. package/src/math/utils/discret.js +51 -0
  120. package/src/math/utils/index.js +102 -0
  121. package/src/math/utils/mapfun.js +50 -0
  122. package/src/reactivity/events/Global/Click.js +56 -0
  123. package/src/reactivity/events/Global/Clipboard.js +84 -0
  124. package/src/reactivity/events/Global/CustomEvent.js +53 -0
  125. package/src/reactivity/events/Global/Drag.js +137 -0
  126. package/src/reactivity/events/Global/Focus.js +56 -0
  127. package/src/reactivity/events/Global/Key.js +104 -0
  128. package/src/reactivity/events/Global/Mouse.js +230 -0
  129. package/src/reactivity/events/Global/Pointer.js +234 -0
  130. package/src/reactivity/events/Global/Swipe.js +147 -0
  131. package/src/reactivity/events/Global/Touch.js +0 -0
  132. package/src/reactivity/events/Global/Wheel.js +44 -0
  133. package/src/reactivity/events/Partiel/Hash.js +44 -0
  134. package/src/reactivity/events/Partiel/Input.js +59 -0
  135. package/src/reactivity/events/Partiel/Media.js +1 -0
  136. package/src/reactivity/events/ZikoEvent.js +91 -0
  137. package/src/reactivity/events/index.js +63 -0
  138. package/src/reactivity/hooks/Contexte/index.js +1 -0
  139. package/src/reactivity/hooks/Contexte/useSuccesifKeys.js +14 -0
  140. package/src/reactivity/hooks/Decorators/index.js +6 -0
  141. package/src/reactivity/hooks/Decorators/time.js +17 -0
  142. package/src/reactivity/hooks/Decorators/type.js +88 -0
  143. package/src/reactivity/hooks/Interactions/index.js +4 -0
  144. package/src/reactivity/hooks/Interactions/useBluetooth.js +48 -0
  145. package/src/reactivity/hooks/Interactions/useChannel.js +50 -0
  146. package/src/reactivity/hooks/Interactions/useEventEmmiter.js +64 -0
  147. package/src/reactivity/hooks/Interactions/useSerial.js +0 -0
  148. package/src/reactivity/hooks/Interactions/useThread.js +44 -0
  149. package/src/reactivity/hooks/Interactions/useUsb.js +0 -0
  150. package/src/reactivity/hooks/Sensors/index.js +2 -0
  151. package/src/reactivity/hooks/Sensors/useBattery.js +36 -0
  152. package/src/reactivity/hooks/Sensors/useCamera.js +0 -0
  153. package/src/reactivity/hooks/Sensors/useGeolocation.js +17 -0
  154. package/src/reactivity/hooks/Sensors/useMicro.js +0 -0
  155. package/src/reactivity/hooks/Sensors/useOrientation.js +0 -0
  156. package/src/reactivity/hooks/Storage/index.js +1 -0
  157. package/src/reactivity/hooks/Storage/useCookie.js +0 -0
  158. package/src/reactivity/hooks/Storage/useIndexedDb.js +0 -0
  159. package/src/reactivity/hooks/Storage/useStorage.js +73 -0
  160. package/src/reactivity/hooks/UI/index.js +5 -0
  161. package/src/reactivity/hooks/UI/useCssLink.js +0 -0
  162. package/src/reactivity/hooks/UI/useCssText.js +21 -0
  163. package/src/reactivity/hooks/UI/useFavIcon.js +38 -0
  164. package/src/reactivity/hooks/UI/useLinearGradient.js +0 -0
  165. package/src/reactivity/hooks/UI/useMediaQuery.js +43 -0
  166. package/src/reactivity/hooks/UI/useRadialGradient.js +0 -0
  167. package/src/reactivity/hooks/UI/useStyle.js +79 -0
  168. package/src/reactivity/hooks/UI/useTheme.js +62 -0
  169. package/src/reactivity/hooks/UI/useTitle.js +30 -0
  170. package/src/reactivity/hooks/index.js +85 -0
  171. package/src/reactivity/hooks/todo.md +26 -0
  172. package/src/reactivity/idea +2 -0
  173. package/src/reactivity/index.js +22 -0
  174. package/src/reactivity/observer/attributes.js +28 -0
  175. package/src/reactivity/observer/children.js +37 -0
  176. package/src/reactivity/observer/index.js +44 -0
  177. package/src/reactivity/observer/intersection.js +44 -0
  178. package/src/reactivity/observer/mutation.js +113 -0
  179. package/src/reactivity/observer/resize.js +47 -0
  180. package/src/reactivity/observer/screen.js +45 -0
  181. package/src/reactivity/observer/screen.js.txt +84 -0
  182. package/src/reactivity/observer/screen.txt +13 -0
  183. package/src/time/animation.js +76 -0
  184. package/src/time/index.js +54 -0
  185. package/src/time/loop.js +87 -0
  186. package/src/time/utils/decorators.js +17 -0
  187. package/src/time/utils/ease.js +144 -0
  188. package/src/time/utils/index.js +18 -0
  189. package/src/time/utils/performance.js +16 -0
  190. package/src/time/utils/ui.js +26 -0
  191. package/src/user-interface/elements/derived/Flex.js +103 -0
  192. package/src/user-interface/elements/derived/Grid.js +33 -0
  193. package/src/user-interface/elements/derived/elements/Notification.js +0 -0
  194. package/src/user-interface/elements/derived/elements/Popover.js +0 -0
  195. package/src/user-interface/elements/derived/elements/Popup.js +0 -0
  196. package/src/user-interface/elements/derived/elements/Swipper.js +4 -0
  197. package/src/user-interface/elements/derived/elements/Timeline.js +0 -0
  198. package/src/user-interface/elements/derived/elements/Toast.js +0 -0
  199. package/src/user-interface/elements/derived/elements/Treeview.js +0 -0
  200. package/src/user-interface/elements/derived/elements/accordion/accordion.js +45 -0
  201. package/src/user-interface/elements/derived/elements/accordion/collapsible.js +82 -0
  202. package/src/user-interface/elements/derived/elements/accordion/index.js +2 -0
  203. package/src/user-interface/elements/derived/elements/alert/alert.js +80 -0
  204. package/src/user-interface/elements/derived/elements/alert/index.js +1 -0
  205. package/src/user-interface/elements/derived/elements/alert/palette.js +52 -0
  206. package/src/user-interface/elements/derived/elements/carousel/index.js +50 -0
  207. package/src/user-interface/elements/derived/elements/code-note/SubElements.js.txt +105 -0
  208. package/src/user-interface/elements/derived/elements/code-note/code-cell.js +195 -0
  209. package/src/user-interface/elements/derived/elements/code-note/code-note.js +72 -0
  210. package/src/user-interface/elements/derived/elements/code-note/index.js +2 -0
  211. package/src/user-interface/elements/derived/elements/code-note/sub-elements.js +67 -0
  212. package/src/user-interface/elements/derived/elements/columns.js +1 -0
  213. package/src/user-interface/elements/derived/elements/fab.js +0 -0
  214. package/src/user-interface/elements/derived/elements/index.js +9 -0
  215. package/src/user-interface/elements/derived/elements/menu/index.js +1 -0
  216. package/src/user-interface/elements/derived/elements/menu/menu3d.js +260 -0
  217. package/src/user-interface/elements/derived/elements/modal/index.js +92 -0
  218. package/src/user-interface/elements/derived/elements/pagination/breadcrumbs.js +54 -0
  219. package/src/user-interface/elements/derived/elements/pagination/index.js +1 -0
  220. package/src/user-interface/elements/derived/elements/splitter/__ZikoUISplitter__.js +62 -0
  221. package/src/user-interface/elements/derived/elements/splitter/hsplitter.js +40 -0
  222. package/src/user-interface/elements/derived/elements/splitter/index.js +2 -0
  223. package/src/user-interface/elements/derived/elements/splitter/vsplitter.js +40 -0
  224. package/src/user-interface/elements/derived/elements/tabs/index.js +180 -0
  225. package/src/user-interface/elements/derived/index.js +3 -0
  226. package/src/user-interface/elements/primitives/ZikoUIContainerElement.js +127 -0
  227. package/src/user-interface/elements/primitives/ZikoUIElement.js +478 -0
  228. package/src/user-interface/elements/primitives/embaded/index.js +1 -0
  229. package/src/user-interface/elements/primitives/index.js +8 -0
  230. package/src/user-interface/elements/primitives/io/Form/index.js +42 -0
  231. package/src/user-interface/elements/primitives/io/Form/index.js.txt +104 -0
  232. package/src/user-interface/elements/primitives/io/Inputs/__helpers__.js +52 -0
  233. package/src/user-interface/elements/primitives/io/Inputs/index.js +12 -0
  234. package/src/user-interface/elements/primitives/io/Inputs/input/index.js +98 -0
  235. package/src/user-interface/elements/primitives/io/Inputs/input-camera/index.js +26 -0
  236. package/src/user-interface/elements/primitives/io/Inputs/input-checkbox/index.js +26 -0
  237. package/src/user-interface/elements/primitives/io/Inputs/input-color/index.js +16 -0
  238. package/src/user-interface/elements/primitives/io/Inputs/input-date-time/index.js +3 -0
  239. package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-date-time.js +14 -0
  240. package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-date.js +14 -0
  241. package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-time.js +14 -0
  242. package/src/user-interface/elements/primitives/io/Inputs/input-email-password/index.js +2 -0
  243. package/src/user-interface/elements/primitives/io/Inputs/input-email-password/input-email.js +15 -0
  244. package/src/user-interface/elements/primitives/io/Inputs/input-email-password/input-password.js +14 -0
  245. package/src/user-interface/elements/primitives/io/Inputs/input-file/index.js +1 -0
  246. package/src/user-interface/elements/primitives/io/Inputs/input-file/input-file.js +0 -0
  247. package/src/user-interface/elements/primitives/io/Inputs/input-file/input-image.js +43 -0
  248. package/src/user-interface/elements/primitives/io/Inputs/input-number/index.js +37 -0
  249. package/src/user-interface/elements/primitives/io/Inputs/input-radio/index.js +26 -0
  250. package/src/user-interface/elements/primitives/io/Inputs/input-search/index.js +45 -0
  251. package/src/user-interface/elements/primitives/io/Inputs/input-slider/index.js +34 -0
  252. package/src/user-interface/elements/primitives/io/Select/index.js +20 -0
  253. package/src/user-interface/elements/primitives/io/Textarea/index.js +18 -0
  254. package/src/user-interface/elements/primitives/io/index.js +4 -0
  255. package/src/user-interface/elements/primitives/list/elements.js +0 -0
  256. package/src/user-interface/elements/primitives/list/index.js +139 -0
  257. package/src/user-interface/elements/primitives/media/Audio/index.js +17 -0
  258. package/src/user-interface/elements/primitives/media/Image/figure.js +19 -0
  259. package/src/user-interface/elements/primitives/media/Image/image.js +36 -0
  260. package/src/user-interface/elements/primitives/media/Image/index.js +2 -0
  261. package/src/user-interface/elements/primitives/media/Video/index.js +27 -0
  262. package/src/user-interface/elements/primitives/media/__ZikoUIDynamicMediaELement__.js +47 -0
  263. package/src/user-interface/elements/primitives/media/index.js +3 -0
  264. package/src/user-interface/elements/primitives/misc/index.js +99 -0
  265. package/src/user-interface/elements/primitives/semantic/index.js +82 -0
  266. package/src/user-interface/elements/primitives/table/elements.js +94 -0
  267. package/src/user-interface/elements/primitives/table/index.js +3 -0
  268. package/src/user-interface/elements/primitives/table/table.js +115 -0
  269. package/src/user-interface/elements/primitives/table/utils.js +12 -0
  270. package/src/user-interface/elements/primitives/text/__ZikoUIText__.js +71 -0
  271. package/src/user-interface/elements/primitives/text/heading.js +36 -0
  272. package/src/user-interface/elements/primitives/text/index.js +3 -0
  273. package/src/user-interface/elements/primitives/text/p.js +26 -0
  274. package/src/user-interface/elements/primitives/text/pre.js +0 -0
  275. package/src/user-interface/elements/primitives/text/text.js +81 -0
  276. package/src/user-interface/index.js +188 -0
  277. package/src/user-interface/style/index.js +510 -0
  278. package/src/user-interface/utils/index.js +70 -0
@@ -0,0 +1,43 @@
1
+ import ZikoCanvasElement from "../Element.js";
2
+ class CanvasArc extends ZikoCanvasElement{
3
+ constructor(x,y,r,angle){
4
+ super(x,y);
5
+ this.r=r;
6
+ this.angle=angle;
7
+ this.path=null;
8
+ }
9
+ draw(ctx){
10
+ if(this.cache.config.rendered){
11
+ ctx.save();
12
+ this.applyNormalStyle(ctx);
13
+ ctx.beginPath();
14
+ this.path=new Path2D();
15
+ this.path.arc(this.px, this.py, this.r, 0, this.angle);
16
+ const{strokeEnabled,fillEnabled}=this.cache.style.normal;
17
+ if(strokeEnabled)ctx.stroke(this.path);
18
+ if(fillEnabled)ctx.fill(this.path);
19
+ ctx.closePath();
20
+ ctx.restore();
21
+ }
22
+ return this;
23
+ }
24
+ radius(r){
25
+ this.r=r;
26
+ if(this.parent)this.parent.draw();
27
+ return this;
28
+ }
29
+ // distanceFromCenter(x,y){
30
+ // return Math.sqrt(
31
+ // (this._x-x)**2-(this._y-y)**2
32
+ // )
33
+ // }
34
+ // isIn(x,y,strict=false){
35
+ // return strict?this.distanceFromCenter(x,y)<this.r:this.distanceFromCenter(x,y)<=this.r;
36
+ // }
37
+ // isInEdges(x,y){
38
+ // return this.distanceFromCenter(x,y)===this.r;
39
+ // }
40
+ }
41
+ const canvasArc=(x,y,r,phi)=>new CanvasArc(x,y,r,phi);
42
+ const canvasCircle=(x,y,r)=>new CanvasArc(x,y,r,2*Math.PI);
43
+ export{canvasArc,canvasCircle}
File without changes
@@ -0,0 +1,26 @@
1
+ import ZikoCanvasElement from "../Element.js";
2
+ class CanvasLine extends ZikoCanvasElement{
3
+ constructor(x0,y0,x1,y1){
4
+ super();
5
+ this.x0=x0;
6
+ this.x1=x1;
7
+ this.y0=y0;
8
+ this.y1=y1;
9
+ delete this.fill;
10
+ }
11
+ draw(ctx){
12
+ if(this.cache.config.rendered){
13
+ ctx.save();
14
+ this.applyNormalStyle(ctx);
15
+ ctx.beginPath();
16
+ ctx.moveTo(this.x0+this._x,this.y0+this._y_);
17
+ ctx.lineTo(this.x1+this._x,this.y1+this._y);
18
+ ctx.stroke();
19
+ if(this.cache.style.normal.strokeEnabled)ctx.stroke();
20
+ ctx.restore();
21
+ }
22
+ return this;
23
+ }
24
+ }
25
+ const canvasLine=(x0,y0,x1,y1)=>new CanvasLine(x0,y0,x1,y1)
26
+ export{canvasLine}
File without changes
@@ -0,0 +1,48 @@
1
+ import ZikoCanvasElement from "../Element.js";
2
+ import { matrix } from "../../../../math/matrix/index.js";
3
+ class CanvasPoints extends ZikoCanvasElement{
4
+ constructor(ptsX,ptsY){
5
+ super();
6
+ this.pointsMatrix=null;
7
+ this.path=new Path2D();
8
+ this.fromXY(ptsX,ptsY);
9
+ }
10
+ get points(){
11
+ return this.pointsMatrix.T.arr;
12
+ }
13
+ draw(ctx){
14
+ if(this.cache.config.rendered){
15
+ ctx.save();
16
+ this.applyNormalStyle(ctx);
17
+ ctx.beginPath();
18
+ this.path.moveTo(this.points[1][0]+this._x,this.points[1][1]+this._y);
19
+ for(let i=1;i<this.points.length;i++){
20
+ this.path.lineTo(this.points[i][0]+this._x,this.points[i][1]+this._y)
21
+ }
22
+ ctx.stroke(this.path);
23
+ ctx.restore();
24
+ }
25
+ return this;
26
+ }
27
+ fromXY(X,Y){
28
+ this.pointsMatrix=matrix([X,Y]);
29
+ return this;
30
+ }
31
+ push(ptsX,ptsY){
32
+ this.pointsMatrix.hstack(matrix([ptsX,ptsY]))
33
+ if(this.parent)this.parent.draw();
34
+ return this;
35
+ }
36
+ isIn(x,y){
37
+ let is;
38
+ if(this.parent){
39
+ this.parent.ctx.setTransform(1,0,0,1,0,0);
40
+ is=this.parent.ctx.isPointInPath(this.path,x,y);
41
+ this.parent.applyTransformMatrix();
42
+ }
43
+ return is;
44
+ }
45
+ }
46
+
47
+ const canvasPoints=(ptsX=[],ptsY=[])=>new CanvasPoints(ptsX,ptsY);
48
+ export{canvasPoints};
@@ -0,0 +1,7 @@
1
+ import ZikoCanvasElement from "../_element.js";
2
+ import { matrix } from "../../../../Math/Matrix/index.js";
3
+ class ZikoCanvasPolygon extends ZikoCanvasElement{
4
+ constructor(ptsX,ptsY){
5
+ super()
6
+ }
7
+ }
File without changes
@@ -0,0 +1,46 @@
1
+ import ZikoCanvasElement from "../Element.js";
2
+ class CanvasRect extends ZikoCanvasElement{
3
+ constructor(x,y,w,h){
4
+ super(x,y);
5
+ this.w=w;
6
+ this.h=h;
7
+ this.path=new Path2D();
8
+ }
9
+ draw(ctx){
10
+ if(this.cache.config.rendered){
11
+ ctx.save();
12
+ this.applyNormalStyle(ctx);
13
+ ctx.beginPath();
14
+ this.path.rect(this.px, this.py,this.w,this.h);
15
+ const{strokeEnabled,fillEnabled}=this.cache.style.normal;
16
+ if(strokeEnabled)ctx.stroke(this.path);
17
+ if(fillEnabled)ctx.fill(this.path);
18
+ ctx.closePath();
19
+ ctx.restore();
20
+ }
21
+ return this;
22
+ }
23
+ width(w){
24
+ this.w=w;
25
+ if(this.parent)this.parent.draw();
26
+ return this;
27
+ }
28
+ height(h){
29
+ this.h=h;
30
+ if(this.parent)this.parent.draw();
31
+ return this;
32
+ }
33
+ // distanceFromCenter(x,y){
34
+ // return Math.sqrt(
35
+ // (this.position.x-x)**2-(this.position.y-y)**2
36
+ // )
37
+ // }
38
+ // isIn(x,y,strict=false){
39
+ // return strict?this.distanceFromCenter(x,y)<this.r:this.distanceFromCenter(x,y)<=this.r;
40
+ // }
41
+ // isInEdges(x,y){
42
+ // return this.distanceFromCenter(x,y)===this.r;
43
+ // }
44
+ }
45
+ const canvasRect=(x,y,w,h)=>new CanvasRect(x,y,w,h)
46
+ export{canvasRect}
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ // Scatter = Circle[]
2
+
File without changes
@@ -0,0 +1,115 @@
1
+ class ZikoCanvasElement{
2
+ constructor(x,y){
3
+ this.parent=null;
4
+ this.position={
5
+ x,
6
+ y
7
+ }
8
+ this.cache={
9
+ interact:null/*avoid redraw*/,
10
+ config:{
11
+ draggable:false,
12
+ selected:false,
13
+ highlighted:false,
14
+ rendered:false
15
+ },
16
+ style:{
17
+ normal:{
18
+ strokeEnabled:true,
19
+ fillEnabled:false,
20
+ strokeColor:"#111111",
21
+ fillColor:"#777777",
22
+ },
23
+ highlighted:{
24
+ strokeEnabled:true,
25
+ fillEnabled:false,
26
+ strokeColor:null,
27
+ fillColor:null,
28
+ }
29
+ },
30
+ }
31
+ this.history={
32
+ position:[],
33
+ styles:[]
34
+ }
35
+ this.render();
36
+ }
37
+ get px(){
38
+ //_x=====>px
39
+ return (this.position.x??0)+(this.parent?.position?.x??0);
40
+ }
41
+ get py(){
42
+ //_y=====>py
43
+ return (this.position.y??0)+(this.parent?.position?.y??0);
44
+ }
45
+ isIntersectedWith(){
46
+
47
+ }
48
+ isInStroke(x,y){
49
+ let is;
50
+ if(this.parent){
51
+ this.parent.ctx.setTransform(1,0,0,1,0,0);
52
+ is=this.parent.ctx.isPointInStroke(this.path,x,y);
53
+ this.parent.applyTransformMatrix();
54
+ }
55
+ return is;
56
+ }
57
+ isInPath(x,y){
58
+ let is;
59
+ if(this.parent){
60
+ this.parent.ctx.setTransform(1,0,0,1,0,0);
61
+ is=this.parent.ctx.isPointInPath(this.path,x,y);
62
+ this.parent.applyTransformMatrix();
63
+ }
64
+ return is;
65
+ }
66
+ posX(x){
67
+ this.position.x=x;
68
+ if(this.parent)this.parent.draw()
69
+ return this;
70
+ }
71
+ posY(y){
72
+ this.position.y=y;
73
+ if(this.parent)this.parent.draw()
74
+ return this;
75
+ }
76
+ color({stroke=this.cache.style.normal.strokeColor,fill=this.cache.style.normal.fillColor}={stroke,fill}){
77
+ this.cache.style.normal.strokeColor=stroke;
78
+ this.cache.style.normal.fillColor=fill;
79
+ if(this.parent)this.parent.draw()
80
+ return this;
81
+ }
82
+ translate(dx=0,dy=0){
83
+ this.position.x+=dx;
84
+ this.position.y+=dy;
85
+ if(this.parent)this.parent.draw();
86
+ return;
87
+ }
88
+ applyNormalStyle(ctx){
89
+ ctx.strokeStyle=this.cache.style.normal.strokeColor;
90
+ ctx.fillStyle=this.cache.style.normal.fillColor;
91
+ return this;
92
+ }
93
+ applyHighlightedStyle(ctx){
94
+ ctx.strokeStyle=this.cache.style.highlighted.strokeColor;
95
+ ctx.fillStyle=this.cache.style.highlighted.fillColor;
96
+ return this;
97
+ }
98
+ stroke(color=this.cache.style.normal.strokeColor,enabled=true){
99
+ this.cache.style.normal.strokeEnabled=enabled;
100
+ this.cache.style.normal.strokeColor=color;
101
+ if(this.parent)this.parent.draw();
102
+ return this
103
+ }
104
+ fill(color=this.cache.style.normal.fillColor,enabled=true){
105
+ this.cache.style.normal.fillEnabled=enabled;
106
+ this.cache.style.normal.filleColor=color;
107
+ if(this.parent)this.parent.draw();
108
+ return this;
109
+ }
110
+ render(render=true){
111
+ this.cache.config.rendered=render;
112
+ return this;
113
+ }
114
+ }
115
+ export default ZikoCanvasElement;
File without changes
File without changes
@@ -0,0 +1,13 @@
1
+ export {
2
+ canvasArc,
3
+ canvasCircle
4
+ } from "./Basic/arc.js";
5
+ export {
6
+ canvasPoints
7
+ } from "./Basic/points.js";
8
+ export {
9
+ canvasLine
10
+ }from "./Basic/line.js"
11
+ export {
12
+ canvasRect
13
+ } from "./Basic/rect.js"
File without changes
@@ -0,0 +1,15 @@
1
+ import Canvas from "./canvas.js";
2
+ import {
3
+ ZikoUICanvas
4
+ } from "./canvas.js";
5
+ export {
6
+ canvasArc,
7
+ canvasCircle,
8
+ canvasPoints,
9
+ canvasLine,
10
+ canvasRect,
11
+ } from "./Elements/index.js";
12
+ export {
13
+ ZikoUICanvas,
14
+ Canvas,
15
+ }
File without changes
@@ -0,0 +1,8 @@
1
+ const hex2rgba = (hex) => {
2
+ return {
3
+ r: parseInt(hex.slice(1, 3), 16),
4
+ g: parseInt(hex.slice(3, 5), 16),
5
+ b: parseInt(hex.slice(5, 7), 16),
6
+ a: 255,
7
+ };
8
+ };
@@ -0,0 +1,58 @@
1
+ const floodFill=(parent, imageData, newColor, x, y)=>{
2
+ const { width, height, data } = imageData;
3
+ const stack = [];
4
+ const baseColor = parent.getColorAtPixel(imageData, x, y);
5
+ let operator = { x, y };
6
+
7
+ // Check if base color and new color are the same
8
+ if (parent.colorMatch(baseColor, newColor)) {
9
+ return;
10
+ }
11
+
12
+ // Add the clicked location to stack
13
+ stack.push({ x: operator.x, y: operator.y });
14
+
15
+ while (stack.length) {
16
+ operator = stack.pop();
17
+ let contiguousDown = true; // Vertical is assumed to be true
18
+ let contiguousUp = true; // Vertical is assumed to be true
19
+ let contiguousLeft = false;
20
+ let contiguousRight = false;
21
+
22
+ // Move to top most contiguousDown pixel
23
+ while (contiguousUp && operator.y >= 0) {
24
+ operator.y--;
25
+ contiguousUp = parent.colorMatch(parent.getColorAtPixel(imageData, operator.x, operator.y), baseColor);
26
+ }
27
+
28
+ // Move downward
29
+ while (contiguousDown && operator.y < height) {
30
+ parent.setColorAtPixel(imageData, newColor, operator.x, operator.y);
31
+
32
+ // Check left
33
+ if (operator.x - 1 >= 0 && parent.colorMatch(parent.getColorAtPixel(imageData, operator.x - 1, operator.y), baseColor)) {
34
+ if (!contiguousLeft) {
35
+ contiguousLeft = true;
36
+ stack.push({ x: operator.x - 1, y: operator.y });
37
+ }
38
+ } else {
39
+ contiguousLeft = false;
40
+ }
41
+
42
+ // Check right
43
+ if (operator.x + 1 < width && parent.colorMatch(parent.getColorAtPixel(imageData, operator.x + 1, operator.y), baseColor)) {
44
+ if (!contiguousRight) {
45
+ stack.push({ x: operator.x + 1, y: operator.y });
46
+ contiguousRight = true;
47
+ }
48
+ } else {
49
+ contiguousRight = false;
50
+ }
51
+
52
+ operator.y++;
53
+ contiguousDown = parent.colorMatch(parent.getColorAtPixel(imageData, operator.x, operator.y), baseColor);
54
+ }
55
+ }
56
+ return imageData;
57
+ }
58
+ export default floodFill;
@@ -0,0 +1,69 @@
1
+ import{
2
+ Svg,
3
+ ZikoUISvg,
4
+ svgCircle,
5
+ svgEllipse,
6
+ svgImage,
7
+ svgLine,
8
+ svgPolygon,
9
+ svgRect,
10
+ svgText,
11
+ svgGroupe,
12
+ svgLink,
13
+ svgGrid,
14
+ svgObject,
15
+ svgPath
16
+ } from "./svg/index.js";
17
+ import {
18
+ Canvas,
19
+ canvasArc,
20
+ canvasCircle,
21
+ canvasPoints,
22
+ canvasLine,
23
+ canvasRect
24
+ } from "./canvas/index.js";
25
+ const Graphics={
26
+ Svg,
27
+ ZikoUISvg,
28
+ svgCircle,
29
+ svgEllipse,
30
+ svgImage,
31
+ svgLine,
32
+ svgPolygon,
33
+ svgRect,
34
+ svgText,
35
+ svgGroupe,
36
+ svgLink,
37
+ svgGrid,
38
+ svgObject,
39
+ svgPath,
40
+ Canvas,
41
+ canvasArc,
42
+ canvasCircle,
43
+ canvasPoints,
44
+ canvasLine,
45
+ canvasRect,
46
+ ExtractAll: function () {
47
+ const keys = Object.keys(this);
48
+ for (let i = 0; i < keys.length; i++) {
49
+ const key = keys[i];
50
+ if (key !== 'ExtractAll' && key !== 'RemoveAll') {
51
+ globalThis[key] = this[key];
52
+ }
53
+ }
54
+ return this;
55
+ },
56
+ RemoveAll: function () {
57
+ const keys = Object.keys(this);
58
+ for (let i = 0; i < keys.length; i++) {
59
+ const key = keys[i];
60
+ if (key !== 'RemoveAll') {
61
+ delete globalThis[key];
62
+ }
63
+ }
64
+ return this;
65
+ }
66
+ }
67
+ export * from "./svg/index.js"
68
+ export * from "./canvas/index.js"
69
+ export default Graphics;
@@ -0,0 +1,26 @@
1
+ import ZikoSvgElement from "../ZikoSvgElement.js";
2
+ class ZikoSvgCircle extends ZikoSvgElement{
3
+ constructor(cx,cy,r){
4
+ super("circle")
5
+ this.element=document?.createElementttNS(
6
+ "http://www.w3.org/2000/svg",
7
+ "circle",
8
+ );
9
+ this.pos(cx,cy).setR(r);
10
+ }
11
+ setR(r){
12
+ this.element.r.baseVal.value=r;
13
+ return this;
14
+ }
15
+ get r(){
16
+ return this.element.baseVal.value;
17
+ }
18
+ get cx(){
19
+ return this.element.baseVal.value;
20
+ }
21
+ get cy(){
22
+ return this.element.baseVal.value;
23
+ }
24
+ }
25
+ const svgCircle=(x,y,r)=>new ZikoSvgCircle(x,y,r);
26
+ export { svgCircle }
@@ -0,0 +1,21 @@
1
+ import ZikoSvgElement from "../ZikoSvgElement.js";
2
+ class ZikoSvgEllipse extends ZikoSvgElement{
3
+ constructor(cx,cy,rx,ry){
4
+ super("ellipse")
5
+ this.element=document?.createElementNS(
6
+ "http://www.w3.org/2000/svg",
7
+ "ellipse",
8
+ );
9
+ this.pos(cx,cy).setRx(rx).setRy(ry);
10
+ }
11
+ setRx(rx){
12
+ this.element.rx.baseVal.value=rx;
13
+ return this;
14
+ }
15
+ setRy(ry){
16
+ this.element.ry.baseVal.value=ry;
17
+ return this;
18
+ }
19
+ }
20
+ const svgEllipse=(x,y,rx,ry)=>new ZikoSvgEllipse(x,y,rx,ry);
21
+ export{ svgEllipse }
@@ -0,0 +1,33 @@
1
+ import ZikoSvgElement from "../ZikoSvgElement.js";
2
+ import { Flex } from "../../../../user-interface/elements/derived/Flex.js"
3
+ class ZikoSvgForeignObject extends ZikoSvgElement{
4
+ constructor(x=0,y=0,w="100%",h="100%",...ZikoUIElement){
5
+ super("foreignObject")
6
+ this.items=[];
7
+ this.element=document?.createElementtNS(
8
+ "http://www.w3.org/2000/svg",
9
+ "foreignObject",
10
+ );
11
+ this.container=Flex().setTarget(this.element).vertical(0,0).size("auto","auto");
12
+ this.container.st.scaleY(-1);
13
+ this.posX(x).posY(y).width(w).height(h);
14
+ }
15
+ width(w){
16
+ this.element.etAttribute("width",w)
17
+ return this;
18
+ }
19
+ height(h){
20
+ this.element.etAttribute("height",h)
21
+ return this;
22
+ }
23
+ add(...ZikoUIElement){
24
+ this.container.append(...ZikoUIElement);
25
+ return this;
26
+ }
27
+ remove(...ZikoUIElement){
28
+ this.container.append(...ZikoUIElement);
29
+ return this;
30
+ }
31
+ }
32
+ const svgObject=(x,y,r)=>new ZikoSvgForeignObject(x,y,r);
33
+ export { svgObject }
@@ -0,0 +1,29 @@
1
+ import ZikoSvgElement from "../ZikoSvgElement.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 { svgGroupe }
@@ -0,0 +1,33 @@
1
+ import ZikoSvgElement from "../ZikoSvgElement.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 { svgImage }
@@ -0,0 +1,29 @@
1
+ import ZikoSvgElement from "../ZikoSvgElement.js";
2
+ class ZikoSvgLine extends ZikoSvgElement{
3
+ constructor(x1,y1,x2,y2){
4
+ super()
5
+ this.element=document?.createElementtNS(
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{ svgLine }