@mauroandre/velojs 0.0.34 → 0.0.35

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 (2) hide show
  1. package/dist/client.js +56 -36
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -1,52 +1,72 @@
1
1
  import { jsx as c } from "preact/jsx-runtime";
2
- import { hydrate as m } from "preact";
3
- import { Router as a, Route as y, Switch as R } from "wouter-preact";
4
- const $ = (o, t) => o.reduceRight((e, l) => /* @__PURE__ */ c(l, { children: e }), t), d = (o, t, e) => t ? e && t === "/" ? o || "/" : t.startsWith("/") ? o + t : o + "/" + t : o, h = (o, t = [], e = "", l = "") => {
5
- const i = [];
6
- for (let u = 0; u < o.length; u++) {
7
- const n = o[u], r = `${l}${u}`;
8
- if (!n.module) {
9
- if (n.children) {
10
- const s = d(e, n.path, !1);
11
- i.push(
12
- ...h(n.children, t, s, `${r}-`)
2
+ import { hydrate as b } from "preact";
3
+ import { Router as j, Route as m, Switch as a } from "wouter-preact";
4
+ const $ = (n, t) => n.reduceRight((e, i) => /* @__PURE__ */ c(i, { children: e }), t), p = (n, t, e) => t ? e && t === "/" ? n || "/" : t.startsWith("/") ? n + t : n + "/" + t : n, x = (n) => n === "" ? "*" : `${n}/*?`, C = (n) => {
5
+ for (const t of n) {
6
+ if (t.path === "*" && t.module) return t.module.Component;
7
+ if (t.children) {
8
+ const e = C(t.children);
9
+ if (e) return e;
10
+ }
11
+ }
12
+ return null;
13
+ }, y = (n, t) => t ? [...n, /* @__PURE__ */ c(m, { children: /* @__PURE__ */ c(t, {}) }, "__notfound")] : n, h = (n, t, e, i, R) => {
14
+ const l = [];
15
+ for (let u = 0; u < n.length; u++) {
16
+ const o = n[u], r = `${R}${u}`;
17
+ if (o.path === "*") continue;
18
+ if (!o.module) {
19
+ if (o.children) {
20
+ const f = p(e, o.path, !1);
21
+ l.push(
22
+ ...h(o.children, t, f, i, `${r}-`)
13
23
  );
14
24
  }
15
25
  continue;
16
26
  }
17
- const f = n.module.Component;
18
- if (!n.children) {
19
- const s = n.path === "*" ? "*" : d(e, n.path, !0);
20
- i.push(
21
- /* @__PURE__ */ c(y, { path: s || "/", children: $(t, /* @__PURE__ */ c(f, {})) }, r)
27
+ const s = o.module.Component;
28
+ if (!o.children) {
29
+ const f = p(e, o.path, !0) || "/";
30
+ l.push(
31
+ /* @__PURE__ */ c(m, { path: f, children: $(t, /* @__PURE__ */ c(s, {})) }, r)
32
+ );
33
+ continue;
34
+ }
35
+ if (o.isRoot) {
36
+ l.push(
37
+ /* @__PURE__ */ c(a, { children: y(
38
+ h(o.children, [], "", i, `${r}-`),
39
+ i
40
+ ) }, r)
22
41
  );
23
42
  continue;
24
43
  }
25
- if (n.isRoot) {
26
- i.push(
27
- /* @__PURE__ */ c(R, { children: h(n.children, [], "", `${r}-`) }, r)
44
+ const d = p(e, o.path, !1);
45
+ if (!o.path) {
46
+ l.push(
47
+ ...h(o.children, [...t, s], d, i, `${r}-`)
28
48
  );
29
49
  continue;
30
50
  }
31
- const p = d(e, n.path, !1);
32
- i.push(
33
- ...h(
34
- n.children,
35
- [...t, f],
36
- p,
37
- `${r}-`
38
- )
51
+ l.push(
52
+ /* @__PURE__ */ c(m, { path: x(d), children: $(
53
+ t,
54
+ /* @__PURE__ */ c(s, { children: /* @__PURE__ */ c(a, { children: y(
55
+ h(o.children, [], d, i, `${r}-`),
56
+ i
57
+ ) }) })
58
+ ) }, r)
39
59
  );
40
60
  }
41
- return i;
42
- }, C = ({ routes: o }) => {
43
- const t = h(o);
44
- return /* @__PURE__ */ c(a, { children: t });
45
- }, S = (o) => {
46
- const { routes: t } = o, e = document.querySelector("body");
47
- e && m(/* @__PURE__ */ c(C, { routes: t }), e);
61
+ return l;
62
+ }, S = ({ routes: n }) => {
63
+ const t = C(n), e = h(n, [], "", t, "");
64
+ return /* @__PURE__ */ c(j, { children: e });
65
+ }, q = (n) => {
66
+ const { routes: t } = n, e = document.querySelector("body");
67
+ e && b(/* @__PURE__ */ c(S, { routes: t }), e);
48
68
  };
49
69
  export {
50
- C as ClientRoutes,
51
- S as startClient
70
+ S as ClientRoutes,
71
+ q as startClient
52
72
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mauroandre/velojs",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "type": "module",
5
5
  "description": "Fullstack web framework built on Hono + Preact with Vite-powered AST transforms",
6
6
  "keywords": [