@myxo-victor/chexjs 6.0.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/ChexJs/sw.js ADDED
@@ -0,0 +1,67 @@
1
+ /*
2
+ * Chex v6.0.0 Service Worker
3
+ * @author Myxo victor
4
+ * IMPORTANT: Place this file in the root directory of your website.
5
+ * Service workers cannot be loaded from CDNs due to browser security restrictions.
6
+ */
7
+
8
+ self.addEventListener('push', function(event) {
9
+ let data = {
10
+ title: 'Chex 6.0 Update',
11
+ content: 'You have a new notification from Chex 6.0.',
12
+ url: '/'
13
+ };
14
+
15
+ try {
16
+ if (event.data) {
17
+ data = event.data.json();
18
+ }
19
+ } catch (e) {
20
+ if (event.data) {
21
+ data.content = event.data.text();
22
+ }
23
+ }
24
+
25
+ const options = {
26
+ body: data.content,
27
+ icon: data.icon || '/icon/logo.png',
28
+ badge: data.badge || '/icon/logo.png',
29
+ vibrate: [100, 50, 100],
30
+ data: {
31
+ url: data.url || '/'
32
+ },
33
+ actions: [
34
+ { action: 'open', title: 'Open' },
35
+ { action: 'close', title: 'Dismiss' }
36
+ ]
37
+ };
38
+
39
+ event.waitUntil(self.registration.showNotification(data.title || 'Chex 6.0', options));
40
+ });
41
+
42
+ self.addEventListener('notificationclick', function(event) {
43
+ const clickedNotification = event.notification;
44
+ clickedNotification.close();
45
+
46
+ if (event.action === 'close') return;
47
+
48
+ const urlToOpen = new URL(clickedNotification.data.url, self.location.origin).href;
49
+
50
+ const promiseChain = clients.matchAll({
51
+ type: 'window',
52
+ includeUncontrolled: true
53
+ }).then((windowClients) => {
54
+ for (let i = 0; i < windowClients.length; i++) {
55
+ if (windowClients[i].url === urlToOpen) {
56
+ return windowClients[i].focus();
57
+ }
58
+ }
59
+ return clients.openWindow(urlToOpen);
60
+ });
61
+
62
+ event.waitUntil(promiseChain);
63
+ });
64
+
65
+ self.addEventListener('activate', function(event) {
66
+ event.waitUntil(clients.claim());
67
+ });
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@myxo-victor/chexjs",
3
+ "version": "6.0.0",
4
+ "description": "A zero-build UI framework with reactive signals, VDOM diffing, routing, state, and a built-in PHP backend bridge — just a script tag, no compiler.",
5
+ "main": "Chex.js",
6
+ "keywords": ["ui", "framework", "vdom", "signals", "Chex", "chexjs"],
7
+ "author": "Myxo Victor",
8
+ "license": "MIT",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ }
12
+ }