@pyreon/zero 0.22.0 → 0.23.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/lib/link.js CHANGED
@@ -1,32 +1,8 @@
1
- import { createRef, onMount, onUnmount } from "@pyreon/core";
2
- import { useRouter } from "@pyreon/router";
1
+ import { t as useIntersectionObserver } from "./_chunks/use-intersection-observer-C6opeplh.js";
2
+ import { createRef } from "@pyreon/core";
3
3
  import { jsx } from "@pyreon/core/jsx-runtime";
4
+ import { useRouter } from "@pyreon/router";
4
5
 
5
- //#region src/utils/use-intersection-observer.ts
6
- /**
7
- * Observes an element and calls `onIntersect` once it enters the viewport.
8
- * Automatically disconnects after the first intersection.
9
- *
10
- * @param getElement - Getter for the target element (may be undefined before mount).
11
- * @param onIntersect - Callback fired when the element becomes visible.
12
- * @param rootMargin - IntersectionObserver rootMargin. Default: "200px".
13
- */
14
- function useIntersectionObserver(getElement, onIntersect, rootMargin = "200px") {
15
- onMount(() => {
16
- const el = getElement();
17
- if (!el) return void 0;
18
- const observer = new IntersectionObserver((entries) => {
19
- for (const entry of entries) if (entry.isIntersecting) {
20
- onIntersect();
21
- observer.disconnect();
22
- }
23
- }, { rootMargin });
24
- observer.observe(el);
25
- onUnmount(() => observer.disconnect());
26
- });
27
- }
28
-
29
- //#endregion
30
6
  //#region src/link.tsx
31
7
  const MAX_PREFETCH_CACHE = 200;
32
8
  const prefetched = /* @__PURE__ */ new Map();
package/lib/meta.js CHANGED
@@ -1,30 +1,6 @@
1
+ import { extractLocaleFromPath } from "./i18n-routing.js";
1
2
  import { useHead } from "@pyreon/head";
2
- import { createContext } from "@pyreon/core";
3
- import { signal } from "@pyreon/reactivity";
4
3
 
5
- //#region src/i18n-routing.ts
6
- /**
7
- * Extract locale from a URL path.
8
- * Returns { locale, pathWithoutLocale }.
9
- */
10
- function extractLocaleFromPath(path, locales, defaultLocale) {
11
- const segments = path.split("/").filter(Boolean);
12
- const firstSegment = segments[0]?.toLowerCase();
13
- if (firstSegment && locales.includes(firstSegment)) return {
14
- locale: firstSegment,
15
- pathWithoutLocale: "/" + segments.slice(1).join("/") || "/"
16
- };
17
- return {
18
- locale: defaultLocale,
19
- pathWithoutLocale: path
20
- };
21
- }
22
- /** @internal Context for the current locale. */
23
- const LocaleCtx = createContext("en");
24
- /** Current locale signal — set by the server middleware or client-side detection. */
25
- const localeSignal = signal("en");
26
-
27
- //#endregion
28
4
  //#region src/meta.tsx
29
5
  function faviconLinks(locale, config) {
30
6
  const hasLocaleOverride = locale && config.locales?.[locale];
package/lib/script.js CHANGED
@@ -1,32 +1,8 @@
1
+ import { t as useIntersectionObserver } from "./_chunks/use-intersection-observer-C6opeplh.js";
1
2
  import { createRef, onMount, onUnmount } from "@pyreon/core";
2
- import { signal } from "@pyreon/reactivity";
3
3
  import { jsx } from "@pyreon/core/jsx-runtime";
4
+ import { signal } from "@pyreon/reactivity";
4
5
 
5
- //#region src/utils/use-intersection-observer.ts
6
- /**
7
- * Observes an element and calls `onIntersect` once it enters the viewport.
8
- * Automatically disconnects after the first intersection.
9
- *
10
- * @param getElement - Getter for the target element (may be undefined before mount).
11
- * @param onIntersect - Callback fired when the element becomes visible.
12
- * @param rootMargin - IntersectionObserver rootMargin. Default: "200px".
13
- */
14
- function useIntersectionObserver(getElement, onIntersect, rootMargin = "200px") {
15
- onMount(() => {
16
- const el = getElement();
17
- if (!el) return void 0;
18
- const observer = new IntersectionObserver((entries) => {
19
- for (const entry of entries) if (entry.isIntersecting) {
20
- onIntersect();
21
- observer.disconnect();
22
- }
23
- }, { rootMargin });
24
- observer.observe(el);
25
- onUnmount(() => observer.disconnect());
26
- });
27
- }
28
-
29
- //#endregion
30
6
  //#region src/script.tsx
31
7
  /**
32
8
  * Composable that provides all script loading behavior — strategy state
package/lib/seo.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { existsSync } from "node:fs";
2
- import { readFile, rm, writeFile } from "node:fs/promises";
3
2
  import { join, resolve } from "node:path";
3
+ import { readFile, rm, writeFile } from "node:fs/promises";
4
4
 
5
5
  //#region src/seo.ts
6
6
  /**
@@ -238,7 +238,7 @@ function seoPlugin(config = {}) {
238
238
  },
239
239
  async generateBundle(_, _bundle) {
240
240
  if (config.sitemap && !useSsgPaths) {
241
- const { scanRouteFiles } = await import("./fs-router-3xzp-4Wj.js");
241
+ const { scanRouteFiles } = await import("./_chunks/fs-router-DvBlRzmP.js").then((n) => n.n);
242
242
  const routesDir = `${process.cwd()}/src/routes`;
243
243
  try {
244
244
  const files = await scanRouteFiles(routesDir);
@@ -262,7 +262,7 @@ function seoPlugin(config = {}) {
262
262
  },
263
263
  async closeBundle() {
264
264
  if (!config.sitemap || !useSsgPaths) return;
265
- const { scanRouteFiles } = await import("./fs-router-3xzp-4Wj.js");
265
+ const { scanRouteFiles } = await import("./_chunks/fs-router-DvBlRzmP.js").then((n) => n.n);
266
266
  const routesDir = `${process.cwd()}/src/routes`;
267
267
  const manifestPath = join(distDir, "_pyreon-ssg-paths.json");
268
268
  try {
@@ -300,7 +300,7 @@ function seoMiddleware(config = {}) {
300
300
  return async (ctx) => {
301
301
  if (ctx.url.pathname === "/robots.txt" && config.robots) return new Response(generateRobots(config.robots), { headers: { "Content-Type": "text/plain" } });
302
302
  if (ctx.url.pathname === "/sitemap.xml" && config.sitemap) try {
303
- const { scanRouteFiles } = await import("./fs-router-3xzp-4Wj.js");
303
+ const { scanRouteFiles } = await import("./_chunks/fs-router-DvBlRzmP.js").then((n) => n.n);
304
304
  const sitemap = generateSitemap(await scanRouteFiles(`${process.cwd()}/src/routes`), config.sitemap);
305
305
  return new Response(sitemap, { headers: { "Content-Type": "application/xml" } });
306
306
  } catch {}