@zpress/core 0.2.1 → 0.3.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/dist/index.d.ts CHANGED
@@ -74,7 +74,7 @@ export declare interface CardConfig {
74
74
  */
75
75
  export declare interface ConfigError {
76
76
  readonly _tag: 'ConfigError';
77
- readonly type: 'empty_sections' | 'missing_field' | 'duplicate_prefix' | 'invalid_icon' | 'invalid_entry' | 'missing_nav_icon';
77
+ readonly type: 'empty_sections' | 'missing_field' | 'duplicate_prefix' | 'invalid_icon' | 'invalid_entry';
78
78
  readonly message: string;
79
79
  }
80
80
 
@@ -251,12 +251,6 @@ export declare interface Entry {
251
251
  * @default "overview"
252
252
  */
253
253
  readonly indexFile?: string;
254
- /**
255
- * Iconify icon identifier for sidebar icon rail display.
256
- * Format: `"prefix:name"` (e.g., `"pixelarticons:folder"`, `"devicon:typescript"`).
257
- * Only meaningful on top-level sections — ignored on leaf pages.
258
- */
259
- readonly icon?: string;
260
254
  /**
261
255
  * Card display metadata for the parent section's auto-generated landing page.
262
256
  *
@@ -461,12 +455,6 @@ export declare interface NavItem {
461
455
  readonly link?: UrlPath;
462
456
  readonly items?: readonly NavItem[];
463
457
  readonly activeMatch?: string;
464
- /**
465
- * Iconify icon identifier for nav bar display.
466
- * Format: `"prefix:name"` (e.g., `"pixelarticons:folder"`, `"devicon:typescript"`).
467
- * Required on top-level nav items when nav is explicit (validated at config boundary).
468
- */
469
- readonly icon?: string;
470
458
  }
471
459
 
472
460
  /**
@@ -662,10 +650,6 @@ export declare interface SidebarItem {
662
650
  */
663
651
  readonly collapsed?: boolean;
664
652
  readonly items?: readonly SidebarItem[];
665
- /**
666
- * Iconify identifier for sidebar icon rail. Only present on top-level sections.
667
- */
668
- readonly icon?: string;
669
653
  }
670
654
 
671
655
  /**
package/dist/index.mjs CHANGED
@@ -90,11 +90,6 @@ function validateConfig(config) {
90
90
  featErr,
91
91
  null
92
92
  ];
93
- const [navErr] = validateNav(config.nav);
94
- if (navErr) return [
95
- navErr,
96
- null
97
- ];
98
93
  return [
99
94
  null,
100
95
  config
@@ -227,29 +222,6 @@ function validateFeature(feature) {
227
222
  if (feature.icon && !feature.icon.includes(':')) return configError('invalid_icon', `Feature "${feature.text}": icon must be an Iconify identifier (e.g. "pixelarticons:speed-fast")`);
228
223
  return null;
229
224
  }
230
- function validateNav(nav) {
231
- if ('auto' === nav || void 0 === nav) return [
232
- null,
233
- true
234
- ];
235
- const navError = nav.reduce((acc, item)=>{
236
- if (acc) return acc;
237
- return validateNavItem(item);
238
- }, null);
239
- if (navError) return [
240
- navError,
241
- null
242
- ];
243
- return [
244
- null,
245
- true
246
- ];
247
- }
248
- function validateNavItem(item) {
249
- if (!item.icon) return configError('missing_nav_icon', `NavItem "${item.text}": top-level nav items require an "icon" (Iconify identifier)`);
250
- if (!item.icon.includes(':')) return configError('invalid_icon', `NavItem "${item.text}": icon must be an Iconify identifier (e.g. "pixelarticons:folder")`);
251
- return null;
252
- }
253
225
  async function config_loadConfig(dir) {
254
226
  const { config } = await loadConfig({
255
227
  cwd: dir,
@@ -1457,7 +1429,7 @@ function buildFeatures(sections, repoRoot) {
1457
1429
  return Promise.all(sections.slice(0, 3).map(async (section, index)=>{
1458
1430
  const link = section.link ?? findFirstChildLink(section);
1459
1431
  const details = await extractSectionDescription(section, repoRoot);
1460
- const iconId = match(section.icon).with(P.nonNullable, (id)=>id).otherwise(()=>null);
1432
+ const iconId = null;
1461
1433
  const iconColor = ICON_COLORS[index % ICON_COLORS.length];
1462
1434
  return {
1463
1435
  title: section.text,
@@ -2168,13 +2140,12 @@ function deduplicateByLink(entries) {
2168
2140
  });
2169
2141
  return result;
2170
2142
  }
2171
- function buildSidebarEntry(entry, icon) {
2143
+ function buildSidebarEntry(entry) {
2172
2144
  if (entry.items && entry.items.length > 0) return {
2173
2145
  text: entry.text,
2174
2146
  items: generateSidebar(entry.items),
2175
2147
  ...maybeCollapsed(entry.collapsible),
2176
- ...maybeLink(entry.link),
2177
- ...maybeIcon(icon)
2148
+ ...maybeLink(entry.link)
2178
2149
  };
2179
2150
  if (null === entry.link || void 0 === entry.link) {
2180
2151
  log.error(`[zpress] Leaf entry "${entry.text}" has no link — skipping`);
@@ -2184,33 +2155,28 @@ function buildSidebarEntry(entry, icon) {
2184
2155
  }
2185
2156
  return {
2186
2157
  text: entry.text,
2187
- link: entry.link,
2188
- ...maybeIcon(icon)
2158
+ link: entry.link
2189
2159
  };
2190
2160
  }
2191
- function generateSidebar(entries, icons) {
2161
+ function generateSidebar(entries) {
2192
2162
  const visible = entries.filter((e)=>!e.hidden);
2193
2163
  const pages = visible.filter((e)=>!e.items || 0 === e.items.length);
2194
2164
  const sections = visible.filter((e)=>e.items && e.items.length > 0);
2195
2165
  return [
2196
2166
  ...pages,
2197
2167
  ...sections
2198
- ].map((entry)=>{
2199
- const icon = resolveIcon(icons, entry.text);
2200
- return buildSidebarEntry(entry, icon);
2201
- });
2168
+ ].map(buildSidebarEntry);
2202
2169
  }
2203
- function buildNavEntry(entry, icon) {
2170
+ function buildNavEntry(entry) {
2204
2171
  const link = sidebar_resolveLink(entry);
2205
2172
  const children = resolveChildren(entry);
2206
2173
  return {
2207
2174
  text: entry.text,
2208
2175
  link,
2209
- ...maybeIcon(icon),
2210
2176
  ...maybeChildren(children)
2211
2177
  };
2212
2178
  }
2213
- function generateNav(config, resolved, icons) {
2179
+ function generateNav(config, resolved) {
2214
2180
  if ('auto' !== config.nav && void 0 !== config.nav) return [
2215
2181
  ...config.nav
2216
2182
  ];
@@ -2220,7 +2186,7 @@ function generateNav(config, resolved, icons) {
2220
2186
  return [
2221
2187
  ...nonIsolated,
2222
2188
  ...isolated
2223
- ].map((entry)=>buildNavEntry(entry, icons.get(entry.text))).filter((item)=>void 0 !== item.link);
2189
+ ].map(buildNavEntry).filter((item)=>void 0 !== item.link);
2224
2190
  }
2225
2191
  function sidebar_findFirstLink(entry) {
2226
2192
  if (entry.link) return entry.link;
@@ -2241,15 +2207,6 @@ function maybeLink(link) {
2241
2207
  };
2242
2208
  return {};
2243
2209
  }
2244
- function maybeIcon(icon) {
2245
- if (icon) return {
2246
- icon
2247
- };
2248
- return {};
2249
- }
2250
- function resolveIcon(icons, text) {
2251
- if (icons) return icons.get(text);
2252
- }
2253
2210
  function sidebar_resolveLink(entry) {
2254
2211
  if (entry.link) return entry.link;
2255
2212
  return sidebar_findFirstLink(entry);
@@ -2379,10 +2336,10 @@ function resolveTags(tags) {
2379
2336
  ...tags
2380
2337
  ];
2381
2338
  }
2382
- function buildMultiSidebar(resolved, openapiSidebar, icons) {
2339
+ function buildMultiSidebar(resolved, openapiSidebar) {
2383
2340
  const rootEntries = resolved.filter((e)=>!e.isolated);
2384
2341
  const isolatedEntries = resolved.filter((e)=>e.isolated && e.link);
2385
- const docsSidebar = generateSidebar(rootEntries, icons);
2342
+ const docsSidebar = generateSidebar(rootEntries);
2386
2343
  const childrenByLink = new Map(isolatedEntries.map((entry)=>{
2387
2344
  const link = entry.link;
2388
2345
  const items = resolveEntryItems(entry.items);
@@ -2394,23 +2351,19 @@ function buildMultiSidebar(resolved, openapiSidebar, icons) {
2394
2351
  const isolatedSidebar = Object.fromEntries(isolatedEntries.flatMap((entry)=>{
2395
2352
  const entryLink = entry.link;
2396
2353
  const children = resolveChildrenByLink(childrenByLink, entryLink);
2397
- const icon = icons.get(entry.text);
2398
2354
  const parentLink = resolveParentLink(entryLink);
2399
2355
  const parentEntry = match(parentLink).with(P.nonNullable, (pl)=>isolatedEntries.find((e)=>e.link === pl)).otherwise(()=>{});
2400
2356
  const isChild = null != parentEntry && parentEntry !== entry;
2401
2357
  const landing = {
2402
2358
  text: entry.text,
2403
- link: entryLink,
2404
- ...multi_maybeIcon(icon)
2359
+ link: entryLink
2405
2360
  };
2406
2361
  const sidebarItems = match(isChild).with(true, ()=>{
2407
2362
  const pe = parentEntry;
2408
2363
  const peLink = pe.link;
2409
- const parentIcon = icons.get(pe.text);
2410
2364
  const parentLanding = {
2411
2365
  text: pe.text,
2412
- link: peLink,
2413
- ...multi_maybeIcon(parentIcon)
2366
+ link: peLink
2414
2367
  };
2415
2368
  const siblings = isolatedEntries.filter((sib)=>{
2416
2369
  const sibLink = sib.link;
@@ -2480,12 +2433,6 @@ function resolveParentLink(entryLink) {
2480
2433
  if (segments) return segments;
2481
2434
  return null;
2482
2435
  }
2483
- function multi_maybeIcon(icon) {
2484
- if (icon) return {
2485
- icon
2486
- };
2487
- return {};
2488
- }
2489
2436
  function buildSidebarGroup(text, link, children, collapsed) {
2490
2437
  if (children.length > 0) return {
2491
2438
  text,
@@ -2522,7 +2469,6 @@ function synthesizeWorkspaceSections(config) {
2522
2469
  text: 'Apps',
2523
2470
  link: '/apps',
2524
2471
  isolated: true,
2525
- icon: 'pixelarticons:device-laptop',
2526
2472
  frontmatter: {
2527
2473
  description: 'Deployable applications that make up the platform.'
2528
2474
  },
@@ -2532,7 +2478,6 @@ function synthesizeWorkspaceSections(config) {
2532
2478
  text: 'Packages',
2533
2479
  link: '/packages',
2534
2480
  isolated: true,
2535
- icon: 'pixelarticons:archive',
2536
2481
  frontmatter: {
2537
2482
  description: 'Shared libraries and utilities consumed across apps and services.'
2538
2483
  },
@@ -2545,7 +2490,6 @@ function synthesizeWorkspaceSections(config) {
2545
2490
  text: group.name,
2546
2491
  link,
2547
2492
  isolated: true,
2548
- icon: group.icon,
2549
2493
  frontmatter: {
2550
2494
  description: group.description
2551
2495
  },
@@ -2766,9 +2710,8 @@ async function sync(config, options) {
2766
2710
  skipped: 0
2767
2711
  }));
2768
2712
  const removed = await match(previousManifest).with(P.nonNullable, async (m)=>await cleanStaleFiles(outDir, m, ctx.manifest)).otherwise(()=>Promise.resolve(0));
2769
- const icons = buildIconMap(allSections);
2770
- const sortedSidebar = buildMultiSidebar(resolved, openapiSidebar, icons);
2771
- const nav = generateNav(config, resolved, icons);
2713
+ const sortedSidebar = buildMultiSidebar(resolved, openapiSidebar);
2714
+ const nav = generateNav(config, resolved);
2772
2715
  await promises.writeFile(node_path.resolve(outDir, '.generated/sidebar.json'), JSON.stringify(sortedSidebar, null, 2), 'utf8');
2773
2716
  await promises.writeFile(node_path.resolve(outDir, '.generated/nav.json'), JSON.stringify(nav, null, 2), 'utf8');
2774
2717
  await saveManifest(outDir, ctx.manifest);
@@ -2864,17 +2807,6 @@ async function copyAll(src, dest) {
2864
2807
  else await promises.copyFile(srcPath, destPath);
2865
2808
  }, Promise.resolve());
2866
2809
  }
2867
- function buildIconMap(sections) {
2868
- return new Map(sections.flatMap((section)=>{
2869
- if (section.icon) return [
2870
- [
2871
- section.text,
2872
- section.icon
2873
- ]
2874
- ];
2875
- return [];
2876
- }));
2877
- }
2878
2810
  function resolveQuiet(quiet) {
2879
2811
  if (null != quiet) return quiet;
2880
2812
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zpress/core",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Config loading, sync engine, and asset utilities for zpress",
5
5
  "keywords": [
6
6
  "config",