ziko 1.9.0 → 2.0.0-alpha.0

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 (234) hide show
  1. package/dist/ziko.cjs +304 -2868
  2. package/dist/ziko.js +1322 -5315
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +1242 -5057
  5. package/package.json +70 -97
  6. package/src/__ziko__/__config__.js +3 -3
  7. package/src/__ziko__/__state__.js +0 -1
  8. package/src/{dom/components → components}/Fragment/index.js +1 -1
  9. package/src/{dom/components/wrappers → components}/HTMLWrapper/index.js +3 -7
  10. package/src/{dom/components/wrappers → components}/SVGWrapper/index.js +3 -15
  11. package/src/{dom/components → components}/Suspense/index.js +1 -1
  12. package/src/{dom/components → components}/Swap/index.js +2 -2
  13. package/src/{dom/components → components}/Switch/index.js +1 -2
  14. package/src/components/View/index.js +11 -0
  15. package/src/{dom/components → components}/index.js +2 -3
  16. package/src/dom/{constructors/UIElement.js → UIElement/index.js} +6 -6
  17. package/src/dom/index.js +2 -6
  18. package/src/dom/{utils → internal-utils}/call_with_optional_props.js +1 -1
  19. package/src/dom/{utils/is_ui_item.js → internal-utils/checkers.js} +1 -0
  20. package/src/dom/internal-utils/is_ui_item.js +10 -0
  21. package/src/dom/tags/index.js +3 -3
  22. package/src/events/custom-events-registry/view.js +1 -1
  23. package/src/hooks/index.d.ts +0 -8
  24. package/src/hooks/index.js +1 -12
  25. package/src/hooks/use-derived.js +18 -14
  26. package/src/hooks/use-effect.js +7 -15
  27. package/src/hooks/use-reactive.d.ts +1 -1
  28. package/src/hooks/use-reactive.js +1 -1
  29. package/src/hooks/use-state.js +1 -7
  30. package/src/index.js +2 -6
  31. package/src/{helpers → internal-utils}/checkers/index.js +1 -1
  32. package/src/math/index.d.ts +4 -4
  33. package/src/math/index.js +7 -10
  34. package/src/math/{functions/mapfun → mapfun}/index.js +1 -1
  35. package/src/math/{functions/utils → utils}/index.d.ts +1 -1
  36. package/src/math/utils/index.js +42 -103
  37. package/src/{dom/constructors/UIElementCore.d.ts → mini-dom/UIElement/index.d.ts} +1 -1
  38. package/src/{dom/constructors/UIElementCore.js → mini-dom/UIElement/index.js} +5 -14
  39. package/src/{dom/constructors/UINode.js → mini-dom/UINode/index.js} +1 -3
  40. package/src/{dom/constructors → mini-dom}/mixins/attrs.js +6 -6
  41. package/src/{dom/constructors → mini-dom}/mixins/dom.js +2 -16
  42. package/src/mini-dom/mixins/lifecycle.js +32 -0
  43. package/src/{dom/constructors → mini-dom}/mixins/style.js +1 -1
  44. package/src/mini-dom/parse_props.js +26 -0
  45. package/src/{dom → mini-dom}/text/index.js +4 -4
  46. package/src/router/file-based-router/index.js +63 -14
  47. package/src/router/index.d.ts +1 -1
  48. package/src/router/index.js +1 -1
  49. package/src/router/{utils → internal-utils}/dynamic-routes-parser.js +45 -11
  50. package/src/router/internal-utils/get-root.js +24 -0
  51. package/src/router/internal-utils/index.d.ts +5 -0
  52. package/src/router/internal-utils/normalize-path.js +32 -0
  53. package/src/router/internal-utils/routes-grouper.js +49 -0
  54. package/src/router/{utils → internal-utils}/routes-matcher.js +32 -9
  55. package/src/{hooks/use-query-params.js → router/useQueryParams/index.js} +0 -1
  56. package/src/time/{clocks/clock.js → clock/index.js} +1 -1
  57. package/src/time/{clocks/clock.d.ts → clock/index.ts} +1 -1
  58. package/src/time/debounce/index.d.ts +4 -0
  59. package/src/time/debounce/index.js +4 -0
  60. package/src/time/index.d.ts +7 -5
  61. package/src/time/index.js +7 -8
  62. package/src/time/sleep/index.d.ts +1 -0
  63. package/src/time/sleep/index.js +1 -0
  64. package/src/time/throttle/index.d.ts +4 -0
  65. package/src/time/throttle/index.js +9 -0
  66. package/src/time/{clocks/tick.js → tick/index.js} +2 -7
  67. package/src/time/{delay → timeout}/index.d.ts +0 -2
  68. package/src/time/{delay → timeout}/index.js +0 -1
  69. package/src/app/globals.js +0 -76
  70. package/src/app/index.js +0 -18
  71. package/src/app/params.js +0 -37
  72. package/src/app/routes.js +0 -57
  73. package/src/app/spa-file-based-routing.js +0 -74
  74. package/src/app/spa.js +0 -55
  75. package/src/app/ziko-app.js +0 -39
  76. package/src/data/api/fetchdom.js +0 -30
  77. package/src/data/api/index.js +0 -4
  78. package/src/data/api/preload.js +0 -11
  79. package/src/data/converter/__(To Be Moved)adoc.js +0 -130
  80. package/src/data/converter/__(To Be Moved)markdown.js +0 -95
  81. package/src/data/converter/array.js +0 -43
  82. package/src/data/converter/canvas.js +0 -25
  83. package/src/data/converter/css.js +0 -37
  84. package/src/data/converter/csv.js +0 -35
  85. package/src/data/converter/idea.txt +0 -10
  86. package/src/data/converter/index.js +0 -33
  87. package/src/data/converter/json.js +0 -80
  88. package/src/data/converter/object.js +0 -74
  89. package/src/data/converter/svg.js +0 -11
  90. package/src/data/datatypes/color.js +0 -11
  91. package/src/data/decorators.js +0 -0
  92. package/src/data/index.js +0 -17
  93. package/src/data/parser/index.d.ts +0 -41
  94. package/src/data/parser/index.js +0 -28
  95. package/src/data/string-dep/index.js +0 -1
  96. package/src/data/string-dep/patterns.js +0 -12
  97. package/src/data/string-dep/string.js +0 -170
  98. package/src/dom/components/Flex/index.js +0 -89
  99. package/src/dom/components/Flex/utils/index.js +0 -20
  100. package/src/dom/components/View/index.js +0 -9
  101. package/src/dom/components/graphics/Canvas/index.js +0 -175
  102. package/src/dom/components/graphics/Svg/index.js +0 -69
  103. package/src/dom/components/graphics/index.js +0 -2
  104. package/src/dom/components/wrappers/index.js +0 -2
  105. package/src/dom/constructors/mixins/lifecycle.js +0 -54
  106. package/src/dom/grid/index.js +0 -33
  107. package/src/dom/mini/UIElement.js +0 -10
  108. package/src/dom/utils/checkers.js +0 -1
  109. package/src/dom/utils/getters.js +0 -0
  110. package/src/hooks/use-favicon.d.ts +0 -41
  111. package/src/hooks/use-favicon.js +0 -59
  112. package/src/hooks/use-ipc.d.ts +0 -12
  113. package/src/hooks/use-ipc.js +0 -83
  114. package/src/hooks/use-media-query.d.ts +0 -24
  115. package/src/hooks/use-media-query.js +0 -59
  116. package/src/hooks/use-root.d.ts +0 -15
  117. package/src/hooks/use-root.js +0 -73
  118. package/src/hooks/use-storage.d.ts +0 -47
  119. package/src/hooks/use-storage.js +0 -118
  120. package/src/hooks/use-thread.d.ts +0 -33
  121. package/src/hooks/use-thread.js +0 -55
  122. package/src/hooks/use-title.d.ts +0 -37
  123. package/src/hooks/use-title.js +0 -43
  124. package/src/lite.js +0 -2
  125. package/src/math/--discret/Set/index.js +0 -2
  126. package/src/math/--discret/Set/power-set.js +0 -15
  127. package/src/math/--discret/Set/sub-set.js +0 -10
  128. package/src/math/--discret/index.js +0 -12
  129. package/src/math/complex/helpers/constructor.js +0 -38
  130. package/src/math/complex/helpers/index.js +0 -1
  131. package/src/math/complex/index.d.ts +0 -231
  132. package/src/math/complex/index.js +0 -193
  133. package/src/math/functions/conversions/index.d.ts +0 -101
  134. package/src/math/functions/conversions/index.js +0 -61
  135. package/src/math/functions/helper.js +0 -81
  136. package/src/math/functions/index.d.ts +0 -147
  137. package/src/math/functions/index.js +0 -43
  138. package/src/math/functions/logic/index.d.ts +0 -53
  139. package/src/math/functions/logic/index.js +0 -54
  140. package/src/math/functions/proxy.js +0 -58
  141. package/src/math/functions/signal/index.d.ts +0 -146
  142. package/src/math/functions/signal/index.js +0 -104
  143. package/src/math/functions/stats/index.js +0 -61
  144. package/src/math/functions/ufunc/index.d.ts +0 -96
  145. package/src/math/functions/ufunc/index.js +0 -372
  146. package/src/math/functions/utils/index.js +0 -47
  147. package/src/math/matrix/AbstractMatrix.js +0 -0
  148. package/src/math/matrix/helpers/constructor.js +0 -31
  149. package/src/math/matrix/helpers/det.js +0 -36
  150. package/src/math/matrix/helpers/index.js +0 -5
  151. package/src/math/matrix/helpers/inverse.js +0 -52
  152. package/src/math/matrix/helpers/maintain.js +0 -13
  153. package/src/math/matrix/helpers/stack.js +0 -24
  154. package/src/math/matrix/index.js +0 -557
  155. package/src/math/random/index.d.ts +0 -162
  156. package/src/math/random/index.js +0 -125
  157. package/src/math/signal/functions.js +0 -84
  158. package/src/math/signal/index.js +0 -1
  159. package/src/math/stats/accum/index.d.ts +0 -43
  160. package/src/math/stats/accum/index.js +0 -39
  161. package/src/math/stats/average/index.d.ts +0 -123
  162. package/src/math/stats/average/index.js +0 -75
  163. package/src/math/stats/index.d.ts +0 -5
  164. package/src/math/stats/index.js +0 -14
  165. package/src/math/stats/percentile/index.d.ts +0 -66
  166. package/src/math/stats/percentile/index.js +0 -18
  167. package/src/math/stats/rolling/index.d.ts +0 -47
  168. package/src/math/stats/rolling/index.js +0 -34
  169. package/src/math/stats/variability/index.d.ts +0 -93
  170. package/src/math/stats/variability/index.js +0 -37
  171. package/src/math/utils/arithmetic.js +0 -137
  172. package/src/math/utils/checkers.js +0 -29
  173. package/src/math/utils/comparaison.js +0 -1
  174. package/src/math/utils/conversions.js +0 -19
  175. package/src/math/utils/discret.js +0 -51
  176. package/src/math/utils/mapfun.js +0 -42
  177. package/src/no-module.js +0 -32
  178. package/src/provider/index.js +0 -7
  179. package/src/router/utils/get-root.js +0 -16
  180. package/src/router/utils/index.d.ts +0 -5
  181. package/src/router/utils/normalize-path.js +0 -21
  182. package/src/router/utils/routes-grouper.js +0 -22
  183. package/src/time/animation/index.d.ts +0 -189
  184. package/src/time/animation/index.js +0 -94
  185. package/src/time/clocks/index.d.ts +0 -3
  186. package/src/time/clocks/index.js +0 -3
  187. package/src/time/converters/index.js +0 -1
  188. package/src/time/decorators/index.d.ts +0 -9
  189. package/src/time/decorators/index.js +0 -17
  190. package/src/time/ease/index.d.ts +0 -103
  191. package/src/time/ease/index.js +0 -118
  192. package/src/time/loop/index.d.ts +0 -50
  193. package/src/time/loop/index.js +0 -103
  194. package/src/time/utils/index.js +0 -17
  195. package/src/time/utils/performance.js +0 -16
  196. package/src/time/utils/ui.js +0 -26
  197. /package/src/{dom/components → components}/For/index.js +0 -0
  198. /package/src/{dom/components → components}/Fragment/index.d.ts +0 -0
  199. /package/src/{dom/components → components}/Swap/index.d.ts +0 -0
  200. /package/src/{dom/components → components}/index.d.ts +0 -0
  201. /package/src/dom/{utils → internal-utils}/index.js +0 -0
  202. /package/src/dom/{utils → internal-utils}/parse_props.js +0 -0
  203. /package/src/{helpers → internal-utils}/index.js +0 -0
  204. /package/src/{helpers → internal-utils}/register/index.js +0 -0
  205. /package/src/{helpers → internal-utils}/register/register-to-class.js +0 -0
  206. /package/src/{helpers → internal-utils}/register/register-to-instance.js +0 -0
  207. /package/src/{symbols → internal-utils/symbols}/index.d.ts +0 -0
  208. /package/src/{symbols → internal-utils/symbols}/index.js +0 -0
  209. /package/src/math/{functions/arithmetic → arithmetic}/index.d.ts +0 -0
  210. /package/src/math/{functions/arithmetic → arithmetic}/index.js +0 -0
  211. /package/src/math/{const.js → const/index.js} +0 -0
  212. /package/src/math/{functions/mapfun → mapfun}/index.d.ts +0 -0
  213. /package/src/math/{functions/mapfun → mapfun}/index.d.ts.txt +0 -0
  214. /package/src/math/{functions/utils → utils}/mapfun.d.ts.txt +0 -0
  215. /package/src/{dom/constructors/UINode.d.ts → mini-dom/UINode/index.d.ts} +0 -0
  216. /package/src/{dom/constructors → mini-dom}/mixins/index.js +0 -0
  217. /package/src/{dom/constructors → mini-dom}/mixins/indexing.js +0 -0
  218. /package/src/router/{utils → internal-utils}/dynamic-routes-parser.d.ts +0 -0
  219. /package/src/router/{utils → internal-utils}/get-root.d.ts +0 -0
  220. /package/src/router/{utils → internal-utils}/index.js +0 -0
  221. /package/src/router/{utils → internal-utils}/normalize-path.d.ts +0 -0
  222. /package/src/router/{utils → internal-utils}/renderer.js +0 -0
  223. /package/src/router/{utils → internal-utils}/routes-grouper.d.ts +0 -0
  224. /package/src/router/{utils → internal-utils}/routes-matcher.d.ts +0 -0
  225. /package/src/{hooks/use-query-params.d.ts → router/useQueryParams/index.d.ts} +0 -0
  226. /package/src/{data/string → string}/checkers/index.d.ts +0 -0
  227. /package/src/{data/string → string}/checkers/index.js +0 -0
  228. /package/src/{data/string → string}/converters/index.d.ts +0 -0
  229. /package/src/{data/string → string}/converters/index.js +0 -0
  230. /package/src/{data/string → string}/index.d.ts +0 -0
  231. /package/src/{data/string → string}/index.js +0 -0
  232. /package/src/time/{clocks/scheduler.js → schedular/index.js} +0 -0
  233. /package/src/time/{clocks/scheduler.d.ts → schedular/index.ts} +0 -0
  234. /package/src/time/{clocks/tick.d.ts → tick/index.ts} +0 -0
package/package.json CHANGED
@@ -1,97 +1,70 @@
1
- {
2
- "name": "ziko",
3
- "version": "1.9.0",
4
- "description": "A versatile JavaScript library offering a rich set of Hyperscript Based UI components, advanced mathematical utilities, interactivity ,animations, client side routing and more ...",
5
- "keywords": [
6
- "front-end",
7
- "framework",
8
- "zikojs",
9
- "ziko",
10
- "math",
11
- "user-interface",
12
- "time",
13
- "dom",
14
- "single page application",
15
- "file based routing"
16
- ],
17
- "type": "module",
18
- "main": "dist/ziko.mjs",
19
- "module": "dist/ziko.mjs",
20
- "unpkg": "dist/ziko.min.js",
21
- "files": [
22
- "src",
23
- "dist",
24
- "LICENCE"
25
- ],
26
- "exports": {
27
- "./src/*": {
28
- "import": "./src/*"
29
- },
30
- "./*": {
31
- "import": "./src/*/index.js"
32
- },
33
- ".": {
34
- "import": "./dist/ziko.mjs",
35
- "require": "./dist/ziko.cjs"
36
- },
37
- "./helpers": {
38
- "import": "./src/__helpers__.js"
39
- },
40
- "./events": {
41
- "import": "./src/events/index.js"
42
- },
43
- "./watch": {
44
- "import": "./src/watch/index.js"
45
- },
46
- "./use": {
47
- "import": "./src/use/index.js"
48
- },
49
- "./hooks": {
50
- "import": "./src/hooks/index.js"
51
- },
52
- "./ui": {
53
- "import": "./src/ui/index.js",
54
- "type": "./src/ui/index.d.ts"
55
- },
56
- "./tags": {
57
- "import": "./src/tags/index.js"
58
- },
59
- "./src": "./src/index.js",
60
- "./html": {},
61
- "./app": {},
62
- "./components": {}
63
- },
64
- "sideEffects": true,
65
- "bin": {
66
- "create-ziko-app": "starter/bin/index.js"
67
- },
68
- "scripts": {
69
- "test": "npx vitest",
70
- "test-link": "node _link/index.js",
71
- "lint": "eslint src/*/*/*",
72
- "dev": "cross-env NODE_ENV=development rollup --config rollup.config.js",
73
- "watch": "cross-env NODE_ENV=development rollup --config rollup.config.js -w",
74
- "build": "cross-env NODE_ENV=production rollup --config rollup.config.js"
75
- },
76
- "repository": {
77
- "type": "git",
78
- "url": "git+https://github.com/zakarialaoui10/ziko.js.git"
79
- },
80
- "author": "zakaria elalaoui",
81
- "license": "MIT",
82
- "bugs": {
83
- "url": "https://github.com/zakarialaoui10/ziko.js/issues"
84
- },
85
- "homepage": "https://github.com/zakarialaoui10/ziko.js#readme",
86
- "devDependencies": {
87
- "@rollup/plugin-commonjs": "^29.0.0",
88
- "@rollup/plugin-node-resolve": "^16.0.3",
89
- "@rollup/plugin-terser": "^0.4.4",
90
- "@vitest/coverage-v8": "^4.0.18",
91
- "cross-env": "^10.1.0",
92
- "eslint": "^10.0.0",
93
- "jsdom": "^26.0.0",
94
- "rollup": "^4.57.1",
95
- "vitest": "^4.0.18"
96
- }
97
- }
1
+ {
2
+ "name": "ziko",
3
+ "version": "2.0.0-alpha.0",
4
+ "description": "A versatile JavaScript library offering a rich set of Hyperscript Based UI components, advanced mathematical utilities, interactivity ,animations, client side routing and more ...",
5
+ "keywords": [
6
+ "front-end",
7
+ "framework",
8
+ "zikojs",
9
+ "ziko",
10
+ "math",
11
+ "user-interface",
12
+ "time",
13
+ "dom",
14
+ "single page application",
15
+ "file based routing"
16
+ ],
17
+ "type": "module",
18
+ "main": "dist/ziko.mjs",
19
+ "module": "dist/ziko.mjs",
20
+ "unpkg": "dist/ziko.min.js",
21
+ "files": [
22
+ "src",
23
+ "dist",
24
+ "LICENCE"
25
+ ],
26
+ "exports": {
27
+ "./*": {
28
+ "import": "./src/*/index.js"
29
+ },
30
+ ".": {
31
+ "import": "./dist/ziko.mjs",
32
+ "require": "./dist/ziko.cjs"
33
+ },
34
+ "./helpers": {
35
+ "import": "./src/__helpers__.js"
36
+ },
37
+ "./events": {
38
+ "import": "./src/events/index.js"
39
+ },
40
+ "./hooks": {
41
+ "import": "./src/hooks/index.js"
42
+ }
43
+ },
44
+ "sideEffects": true,
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/zikojs/ziko.git",
48
+ "directory": "packages/ziko"
49
+ },
50
+ "author": "zakaria elalaoui",
51
+ "license": "MIT",
52
+ "bugs": {
53
+ "url": "https://github.com/zikojs/ziko/issues"
54
+ },
55
+ "homepage": "https://github.com/zikojs/ziko#readme",
56
+ "devDependencies": {
57
+ "@rollup/plugin-commonjs": "^29.0.0",
58
+ "@rollup/plugin-node-resolve": "^16.0.3",
59
+ "@rollup/plugin-terser": "^0.4.4",
60
+ "rollup": "^4.57.1"
61
+ },
62
+ "scripts": {
63
+ "test": "npx vitest",
64
+ "test-link": "node _link/index.js",
65
+ "lint": "eslint src/*/*/*",
66
+ "dev": "cross-env NODE_ENV=development rollup --config rollup.config.js",
67
+ "watch": "cross-env NODE_ENV=development rollup --config rollup.config.js -w",
68
+ "build": "cross-env NODE_ENV=production rollup --config rollup.config.js"
69
+ }
70
+ }
@@ -2,9 +2,9 @@ export const __Config__ = {
2
2
  default:{
3
3
  target:null,
4
4
  render:true,
5
- math:{
6
- mode:"deg"
7
- }
5
+ // math:{
6
+ // mode:"deg"
7
+ // }
8
8
  },
9
9
  setDefault:function(pairs){
10
10
  const keys=Object.keys(pairs);
@@ -1,4 +1,3 @@
1
- import { useSessionStorage } from '../hooks/use-storage.js'
2
1
  export var __State__ = {
3
2
  store : new Map(),
4
3
  index : 0,
@@ -1,4 +1,4 @@
1
- import { UIElement } from "../../constructors/UIElement.js";
1
+ import { UIElement } from "../../dom/UIElement/index.js";
2
2
 
3
3
  export class UIFragment extends UIElement{
4
4
  constructor(...items){
@@ -1,6 +1,6 @@
1
- import { UIElement } from "../../../constructors/UIElement.js";
1
+ import { UIElement } from "../../dom/UIElement/index.js";
2
2
 
3
- class UIHTMLWrapper extends UIElement {
3
+ export class UIHTMLWrapper extends UIElement {
4
4
  constructor(content){
5
5
  super({element : 'div', name : 'html_wrappper'})
6
6
  this.element.append(html2dom(content))
@@ -19,8 +19,4 @@ function html2dom(htmlString) {
19
19
  }
20
20
  }
21
21
 
22
- const HTMLWrapper = (content) => new UIHTMLWrapper(content)
23
- export{
24
- UIHTMLWrapper,
25
- HTMLWrapper
26
- }
22
+ export const HTMLWrapper = (content) => new UIHTMLWrapper(content)
@@ -1,6 +1,5 @@
1
- import { UIElement } from "../../../constructors/UIElement.js";
2
-
3
- class UISVGWrapper extends UIElement {
1
+ import { UIElement } from "../../dom/UIElement/index.js";
2
+ export class UISVGWrapper extends UIElement {
4
3
  constructor(content){
5
4
  super({element : 'div', name : 'html_wrappper'})
6
5
  this.element.append(svg2dom(content));
@@ -27,20 +26,9 @@ function svg2dom(svgString) {
27
26
  element.setAttribute(name, value)
28
27
  }
29
28
  element.append(...children)
30
-
31
- globalThis.svg = svg
32
- globalThis.children = children
33
- globalThis.attributes = attributes
34
- globalThis.element = element
35
29
  return element;
36
30
  }
37
31
  throw new Error("DOMParser is not available in this environment");
38
32
  }
39
33
 
40
-
41
-
42
- const SVGWrapper = (content) => new UISVGWrapper(content)
43
- export{
44
- UISVGWrapper,
45
- SVGWrapper
46
- }
34
+ export const SVGWrapper = (content) => new UISVGWrapper(content)
@@ -1,4 +1,4 @@
1
- import {UIElement} from "../../mini/UIElement.js";
1
+ import { UIElement } from "../../dom/UIElement/index.js";
2
2
  export class UISuspense extends UIElement{
3
3
  constructor(fallback_ui, callback){
4
4
  super({element : "div", name : "suspense"})
@@ -1,5 +1,5 @@
1
- import { UIElement } from "../../constructors/UIElement.js";
2
- import { call_with_optional_props } from '../../utils/index.js';
1
+ import { UIElement } from "../../dom/UIElement/index.js";
2
+ import { call_with_optional_props } from '../../dom/internal-utils/call_with_optional_props.js';
3
3
 
4
4
  export class UISwap extends UIElement {
5
5
  #DISPLAYS_MAP = new WeakMap()
@@ -1,5 +1,4 @@
1
- import { UIElement } from "../../constructors/UIElement.js";
2
-
1
+ import { UIElement } from "../../dom/UIElement/index.js";
3
2
  class UISwitch extends UIElement{
4
3
  constructor(key, cases){
5
4
  super()
@@ -0,0 +1,11 @@
1
+ import { UIElement } from "../../dom/UIElement/index.js";
2
+ import { call_with_optional_props } from '../../dom/internal-utils/call_with_optional_props.js';
3
+
4
+ export class UIView extends UIElement{
5
+ constructor(...items){
6
+ super({element : 'div', name : 'view'})
7
+ this.append(...items)
8
+ }
9
+ }
10
+
11
+ export const View = (...items) => call_with_optional_props(UIElement);
@@ -5,6 +5,5 @@ export * from './Swap/index.js';
5
5
  export * from './Fragment/index.js';
6
6
  export * from './For/index.js';
7
7
  export * from './Switch/index.js';
8
-
9
- export * from './wrappers/index.js'
10
- export * from './graphics/index.js'
8
+ export * from './HTMLWrapper/index.js'
9
+ export * from './SVGWrapper/index.js'
@@ -1,12 +1,12 @@
1
- import { UIElementCore } from "./UIElementCore.js";
2
- import { register_to_class } from "../../helpers/register/register-to-class.js";
1
+ import { UIElement as UIElementCore } from "../../mini-dom/UIElement/index.js";
2
+ import { register_to_class } from "../../internal-utils/register/register-to-class.js";
3
3
  import {
4
4
  LifecycleMethods,
5
5
  AttrsMethods,
6
6
  DomMethods,
7
7
  IndexingMethods,
8
8
  StyleMethods,
9
- } from "./mixins/index.js";
9
+ } from "../../mini-dom/mixins/index.js";
10
10
 
11
11
  import {
12
12
  EventController,
@@ -102,9 +102,9 @@ class UIElement extends UIElementCore{
102
102
  get text(){
103
103
  return this.element.textContent;
104
104
  }
105
- get isBody(){
106
- return this.element === globalThis?.document.body;
107
- }
105
+ // get isBody(){
106
+ // return this.element === globalThis?.document.body;
107
+ // }
108
108
  get parent(){
109
109
  return this.cache.parent;
110
110
  }
package/src/dom/index.js CHANGED
@@ -1,7 +1,3 @@
1
- export * from './constructors/UIElement.js'
2
- export * from './constructors/UINode.js'
3
- export * from './utils/index.js'
1
+ export * from './UIElement/index.js'
4
2
  export * from './tags/index.js';
5
- export * from './text/index.js';
6
- export * from './web-component/index.js'
7
- export * from './components/index.js'
3
+ // export * from './text/index.js';
@@ -1,4 +1,4 @@
1
- import { is_primitive } from "./checkers.js";
1
+ import { is_primitive } from "../../internal-utils/checkers/index.js";
2
2
  export const call_with_optional_props = (Component) => {
3
3
  return (...args) => {
4
4
  const first = args[0];
@@ -1,5 +1,6 @@
1
1
  import { isStateGetter } from '../../hooks/use-state.js'
2
2
  import { UIElement } from '../constructors/UIElement.js'
3
+
3
4
  export const is_ui_item = item => {
4
5
  return (
5
6
  ['string', 'number'].includes(item)
@@ -0,0 +1,10 @@
1
+ import { isStateGetter } from '../../hooks/use-state.js'
2
+ import { UIElement } from '../UIElement/index.js'
3
+ export const is_ui_item = item => {
4
+ return (
5
+ ['string', 'number'].includes(item)
6
+ || isStateGetter(item)
7
+ || item instanceof HTMLElement
8
+ || item instanceof UIElement
9
+ )
10
+ }
@@ -1,8 +1,8 @@
1
- import {UIElement} from "../constructors/UIElement.js";
1
+ import {UIElement} from "../UIElement/index.js";
2
2
  import { HTMLTags, SVGTags, MathMLTags } from "./tags-list.js";
3
3
  import { isStateGetter } from "../../hooks/use-state.js";
4
- import { call_with_optional_props } from "../utils/call_with_optional_props.js";
5
- import { is_ui_item } from "../utils/is_ui_item.js";
4
+ import { call_with_optional_props } from "../internal-utils/call_with_optional_props.js";
5
+ import { is_ui_item } from "../internal-utils/is_ui_item.js";
6
6
 
7
7
  export const tags = new Proxy({}, {
8
8
  get(target, prop) {
@@ -1,4 +1,4 @@
1
- import { throttle } from "../../time/decorators/index.js";
1
+ import { throttle } from "../../time/index.js";
2
2
  class ViewEvent extends CustomEvent {
3
3
  constructor(type, detail, { bubbles = true, cancelable = true } = {}) {
4
4
  super(type, { detail, bubbles, cancelable });
@@ -1,13 +1,5 @@
1
- export type * from './use-ipc'
2
- export type * from './use-storage.d.ts'
3
1
  export type * from './use-state.d.ts'
4
2
  export type * from './use-derived.d.ts'
5
3
  export type * from './use-effect.d.ts'
6
4
  export type * from './use-reactive.d.ts'
7
- export type * from './use-thread.d.ts'
8
5
  export type * from './use-event-emitter.d.ts'
9
- export type * from './use-media-query.d.ts'
10
- export type * from './use-title.d.ts'
11
- export type * from './use-favicon.d.ts'
12
- export type * from './use-root.d.ts'
13
- export type * from './use-query-params.d.ts'
@@ -1,16 +1,5 @@
1
- // STATES
2
1
  export * from './use-state.js';
3
2
  export * from './use-derived.js';
4
3
  export * from './use-reactive.js';
5
4
  export * from './use-effect.js'
6
-
7
- //
8
- export * from './use-ipc.js'
9
- export * from './use-storage.js'
10
- export * from './use-thread.js'
11
- export * from './use-event-emitter.js'
12
- export * from './use-media-query.js'
13
- export * from './use-title.js'
14
- export * from './use-root.js'
15
-
16
- export * from './use-query-params.js'
5
+ export * from './use-event-emitter.js'
@@ -1,30 +1,34 @@
1
- import { STATE_GETTER } from '../symbols/index.js';
1
+ import { STATE_GETTER } from '../internal-utils/symbols/index.js';
2
2
 
3
3
  export function useDerived(deriveFn, sources) {
4
- let value = deriveFn(...sources.map(s => s().value));
4
+ const getValue = () => deriveFn(...sources.map(source => source().value));
5
+
6
+ let value = getValue();
5
7
  const subscribers = new Set();
6
8
 
7
- // const unsubscribers = sources.map(source => {
8
- // const srcValue = source();
9
+ const notify = () => {
10
+ const newValue = getValue();
11
+
12
+ if (Object.is(newValue, value)) return;
9
13
 
10
- // return srcValue._subscribe(() => {
11
- // const newVal = deriveFn(...sources.map(s => s().value));
14
+ value = newValue;
15
+ subscribers.forEach(fn => fn(value));
16
+ };
12
17
 
13
- // if (!Object.is(newVal, value)) {
14
- // value = newVal;
15
- // subscribers.forEach(fn => fn(value));
16
- // }
17
- // });
18
- // });
18
+ const unsubscribers = sources.map(source => {
19
+ const state = source();
20
+ return state._subscribe(notify);
21
+ });
19
22
 
20
23
  const getter = () => ({
21
24
  value,
22
- _subscribe: (fn) => {
25
+ _subscribe(fn) {
23
26
  subscribers.add(fn);
24
27
  return () => subscribers.delete(fn);
25
28
  },
26
29
  });
27
30
 
28
31
  getter[STATE_GETTER] = true;
29
- return getter
32
+
33
+ return getter;
30
34
  }
@@ -1,40 +1,32 @@
1
1
  import { isStateGetter } from "./use-state.js";
2
2
 
3
- export const useEffect = (callback, deps = []) =>{
3
+ export const useEffect = (callback, deps = []) => {
4
4
  const states = deps.filter(isStateGetter);
5
-
6
5
  let cleanup;
7
6
 
7
+ const getValues = () =>
8
+ states.map(state => state().value);
9
+
8
10
  const execute = () => {
9
- // Cleanup previous effect
10
11
  if (typeof cleanup === "function") {
11
12
  cleanup();
12
13
  }
13
14
 
14
- // Read current state values
15
- const values = states.map(state => state().value);
16
-
17
- // Execute effect
18
- cleanup = callback(...values);
15
+ cleanup = callback(getValues());
19
16
  };
20
17
 
21
- // Subscribe to states
22
18
  const unsubscribers = states.map(state =>
23
19
  state()._subscribe(execute)
24
20
  );
25
21
 
26
- // Initial execution
27
22
  execute();
28
23
 
29
- // Return effect cleanup
30
24
  return () => {
31
- unsubscribers.forEach(unsubscribe => {
32
- unsubscribe();
33
- });
25
+ unsubscribers.forEach(unsubscribe => unsubscribe());
34
26
 
35
27
  if (typeof cleanup === "function") {
36
28
  cleanup();
37
29
  cleanup = undefined;
38
30
  }
39
31
  };
40
- }
32
+ };
@@ -1,4 +1,4 @@
1
- import { mapfun, MapfunResult } from "../math/utils/mapfun.d.ts";
1
+ import { mapfun, MapfunResult } from "../math/mapfun/index.d.ts";
2
2
  import { useState } from "./use-state.d.ts";
3
3
 
4
4
  export function useReactive<
@@ -1,4 +1,4 @@
1
- import { mapfun } from '../math/utils/mapfun.js'
1
+ import { mapfun } from '../math/mapfun/index.js'
2
2
  import { useState } from './use-state.js'
3
3
 
4
4
  const useReactive = (nested_value) => mapfun(
@@ -1,10 +1,4 @@
1
- // import { __init__global__ } from "../__ziko__/index.js";
2
-
3
- // if (!globalThis.__Ziko__) __init__global__();
4
-
5
- // export const STATE_GETTER = Symbol.for("ziko.stateGetter");
6
-
7
- import {STATE_GETTER} from '../symbols/index.js'
1
+ import { STATE_GETTER } from '../internal-utils/symbols/index.js';
8
2
 
9
3
  export function useState(initialValue) {
10
4
  const state = {
package/src/index.js CHANGED
@@ -1,18 +1,14 @@
1
1
  export * from "./math/index.js";
2
2
  export * from "./dom/index.js";
3
3
  export * from "./time/index.js";
4
- export * from "./data/index.js";
5
- // export * from "./reactivity/index.js"
6
- export * from "./app/index.js";
7
4
  export * from './hooks/index.js';
8
- // export * from './use/index.js'
9
-
10
5
  export * from "./events/index.js";
6
+ export * from './string/index.js'
11
7
 
12
8
  if(globalThis?.document){
13
9
  document?.addEventListener("DOMContentLoaded", __Ziko__.__Config__.init());
14
10
  }
15
11
 
16
- import './math/functions/proxy.js'
12
+ // import './math/functions/proxy.js'
17
13
 
18
14
 
@@ -1,2 +1,2 @@
1
1
  export const is_primitive = value => typeof value !== 'object' && typeof value !== 'function' || value === null;
2
- export const is_async = fn => fn && fn.constructor && fn.constructor.name === "AsyncFunction";
2
+ export const is_async = fn => fn && fn.constructor && fn.constructor.name === "AsyncFunction";
@@ -1,4 +1,4 @@
1
- export type * from './random/index.d.ts';
2
- export type * from './complex/index.d.ts';
3
- export type * from './stats/index.d.ts'
4
- export type * from './functions/index.d.ts'
1
+ export type * from './random/index';
2
+ export type * from './complex/index';
3
+ export type * from './stats/index'
4
+ export type * from './functions/index'
package/src/math/index.js CHANGED
@@ -1,11 +1,8 @@
1
- export * from "./const.js"
2
- export * from "./functions/index.js"
3
- export * from "./complex/index.js"
4
- export * from "./matrix/index.js"
5
- export * from './stats/index.js'
6
- // export * from "./discret"
7
- export * from "./random/index.js"
8
- // export * from "./utils/index.js" // To Check
9
- // export * from "./statistics"
10
- // export default Math;
1
+ export * from "./const/index.js"
2
+ export * from './mapfun/index.js'
3
+ export * from './utils/index.js'
4
+ // export * from './ufunc/index.js'
5
+ // export * from './random/index.js'
6
+ // export * from './complex/index.js'
7
+
11
8
 
@@ -1,4 +1,4 @@
1
- import { is_primitive } from "../../../helpers/checkers/index.js";
1
+ import { is_primitive } from "../../internal-utils/checkers/index.js";
2
2
  export const mapfun=(fun,...X)=>{
3
3
  const Y=X.map(x=>{
4
4
  if(is_primitive(x) || x?.__mapfun__) return fun(x)
@@ -1,4 +1,4 @@
1
- import { Mappable } from "../mapfun/index.d.ts";
1
+ import { Mappable } from "../../mapfun/indexx
2
2
  /**
3
3
  * Converts degrees to radians.
4
4
  *