zudoku 0.82.1 → 0.82.2

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/cli/cli.js CHANGED
@@ -1,7 +1,12 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __esm = (fn, res) => function __init() {
4
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
3
+ var __esm = (fn, res, err) => function __init() {
4
+ if (err) throw err[0];
5
+ try {
6
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
7
+ } catch (e) {
8
+ throw err = [e], e;
9
+ }
5
10
  };
6
11
  var __export = (target, all) => {
7
12
  for (var name in all)
@@ -143,7 +143,10 @@ type NavigationCategory = {
143
143
  collapsible?: boolean;
144
144
  collapsed?: boolean;
145
145
  stack?: boolean; // open the category's items as a stacked sub-nav
146
- link?: string | { type: "doc"; file: string; label?: string; path?: string };
146
+ link?:
147
+ | string
148
+ | { type: "doc"; file: string; label?: string; path?: string }
149
+ | { type: "link"; to: string; label?: string };
147
150
  display?:
148
151
  | "auth"
149
152
  | "anon"
@@ -158,9 +161,11 @@ type NavigationCategory = {
158
161
  #### Category links
159
162
 
160
163
  A category can have a `link` property that makes the category label itself clickable, navigating to
161
- a document. This is useful when you want a category that acts as both a group and a landing page.
164
+ a document, a path, or an external URL. This is useful when you want a category that acts as both a
165
+ group and a landing page.
162
166
 
163
- The `link` can be a simple string pointing to a file path, or an object for more control:
167
+ The `link` can be a simple string pointing to a file path, a `doc` object for more control, or a
168
+ `link` object that points the category label at an arbitrary path or external URL:
164
169
 
165
170
  ```tsx title="String shorthand"
166
171
  {
@@ -190,7 +195,7 @@ The `link` can be a simple string pointing to a file path, or an object for more
190
195
  }
191
196
  ```
192
197
 
193
- The object form supports these properties:
198
+ The `doc` object form supports these properties:
194
199
 
195
200
  | Property | Type | Description |
196
201
  | -------- | -------- | -------------------------------------------------------- |
@@ -199,6 +204,29 @@ The object form supports these properties:
199
204
  | `label` | `string` | Override the label (defaults to the document title) |
200
205
  | `path` | `string` | Custom URL path (overrides the default file-based route) |
201
206
 
207
+ ```tsx title="Link form pointing to a path or external URL"
208
+ {
209
+ type: "category",
210
+ label: "API Reference",
211
+ link: {
212
+ type: "link",
213
+ to: "/api",
214
+ },
215
+ items: [
216
+ "guides/authentication",
217
+ "guides/rate-limits",
218
+ ],
219
+ }
220
+ ```
221
+
222
+ The `link` object form supports these properties:
223
+
224
+ | Property | Type | Description |
225
+ | -------- | -------- | ----------------------------------- |
226
+ | `type` | `"link"` | Must be `"link"` |
227
+ | `to` | `string` | Path or external URL to navigate to |
228
+ | `label` | `string` | Override the category label |
229
+
202
230
  ### `type: doc`
203
231
 
204
232
  Doc is used to reference markdown files. The `label` is the text that will be displayed, and the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zudoku",
3
- "version": "0.82.1",
3
+ "version": "0.82.2",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20.19.0 <21.0.0 || >=22.12.0"
@@ -175,7 +175,7 @@
175
175
  "@apidevtools/json-schema-ref-parser": "15.3.5",
176
176
  "@base-ui/react": "^1.4.1",
177
177
  "@envelop/core": "5.5.1",
178
- "@graphiql/toolkit": "0.12.0",
178
+ "@graphiql/toolkit": "0.12.1",
179
179
  "@graphql-typed-document-node/core": "3.2.0",
180
180
  "@hono/node-server": "2.0.3",
181
181
  "@lekoarts/rehype-meta-as-attributes": "3.0.3",
@@ -229,7 +229,7 @@
229
229
  "cmdk": "1.1.1",
230
230
  "dotenv": "17.4.2",
231
231
  "embla-carousel-react": "8.6.0",
232
- "esbuild": "^0.28.0",
232
+ "esbuild": "^0.28.1",
233
233
  "estree-util-is-identifier-name": "3.0.0",
234
234
  "estree-util-value-to-estree": "3.5.0",
235
235
  "fast-equals": "6.0.0",
@@ -260,7 +260,7 @@
260
260
  "openapi-types": "12.1.3",
261
261
  "pagefind": "1.5.2",
262
262
  "picocolors": "1.1.1",
263
- "piscina": "5.1.4",
263
+ "piscina": "5.2.0",
264
264
  "posthog-node": "5.36.2",
265
265
  "quick-lru": "7.3.0",
266
266
  "react-error-boundary": "6.1.1",
@@ -288,11 +288,11 @@
288
288
  "unist-util-visit": "5.1.0",
289
289
  "vaul": "1.1.2",
290
290
  "vfile": "6.0.3",
291
- "vite": "8.0.13",
291
+ "vite": "8.0.16",
292
292
  "yaml": "2.9.0",
293
293
  "yargs": "18.0.0",
294
294
  "zod": "4.4.3",
295
- "zustand": "5.0.13"
295
+ "zustand": "5.0.14"
296
296
  },
297
297
  "devDependencies": {
298
298
  "@graphql-codegen/cli": "7.1.1",
@@ -104,6 +104,7 @@ const NavigationCategoryInner = ({
104
104
  defaultOpen={isDefaultOpen}
105
105
  open={open}
106
106
  onOpenChange={(value) => {
107
+ if (!isCollapsible) return;
107
108
  // Categories with a link navigate on row click, so they only open here
108
109
  // (closing is done via the chevron). Without a link the row toggles.
109
110
  const nextOpen = category.link ? true : value;
@@ -24,6 +24,7 @@ import { Popover, PopoverContent, PopoverTrigger } from "zudoku/ui/Popover.js";
24
24
  import type { TocEntry } from "../../../vite/mdx/rehype-extract-toc-with-jsx.js";
25
25
  import { AiAssistantMenuItems } from "../../components/AiAssistantMenuItems.js";
26
26
  import { CategoryHeading } from "../../components/CategoryHeading.js";
27
+ import { useIsClient } from "../../components/ClientOnly.js";
27
28
  import { useViewportAnchor } from "../../components/context/ViewportAnchorContext.js";
28
29
  import { useZudoku } from "../../components/context/ZudokuContext.js";
29
30
  import { DeveloperHint } from "../../components/DeveloperHint.js";
@@ -193,6 +194,8 @@ export const MdxPage = ({
193
194
  ? new Date(frontmatter.lastModifiedTime)
194
195
  : null;
195
196
 
197
+ const isClient = useIsClient();
198
+
196
199
  const editConfig =
197
200
  frontmatter.suggestEdit !== false &&
198
201
  (frontmatter.suggestEdit ?? defaultOptions?.suggestEdit);
@@ -400,15 +403,27 @@ export const MdxPage = ({
400
403
  <div>
401
404
  {showLastModified && lastModifiedDate && (
402
405
  <div
403
- title={lastModifiedDate.toLocaleString(undefined, {
404
- dateStyle: "full",
405
- timeStyle: "medium",
406
- })}
406
+ // Render the tooltip (full date + time in the viewer's local
407
+ // timezone) only on the client. It's omitted on the server and
408
+ // the first client render, so there's no hydration mismatch,
409
+ // then added after mount.
410
+ title={
411
+ isClient
412
+ ? lastModifiedDate.toLocaleString("en-US", {
413
+ dateStyle: "full",
414
+ timeStyle: "medium",
415
+ })
416
+ : undefined
417
+ }
407
418
  >
408
419
  Last modified on{" "}
409
420
  <time dateTime={lastModifiedDate.toISOString()}>
410
421
  {lastModifiedDate.toLocaleDateString("en-US", {
411
422
  dateStyle: "long",
423
+ // Pinned to UTC so the prerendered day matches the client
424
+ // render; a local timezone would shift the day near a UTC
425
+ // boundary and cause a hydration error (#418).
426
+ timeZone: "UTC",
412
427
  })}
413
428
  </time>
414
429
  </div>