@mauroandre/velojs 0.0.32 → 0.0.33

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/client.d.ts CHANGED
@@ -2,4 +2,7 @@ import type { AppRoutes } from "./types.js";
2
2
  export interface StartClientOptions {
3
3
  routes: AppRoutes;
4
4
  }
5
+ export declare const ClientRoutes: ({ routes }: {
6
+ routes: AppRoutes;
7
+ }) => import("preact").JSX.Element;
5
8
  export declare const startClient: (options: StartClientOptions) => void;
package/dist/client.js CHANGED
@@ -1,46 +1,53 @@
1
- import { jsx as e } from "preact/jsx-runtime";
2
- import { hydrate as p } from "preact";
1
+ import { jsx as n } from "preact/jsx-runtime";
2
+ import { hydrate as m } from "preact";
3
3
  import { Router as f, Route as l, Switch as s } from "wouter-preact";
4
- const u = (r, i = !1) => {
5
- const o = [];
6
- for (let n = 0; n < r.length; n++) {
7
- const t = r[n];
4
+ const p = (o, e) => o.reduceRight((r, i) => /* @__PURE__ */ n(i, { children: r }), e), h = (o, e = [], r = "") => {
5
+ const i = [];
6
+ for (let u = 0; u < o.length; u++) {
7
+ const t = o[u], c = `${r}${u}`;
8
8
  if (!t.module) {
9
- if (t.children)
10
- for (const d of u(t.children, i))
11
- o.push(d);
9
+ t.children && i.push(...h(t.children, e, `${c}-`));
12
10
  continue;
13
11
  }
14
- const c = t.module.Component;
12
+ const d = t.module.Component;
15
13
  if (!t.children) {
16
- o.push(
17
- /* @__PURE__ */ e(l, { path: t.path || "", children: /* @__PURE__ */ e(c, {}) }, n)
14
+ i.push(
15
+ /* @__PURE__ */ n(l, { path: t.path || "", children: p(e, /* @__PURE__ */ n(d, {})) }, c)
18
16
  );
19
17
  continue;
20
18
  }
21
- const h = u(t.children, !!t.path);
22
19
  if (t.isRoot) {
23
- o.push(/* @__PURE__ */ e(s, { children: h }, n));
20
+ i.push(
21
+ /* @__PURE__ */ n(s, { children: h(t.children, [], `${c}-`) }, c)
22
+ );
24
23
  continue;
25
24
  }
26
25
  if (!t.path) {
27
- o.push(
28
- /* @__PURE__ */ e(c, { children: /* @__PURE__ */ e(s, { children: h }) }, n)
26
+ i.push(
27
+ ...h(
28
+ t.children,
29
+ [...e, d],
30
+ `${c}-`
31
+ )
29
32
  );
30
33
  continue;
31
34
  }
32
- o.push(
33
- /* @__PURE__ */ e(l, { path: t.path, nest: !0, children: /* @__PURE__ */ e(c, { children: /* @__PURE__ */ e(s, { children: h }) }) }, n)
35
+ i.push(
36
+ /* @__PURE__ */ n(l, { path: t.path, nest: !0, children: p(
37
+ e,
38
+ /* @__PURE__ */ n(d, { children: /* @__PURE__ */ n(s, { children: h(t.children, [], `${c}-`) }) })
39
+ ) }, c)
34
40
  );
35
41
  }
36
- return o;
37
- }, m = ({ routes: r }) => {
38
- const i = u(r);
39
- return /* @__PURE__ */ e(f, { children: i });
40
- }, C = (r) => {
41
- const { routes: i } = r, o = document.querySelector("body");
42
- o && p(/* @__PURE__ */ e(m, { routes: i }), o);
42
+ return i;
43
+ }, a = ({ routes: o }) => {
44
+ const e = h(o);
45
+ return /* @__PURE__ */ n(f, { children: e });
46
+ }, C = (o) => {
47
+ const { routes: e } = o, r = document.querySelector("body");
48
+ r && m(/* @__PURE__ */ n(a, { routes: e }), r);
43
49
  };
44
50
  export {
51
+ a as ClientRoutes,
45
52
  C as startClient
46
53
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mauroandre/velojs",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "type": "module",
5
5
  "description": "Fullstack web framework built on Hono + Preact with Vite-powered AST transforms",
6
6
  "keywords": [