blume 0.1.2 → 0.1.4

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.
@@ -94,6 +94,19 @@ declare const uiStringsObject: z.ZodObject<{
94
94
  label?: string | undefined;
95
95
  untranslated?: string | undefined;
96
96
  }>>;
97
+ notFound: z.ZodDefault<z.ZodObject<{
98
+ description: z.ZodDefault<z.ZodString>;
99
+ home: z.ZodDefault<z.ZodString>;
100
+ title: z.ZodDefault<z.ZodString>;
101
+ }, "strip", z.ZodTypeAny, {
102
+ title: string;
103
+ description: string;
104
+ home: string;
105
+ }, {
106
+ title?: string | undefined;
107
+ description?: string | undefined;
108
+ home?: string | undefined;
109
+ }>>;
97
110
  page: z.ZodDefault<z.ZodObject<{
98
111
  lastUpdated: z.ZodDefault<z.ZodString>;
99
112
  next: z.ZodDefault<z.ZodString>;
@@ -188,6 +201,11 @@ declare const uiStringsObject: z.ZodObject<{
188
201
  toc: {
189
202
  title: string;
190
203
  };
204
+ notFound: {
205
+ title: string;
206
+ description: string;
207
+ home: string;
208
+ };
191
209
  }, {
192
210
  actions?: {
193
211
  addToCursor?: string | undefined;
@@ -237,6 +255,11 @@ declare const uiStringsObject: z.ZodObject<{
237
255
  toc?: {
238
256
  title?: string | undefined;
239
257
  } | undefined;
258
+ notFound?: {
259
+ title?: string | undefined;
260
+ description?: string | undefined;
261
+ home?: string | undefined;
262
+ } | undefined;
240
263
  }>;
241
264
  export declare const uiStringsSchema: z.ZodDefault<z.ZodObject<{
242
265
  actions: z.ZodDefault<z.ZodObject<{
@@ -324,6 +347,19 @@ export declare const uiStringsSchema: z.ZodDefault<z.ZodObject<{
324
347
  label?: string | undefined;
325
348
  untranslated?: string | undefined;
326
349
  }>>;
350
+ notFound: z.ZodDefault<z.ZodObject<{
351
+ description: z.ZodDefault<z.ZodString>;
352
+ home: z.ZodDefault<z.ZodString>;
353
+ title: z.ZodDefault<z.ZodString>;
354
+ }, "strip", z.ZodTypeAny, {
355
+ title: string;
356
+ description: string;
357
+ home: string;
358
+ }, {
359
+ title?: string | undefined;
360
+ description?: string | undefined;
361
+ home?: string | undefined;
362
+ }>>;
327
363
  page: z.ZodDefault<z.ZodObject<{
328
364
  lastUpdated: z.ZodDefault<z.ZodString>;
329
365
  next: z.ZodDefault<z.ZodString>;
@@ -418,6 +454,11 @@ export declare const uiStringsSchema: z.ZodDefault<z.ZodObject<{
418
454
  toc: {
419
455
  title: string;
420
456
  };
457
+ notFound: {
458
+ title: string;
459
+ description: string;
460
+ home: string;
461
+ };
421
462
  }, {
422
463
  actions?: {
423
464
  addToCursor?: string | undefined;
@@ -467,6 +508,11 @@ export declare const uiStringsSchema: z.ZodDefault<z.ZodObject<{
467
508
  toc?: {
468
509
  title?: string | undefined;
469
510
  } | undefined;
511
+ notFound?: {
512
+ title?: string | undefined;
513
+ description?: string | undefined;
514
+ home?: string | undefined;
515
+ } | undefined;
470
516
  }>>;
471
517
  /** A fully-resolved dictionary; every key present. */
472
518
  export type UIStrings = z.infer<typeof uiStringsObject>;
@@ -57,13 +57,13 @@ declare const pageMetaBaseSchema: z.ZodObject<{
57
57
  }, "strict", z.ZodTypeAny, {
58
58
  noindex: boolean;
59
59
  title?: string | undefined;
60
- canonical?: string | undefined;
61
60
  description?: string | undefined;
61
+ canonical?: string | undefined;
62
62
  image?: string | undefined;
63
63
  }, {
64
64
  title?: string | undefined;
65
- canonical?: string | undefined;
66
65
  description?: string | undefined;
66
+ canonical?: string | undefined;
67
67
  image?: string | undefined;
68
68
  noindex?: boolean | undefined;
69
69
  }>>;
@@ -106,8 +106,8 @@ declare const pageMetaBaseSchema: z.ZodObject<{
106
106
  seo: {
107
107
  noindex: boolean;
108
108
  title?: string | undefined;
109
- canonical?: string | undefined;
110
109
  description?: string | undefined;
110
+ canonical?: string | undefined;
111
111
  image?: string | undefined;
112
112
  };
113
113
  sidebar: {
@@ -119,8 +119,8 @@ declare const pageMetaBaseSchema: z.ZodObject<{
119
119
  };
120
120
  date?: string | undefined;
121
121
  title?: string | undefined;
122
- icon?: string | undefined;
123
122
  description?: string | undefined;
123
+ icon?: string | undefined;
124
124
  changelog?: {
125
125
  date?: string | undefined;
126
126
  category?: string | undefined;
@@ -146,9 +146,9 @@ declare const pageMetaBaseSchema: z.ZodObject<{
146
146
  exclude?: boolean | undefined;
147
147
  tags?: string[] | undefined;
148
148
  } | undefined;
149
+ description?: string | undefined;
149
150
  hidden?: boolean | undefined;
150
151
  icon?: string | undefined;
151
- description?: string | undefined;
152
152
  noindex?: boolean | undefined;
153
153
  changelog?: {
154
154
  date?: string | Date | undefined;
@@ -168,8 +168,8 @@ declare const pageMetaBaseSchema: z.ZodObject<{
168
168
  rss?: boolean | undefined;
169
169
  seo?: {
170
170
  title?: string | undefined;
171
- canonical?: string | undefined;
172
171
  description?: string | undefined;
172
+ canonical?: string | undefined;
173
173
  image?: string | undefined;
174
174
  noindex?: boolean | undefined;
175
175
  } | undefined;
@@ -238,13 +238,13 @@ export declare const pageMetaSchema: z.ZodObject<{
238
238
  }, "strict", z.ZodTypeAny, {
239
239
  noindex: boolean;
240
240
  title?: string | undefined;
241
- canonical?: string | undefined;
242
241
  description?: string | undefined;
242
+ canonical?: string | undefined;
243
243
  image?: string | undefined;
244
244
  }, {
245
245
  title?: string | undefined;
246
- canonical?: string | undefined;
247
246
  description?: string | undefined;
247
+ canonical?: string | undefined;
248
248
  image?: string | undefined;
249
249
  noindex?: boolean | undefined;
250
250
  }>>;
@@ -287,8 +287,8 @@ export declare const pageMetaSchema: z.ZodObject<{
287
287
  seo: {
288
288
  noindex: boolean;
289
289
  title?: string | undefined;
290
- canonical?: string | undefined;
291
290
  description?: string | undefined;
291
+ canonical?: string | undefined;
292
292
  image?: string | undefined;
293
293
  };
294
294
  sidebar: {
@@ -300,8 +300,8 @@ export declare const pageMetaSchema: z.ZodObject<{
300
300
  };
301
301
  date?: string | undefined;
302
302
  title?: string | undefined;
303
- icon?: string | undefined;
304
303
  description?: string | undefined;
304
+ icon?: string | undefined;
305
305
  changelog?: {
306
306
  date?: string | undefined;
307
307
  category?: string | undefined;
@@ -327,9 +327,9 @@ export declare const pageMetaSchema: z.ZodObject<{
327
327
  exclude?: boolean | undefined;
328
328
  tags?: string[] | undefined;
329
329
  } | undefined;
330
+ description?: string | undefined;
330
331
  hidden?: boolean | undefined;
331
332
  icon?: string | undefined;
332
- description?: string | undefined;
333
333
  noindex?: boolean | undefined;
334
334
  changelog?: {
335
335
  date?: string | Date | undefined;
@@ -349,8 +349,8 @@ export declare const pageMetaSchema: z.ZodObject<{
349
349
  rss?: boolean | undefined;
350
350
  seo?: {
351
351
  title?: string | undefined;
352
- canonical?: string | undefined;
353
352
  description?: string | undefined;
353
+ canonical?: string | undefined;
354
354
  image?: string | undefined;
355
355
  noindex?: boolean | undefined;
356
356
  } | undefined;
@@ -551,14 +551,14 @@ declare const contentSourceSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
551
551
  }, "strict", z.ZodTypeAny, {
552
552
  status?: string | undefined;
553
553
  title?: string | undefined;
554
- order?: string | undefined;
555
554
  description?: string | undefined;
555
+ order?: string | undefined;
556
556
  slug?: string | undefined;
557
557
  }, {
558
558
  status?: string | undefined;
559
559
  title?: string | undefined;
560
- order?: string | undefined;
561
560
  description?: string | undefined;
561
+ order?: string | undefined;
562
562
  slug?: string | undefined;
563
563
  }>>;
564
564
  /** Status value treated as published; others map to `draft`. Default `Published`. */
@@ -572,8 +572,8 @@ declare const contentSourceSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
572
572
  properties?: {
573
573
  status?: string | undefined;
574
574
  title?: string | undefined;
575
- order?: string | undefined;
576
575
  description?: string | undefined;
576
+ order?: string | undefined;
577
577
  slug?: string | undefined;
578
578
  } | undefined;
579
579
  publishedValue?: string | undefined;
@@ -585,8 +585,8 @@ declare const contentSourceSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
585
585
  properties?: {
586
586
  status?: string | undefined;
587
587
  title?: string | undefined;
588
- order?: string | undefined;
589
588
  description?: string | undefined;
589
+ order?: string | undefined;
590
590
  slug?: string | undefined;
591
591
  } | undefined;
592
592
  publishedValue?: string | undefined;
@@ -1195,14 +1195,14 @@ export declare const blumeConfigSchema: z.ZodObject<{
1195
1195
  }, "strict", z.ZodTypeAny, {
1196
1196
  status?: string | undefined;
1197
1197
  title?: string | undefined;
1198
- order?: string | undefined;
1199
1198
  description?: string | undefined;
1199
+ order?: string | undefined;
1200
1200
  slug?: string | undefined;
1201
1201
  }, {
1202
1202
  status?: string | undefined;
1203
1203
  title?: string | undefined;
1204
- order?: string | undefined;
1205
1204
  description?: string | undefined;
1205
+ order?: string | undefined;
1206
1206
  slug?: string | undefined;
1207
1207
  }>>;
1208
1208
  /** Status value treated as published; others map to `draft`. Default `Published`. */
@@ -1216,8 +1216,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
1216
1216
  properties?: {
1217
1217
  status?: string | undefined;
1218
1218
  title?: string | undefined;
1219
- order?: string | undefined;
1220
1219
  description?: string | undefined;
1220
+ order?: string | undefined;
1221
1221
  slug?: string | undefined;
1222
1222
  } | undefined;
1223
1223
  publishedValue?: string | undefined;
@@ -1229,8 +1229,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
1229
1229
  properties?: {
1230
1230
  status?: string | undefined;
1231
1231
  title?: string | undefined;
1232
- order?: string | undefined;
1233
1232
  description?: string | undefined;
1233
+ order?: string | undefined;
1234
1234
  slug?: string | undefined;
1235
1235
  } | undefined;
1236
1236
  publishedValue?: string | undefined;
@@ -1322,8 +1322,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
1322
1322
  properties?: {
1323
1323
  status?: string | undefined;
1324
1324
  title?: string | undefined;
1325
- order?: string | undefined;
1326
1325
  description?: string | undefined;
1326
+ order?: string | undefined;
1327
1327
  slug?: string | undefined;
1328
1328
  } | undefined;
1329
1329
  publishedValue?: string | undefined;
@@ -1387,8 +1387,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
1387
1387
  properties?: {
1388
1388
  status?: string | undefined;
1389
1389
  title?: string | undefined;
1390
- order?: string | undefined;
1391
1390
  description?: string | undefined;
1391
+ order?: string | undefined;
1392
1392
  slug?: string | undefined;
1393
1393
  } | undefined;
1394
1394
  publishedValue?: string | undefined;
@@ -1458,11 +1458,17 @@ export declare const blumeConfigSchema: z.ZodObject<{
1458
1458
  }>>;
1459
1459
  description: z.ZodOptional<z.ZodString>;
1460
1460
  /**
1461
- * Directory (relative to the project root) that `<Component path>` resolves
1462
- * live previews and their source against. Defaults to `examples`; point it
1463
- * elsewhere when examples live outside a top-level `examples/` — e.g. a
1464
- * registry layout like `registry/<pkg>`, where a `<Component path>` key is
1465
- * then relative to that directory.
1461
+ * Where `<Component path>` resolves live previews and their source from,
1462
+ * relative to the project root. Defaults to the `examples` directory; point
1463
+ * it elsewhere when examples live outside a top-level `examples/`.
1464
+ *
1465
+ * May be a glob (anything with `*`/`?`/`[]`/`{}`/`!`), in which case only
1466
+ * matching files are discovered and a `<Component path>` key is relative to
1467
+ * the glob's static prefix. Use this for a registry layout that colocates
1468
+ * component sources with their examples — `registry/<pkg>/**\/examples/*`
1469
+ * targets just the examples, leaving the sources (which have no default
1470
+ * export to wrap) out, so the registry needn't be forked into its own
1471
+ * examples directory.
1466
1472
  */
1467
1473
  examples: z.ZodDefault<z.ZodString>;
1468
1474
  export: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
@@ -2117,14 +2123,14 @@ export declare const blumeConfigSchema: z.ZodObject<{
2117
2123
  }, "strict", z.ZodTypeAny, {
2118
2124
  path: string;
2119
2125
  label: string;
2120
- icon?: string | undefined;
2121
2126
  description?: string | undefined;
2127
+ icon?: string | undefined;
2122
2128
  tag?: string | undefined;
2123
2129
  }, {
2124
2130
  path: string;
2125
2131
  label: string;
2126
- icon?: string | undefined;
2127
2132
  description?: string | undefined;
2133
+ icon?: string | undefined;
2128
2134
  tag?: string | undefined;
2129
2135
  }>, "many">>;
2130
2136
  kind: z.ZodEnum<["dropdown", "language", "product", "version"]>;
@@ -2134,8 +2140,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
2134
2140
  items: {
2135
2141
  path: string;
2136
2142
  label: string;
2137
- icon?: string | undefined;
2138
2143
  description?: string | undefined;
2144
+ icon?: string | undefined;
2139
2145
  tag?: string | undefined;
2140
2146
  }[];
2141
2147
  kind: "version" | "dropdown" | "language" | "product";
@@ -2145,8 +2151,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
2145
2151
  items?: {
2146
2152
  path: string;
2147
2153
  label: string;
2148
- icon?: string | undefined;
2149
2154
  description?: string | undefined;
2155
+ icon?: string | undefined;
2150
2156
  tag?: string | undefined;
2151
2157
  }[] | undefined;
2152
2158
  }>, "many">>;
@@ -2173,14 +2179,14 @@ export declare const blumeConfigSchema: z.ZodObject<{
2173
2179
  }, "strict", z.ZodTypeAny, {
2174
2180
  path: string;
2175
2181
  label: string;
2176
- icon?: string | undefined;
2177
2182
  description?: string | undefined;
2183
+ icon?: string | undefined;
2178
2184
  tag?: string | undefined;
2179
2185
  }, {
2180
2186
  path: string;
2181
2187
  label: string;
2182
- icon?: string | undefined;
2183
2188
  description?: string | undefined;
2189
+ icon?: string | undefined;
2184
2190
  tag?: string | undefined;
2185
2191
  }>, "many">>;
2186
2192
  label: z.ZodString;
@@ -2192,8 +2198,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
2192
2198
  items?: {
2193
2199
  path: string;
2194
2200
  label: string;
2195
- icon?: string | undefined;
2196
2201
  description?: string | undefined;
2202
+ icon?: string | undefined;
2197
2203
  tag?: string | undefined;
2198
2204
  }[] | undefined;
2199
2205
  }, {
@@ -2203,8 +2209,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
2203
2209
  items?: {
2204
2210
  path: string;
2205
2211
  label: string;
2206
- icon?: string | undefined;
2207
2212
  description?: string | undefined;
2213
+ icon?: string | undefined;
2208
2214
  tag?: string | undefined;
2209
2215
  }[] | undefined;
2210
2216
  }>, "many">>;
@@ -2255,8 +2261,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
2255
2261
  items: {
2256
2262
  path: string;
2257
2263
  label: string;
2258
- icon?: string | undefined;
2259
2264
  description?: string | undefined;
2265
+ icon?: string | undefined;
2260
2266
  tag?: string | undefined;
2261
2267
  }[];
2262
2268
  kind: "version" | "dropdown" | "language" | "product";
@@ -2273,8 +2279,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
2273
2279
  items?: {
2274
2280
  path: string;
2275
2281
  label: string;
2276
- icon?: string | undefined;
2277
2282
  description?: string | undefined;
2283
+ icon?: string | undefined;
2278
2284
  tag?: string | undefined;
2279
2285
  }[] | undefined;
2280
2286
  }[] | undefined;
@@ -2327,8 +2333,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
2327
2333
  items?: {
2328
2334
  path: string;
2329
2335
  label: string;
2330
- icon?: string | undefined;
2331
2336
  description?: string | undefined;
2337
+ icon?: string | undefined;
2332
2338
  tag?: string | undefined;
2333
2339
  }[] | undefined;
2334
2340
  }[] | undefined;
@@ -2343,8 +2349,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
2343
2349
  items?: {
2344
2350
  path: string;
2345
2351
  label: string;
2346
- icon?: string | undefined;
2347
2352
  description?: string | undefined;
2353
+ icon?: string | undefined;
2348
2354
  tag?: string | undefined;
2349
2355
  }[] | undefined;
2350
2356
  }[] | undefined;
@@ -2806,8 +2812,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
2806
2812
  properties?: {
2807
2813
  status?: string | undefined;
2808
2814
  title?: string | undefined;
2809
- order?: string | undefined;
2810
2815
  description?: string | undefined;
2816
+ order?: string | undefined;
2811
2817
  slug?: string | undefined;
2812
2818
  } | undefined;
2813
2819
  publishedValue?: string | undefined;
@@ -2980,8 +2986,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
2980
2986
  items: {
2981
2987
  path: string;
2982
2988
  label: string;
2983
- icon?: string | undefined;
2984
2989
  description?: string | undefined;
2990
+ icon?: string | undefined;
2985
2991
  tag?: string | undefined;
2986
2992
  }[];
2987
2993
  kind: "version" | "dropdown" | "language" | "product";
@@ -2998,8 +3004,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
2998
3004
  items?: {
2999
3005
  path: string;
3000
3006
  label: string;
3001
- icon?: string | undefined;
3002
3007
  description?: string | undefined;
3008
+ icon?: string | undefined;
3003
3009
  tag?: string | undefined;
3004
3010
  }[] | undefined;
3005
3011
  }[] | undefined;
@@ -3175,8 +3181,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
3175
3181
  properties?: {
3176
3182
  status?: string | undefined;
3177
3183
  title?: string | undefined;
3178
- order?: string | undefined;
3179
3184
  description?: string | undefined;
3185
+ order?: string | undefined;
3180
3186
  slug?: string | undefined;
3181
3187
  } | undefined;
3182
3188
  publishedValue?: string | undefined;
@@ -3406,8 +3412,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
3406
3412
  items?: {
3407
3413
  path: string;
3408
3414
  label: string;
3409
- icon?: string | undefined;
3410
3415
  description?: string | undefined;
3416
+ icon?: string | undefined;
3411
3417
  tag?: string | undefined;
3412
3418
  }[] | undefined;
3413
3419
  }[] | undefined;
@@ -3422,8 +3428,8 @@ export declare const blumeConfigSchema: z.ZodObject<{
3422
3428
  items?: {
3423
3429
  path: string;
3424
3430
  label: string;
3425
- icon?: string | undefined;
3426
3431
  description?: string | undefined;
3432
+ icon?: string | undefined;
3427
3433
  tag?: string | undefined;
3428
3434
  }[] | undefined;
3429
3435
  }[] | undefined;
@@ -129,6 +129,12 @@ export type NavNode = {
129
129
  display?: SidebarDisplay;
130
130
  icon?: string;
131
131
  route?: string;
132
+ /**
133
+ * The group's URL path (its folder route prefix), even when the folder
134
+ * has no index page to link. Used to scope the sidebar to a tab's section;
135
+ * not a clickable link (that's `route`).
136
+ */
137
+ path?: string;
132
138
  collapsed?: boolean;
133
139
  children: NavNode[];
134
140
  };
@@ -247,6 +247,44 @@ releases. When you want a layout that's fully yours,
247
247
  standard Astro project you own outright.
248
248
  :::
249
249
 
250
+ ## 404 page
251
+
252
+ Blume ships a default **not found** page out of the box: a centered "404" message
253
+ wrapped in the site chrome (header, search, theme), served for any unmatched URL.
254
+ `blume build` writes it to `404.html`, which static hosts serve automatically, and
255
+ `blume dev` shows it for unknown routes.
256
+
257
+ To replace it with your own, add a `pages/404.astro`. It owns the `/404` route the
258
+ same way `pages/changelog.astro` takes over the changelog — your page wins and the
259
+ default is dropped. Build it like any other custom page, in `PageLayout` or
260
+ `RootLayout`:
261
+
262
+ ```astro pages/404.astro lineNumbers
263
+ ---
264
+ import PageLayout from "blume/components/layout/PageLayout.astro";
265
+ import data from "blume:data";
266
+ ---
267
+
268
+ <PageLayout
269
+ site={{ title: data.config.title, description: data.config.description }}
270
+ logo={data.config.logo}
271
+ navigation={data.navigation}
272
+ themeMode={data.config.theme.mode}
273
+ searchEnabled={data.config.search.enabled}
274
+ page={{ title: "Page not found", route: "/404" }}
275
+ noindex={true}
276
+ >
277
+ <section class="mx-auto max-w-2xl px-6 py-24 text-center">
278
+ <h1>This page took a wrong turn</h1>
279
+ <a href="/">Back to home</a>
280
+ </section>
281
+ </PageLayout>
282
+ ```
283
+
284
+ To keep the default design but change its wording — including for other languages
285
+ — override the `notFound` [UI strings](/docs/content/i18n) (`title`, `description`,
286
+ `home`) via `i18n.ui`.
287
+
250
288
  ## Interactive pages
251
289
 
252
290
  Custom pages are ordinary Astro, so you can drop in React (or any framework)
@@ -589,6 +589,26 @@ export default defineConfig({
589
589
  <Component path="file-list/basic" />
590
590
  ```
591
591
 
592
+ `examples` can also be a glob (anything with `*`, `?`, `[]`, `{}`, or `!`). Only
593
+ matching files are discovered, and `path` is relative to the glob's static prefix
594
+ (the part before the first wildcard). This is for a registry that colocates each
595
+ component's source with its example — point at just the examples so the sources,
596
+ which have no default export to preview, aren't swept in:
597
+
598
+ ```ts
599
+ // blume.config.ts
600
+ export default defineConfig({
601
+ // registry/files-sdk/file-list/file-list.tsx — source, left out
602
+ // registry/files-sdk/file-list/examples/basic.tsx — discovered
603
+ examples: "registry/files-sdk/**/examples/*",
604
+ });
605
+ ```
606
+
607
+ ```astro
608
+ <!-- keyed relative to registry/files-sdk -->
609
+ <Component path="file-list/examples/basic" />
610
+ ```
611
+
592
612
  <Component path="counter" />
593
613
 
594
614
  ```astro
@@ -86,19 +86,27 @@ sidebar:
86
86
 
87
87
  ## Tabs
88
88
 
89
- Render top-level sections as tabs in the header, useful for separating, say, docs
90
- from an API reference. A tab is highlighted when the current route falls under
91
- its `path`:
89
+ Render top-level sections as tabs in the header, useful for splitting a large
90
+ site into distinct areas say adapters, an API, and AI guides. A tab is
91
+ highlighted when the current route falls under its `path`:
92
92
 
93
93
  ```ts blume.config.ts lineNumbers
94
94
  navigation: {
95
95
  tabs: [
96
- { label: "Docs", path: "/", icon: "book-open" },
96
+ { label: "Adapters", path: "/adapters", icon: "plug" },
97
97
  { label: "API", path: "/api", icon: "rocket" },
98
+ { label: "AI", path: "/ai", icon: "sparkles" },
98
99
  ],
99
100
  }
100
101
  ```
101
102
 
103
+ Tabs also **scope the sidebar**: when the current route falls under a tab's
104
+ `path`, the sidebar shows only that section's pages — so `/adapters/*` lists the
105
+ adapters and nothing else. The folder at a tab's `path` becomes the section, so
106
+ this needs no extra config beyond the tabs themselves; structure your content
107
+ into a folder per tab and point each tab at it. A route under no tab (or a tab
108
+ whose `path` is `/`) shows the full sidebar.
109
+
102
110
  ## Explicit sidebar
103
111
 
104
112
  For full control, define `navigation.sidebar` in config. When it's set, Blume
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blume",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Documentation that's fast, AI-ready, and zero-config.",
5
5
  "keywords": [
6
6
  "astro",
@@ -40,25 +40,62 @@ const FRAMEWORK_BY_EXT: Record<string, ExampleFramework> = {
40
40
  };
41
41
 
42
42
  // Captures the extension so we can strip it from the path key and pick the
43
- // framework. Kept in sync with the glob below.
43
+ // framework. Kept in sync with the glob below — non-matching files a user glob
44
+ // happens to sweep in (e.g. a registry's `.ts` sources) are dropped here.
44
45
  const EXAMPLE_FILE = /\.(?<ext>astro|jsx|svelte|tsx|vue)$/u;
45
46
 
47
+ // Renderable example files when `examples` names a plain directory.
48
+ const DEFAULT_EXAMPLE_GLOB = "**/*.{astro,jsx,svelte,tsx,vue}";
49
+
50
+ // Glob magic that turns `examples` from a plain directory into a pattern. `()`,
51
+ // `@`, and `+` are excluded so literal path segments (npm scopes, parens) keep
52
+ // resolving as directories; the extglob leads `*?!` still trigger here.
53
+ const GLOB_MAGIC = /[!*?[\]{}]/u;
54
+
55
+ /**
56
+ * Split a glob into its static directory prefix and the remaining pattern, so
57
+ * discovered files can be keyed relative to that prefix (e.g.
58
+ * `registry/x/**\/examples/*` → `{ base: "registry/x", rest: "**\/examples/*" }`).
59
+ */
60
+ const splitGlobBase = (pattern: string): { base: string; rest: string } => {
61
+ const segments = pattern.split("/");
62
+ const firstMagic = segments.findIndex((segment) => GLOB_MAGIC.test(segment));
63
+ if (firstMagic === -1) {
64
+ return { base: pattern, rest: "" };
65
+ }
66
+ return {
67
+ base: segments.slice(0, firstMagic).join("/"),
68
+ rest: segments.slice(firstMagic).join("/"),
69
+ };
70
+ };
71
+
46
72
  /**
47
- * Discover preview examples under `<root>/<subdir>` (the `examples` config,
48
- * default `examples`). Every `.astro`/`.tsx`/`.jsx`/`.vue`/`.svelte` file
49
- * becomes addressable by `<Component path="...">`, where the path is the file's
50
- * location under that directory without its extension (e.g. `forms/login.tsx` →
51
- * `forms/login`). Discovery is path-based (a glob), so no example code is
52
- * executed. Framework examples carry a hydration mode (default `client:visible`,
53
- * overridable via `export const client`); `.astro` examples render statically
54
- * with no client directive.
73
+ * Discover preview examples for the `examples` config (default `examples`).
74
+ * Every `.astro`/`.tsx`/`.jsx`/`.vue`/`.svelte` file becomes addressable by
75
+ * `<Component path="...">`, where the path is the file's location without its
76
+ * extension (e.g. `forms/login.tsx` → `forms/login`).
77
+ *
78
+ * `pattern` is a directory by default, but may be a glob (anything with
79
+ * `*`/`?`/`[]`/`{}`/`!`) then only matching files are discovered and each
80
+ * `<Component path>` key is relative to the glob's static prefix. This lets a
81
+ * registry layout that colocates component sources with their examples be
82
+ * targeted directly (e.g. `registry/<pkg>/**\/examples/*`) without the sources —
83
+ * which have no default export and so can't be wrapped — being swept in.
84
+ *
85
+ * Discovery is path-based (a glob), so no example code is executed. Framework
86
+ * examples carry a hydration mode (default `client:visible`, overridable via
87
+ * `export const client`); `.astro` examples render statically with no client
88
+ * directive.
55
89
  */
56
90
  export const discoverExamples = async (
57
91
  root: string,
58
- subdir = "examples"
92
+ pattern = "examples"
59
93
  ): Promise<ExampleDiscovery> => {
60
- const dir = join(root, subdir);
61
- const matches = await glob(["**/*.{astro,jsx,svelte,tsx,vue}"], {
94
+ const { base, rest } = GLOB_MAGIC.test(pattern)
95
+ ? splitGlobBase(pattern)
96
+ : { base: pattern, rest: DEFAULT_EXAMPLE_GLOB };
97
+ const dir = join(root, base);
98
+ const matches = await glob([rest], {
62
99
  absolute: true,
63
100
  cwd: dir,
64
101
  onlyFiles: true,