@mauroandre/velojs 0.0.29 → 0.0.30

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/components.js +25 -25
  2. package/package.json +1 -1
@@ -1,56 +1,56 @@
1
- import { jsx as o, jsxs as p, Fragment as $ } from "preact/jsx-runtime";
2
- import { useRouter as C, Link as S } from "wouter-preact";
3
- import { __veloUpdatePending as E } from "./hooks.js";
1
+ import { jsx as o, jsxs as p, Fragment as h } from "preact/jsx-runtime";
2
+ import { useRouter as L, Link as C } from "wouter-preact";
3
+ import { __veloUpdatePending as S } from "./hooks.js";
4
4
  function O({ basePath: e, favicon: t = "/favicon.ico" } = {}) {
5
5
  const n = process.env.NODE_ENV !== "production";
6
6
  e = e || process.env.STATIC_BASE_URL || (process.env.VELO_STATIC ? "/client" : "");
7
- const i = t !== !1 && /* @__PURE__ */ o("link", { rel: "icon", href: `${e}${t}`, type: "image/x-icon" });
7
+ const r = t === !1 ? void 0 : t.endsWith(".svg") ? "image/svg+xml" : t.endsWith(".png") ? "image/png" : "image/x-icon", i = t !== !1 && /* @__PURE__ */ o("link", { rel: "icon", href: `${e}${t}`, type: r });
8
8
  if (n)
9
- return /* @__PURE__ */ p($, { children: [
9
+ return /* @__PURE__ */ p(h, { children: [
10
10
  i,
11
11
  /* @__PURE__ */ o("script", { type: "module", src: "/@vite/client" }),
12
12
  /* @__PURE__ */ o("script", { type: "module", src: "/__velo_client.js" })
13
13
  ] });
14
- const r = globalThis.__veloClientJs || (typeof __VELO_CLIENT_JS__ < "u" ? __VELO_CLIENT_JS__ : "client.js"), c = globalThis.__veloClientCss || (typeof __VELO_CLIENT_CSS__ < "u" ? __VELO_CLIENT_CSS__ : "client.css");
15
- return /* @__PURE__ */ p($, { children: [
14
+ const l = globalThis.__veloClientJs || (typeof __VELO_CLIENT_JS__ < "u" ? __VELO_CLIENT_JS__ : "client.js"), c = globalThis.__veloClientCss || (typeof __VELO_CLIENT_CSS__ < "u" ? __VELO_CLIENT_CSS__ : "client.css");
15
+ return /* @__PURE__ */ p(h, { children: [
16
16
  i,
17
17
  /* @__PURE__ */ o("link", { rel: "stylesheet", href: `${e}/${c}` }),
18
- /* @__PURE__ */ o("script", { type: "module", src: `${e}/${r}` })
18
+ /* @__PURE__ */ o("script", { type: "module", src: `${e}/${l}` })
19
19
  ] });
20
20
  }
21
- function h(e, t) {
21
+ function $(e, t) {
22
22
  let n = e;
23
- for (const [i, r] of Object.entries(t))
24
- n = n.replace(`:${i}`, r);
23
+ for (const [r, i] of Object.entries(t))
24
+ n = n.replace(`:${r}`, i);
25
25
  return n;
26
26
  }
27
- function j({ to: e, params: t, search: n, absolute: i, ...r }) {
28
- const c = typeof e != "string", u = C(), f = c ? (i ? e.metadata?.fullPath : e.metadata?.path) ?? "/" : e, l = t ? h(f, t) : f, v = c && i ? `~${l}` : l, a = n ? `?${new URLSearchParams(n).toString()}` : "", L = `${v}${a}`;
29
- if (typeof window < "u" && E.value) {
30
- let _;
31
- if (c) {
27
+ function j({ to: e, params: t, search: n, absolute: r, ...i }) {
28
+ const l = typeof e != "string", c = L(), f = l ? (r ? e.metadata?.fullPath : e.metadata?.path) ?? "/" : e, _ = t ? $(f, t) : f, m = l && r ? `~${_}` : _, u = n ? `?${new URLSearchParams(n).toString()}` : "", g = `${m}${u}`;
29
+ if (typeof window < "u" && S.value) {
30
+ let a;
31
+ if (l) {
32
32
  const s = e.metadata?.fullPath ?? f;
33
- _ = `${t ? h(s, t) : s}${a}`;
33
+ a = `${t ? $(s, t) : s}${u}`;
34
34
  } else {
35
- const s = l.replace(/^~/, "");
36
- _ = `${!l.startsWith("~") && u.base ? u.base : ""}${s}${a}`;
35
+ const s = _.replace(/^~/, "");
36
+ a = `${!_.startsWith("~") && c.base ? c.base : ""}${s}${u}`;
37
37
  }
38
- const { onClick: d, ...m } = r;
38
+ const { onClick: d, ...v } = i;
39
39
  return /* @__PURE__ */ o(
40
40
  "a",
41
41
  {
42
- href: _,
42
+ href: a,
43
43
  onClick: (s) => {
44
- d && d(s), s.defaultPrevented || (s.preventDefault(), window.location.href = _);
44
+ d && d(s), s.defaultPrevented || (s.preventDefault(), window.location.href = a);
45
45
  },
46
- ...m
46
+ ...v
47
47
  }
48
48
  );
49
49
  }
50
- return /* @__PURE__ */ o(S, { to: L, ...r });
50
+ return /* @__PURE__ */ o(C, { to: g, ...i });
51
51
  }
52
52
  export {
53
53
  j as Link,
54
54
  O as Scripts,
55
- h as substituteParams
55
+ $ as substituteParams
56
56
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mauroandre/velojs",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "type": "module",
5
5
  "description": "Fullstack web framework built on Hono + Preact with Vite-powered AST transforms",
6
6
  "keywords": [