cradova 1.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.
Files changed (60) hide show
  1. package/LICENSE +201 -0
  2. package/cradova.png +0 -0
  3. package/docs/README.md +0 -0
  4. package/index.d.ts +52 -0
  5. package/index.js +342 -0
  6. package/index.ts +366 -0
  7. package/package.json +36 -0
  8. package/scripts/JsonDB.d.ts +298 -0
  9. package/scripts/JsonDB.js +698 -0
  10. package/scripts/JsonDB.ts +794 -0
  11. package/scripts/Metrics.d.ts +51 -0
  12. package/scripts/Metrics.js +56 -0
  13. package/scripts/Metrics.ts +66 -0
  14. package/scripts/Router.d.ts +12 -0
  15. package/scripts/Router.js +95 -0
  16. package/scripts/Router.ts +105 -0
  17. package/scripts/Screen.d.ts +11 -0
  18. package/scripts/Screen.js +62 -0
  19. package/scripts/Screen.ts +62 -0
  20. package/scripts/animate.d.ts +25 -0
  21. package/scripts/animate.js +47 -0
  22. package/scripts/animate.ts +57 -0
  23. package/scripts/css.d.ts +20 -0
  24. package/scripts/css.js +41 -0
  25. package/scripts/css.ts +46 -0
  26. package/scripts/dispatcher.d.ts +1 -0
  27. package/scripts/dispatcher.js +57 -0
  28. package/scripts/dispatcher.ts +58 -0
  29. package/scripts/file-system.d.ts +2 -0
  30. package/scripts/file-system.js +175 -0
  31. package/scripts/file-system.ts +177 -0
  32. package/scripts/fullscreen.d.ts +4 -0
  33. package/scripts/fullscreen.js +29 -0
  34. package/scripts/fullscreen.ts +30 -0
  35. package/scripts/init.d.ts +2 -0
  36. package/scripts/init.js +17 -0
  37. package/scripts/init.ts +18 -0
  38. package/scripts/localStorage.d.ts +9 -0
  39. package/scripts/localStorage.js +26 -0
  40. package/scripts/localStorage.ts +37 -0
  41. package/scripts/media.d.ts +22 -0
  42. package/scripts/media.js +48 -0
  43. package/scripts/media.ts +51 -0
  44. package/scripts/reuse.ts +74 -0
  45. package/scripts/speaker.d.ts +2 -0
  46. package/scripts/speaker.js +16 -0
  47. package/scripts/speaker.ts +25 -0
  48. package/scripts/store.d.ts +10 -0
  49. package/scripts/store.js +56 -0
  50. package/scripts/store.ts +47 -0
  51. package/scripts/swipe.d.ts +9 -0
  52. package/scripts/swipe.js +113 -0
  53. package/scripts/swipe.ts +129 -0
  54. package/scripts/widget.d.ts +2 -0
  55. package/scripts/widget.js +19 -0
  56. package/scripts/widget.ts +23 -0
  57. package/service-worker.d.ts +2 -0
  58. package/service-worker.js +40 -0
  59. package/service-worker.ts +52 -0
  60. package/tsconfig.json +11 -0
@@ -0,0 +1,19 @@
1
+ const w = function (...childrens) {
2
+ let props;
3
+ if (typeof childrens[0] === "object" &&
4
+ !(childrens[0] instanceof HTMLElement)) {
5
+ props = childrens[0];
6
+ childrens = childrens.slice(1, childrens.length);
7
+ }
8
+ const par = document.createDocumentFragment();
9
+ childrens.forEach((ch) => {
10
+ if (typeof ch === "function") {
11
+ par.append(ch(props));
12
+ }
13
+ else {
14
+ par.append(ch);
15
+ }
16
+ });
17
+ return () => par;
18
+ };
19
+ export default w;
@@ -0,0 +1,23 @@
1
+ const w = function (
2
+ ...childrens: HTMLElement[] | ((el: Record<string, string>) => HTMLElement)[]
3
+ ) {
4
+ let props: Record<string, string>;
5
+ if (
6
+ typeof childrens[0] === "object" &&
7
+ !(childrens[0] instanceof HTMLElement)
8
+ ) {
9
+ props = childrens[0];
10
+ childrens = childrens.slice(1, childrens.length);
11
+ }
12
+ const par = document.createDocumentFragment();
13
+ childrens.forEach((ch) => {
14
+ if (typeof ch === "function") {
15
+ par.append(ch(props));
16
+ } else {
17
+ par.append(ch);
18
+ }
19
+ });
20
+ return () => par;
21
+ };
22
+
23
+ export default w;
@@ -0,0 +1,2 @@
1
+ declare const store = "sample_store";
2
+ declare const assets: string[];
@@ -0,0 +1,40 @@
1
+ const store = "sample_store";
2
+ const assets = [
3
+ // put all the files you want cached here
4
+ "/",
5
+ ];
6
+ self.addEventListener("install", function (e) {
7
+ e.waitUntil(assets.forEach((asset) => {
8
+ fetch(asset)
9
+ .then((res) => {
10
+ const response = res.clone();
11
+ caches.open(store).then((cache) => {
12
+ cache.put(e.request, response);
13
+ });
14
+ return res;
15
+ })
16
+ .catch((err) => console.log(err));
17
+ }));
18
+ self["skipWaiting"]();
19
+ });
20
+ self.addEventListener("activate", function (e) {
21
+ e.waitUntil(caches.keys().then((cach) => {
22
+ if (cach !== store) {
23
+ return caches.delete(cach);
24
+ }
25
+ }));
26
+ return self.clients.claim();
27
+ });
28
+ self.addEventListener("fetch", function (e) {
29
+ e.waitUntil(e.respondWith(fetch(e.request)
30
+ .then((res) => {
31
+ const response = res.clone();
32
+ caches.open(store).then((cache) => {
33
+ console.log(response, " fetching");
34
+ cache.put(e.request, response);
35
+ });
36
+ return res;
37
+ })
38
+ .catch(() => caches.match(e.request).then((res) => res))));
39
+ self["skipWaiting"]();
40
+ });
@@ -0,0 +1,52 @@
1
+ const store = "sample_store";
2
+
3
+ const assets = [
4
+ // put all the files you want cached here
5
+ "/",
6
+ ];
7
+
8
+ self.addEventListener("install", function (e) {
9
+ e.waitUntil(
10
+ assets.forEach((asset) => {
11
+ fetch(asset)
12
+ .then((res) => {
13
+ const response = res.clone();
14
+ caches.open(store).then((cache) => {
15
+ cache.put(e.request, response);
16
+ });
17
+ return res;
18
+ })
19
+ .catch((err) => console.log(err));
20
+ })
21
+ );
22
+ self["skipWaiting"]();
23
+ });
24
+
25
+ self.addEventListener("activate", function (e) {
26
+ e.waitUntil(
27
+ caches.keys().then((cach) => {
28
+ if (cach !== store) {
29
+ return caches.delete(cach);
30
+ }
31
+ })
32
+ );
33
+ return self.clients.claim();
34
+ });
35
+
36
+ self.addEventListener("fetch", function (e) {
37
+ e.waitUntil(
38
+ e.respondWith(
39
+ fetch(e.request)
40
+ .then((res) => {
41
+ const response = res.clone();
42
+ caches.open(store).then((cache) => {
43
+ console.log(response, " fetching");
44
+ cache.put(e.request, response);
45
+ });
46
+ return res;
47
+ })
48
+ .catch(() => caches.match(e.request).then((res) => res))
49
+ )
50
+ );
51
+ self["skipWaiting"]();
52
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "compilerOptions": {
3
+ "strict": false,
4
+ "lib": ["ES2022", "DOM"],
5
+ "target": "ES2021",
6
+ "declaration": true,
7
+ "module": "ES2022",
8
+ "moduleResolution": "node"
9
+ },
10
+ "include": ["*.ts"]
11
+ }