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.
- package/dist/ziko.cjs +304 -2868
- package/dist/ziko.js +1322 -5315
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +1242 -5057
- package/package.json +70 -97
- package/src/__ziko__/__config__.js +3 -3
- package/src/__ziko__/__state__.js +0 -1
- package/src/{dom/components → components}/Fragment/index.js +1 -1
- package/src/{dom/components/wrappers → components}/HTMLWrapper/index.js +3 -7
- package/src/{dom/components/wrappers → components}/SVGWrapper/index.js +3 -15
- package/src/{dom/components → components}/Suspense/index.js +1 -1
- package/src/{dom/components → components}/Swap/index.js +2 -2
- package/src/{dom/components → components}/Switch/index.js +1 -2
- package/src/components/View/index.js +11 -0
- package/src/{dom/components → components}/index.js +2 -3
- package/src/dom/{constructors/UIElement.js → UIElement/index.js} +6 -6
- package/src/dom/index.js +2 -6
- package/src/dom/{utils → internal-utils}/call_with_optional_props.js +1 -1
- package/src/dom/{utils/is_ui_item.js → internal-utils/checkers.js} +1 -0
- package/src/dom/internal-utils/is_ui_item.js +10 -0
- package/src/dom/tags/index.js +3 -3
- package/src/events/custom-events-registry/view.js +1 -1
- package/src/hooks/index.d.ts +0 -8
- package/src/hooks/index.js +1 -12
- package/src/hooks/use-derived.js +18 -14
- package/src/hooks/use-effect.js +7 -15
- package/src/hooks/use-reactive.d.ts +1 -1
- package/src/hooks/use-reactive.js +1 -1
- package/src/hooks/use-state.js +1 -7
- package/src/index.js +2 -6
- package/src/{helpers → internal-utils}/checkers/index.js +1 -1
- package/src/math/index.d.ts +4 -4
- package/src/math/index.js +7 -10
- package/src/math/{functions/mapfun → mapfun}/index.js +1 -1
- package/src/math/{functions/utils → utils}/index.d.ts +1 -1
- package/src/math/utils/index.js +42 -103
- package/src/{dom/constructors/UIElementCore.d.ts → mini-dom/UIElement/index.d.ts} +1 -1
- package/src/{dom/constructors/UIElementCore.js → mini-dom/UIElement/index.js} +5 -14
- package/src/{dom/constructors/UINode.js → mini-dom/UINode/index.js} +1 -3
- package/src/{dom/constructors → mini-dom}/mixins/attrs.js +6 -6
- package/src/{dom/constructors → mini-dom}/mixins/dom.js +2 -16
- package/src/mini-dom/mixins/lifecycle.js +32 -0
- package/src/{dom/constructors → mini-dom}/mixins/style.js +1 -1
- package/src/mini-dom/parse_props.js +26 -0
- package/src/{dom → mini-dom}/text/index.js +4 -4
- package/src/router/file-based-router/index.js +63 -14
- package/src/router/index.d.ts +1 -1
- package/src/router/index.js +1 -1
- package/src/router/{utils → internal-utils}/dynamic-routes-parser.js +45 -11
- package/src/router/internal-utils/get-root.js +24 -0
- package/src/router/internal-utils/index.d.ts +5 -0
- package/src/router/internal-utils/normalize-path.js +32 -0
- package/src/router/internal-utils/routes-grouper.js +49 -0
- package/src/router/{utils → internal-utils}/routes-matcher.js +32 -9
- package/src/{hooks/use-query-params.js → router/useQueryParams/index.js} +0 -1
- package/src/time/{clocks/clock.js → clock/index.js} +1 -1
- package/src/time/{clocks/clock.d.ts → clock/index.ts} +1 -1
- package/src/time/debounce/index.d.ts +4 -0
- package/src/time/debounce/index.js +4 -0
- package/src/time/index.d.ts +7 -5
- package/src/time/index.js +7 -8
- package/src/time/sleep/index.d.ts +1 -0
- package/src/time/sleep/index.js +1 -0
- package/src/time/throttle/index.d.ts +4 -0
- package/src/time/throttle/index.js +9 -0
- package/src/time/{clocks/tick.js → tick/index.js} +2 -7
- package/src/time/{delay → timeout}/index.d.ts +0 -2
- package/src/time/{delay → timeout}/index.js +0 -1
- package/src/app/globals.js +0 -76
- package/src/app/index.js +0 -18
- package/src/app/params.js +0 -37
- package/src/app/routes.js +0 -57
- package/src/app/spa-file-based-routing.js +0 -74
- package/src/app/spa.js +0 -55
- package/src/app/ziko-app.js +0 -39
- package/src/data/api/fetchdom.js +0 -30
- package/src/data/api/index.js +0 -4
- package/src/data/api/preload.js +0 -11
- package/src/data/converter/__(To Be Moved)adoc.js +0 -130
- package/src/data/converter/__(To Be Moved)markdown.js +0 -95
- package/src/data/converter/array.js +0 -43
- package/src/data/converter/canvas.js +0 -25
- package/src/data/converter/css.js +0 -37
- package/src/data/converter/csv.js +0 -35
- package/src/data/converter/idea.txt +0 -10
- package/src/data/converter/index.js +0 -33
- package/src/data/converter/json.js +0 -80
- package/src/data/converter/object.js +0 -74
- package/src/data/converter/svg.js +0 -11
- package/src/data/datatypes/color.js +0 -11
- package/src/data/decorators.js +0 -0
- package/src/data/index.js +0 -17
- package/src/data/parser/index.d.ts +0 -41
- package/src/data/parser/index.js +0 -28
- package/src/data/string-dep/index.js +0 -1
- package/src/data/string-dep/patterns.js +0 -12
- package/src/data/string-dep/string.js +0 -170
- package/src/dom/components/Flex/index.js +0 -89
- package/src/dom/components/Flex/utils/index.js +0 -20
- package/src/dom/components/View/index.js +0 -9
- package/src/dom/components/graphics/Canvas/index.js +0 -175
- package/src/dom/components/graphics/Svg/index.js +0 -69
- package/src/dom/components/graphics/index.js +0 -2
- package/src/dom/components/wrappers/index.js +0 -2
- package/src/dom/constructors/mixins/lifecycle.js +0 -54
- package/src/dom/grid/index.js +0 -33
- package/src/dom/mini/UIElement.js +0 -10
- package/src/dom/utils/checkers.js +0 -1
- package/src/dom/utils/getters.js +0 -0
- package/src/hooks/use-favicon.d.ts +0 -41
- package/src/hooks/use-favicon.js +0 -59
- package/src/hooks/use-ipc.d.ts +0 -12
- package/src/hooks/use-ipc.js +0 -83
- package/src/hooks/use-media-query.d.ts +0 -24
- package/src/hooks/use-media-query.js +0 -59
- package/src/hooks/use-root.d.ts +0 -15
- package/src/hooks/use-root.js +0 -73
- package/src/hooks/use-storage.d.ts +0 -47
- package/src/hooks/use-storage.js +0 -118
- package/src/hooks/use-thread.d.ts +0 -33
- package/src/hooks/use-thread.js +0 -55
- package/src/hooks/use-title.d.ts +0 -37
- package/src/hooks/use-title.js +0 -43
- package/src/lite.js +0 -2
- package/src/math/--discret/Set/index.js +0 -2
- package/src/math/--discret/Set/power-set.js +0 -15
- package/src/math/--discret/Set/sub-set.js +0 -10
- package/src/math/--discret/index.js +0 -12
- package/src/math/complex/helpers/constructor.js +0 -38
- package/src/math/complex/helpers/index.js +0 -1
- package/src/math/complex/index.d.ts +0 -231
- package/src/math/complex/index.js +0 -193
- package/src/math/functions/conversions/index.d.ts +0 -101
- package/src/math/functions/conversions/index.js +0 -61
- package/src/math/functions/helper.js +0 -81
- package/src/math/functions/index.d.ts +0 -147
- package/src/math/functions/index.js +0 -43
- package/src/math/functions/logic/index.d.ts +0 -53
- package/src/math/functions/logic/index.js +0 -54
- package/src/math/functions/proxy.js +0 -58
- package/src/math/functions/signal/index.d.ts +0 -146
- package/src/math/functions/signal/index.js +0 -104
- package/src/math/functions/stats/index.js +0 -61
- package/src/math/functions/ufunc/index.d.ts +0 -96
- package/src/math/functions/ufunc/index.js +0 -372
- package/src/math/functions/utils/index.js +0 -47
- package/src/math/matrix/AbstractMatrix.js +0 -0
- package/src/math/matrix/helpers/constructor.js +0 -31
- package/src/math/matrix/helpers/det.js +0 -36
- package/src/math/matrix/helpers/index.js +0 -5
- package/src/math/matrix/helpers/inverse.js +0 -52
- package/src/math/matrix/helpers/maintain.js +0 -13
- package/src/math/matrix/helpers/stack.js +0 -24
- package/src/math/matrix/index.js +0 -557
- package/src/math/random/index.d.ts +0 -162
- package/src/math/random/index.js +0 -125
- package/src/math/signal/functions.js +0 -84
- package/src/math/signal/index.js +0 -1
- package/src/math/stats/accum/index.d.ts +0 -43
- package/src/math/stats/accum/index.js +0 -39
- package/src/math/stats/average/index.d.ts +0 -123
- package/src/math/stats/average/index.js +0 -75
- package/src/math/stats/index.d.ts +0 -5
- package/src/math/stats/index.js +0 -14
- package/src/math/stats/percentile/index.d.ts +0 -66
- package/src/math/stats/percentile/index.js +0 -18
- package/src/math/stats/rolling/index.d.ts +0 -47
- package/src/math/stats/rolling/index.js +0 -34
- package/src/math/stats/variability/index.d.ts +0 -93
- package/src/math/stats/variability/index.js +0 -37
- package/src/math/utils/arithmetic.js +0 -137
- package/src/math/utils/checkers.js +0 -29
- package/src/math/utils/comparaison.js +0 -1
- package/src/math/utils/conversions.js +0 -19
- package/src/math/utils/discret.js +0 -51
- package/src/math/utils/mapfun.js +0 -42
- package/src/no-module.js +0 -32
- package/src/provider/index.js +0 -7
- package/src/router/utils/get-root.js +0 -16
- package/src/router/utils/index.d.ts +0 -5
- package/src/router/utils/normalize-path.js +0 -21
- package/src/router/utils/routes-grouper.js +0 -22
- package/src/time/animation/index.d.ts +0 -189
- package/src/time/animation/index.js +0 -94
- package/src/time/clocks/index.d.ts +0 -3
- package/src/time/clocks/index.js +0 -3
- package/src/time/converters/index.js +0 -1
- package/src/time/decorators/index.d.ts +0 -9
- package/src/time/decorators/index.js +0 -17
- package/src/time/ease/index.d.ts +0 -103
- package/src/time/ease/index.js +0 -118
- package/src/time/loop/index.d.ts +0 -50
- package/src/time/loop/index.js +0 -103
- package/src/time/utils/index.js +0 -17
- package/src/time/utils/performance.js +0 -16
- package/src/time/utils/ui.js +0 -26
- /package/src/{dom/components → components}/For/index.js +0 -0
- /package/src/{dom/components → components}/Fragment/index.d.ts +0 -0
- /package/src/{dom/components → components}/Swap/index.d.ts +0 -0
- /package/src/{dom/components → components}/index.d.ts +0 -0
- /package/src/dom/{utils → internal-utils}/index.js +0 -0
- /package/src/dom/{utils → internal-utils}/parse_props.js +0 -0
- /package/src/{helpers → internal-utils}/index.js +0 -0
- /package/src/{helpers → internal-utils}/register/index.js +0 -0
- /package/src/{helpers → internal-utils}/register/register-to-class.js +0 -0
- /package/src/{helpers → internal-utils}/register/register-to-instance.js +0 -0
- /package/src/{symbols → internal-utils/symbols}/index.d.ts +0 -0
- /package/src/{symbols → internal-utils/symbols}/index.js +0 -0
- /package/src/math/{functions/arithmetic → arithmetic}/index.d.ts +0 -0
- /package/src/math/{functions/arithmetic → arithmetic}/index.js +0 -0
- /package/src/math/{const.js → const/index.js} +0 -0
- /package/src/math/{functions/mapfun → mapfun}/index.d.ts +0 -0
- /package/src/math/{functions/mapfun → mapfun}/index.d.ts.txt +0 -0
- /package/src/math/{functions/utils → utils}/mapfun.d.ts.txt +0 -0
- /package/src/{dom/constructors/UINode.d.ts → mini-dom/UINode/index.d.ts} +0 -0
- /package/src/{dom/constructors → mini-dom}/mixins/index.js +0 -0
- /package/src/{dom/constructors → mini-dom}/mixins/indexing.js +0 -0
- /package/src/router/{utils → internal-utils}/dynamic-routes-parser.d.ts +0 -0
- /package/src/router/{utils → internal-utils}/get-root.d.ts +0 -0
- /package/src/router/{utils → internal-utils}/index.js +0 -0
- /package/src/router/{utils → internal-utils}/normalize-path.d.ts +0 -0
- /package/src/router/{utils → internal-utils}/renderer.js +0 -0
- /package/src/router/{utils → internal-utils}/routes-grouper.d.ts +0 -0
- /package/src/router/{utils → internal-utils}/routes-matcher.d.ts +0 -0
- /package/src/{hooks/use-query-params.d.ts → router/useQueryParams/index.d.ts} +0 -0
- /package/src/{data/string → string}/checkers/index.d.ts +0 -0
- /package/src/{data/string → string}/checkers/index.js +0 -0
- /package/src/{data/string → string}/converters/index.d.ts +0 -0
- /package/src/{data/string → string}/converters/index.js +0 -0
- /package/src/{data/string → string}/index.d.ts +0 -0
- /package/src/{data/string → string}/index.js +0 -0
- /package/src/time/{clocks/scheduler.js → schedular/index.js} +0 -0
- /package/src/time/{clocks/scheduler.d.ts → schedular/index.ts} +0 -0
- /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": "
|
|
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
|
|
29
|
-
},
|
|
30
|
-
"
|
|
31
|
-
"import": "./
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
},
|
|
37
|
-
"./
|
|
38
|
-
"import": "./src/
|
|
39
|
-
},
|
|
40
|
-
"./
|
|
41
|
-
"import": "./src/
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UIElement } from "
|
|
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 "
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import { UIElement } from "../../
|
|
2
|
-
import { call_with_optional_props } from '../../utils/
|
|
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()
|
|
@@ -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 './
|
|
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 "
|
|
2
|
-
import { register_to_class } from "../../
|
|
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 "
|
|
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
|
-
|
|
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 './
|
|
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';
|
|
@@ -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
|
+
}
|
package/src/dom/tags/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {UIElement} from "../
|
|
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) {
|
package/src/hooks/index.d.ts
CHANGED
|
@@ -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'
|
package/src/hooks/index.js
CHANGED
|
@@ -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'
|
package/src/hooks/use-derived.js
CHANGED
|
@@ -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
|
-
|
|
4
|
+
const getValue = () => deriveFn(...sources.map(source => source().value));
|
|
5
|
+
|
|
6
|
+
let value = getValue();
|
|
5
7
|
const subscribers = new Set();
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
const notify = () => {
|
|
10
|
+
const newValue = getValue();
|
|
11
|
+
|
|
12
|
+
if (Object.is(newValue, value)) return;
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
value = newValue;
|
|
15
|
+
subscribers.forEach(fn => fn(value));
|
|
16
|
+
};
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
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
|
-
|
|
32
|
+
|
|
33
|
+
return getter;
|
|
30
34
|
}
|
package/src/hooks/use-effect.js
CHANGED
|
@@ -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
|
-
|
|
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
|
+
};
|
package/src/hooks/use-state.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
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";
|
package/src/math/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type * from './random/index
|
|
2
|
-
export type * from './complex/index
|
|
3
|
-
export type * from './stats/index
|
|
4
|
-
export type * from './functions/index
|
|
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
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from './
|
|
6
|
-
// export * from
|
|
7
|
-
|
|
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
|
|