ziko 0.0.6 β 0.0.7
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 +171 -182
- package/dist/ziko.cjs +35 -12
- package/dist/ziko.js +35 -12
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +35 -13
- package/package.json +1 -1
- package/starter/bin/index.js +2 -1
package/README.md
CHANGED
|
@@ -4,6 +4,81 @@
|
|
|
4
4
|
|
|
5
5
|
<br>
|
|
6
6
|
|
|
7
|
+
# Architecture
|
|
8
|
+
|
|
9
|
+
```mermaid
|
|
10
|
+
mindmap
|
|
11
|
+
root((Ziko))
|
|
12
|
+
Core
|
|
13
|
+
Math
|
|
14
|
+
Utils
|
|
15
|
+
Functions
|
|
16
|
+
Complex
|
|
17
|
+
Matrix
|
|
18
|
+
Random
|
|
19
|
+
Calculus
|
|
20
|
+
Signal
|
|
21
|
+
Discret
|
|
22
|
+
Statistics
|
|
23
|
+
UI
|
|
24
|
+
Elements
|
|
25
|
+
Text
|
|
26
|
+
text
|
|
27
|
+
p
|
|
28
|
+
h1...h6
|
|
29
|
+
List
|
|
30
|
+
ol
|
|
31
|
+
ul
|
|
32
|
+
Table
|
|
33
|
+
Inputs
|
|
34
|
+
Semantic
|
|
35
|
+
Main
|
|
36
|
+
Header
|
|
37
|
+
Footer
|
|
38
|
+
Section
|
|
39
|
+
Article
|
|
40
|
+
Nav
|
|
41
|
+
Aside
|
|
42
|
+
Custom Elements
|
|
43
|
+
Flex
|
|
44
|
+
Grid
|
|
45
|
+
Accordion
|
|
46
|
+
Carousel
|
|
47
|
+
Tabs
|
|
48
|
+
CodeCell
|
|
49
|
+
CodeNote
|
|
50
|
+
Time
|
|
51
|
+
Animation
|
|
52
|
+
Ease functions
|
|
53
|
+
Loop
|
|
54
|
+
Data
|
|
55
|
+
Api
|
|
56
|
+
Converter
|
|
57
|
+
Decorator
|
|
58
|
+
Parser
|
|
59
|
+
Reactivity
|
|
60
|
+
Events
|
|
61
|
+
Observer
|
|
62
|
+
Use
|
|
63
|
+
Graphics
|
|
64
|
+
Svg
|
|
65
|
+
Canvas
|
|
66
|
+
App
|
|
67
|
+
Router
|
|
68
|
+
Seo
|
|
69
|
+
Config
|
|
70
|
+
Themes
|
|
71
|
+
Addons
|
|
72
|
+
Zikogl
|
|
73
|
+
Ziko-lottie
|
|
74
|
+
Wrapper
|
|
75
|
+
React
|
|
76
|
+
Svelte
|
|
77
|
+
Vue
|
|
78
|
+
Lit
|
|
79
|
+
Solid
|
|
80
|
+
Preact
|
|
81
|
+
```
|
|
7
82
|
# Install
|
|
8
83
|
```bash
|
|
9
84
|
npm install ziko
|
|
@@ -55,205 +130,134 @@ npm install ziko
|
|
|
55
130
|
|
|
56
131
|
## π [wiki](https://github.com/zakarialaoui10/ziko.js/wiki)
|
|
57
132
|
|
|
58
|
-
## π‘ [Features]()
|
|
59
|
-
|
|
60
|
-
<summary>
|
|
61
|
-
<strong> π° Methodes Extracting </strong>
|
|
62
|
-
</summary>
|
|
63
|
-
|
|
64
|
-
```js
|
|
65
|
-
Ziko.ExtractAll()
|
|
66
|
-
// if you want to extract only UI methodes you can use Ziko.UI.Extractll()
|
|
67
|
-
```
|
|
68
|
-
π·οΈ This method simplifies syntax by extracting all UI, Math, Time, Graphics, and other methods within the Ziko framework. Instead of writing specific namespace prefixes like `Ziko.UI.text("Hi")` , `Ziko.Math.complex(1,2)` , `Ziko.Math.matrix([[1,2],[2,3]])`, you can directly use simplified syntax such as `text("Hi")` , `complex(1,1)` and `matrix([[1,2],[2,3]])`.
|
|
133
|
+
## π‘ [Features]()
|
|
134
|
+
### π° No Template Engines :
|
|
69
135
|
|
|
70
|
-
|
|
71
|
-
|
|
136
|
+
zikojs UI module adopts a distinctive approach to building and updating user interfaces.
|
|
137
|
+
It doesn't rely on predefined markup templates. Instead, it leverages a hyperscript-like syntax to dynamically create and update user interfaces.
|
|
72
138
|
|
|
73
139
|
<details>
|
|
74
|
-
|
|
75
|
-
<strong> π° Mathematical Utilities & Tips </strong>
|
|
76
|
-
</summary>
|
|
140
|
+
<summary> See More </summary>
|
|
77
141
|
|
|
78
|
-
|
|
79
|
-
|
|
142
|
+
For instance, consider the following JavaScript code using zikojs:
|
|
143
|
+
```js
|
|
144
|
+
para=p(
|
|
145
|
+
text("hello"),
|
|
146
|
+
text("world")
|
|
147
|
+
)
|
|
148
|
+
.style({
|
|
149
|
+
color:"darkblue"
|
|
150
|
+
})
|
|
151
|
+
.forEach(n=>n.onPtrEnter(e=>{
|
|
152
|
+
console.log(e.target.text)
|
|
153
|
+
}));
|
|
154
|
+
```
|
|
155
|
+
`p(...)` - This line creates a paragraph element (<p>) using zikojs. Inside the p() function, we pass in two text() function calls, which create text nodes containing "hello" and "world" respectively. These will be the contents of the paragraph.
|
|
80
156
|
|
|
81
|
-
|
|
157
|
+
`.style({...})` - This method sets the style of the paragraph element. In this case, it sets the color to "darkblue".
|
|
82
158
|
|
|
83
|
-
|
|
159
|
+
`.forEach(...)` - This method iterates over the two items of the paragraph element. Inside the callback function, it sets up an event listener for the "pointerenter" event on each child element. When the pointer enters any child element, it logs the text content of that element to the console.
|
|
84
160
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|-|-|
|
|
88
|
-
|`sqrt(9)`|`sqrt(9)`|
|
|
89
|
-
|`sqrt(4,9,16)`|`[Math.sqrt(4),Math.sqrt(9),Math.sqrt(16)]`|
|
|
90
|
-
|`sqrt([4,9,16])`|`[Math.sqrt(4),Math.sqrt(9),Math.sqrt(16)]`|
|
|
91
|
-
|`sqrt([4,9],16)`|`[[Math.sqrt(4),Math.sqrt(9)],Math.sqrt(16)]`|
|
|
92
|
-
|`sqrt({x:4,y:9})`|`{x:sqrt(4),sqrt(9)}`|
|
|
161
|
+
>[!TIP]
|
|
162
|
+
To acces the para items you can use Array like syntaxe , `para[index]` or `para.at(index)` (index can positive or negative integer)
|
|
93
163
|
|
|
164
|
+
This code snippet produces the equivalent HTML structure:
|
|
165
|
+
```html
|
|
166
|
+
<p style="color:darkblue">
|
|
167
|
+
<span>hello</span>
|
|
168
|
+
<span>world</span>
|
|
169
|
+
</p>
|
|
170
|
+
<script>
|
|
171
|
+
para=document.querySelector(p);
|
|
172
|
+
[...a.children].forEach(
|
|
173
|
+
n=>n.addEventListener("pointerenter",e=>{
|
|
174
|
+
console.log(e.target.textContent)
|
|
175
|
+
}))
|
|
176
|
+
</script>
|
|
177
|
+
```
|
|
178
|
+
In summary, zikojs UI module enables dynamic creation and manipulation of user interfaces without relying on static markup templates, offering flexibility and control over UI elements.
|
|
94
179
|
|
|
95
|
-
|
|
180
|
+
</details>
|
|
96
181
|
|
|
97
|
-
π For Example :
|
|
98
|
-
```js
|
|
99
|
-
sqrt({
|
|
100
|
-
a:1,
|
|
101
|
-
b:2,
|
|
102
|
-
c:[3,4],
|
|
103
|
-
d:[[
|
|
104
|
-
[5,6]
|
|
105
|
-
]],
|
|
106
|
-
e:{
|
|
107
|
-
f:[
|
|
108
|
-
{g:7}
|
|
109
|
-
]
|
|
110
|
-
},
|
|
111
|
-
h:new Map([["i",8],["j",9]]),
|
|
112
|
-
k:{
|
|
113
|
-
l:{
|
|
114
|
-
m:new Set([10,11])
|
|
115
|
-
},
|
|
116
|
-
n:[12]
|
|
117
|
-
}
|
|
118
|
-
})
|
|
119
|
-
```
|
|
120
|
-
This would return :
|
|
121
|
-
```js
|
|
122
|
-
{
|
|
123
|
-
a:sqrt(1),
|
|
124
|
-
b:sqrt(2),
|
|
125
|
-
c:[sqrt(3),sqrt(4)],
|
|
126
|
-
d:[[
|
|
127
|
-
[sqrt(5),sqrt(6)]
|
|
128
|
-
]],
|
|
129
|
-
e:{
|
|
130
|
-
f:[
|
|
131
|
-
{g:sqrt(7)}
|
|
132
|
-
]
|
|
133
|
-
},
|
|
134
|
-
h:new Map([["i",sqrt(8)],["j",sqrt(9)]]),
|
|
135
|
-
k:{
|
|
136
|
-
l:{
|
|
137
|
-
m:new Set([sqrt(10),sqrt(11)])
|
|
138
|
-
},
|
|
139
|
-
n:[sqrt(12)]
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
```
|
|
143
182
|
|
|
144
|
-
π‘ You can apply this approach to build your custom function ;
|
|
145
|
-
```js
|
|
146
|
-
import {mapfun} from "ziko";
|
|
147
|
-
const parabolic_func=(a,b,c,x)=>a*(x**2)+b*x+c;
|
|
148
|
-
const parabol=(a,b,c,...X)=>mapfun(n=>parabolic_func(a,b,c,n),...X)
|
|
149
|
-
const a=-1.5,b=2,c=3;
|
|
150
|
-
X0=[0,1,2,3];
|
|
151
|
-
X1={x10:0,x11:1,x12:2,x13:3}
|
|
152
|
-
console.log(parabol(a,b,c,X0));
|
|
153
|
-
// [3,3,1,3]
|
|
154
|
-
console.log(parabol(a,b,c,X1));
|
|
155
|
-
// {x10: 3,x11: 3,x12: 1,x13: -3}
|
|
156
|
-
console.log(parabol(a,b,c,X0,X1))
|
|
157
|
-
/*
|
|
158
|
-
[
|
|
159
|
-
[3,3,1,3],
|
|
160
|
-
{x10: 3,x11: 3,x12: 1,x13: -3}
|
|
161
|
-
]
|
|
162
|
-
*/
|
|
163
|
-
```
|
|
164
|
-
Or you can use the currying syntaxe :
|
|
165
|
-
```js
|
|
166
|
-
import {mapfun} from "ziko";
|
|
167
|
-
const parabolic_func=(a,b,c,x)=>a*(x**2)+b*x+c;
|
|
168
|
-
const map_parabolic_func=(a,b,c)=>(...X)=>mapfun(n=>parabolic_func(a,b,c,n),...X);
|
|
169
|
-
const a=-1.5,b=2,c=3;
|
|
170
|
-
const X=[0,1,2,3];
|
|
171
|
-
console.log(parabolic_func(a,b,c)(X));
|
|
172
|
-
// [3,3,1,3]
|
|
173
|
-
```
|
|
174
183
|
|
|
175
|
-
|
|
184
|
+
### π° Flexible Integration with Popular Frameworks/Libraries
|
|
176
185
|
|
|
177
|
-
|
|
186
|
+
You can integrate it inside other frameworks/libraries like React , Vue , Svelte ... To do so, all you need to do is install the [ziko-wrapper](https://www.npmjs.com/package/ziko-wrapper) package.
|
|
178
187
|
|
|
179
|
-
|
|
188
|
+
### π° Extensive Add-On Ecosystem
|
|
189
|
+
|
|
190
|
+
|Addon|Purpose|Dependecy|Links|
|
|
191
|
+
|-|-|-|-|
|
|
192
|
+
|zikogl|-|Threejs|[NPM](https://www.npmjs.com/package/zikogl) [GITHUB](https://github.com/zakarialaoui10/zikogl/)|
|
|
193
|
+
|ziko-lottie|render Lottie file within zikojs app|Lottie-web|[NPM](https://www.npmjs.com/package/ziko-lottie) [GITHUB](https://github.com/zakarialaoui10/ziko-lottie/)|
|
|
194
|
+
### π° The capability to function in both browser-based and Node.js environments
|
|
195
|
+
### π° Methodes Extracting
|
|
180
196
|
|
|
181
|
-
### Matrix
|
|
182
|
-
### Complex
|
|
183
|
-
</details>
|
|
184
|
-
<details>
|
|
185
|
-
<summary>
|
|
186
|
-
<strong> π° Rich UI elements </strong>
|
|
187
|
-
</summary>
|
|
188
|
-
</details>
|
|
189
197
|
<details>
|
|
190
198
|
<summary>
|
|
191
|
-
|
|
199
|
+
See More
|
|
192
200
|
</summary>
|
|
193
201
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
.onPtrMove(useThrottle(() => console.log("hi")));
|
|
202
|
+
```js
|
|
203
|
+
Ziko.ExtractAll()
|
|
204
|
+
// if you want to extract only UI methodes you can use Ziko.UI.Extractll()
|
|
198
205
|
```
|
|
199
|
-
|
|
206
|
+
π·οΈ This method simplifies syntax by extracting all UI, Math, Time, Graphics, and other methods within the Ziko framework. Instead of writing specific namespace prefixes like `Ziko.UI.text("Hi")` , `Ziko.Math.complex(1,2)` , `Ziko.Math.matrix([[1,2],[2,3]])`, you can directly use simplified syntax such as `text("Hi")` , `complex(1,1)` and `matrix([[1,2],[2,3]])`.
|
|
200
207
|
|
|
208
|
+
β οΈ Be careful with this method because it will overwrite any existing global or local variables and functions with the same names as the extracted methods.
|
|
209
|
+
</details>
|
|
210
|
+
|
|
211
|
+
### π° Mathematical Utilities & Tips
|
|
212
|
+
### π° Rich UI elements
|
|
213
|
+
### π° Methodes Chaining
|
|
214
|
+
It allows multiple methods to be called sequentially on an object, enhancing code readability and conciseness.
|
|
201
215
|
<details>
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
216
|
+
<summary> See More </summary>
|
|
217
|
+
</details>
|
|
218
|
+
|
|
219
|
+
### π° Events Handling
|
|
205
220
|
|
|
206
|
-
|
|
221
|
+
<details>
|
|
222
|
+
<summary>
|
|
223
|
+
See More
|
|
224
|
+
</summary>
|
|
225
|
+
|
|
226
|
+
Example of creating simple Paint sketch using canvas and pointer events :
|
|
207
227
|
```js
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
map(e.dx,0,
|
|
213
|
-
map(e.dy,0,
|
|
228
|
+
Scene=Canvas().size("500px","500px")
|
|
229
|
+
Scene.onPtrDown(e=>{
|
|
230
|
+
e.target.ctx.beginPath()
|
|
231
|
+
e.target.ctx.moveTo(
|
|
232
|
+
map(e.dx,0,e.target.element.offsetWidth,e.target.Xmin,e.target.Xmax),
|
|
233
|
+
map(e.dy,0,e.target.element.offseHeight,e.target.Ymin,e.target.Ymax)
|
|
214
234
|
)
|
|
215
235
|
})
|
|
216
|
-
|
|
236
|
+
Scene.onPtrMove(e=>{
|
|
217
237
|
if(e.isDown){
|
|
218
|
-
const x=map(e.mx,0,
|
|
219
|
-
const y=map(e.my,0,
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
238
|
+
const x=map(e.mx,0,e.target.element.offsetWidth,e.target.axisMatrix[0][0],e.target.axisMatrix[1][0])
|
|
239
|
+
const y=map(e.my,0,e.target.element.offsetHeight,e.target.axisMatrix[1][1],e.target.axisMatrix[0][1])
|
|
240
|
+
e.target.append(canvasCircle(x,y,1).color({fill:"#5555AA"}).fill())
|
|
241
|
+
}})
|
|
242
|
+
|
|
243
|
+
Scene.onPtrUp(()=>{})
|
|
223
244
|
```
|
|
224
245
|
</details>
|
|
225
246
|
|
|
226
|
-
|
|
227
|
-
<summary>
|
|
228
|
-
<strong> π° Functions decorators </strong>
|
|
229
|
-
</summary>
|
|
247
|
+
### π° Functions decorators
|
|
230
248
|
|
|
231
|
-
|
|
249
|
+
```js
|
|
232
250
|
const inp=input().onKeyDown(throttle(e=>console.log(e.kd),1000));
|
|
233
|
-
|
|
234
|
-
</details>
|
|
235
|
-
|
|
236
|
-
<details>
|
|
237
|
-
<summary>
|
|
238
|
-
<strong> π° Reactivity </strong>
|
|
239
|
-
</summary>
|
|
240
|
-
|
|
241
|
-
### Events
|
|
242
|
-
### Observers
|
|
243
|
-
### Use
|
|
251
|
+
```
|
|
244
252
|
|
|
245
|
-
|
|
253
|
+
### π° Reactivity
|
|
254
|
+
### π° Routing for Single Page Applications (SPA)
|
|
246
255
|
|
|
247
|
-
|
|
248
|
-
<summary>
|
|
249
|
-
<strong> π° Rich UI Elements Based on Math modules </strong>
|
|
250
|
-
</summary>
|
|
251
|
-
for example in `Table` you can use methodes like `hsatck` `vstack` `transpose` ...
|
|
252
|
-
</details>
|
|
256
|
+
Zikojs has a built-in Single page application router based on history browser api
|
|
253
257
|
|
|
254
258
|
<details>
|
|
255
259
|
<summary>
|
|
256
|
-
<strong>
|
|
260
|
+
<strong> See More </strong>
|
|
257
261
|
</summary>
|
|
258
262
|
|
|
259
263
|
```js
|
|
@@ -283,10 +287,8 @@ S.get(
|
|
|
283
287
|
```
|
|
284
288
|
</details>
|
|
285
289
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
<strong>π° Multithreading supports</strong>
|
|
289
|
-
</summary>
|
|
290
|
+
|
|
291
|
+
### π° Multithreading supports
|
|
290
292
|
|
|
291
293
|
```js
|
|
292
294
|
useThread(() => {
|
|
@@ -295,21 +297,9 @@ useThread(() => {
|
|
|
295
297
|
return s;
|
|
296
298
|
}, console.log);
|
|
297
299
|
```
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
<summary>
|
|
302
|
-
<strong> π° Responsive Design using Flex element and resize observer </strong>
|
|
303
|
-
</summary>
|
|
304
|
-
</details>
|
|
305
|
-
|
|
306
|
-
<details>
|
|
307
|
-
<summary>
|
|
308
|
-
<strong> π° Loop and animations support </strong>
|
|
309
|
-
</summary>
|
|
310
|
-
</details>
|
|
311
|
-
|
|
312
|
-
|
|
300
|
+
|
|
301
|
+
### π° Responsive Design based on Flex element and resize observer
|
|
302
|
+
### π° Loop and animations support
|
|
313
303
|
|
|
314
304
|
## βοΈ Show your support <a name="support"></a>
|
|
315
305
|
|
|
@@ -326,4 +316,3 @@ This projet is licensed under the terms of MIT License
|
|
|
326
316
|
|
|
327
317
|
|
|
328
318
|
|
|
329
|
-
|
package/dist/ziko.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date :
|
|
5
|
+
Date : Mon May 20 2024 19:37:06 GMT+0100 (UTC+01:00)
|
|
6
6
|
Git-Repo : https://github.com/zakarialaoui10/ziko.js
|
|
7
7
|
Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
|
|
8
8
|
Released under MIT License
|
|
@@ -14,10 +14,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
14
14
|
|
|
15
15
|
class ZikoMath {}
|
|
16
16
|
|
|
17
|
-
/** @module Math */
|
|
18
|
-
/**
|
|
19
|
-
* @class
|
|
20
|
-
*/
|
|
21
17
|
class Complex extends ZikoMath{
|
|
22
18
|
constructor(a = 0, b = 0) {
|
|
23
19
|
super();
|
|
@@ -181,13 +177,6 @@ class Complex extends ZikoMath{
|
|
|
181
177
|
return "<span>" + this.a + " + i * " + this.b + "</span>";
|
|
182
178
|
}
|
|
183
179
|
}
|
|
184
|
-
/**
|
|
185
|
-
* Performs complex number operations on numbers, arrays, ArrayBuffers, or Matrices.
|
|
186
|
-
* @param {number|number[]|ArrayBuffer|Matrix} a
|
|
187
|
-
* @param {number|number[]|ArrayBuffer|Matrix} b
|
|
188
|
-
* @param {number|number[]|ArrayBuffer|Matrix} b
|
|
189
|
-
* @returns {Complex|Complex[]}
|
|
190
|
-
*/
|
|
191
180
|
const complex=(a,b)=>{
|
|
192
181
|
if((a instanceof Array||ArrayBuffer.isView(a)) && (b instanceof Array||ArrayBuffer.isView(a)))return a.map((n,i)=>complex(a[i],b[i]));
|
|
193
182
|
if(a instanceof Matrix && b instanceof Matrix){
|
|
@@ -9938,6 +9927,39 @@ const __Config__={
|
|
|
9938
9927
|
init:()=>document.documentElement.setAttribute("data-engine","zikojs")
|
|
9939
9928
|
};
|
|
9940
9929
|
|
|
9930
|
+
class ZikoUIComponent extends HTMLElement{
|
|
9931
|
+
constructor(){
|
|
9932
|
+
super();
|
|
9933
|
+
this.shadowDOM = this.attachShadow({ mode: 'open' });
|
|
9934
|
+
this.wrapper=document.createElement("div");
|
|
9935
|
+
}
|
|
9936
|
+
connectedCallback() {
|
|
9937
|
+
this.setAttribute('role', 'region');
|
|
9938
|
+
this.setAttribute('data-engine',"zikojs");
|
|
9939
|
+
this.shadowDOM.append(this.wrapper);
|
|
9940
|
+
this.observeContentChanges();
|
|
9941
|
+
}
|
|
9942
|
+
observeContentChanges() {
|
|
9943
|
+
const observer = new MutationObserver((mutations) => {
|
|
9944
|
+
mutations.forEach((mutation) => {
|
|
9945
|
+
if (mutation.type === 'childList' || mutation.type === 'characterData') {
|
|
9946
|
+
this.wrapper.innerHTML="";
|
|
9947
|
+
__Ziko__.__Config__.setDefault({ target: this.wrapper });
|
|
9948
|
+
globalThis.eval(this.innerHTML);
|
|
9949
|
+
}
|
|
9950
|
+
});
|
|
9951
|
+
});
|
|
9952
|
+
observer.observe(this, { childList: true, subtree: true, characterData: true });
|
|
9953
|
+
}
|
|
9954
|
+
|
|
9955
|
+
disconnectedCallback() {
|
|
9956
|
+
console.log('ZikoUIComponent removed from page.');
|
|
9957
|
+
}
|
|
9958
|
+
}
|
|
9959
|
+
if(globalThis.document){
|
|
9960
|
+
globalThis.customElements.define('ziko-ui', ZikoUIComponent);
|
|
9961
|
+
}
|
|
9962
|
+
|
|
9941
9963
|
class ZikoSeo{
|
|
9942
9964
|
constructor(app){
|
|
9943
9965
|
this.app=app;
|
|
@@ -10121,6 +10143,7 @@ exports.ZikoUIAudio = ZikoUIAudio;
|
|
|
10121
10143
|
exports.ZikoUIBr = ZikoUIBr;
|
|
10122
10144
|
exports.ZikoUICanvas = ZikoUICanvas;
|
|
10123
10145
|
exports.ZikoUICodeNote = ZikoUICodeNote;
|
|
10146
|
+
exports.ZikoUIComponent = ZikoUIComponent;
|
|
10124
10147
|
exports.ZikoUIElement = ZikoUIElement;
|
|
10125
10148
|
exports.ZikoUIFigure = ZikoUIFigure;
|
|
10126
10149
|
exports.ZikoUIFooter = ZikoUIFooter;
|
package/dist/ziko.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date :
|
|
5
|
+
Date : Mon May 20 2024 19:37:06 GMT+0100 (UTC+01:00)
|
|
6
6
|
Git-Repo : https://github.com/zakarialaoui10/ziko.js
|
|
7
7
|
Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
|
|
8
8
|
Released under MIT License
|
|
@@ -16,10 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
class ZikoMath {}
|
|
18
18
|
|
|
19
|
-
/** @module Math */
|
|
20
|
-
/**
|
|
21
|
-
* @class
|
|
22
|
-
*/
|
|
23
19
|
class Complex extends ZikoMath{
|
|
24
20
|
constructor(a = 0, b = 0) {
|
|
25
21
|
super();
|
|
@@ -183,13 +179,6 @@
|
|
|
183
179
|
return "<span>" + this.a + " + i * " + this.b + "</span>";
|
|
184
180
|
}
|
|
185
181
|
}
|
|
186
|
-
/**
|
|
187
|
-
* Performs complex number operations on numbers, arrays, ArrayBuffers, or Matrices.
|
|
188
|
-
* @param {number|number[]|ArrayBuffer|Matrix} a
|
|
189
|
-
* @param {number|number[]|ArrayBuffer|Matrix} b
|
|
190
|
-
* @param {number|number[]|ArrayBuffer|Matrix} b
|
|
191
|
-
* @returns {Complex|Complex[]}
|
|
192
|
-
*/
|
|
193
182
|
const complex=(a,b)=>{
|
|
194
183
|
if((a instanceof Array||ArrayBuffer.isView(a)) && (b instanceof Array||ArrayBuffer.isView(a)))return a.map((n,i)=>complex(a[i],b[i]));
|
|
195
184
|
if(a instanceof Matrix && b instanceof Matrix){
|
|
@@ -9940,6 +9929,39 @@
|
|
|
9940
9929
|
init:()=>document.documentElement.setAttribute("data-engine","zikojs")
|
|
9941
9930
|
};
|
|
9942
9931
|
|
|
9932
|
+
class ZikoUIComponent extends HTMLElement{
|
|
9933
|
+
constructor(){
|
|
9934
|
+
super();
|
|
9935
|
+
this.shadowDOM = this.attachShadow({ mode: 'open' });
|
|
9936
|
+
this.wrapper=document.createElement("div");
|
|
9937
|
+
}
|
|
9938
|
+
connectedCallback() {
|
|
9939
|
+
this.setAttribute('role', 'region');
|
|
9940
|
+
this.setAttribute('data-engine',"zikojs");
|
|
9941
|
+
this.shadowDOM.append(this.wrapper);
|
|
9942
|
+
this.observeContentChanges();
|
|
9943
|
+
}
|
|
9944
|
+
observeContentChanges() {
|
|
9945
|
+
const observer = new MutationObserver((mutations) => {
|
|
9946
|
+
mutations.forEach((mutation) => {
|
|
9947
|
+
if (mutation.type === 'childList' || mutation.type === 'characterData') {
|
|
9948
|
+
this.wrapper.innerHTML="";
|
|
9949
|
+
__Ziko__.__Config__.setDefault({ target: this.wrapper });
|
|
9950
|
+
globalThis.eval(this.innerHTML);
|
|
9951
|
+
}
|
|
9952
|
+
});
|
|
9953
|
+
});
|
|
9954
|
+
observer.observe(this, { childList: true, subtree: true, characterData: true });
|
|
9955
|
+
}
|
|
9956
|
+
|
|
9957
|
+
disconnectedCallback() {
|
|
9958
|
+
console.log('ZikoUIComponent removed from page.');
|
|
9959
|
+
}
|
|
9960
|
+
}
|
|
9961
|
+
if(globalThis.document){
|
|
9962
|
+
globalThis.customElements.define('ziko-ui', ZikoUIComponent);
|
|
9963
|
+
}
|
|
9964
|
+
|
|
9943
9965
|
class ZikoSeo{
|
|
9944
9966
|
constructor(app){
|
|
9945
9967
|
this.app=app;
|
|
@@ -10123,6 +10145,7 @@
|
|
|
10123
10145
|
exports.ZikoUIBr = ZikoUIBr;
|
|
10124
10146
|
exports.ZikoUICanvas = ZikoUICanvas;
|
|
10125
10147
|
exports.ZikoUICodeNote = ZikoUICodeNote;
|
|
10148
|
+
exports.ZikoUIComponent = ZikoUIComponent;
|
|
10126
10149
|
exports.ZikoUIElement = ZikoUIElement;
|
|
10127
10150
|
exports.ZikoUIFigure = ZikoUIFigure;
|
|
10128
10151
|
exports.ZikoUIFooter = ZikoUIFooter;
|