diff --git a/package.json b/package.json index 0ceba88..896b2d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "@colonydb/anthill": "0.2.0-25", + "@colonydb/anthill": "0.2.0-26", "@vercel/analytics": "^1.5.0", "jsdom": "^26.0.0", "next": "15.2.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5a0e6ca..400f85d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@colonydb/anthill': - specifier: 0.2.0-25 - version: 0.2.0-25(@types/react@19.1.9)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(valibot@1.1.0(typescript@5.9.2)) + specifier: 0.2.0-26 + version: 0.2.0-26(@types/react@19.1.9)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(valibot@1.1.0(typescript@5.9.2)) '@vercel/analytics': specifier: ^1.5.0 version: 1.5.0(next@15.2.1(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(react@19.1.1) @@ -116,8 +116,8 @@ packages: cpu: [x64] os: [win32] - '@colonydb/anthill@0.2.0-25': - resolution: {integrity: sha512-+mJA9qPwtBQrbvimesmkiBBCWXAKauQ8hG1zLMHScdtOjDVmIRH4ChmXub/NTxc6V/YWjFVnMc4rGgjNHCwraQ==} + '@colonydb/anthill@0.2.0-26': + resolution: {integrity: sha512-DzQ1D4F+k1mkKmZKCWEvJc1k9y3UTbhFo5FTb+kMf7k0v8hg0UDtcV1XhE4ymcq0/TCLBIPYmFdHWMzTcbNEsg==} peerDependencies: react: ^19.0.0 react-dom: ^19.0.0 @@ -963,7 +963,7 @@ snapshots: '@biomejs/cli-win32-x64@2.1.4': optional: true - '@colonydb/anthill@0.2.0-25(@types/react@19.1.9)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(valibot@1.1.0(typescript@5.9.2))': + '@colonydb/anthill@0.2.0-26(@types/react@19.1.9)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(valibot@1.1.0(typescript@5.9.2))': dependencies: '@haydn/universal': 0.0.4 clsx: 2.1.1 diff --git a/src/app/List.tsx b/src/app/List.tsx index 3e2932a..3db41d0 100644 --- a/src/app/List.tsx +++ b/src/app/List.tsx @@ -1,15 +1,21 @@ "use client"; +import { CodeBlock } from "@colonydb/anthill/CodeBlock"; import { Header } from "@colonydb/anthill/Header"; import { Heading } from "@colonydb/anthill/Heading"; import { Link } from "@colonydb/anthill/Link"; +import { PlainText } from "@colonydb/anthill/PlainText"; import { RichText } from "@colonydb/anthill/RichText"; import { Section } from "@colonydb/anthill/Section"; +import { Stack } from "@colonydb/anthill/Stack"; import { type ReactNode, useEffect, useState } from "react"; import useSWR from "swr/immutable"; import type { ListConfig, ListResult } from "."; -type Props = { actions?: ReactNode } & Omit; +type Props = { + actions?: ReactNode; + debug?: boolean; +} & Omit; const fetcher = (url: string) => fetch(url).then((r) => { @@ -21,6 +27,7 @@ const fetcher = (url: string) => const List = ({ actions, + debug = false, exclude, include, itemSelector, @@ -75,10 +82,14 @@ const List = ({ ) : error ? (

Error: {error.message}

) : data === undefined || data.items.length === 0 ? ( -
-

No results

-
{JSON.stringify(data?.debug, null, 2)}
-
+ + + No results + </PlainText> + {debug && data?.debug ? ( + <CodeBlock language="json">{JSON.stringify(data.debug, null, 2)}</CodeBlock> + ) : null} + </Stack> ) : ( <RichText> <ul> diff --git a/src/app/ListForm.tsx b/src/app/ListForm.tsx index 7f075b4..699150e 100644 --- a/src/app/ListForm.tsx +++ b/src/app/ListForm.tsx @@ -123,6 +123,7 @@ const Preview = () => { <Specimen> {v.is(schema, data) ? ( <List + debug exclude={data.exclude} include={data.include} itemSelector={data.itemSelector}