ziko 0.40.0 → 0.41.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.js CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Tue Aug 19 2025 09:41:09 GMT+0100 (UTC+01:00)
5
+ Date : Tue Aug 19 2025 12:50:26 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
@@ -1293,7 +1293,7 @@
1293
1293
 
1294
1294
  };
1295
1295
 
1296
- function __addItem__(adder, pusher, ...ele) {
1296
+ async function __addItem__(adder, pusher, ...ele) {
1297
1297
  if (this.cache.isFrozzen) {
1298
1298
  console.warn("You can't append new item to frozzen element");
1299
1299
  return this;
@@ -1319,6 +1319,13 @@
1319
1319
  ele[i].target = this.element;
1320
1320
  this.items[pusher](ele[i]);
1321
1321
  }
1322
+ else if(ele[i] instanceof Promise){
1323
+ const UIEle = await ele[i];
1324
+ UIEle.cache.parent = this;
1325
+ this.element?.[adder](UIEle.element);
1326
+ UIEle.target = this.element;
1327
+ this.items[pusher](UIEle);
1328
+ }
1322
1329
  else if (ele[i] instanceof Object) {
1323
1330
  if (ele[i]?.style) this.style(ele[i]?.style);
1324
1331
  if (ele[i]?.attr) {
package/dist/ziko.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Tue Aug 19 2025 09:41:09 GMT+0100 (UTC+01:00)
5
+ Date : Tue Aug 19 2025 12:50:26 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
@@ -1287,7 +1287,7 @@ const DomMethods = {
1287
1287
 
1288
1288
  };
1289
1289
 
1290
- function __addItem__(adder, pusher, ...ele) {
1290
+ async function __addItem__(adder, pusher, ...ele) {
1291
1291
  if (this.cache.isFrozzen) {
1292
1292
  console.warn("You can't append new item to frozzen element");
1293
1293
  return this;
@@ -1313,6 +1313,13 @@ function __addItem__(adder, pusher, ...ele) {
1313
1313
  ele[i].target = this.element;
1314
1314
  this.items[pusher](ele[i]);
1315
1315
  }
1316
+ else if(ele[i] instanceof Promise){
1317
+ const UIEle = await ele[i];
1318
+ UIEle.cache.parent = this;
1319
+ this.element?.[adder](UIEle.element);
1320
+ UIEle.target = this.element;
1321
+ this.items[pusher](UIEle);
1322
+ }
1316
1323
  else if (ele[i] instanceof Object) {
1317
1324
  if (ele[i]?.style) this.style(ele[i]?.style);
1318
1325
  if (ele[i]?.attr) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ziko",
3
- "version": "0.40.0",
3
+ "version": "0.41.0",
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",
@@ -1,12 +1,3 @@
1
- import * as Events from "./events";
2
- import * as Observer from "./observer"
3
- import * as Hooks from "./hooks"
4
- const Reactivity={
5
- ...Events,
6
- ...Observer,
7
- ...Hooks,
8
- }
9
1
  export * from "./events";
10
2
  export * from "./observer";
11
3
  export * from "./hooks";
12
- export default Reactivity;
@@ -68,7 +68,7 @@ export const DomMethods = {
68
68
 
69
69
  };
70
70
 
71
- function __addItem__(adder, pusher, ...ele) {
71
+ async function __addItem__(adder, pusher, ...ele) {
72
72
  if (this.cache.isFrozzen) {
73
73
  console.warn("You can't append new item to frozzen element");
74
74
  return this;
@@ -94,6 +94,13 @@ function __addItem__(adder, pusher, ...ele) {
94
94
  ele[i].target = this.element;
95
95
  this.items[pusher](ele[i]);
96
96
  }
97
+ else if(ele[i] instanceof Promise){
98
+ const UIEle = await ele[i]
99
+ UIEle.cache.parent = this;
100
+ this.element?.[adder](UIEle.element);
101
+ UIEle.target = this.element;
102
+ this.items[pusher](UIEle)
103
+ }
97
104
  else if (ele[i] instanceof Object) {
98
105
  if (ele[i]?.style) this.style(ele[i]?.style);
99
106
  if (ele[i]?.attr) {
package/src/ui/index.js CHANGED
@@ -6,4 +6,5 @@ export * from './flex/index.js';
6
6
  export * from './grid/index.js';
7
7
  export * from './suspense/index.js';
8
8
  export * from './wrapper/index.js';
9
- export * from './graphics/index.js'
9
+ export * from './graphics/index.js'
10
+ export * from './web-component/index.js'
@@ -0,0 +1,33 @@
1
+ export function defineWC(name, UIElement, props = {}, { mode = 'open'} = {}){
2
+ globalThis.customElements?.define(
3
+ name,
4
+ class extends HTMLElement{
5
+ static observedAttributes = ['style',...Object.keys(props)];
6
+ constructor(){
7
+ super()
8
+ this.attachShadow({ mode });
9
+ this.props = {};
10
+ this.PropsMask = {
11
+ ...props,
12
+ ...{
13
+ style : { type : Object}
14
+ }
15
+ }
16
+ }
17
+ connectedCallback(){
18
+ this.render()
19
+ console.log(this.props)
20
+ }
21
+ render(){
22
+ this.shadowRoot.innerHTML = ''
23
+ this.UIElement = UIElement(this.props);
24
+ this.UIElement.setTarget(this.shadowRoot)
25
+ }
26
+ attributeChangedCallback(name, _, newValue) {
27
+ Object.assign(this.props, {[name] : this.PropsMask[name].type(newValue)});
28
+ // if(name === "style") this.
29
+ this.render()
30
+ }
31
+ }
32
+ )
33
+ }