ab-nextjs-components 0.4.2 โ†’ 0.6.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.
Files changed (89) hide show
  1. package/CHANGELOG.md +81 -17
  2. package/README.md +16 -2
  3. package/ab-app-bar/index.tsx +5 -5
  4. package/ab-app-bar/styles.module.css +5 -5
  5. package/ab-bottom-drawer/index.tsx +3 -3
  6. package/ab-bottom-drawer/styles.module.css +2 -2
  7. package/ab-bottom-drawer/use-ab-swipe-down.ts +1 -1
  8. package/ab-breadcrumbs/index.tsx +1 -1
  9. package/ab-breadcrumbs/styles.module.css +5 -5
  10. package/ab-button/index.tsx +1 -1
  11. package/ab-button/styles.module.css +5 -5
  12. package/ab-callout/index.tsx +1 -1
  13. package/ab-callout/styles.module.css +1 -1
  14. package/ab-carousel/helpers.ts +1 -1
  15. package/ab-carousel/index.tsx +4 -4
  16. package/ab-carousel/styles.module.css +2 -2
  17. package/ab-chip/styles.module.css +1 -1
  18. package/ab-code-block/focus.tsx +63 -0
  19. package/ab-code-block/index.tsx +55 -28
  20. package/ab-code-block/styles.module.css +4 -3
  21. package/ab-content-tabs/index.tsx +25 -3
  22. package/ab-demo-box/index.tsx +45 -7
  23. package/ab-demo-box/styles.module.css +19 -7
  24. package/ab-demo-code/index.tsx +38 -34
  25. package/ab-demo-code/styles.module.css +3 -41
  26. package/ab-doc-pager/index.tsx +1 -1
  27. package/ab-drawer/gestures.ts +1 -1
  28. package/ab-drawer/index.tsx +12 -4
  29. package/ab-drawer/kit.module.css +13 -13
  30. package/ab-drawer/styles.module.css +2 -2
  31. package/ab-drawer/use-ab-edge-swipe.ts +2 -2
  32. package/ab-flow-diagram/helpers.ts +2 -2
  33. package/ab-flow-diagram/index.tsx +2 -2
  34. package/ab-flow-diagram/styles.module.css +3 -3
  35. package/ab-icon/builtin.ts +4 -0
  36. package/ab-icon/helpers.ts +1 -1
  37. package/ab-icon/index.tsx +3 -3
  38. package/ab-icon/registrar.tsx +1 -1
  39. package/ab-icon-button/index.tsx +1 -1
  40. package/ab-install-snippet/styles.module.css +1 -1
  41. package/ab-link/index.tsx +2 -2
  42. package/ab-link/locale.ts +1 -1
  43. package/ab-list/styles.module.css +1 -1
  44. package/ab-locale-switcher/index.tsx +6 -6
  45. package/ab-locale-switcher/styles.module.css +5 -5
  46. package/ab-mobile-header/index.tsx +6 -6
  47. package/ab-nav-drawer/index.tsx +11 -6
  48. package/ab-navbar/index.tsx +1 -1
  49. package/ab-navbar/styles.module.css +1 -1
  50. package/ab-navbar/view.tsx +1 -1
  51. package/ab-package-card/index.tsx +3 -3
  52. package/ab-package-card/previews.tsx +1 -1
  53. package/ab-package-card/styles.module.css +2 -2
  54. package/ab-playground-scene/i18n.module.css +1 -1
  55. package/ab-playground-scene/icons.tsx +1 -1
  56. package/ab-playground-scene/index.tsx +4 -4
  57. package/ab-playground-scene/labels.ts +3 -3
  58. package/ab-playground-scene/scenes.tsx +4 -4
  59. package/ab-playground-scene/styles.module.css +6 -6
  60. package/ab-playground-scene/upgraded.tsx +3 -3
  61. package/ab-playground-scene/welcome.tsx +1 -1
  62. package/ab-preview-code/index.tsx +115 -0
  63. package/ab-preview-code/stage.tsx +153 -0
  64. package/ab-preview-code/styles.module.css +43 -0
  65. package/ab-progress-chips/index.tsx +1 -1
  66. package/ab-search-drawer/index.tsx +4 -4
  67. package/ab-search-trigger/index.tsx +5 -5
  68. package/ab-search-trigger/styles.module.css +3 -3
  69. package/ab-settings-drawer/index.tsx +2 -2
  70. package/ab-sidebar/active.ts +105 -0
  71. package/ab-sidebar/index.tsx +10 -6
  72. package/ab-sidebar/profile-button.tsx +2 -2
  73. package/ab-sidebar/styles.module.css +4 -4
  74. package/ab-sidebar/view.tsx +16 -8
  75. package/ab-theme-mode/index.tsx +3 -3
  76. package/ab-theme-toggle/index.tsx +6 -6
  77. package/ab-theme-toggle/styles.module.css +2 -2
  78. package/ab-toc/index.tsx +3 -3
  79. package/ab-toc/promo.tsx +2 -2
  80. package/ab-toc/styles.module.css +1 -1
  81. package/ab-toc-drawer/index.tsx +1 -1
  82. package/ab-version-switcher/index.tsx +2 -2
  83. package/css/dialog.css +1 -1
  84. package/index.ts +29 -18
  85. package/package.json +3 -1
  86. package/server/ab-button/index.tsx +1 -1
  87. package/server/ab-icon/index.tsx +2 -2
  88. package/server/ab-sidebar/index.tsx +3 -2
  89. package/types/index.d.ts +8 -7
@@ -0,0 +1,105 @@
1
+ /*
2
+ * @license MIT
3
+ * ~~~~~~~~~~~~
4
+ * ab-nextjs-components
5
+ * ~~~~~~~~~~~~
6
+ * Copyright (c) 2026 Abraham Ukachi. The abElements Project.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the 'Software'), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ *
26
+ *
27
+ * @project: ab-nextjs-components
28
+ * @name: Active nav item matching (0.5.0)
29
+ * @file: ab-sidebar/active.ts
30
+ * @type: Pure helpers (client + server)
31
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
32
+ *
33
+ * Example usage:
34
+ * 1+|> getAbActiveHrefs(['/docs', '/docs/x'], '/docs/x?tab=1#top') // โ†’ Set { '/docs/x' } (longest match only)
35
+ * 2+|> getAbActiveHrefs(['/docs', '/docs/x'], '/docs/x', { match: 'prefix' }) // โ†’ Set { '/docs', '/docs/x' }
36
+ */
37
+
38
+ /*
39
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
40
+ * MOTTO: We'll always do more ๐Ÿ˜œ!!!
41
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
42
+ */
43
+
44
+ // ๐Ÿง  no 'use client': AbSidebar (both twins) and AbNavDrawer share these, so one rule lights every nav
45
+
46
+ // ๐ŸŒ locale-prefix stripping (`/fr/docs` โ†’ `/docs`)
47
+ import { stripAbLocalePrefix } from '../ab-link/locale';
48
+
49
+ /**
50
+ * ๐ŸŽฏ How an item's href is matched against the current route.
51
+ *
52
+ * - `'best'` (default): prefix matching, but only the **longest** matching href wins, so `/docs` and
53
+ * `/docs/x` never light up together on `/docs/x`. On `/docs/y` (not in the list) `/docs` still lights.
54
+ * - `'prefix'`: every parent of the route is active (the pre-0.5.0 behaviour; can double-highlight).
55
+ * - `'exact'`: only the item whose href equals the route.
56
+ */
57
+ export type AbActiveMatch = 'best' | 'prefix' | 'exact';
58
+
59
+ /** ๐Ÿ”— anything with an href, plus an optional per-item override (`exact: true` = never a parent match) */
60
+ export interface AbActiveMatchable { href: string; exact?: boolean }
61
+
62
+ /** โš™๏ธ options shared by the helpers */
63
+ export interface AbActiveMatchOptions {
64
+ match?: AbActiveMatch; // ๐ŸŽฏ default 'best'
65
+ locales?: readonly string[]; // ๐ŸŒ stripped from the current route first (e.g. ['en', 'fr'])
66
+ }
67
+
68
+ /** ๐Ÿงน normalise a path: drop `?query` and `#hash`, and a trailing slash (but `/` stays `/`) */
69
+ export function normalizeAbHref(href: string): string {
70
+ const path = href.split(/[?#]/)[0] || '/'; // โœ‚๏ธ query + hash (a bare "?x" is the root)
71
+ const trimmed = path.replace(/\/+$/, ''); // โœ‚๏ธ trailing slashes
72
+ return trimmed === '' ? '/' : trimmed; // ๐Ÿ 
73
+ }
74
+
75
+ /** ๐ŸŽฏ does one href match the route? `exact` = equality only; otherwise equality or a parent segment */
76
+ export function matchAbHref(href: string, current: string, exact = false): boolean {
77
+ const h = normalizeAbHref(href); const c = normalizeAbHref(current); // ๐Ÿงน both sides
78
+ if (h === c) return true; // โœ… exact
79
+ if (exact || h === '/') return false; // ๐Ÿ™… "/" only ever matches itself
80
+ return c.startsWith(`${h}/`); // ๐ŸŒณ a whole-segment parent (`/doc` never matches `/docs`)
81
+ }
82
+
83
+ /**
84
+ * ๐Ÿฅ‡ the set of active hrefs (normalised) among `items` for the route `current`.
85
+ * An item's own `exact` wins over `match`; `exact: false` on an item allows prefix matching even when `match='exact'`.
86
+ */
87
+ export function getAbActiveHrefs(items: ReadonlyArray<AbActiveMatchable | string>, current: string | undefined, options: AbActiveMatchOptions = {}): Set<string> {
88
+ const out = new Set<string>(); // ๐Ÿ“ฆ
89
+ if (!current) return out; // ๐Ÿšซ no route
90
+ const { match = 'best', locales } = options;
91
+ const route = stripAbLocalePrefix(current, locales); // ๐ŸŒ
92
+ const hits = items
93
+ .map((it) => (typeof it === 'string' ? { href: it } : it)) // ๐Ÿ” plain strings welcome
94
+ .filter((it) => matchAbHref(it.href, route, it.exact ?? match === 'exact')) // ๐ŸŽฏ per-item override first
95
+ .map((it) => normalizeAbHref(it.href)); // ๐Ÿงน
96
+ if (match !== 'best') { hits.forEach((h) => out.add(h)); return out; } // ๐ŸŒณ prefix / exact: all hits
97
+ const longest = hits.reduce((a, h) => (h.length > a.length ? h : a), ''); // ๐Ÿฅ‡ the deepest match
98
+ if (longest) out.add(longest); // โœ… one href (two items sharing it both light, which is intended)
99
+ return out;
100
+ }
101
+
102
+ /** ๐ŸŒณ flatten nested items (`items` children) into one list, so a child can out-match its parent */
103
+ export function flattenAbNavItems<T extends AbActiveMatchable & { items?: readonly T[] }>(items: readonly T[]): T[] {
104
+ return items.flatMap((it) => [it, ...(it.items ? flattenAbNavItems(it.items) : [])]); // ๐Ÿ” depth-first
105
+ }
@@ -48,20 +48,23 @@
48
48
  import { useState, type ReactElement } from 'react';
49
49
  // ๐Ÿงญ current route (fallback when `activeHref` is omitted)
50
50
  import { usePathname } from 'next/navigation';
51
- // ๐ŸŒ 0.1.13 (Joseph #10): locale-stripped pathname
51
+ // ๐ŸŒ 0.1.13 (#10): locale-stripped pathname
52
52
  import { stripAbLocalePrefix, useAbLocales } from '../ab-link';
53
53
  // ๐Ÿ”ฃ client AbIcon (built-in chevrons are always registered)
54
54
  import AbIcon from '../ab-icon';
55
55
  // ๐Ÿ–ผ๏ธ shared view
56
- import { AbSidebarView, isAbSidebarActive, type AbSidebarBaseProps } from './view';
56
+ import { AbSidebarView, createAbSidebarActive, toAbSidebarSections, type AbSidebarBaseProps } from './view';
57
57
  // ๐ŸŽจ styles
58
58
  import styles from './styles.module.css';
59
- // ๐Ÿ‘ค 0.2.1 (God 02:44): the bottom-left profile button (โ‰ฅ 1180px, CSS)
59
+ // ๐Ÿ‘ค 0.2.1: the bottom-left profile button (โ‰ฅ 1180px, CSS)
60
60
  import AbSidebarProfileButton, { type AbSidebarProfileButtonProps } from './profile-button';
61
61
 
62
62
  // ๐Ÿ“ฆ re-export the shared types
63
63
  export type { AbSidebarItem, AbSidebarSection, AbSidebarLink, AbSidebarLabels } from './view';
64
- export { isAbSidebarActive, toAbSidebarSections } from './view';
64
+ export { isAbSidebarActive, toAbSidebarSections, createAbSidebarActive } from './view';
65
+ // ๐ŸŽฏ 0.5.0: the shared active-matching helpers + types (AbNavDrawer uses them too)
66
+ export { getAbActiveHrefs, matchAbHref, normalizeAbHref, flattenAbNavItems } from './active';
67
+ export type { AbActiveMatch, AbActiveMatchable, AbActiveMatchOptions } from './active';
65
68
  export { AbSidebarProfileButton, type AbSidebarProfileButtonProps } from './profile-button';
66
69
 
67
70
  /** โš™๏ธ Client props: the shared ones + collapse control. */
@@ -69,7 +72,7 @@ export interface AbSidebarProps extends AbSidebarBaseProps {
69
72
  defaultCollapsed?: boolean; // ๐Ÿšช uncontrolled start
70
73
  onCollapsedChange?: (collapsed: boolean) => void; // ๐Ÿ””
71
74
  collapsible?: boolean; // ๐Ÿ”˜ show the collapse button (default true when sections are given)
72
- // ๐Ÿ‘ค 0.2.1 (God 02:44): opt-in; pass `user` + the AbSettingsDrawer props for a profile button at the bottom left
75
+ // ๐Ÿ‘ค 0.2.1: opt-in; pass `user` + the AbSettingsDrawer props for a profile button at the bottom left
73
76
  profile?: Omit<AbSidebarProfileButtonProps, 'collapsed'>;
74
77
  collapseButtonVariant?: 'plain' | 'outlined'; // โช 0.1.14 (P9): 'outlined' = 32ร—32 bordered `<<` / `>>` (default 'plain' chevron)
75
78
  }
@@ -92,7 +95,8 @@ const AbSidebar = (props: AbSidebarProps): ReactElement => {
92
95
  onCollapsedChange?.(next); // ๐Ÿ””
93
96
  };
94
97
  // ๐ŸŽฏ legacy `page` wins, then activeHref, then the pathname
95
- const active = (href: string, value?: string) => (page ? page === value : isAbSidebarActive(href, activeHref ?? pathname));
98
+ const isOn = createAbSidebarActive(toAbSidebarSections(props.sections, props.links), activeHref ?? pathname, props.activeMatch); // ๐Ÿฅ‡ 0.5.0: deepest match by default
99
+ const active = (href: string, value?: string) => (page ? page === value : isOn(href));
96
100
  // ๐Ÿ”˜ the toggle
97
101
  const showToggle = collapsible ?? !!props.sections?.length;
98
102
  const toggleLabel = collapsed ? labels?.expand ?? 'Expand sidebar' : labels?.collapse ?? 'Collapse sidebar';
@@ -24,7 +24,7 @@
24
24
  * SOFTWARE.
25
25
  *
26
26
  * @project: ab-nextjs-components
27
- * @name: AbSidebarProfileButton - Client (0.2.1, God 02:44)
27
+ * @name: AbSidebarProfileButton - Client (0.2.1)
28
28
  * @file: ab-sidebar/profile-button.tsx
29
29
  * @type: Client Component
30
30
  * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
@@ -71,7 +71,7 @@ export interface AbSidebarProfileButtonProps extends Omit<AbSettingsDrawerProps,
71
71
  }
72
72
 
73
73
  /**
74
- * ๐Ÿ‘ค AbSidebarProfileButton โ€” the bottom-left sidebar control (God 02:44, replaces the 0.2.1-draft settings icon
74
+ * ๐Ÿ‘ค AbSidebarProfileButton โ€” the bottom-left sidebar control (replaces the 0.2.1-draft settings icon
75
75
  * button): a 40px profile circle (signed out: the profile glyph; signed in: the initials on the container colour, or
76
76
  * the photo masked to a circle) + the name when the sidebar is expanded. Tapping it opens AbSettingsDrawer.
77
77
  *
@@ -117,7 +117,7 @@
117
117
  text-decoration: none; /* ๐Ÿšซ */
118
118
  color: inherit; /* ๐Ÿ–‹๏ธ */
119
119
  font-weight: 500; /* ๐Ÿ”ค */
120
- /* ๐Ÿ”ค 0.1.13 (Joseph #15): M3 label-large, so names stop inheriting the big body size and wrapping at 280px */
120
+ /* ๐Ÿ”ค 0.1.13 (#15): M3 label-large, so names stop inheriting the big body size and wrapping at 280px */
121
121
  font-family: var(--md-sys-typescale-label-large-font, inherit);
122
122
  font-size: var(--md-sys-typescale-label-large-size, 14px);
123
123
  line-height: var(--md-sys-typescale-label-large-line-height, 20px);
@@ -175,7 +175,7 @@
175
175
  padding: 0; border-radius: 0; background: none; line-height: 1; /* ๐Ÿงน no chip */
176
176
  font: 500 10.5px var(--ab-font-code, 'Roboto Mono', ui-monospace, monospace); color: var(--ab-color-faint, #807062); /* โŒจ๏ธ */
177
177
  }
178
- /* โ™ฟ James: faint on --tint is 3.9:1, so on the active row the text badge takes the row's --accent-text (โ‰ฅ 4.5:1 on tint) */
178
+ /* โ™ฟ faint on --tint is 3.9:1, so on the active row the text badge takes the row's --accent-text (โ‰ฅ 4.5:1 on tint) */
179
179
  .abSidebar[data-badge='text'] .abSidebarLink[data-active='true'] .abSidebarBadge { color: inherit; }
180
180
  /* โช P9: outlined collapse, 32ร—32, radius 8, 1px --border, --card, --muted */
181
181
  .abSidebarToggle[data-variant='outlined'] {
@@ -188,7 +188,7 @@
188
188
  .abSidebar[data-density='compact'][data-collapsed='true'] .abSidebarSections { padding-inline: 8px; }
189
189
  .abSidebar[data-density='compact'][data-collapsed='true'] .abSidebarLink { width: 40px; height: 40px; } /* ๐Ÿ‘† */
190
190
 
191
- /* ๐Ÿท๏ธ 0.1.15 (God 00:08): the tablet logo row, mock 06 `.sb-logo` = 60px, 0 20px, centred, never shrinks.
191
+ /* ๐Ÿท๏ธ 0.1.15: the tablet logo row, mock 06 `.sb-logo` = 60px, 0 20px, centred, never shrinks.
192
192
  * Height follows core's --ab-header-height (60px at tablet) so it lines up with the main bar. */
193
193
  .abSidebarLogo { flex: none; display: flex; align-items: center; box-sizing: border-box; height: var(--ab-header-height, 60px); padding: 0 20px; }
194
194
  .abSidebar[data-collapsed='true'] .abSidebarLogo { justify-content: center; padding: 0; } /* ๐Ÿšช rail: centred */
@@ -207,7 +207,7 @@
207
207
  .abSidebar[data-collapsed='true'] .abSidebarFooter { justify-content: center; } /* ๐Ÿšช rail: centred */
208
208
  .abSidebar { min-height: 100%; } /* ๐Ÿ“ fill the pane so the footer can reach the bottom */
209
209
  .abSidebar[data-density='compact'] .abSidebarFooter { padding: 8px 10px 12px; box-sizing: border-box; width: 100%; } /* ๐Ÿ“ฆ compact: line up with the rows (sections pad 10px) */
210
- /* ๐Ÿ‘ค 0.2.1 (God 02:44): the profile button: avatar (+ the name when expanded), theme tokens only */
210
+ /* ๐Ÿ‘ค 0.2.1: the profile button: avatar (+ the name when expanded), theme tokens only */
211
211
  .abSidebarProfile {
212
212
  display: inline-flex; /* ๐Ÿ“ */
213
213
  align-items: center; /* โ†•๏ธ */
@@ -46,16 +46,19 @@ import Link from '../ab-link';
46
46
  import AbBalloon from '../ab-balloon';
47
47
  // ๐ŸŽจ styles
48
48
  import styles from './styles.module.css';
49
+ // ๐ŸŽฏ 0.5.0: one active-matching rule for AbSidebar + AbNavDrawer (longest match by default)
50
+ import { flattenAbNavItems, getAbActiveHrefs, matchAbHref, normalizeAbHref, type AbActiveMatch } from './active';
49
51
 
50
52
  /** ๐Ÿ”— One sidebar destination (G40). `items` = one level of children, shown under the parent. */
51
53
  export interface AbSidebarItem {
52
- id?: string; // ๐Ÿ†” 0.1.13 (James nit): stable React key when two items share an href (default: `href`)
54
+ id?: string; // ๐Ÿ†” 0.1.13 (nit): stable React key when two items share an href (default: `href`)
53
55
  href: string; // ๐Ÿ”—
54
56
  icon?: string; // ๐Ÿ”ฃ AbIcons name: outlined, filled when active
55
- label: ReactNode; // ๐Ÿท๏ธ 0.1.13: any node (Joseph #15), e.g. a mono package name
57
+ label: ReactNode; // ๐Ÿท๏ธ 0.1.13: any node (#15), e.g. a mono package name
56
58
  labelText?: string; // โ™ฟ plain-text name for the rail tooltip/aria-label when `label` isn't a string
57
59
  badge?: ReactNode; // ๐Ÿ”ด e.g. "New" or a count
58
60
  items?: AbSidebarItem[]; // ๐ŸŒณ children
61
+ exact?: boolean; // ๐ŸŽฏ 0.5.0: true = active on its own href only (never as a parent); false = allow parent matching even under activeMatch="exact"
59
62
  }
60
63
 
61
64
  /** ๐Ÿ—‚๏ธ A labelled group of items. */
@@ -90,7 +93,8 @@ export interface AbSidebarBaseProps {
90
93
  className?: string; // ๐Ÿท๏ธ
91
94
  id?: string; // ๐Ÿ†” the list id (aria-controls target), default "ab-sidebar-list"
92
95
  sections?: AbSidebarSection[]; // ๐Ÿ—‚๏ธ G40
93
- activeHref?: string; // ๐ŸŽฏ current route (exact or a parent prefix)
96
+ activeHref?: string; // ๐ŸŽฏ current route (query, hash and a trailing slash are ignored)
97
+ activeMatch?: AbActiveMatch; // ๐ŸŽฏ 0.5.0: 'best' (default, deepest match only), 'prefix' (every parent too) or 'exact'
94
98
  collapsed?: boolean; // ๐Ÿšช icon rail
95
99
  header?: ReactNode; // ๐Ÿท๏ธ top slot (brand, workspace switcherโ€ฆ)
96
100
  labels?: AbSidebarLabels; // ๐ŸŒ
@@ -99,7 +103,7 @@ export interface AbSidebarBaseProps {
99
103
  density?: 'comfortable' | 'compact'; // ๐Ÿ“ 'compact' = 32px rows, 13.5/500, 18px icons, 11px group labels
100
104
  activeShape?: 'pill' | 'rounded'; // ๐Ÿ”ท 'rounded' = 8px-radius --tint row (default 'pill')
101
105
  badgeVariant?: 'chip' | 'text'; // ๐Ÿท๏ธ 'text' = plain mono 10.5 --faint meta (e.g. a version), no chip
102
- // ๐Ÿท๏ธ 0.1.15 (God 00:08): a 60px logo row above `header` (mock 06 `.sb-logo`). With core โ‰ฅ 0.2.1 panes it only shows
106
+ // ๐Ÿท๏ธ 0.1.15: a 60px logo row above `header` (mock 06 `.sb-logo`). With core โ‰ฅ 0.2.1 panes it only shows
103
107
  // where the app header is hidden (tabletHeader="main" at 768โ€“1179); elsewhere it always shows
104
108
  logo?: ReactNode;
105
109
  footer?: ReactNode; // ๐Ÿฆถ 0.2.1: a bottom slot pinned to the bottom left (e.g. AbSidebarProfileButton)
@@ -111,11 +115,15 @@ export interface AbSidebarBaseProps {
111
115
  brandLabel?: string;
112
116
  }
113
117
 
114
- /** ๐ŸŽฏ Is `href` the current route, or a parent of it? */
118
+ /** ๐ŸŽฏ Is `href` the current route, or a parent of it? (single-item prefix check; lists use `getAbActiveHrefs`) */
115
119
  export function isAbSidebarActive(href: string, activeHref?: string): boolean {
116
- if (!activeHref) return false; // ๐Ÿšซ
117
- if (href === activeHref) return true; // โœ… exact
118
- return href !== '/' && activeHref.startsWith(`${href.replace(/\/$/, '')}/`); // ๐ŸŒณ parent
120
+ return !!activeHref && matchAbHref(href, activeHref); // ๐ŸŒณ query / hash / trailing slash tolerant since 0.5.0
121
+ }
122
+
123
+ /** ๐ŸŽฏ 0.5.0: an `active(href)` checker for a whole sidebar, using `activeMatch` + each item's `exact` */
124
+ export function createAbSidebarActive(groups: AbSidebarSection[], current: string | undefined, match?: AbActiveMatch): (href: string) => boolean {
125
+ const on = getAbActiveHrefs(groups.flatMap((g) => flattenAbNavItems(g.items)), current, { match }); // ๐Ÿฅ‡ resolved once per render
126
+ return (href) => on.has(normalizeAbHref(href)); // โœ…
119
127
  }
120
128
 
121
129
  /** ๐Ÿ—‚๏ธ sections, or the legacy links as one unlabelled section. */
@@ -60,7 +60,7 @@ export interface AbThemeModeProviderProps {
60
60
  }
61
61
 
62
62
  /**
63
- * ๐ŸŒ— AbThemeModeProvider โ€” 0.2.3 (Joseph, Welcome 0.2.21): ONE theme state for the whole app. Each AbThemeToggle
63
+ * ๐ŸŒ— AbThemeModeProvider โ€” 0.2.3 (Welcome 0.2.21): ONE theme state for the whole app. Each AbThemeToggle
64
64
  * (laptop sidebar, Settings sheet) and AbMobileHeader's 3-state button used to run its own engine, so they drifted
65
65
  * across 768px. Under this provider they all read and write this one engine (still persisted under the `theme`
66
66
  * key, still following the OS in 'system'). Put it once, high in the tree (e.g. around AbAppLayout).
@@ -80,10 +80,10 @@ export function useAbThemeModeContext(): AbThemeModeContextValue | null {
80
80
 
81
81
  // ๐Ÿ“ฆ exports
82
82
  /**
83
- * ๐Ÿ”ฃ 0.3.2 (Joseph, 0.2.23 gaps): the ONE glyph per theme mode, shared by AbMobileHeader's theme button and
83
+ * ๐Ÿ”ฃ 0.3.2 (0.2.23 gaps): the ONE glyph per theme mode, shared by AbMobileHeader's theme button and
84
84
  * AbThemeToggle, so the two never drift apart (AbIcons names)
85
85
  */
86
- export const AB_THEME_MODE_ICONS: Readonly<Record<AbThemeMode, string>> = { light: 'light_mode', dark: 'dark_mode', system: 'brightness_auto' }; // ๐ŸŒž ๐ŸŒ™ ๐ŸŒ—๐Ÿ…ฐ๏ธ (0.3.2, God: brightness_auto everywhere, was 'computer')
86
+ export const AB_THEME_MODE_ICONS: Readonly<Record<AbThemeMode, string>> = { light: 'light_mode', dark: 'dark_mode', system: 'brightness_auto' }; // ๐ŸŒž ๐ŸŒ™ ๐ŸŒ—๐Ÿ…ฐ๏ธ (0.3.2, brightness_auto everywhere, was 'computer')
87
87
  /** ๐Ÿ“ 0.3.2: the glyph size of a single theme icon button (AbMobileHeader + AbThemeToggle variant="icon") */
88
88
  export const AB_THEME_ICON_BUTTON_GLYPH = 24; // ๐Ÿ“ px
89
89
 
@@ -66,7 +66,7 @@ export interface AbThemeToggleLabels {
66
66
  light: string; // ๐ŸŒž "Light"
67
67
  dark: string; // ๐ŸŒ™ "Dark"
68
68
  system: string; // ๐Ÿ–ฅ๏ธ "System"
69
- // ๐ŸŽฏ 0.1.14 (John): action names for the icon button when it shows the target mode,
69
+ // ๐ŸŽฏ 0.1.14: action names for the icon button when it shows the target mode,
70
70
  // e.g. { dark: 'Switch to dark theme', light: 'Switch to light theme' }. Falls back to "Theme: Dark"
71
71
  switchTo?: Partial<Record<AbThemeMode, string>>;
72
72
  }
@@ -82,15 +82,15 @@ export interface AbThemeToggleProps {
82
82
  icons?: Partial<Record<AbThemeMode, ReactNode>>; // ๐Ÿ–ผ๏ธ override glyphs
83
83
  size?: 'sm' | 'md'; // ๐Ÿ“ sm = 32px, md = 40px segments (hit area โ‰ฅ 24px either way)
84
84
  appearance?: 'fill' | 'thumb'; // ๐ŸŒ— 0.1.14 (P7): 'thumb' = the Home pill (28px segments, raised card thumb, filled active glyph). Default 'fill'
85
- // ๐ŸŽฏ 0.1.14 (John): icon variant only. 'target' = glyph + name of the mode a click switches TO
86
- // (moon in light, sun in dark, like the Home mock). 0.3.2 (God): default 'target' for every appearance (was 'current' for fill)
85
+ // ๐ŸŽฏ 0.1.14: icon variant only. 'target' = glyph + name of the mode a click switches TO
86
+ // (moon in light, sun in dark, like the Home mock). 0.3.2: default 'target' for every appearance (was 'current' for fill)
87
87
  iconShows?: 'current' | 'target';
88
88
  className?: string; // ๐Ÿท๏ธ
89
89
  style?: CSSProperties; // ๐ŸŽจ
90
90
  }
91
91
 
92
92
  // ๐Ÿ”ฃ default glyphs (AbIcons names)
93
- // ๐Ÿ”— 0.3.2 (Joseph): the shared map, so the glyphs match AbMobileHeader's theme button
93
+ // ๐Ÿ”— 0.3.2: the shared map, so the glyphs match AbMobileHeader's theme button
94
94
  const DEFAULT_ICON_NAMES: Readonly<Record<AbThemeMode, string>> = AB_THEME_MODE_ICONS;
95
95
 
96
96
  /**
@@ -144,7 +144,7 @@ function AbThemeToggleView(props: AbThemeToggleProps & { engine: Pick<AbThemeMod
144
144
 
145
145
  // ๐Ÿ–ผ๏ธ glyph for a mode (decorative: the label names it)
146
146
  // P7 thumb: 17px segments, filled while active (spec ยง2 icons)
147
- // 0.3.2 (Joseph): variant="icon" uses the header's 24px glyph (was 22 thumb / 20), so it matches AbMobileHeader
147
+ // 0.3.2: variant="icon" uses the header's 24px glyph (was 22 thumb / 20), so it matches AbMobileHeader
148
148
  const glyphSize = variant === 'icon' ? AB_THEME_ICON_BUTTON_GLYPH : thumb ? 17 : 20; // ๐Ÿ“
149
149
  const glyph = (mode: AbThemeMode, active = false) =>
150
150
  icons?.[mode] ?? <AbIcon name={DEFAULT_ICON_NAMES[mode]} size={glyphSize} variant={thumb && active ? 'filled' : undefined} />;
@@ -152,7 +152,7 @@ function AbThemeToggleView(props: AbThemeToggleProps & { engine: Pick<AbThemeMod
152
152
  // ๐Ÿ”˜ single cycling button variant
153
153
  if (variant === 'icon') {
154
154
  const next = modes[(Math.max(0, modes.indexOf(current)) + 1) % modes.length]; // โญ๏ธ
155
- const target = (iconShows ?? 'target') === 'target'; // ๐ŸŽฏ 0.3.2 (God): always the target by default, like AbMobileHeader (was 'current' for fill)
155
+ const target = (iconShows ?? 'target') === 'target'; // ๐ŸŽฏ 0.3.2: always the target by default, like AbMobileHeader (was 'current' for fill)
156
156
  const name = target ? (labels.switchTo?.[next] ?? `${labels.group}: ${labels[next]}`) : `${labels.group}: ${labels[current]}`; // โ™ฟ
157
157
  return (
158
158
  <button
@@ -61,7 +61,7 @@
61
61
  cursor: pointer; /* ๐Ÿ‘† */
62
62
  --ab-motion-duration: var(--ab-motion-duration-short, 160ms); /* ๐ŸŽž๏ธ colour fade = .ab-motion-colors (ab-nextjs-animations) */
63
63
  }
64
- /* ๐Ÿ‘† 0.3.2 (God, 0.2.23 gaps): the single icon button is a 44px tap target (was 40px), the same 44ร—44 as
64
+ /* ๐Ÿ‘† 0.3.2 (0.2.23 gaps): the single icon button is a 44px tap target (was 40px), the same 44ร—44 as
65
65
  AbMobileHeader's theme button; the segments keep 40/32px (radios inside one pill) */
66
66
  .icon {
67
67
  width: 44px; /* ๐Ÿ“ */
@@ -73,7 +73,7 @@
73
73
  height: 32px; /* ๐Ÿ“ */
74
74
  }
75
75
 
76
- /* ๐Ÿ‘† 0.3.2 (God): every radio segment and the sm icon button get an invisible 44ร—44 hit area centred on them, so
76
+ /* ๐Ÿ‘† 0.3.2: every radio segment and the sm icon button get an invisible 44ร—44 hit area centred on them, so
77
77
  the 40/32/28px visuals stay while the tap target is โ‰ฅ 44px (WCAG 2.5.5). Neighbouring areas overlap by a few px;
78
78
  the later segment wins there, which is fine for adjacent radios */
79
79
  .segment,
package/ab-toc/index.tsx CHANGED
@@ -62,7 +62,7 @@ export const AB_MAIN_SCROLLER_SELECTOR = '[data-ab-part="main-content"]';
62
62
  * Use it as `useAbScrollSpy({ root })` / `scrollToAbSection(id, { container })`.
63
63
  *
64
64
  * โš ๏ธ Call it only in an effect or an event handler, **never during render**: it reads the DOM, so a render
65
- * call returns `null` on the server and the element on the client (hydration mismatch). (James nit)
65
+ * call returns `null` on the server and the element on the client (hydration mismatch). (nit)
66
66
  */
67
67
  export function getAbMainScroller(from?: Element | null): HTMLElement | null {
68
68
  if (typeof document === 'undefined') return null; // ๐Ÿ–ฅ๏ธ SSR
@@ -86,7 +86,7 @@ export interface AbTocProps {
86
86
  items: AbTocItem[]; // ๐Ÿ“‘
87
87
  activeId?: string | null; // ๐ŸŽฏ e.g. from useAbScrollSpy (hooks 0.1.7)
88
88
  title?: string; // ๐Ÿท๏ธ default "On this page"
89
- label?: string; // ๐Ÿท๏ธ 0.1.13 (Joseph #16): alias of `title`; `title` wins when both are set
89
+ label?: string; // ๐Ÿท๏ธ 0.1.13 (#16): alias of `title`; `title` wins when both are set
90
90
  onNavigate?: (id: string) => void; // ๐Ÿ”” e.g. scrollToAbSection(id, { container }) (hooks 0.1.7); without it a plain #id jump, which scrolls the nearest scroller (the main pane in core 0.1.6 panes)
91
91
  id?: string; // ๐Ÿ†” root id (default "ab-toc"); the title gets `${id}-title`
92
92
  className?: string; // ๐Ÿท๏ธ
@@ -158,5 +158,5 @@ const AbToc = ({ items, activeId, label, title = label ?? 'On this page', onNavi
158
158
  export default AbToc;
159
159
  export { AbToc };
160
160
 
161
- // ๐Ÿ†• 0.2.1 (God 02:44): the aside "New" card
161
+ // ๐Ÿ†• 0.2.1: the aside "New" card
162
162
  export { AbTocPromo, type AbTocPromoProps } from './promo';
package/ab-toc/promo.tsx CHANGED
@@ -24,7 +24,7 @@
24
24
  * SOFTWARE.
25
25
  *
26
26
  * @project: ab-nextjs-components
27
- * @name: AbTocPromo (0.2.1, God 02:44, mock .toc-card)
27
+ * @name: AbTocPromo (0.2.1, approved, mock .toc-card)
28
28
  * @file: ab-toc/promo.tsx
29
29
  * @type: React Component (no hooks: client + server)
30
30
  * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
@@ -54,7 +54,7 @@ export interface AbTocPromoProps {
54
54
  children?: ReactNode; // ๐Ÿ“ the 11.5px muted subtitle (a `<code>` inside is 10.5px)
55
55
  badge?: ReactNode; // ๐Ÿ†• the small chip (default "New"; `null` = none)
56
56
  href?: string; // ๐Ÿ”— makes the title a link (the whole card clicks)
57
- // โ™ฟ 0.3.2 (God, 0.2.23 gaps): the card sits INSIDE the page aside, so by default its root is a plain <div> (no
57
+ // โ™ฟ 0.3.2 (0.2.23 gaps): the card sits INSIDE the page aside, so by default its root is a plain <div> (no
58
58
  // unnamed nested <aside> landmark). With `label` it becomes a NAMED <aside aria-label={label}> instead
59
59
  label?: string;
60
60
  className?: string; // ๐Ÿท๏ธ
@@ -65,7 +65,7 @@
65
65
  .abTocFooter a svg { flex: none; width: 15px; height: 15px; color: var(--ab-color-faint, inherit); } /* ๐Ÿ”ฃ GitHub ยท north_east */
66
66
  .abTocFooter > ul { list-style: none; margin: 0; padding: 0; }
67
67
 
68
- /* ๐Ÿ†• 0.2.1 (God 02:44): AbTocPromo, the aside "New" card (mock .toc-card), theme tokens only */
68
+ /* ๐Ÿ†• 0.2.1: AbTocPromo, the aside "New" card (mock .toc-card), theme tokens only */
69
69
  .abTocPromo {
70
70
  position: relative; /* ๐Ÿ“Œ the stretched link */
71
71
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; /* ๐Ÿ“ */
@@ -77,7 +77,7 @@ export interface AbTocDrawerProps {
77
77
  }
78
78
 
79
79
  /**
80
- * โžก๏ธ AbTocDrawer โ€” John's right drawer (drawers v2 ยง3): the page aside ("On this page") on mobile.
80
+ * โžก๏ธ AbTocDrawer โ€” the right drawer (drawers v2 ยง3): the page aside ("On this page") on mobile.
81
81
  *
82
82
  * - ๐Ÿงญ Only for routes whose layout has an aside: render it (and enable the right edge swipe) there, nowhere else
83
83
  * - ๐Ÿ“ 296px, 16 0 0 16 radius, title Mulish 800 20px; 44px outline rows on a 2px rail, level 3 indented 16px,
@@ -62,7 +62,7 @@ export interface AbVersionOption {
62
62
 
63
63
  /** โš™๏ธ props */
64
64
  export interface AbVersionSwitcherProps {
65
- label?: string; // ๐Ÿท๏ธ text before the version; default none (0.2.0, God 01:27: the app IS the docs, so no "Docs" prefix)
65
+ label?: string; // ๐Ÿท๏ธ text before the version; default none (0.2.0, the app IS the docs, so no "Docs" prefix)
66
66
  version: string; // โœ… current version (shown bold), e.g. 'v0.2.x'
67
67
  versions?: readonly AbVersionOption[]; // ๐Ÿ“‹ the choices (none / one = a static label, no menu)
68
68
  onSelect?: (value: string) => void; // ๐Ÿ“ฃ button items
@@ -80,7 +80,7 @@ const AbVersionSwitcher = ({ label = '', version, versions = [], onSelect, menuL
80
80
  const menuId = `ab-version-menu-${useId().replace(/:/g, '')}`; // ๐Ÿ†”
81
81
  const wrap = useRef<HTMLDivElement>(null); // ๐Ÿ“
82
82
  const btn = useRef<HTMLButtonElement>(null); // ๐Ÿ“
83
- const name = menuLabel ?? (label ? `${label} ${version}` : `Version ${version}`); // โ™ฟ WCAG 2.5.3 label-in-name (James); no label โ†’ "Version v0.2.x" (James P2, still contains the visible text)
83
+ const name = menuLabel ?? (label ? `${label} ${version}` : `Version ${version}`); // โ™ฟ WCAG 2.5.3 label-in-name; no label โ†’ "Version v0.2.x" (P2, still contains the visible text)
84
84
  const hasMenu = versions.length > 1; // ๐Ÿ“‹
85
85
 
86
86
  // โŽ‹ Escape + outside click close it
package/css/dialog.css CHANGED
@@ -138,7 +138,7 @@ li.dialog-list-item {
138
138
  transform-origin: left;
139
139
  opacity: var(--opacity-dialog-list-item, 0.68);
140
140
  user-select: none;
141
- /* โš ๏ธ named motion exception (James review): consumer-rendered markup, no component can add an ab-motion-* class; pinned in __tests__/motion-from-animations.test.tsx */
141
+ /* โš ๏ธ named motion exception (review): consumer-rendered markup, no component can add an ab-motion-* class; pinned in __tests__/motion-from-animations.test.tsx */
142
142
  transition: all 0.2s ease-in-out;
143
143
  }
144
144
 
package/index.ts CHANGED
@@ -80,8 +80,9 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
80
80
  { name: 'AbText', file: 'ab-text/index.tsx', kind: 'client', status: 'Done' },
81
81
  { name: 'AbProduct', file: 'ab-product/index.tsx', kind: 'client', status: 'Done' },
82
82
  { name: 'AbProductItem', file: 'ab-product-item/index.tsx', kind: 'client', status: 'Done' },
83
- { name: 'AbDemoBox', file: 'ab-demo-box/index.tsx', kind: 'client', status: 'Done' },
84
- { name: 'AbDemoCode', file: 'ab-demo-code/index.tsx', kind: 'client', status: 'Done' },
83
+ { name: 'AbDemoBox', file: 'ab-demo-box/index.tsx', kind: 'server', status: 'Done' },
84
+ { name: 'AbDemoCode', file: 'ab-demo-code/index.tsx', kind: 'server', status: 'Done' },
85
+ { name: 'AbPreviewCode', file: 'ab-preview-code/index.tsx', kind: 'server', status: 'Done' }, // ๐Ÿงช๐Ÿ’ป 0.6.0 (G16): the docs Preview / Code pair
85
86
 
86
87
  // SERVER
87
88
  { name: 'AbIcon', file: 'server/ab-icon/index.tsx', kind: 'server', status: 'Done' },
@@ -142,11 +143,11 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
142
143
  { name: 'AbProfileAvatar', file: 'ab-profile-avatar/index.tsx', kind: 'server', status: 'Done' }, // ๐Ÿ†• 0.2.1 initials / photo / glyph circle (no hooks: client + server)
143
144
  { name: 'AbVersionSwitcher', file: 'ab-version-switcher/index.tsx', kind: 'client', status: 'Done' },
144
145
  { name: 'AbBreadcrumbs', file: 'ab-breadcrumbs/index.tsx', kind: 'server', status: 'Done' },
145
- { name: 'AbDocPager', file: 'ab-doc-pager/index.tsx', kind: 'server', status: 'Done' }, // โฎ๏ธโญ๏ธ 0.3.4 (Joseph, 0.2.24 MDX docs): AbDocPager
146
- { name: 'AbContentTabs', file: 'ab-content-tabs/index.tsx', kind: 'client', status: 'Done' }, // ๐Ÿ—‚๏ธ 0.3.4 (Joseph, 0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
147
- { name: 'AbContentTab', file: 'ab-content-tabs/index.tsx', kind: 'client', status: 'Done' }, // ๐Ÿ—‚๏ธ 0.3.4 (Joseph, 0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
148
- { name: 'AbCodeBlock', file: 'ab-code-block/index.tsx', kind: 'server', status: 'Done' }, // ๐Ÿ’ป 0.3.4 (Joseph, 0.2.24 MDX docs): AbCodeBlock (+ its copy island)
149
- { name: 'AbCallout', file: 'ab-callout/index.tsx', kind: 'server', status: 'Done' }, // ๐Ÿ’ก 0.3.4 (Joseph, 0.2.24 MDX docs): AbCallout
146
+ { name: 'AbDocPager', file: 'ab-doc-pager/index.tsx', kind: 'server', status: 'Done' }, // โฎ๏ธโญ๏ธ 0.3.4 (0.2.24 MDX docs): AbDocPager
147
+ { name: 'AbContentTabs', file: 'ab-content-tabs/index.tsx', kind: 'client', status: 'Done' }, // ๐Ÿ—‚๏ธ 0.3.4 (0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
148
+ { name: 'AbContentTab', file: 'ab-content-tabs/index.tsx', kind: 'client', status: 'Done' }, // ๐Ÿ—‚๏ธ 0.3.4 (0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
149
+ { name: 'AbCodeBlock', file: 'ab-code-block/index.tsx', kind: 'server', status: 'Done' }, // ๐Ÿ’ป 0.3.4 (0.2.24 MDX docs): AbCodeBlock (+ its copy island)
150
+ { name: 'AbCallout', file: 'ab-callout/index.tsx', kind: 'server', status: 'Done' }, // ๐Ÿ’ก 0.3.4 (0.2.24 MDX docs): AbCallout
150
151
  { name: 'AbList', file: 'ab-list/index.tsx', kind: 'server', status: 'Done' },
151
152
  ]
152
153
 
@@ -184,12 +185,15 @@ export { default as AbBrand } from './ab-brand/index.tsx'
184
185
  export { default as AbName } from './ab-name/index.tsx'
185
186
  export { default as AbNavbar } from './ab-navbar/index.tsx'
186
187
  export { default as AbSidebar } from './ab-sidebar/index.tsx'
187
- // ๐Ÿ‘ค 0.2.1 (God 02:44): the bottom-left sidebar profile button โ†’ AbSettingsDrawer (laptop + wide)
188
+ // ๐ŸŽฏ 0.5.0: active-item matching shared by AbSidebar + AbNavDrawer (`activeMatch`, per-item `exact`)
189
+ export { getAbActiveHrefs, matchAbHref, normalizeAbHref, flattenAbNavItems } from './ab-sidebar/active.ts'
190
+ export type { AbActiveMatch, AbActiveMatchable, AbActiveMatchOptions } from './ab-sidebar/active.ts'
191
+ // ๐Ÿ‘ค 0.2.1: the bottom-left sidebar profile button โ†’ AbSettingsDrawer (laptop + wide)
188
192
  export { default as AbSidebarProfileButton } from './ab-sidebar/profile-button.tsx'
189
193
  export type { AbSidebarProfileButtonProps } from './ab-sidebar/profile-button.tsx'
190
- // ๐Ÿ“‘ 0.1.13 (Joseph): AbToc + the panes main-scroller helpers (also at `ab-nextjs-components/ab-toc`)
194
+ // ๐Ÿ“‘ 0.1.13: AbToc + the panes main-scroller helpers (also at `ab-nextjs-components/ab-toc`)
191
195
  export { default as AbToc, getAbMainScroller, AB_MAIN_SCROLLER_SELECTOR } from './ab-toc/index.tsx'
192
- // ๐Ÿ†• 0.2.1 (God 02:44): the aside "New" card
196
+ // ๐Ÿ†• 0.2.1: the aside "New" card
193
197
  export { default as AbTocPromo } from './ab-toc/promo.tsx'
194
198
  export type { AbTocPromoProps } from './ab-toc/promo.tsx'
195
199
  export type { AbTocItem, AbTocProps } from './ab-toc/index.tsx'
@@ -197,7 +201,7 @@ export type { AbTocItem, AbTocProps } from './ab-toc/index.tsx'
197
201
  export { default as AbErrorHero } from './ab-error-hero/index.tsx'
198
202
  export type { AbErrorHeroProps } from './ab-error-hero/index.tsx'
199
203
  // ๐Ÿ—„๏ธ 0.1.14 (G53): AbDrawer + useAbDrawer (also at `ab-nextjs-components/ab-drawer`)
200
- export { default as AbDrawer, useAbDrawer, getAbDrawerHost, AB_DRAWER_DURATION, AB_DRAWER_RETURN_FOCUS } from './ab-drawer/index.tsx'
204
+ export { default as AbDrawer, useAbDrawer, getAbDrawerHost, AB_DRAWER_DURATION, AB_DRAWER_RETURN_FOCUS, AB_PREVIEW_SCOPE_SELECTOR } from './ab-drawer/index.tsx'
201
205
  // ๐Ÿค 0.2.0 drawers v2: edge swipes + the swipe / snap rules
202
206
  export { useAbEdgeSwipe, AB_ASIDE_DRAWER_MAX_WIDTH, AB_SWIPE, resolveAbSheetRelease, resolveAbSideRelease } from './ab-drawer/index.tsx'
203
207
  export type { AbDrawerTier, AbSheetSnap, UseAbEdgeSwipeOptions } from './ab-drawer/index.tsx'
@@ -209,14 +213,14 @@ export type { AbConfirmDrawerProps } from './ab-confirm-drawer/index.tsx'
209
213
  // ๐Ÿ“ฑ 0.1.14 (D40): AbBottomDrawer, the mobile bottom drawer
210
214
  export { default as AbBottomDrawer } from './ab-bottom-drawer/index.tsx'
211
215
  export type { AbBottomDrawerProps } from './ab-bottom-drawer/index.tsx'
212
- // ๐Ÿ‘‡ 0.2.3 (Joseph, Welcome 0.2.21): swipe a bottom sheet down to close
216
+ // ๐Ÿ‘‡ 0.2.3 (Welcome 0.2.21): swipe a bottom sheet down to close
213
217
  export { useAbSwipeDown, isAbScrolledInside } from './ab-bottom-drawer/use-ab-swipe-down.ts'
214
218
  export type { UseAbSwipeDownOptions } from './ab-bottom-drawer/use-ab-swipe-down.ts'
215
219
  // ๐Ÿ†• 0.2.0 drawers v2: AbMobileHeader
216
220
  export { default as AbMobileHeader } from './ab-mobile-header/index.tsx'
217
221
  export type { AbMobileHeaderProps, AbMobileHeaderThemeMode, AbMobileHeaderLanguage } from './ab-mobile-header/index.tsx'
218
222
  export { AB_MOBILE_HEADER_THEME_CYCLE } from './ab-mobile-header/index.tsx' // ๐ŸŒ— 0.2.3
219
- // ๐ŸŒ— 0.2.3 (Joseph, Welcome 0.2.21): one shared theme mode for every toggle
223
+ // ๐ŸŒ— 0.2.3 (Welcome 0.2.21): one shared theme mode for every toggle
220
224
  export { AbThemeModeProvider, useAbThemeModeContext, AB_THEME_MODE_ICONS, AB_THEME_ICON_BUTTON_GLYPH } from './ab-theme-mode/index.tsx' // ๐Ÿ”ฃ 0.3.2: + the shared theme glyphs
221
225
  export type { AbThemeModeProviderProps, AbThemeModeContextValue } from './ab-theme-mode/index.tsx'
222
226
  // ๐Ÿ†• 0.2.0 drawers v2: AbSearchDrawer
@@ -247,19 +251,26 @@ export { default as AbText } from './ab-text/index.tsx'
247
251
  export { default as AbProduct } from './ab-product/index.tsx'
248
252
  export { default as AbProductItem } from './ab-product-item/index.tsx'
249
253
  export { default as AbDemoBox } from './ab-demo-box/index.tsx'
254
+ export type { AbDemoBoxProps, AbDemoBoxScheme } from './ab-demo-box/index.tsx'
250
255
  export { default as AbDemoCode } from './ab-demo-code/index.tsx'
256
+ export type { AbDemoCodeProps } from './ab-demo-code/index.tsx'
257
+ // ๐Ÿงช๐Ÿ’ป 0.6.0 (G16): the docs Preview / Code pair (AbContentTabs + AbDemoBox + AbDemoCode)
258
+ export { default as AbPreviewCode } from './ab-preview-code/index.tsx'
259
+ export type { AbPreviewCodeProps, AbPreviewCodeLabels } from './ab-preview-code/index.tsx'
260
+ export { default as AbPreviewStage } from './ab-preview-code/stage.tsx' // ๐Ÿงฐ 0.6.0: the preview toolbar island
261
+ export type { AbPreviewStageProps, AbPreviewStageLabels } from './ab-preview-code/stage.tsx'
251
262
  export { default as AbPolygon } from './server/ab-polygon/index.tsx'
252
- // ๐Ÿ’ก 0.3.4 (Joseph, 0.2.24 MDX docs): AbCallout
263
+ // ๐Ÿ’ก 0.3.4 (0.2.24 MDX docs): AbCallout
253
264
  export { default as AbCallout, AB_CALLOUT_ICONS } from './ab-callout/index.tsx'
254
265
  export type { AbCalloutProps, AbCalloutVariant } from './ab-callout/index.tsx'
255
- // ๐Ÿ’ป 0.3.4 (Joseph, 0.2.24 MDX docs): AbCodeBlock (+ its copy island)
266
+ // ๐Ÿ’ป 0.3.4 (0.2.24 MDX docs): AbCodeBlock (+ its copy island)
256
267
  export { default as AbCodeBlock } from './ab-code-block/index.tsx'
257
268
  export { default as AbCodeBlockCopy } from './ab-code-block/copy.tsx'
258
269
  export type { AbCodeBlockCopyProps } from './ab-code-block/copy.tsx'
259
270
  export type { AbCodeBlockProps } from './ab-code-block/index.tsx'
260
- // ๐Ÿ—‚๏ธ 0.3.4 (Joseph, 0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
261
- export { default as AbContentTabs, AbContentTab } from './ab-content-tabs/index.tsx'
271
+ // ๐Ÿ—‚๏ธ 0.3.4 (0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
272
+ export { default as AbContentTabs, AbContentTab, AB_FOCUSABLE_SELECTOR } from './ab-content-tabs/index.tsx' // โŒจ๏ธ 0.6.0: the panel tab-stop check
262
273
  export type { AbContentTabsProps, AbContentTabProps } from './ab-content-tabs/index.tsx'
263
- // โฎ๏ธโญ๏ธ 0.3.4 (Joseph, 0.2.24 MDX docs): AbDocPager
274
+ // โฎ๏ธโญ๏ธ 0.3.4 (0.2.24 MDX docs): AbDocPager
264
275
  export { default as AbDocPager } from './ab-doc-pager/index.tsx'
265
276
  export type { AbDocPagerProps, AbDocPagerLink } from './ab-doc-pager/index.tsx'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ab-nextjs-components",
3
- "version": "0.4.2",
3
+ "version": "0.6.0",
4
4
  "description": "๐Ÿš€ A lightweight collection of server & client React components created by Abraham Ukachi, and optimized for Next.js applications ๐Ÿ˜Ž.",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -106,6 +106,7 @@
106
106
  "ab-product-item",
107
107
  "ab-demo-box",
108
108
  "ab-demo-code",
109
+ "ab-preview-code",
109
110
  "ab-splash",
110
111
  "ab-linear-progress",
111
112
  "ab-carousel",
@@ -227,6 +228,7 @@
227
228
  "./ab-product-item": "./ab-product-item/index.tsx",
228
229
  "./ab-demo-box": "./ab-demo-box/index.tsx",
229
230
  "./ab-demo-code": "./ab-demo-code/index.tsx",
231
+ "./ab-preview-code": "./ab-preview-code/index.tsx",
230
232
  "./server/ab-brand": "./server/ab-brand/index.tsx",
231
233
  "./server/ab-name": "./server/ab-name/index.tsx",
232
234
  "./server/ab-navbar": "./server/ab-navbar/index.tsx",
@@ -43,7 +43,7 @@ import clsx from 'clsx';
43
43
  // ๐Ÿ”— 404 gaps: the provider-aware link (client component, fine to render from a server twin)
44
44
  import AbLink from '../../ab-link';
45
45
  // ๐ŸŽจ styles (server copy)
46
- // ๐Ÿงฌ 0.2.3 (Joseph 03:41): ONE source for the button box โ€” the client module's CSS (no server copy to drift)
46
+ // ๐Ÿงฌ 0.2.3: ONE source for the button box โ€” the client module's CSS (no server copy to drift)
47
47
  import styles from '../../ab-button/styles.module.css';
48
48
  // ๐Ÿงฎ the SAME rules as the client twin
49
49
  import {
@@ -67,7 +67,7 @@ const AbIcon = ({ name, variant, filled = false, weight, size, label, title, svg
67
67
  const want: AbIconVariant = variant ?? (filled ? 'filled' : 'outlined');
68
68
  // ๐Ÿ” explicit โ†’ registered โ†’ whole map (weight is applied by CSS, so ask for the raw markup)
69
69
  const markup = pickAbIconMarkup(svg ?? getRegisteredAbIcon(name), want) ?? getAbIconSvg(name, want);
70
- // ๐Ÿ†” one id per rendered instance (Joseph: a hidden twin's mask broke the active Home)
70
+ // ๐Ÿ†” one id per rendered instance (a hidden twin's mask broke the active Home)
71
71
  const uid = useId();
72
72
  // ๐ŸŽš๏ธ legacy `filled` โ†’ variant
73
73
  const v: AbIconVariant = variant ?? (filled ? 'filled' : 'outlined');
@@ -94,7 +94,7 @@ const AbIcon = ({ name, variant, filled = false, weight, size, label, title, svg
94
94
  );
95
95
  }
96
96
 
97
- // ๐Ÿ•ฐ๏ธ 0.1.13 (James review): NON-breaking fallback for unregistered names. A patch must not blank icons,
97
+ // ๐Ÿ•ฐ๏ธ 0.1.13 (review): NON-breaking fallback for unregistered names. A patch must not blank icons,
98
98
  // so an unknown name still renders the pre-G2 Material Symbols ligature (needs the app's font), and
99
99
  // warns once in development so the missing registration gets fixed before the app drops the font.
100
100
  warnAbIconMissing(name);