@zeno-lib/query 0.0.1 → 0.0.3

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.
@@ -2,8 +2,8 @@ import { DehydratedState } from "@tanstack/react-query";
2
2
  import { ReactNode } from "react";
3
3
  //#region src/prefetched-queries.d.ts
4
4
  /** Whether the nearest `PrefetchedQueries` above was handed at least one dehydrated query. */
5
- declare function useHasPrefetchedQueries(): boolean;
6
- type PrefetchedQueriesProps = {
5
+ export declare function useHasPrefetchedQueries(): boolean;
6
+ export type PrefetchedQueriesProps = {
7
7
  children: ReactNode;
8
8
  state: DehydratedState;
9
9
  };
@@ -12,6 +12,5 @@ type PrefetchedQueriesProps = {
12
12
  * render** (on the server pass as well as in the browser), so a `useSuspenseQuery` below it
13
13
  * resolves synchronously in both and the two passes produce the same markup.
14
14
  */
15
- declare function PrefetchedQueries({ children, state }: PrefetchedQueriesProps): import("react/jsx-runtime").JSX.Element;
16
- //#endregion
17
- export { PrefetchedQueries, PrefetchedQueriesProps, useHasPrefetchedQueries };
15
+ export declare function PrefetchedQueries({ children, state }: PrefetchedQueriesProps): import("react").JSX.Element;
16
+ //#endregion
@@ -10,32 +10,31 @@
10
10
  * Every duration is in milliseconds.
11
11
  */
12
12
  /** Fast-moving data that keeps updating even while the tab is hidden: 15 s, refetched in the background. */
13
- declare const liveBackgroundQueryDefaults: {
13
+ export declare const liveBackgroundQueryDefaults: {
14
14
  readonly refetchInterval: number;
15
15
  readonly refetchIntervalInBackground: true;
16
16
  readonly staleTime: number;
17
17
  };
18
18
  /** Fast-moving data refreshed while it is on screen: 30 s. */
19
- declare const liveQueryDefaults: {
19
+ export declare const liveQueryDefaults: {
20
20
  readonly refetchInterval: number;
21
21
  readonly staleTime: number;
22
22
  };
23
23
  /** Data that can be slightly stale: 1 min. */
24
- declare const shortLivedQueryDefaults: {
24
+ export declare const shortLivedQueryDefaults: {
25
25
  readonly staleTime: number;
26
26
  };
27
27
  /** Slower-changing detail data: 2 min. */
28
- declare const longLivedQueryDefaults: {
28
+ export declare const longLivedQueryDefaults: {
29
29
  readonly staleTime: number;
30
30
  };
31
31
  /** Reference data worth keeping longer: 5 min stale, 30 min in the cache (the one preset that raises `gcTime`). */
32
- declare const cachedQueryDefaults: {
32
+ export declare const cachedQueryDefaults: {
33
33
  readonly gcTime: number;
34
34
  readonly staleTime: number;
35
35
  };
36
36
  /** Effectively immutable data: never stale. */
37
- declare const staticQueryDefaults: {
37
+ export declare const staticQueryDefaults: {
38
38
  readonly staleTime: number;
39
39
  };
40
- //#endregion
41
- export { cachedQueryDefaults, liveBackgroundQueryDefaults, liveQueryDefaults, longLivedQueryDefaults, shortLivedQueryDefaults, staticQueryDefaults };
40
+ //#endregion
@@ -1,7 +1,7 @@
1
1
  import { DehydrateOptions, QueryClient } from "@tanstack/react-query";
2
2
  import { ReactNode } from "react";
3
3
  //#region src/query-hydration-boundary.d.ts
4
- type QueryHydrationBoundaryProps = {
4
+ export type QueryHydrationBoundaryProps = {
5
5
  children: ReactNode;
6
6
  /**
7
7
  * Fills the server-side cache. Call each query through the same `queryOptions` factory the
@@ -32,6 +32,5 @@ type QueryHydrationBoundaryProps = {
32
32
  * </QueryHydrationBoundary>
33
33
  * ```
34
34
  */
35
- declare function QueryHydrationBoundary({ children, createQueryClient, dehydrateOptions, prefetch }: QueryHydrationBoundaryProps): Promise<import("react/jsx-runtime").JSX.Element>;
36
- //#endregion
37
- export { QueryHydrationBoundary, QueryHydrationBoundaryProps };
35
+ export declare function QueryHydrationBoundary({ children, createQueryClient, dehydrateOptions, prefetch }: QueryHydrationBoundaryProps): Promise<import("react").JSX.Element>;
36
+ //#endregion
@@ -1,11 +1,10 @@
1
1
  import { ComponentPropsWithoutRef } from "react";
2
2
  //#region src/query-suspense-loading.d.ts
3
- type QuerySuspenseLoadingProps = ComponentPropsWithoutRef<"div">;
3
+ export type QuerySuspenseLoadingProps = ComponentPropsWithoutRef<"div">;
4
4
  /**
5
5
  * Single layout root for Suspense loading UI: set `className` and children here so `aria-busy` /
6
6
  * `aria-live` apply to the same element as your skeleton stack (no inner wrapper div). Accepts
7
7
  * all `div` props; the `aria-busy` and `aria-live` defaults can be overridden.
8
8
  */
9
- declare function QuerySuspenseLoading({ "aria-busy": ariaBusy, "aria-live": ariaLive, children, ...props }: QuerySuspenseLoadingProps): import("react/jsx-runtime").JSX.Element;
10
- //#endregion
11
- export { QuerySuspenseLoading, QuerySuspenseLoadingProps };
9
+ export declare function QuerySuspenseLoading({ "aria-busy": ariaBusy, "aria-live": ariaLive, children, ...props }: QuerySuspenseLoadingProps): import("react").JSX.Element;
10
+ //#endregion
@@ -1,13 +1,13 @@
1
1
  import { ReactNode } from "react";
2
2
  //#region src/query-suspense.d.ts
3
- type QuerySuspenseErrorFallbackProps = {
3
+ export type QuerySuspenseErrorFallbackProps = {
4
4
  error: Error;
5
5
  onRetry: () => void;
6
6
  };
7
7
  /** Dev/test only: force a boundary's loading or error UI (e.g. for screenshots). Ignored in production. */
8
- type QuerySuspenseDebugState = "loading" | "error";
8
+ export type QuerySuspenseDebugState = "loading" | "error";
9
9
  /** Exported so callers can type wrapper components that forward `fallback` / `errorFallback`. */
10
- type QuerySuspenseProps = {
10
+ export type QuerySuspenseProps = {
11
11
  children: ReactNode;
12
12
  /** Suspense fallback: usually a skeleton of the same layout. */
13
13
  fallback: ReactNode;
@@ -25,6 +25,5 @@ type QuerySuspenseProps = {
25
25
  * hydration gate: `fallback` is all it renders on the server and through hydration, unless a
26
26
  * `PrefetchedQueries` (e.g. from `QueryHydrationBoundary`) above it was handed dehydrated queries.
27
27
  */
28
- declare function QuerySuspense({ children, errorFallback, fallback, debugState }: QuerySuspenseProps): import("react/jsx-runtime").JSX.Element;
29
- //#endregion
30
- export { QuerySuspense, QuerySuspenseDebugState, QuerySuspenseErrorFallbackProps, QuerySuspenseProps };
28
+ export declare function QuerySuspense({ children, errorFallback, fallback, debugState }: QuerySuspenseProps): import("react").JSX.Element;
29
+ //#endregion
@@ -4,7 +4,7 @@ import { QueryErrorResetBoundary } from "@tanstack/react-query";
4
4
  import { Component, Suspense, useSyncExternalStore } from "react";
5
5
  import { Fragment, jsx } from "react/jsx-runtime";
6
6
  //#region src/query-suspense.tsx
7
- const debugStateEnabled = typeof process !== "undefined" && process.env.NODE_ENV !== "production";
7
+ const debugStateEnabled = process.env.NODE_ENV !== "production";
8
8
  const subscribeToNothing = () => () => {};
9
9
  const useIsHydrated = () => useSyncExternalStore(subscribeToNothing, () => true, () => false);
10
10
  const debugError = Object.freeze(/* @__PURE__ */ new Error("QuerySuspense: debugState=\"error\" (development / test only; for screenshots)"));
package/package.json CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "name": "@zeno-lib/query",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
+ "repository": {
5
+ "url": "https://github.com/zeno-lib/zeno.git",
6
+ "directory": "packages/query"
7
+ },
4
8
  "type": "module",
5
9
  "exports": {
6
10
  "./prefetched-queries": {
@@ -32,34 +36,31 @@
32
36
  "files": [
33
37
  "dist"
34
38
  ],
35
- "publishConfig": {
36
- "access": "public"
37
- },
38
- "repository": {
39
- "url": "https://github.com/zeno-lib/zeno.git",
40
- "directory": "packages/query"
39
+ "devDependencies": {
40
+ "@tanstack/react-query": "^5.104.1",
41
+ "@types/node": "26.6.4",
42
+ "@types/react": "19.3.0",
43
+ "@types/react-dom": "19.3.0",
44
+ "@zeno-lib/test": "^0.1.1",
45
+ "@zeno-lib/typescript": "^1.1.0",
46
+ "@zeno-lib/ui": "^0.0.1",
47
+ "react": "^19.3.0",
48
+ "react-dom": "^19.3.0",
49
+ "tsdown": "^0.23.0",
50
+ "typescript": "7.0.2",
51
+ "vite": "8.3.3",
52
+ "vitest": "5.0.3"
41
53
  },
42
54
  "peerDependencies": {
43
55
  "@tanstack/react-query": ">=5",
44
56
  "react": ">=19"
45
57
  },
46
- "devDependencies": {
47
- "@tanstack/react-query": "^5.103.2",
48
- "@types/node": "25.6.0",
49
- "@types/react": "19.2.14",
50
- "@types/react-dom": "19.2.3",
51
- "react": "^19.2.5",
52
- "react-dom": "^19.2.5",
53
- "tsdown": "^0.22.14",
54
- "typescript": "7.0.2",
55
- "vite": "8.0.16",
56
- "vitest": "4.1.11",
57
- "@zeno-lib/test": "^0.1.0",
58
- "@zeno-lib/typescript": "^1.1.0",
59
- "@zeno-lib/ui": "^0.0.1"
58
+ "publishConfig": {
59
+ "access": "public"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "tsdown",
63
+ "dev": "tsdown --watch --no-clean",
63
64
  "test": "vitest --run",
64
65
  "test:watch": "vitest watch",
65
66
  "types:check": "tsc --noEmit"