ziko 0.0.5 → 0.0.6

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 (235) hide show
  1. package/dist/ziko.cjs +9999 -9853
  2. package/dist/ziko.js +10000 -9854
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +9999 -9853
  5. package/package.json +12 -4
  6. package/starter/bin/index.js +10 -0
  7. package/wrapper/react/README.md +26 -0
  8. package/wrapper/react/index.jsx +7 -1
  9. package/wrapper/svelte/ZikoUI.svelte +15 -0
  10. package/wrapper/vue/ZikoUI.vue +8 -2
  11. package/core/App/Accessibility/index.js +0 -0
  12. package/core/App/Globals/__Target__.js +0 -3
  13. package/core/App/Globals/__UI__.js +0 -38
  14. package/core/App/Globals/__init__.js +0 -8
  15. package/core/App/Globals/index.js +0 -18
  16. package/core/App/Router/index.js +0 -40
  17. package/core/App/Seo/index.js +0 -43
  18. package/core/App/Themes/dark.js +0 -885
  19. package/core/App/Themes/index.js +0 -11
  20. package/core/App/Themes/light.js +0 -255
  21. package/core/App/app.js +0 -46
  22. package/core/App/index.js +0 -12
  23. package/core/Data/Api/fetchdom.js +0 -14
  24. package/core/Data/Api/index.js +0 -4
  25. package/core/Data/Api/preload.js +0 -11
  26. package/core/Data/Converter/canvas.js +0 -25
  27. package/core/Data/Converter/csv.js +0 -33
  28. package/core/Data/Converter/index.js +0 -25
  29. package/core/Data/Converter/json.js +0 -80
  30. package/core/Data/Converter/markdown.js +0 -83
  31. package/core/Data/Converter/svg.js +0 -11
  32. package/core/Data/Parser/markdown.js +0 -0
  33. package/core/Data/Parser/xml.js +0 -47
  34. package/core/Data/Strings/index.js +0 -26
  35. package/core/Data/decorators.js +0 -0
  36. package/core/Data/index.js +0 -64
  37. package/core/Graphics/Canvas/Elements/Basic/arc.js +0 -43
  38. package/core/Graphics/Canvas/Elements/Basic/image.js +0 -0
  39. package/core/Graphics/Canvas/Elements/Basic/line.js +0 -26
  40. package/core/Graphics/Canvas/Elements/Basic/path.js +0 -0
  41. package/core/Graphics/Canvas/Elements/Basic/points.js +0 -48
  42. package/core/Graphics/Canvas/Elements/Basic/polygon.js +0 -7
  43. package/core/Graphics/Canvas/Elements/Basic/polyline.js +0 -0
  44. package/core/Graphics/Canvas/Elements/Basic/rect.js +0 -46
  45. package/core/Graphics/Canvas/Elements/Basic/text.js +0 -0
  46. package/core/Graphics/Canvas/Elements/Chart/histogram.js +0 -0
  47. package/core/Graphics/Canvas/Elements/Chart/plot.js +0 -0
  48. package/core/Graphics/Canvas/Elements/Chart/scatter.js +0 -2
  49. package/core/Graphics/Canvas/Elements/Chart/stem.js +0 -0
  50. package/core/Graphics/Canvas/Elements/Element.js +0 -115
  51. package/core/Graphics/Canvas/Elements/Groupe.js +0 -0
  52. package/core/Graphics/Canvas/Elements/grid.js +0 -0
  53. package/core/Graphics/Canvas/Elements/index.js +0 -13
  54. package/core/Graphics/Canvas/Filter/index.js +0 -0
  55. package/core/Graphics/Canvas/Paint/index.js +0 -0
  56. package/core/Graphics/Canvas/Utils/color.js +0 -8
  57. package/core/Graphics/Canvas/Utils/floodFill.js +0 -58
  58. package/core/Graphics/Canvas/_canvas_offscreen +0 -0
  59. package/core/Graphics/Canvas/canvas.js +0 -189
  60. package/core/Graphics/Canvas/index.js +0 -15
  61. package/core/Graphics/Svg/Elements/ZikoSvgElement.js +0 -28
  62. package/core/Graphics/Svg/Elements/circle.js +0 -34
  63. package/core/Graphics/Svg/Elements/ellipse.js +0 -29
  64. package/core/Graphics/Svg/Elements/foreignObject.js +0 -46
  65. package/core/Graphics/Svg/Elements/grid.js +0 -9
  66. package/core/Graphics/Svg/Elements/groupe.js +0 -29
  67. package/core/Graphics/Svg/Elements/image.js +0 -33
  68. package/core/Graphics/Svg/Elements/line.js +0 -29
  69. package/core/Graphics/Svg/Elements/path.js +0 -59
  70. package/core/Graphics/Svg/Elements/polygon.js +0 -31
  71. package/core/Graphics/Svg/Elements/polyline.js +0 -4
  72. package/core/Graphics/Svg/Elements/rect.js +0 -43
  73. package/core/Graphics/Svg/Elements/text.js +0 -26
  74. package/core/Graphics/Svg/index.js +0 -1
  75. package/core/Graphics/Svg/svg.js +0 -117
  76. package/core/Graphics/index.js +0 -61
  77. package/core/Math/Calculus/Special Functions/bessel.js +0 -31
  78. package/core/Math/Calculus/Special Functions/beta.js +0 -38
  79. package/core/Math/Calculus/Special Functions/gamma.js +0 -30
  80. package/core/Math/Calculus/Special Functions/index.js +0 -4
  81. package/core/Math/Calculus/index.js +0 -1
  82. package/core/Math/Complex/Fractals/julia.js +0 -0
  83. package/core/Math/Complex/index.js +0 -191
  84. package/core/Math/Discret/Combinaison/index.js +0 -34
  85. package/core/Math/Discret/Conversion/index.js +0 -86
  86. package/core/Math/Discret/Logic/index.js +0 -46
  87. package/core/Math/Discret/Permutation/index.js +0 -31
  88. package/core/Math/Discret/Set/index.js +0 -2
  89. package/core/Math/Discret/Set/powerSet.js +0 -15
  90. package/core/Math/Discret/Set/subSet.js +0 -10
  91. package/core/Math/Discret/index.js +0 -23
  92. package/core/Math/Functions/index.js +0 -182
  93. package/core/Math/Matrix/Decomposition.js +0 -90
  94. package/core/Math/Matrix/LinearSystem.js +0 -10
  95. package/core/Math/Matrix/Matrix.js +0 -712
  96. package/core/Math/Matrix/index.js +0 -3
  97. package/core/Math/Numeric/index.js +0 -0
  98. package/core/Math/Random/index.js +0 -173
  99. package/core/Math/Signal/__np.py.txt +0 -40
  100. package/core/Math/Signal/conv.js +0 -175
  101. package/core/Math/Signal/fft.js +0 -55
  102. package/core/Math/Signal/filter.js +0 -39
  103. package/core/Math/Signal/functions.js +0 -146
  104. package/core/Math/Signal/index.js +0 -110
  105. package/core/Math/Statistics/Functions/index.js +0 -100
  106. package/core/Math/Statistics/index.js +0 -16
  107. package/core/Math/Utils/arithmetic.js +0 -139
  108. package/core/Math/Utils/checkers.js +0 -11
  109. package/core/Math/Utils/comparaison.js +0 -1
  110. package/core/Math/Utils/conversions.js +0 -7
  111. package/core/Math/Utils/discret.js +0 -28
  112. package/core/Math/Utils/index.js +0 -102
  113. package/core/Math/Utils/mapfun.js +0 -43
  114. package/core/Math/absract.js +0 -1
  115. package/core/Math/const.js +0 -3
  116. package/core/Math/index.js +0 -193
  117. package/core/Reactivity/Events/Global/Click.js +0 -56
  118. package/core/Reactivity/Events/Global/Clipboard.js +0 -84
  119. package/core/Reactivity/Events/Global/CustomEvent.js +0 -53
  120. package/core/Reactivity/Events/Global/Drag.js +0 -137
  121. package/core/Reactivity/Events/Global/Focus.js +0 -56
  122. package/core/Reactivity/Events/Global/Key.js +0 -104
  123. package/core/Reactivity/Events/Global/Mouse.js +0 -230
  124. package/core/Reactivity/Events/Global/Pointer.js +0 -214
  125. package/core/Reactivity/Events/Global/Touch.js +0 -0
  126. package/core/Reactivity/Events/Global/Wheel.js +0 -44
  127. package/core/Reactivity/Events/Partiel/Hash.js +0 -44
  128. package/core/Reactivity/Events/Partiel/Input.js +0 -59
  129. package/core/Reactivity/Events/Partiel/MediaEvent.js +0 -1
  130. package/core/Reactivity/Events/ZikoEvent.js +0 -91
  131. package/core/Reactivity/Events/index.js +0 -60
  132. package/core/Reactivity/Observer/index.js +0 -3
  133. package/core/Reactivity/Observer/intersection.js +0 -40
  134. package/core/Reactivity/Observer/mutation.js +0 -90
  135. package/core/Reactivity/Observer/resize.js +0 -47
  136. package/core/Reactivity/Use/Contexte/index.js +0 -1
  137. package/core/Reactivity/Use/Contexte/useSuccesifKeys.js +0 -14
  138. package/core/Reactivity/Use/Decorators/index.js +0 -4
  139. package/core/Reactivity/Use/Interactions/index.js +0 -4
  140. package/core/Reactivity/Use/Interactions/useBluetooth.js +0 -48
  141. package/core/Reactivity/Use/Interactions/useChannel.js +0 -50
  142. package/core/Reactivity/Use/Interactions/useEventEmmiter.js +0 -64
  143. package/core/Reactivity/Use/Interactions/useSerial.js +0 -0
  144. package/core/Reactivity/Use/Interactions/useThread.js +0 -44
  145. package/core/Reactivity/Use/Interactions/useUsb.js +0 -0
  146. package/core/Reactivity/Use/Sensors/index.js +0 -2
  147. package/core/Reactivity/Use/Sensors/useBattery.js +0 -36
  148. package/core/Reactivity/Use/Sensors/useCamera.js +0 -0
  149. package/core/Reactivity/Use/Sensors/useGeolocation.js +0 -17
  150. package/core/Reactivity/Use/Sensors/useMicro.js +0 -0
  151. package/core/Reactivity/Use/Sensors/useOrientation.js +0 -0
  152. package/core/Reactivity/Use/Storage/index.js +0 -1
  153. package/core/Reactivity/Use/Storage/useCookie.js +0 -0
  154. package/core/Reactivity/Use/Storage/useIndexedDb.js +0 -0
  155. package/core/Reactivity/Use/Storage/useStorage.js +0 -74
  156. package/core/Reactivity/Use/UI/index.js +0 -4
  157. package/core/Reactivity/Use/UI/useCssLink.js +0 -0
  158. package/core/Reactivity/Use/UI/useCssText.js +0 -21
  159. package/core/Reactivity/Use/UI/useFavIcon.js +0 -38
  160. package/core/Reactivity/Use/UI/useLinearGradient.js +0 -0
  161. package/core/Reactivity/Use/UI/useMediaQuery.js +0 -1
  162. package/core/Reactivity/Use/UI/useRadialGradient.js +0 -0
  163. package/core/Reactivity/Use/UI/useStyle.js +0 -54
  164. package/core/Reactivity/Use/UI/useTheme.js +0 -62
  165. package/core/Reactivity/Use/UI/useTitle.js +0 -30
  166. package/core/Reactivity/Use/index.js +0 -82
  167. package/core/Reactivity/Use/todo.md +0 -26
  168. package/core/Reactivity/index.js +0 -3
  169. package/core/Time/animation.js +0 -76
  170. package/core/Time/index.js +0 -54
  171. package/core/Time/loop.js +0 -83
  172. package/core/Time/utils/decorators.js +0 -17
  173. package/core/Time/utils/ease.js +0 -144
  174. package/core/Time/utils/index.js +0 -18
  175. package/core/Time/utils/performance.js +0 -16
  176. package/core/Time/utils/ui.js +0 -26
  177. package/core/UI/CustomElement/Elements/Accordion/index.js +0 -62
  178. package/core/UI/CustomElement/Elements/Carousel/index.js +0 -47
  179. package/core/UI/CustomElement/Elements/CodeNote/CodeCell.js +0 -176
  180. package/core/UI/CustomElement/Elements/CodeNote/CodeNote.js +0 -69
  181. package/core/UI/CustomElement/Elements/CodeNote/SubElements.js +0 -64
  182. package/core/UI/CustomElement/Elements/CodeNote/index.js +0 -2
  183. package/core/UI/CustomElement/Elements/Columns.js +0 -1
  184. package/core/UI/CustomElement/Elements/FAB.js +0 -0
  185. package/core/UI/CustomElement/Elements/Menu.js +0 -0
  186. package/core/UI/CustomElement/Elements/Notification.js +0 -0
  187. package/core/UI/CustomElement/Elements/Popover.js +0 -0
  188. package/core/UI/CustomElement/Elements/Popup.js +0 -0
  189. package/core/UI/CustomElement/Elements/Swipper.js +0 -4
  190. package/core/UI/CustomElement/Elements/Tabs/index.js +0 -111
  191. package/core/UI/CustomElement/Elements/Timeline.js +0 -0
  192. package/core/UI/CustomElement/Elements/Toast.js +0 -0
  193. package/core/UI/CustomElement/Elements/Treeview.js +0 -0
  194. package/core/UI/CustomElement/Elements/index.js +0 -4
  195. package/core/UI/CustomElement/Flex.js +0 -97
  196. package/core/UI/CustomElement/Grid.js +0 -30
  197. package/core/UI/CustomElement/index.js +0 -3
  198. package/core/UI/Embaded/index.js +0 -1
  199. package/core/UI/Inputs/Primitives/btn.js +0 -30
  200. package/core/UI/Inputs/Primitives/elements.js +0 -28
  201. package/core/UI/Inputs/Primitives/inputs.js +0 -324
  202. package/core/UI/Inputs/Primitives/select.js +0 -14
  203. package/core/UI/Inputs/Primitives/textarea.js +0 -15
  204. package/core/UI/Inputs/camera.js +0 -23
  205. package/core/UI/Inputs/index.js +0 -20
  206. package/core/UI/List/elements.js +0 -0
  207. package/core/UI/List/index.js +0 -127
  208. package/core/UI/Media/Audio/index.js +0 -38
  209. package/core/UI/Media/Image/figure.js +0 -16
  210. package/core/UI/Media/Image/image.js +0 -33
  211. package/core/UI/Media/Image/index.js +0 -2
  212. package/core/UI/Media/Video/index.js +0 -49
  213. package/core/UI/Media/index.js +0 -3
  214. package/core/UI/Misc/index.js +0 -45
  215. package/core/UI/Semantic/index.js +0 -61
  216. package/core/UI/Style/index.js +0 -499
  217. package/core/UI/Table/elements.js +0 -94
  218. package/core/UI/Table/index.js +0 -3
  219. package/core/UI/Table/table.js +0 -112
  220. package/core/UI/Table/utils.js +0 -12
  221. package/core/UI/Text/heading.js +0 -34
  222. package/core/UI/Text/index.js +0 -3
  223. package/core/UI/Text/p.js +0 -36
  224. package/core/UI/Text/pre.js +0 -0
  225. package/core/UI/Text/text.js +0 -65
  226. package/core/UI/Utils/index.js +0 -70
  227. package/core/UI/ZikoUIElement.js +0 -503
  228. package/core/UI/index.js +0 -154
  229. package/core/__proto__/Array.js +0 -74
  230. package/core/__proto__/Function.js +0 -0
  231. package/core/__proto__/Number.js +0 -76
  232. package/core/__proto__/Object.js +0 -0
  233. package/core/__proto__/String.js +0 -0
  234. package/core/index.js +0 -72
  235. package/wrapper/react/readme.md +0 -19
@@ -1,26 +0,0 @@
1
- const isPalindrome=(str)=>{
2
- str=str.toLocaleLowerCase();
3
- let l=str.length,i;
4
- for(i=0;i<l/2;i++)if(str[i]!=str[l-i-1])return false;
5
- return true;
6
- }
7
- const isAnagrams=(word,words)=>{
8
- word=word.split("").sort();
9
- words=words.split("").sort();
10
- return JSON.stringify(word)===JSON.stringify(words);
11
- }
12
- const isIsogram=(str)=>{
13
- return [...new Set(str.toLowerCase())].length===str.length;
14
- }
15
- const removeExtraSpace=str=>str.replace(/\s+/g,' ');
16
- const count=(str,value)=>str.split("").filter(x => x==value).length;
17
- const countWords=(str,value)=>str.split(" ").filter(x => x==value).length;
18
-
19
- export{
20
- isPalindrome,
21
- isAnagrams,
22
- isIsogram,
23
- removeExtraSpace,
24
- count,
25
- countWords
26
- }
File without changes
@@ -1,64 +0,0 @@
1
- import {
2
- markdown2html,
3
- csv2arr,
4
- csv2matrix,
5
- csv2object,
6
- csv2json,
7
- csv2sql,
8
- json2arr,
9
- json2csv,
10
- json2csvFile,
11
- json2yml,
12
- json2ymlFile,
13
- json2xml,
14
- json2xmlFile,
15
- svg2str,
16
- svg2ascii,
17
- svg2imgUrl,
18
- svg2img
19
- } from "./Converter";
20
- import parseXML from "./Parser/xml";
21
- import { preload } from "./Api";
22
- const Data={
23
- parseXML,
24
- preload,
25
- markdown2html,
26
- csv2arr,
27
- csv2matrix,
28
- csv2object,
29
- csv2json,
30
- csv2sql,
31
- json2arr,
32
- json2csv,
33
- json2csvFile,
34
- json2yml,
35
- json2ymlFile,
36
- json2xml,
37
- json2xmlFile,
38
- svg2str,
39
- svg2ascii,
40
- svg2imgUrl,
41
- svg2img,
42
- ExtractAll: function () {
43
- const keys = Object.keys(this);
44
- for (let i = 0; i < keys.length; i++) {
45
- const key = keys[i];
46
- if (key !== 'ExtractAll' && key !== 'RemoveAll') {
47
- globalThis[key] = this[key];
48
- }
49
- }
50
- return this;
51
- },
52
- RemoveAll: function () {
53
- const keys = Object.keys(this);
54
- for (let i = 0; i < keys.length; i++) {
55
- const key = keys[i];
56
- if (key !== 'RemoveAll') {
57
- delete globalThis[key];
58
- }
59
- }
60
- return this;
61
- }
62
- }
63
- export * from "./Converter"
64
- export default Data
@@ -1,43 +0,0 @@
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
@@ -1,26 +0,0 @@
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
@@ -1,48 +0,0 @@
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};
@@ -1,7 +0,0 @@
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
@@ -1,46 +0,0 @@
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
File without changes
@@ -1,2 +0,0 @@
1
- // Scatter = Circle[]
2
-
File without changes
@@ -1,115 +0,0 @@
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
@@ -1,13 +0,0 @@
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
File without changes
@@ -1,8 +0,0 @@
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
- };
@@ -1,58 +0,0 @@
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;
File without changes
@@ -1,189 +0,0 @@
1
- import ZikoUIElement from "../../UI/ZikoUIElement.js";
2
- import {Matrix} from "../../Math/Matrix/index.js"
3
- import { convolute } from "../../Math/Signal/conv.js";
4
- class ZikoUICanvas extends ZikoUIElement{
5
- constructor(w,h){
6
- super();
7
- this.element=document.createElement("canvas");
8
- this.ctx = this.element.getContext("2d");
9
- this.style({
10
- border:"1px red solid",
11
- //width:"300px",
12
- //height:"300px"
13
- })
14
- this.transformMatrix=new Matrix([
15
- [1,0,0],
16
- [0,1,0],
17
- [0,0,1]
18
- ])
19
- this.axisMatrix=new Matrix([
20
- [-10,-10],
21
- [10,10]
22
- ])
23
- this.render(globalThis.__ZikoConfig__.default.render);
24
- setTimeout(()=>this.resize(w,h),0);
25
- this.on("sizeupdated",()=>this.adjust())
26
- }
27
- get Width(){
28
- return this.element.width;
29
- }
30
- get Height(){
31
- return this.element.height;
32
- }
33
- get Xmin(){
34
- return this.axisMatrix[0][0];
35
- }
36
- get Ymin(){
37
- return this.axisMatrix[0][1];
38
- }
39
- get Xmax(){
40
- return this.axisMatrix[1][0];
41
- }
42
- get Ymax(){
43
- return this.axisMatrix[1][1];
44
- }
45
- get ImageData(){
46
- return this.ctx.getImageData(0,0,c.Width,c.Height);
47
- }
48
- draw(all=true){
49
- if(all){
50
- this.clear();
51
- this.items.forEach(element => {
52
- element.parent=this;
53
- element.draw(this.ctx)
54
- });
55
- }
56
- else {
57
- this.items.at(-1).parent=this;
58
- this.items.at(-1).draw(this.ctx);
59
- }
60
- this.maintain();
61
- return this;
62
- }
63
- applyTransformMatrix(){
64
- this.ctx.setTransform(
65
- this.transformMatrix[0][0],
66
- this.transformMatrix[1][0],
67
- this.transformMatrix[0][1],
68
- this.transformMatrix[1][1],
69
- this.transformMatrix[0][2],
70
- this.transformMatrix[1][2],
71
- );
72
- return this;
73
- }
74
- resize(w,h){
75
- // this.style({
76
- // width:w,
77
- // height:h
78
- // })
79
- this.size(w,h)
80
- this.lineWidth();
81
- this.view(this.axisMatrix[0][0], this.axisMatrix[0][1], this.axisMatrix[1][0], this.axisMatrix[1][1]);
82
- this.emit("sizeupdated");
83
- return this;
84
- }
85
- adjust(){
86
- this.element.width=this.element.getBoundingClientRect().width;
87
- this.element.height=this.element.getBoundingClientRect().height;
88
- this.view(this.axisMatrix[0][0], this.axisMatrix[0][1], this.axisMatrix[1][0], this.axisMatrix[1][1]);
89
- return this;
90
- }
91
- view(xMin,yMin,xMax,yMax){
92
- this.transformMatrix[0][0]=this.Width/(xMax-xMin); // scaleX
93
- this.transformMatrix[1][1]=-this.Height/(yMax-yMin); // scaleY
94
- this.transformMatrix[0][2]=this.Width/2;
95
- this.transformMatrix[1][2]=this.Height/2;
96
- this.axisMatrix=new Matrix([
97
- [xMin,yMin],
98
- [xMax,yMax]
99
- ])
100
-
101
- this.applyTransformMatrix();
102
- this.clear();
103
- this.lineWidth(1);
104
- this.draw();
105
- return this;
106
- }
107
- reset(){
108
- this.ctx.setTransform(1,0,0,0,0,0);
109
- return this;
110
- }
111
- append(element){
112
- this.items.push(element);
113
- this.draw(false);
114
- return this;
115
- }
116
- background(color){
117
- this.ctx.fillStyle = color;
118
- this.ctx.setTransform(1, 0, 0, 1, 0, 0);
119
- this.ctx.fillRect(0, 0, this.Width, this.Height);
120
- this.applyTransformMatrix();
121
- this.draw();
122
- }
123
- lineWidth(w){
124
- this.ctx.lineWidth=w/this.transformMatrix[0][0];;
125
- return this
126
- }
127
- ImageData(x=0,y=0,w=this.Width,h=this.Height){
128
- return this.ctx.getImageData(x,y,w,h);
129
- }
130
- clear(){
131
- this.ctx.setTransform(1, 0, 0, 1, 0, 0);
132
- this.ctx.clearRect(0, 0, this.Width, this.Height);
133
- this.applyTransformMatrix();
134
- return this;
135
- }
136
- clone(){
137
- console.log(this.Width)
138
- const canvas=new ZikoUICanvas();
139
- canvas.items=this.items;
140
- canvas.transformMatrix=this.transformMatrix;
141
- canvas.axisMatrix=this.axisMatrix;
142
- Object.assign(canvas.cache,{...this.cache});
143
- //waitForUIElm(this)
144
- //console.log(element)
145
- this.size(element.style.width,element.style.width);
146
- this.applyTransformMatrix();
147
- this.draw();
148
- this.adjust();
149
- return canvas;
150
- }
151
- toImage() {
152
- this.img = document.createElement("img");
153
- this.img.src = this.element.toDataURL("image/png");
154
- return this;
155
- }
156
- toBlob() {
157
- var canvas = this.element;
158
- canvas.toBlob(function (blob) {
159
- var newImg = document.createElement("img"),
160
- url = URL.createObjectURL(blob);
161
- newImg.onload = function () {
162
- URL.revokeObjectURL(url);
163
- };
164
- newImg.src = url;
165
- console.log(newImg);
166
- });
167
- }
168
- zoomIn(){
169
-
170
- }
171
- zoomOut(){
172
-
173
- }
174
- undo(n){
175
-
176
- }
177
- redo(n){
178
-
179
- }
180
- stream(){
181
-
182
- }
183
- }
184
-
185
- const Canvas=(w,h)=>new ZikoUICanvas(w,h);
186
- export{
187
- ZikoUICanvas
188
- }
189
- export default Canvas;