ziko 2.0.0-beta.17.1 → 2.0.0-beta.17.2
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/README.md +135 -135
- package/package.json +13 -13
- package/src/Layout/index.d.ts +37 -37
- package/src/Layout/index.js +97 -97
- package/src/__ziko__/__cache__.js +8 -8
- package/src/__ziko__/__config__.js +15 -15
- package/src/__ziko__/__hydration__.js +11 -11
- package/src/__ziko__/__state__.js +20 -20
- package/src/__ziko__/__ui__.js +32 -32
- package/src/__ziko__/index.js +20 -20
- package/src/__ziko__/params.js +39 -39
- package/src/components/For/index.js +16 -16
- package/src/components/Fragment/index.d.ts +35 -35
- package/src/components/Fragment/index.js +12 -12
- package/src/components/HTMLWrapper/index.js +21 -21
- package/src/components/SVGWrapper/index.js +33 -33
- package/src/components/Suspense/index.js +22 -22
- package/src/components/Swap/index.d.ts +79 -79
- package/src/components/Swap/index.js +63 -63
- package/src/components/Switch/index.js +36 -36
- package/src/components/View/index.js +10 -10
- package/src/components/index.d.ts +1 -1
- package/src/components/index.js +8 -8
- package/src/dom/UIElement/index.js +303 -303
- package/src/dom/UIElement/utils.js +92 -92
- package/src/dom/index.js +2 -2
- package/src/dom/internal-utils/call_with_optional_props.js +13 -13
- package/src/dom/internal-utils/checkers.js +10 -10
- package/src/dom/internal-utils/index.js +87 -87
- package/src/dom/internal-utils/is_ui_item.js +9 -9
- package/src/dom/internal-utils/parse_props.js +25 -25
- package/src/dom/tags/index.d.ts +27 -27
- package/src/dom/tags/index.js +29 -29
- package/src/dom/tags/tags-list.js +134 -134
- package/src/dom/web-component/index.d.ts +14 -14
- package/src/dom/web-component/index.js +46 -46
- package/src/events/controller/index.js +60 -60
- package/src/events/custom-events-registry/click-away.js +39 -39
- package/src/events/custom-events-registry/index.js +2 -2
- package/src/events/custom-events-registry/swipe.js +76 -76
- package/src/events/custom-events-registry/view.js +74 -74
- package/src/events/index.js +2 -2
- package/src/events/mixins/click.js +23 -23
- package/src/events/mixins/index.js +4 -4
- package/src/events/mixins/key.js +24 -24
- package/src/events/mixins/ptr.js +44 -44
- package/src/events/mixins/swipe.js +30 -30
- package/src/events/mixins/utils/index.js +16 -16
- package/src/events/mixins/view.js +24 -24
- package/src/hooks/index.d.ts +5 -5
- package/src/hooks/index.js +4 -4
- package/src/hooks/use-derived.d.ts +14 -14
- package/src/hooks/use-derived.js +33 -33
- package/src/hooks/use-effect.d.ts +38 -38
- package/src/hooks/use-effect.js +31 -31
- package/src/hooks/use-event-emitter.d.ts +46 -46
- package/src/hooks/use-event-emitter.js +68 -68
- package/src/hooks/use-reactive.d.ts +14 -14
- package/src/hooks/use-reactive.js +15 -15
- package/src/hooks/use-state.d.ts +42 -42
- package/src/hooks/use-state.js +52 -52
- package/src/index.d.ts +5 -5
- package/src/index.js +16 -16
- package/src/internal-utils/checkers/index.js +1 -1
- package/src/internal-utils/index.js +65 -65
- package/src/internal-utils/register/index.js +7 -7
- package/src/internal-utils/register/register-to-class.js +15 -15
- package/src/internal-utils/register/register-to-instance.js +30 -30
- package/src/internal-utils/symbols/index.d.ts +41 -41
- package/src/internal-utils/symbols/index.js +6 -6
- package/src/math/arithmetic/index.d.ts +94 -94
- package/src/math/arithmetic/index.js +55 -55
- package/src/math/const/index.js +2 -2
- package/src/math/index.d.ts +3 -3
- package/src/math/index.js +8 -8
- package/src/math/mapfun/index.d.ts +52 -52
- package/src/math/mapfun/index.js +32 -32
- package/src/math/utils/index.d.ts +117 -117
- package/src/math/utils/index.js +47 -47
- package/src/mini-dom/UIElement/index.d.ts +59 -59
- package/src/mini-dom/UIElement/index.js +89 -89
- package/src/mini-dom/UINode/index.d.ts +11 -11
- package/src/mini-dom/UINode/index.js +12 -12
- package/src/mini-dom/mixins/attrs.js +47 -47
- package/src/mini-dom/mixins/dom.js +97 -97
- package/src/mini-dom/mixins/index.js +16 -16
- package/src/mini-dom/mixins/indexing.js +14 -14
- package/src/mini-dom/mixins/lifecycle.js +28 -28
- package/src/mini-dom/mixins/style.js +33 -33
- package/src/mini-dom/parse_props.js +25 -25
- package/src/mini-dom/text/index.js +14 -14
- package/src/router/file-based-router/index.d.ts +83 -83
- package/src/router/file-based-router/index.js +163 -163
- package/src/router/index.d.ts +1 -1
- package/src/router/index.js +1 -1
- package/src/router/internal-utils/dynamic-routes-parser.d.ts +14 -14
- package/src/router/internal-utils/dynamic-routes-parser.js +109 -109
- package/src/router/internal-utils/get-root.d.ts +11 -11
- package/src/router/internal-utils/get-root.js +23 -23
- package/src/router/internal-utils/index.d.ts +4 -4
- package/src/router/internal-utils/index.js +5 -5
- package/src/router/internal-utils/normalize-path.d.ts +15 -15
- package/src/router/internal-utils/normalize-path.js +31 -31
- package/src/router/internal-utils/renderer.js +13 -13
- package/src/router/internal-utils/routes-grouper.d.ts +29 -29
- package/src/router/internal-utils/routes-grouper.js +48 -48
- package/src/router/internal-utils/routes-matcher.js +83 -83
- package/src/router/useQueryParams/index.d.ts +30 -30
- package/src/router/useQueryParams/index.js +69 -69
- package/src/string/checkers/index.d.ts +61 -61
- package/src/string/checkers/index.js +26 -26
- package/src/string/converters/index.d.ts +158 -158
- package/src/string/converters/index.js +61 -61
- package/src/string/index.d.ts +1 -1
- package/src/string/index.js +1 -1
- package/src/time/clock/index.js +61 -61
- package/src/time/debounce/index.d.ts +4 -4
- package/src/time/debounce/index.js +3 -3
- package/src/time/index.d.ts +6 -6
- package/src/time/index.js +6 -6
- package/src/time/schedular/index.js +68 -68
- package/src/time/throttle/index.d.ts +4 -4
- package/src/time/throttle/index.js +8 -8
- package/src/time/tick/index.js +42 -42
- package/src/time/timeout/index.d.ts +10 -10
- package/src/time/timeout/index.js +14 -14
- package/LICENSE +0 -21
- package/dist/ziko.cjs +0 -2671
- package/dist/ziko.js +0 -2677
- package/dist/ziko.min.js +0 -10
- package/dist/ziko.min.js.map +0 -1
- package/dist/ziko.mjs +0 -2583
package/README.md
CHANGED
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
# Zikojs
|
|
2
|
-
|
|
3
|
-
A versatile JavaScript library offering a rich set of Hyperscript Based UI components, advanced mathematical utilities, interactivity ,animations, client side routing and more ...
|
|
4
|
-
<div align="center">
|
|
5
|
-
|
|
6
|
-
[](https://github.com/zakarialaoui10/zikojs/blob/HEAD/LICENSE) [](https://www.npmjs.com/package/ziko) [](https://www.npmjs.com/package/ziko)
|
|
7
|
-
<!-- [](https://isitmaintained.com/project/zakarialaoui/ziko 'Average time to resolve an issue') -->
|
|
8
|
-
|
|
9
|
-
</div>
|
|
10
|
-
|
|
11
|
-
<!--
|
|
12
|
-
## Philosophy
|
|
13
|
-
Methodes Chaining
|
|
14
|
-
Composition
|
|
15
|
-
-->
|
|
16
|
-
## Demos
|
|
17
|
-
- [ Windows entanglement using zikojs and ziko-gl ](https://www.linkedin.com/feed/update/urn:li:activity:7144023650394918913/)
|
|
18
|
-
|
|
19
|
-
## 🔥 Features
|
|
20
|
-
### 💎 Core
|
|
21
|
-
- 🚫 Zero Dependency
|
|
22
|
-
- 🌳 Partial Tree Shaking
|
|
23
|
-
- 🔢 Rich Math Functions and Utilities
|
|
24
|
-
- <details>
|
|
25
|
-
<summary>Flexible Math Functions</summary>
|
|
26
|
-
ZikoJS offers flexible math utilities, such as the `mapfun` function, which allows mapping standard mathematical operations to complex and nested data structures.
|
|
27
|
-
For example, the `cos` function in ZikoJS is built on top of mapfun, enabling it to handle multiple arguments with diverse types (numbers, arrays, objects).
|
|
28
|
-
|
|
29
|
-
```js
|
|
30
|
-
import { cos, PI } from "ziko";
|
|
31
|
-
const result = cos(PI, PI / 2, PI / 4, [PI / 6, PI / 3], {
|
|
32
|
-
x: PI / 2,
|
|
33
|
-
y: PI / 4,
|
|
34
|
-
z: [0, PI / 12],
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
/*
|
|
38
|
-
result =>
|
|
39
|
-
[
|
|
40
|
-
-1,
|
|
41
|
-
0,
|
|
42
|
-
0.707106781186548,
|
|
43
|
-
[0.866025403784439, 0.5],
|
|
44
|
-
{
|
|
45
|
-
x: 0,
|
|
46
|
-
y: 0.707106781186548,
|
|
47
|
-
z: [1, 0.965925826289068],
|
|
48
|
-
},
|
|
49
|
-
];
|
|
50
|
-
*/
|
|
51
|
-
// console.log(result)
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
You can also built your own flexible Math function using this mapfun util :
|
|
55
|
-
```js
|
|
56
|
-
import { mapfun } from "ziko";
|
|
57
|
-
const parabolic_func = (a, b, c, x) => a * x ** 2 + b * x + c;
|
|
58
|
-
const map_parabolic_func =
|
|
59
|
-
(a, b, c) =>
|
|
60
|
-
(...X) =>
|
|
61
|
-
mapfun((n) => parabolic_func(a, b, c, n), ...X);
|
|
62
|
-
const a = -1.5,
|
|
63
|
-
b = 2,
|
|
64
|
-
c = 3;
|
|
65
|
-
const X = [0, 1, 2, 3];
|
|
66
|
-
console.log(parabolic_func(a, b, c)(X));
|
|
67
|
-
// [3,3,1,3]
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
</details>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
<!-- - The Math Module supports a new Paradigm -->
|
|
75
|
-
- ✨ Hyperscript-Based Declarative UI (No Template Engines needed)
|
|
76
|
-
```js
|
|
77
|
-
import {p, text, Random} from 'ziko'
|
|
78
|
-
const Hello = name => p(
|
|
79
|
-
text("Hello ", name)
|
|
80
|
-
).onClick(e => e.target.style({color : Random.color()}))
|
|
81
|
-
```
|
|
82
|
-
- 🔄 Built in State Mangement :
|
|
83
|
-
```js
|
|
84
|
-
import { tags } from 'ziko/dom'
|
|
85
|
-
import {useState, useDerived} from 'ziko/hooks'
|
|
86
|
-
const [timer, setTimer] = useState(0);
|
|
87
|
-
const converToHMS = seconds => `${Math.floor(seconds / 3600)} : ${Math.floor((seconds % 3600) / 60)} : ${seconds % 60} `
|
|
88
|
-
const [time] = useDerived(t => converToHMS(t) , [timer] )
|
|
89
|
-
tags.p('Elapsed Time : ', time)
|
|
90
|
-
let i = 1;
|
|
91
|
-
setInterval(()=>{
|
|
92
|
-
setTimer(i);
|
|
93
|
-
i++
|
|
94
|
-
}, 1000)
|
|
95
|
-
```
|
|
96
|
-
- 📱 Single Page Application With File Based Routing
|
|
97
|
-
```js
|
|
98
|
-
import { FileBasedRouting } from "ziko";
|
|
99
|
-
FileBasedRouting(import.meta.glob("./pages/**/*.js"))
|
|
100
|
-
```
|
|
101
|
-
- 🤝 One Way Interleaving With [Vanjs]()
|
|
102
|
-
- ⏰ Time loop and animations support
|
|
103
|
-
|
|
104
|
-
### 🚀 External :
|
|
105
|
-
- 🧩 Extra UI Components : [Zextra](https://github.com/zakarialaoui10/zextra)
|
|
106
|
-
- 🖥️ Server Side Rendering With File Based Routing and Client Side Hydration : [ziko-server](https://github.com/zakarialaoui10/ziko-server)
|
|
107
|
-
- 📝 Mdx-Like Markdown Preprocessor : [Mdz](https://github.com/zakarialaoui10/mdz)
|
|
108
|
-
- 🔌 Flexible Integration with Popular Frameworks/Libraries : [Ziko-wrapper](https://github.com/zakarialaoui10/ziko-wrapper)
|
|
109
|
-
- 🔄 Bi-directional : `React`, `Preact`, `Solid`, `Svelte`, `Vue` , `Vanjs`
|
|
110
|
-
- ➡️ Uni-directional (ZikoJS → X) :
|
|
111
|
-
- `Astro` : (SSR + Client Hydration)
|
|
112
|
-
- 📦 Growing Add-On Ecosystem :
|
|
113
|
-
- Ziko-Tgl : WebGL/3D Graphics, Built on Top of [Threejs](https://github.com/zakarialaoui10/ziko-gl)
|
|
114
|
-
- Ziko-Chart
|
|
115
|
-
- Ziko-Code
|
|
116
|
-
- Ziko-Lottie
|
|
117
|
-
- ...
|
|
118
|
-
|
|
119
|
-
## Install :
|
|
120
|
-
```bash
|
|
121
|
-
npm i ziko
|
|
122
|
-
```
|
|
123
|
-
## Quick Start :
|
|
124
|
-
```bash
|
|
125
|
-
npx create-ziko-app [app-title]
|
|
126
|
-
```
|
|
127
|
-
## ⭐️ Show your support <a name="support"></a>
|
|
128
|
-
|
|
129
|
-
If you appreciate the library, kindly demonstrate your support by giving it a star!<br>
|
|
130
|
-
[](https://github.com/zakarialaoui10/ziko.js)
|
|
131
|
-
<!--## Financial support-->
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
To do
|
|
135
|
-
add component middlware/wrapper
|
|
1
|
+
# Zikojs
|
|
2
|
+
|
|
3
|
+
A versatile JavaScript library offering a rich set of Hyperscript Based UI components, advanced mathematical utilities, interactivity ,animations, client side routing and more ...
|
|
4
|
+
<div align="center">
|
|
5
|
+
|
|
6
|
+
[](https://github.com/zakarialaoui10/zikojs/blob/HEAD/LICENSE) [](https://www.npmjs.com/package/ziko) [](https://www.npmjs.com/package/ziko)
|
|
7
|
+
<!-- [](https://isitmaintained.com/project/zakarialaoui/ziko 'Average time to resolve an issue') -->
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<!--
|
|
12
|
+
## Philosophy
|
|
13
|
+
Methodes Chaining
|
|
14
|
+
Composition
|
|
15
|
+
-->
|
|
16
|
+
## Demos
|
|
17
|
+
- [ Windows entanglement using zikojs and ziko-gl ](https://www.linkedin.com/feed/update/urn:li:activity:7144023650394918913/)
|
|
18
|
+
|
|
19
|
+
## 🔥 Features
|
|
20
|
+
### 💎 Core
|
|
21
|
+
- 🚫 Zero Dependency
|
|
22
|
+
- 🌳 Partial Tree Shaking
|
|
23
|
+
- 🔢 Rich Math Functions and Utilities
|
|
24
|
+
- <details>
|
|
25
|
+
<summary>Flexible Math Functions</summary>
|
|
26
|
+
ZikoJS offers flexible math utilities, such as the `mapfun` function, which allows mapping standard mathematical operations to complex and nested data structures.
|
|
27
|
+
For example, the `cos` function in ZikoJS is built on top of mapfun, enabling it to handle multiple arguments with diverse types (numbers, arrays, objects).
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import { cos, PI } from "ziko";
|
|
31
|
+
const result = cos(PI, PI / 2, PI / 4, [PI / 6, PI / 3], {
|
|
32
|
+
x: PI / 2,
|
|
33
|
+
y: PI / 4,
|
|
34
|
+
z: [0, PI / 12],
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
/*
|
|
38
|
+
result =>
|
|
39
|
+
[
|
|
40
|
+
-1,
|
|
41
|
+
0,
|
|
42
|
+
0.707106781186548,
|
|
43
|
+
[0.866025403784439, 0.5],
|
|
44
|
+
{
|
|
45
|
+
x: 0,
|
|
46
|
+
y: 0.707106781186548,
|
|
47
|
+
z: [1, 0.965925826289068],
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
*/
|
|
51
|
+
// console.log(result)
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
You can also built your own flexible Math function using this mapfun util :
|
|
55
|
+
```js
|
|
56
|
+
import { mapfun } from "ziko";
|
|
57
|
+
const parabolic_func = (a, b, c, x) => a * x ** 2 + b * x + c;
|
|
58
|
+
const map_parabolic_func =
|
|
59
|
+
(a, b, c) =>
|
|
60
|
+
(...X) =>
|
|
61
|
+
mapfun((n) => parabolic_func(a, b, c, n), ...X);
|
|
62
|
+
const a = -1.5,
|
|
63
|
+
b = 2,
|
|
64
|
+
c = 3;
|
|
65
|
+
const X = [0, 1, 2, 3];
|
|
66
|
+
console.log(parabolic_func(a, b, c)(X));
|
|
67
|
+
// [3,3,1,3]
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
</details>
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
<!-- - The Math Module supports a new Paradigm -->
|
|
75
|
+
- ✨ Hyperscript-Based Declarative UI (No Template Engines needed)
|
|
76
|
+
```js
|
|
77
|
+
import {p, text, Random} from 'ziko'
|
|
78
|
+
const Hello = name => p(
|
|
79
|
+
text("Hello ", name)
|
|
80
|
+
).onClick(e => e.target.style({color : Random.color()}))
|
|
81
|
+
```
|
|
82
|
+
- 🔄 Built in State Mangement :
|
|
83
|
+
```js
|
|
84
|
+
import { tags } from 'ziko/dom'
|
|
85
|
+
import {useState, useDerived} from 'ziko/hooks'
|
|
86
|
+
const [timer, setTimer] = useState(0);
|
|
87
|
+
const converToHMS = seconds => `${Math.floor(seconds / 3600)} : ${Math.floor((seconds % 3600) / 60)} : ${seconds % 60} `
|
|
88
|
+
const [time] = useDerived(t => converToHMS(t) , [timer] )
|
|
89
|
+
tags.p('Elapsed Time : ', time)
|
|
90
|
+
let i = 1;
|
|
91
|
+
setInterval(()=>{
|
|
92
|
+
setTimer(i);
|
|
93
|
+
i++
|
|
94
|
+
}, 1000)
|
|
95
|
+
```
|
|
96
|
+
- 📱 Single Page Application With File Based Routing
|
|
97
|
+
```js
|
|
98
|
+
import { FileBasedRouting } from "ziko";
|
|
99
|
+
FileBasedRouting(import.meta.glob("./pages/**/*.js"))
|
|
100
|
+
```
|
|
101
|
+
- 🤝 One Way Interleaving With [Vanjs]()
|
|
102
|
+
- ⏰ Time loop and animations support
|
|
103
|
+
|
|
104
|
+
### 🚀 External :
|
|
105
|
+
- 🧩 Extra UI Components : [Zextra](https://github.com/zakarialaoui10/zextra)
|
|
106
|
+
- 🖥️ Server Side Rendering With File Based Routing and Client Side Hydration : [ziko-server](https://github.com/zakarialaoui10/ziko-server)
|
|
107
|
+
- 📝 Mdx-Like Markdown Preprocessor : [Mdz](https://github.com/zakarialaoui10/mdz)
|
|
108
|
+
- 🔌 Flexible Integration with Popular Frameworks/Libraries : [Ziko-wrapper](https://github.com/zakarialaoui10/ziko-wrapper)
|
|
109
|
+
- 🔄 Bi-directional : `React`, `Preact`, `Solid`, `Svelte`, `Vue` , `Vanjs`
|
|
110
|
+
- ➡️ Uni-directional (ZikoJS → X) :
|
|
111
|
+
- `Astro` : (SSR + Client Hydration)
|
|
112
|
+
- 📦 Growing Add-On Ecosystem :
|
|
113
|
+
- Ziko-Tgl : WebGL/3D Graphics, Built on Top of [Threejs](https://github.com/zakarialaoui10/ziko-gl)
|
|
114
|
+
- Ziko-Chart
|
|
115
|
+
- Ziko-Code
|
|
116
|
+
- Ziko-Lottie
|
|
117
|
+
- ...
|
|
118
|
+
|
|
119
|
+
## Install :
|
|
120
|
+
```bash
|
|
121
|
+
npm i ziko
|
|
122
|
+
```
|
|
123
|
+
## Quick Start :
|
|
124
|
+
```bash
|
|
125
|
+
npx create-ziko-app [app-title]
|
|
126
|
+
```
|
|
127
|
+
## ⭐️ Show your support <a name="support"></a>
|
|
128
|
+
|
|
129
|
+
If you appreciate the library, kindly demonstrate your support by giving it a star!<br>
|
|
130
|
+
[](https://github.com/zakarialaoui10/ziko.js)
|
|
131
|
+
<!--## Financial support-->
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
To do
|
|
135
|
+
add component middlware/wrapper
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ziko",
|
|
3
|
-
"version": "2.0.0-beta.17.
|
|
3
|
+
"version": "2.0.0-beta.17.2",
|
|
4
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
5
|
"keywords": [
|
|
6
6
|
"front-end",
|
|
@@ -40,6 +40,14 @@
|
|
|
40
40
|
"README.md"
|
|
41
41
|
],
|
|
42
42
|
"sideEffects": true,
|
|
43
|
+
"scripts": {
|
|
44
|
+
"test": "npx vitest",
|
|
45
|
+
"test-link": "node _link/index.js",
|
|
46
|
+
"lint": "eslint src/*/*/*",
|
|
47
|
+
"dev": "cross-env NODE_ENV=development rollup --config rollup.config.js",
|
|
48
|
+
"watch": "cross-env NODE_ENV=development rollup --config rollup.config.js -w",
|
|
49
|
+
"build": "cross-env NODE_ENV=production rollup --config rollup.config.js"
|
|
50
|
+
},
|
|
43
51
|
"repository": {
|
|
44
52
|
"type": "git",
|
|
45
53
|
"url": "git+https://github.com/zikojs/ziko.git",
|
|
@@ -52,17 +60,9 @@
|
|
|
52
60
|
},
|
|
53
61
|
"homepage": "https://github.com/zikojs/ziko#readme",
|
|
54
62
|
"devDependencies": {
|
|
55
|
-
"@rollup/plugin-commonjs": "
|
|
56
|
-
"@rollup/plugin-node-resolve": "
|
|
57
|
-
"@rollup/plugin-terser": "
|
|
58
|
-
"rollup": "
|
|
59
|
-
},
|
|
60
|
-
"scripts": {
|
|
61
|
-
"test": "npx vitest",
|
|
62
|
-
"test-link": "node _link/index.js",
|
|
63
|
-
"lint": "eslint src/*/*/*",
|
|
64
|
-
"dev": "cross-env NODE_ENV=development rollup --config rollup.config.js",
|
|
65
|
-
"watch": "cross-env NODE_ENV=development rollup --config rollup.config.js -w",
|
|
66
|
-
"build": "cross-env NODE_ENV=production rollup --config rollup.config.js"
|
|
63
|
+
"@rollup/plugin-commonjs": "catalog:",
|
|
64
|
+
"@rollup/plugin-node-resolve": "catalog:",
|
|
65
|
+
"@rollup/plugin-terser": "catalog:",
|
|
66
|
+
"rollup": "catalog:"
|
|
67
67
|
}
|
|
68
68
|
}
|
package/src/Layout/index.d.ts
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import type { UIElement } from "../dom/UIElement";
|
|
2
|
-
export interface UILayoutOptions {
|
|
3
|
-
title?: string;
|
|
4
|
-
icon?: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
lang?: string;
|
|
7
|
-
links?: Record<string, any>[];
|
|
8
|
-
script?: Record<string, any>[];
|
|
9
|
-
meta?: Record<string, any>[];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class UILayout {
|
|
13
|
-
options: UILayoutOptions;
|
|
14
|
-
ui: UIElement[];
|
|
15
|
-
|
|
16
|
-
constructor(
|
|
17
|
-
options?: UILayoutOptions,
|
|
18
|
-
...ui: UIElement[]
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
render(): void | {
|
|
22
|
-
title?: string;
|
|
23
|
-
icon?: string;
|
|
24
|
-
description?: string;
|
|
25
|
-
lang?: string;
|
|
26
|
-
links: Record<string, any>[];
|
|
27
|
-
meta: Record<string, any>[];
|
|
28
|
-
script: Record<string, any>[];
|
|
29
|
-
body: UIElement[];
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
mount(target: Element): this;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function Layout(
|
|
36
|
-
options?: UILayoutOptions,
|
|
37
|
-
...ui: UIElement[]
|
|
1
|
+
import type { UIElement } from "../dom/UIElement";
|
|
2
|
+
export interface UILayoutOptions {
|
|
3
|
+
title?: string;
|
|
4
|
+
icon?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
lang?: string;
|
|
7
|
+
links?: Record<string, any>[];
|
|
8
|
+
script?: Record<string, any>[];
|
|
9
|
+
meta?: Record<string, any>[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class UILayout {
|
|
13
|
+
options: UILayoutOptions;
|
|
14
|
+
ui: UIElement[];
|
|
15
|
+
|
|
16
|
+
constructor(
|
|
17
|
+
options?: UILayoutOptions,
|
|
18
|
+
...ui: UIElement[]
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
render(): void | {
|
|
22
|
+
title?: string;
|
|
23
|
+
icon?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
lang?: string;
|
|
26
|
+
links: Record<string, any>[];
|
|
27
|
+
meta: Record<string, any>[];
|
|
28
|
+
script: Record<string, any>[];
|
|
29
|
+
body: UIElement[];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
mount(target: Element): this;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function Layout(
|
|
36
|
+
options?: UILayoutOptions,
|
|
37
|
+
...ui: UIElement[]
|
|
38
38
|
): UILayout;
|
package/src/Layout/index.js
CHANGED
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
import { tags } from '../dom/tags/index.js'
|
|
2
|
-
import { call_with_optional_props } from '../dom/internal-utils/call_with_optional_props.js'
|
|
3
|
-
|
|
4
|
-
const { meta, link, script } = tags;
|
|
5
|
-
|
|
6
|
-
export class UILayout {
|
|
7
|
-
|
|
8
|
-
constructor(
|
|
9
|
-
{
|
|
10
|
-
title,
|
|
11
|
-
icon,
|
|
12
|
-
description,
|
|
13
|
-
lang,
|
|
14
|
-
links = [],
|
|
15
|
-
script: scripts = [],
|
|
16
|
-
meta: metas = [],
|
|
17
|
-
} = {},
|
|
18
|
-
...ui
|
|
19
|
-
) {
|
|
20
|
-
this.options = {
|
|
21
|
-
title,
|
|
22
|
-
icon,
|
|
23
|
-
description,
|
|
24
|
-
lang,
|
|
25
|
-
links,
|
|
26
|
-
meta: metas,
|
|
27
|
-
script: scripts,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
this.ui = ui;
|
|
31
|
-
this.render()
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
render() {
|
|
35
|
-
if (typeof document === "undefined") {
|
|
36
|
-
return {
|
|
37
|
-
...this.options,
|
|
38
|
-
body: this.ui,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const {
|
|
43
|
-
title,
|
|
44
|
-
icon,
|
|
45
|
-
description,
|
|
46
|
-
lang,
|
|
47
|
-
links,
|
|
48
|
-
meta: metas,
|
|
49
|
-
script: scripts,
|
|
50
|
-
} = this.options;
|
|
51
|
-
|
|
52
|
-
if (title) {
|
|
53
|
-
document.title = title;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (lang) {
|
|
57
|
-
document.documentElement.lang = lang;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (icon) {
|
|
61
|
-
document.head.appendChild(
|
|
62
|
-
link({
|
|
63
|
-
rel: "icon",
|
|
64
|
-
href: icon,
|
|
65
|
-
})
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (description) {
|
|
70
|
-
document.head.appendChild(
|
|
71
|
-
meta({
|
|
72
|
-
name: "description",
|
|
73
|
-
content: description,
|
|
74
|
-
})
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
for (const attrs of links) {
|
|
79
|
-
document.head.appendChild(link(attrs));
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
for (const attrs of metas) {
|
|
83
|
-
document.head.appendChild(meta(attrs));
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
for (const attrs of scripts) {
|
|
87
|
-
document.head.appendChild(script(attrs));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
mount(target){
|
|
92
|
-
this.ui.forEach(el => el.mount(target));
|
|
93
|
-
return this
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
1
|
+
import { tags } from '../dom/tags/index.js'
|
|
2
|
+
import { call_with_optional_props } from '../dom/internal-utils/call_with_optional_props.js'
|
|
3
|
+
|
|
4
|
+
const { meta, link, script } = tags;
|
|
5
|
+
|
|
6
|
+
export class UILayout {
|
|
7
|
+
|
|
8
|
+
constructor(
|
|
9
|
+
{
|
|
10
|
+
title,
|
|
11
|
+
icon,
|
|
12
|
+
description,
|
|
13
|
+
lang,
|
|
14
|
+
links = [],
|
|
15
|
+
script: scripts = [],
|
|
16
|
+
meta: metas = [],
|
|
17
|
+
} = {},
|
|
18
|
+
...ui
|
|
19
|
+
) {
|
|
20
|
+
this.options = {
|
|
21
|
+
title,
|
|
22
|
+
icon,
|
|
23
|
+
description,
|
|
24
|
+
lang,
|
|
25
|
+
links,
|
|
26
|
+
meta: metas,
|
|
27
|
+
script: scripts,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
this.ui = ui;
|
|
31
|
+
this.render()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
render() {
|
|
35
|
+
if (typeof document === "undefined") {
|
|
36
|
+
return {
|
|
37
|
+
...this.options,
|
|
38
|
+
body: this.ui,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const {
|
|
43
|
+
title,
|
|
44
|
+
icon,
|
|
45
|
+
description,
|
|
46
|
+
lang,
|
|
47
|
+
links,
|
|
48
|
+
meta: metas,
|
|
49
|
+
script: scripts,
|
|
50
|
+
} = this.options;
|
|
51
|
+
|
|
52
|
+
if (title) {
|
|
53
|
+
document.title = title;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (lang) {
|
|
57
|
+
document.documentElement.lang = lang;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (icon) {
|
|
61
|
+
document.head.appendChild(
|
|
62
|
+
link({
|
|
63
|
+
rel: "icon",
|
|
64
|
+
href: icon,
|
|
65
|
+
})
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (description) {
|
|
70
|
+
document.head.appendChild(
|
|
71
|
+
meta({
|
|
72
|
+
name: "description",
|
|
73
|
+
content: description,
|
|
74
|
+
})
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
for (const attrs of links) {
|
|
79
|
+
document.head.appendChild(link(attrs));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
for (const attrs of metas) {
|
|
83
|
+
document.head.appendChild(meta(attrs));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
for (const attrs of scripts) {
|
|
87
|
+
document.head.appendChild(script(attrs));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
mount(target){
|
|
92
|
+
this.ui.forEach(el => el.mount(target));
|
|
93
|
+
return this
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
98
|
export const Layout = call_with_optional_props(UILayout)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export const __CACHE__ = {
|
|
2
|
-
ui_index : 0,
|
|
3
|
-
get_ui_index:function(){
|
|
4
|
-
return this.ui_index ++
|
|
5
|
-
},
|
|
6
|
-
register_ui: function(UIElement){
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
export const __CACHE__ = {
|
|
2
|
+
ui_index : 0,
|
|
3
|
+
get_ui_index:function(){
|
|
4
|
+
return this.ui_index ++
|
|
5
|
+
},
|
|
6
|
+
register_ui: function(UIElement){
|
|
7
|
+
|
|
8
|
+
}
|
|
9
9
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export const __Config__ = {
|
|
2
|
-
default:{
|
|
3
|
-
target:null,
|
|
4
|
-
autoMount:false,
|
|
5
|
-
},
|
|
6
|
-
setDefault:function(pairs){
|
|
7
|
-
const keys = Object.keys(pairs);
|
|
8
|
-
const values = Object.values(pairs);
|
|
9
|
-
for(let i=0; i<keys.length; i++) this.default[keys[i]]=values[i];
|
|
10
|
-
},
|
|
11
|
-
init:()=>{
|
|
12
|
-
// document.documentElement.setAttribute("data-engine","zikojs")
|
|
13
|
-
},
|
|
14
|
-
renderingMode :'spa',
|
|
15
|
-
isSSC : false,
|
|
1
|
+
export const __Config__ = {
|
|
2
|
+
default:{
|
|
3
|
+
target:null,
|
|
4
|
+
autoMount:false,
|
|
5
|
+
},
|
|
6
|
+
setDefault:function(pairs){
|
|
7
|
+
const keys = Object.keys(pairs);
|
|
8
|
+
const values = Object.values(pairs);
|
|
9
|
+
for(let i=0; i<keys.length; i++) this.default[keys[i]]=values[i];
|
|
10
|
+
},
|
|
11
|
+
init:()=>{
|
|
12
|
+
// document.documentElement.setAttribute("data-engine","zikojs")
|
|
13
|
+
},
|
|
14
|
+
renderingMode :'spa',
|
|
15
|
+
isSSC : false,
|
|
16
16
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export const __HYDRATION__ = {
|
|
2
|
-
store : new Map(),
|
|
3
|
-
index : 0,
|
|
4
|
-
register: function(component){
|
|
5
|
-
this.store.set(this.index++ , component)
|
|
6
|
-
},
|
|
7
|
-
reset(){
|
|
8
|
-
this.index = 0;
|
|
9
|
-
this.store.clear()
|
|
10
|
-
}
|
|
11
|
-
|
|
1
|
+
export const __HYDRATION__ = {
|
|
2
|
+
store : new Map(),
|
|
3
|
+
index : 0,
|
|
4
|
+
register: function(component){
|
|
5
|
+
this.store.set(this.index++ , component)
|
|
6
|
+
},
|
|
7
|
+
reset(){
|
|
8
|
+
this.index = 0;
|
|
9
|
+
this.store.clear()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
12
|
}
|