ab-nextjs-components 0.1.14 → 0.2.1

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 (40) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +5 -0
  3. package/ab-app-bar/index.tsx +17 -6
  4. package/ab-app-bar/styles.module.css +27 -2
  5. package/ab-balloon/index.tsx +35 -3
  6. package/ab-balloon/styles.module.css +8 -0
  7. package/ab-bottom-drawer/styles.module.css +1 -1
  8. package/ab-breadcrumbs/index.tsx +1 -1
  9. package/ab-drawer/gestures.ts +134 -0
  10. package/ab-drawer/index.tsx +168 -12
  11. package/ab-drawer/kit.module.css +210 -0
  12. package/ab-drawer/styles.module.css +39 -0
  13. package/ab-drawer/use-ab-edge-swipe.ts +165 -0
  14. package/ab-icon-button/index.tsx +1 -1
  15. package/ab-locale-switcher/index.tsx +64 -3
  16. package/ab-locale-switcher/styles.module.css +20 -0
  17. package/ab-mobile-header/index.tsx +100 -0
  18. package/ab-nav-drawer/index.tsx +158 -0
  19. package/ab-navbar/index.tsx +1 -1
  20. package/ab-package-card/index.tsx +2 -0
  21. package/ab-package-card/previews.tsx +94 -0
  22. package/ab-package-card/styles.module.css +21 -0
  23. package/ab-profile-avatar/index.tsx +105 -0
  24. package/ab-profile-avatar/styles.module.css +53 -0
  25. package/ab-search-drawer/index.tsx +279 -0
  26. package/ab-search-trigger/index.tsx +8 -3
  27. package/ab-search-trigger/styles.module.css +3 -0
  28. package/ab-settings-drawer/index.tsx +203 -0
  29. package/ab-sidebar/index.tsx +10 -2
  30. package/ab-sidebar/profile-button.tsx +115 -0
  31. package/ab-sidebar/styles.module.css +43 -0
  32. package/ab-sidebar/view.tsx +9 -1
  33. package/ab-toc/index.tsx +3 -0
  34. package/ab-toc/promo.tsx +74 -0
  35. package/ab-toc/styles.module.css +16 -0
  36. package/ab-toc-drawer/index.tsx +129 -0
  37. package/ab-version-switcher/index.tsx +5 -5
  38. package/index.ts +36 -1
  39. package/package.json +15 -3
  40. package/types/index.d.ts +27 -1
@@ -45,7 +45,7 @@
45
45
  'use client';
46
46
 
47
47
  // ⚛️ React
48
- import { useCallback, useEffect, useId, useRef, useState, type CSSProperties, type ReactElement, type ReactNode } from 'react';
48
+ import { useCallback, useEffect, useId, useRef, useState, type CSSProperties, type PointerEvent as ReactPointerEvent, type ReactElement, type ReactNode } from 'react';
49
49
  // 🌀 portal into the scope's drawer layer
50
50
  import { createPortal } from 'react-dom';
51
51
  // 🧵 classes
@@ -57,10 +57,18 @@ import { AB_MOTION } from 'ab-nextjs-animations/motion';
57
57
  import 'ab-nextjs-animations/motion/styles.css';
58
58
  // 🎛️ the controller hook + scope type
59
59
  import { useAbDrawer, type AbDrawerScope, type UseAbDrawer } from './use-ab-drawer';
60
+ // 🤏 drawers v2: the pure swipe / snap rules
61
+ import { AB_SWIPE, createAbVelocityTracker, resolveAbSheetRelease, resolveAbSideRelease, type AbSheetSnap } from './gestures';
60
62
 
61
63
  // 📦 re-exports: one import for the whole drawer API
62
64
  export { useAbDrawer };
63
- export type { AbDrawerScope, UseAbDrawer };
65
+ export type { AbDrawerScope, UseAbDrawer, AbSheetSnap };
66
+ // 🤏 0.2.0: edge swipes + the pure rules, from the same entry
67
+ export { useAbEdgeSwipe, AB_ASIDE_DRAWER_MAX_WIDTH, type UseAbEdgeSwipeOptions } from './use-ab-edge-swipe';
68
+ export { AB_SWIPE, resolveAbSheetRelease, resolveAbSideRelease } from './gestures';
69
+
70
+ /** 🥞 drawers v2 stacking tiers (spec z-order): aside (right) < nav (left) < sheet (bottom). Unset = the old single level. */
71
+ export type AbDrawerTier = 'aside' | 'nav' | 'sheet';
64
72
 
65
73
  /** 🧭 where it slides in from. `start` / `end` follow the writing direction (RTL-aware). */
66
74
  export type AbDrawerSide = 'top' | 'bottom' | 'left' | 'right' | 'start' | 'end';
@@ -81,7 +89,19 @@ export interface AbDrawerProps {
81
89
  modal?: boolean; // 🔒 trap focus + make the rest of the scope inert (default `true`)
82
90
  closeLabel?: string; // 🌍 default "Close"
83
91
  noJsFallback?: boolean; // 🧩 D41: without JS, render the content in flow (default `true`)
84
- initialFocus?: 'first' | 'panel'; // 🎯 on open: the first control (default) or the panel itself (no ring on the ✕; Tab then enters)
92
+ initialFocus?: 'first' | 'panel' | (string & {}); // 🎯 on open: the first control (default), the panel itself, or (0.2.0) a CSS selector inside the panel, e.g. `[role=radio][aria-checked=true]`
93
+ // 🆕 0.2.0 drawers v2 (John, God 01:22): all opt-in, the defaults keep the old drawer
94
+ tier?: AbDrawerTier; // 🥞 stacking tier: 'aside' (z 60) < 'nav' (61) < 'sheet' (62)
95
+ swipe?: boolean; // 🤏 side drawers: swipe the sheet back toward its edge to close (30% of the width or ≥ 0.5px/ms)
96
+ snapPoints?: boolean; // 🧲 bottom only, below 768px: snaps at 70% (S1) and full height (S2) with a handle; gestures per the spec
97
+ defaultSnap?: AbSheetSnap; // 🧲 where it opens (default 'partial'; e.g. 'full' for a search sheet)
98
+ fullOnly?: boolean; // 🧲 no 70% stop: opens at full height, a gentle drag springs back, a hard one closes (search: the keyboard is up)
99
+ onSnapChange?: (snap: AbSheetSnap) => void; // 🔔
100
+ handleLabels?: { expand: string; collapse: string }; // ♿ the handle button (default "Expand" / "Collapse")
101
+ centerIn?: 'main'; // 💻 bottom only, 768px and up: centred in the main pane, min(640px, main width) wide, ≤ 70% tall
102
+ returnFocus?: string; // ↩️ selector focused on close when there was no focusable opener (an edge swipe); default AB_DRAWER_RETURN_FOCUS (the header / brand logo)
103
+ closeIcon?: ReactNode; // ✕ the close glyph (default a text ✕)
104
+ headerStart?: ReactNode; // 🏷️ header content that does NOT label the dialog (e.g. a logo; then use `aria-label`). `title` wins
85
105
  className?: string; // 🏷️
86
106
  }
87
107
 
@@ -126,6 +146,9 @@ const isTopDrawer = (token: symbol): boolean => openStack[openStack.length - 1]
126
146
 
127
147
  // ♿ reduced-motion check, read once per open / close on purpose: it only picks the unmount delay for THAT
128
148
  // toggle (the slide itself is CSS, which follows the media query live), so a listener would buy nothing
149
+ /** ↩️ 0.2.1 (Joseph): where focus goes after a drawer that had no focusable opener closes (an edge swipe): the
150
+ * mobile header's logo link, else AbAppBar's brand link, else AbSidebar's logo row link. `returnFocus` overrides it. */
151
+ export const AB_DRAWER_RETURN_FOCUS = '[data-ab-part="mobile-header"] a[href], [data-ab-part="app-bar-brand"] a[href], [data-ab-part="sidebar-logo"] a[href]';
129
152
  const reducedMotion = (): boolean => typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
130
153
 
131
154
  /**
@@ -143,6 +166,7 @@ const reducedMotion = (): boolean => typeof window !== 'undefined' && typeof win
143
166
  */
144
167
  const AbDrawer = (props: AbDrawerProps): ReactElement => {
145
168
  const { open, onClose, scope = 'app', side = 'bottom', title, id, children, footer, size, modal = true, closeLabel = 'Close', noJsFallback = true, initialFocus = 'first', className } = props;
169
+ const { tier, swipe = false, snapPoints = false, defaultSnap = 'partial', onSnapChange, handleLabels, centerIn, returnFocus, closeIcon, headerStart, fullOnly = false } = props; // 🆕 0.2.0
146
170
  const auto = useId().replace(/[^A-Za-z0-9_-]/g, ''); // 🆔 SSR-stable
147
171
  const dialogId = id ?? `ab-drawer-${auto}`; // 🆔
148
172
  const titleId = `${dialogId}-title`; // 🏷️
@@ -201,14 +225,24 @@ const AbDrawer = (props: AbDrawerProps): ReactElement => {
201
225
  // ♿ focus in on open, back to the opener on close
202
226
  useEffect(() => {
203
227
  if (!open || !present || !panel.current) return;
204
- const first = initialFocus === 'panel' ? null : panel.current.querySelector<HTMLElement>(FOCUSABLE); // 🎯 first control, else the panel
228
+ const pick = initialFocus === 'panel' ? null : initialFocus === 'first' ? FOCUSABLE : initialFocus; // 🎯 0.2.0: or a selector
229
+ const first = pick ? panel.current.querySelector<HTMLElement>(pick) ?? (pick !== FOCUSABLE ? panel.current.querySelector<HTMLElement>(FOCUSABLE) : null) : null; // 🎯 that, else the first control, else the panel
230
+ // 👀 e.g. the checked language in view: scroll ONLY the drawer body (scrollIntoView would also scroll the clipped
231
+ // layer and undo the 70% snap offset, WebKit e2e 2026-10-21)
232
+ const body = panel.current.querySelector<HTMLElement>('[data-ab-part="drawer-body"]');
233
+ if (first && body && body.contains(first)) { const b = body.getBoundingClientRect(); const r = first.getBoundingClientRect(); if (r.bottom > b.bottom) body.scrollTop += r.bottom - b.bottom; else if (r.top < b.top) body.scrollTop -= b.top - r.top; }
205
234
  (first ?? panel.current).focus({ preventScroll: true });
235
+ const node = panel.current; // 📌 this open's panel (for the cleanup)
206
236
  return () => {
207
- const back = opener.current as HTMLElement | null; // ↩️
237
+ const had = opener.current as HTMLElement | null; // ↩️
238
+ const usable = had && had !== document.body && had.isConnected ? had : null; // 🤏 a swipe has no opener
239
+ // ↩️ 0.2.0 fallback: the first VISIBLE match (an app often renders the logo twice, one hidden per breakpoint)
240
+ const pool = Array.from(document.querySelectorAll<HTMLElement>(returnFocus ?? AB_DRAWER_RETURN_FOCUS)).filter((el) => !node.contains(el)); // 🏷️ 0.2.1 (Joseph): default = the header / brand logo
241
+ const back = usable ?? pool.find((el) => el.getClientRects().length > 0) ?? pool[0] ?? null; // 👀 the visible one, else the first
208
242
  // ⏭️ a microtask later: the inert cleanup below runs after this one, and an inert opener can't take focus
209
243
  queueMicrotask(() => { if (back && back.isConnected && typeof back.focus === 'function') back.focus({ preventScroll: true }); });
210
244
  };
211
- }, [open, present, layer, initialFocus]); // 🎯 initialFocus is static in practice
245
+ }, [open, present, layer, initialFocus, returnFocus]); // 🎯 static in practice
212
246
 
213
247
  // 🔒 the rest of the scope is inert while open (modal only); we only undo what we set
214
248
  useEffect(() => {
@@ -228,6 +262,117 @@ const AbDrawer = (props: AbDrawerProps): ReactElement => {
228
262
  return () => { const i = openStack.lastIndexOf(token); if (i >= 0) openStack.splice(i, 1); };
229
263
  }, [open, token]);
230
264
 
265
+ // 🧲 0.2.0: snap state (bottom + snapPoints, below 768px) and the laptop centring (centerIn="main", 768px and up)
266
+ const [mobile, setMobile] = useState(false); // 📱 below 768px?
267
+ const [snap, setSnapState] = useState<AbSheetSnap>(fullOnly ? 'full' : defaultSnap); // 🧲 S1 / S2
268
+ const [returned, setReturned] = useState(false); // ✌️ came back to S1 from S2 with a gentle drag
269
+ const [geo, setGeo] = useState<Record<string, string>>({}); // 📐 measured CSS vars (px)
270
+ const snapping = snapPoints && side === 'bottom' && mobile; // 🧲 live?
271
+ const centring = centerIn === 'main' && side === 'bottom' && !mobile; // 💻 live?
272
+ const setSnap = useCallback((next: AbSheetSnap) => { setSnapState(next); onSnapChange?.(next); }, [onSnapChange]);
273
+ // 🔁 every open starts at defaultSnap (derived during render, like `present`)
274
+ const [lastOpen, setLastOpen] = useState(open);
275
+ if (open !== lastOpen) { setLastOpen(open); if (open) { setSnapState(fullOnly ? 'full' : defaultSnap); setReturned(false); } }
276
+ // 📱 follow the 768px breakpoint (the same edge core uses)
277
+ useEffect(() => {
278
+ if (!(snapPoints || centerIn) || typeof window.matchMedia !== 'function') return;
279
+ const mq = window.matchMedia('(max-width: 767px)'); // 📱
280
+ const on = () => setMobile(mq.matches);
281
+ on(); mq.addEventListener?.('change', on);
282
+ return () => mq.removeEventListener?.('change', on);
283
+ }, [snapPoints, centerIn]);
284
+ // 📐 measure: S1 offset (100% − 70% of the app) and the main pane box inside the host
285
+ useEffect(() => {
286
+ const host = layer?.parentElement;
287
+ if (!present || !host || !(snapping || centring)) return;
288
+ const measure = () => {
289
+ const hb = host === document.body ? { top: 0, left: 0, width: window.innerWidth, height: window.innerHeight } : host.getBoundingClientRect(); // 📏
290
+ const next: Record<string, string> = { '--ab-drawer-host-h': `${hb.height}px` };
291
+ if (snapping) {
292
+ const ph = panel.current?.getBoundingClientRect().height ?? hb.height; // 📏 the full-height sheet
293
+ next['--ab-drawer-partial-offset'] = `${Math.max(0, ph - 0.7 * hb.height)}px`; // 🧲 S1 = 70% of the app visible
294
+ }
295
+ if (centring) {
296
+ const main = host.querySelector<HTMLElement>('[data-ab-part="main"]')?.getBoundingClientRect(); // 📄 the main pane
297
+ next['--ab-drawer-main-left'] = `${main ? main.left - hb.left : 0}px`;
298
+ next['--ab-drawer-main-width'] = `${main ? main.width : hb.width}px`;
299
+ }
300
+ setGeo((g) => (JSON.stringify(g) === JSON.stringify(next) ? g : next)); // 🧮 no loop
301
+ };
302
+ measure();
303
+ const ro = typeof ResizeObserver === 'function' ? new ResizeObserver(measure) : null; // 👀 resizes
304
+ ro?.observe(host); if (panel.current) ro?.observe(panel.current);
305
+ return () => ro?.disconnect();
306
+ }, [present, layer, snapping, centring]);
307
+
308
+ // 🤏 0.2.0 drags: side sheets swipe toward their edge to close; the snap sheet follows the finger and resolves
309
+ const drag = useRef<{ x: number; y: number; t: number; axis: 0 | 1 | 2; v: ReturnType<typeof createAbVelocityTracker>; el?: Element; id?: number } | null>(null); // 0 = undecided, 1 = ours, 2 = not ours
310
+ const edgeSign = side === 'left' || side === 'start' ? -1 : side === 'right' || side === 'end' ? 1 : 0; // ⬅️ / ➡️ the closing direction
311
+ const setDragTransform = (value: string | null) => {
312
+ const el = panel.current; if (!el) return;
313
+ el.toggleAttribute('data-dragging', value != null); // 🫳 CSS drops the transition while the finger leads
314
+ if (value != null) el.style.removeProperty('--ab-motion-duration'); // 🧹 last release's speed must not beat the 0ms drag rule
315
+ if (value == null) el.style.removeProperty('transform'); else el.style.setProperty('transform', value);
316
+ };
317
+ const onDragStart = (e: { clientX: number; clientY: number; timeStamp: number }, from: 'grip' | 'body') => {
318
+ if (!(swipe && edgeSign !== 0) && !snapping) return; // 🙅 nothing to drag
319
+ if (from === 'body' && snapping && (panel.current?.querySelector('[data-ab-part="drawer-body"]')?.scrollTop ?? 0) > 0) return; // 📜 content not at the top: let it scroll
320
+ const v = createAbVelocityTracker(); v.add(snapping && edgeSign === 0 ? e.clientY : e.clientX, e.timeStamp);
321
+ drag.current = { x: e.clientX, y: e.clientY, t: e.timeStamp, axis: 0, v };
322
+ };
323
+ const onDragMove = (e: { clientX: number; clientY: number; timeStamp: number; preventDefault?: () => void; cancelable?: boolean }) => {
324
+ const d = drag.current; if (!d || d.axis === 2) return;
325
+ const dx = e.clientX - d.x; const dy = e.clientY - d.y; // ↔️ ↕️
326
+ const vertical = edgeSign === 0; // 🧲 the bottom sheet moves on y
327
+ if (d.axis === 0) {
328
+ if (Math.max(Math.abs(dx), Math.abs(dy)) < AB_SWIPE.slop) return; // 🫳 still a tap
329
+ const mine = vertical ? Math.abs(dy) > Math.abs(dx) : Math.abs(dx) > Math.abs(dy); // 🧭 our axis?
330
+ d.axis = mine ? 1 : 2; if (!mine) return;
331
+ if (d.el && d.id != null) d.el.setPointerCapture?.(d.id); // 📌 captured only once it IS a drag (taps on links still click)
332
+ }
333
+ if (e.cancelable) e.preventDefault?.(); // 🚫 no page scroll while we lead
334
+ d.v.add(vertical ? e.clientY : e.clientX, e.timeStamp); // ⚡
335
+ if (vertical) {
336
+ const base = snap === 'full' ? 0 : parseFloat(geo['--ab-drawer-partial-offset'] ?? '0'); // 🧲 where it rests
337
+ setDragTransform(`translateY(${Math.max(0, base + dy)}px)`); // ⬇️⬆️ follow (never above S2)
338
+ } else {
339
+ const along = dx * edgeSign; // ↔️ + = toward the edge
340
+ setDragTransform(`translateX(${Math.max(0, along) * edgeSign}px)`); // ↔️ follow, never past open
341
+ }
342
+ };
343
+ const onDragEnd = (e: { clientX: number; clientY: number; timeStamp: number }) => {
344
+ const d = drag.current; drag.current = null;
345
+ if (!d || d.axis !== 1) { setDragTransform(null); return; }
346
+ const vertical = edgeSign === 0;
347
+ const vel = d.v.velocity(); // ⚡ px/ms
348
+ setDragTransform(null); // 🛬 hand back to CSS (the attribute transition carries on)
349
+ if (!vertical) {
350
+ const dist = (e.clientX - d.x) * edgeSign; // ↔️ toward the edge
351
+ if (resolveAbSideRelease({ distance: dist, velocity: vel * edgeSign, width: panel.current?.offsetWidth ?? 320 })) close.current(); // ✅
352
+ return;
353
+ }
354
+ const hostH = parseFloat(geo['--ab-drawer-host-h'] ?? '0') || window.innerHeight; // 📏
355
+ const ph = panel.current?.offsetHeight || hostH; // 📏 S2 height
356
+ const resolved = resolveAbSheetRelease({ from: snap, dy: e.clientY - d.y, velocity: vel, partialHeight: 0.7 * hostH, fullHeight: ph, returned }); // 🧲
357
+ const to = fullOnly && resolved === 'partial' ? 'full' : resolved; // 🧲 fullOnly: no S1, spring back to S2
358
+ // ⏱️ carry the release speed: the remaining distance at that speed, between 120 and 240ms
359
+ const ms = Math.abs(vel) > 0.05 ? Math.round(Math.min(AB_DRAWER_DURATION, Math.max(120, (0.3 * hostH) / Math.abs(vel)))) : AB_DRAWER_DURATION;
360
+ panel.current?.style.setProperty('--ab-motion-duration', `${ms}ms`); // 🎞️ the ab-nextjs-animations token
361
+ if (to === 'closed') { close.current(); return; }
362
+ setReturned(snap === 'full' && to === 'partial'); // ✌️ remember the gentle return
363
+ if (to !== snap) setSnap(to);
364
+ };
365
+ // 🖐️ pointer handlers (touch / pen / mouse). The grip kind rides on `data-ab-grip`, so these are plain handlers
366
+ // (never called during render); the pointer is captured only once the press becomes a drag
367
+ const onGripDown = (e: ReactPointerEvent) => {
368
+ if (e.button !== 0) return;
369
+ onDragStart(e, (e.currentTarget as Element).getAttribute('data-ab-grip') === 'body' ? 'body' : 'grip');
370
+ if (drag.current) { drag.current.el = e.currentTarget as Element; drag.current.id = e.pointerId; } // 📌 for the capture
371
+ };
372
+ const onGripMove = (e: ReactPointerEvent) => onDragMove(e);
373
+ const onGripUp = (e: ReactPointerEvent) => onDragEnd(e);
374
+ const gripProps = { onPointerDown: onGripDown, onPointerMove: onGripMove, onPointerUp: onGripUp, onPointerCancel: onGripUp }; // 🖐️
375
+
231
376
  // ⎋ Escape closes (skips events an inner menu already handled); Tab stays inside (modal). Topmost drawer only
232
377
  const onKeyDown = useCallback((e: KeyboardEvent) => {
233
378
  if (!panel.current || !isTopDrawer(token)) return; // 🥞 a drawer under another one stays put
@@ -250,7 +395,10 @@ const AbDrawer = (props: AbDrawerProps): ReactElement => {
250
395
  const heading = title == null ? null : typeof title === 'string' || typeof title === 'number'
251
396
  ? <h2 id={titleId} className={styles.abDrawerTitle}>{title}</h2>
252
397
  : <div id={props['aria-labelledby'] ? undefined : titleId} className={styles.abDrawerTitle}>{title}</div>;
253
- const sizeVar = size ? ({ '--ab-drawer-size': size } as CSSProperties) : undefined; // 📏
398
+ const head = heading ?? (headerStart != null ? <div className={styles.abDrawerTitle} data-ab-part="drawer-header-start">{headerStart}</div> : null); // 🏷️ 0.2.0
399
+ const sizeVar = (size || snapping || centring ? { ...(size ? { '--ab-drawer-size': size } : {}), ...(snapping || centring ? geo : {}) } : undefined) as CSSProperties | undefined; // 📏 + 🧲 measured vars
400
+ const grip = snapping || (swipe && edgeSign !== 0); // 🤏 drags on
401
+ const handle = snapPoints && side === 'bottom'; // ➖ the handle strip
254
402
 
255
403
  // 🧩 D41: before hydration (and with no JS at all) the content is an in-flow section
256
404
  if (!layer) {
@@ -270,7 +418,7 @@ const AbDrawer = (props: AbDrawerProps): ReactElement => {
270
418
  return (
271
419
  <div ref={anchor} className={styles.abDrawerAnchor} data-ab-part="drawer-anchor">
272
420
  {present && createPortal(
273
- <div className={styles.abDrawerFrame} data-state={shown ? 'open' : 'closed'} data-side={side} data-scope={scope}>
421
+ <div className={styles.abDrawerFrame} data-state={shown ? 'open' : 'closed'} data-side={side} data-scope={scope} data-tier={tier}>
274
422
  {/* 🌫️ scrim: a click closes (pointer only; keyboard users have Escape and the close button) */}
275
423
  <div className={clsx(styles.abDrawerScrim, AB_MOTION.colors)} data-ab-part="drawer-scrim" aria-hidden="true" onClick={() => close.current()} />
276
424
  <div
@@ -284,15 +432,23 @@ const AbDrawer = (props: AbDrawerProps): ReactElement => {
284
432
  className={clsx('AbDrawer', styles.abDrawer, AB_MOTION.transform, className)}
285
433
  data-ab-part="drawer"
286
434
  data-side={side}
435
+ data-snap={snapping ? snap : undefined} // 🧲 0.2.0: CSS places S1 / S2
436
+ data-center={centring ? 'main' : undefined} // 💻 0.2.0: centred in the main pane
437
+ data-swipe={grip ? 'true' : undefined} // 🤏 touch-action hooks
287
438
  style={sizeVar}
439
+ {...(swipe && edgeSign !== 0 ? { ...gripProps, 'data-ab-grip': 'body' } : {})}
288
440
  >
289
- <div className={styles.abDrawerHeader}>
290
- {heading}
441
+ {handle && (snapping && !fullOnly ? (
442
+ // ➖ 0.2.0: the handle (40×4 bar in a 24px strip, 44px touch zone): a button that toggles S1 / S2
443
+ <button type="button" className={styles.abDrawerHandle} data-ab-part="drawer-handle" aria-expanded={snap === 'full'} aria-label={snap === 'full' ? handleLabels?.collapse ?? 'Collapse' : handleLabels?.expand ?? 'Expand'} onClick={() => { setReturned(false); setSnap(snap === 'full' ? 'partial' : 'full'); }} data-ab-grip="grip" {...gripProps} />
444
+ ) : <div className={styles.abDrawerHandle} data-ab-part="drawer-handle" aria-hidden="true" {...(snapping ? { ...gripProps, 'data-ab-grip': 'grip' } : {})} />)}
445
+ <div className={styles.abDrawerHeader} data-ab-part="drawer-header" {...(snapping ? { ...gripProps, 'data-ab-grip': 'grip' } : {})}>
446
+ {head}
291
447
  <button type="button" className={styles.abDrawerClose} data-ab-part="drawer-close" aria-label={closeLabel} onClick={() => close.current()}>
292
- <span aria-hidden="true">✕</span>
448
+ {closeIcon ?? <span aria-hidden="true">✕</span>}
293
449
  </button>
294
450
  </div>
295
- <div className={styles.abDrawerBody} data-ab-part="drawer-body">{children}</div>
451
+ <div className={styles.abDrawerBody} data-ab-part="drawer-body" {...(snapping ? { ...gripProps, 'data-ab-grip': 'body' } : {})}>{children}</div>
296
452
  {footer != null && <div className={styles.abDrawerFooter} data-ab-part="drawer-footer">{footer}</div>}
297
453
  </div>
298
454
  </div>,
@@ -0,0 +1,210 @@
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
+ * @project: ab-nextjs-components
27
+ * @name: Drawers v2 kit styles
28
+ * @file: ab-drawer/kit.module.css
29
+ * @type: CSS module
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ */
32
+
33
+ /*
34
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
+ * MOTTO: We'll always do more 😜!!!
36
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
+ */
38
+
39
+
40
+ /* 🧰 drawers v2 (John's frames, God 01:22): the shared look of AbSettingsDrawer, AbNavDrawer, AbTocDrawer and
41
+ AbSearchDrawer. Values are the mock's (drawer.css), read through the theme tokens where theme 0.3.5+ has them.
42
+ Doubled classes beat AbDrawer's own rules without !important. */
43
+
44
+ /* 🎨 local tokens: light, then dark (CSS modules need :global for the theme classes) */
45
+ .sheet {
46
+ --ab-dr-bg: var(--ab-color-bg, #fff8f5); /* 🎨 --bg */
47
+ --ab-dr-card: var(--ab-color-card, #fff); /* 🃏 --card */
48
+ --ab-dr-card2: #fbf3ec; /* 🃏 --card2 (segmented track) */
49
+ --ab-dr-on: #f7ede4; /* 🎯 the active row (mock .light .row.on) */
50
+ --ab-dr-on-ring: inset 0 0 0 1px rgb(166 124 82 / 0.3); /* 🎯 its 1px ring */
51
+ --ab-dr-seg-on: var(--ab-color-card, #fff); /* 🎚️ the raised segment */
52
+ --ab-dr-faint: #9c8c80; /* ➖ the handle bar (--faint) */
53
+ }
54
+ :global(.dark) .sheet, :global([data-theme='dark']) .sheet {
55
+ --ab-dr-bg: var(--ab-color-pane-main, #1d150f); /* 🌙 the sheet is #1D150F */
56
+ --ab-dr-card2: #2c2118;
57
+ --ab-dr-on: var(--ab-color-tint, rgb(166 124 82 / 0.2)); /* 🌙 tint, no ring */
58
+ --ab-dr-on-ring: none;
59
+ --ab-dr-seg-on: #3a2b1e;
60
+ --ab-dr-faint: #86776b;
61
+ }
62
+
63
+ /* 🗄️ every v2 sheet: --bg, a 1px --border edge, the mock shadow */
64
+ .sheet.sheet {
65
+ background: var(--ab-dr-bg); color: var(--ab-color-text, #211a16); /* 🎨 */
66
+ border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); /* ➖ */
67
+ box-shadow: 0 -8px 32px rgb(25 18 12 / 0.22); /* 🌗 */
68
+ outline: none; /* 🎯 */
69
+ }
70
+ /* ⬆️ bottom: 16px top radius, no bottom edge; 16px + home indicator below (24px on laptop) */
71
+ .sheet.sheet[data-side='bottom'] { border-bottom: 0; border-radius: 16px 16px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
72
+ .sheet.sheet[data-side='bottom'][data-center='main'] { padding-bottom: 24px; }
73
+ /* ⬅️ left: 320px, 0 16 16 0; ➡️ right: 296px, 16 0 0 16 (widths come from `size`) */
74
+ .sheet.sheet:is([data-side='left'], [data-side='start']) { border-inline-start: 0; border-radius: 0 16px 16px 0; box-shadow: 8px 0 32px rgb(25 18 12 / 0.22); padding-top: env(safe-area-inset-top, 0px); }
75
+ .sheet.sheet:is([data-side='right'], [data-side='end']) { border-inline-end: 0; border-radius: 16px 0 0 16px; box-shadow: -8px 0 32px rgb(25 18 12 / 0.22); padding-top: env(safe-area-inset-top, 0px); }
76
+ .sheet.sheet:is([data-side='left'], [data-side='start'], [data-side='right'], [data-side='end']) { max-width: 100%; }
77
+
78
+ /* ➖ the handle bar: 40×4 in --faint */
79
+ .sheet [data-ab-part='drawer-handle']::before { background: var(--ab-dr-faint); }
80
+ /* 🔝 header: 56px, 24px start inset; the title is Mulish 800 22px (20px on the right drawer) */
81
+ .sheet [data-ab-part='drawer-header'] { block-size: 56px; box-sizing: border-box; padding: 0 8px 0 24px; gap: 8px; }
82
+ .sheet [data-ab-part='drawer-header'] > :first-child { font-family: var(--ab-font-title, 'Mulish', inherit); font-weight: 800; font-size: 22px; letter-spacing: -0.01em; line-height: 1.2; }
83
+ .titleSm [data-ab-part='drawer-header'] > :first-child { font-size: 20px; }
84
+ /* ✕ close: 44px, 8px radius, --muted, 24px glyph */
85
+ .sheet [data-ab-part='drawer-close'] { inline-size: 44px; block-size: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--ab-color-muted, #6b5b50); }
86
+ @media (hover: hover) { .sheet [data-ab-part='drawer-close']:hover { background: var(--ab-color-hover, rgb(166 124 82 / 0.08)); } } /* 🖱️ 0.2.1 (Joseph): no sticky tap-hover on touch */
87
+ .sheet [data-ab-part='drawer-close']:focus { outline: none; }
88
+ .sheet [data-ab-part='drawer-close']:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 2px; }
89
+ /* 📜 body: 16px sides */
90
+ .sheet [data-ab-part='drawer-body'] { padding: 0 16px; display: flex; flex-direction: column; }
91
+
92
+ /* 🏷️ section label: Inter 700 12/16 uppercase +0.08em, --muted */
93
+ .lbl { margin: 0; padding: 16px 16px 8px; font: 700 12px/16px var(--ab-font-body, 'Inter', inherit); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ab-color-muted, #6b5b50); }
94
+ /* ▭ a 48px row (settings, footer links) */
95
+ .row {
96
+ box-sizing: border-box; display: flex; align-items: center; gap: 16px; flex: none; /* 📐 */
97
+ block-size: 48px; padding: 0 16px; border: 0; border-radius: 8px; margin: 0; inline-size: 100%; /* 📏 */
98
+ background: transparent; color: var(--ab-color-text, #211a16); font: 500 16px/1.2 var(--ab-font-body, 'Inter', inherit); /* 🔤 */
99
+ text-align: start; text-decoration: none; cursor: pointer; /* 🖱️ */
100
+ }
101
+ .row > svg, .row > .ic { flex: none; inline-size: 24px; block-size: 24px; color: var(--ab-color-muted, #6b5b50); }
102
+ @media (hover: hover) { .row:hover { background: var(--ab-color-hover, rgb(166 124 82 / 0.08)); } } /* 🖱️ 0.2.1 (Joseph): no sticky tap-hover on touch */
103
+ .row:focus { outline: none; }
104
+ .row:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: -2px; }
105
+ .row[aria-checked='true'], .row[aria-current='page'] { background: var(--ab-dr-on); box-shadow: var(--ab-dr-on-ring); color: var(--ab-color-accent-text, #8b6340); font-weight: 700; } /* 🎯 */
106
+ .row[aria-checked='true'] > svg, .row[aria-current='page'] > svg { color: var(--ab-color-accent-text, #8b6340); }
107
+ .ck { margin-inline-start: auto; color: var(--ab-color-accent-text, #8b6340); } /* ✓ 24px check */
108
+ .row > .ck { color: var(--ab-color-accent-text, #8b6340); }
109
+ .chev { margin-inline-start: 0; } /* › right after the label (mock: "Settings ›") */
110
+ .hr { block-size: 1px; margin: 8px 16px; border: 0; background: var(--ab-color-div, rgb(92 64 48 / 0.11)); flex: none; }
111
+
112
+ /* 🎚️ segmented control: 48px, 4px track padding, 3 equal segments, 14px 600 */
113
+ .seg { box-sizing: border-box; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; block-size: 48px; padding: 4px; margin: 0 0 8px; border-radius: 8px; background: var(--ab-dr-card2); border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); }
114
+ .segBtn { display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 6px; background: transparent; color: var(--ab-color-muted, #6b5b50); font: 600 14px/1 var(--ab-font-body, 'Inter', inherit); cursor: pointer; padding: 0; }
115
+ .segBtn > svg { inline-size: 18px; block-size: 18px; }
116
+ .segBtn[aria-checked='true'] { background: var(--ab-dr-seg-on); color: var(--ab-color-accent-text, #8b6340); box-shadow: 0 1px 3px rgb(25 18 12 / 0.12); outline: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); }
117
+ .segBtn:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 1px; }
118
+
119
+ /* ⬅️ the nav drawer: logo header, the version chip, a scrolling nav (44px rows, 15px) with a 72px fade, a pinned footer */
120
+ .logoRow { display: flex; align-items: center; min-inline-size: 0; }
121
+ .logoRow a { display: flex; align-items: center; color: inherit; }
122
+ .ver { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; block-size: 32px; padding: 0 8px 0 10px; margin: 0 0 8px 8px; box-sizing: border-box; border-radius: 8px; border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); background: var(--ab-dr-card); color: var(--ab-color-muted, #6b5b50); font: 500 13px/1 var(--ab-font-body, 'Inter', inherit); }
123
+ .ver b { font-family: var(--ab-font-mono, 'Roboto Mono', monospace); color: var(--ab-color-accent-text, #8b6340); font-weight: 600; }
124
+ .ver > svg { inline-size: 18px; block-size: 18px; }
125
+ .navWrap { position: relative; flex: 1 1 auto; min-block-size: 0; display: flex; flex-direction: column; }
126
+ .nav { flex: 1 1 auto; min-block-size: 0; overflow: hidden auto; overscroll-behavior: contain; padding-bottom: 72px; }
127
+ .fade { position: absolute; inset: auto 0 0; block-size: 72px; pointer-events: none; background: linear-gradient(transparent, var(--ab-dr-bg)); } /* 🌫️ marks the scroll */
128
+ .grp { margin: 0; padding: 16px 12px 8px; font: 700 12px/16px var(--ab-font-body, 'Inter', inherit); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ab-color-muted, #6b5b50); }
129
+ .list { list-style: none; margin: 0; padding: 0; }
130
+ .nv { box-sizing: border-box; display: flex; align-items: center; gap: 12px; block-size: 44px; padding: 0 12px; border-radius: 8px; color: var(--ab-color-text, #211a16); font: 500 15px/1.2 var(--ab-font-body, 'Inter', inherit); text-decoration: none; }
131
+ .nv > svg { flex: none; inline-size: 22px; block-size: 22px; color: var(--ab-color-muted, #6b5b50); }
132
+ @media (hover: hover) { .nv:hover { background: var(--ab-color-hover, rgb(166 124 82 / 0.08)); } } /* 🖱️ 0.2.1 (Joseph): no sticky tap-hover on touch */
133
+ .nv:focus { outline: none; }
134
+ .nv:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: -2px; }
135
+ .nv[aria-current='page'] { background: var(--ab-dr-on); box-shadow: var(--ab-dr-on-ring); color: var(--ab-color-accent-text, #8b6340); font-weight: 700; }
136
+ .nv[aria-current='page'] > svg { color: var(--ab-color-accent-text, #8b6340); }
137
+ .mini { margin-inline-start: auto; font: 400 12px/1 var(--ab-font-mono, 'Roboto Mono', monospace); color: var(--ab-color-muted, #6b5b50); }
138
+ .navFoot { flex: none; border-top: 1px solid var(--ab-color-div, rgb(92 64 48 / 0.11)); margin: 0 -16px; padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px)); } /* 📌 pinned, full-width rule */
139
+
140
+ /* ➡️ the outline: 44px rows on a 2px rail, level 3 indented 16px, the active one bronze */
141
+ .toc { list-style: none; margin: 0 0 0 8px; padding: 0; }
142
+ .tocLink { box-sizing: border-box; display: flex; align-items: center; block-size: 44px; padding: 0 16px; border-inline-start: 2px solid var(--ab-color-div, rgb(92 64 48 / 0.11)); color: var(--ab-color-muted, #6b5b50); font: 400 15px/1.2 var(--ab-font-body, 'Inter', inherit); text-decoration: none; }
143
+ .tocLink[data-level='3'] { padding-inline-start: 32px; font-size: 14px; }
144
+ .tocLink[data-level='4'] { padding-inline-start: 48px; font-size: 14px; }
145
+ .tocLink[aria-current='location'] { border-inline-start-color: var(--ab-color-accent, #a67c52); color: var(--ab-color-accent-text, #8b6340); font-weight: 700; background: var(--ab-color-hover, rgb(166 124 82 / 0.08)); }
146
+ .tocLink:focus { outline: none; }
147
+ .tocLink:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: -2px; }
148
+ .tocHr { margin: 16px 8px; }
149
+ .tocRow { font-size: 15px; margin: 0 -8px; inline-size: calc(100% + 16px); }
150
+
151
+ /* 🔎 search: a 48px field with a 2px accent border, then the results (they scroll) */
152
+ .searchBody { flex: 1 1 auto; min-block-size: 0; display: flex; flex-direction: column; }
153
+ .field { box-sizing: border-box; flex: none; display: flex; align-items: center; gap: 12px; block-size: 48px; padding: 0 4px 0 16px; margin: 0 0 8px; border-radius: 8px; border: 2px solid var(--ab-color-accent, #a67c52); background: var(--ab-dr-card); }
154
+ .field > svg { flex: none; inline-size: 22px; block-size: 22px; color: var(--ab-color-muted, #6b5b50); }
155
+ .input { flex: 1 1 auto; min-inline-size: 0; border: 0; outline: none; background: transparent; color: var(--ab-color-text, #211a16); font: 500 16px/1.2 var(--ab-font-body, 'Inter', inherit); caret-color: var(--ab-color-accent-text, #8b6340); padding: 0; }
156
+ .input::placeholder { color: var(--ab-color-muted, #6b5b50); font-weight: 400; }
157
+ .input::-webkit-search-cancel-button { display: none; }
158
+ .iconSm { flex: none; inline-size: 40px; block-size: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: transparent; color: var(--ab-color-muted, #6b5b50); cursor: pointer; padding: 0; }
159
+ .iconSm > svg { inline-size: 20px; block-size: 20px; }
160
+ @media (hover: hover) { .iconSm:hover { background: var(--ab-color-hover, rgb(166 124 82 / 0.08)); } } /* 🖱️ 0.2.1 (Joseph): no sticky tap-hover on touch */
161
+ .iconSm:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: -2px; }
162
+ .results { flex: 1 1 auto; min-block-size: 0; overflow: hidden auto; overscroll-behavior: contain; }
163
+ .recent { gap: 12px; padding-inline-end: 0; font-size: 15px; cursor: default; }
164
+ @media (hover: hover) { .recent:hover { background: transparent; } } /* 🖱️ 0.2.1 (Joseph): no sticky tap-hover on touch */
165
+ .recentGo { flex: 1 1 auto; min-inline-size: 0; border: 0; background: none; padding: 0; text-align: start; color: inherit; font: inherit; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
166
+ .recentGo:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 2px; }
167
+ .grp2 { display: flex; align-items: baseline; gap: 8px; padding: 12px 16px 4px; margin: 0; }
168
+ .grp2 > span { font: 700 12px/16px var(--ab-font-body, 'Inter', inherit); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ab-color-muted, #6b5b50); }
169
+ .grp2 > code { font: 400 12px/16px var(--ab-font-mono, 'Roboto Mono', monospace); color: var(--ab-color-muted, #6b5b50); }
170
+ .sr { box-sizing: border-box; display: flex; align-items: center; gap: 12px; min-block-size: 56px; padding: 4px 12px; border-radius: 8px; color: inherit; text-decoration: none; }
171
+ .sr[aria-selected='true'] { background: var(--ab-dr-on); box-shadow: var(--ab-dr-on-ring); }
172
+ @media (hover: hover) { .sr:hover { background: var(--ab-color-hover, rgb(166 124 82 / 0.08)); } } /* 🖱️ 0.2.1 (Joseph): no sticky tap-hover on touch */
173
+ @media (hover: hover) { .sr[aria-selected='true']:hover { background: var(--ab-dr-on); } } /* 🖱️ 0.2.1 (Joseph): no sticky tap-hover on touch */
174
+ .pkgIc { flex: none; inline-size: 32px; block-size: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--ab-dr-card2); color: var(--ab-color-accent-text, #8b6340); }
175
+ .pkgIc > svg { inline-size: 20px; block-size: 20px; }
176
+ .srText { flex: 1 1 auto; min-inline-size: 0; }
177
+ .srText > b { display: block; font: 600 15px/1.3 var(--ab-font-body, 'Inter', inherit); color: var(--ab-color-text, #211a16); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
178
+ .srText > small { display: block; font: 400 13px/1.35 var(--ab-font-body, 'Inter', inherit); color: var(--ab-color-muted, #6b5b50); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
179
+ .srMeta { flex: none; font: 400 12px/1 var(--ab-font-mono, 'Roboto Mono', monospace); color: var(--ab-color-muted, #6b5b50); }
180
+ .mark { background: none; color: var(--ab-color-accent-text, #8b6340); font-weight: 700; } /* 🖍️ the matched part */
181
+ .nores { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 24px; }
182
+ .nores > .pkgIc { inline-size: 56px; block-size: 56px; border-radius: 16px; }
183
+ .nores > .pkgIc > svg { inline-size: 28px; block-size: 28px; }
184
+ .nores > b { margin-top: 8px; font: 800 20px/1.2 var(--ab-font-title, 'Mulish', inherit); }
185
+ .nores > p { margin: 0; max-inline-size: 300px; font: 400 15px/1.5 var(--ab-font-body, 'Inter', inherit); color: var(--ab-color-muted, #6b5b50); }
186
+ .srOnly { position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
187
+
188
+ /* 📱 the mobile main header: 56px row, logo left, 44px globe + theme buttons right */
189
+ .mh { box-sizing: border-box; display: flex; align-items: center; block-size: 100%; min-block-size: 56px; padding: 0 4px 0 16px; gap: 0; background: transparent; }
190
+ .mh > .logoRow { flex: 1 1 auto; }
191
+ .ibtn { flex: none; inline-size: 44px; block-size: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: transparent; color: var(--ab-color-text, #211a16); cursor: pointer; padding: 0; }
192
+ .ibtn > svg { inline-size: 24px; block-size: 24px; }
193
+ @media (hover: hover) { .ibtn:hover { background: var(--ab-color-hover, rgb(166 124 82 / 0.08)); } } /* 🖱️ 0.2.1 (Joseph): no sticky tap-hover on touch */
194
+ .ibtn:focus { outline: none; }
195
+ .ibtn:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: -2px; }
196
+ .verRow { display: flex; flex: none; } /* 🏷️ keeps the chip its own size */
197
+
198
+ /* 🔎 the search sheet: laptop = a fixed 70% (567px at 810) with the results scrolling inside under a 48px fade */
199
+ .searchSheet.searchSheet[data-center='main'] { block-size: 70%; }
200
+ .resWrap { position: relative; flex: 1 1 auto; min-block-size: 0; display: flex; flex-direction: column; }
201
+ .resFade { display: none; position: absolute; inset: auto 0 0; block-size: 48px; pointer-events: none; background: linear-gradient(transparent, var(--ab-dr-bg)); }
202
+ .searchSheet[data-center='main'] .resFade { display: block; }
203
+ .didYouMean { justify-content: center; gap: 0; margin-top: 8px; font-size: 15px; }
204
+ .nores code { font-family: var(--ab-font-mono, 'Roboto Mono', monospace); }
205
+ /* 👤 0.2.1: the settings account row (avatar · name / email) and the Help / About block */
206
+ .acct { block-size: auto; min-block-size: 56px; padding-block: 8px; } /* 📏 two lines fit */
207
+ .acctText { display: flex; flex-direction: column; min-width: 0; gap: 2px; } /* 📐 */
208
+ .acctText b { font-weight: 600; } /* 🔤 the name */
209
+ .acctText small { font-size: 13px; color: var(--ab-color-muted, #6b5b50); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* ✉️ */
210
+ .more { display: flex; flex-direction: column; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--ab-color-div, rgb(92 64 48 / 0.11)); } /* ➖ after Language */
@@ -47,6 +47,7 @@
47
47
  inset: 0; /* 📐 the whole scope */
48
48
  z-index: 60; /* ⬆️ above the panes and the aside sheet (30) */
49
49
  overflow: hidden; /* ✂️ a sliding panel never leaks out */
50
+ overflow: clip; /* ✂️ 0.2.0: clip, so nothing (focus, scrollIntoView) can scroll the layer itself */
50
51
  pointer-events: none; /* 🖱️ idle layer = transparent to clicks */
51
52
  contain: layout paint; /* 🚀 */
52
53
  }
@@ -113,6 +114,44 @@
113
114
 
114
115
  /* ♿ reduced motion: no slide, no fade (handled by ab-nextjs-animations .ab-motion-*) */
115
116
 
117
+ /* ===== 🆕 0.2.0 drawers v2 (John's frames, God 01:22) ===== */
118
+ /* 🥞 stacking tiers (spec z-order): right drawer < left drawer < bottom sheet. The layers are siblings in the host,
119
+ so the tier sits on the layer (z 60 / 61 / 62 keeps all three above the panes and bars, like before) */
120
+ .abDrawerLayer:has(> .abDrawerFrame[data-tier='nav']) { z-index: 61; } /* ⬅️ the left drawer is in front of the right one */
121
+ .abDrawerLayer:has(> .abDrawerFrame[data-tier='sheet']) { z-index: 62; } /* ⬆️ the bottom sheet is on top */
122
+ /* 🎞️ side drawers slide in 200ms and out 160ms, cubic-bezier(.2,0,0,1) (the ab-nextjs-animations tokens) */
123
+ .abDrawerFrame[data-tier] > .abDrawer:is([data-side='left'], [data-side='right'], [data-side='start'], [data-side='end']) { --ab-motion-duration: var(--ab-drawer-duration, 200ms); }
124
+ .abDrawerFrame[data-tier][data-state='closed'] > .abDrawer:is([data-side='left'], [data-side='right'], [data-side='start'], [data-side='end']) { --ab-motion-duration: var(--ab-drawer-close-duration, 160ms); }
125
+ /* 🫳 while a finger leads, the sheet follows it 1:1 (no transition); on release CSS takes over again */
126
+ .abDrawer.abDrawer[data-dragging] { --ab-motion-duration: 0ms; } /* ⏱️ the ab-nextjs-animations token at 0 */
127
+ .abDrawer[data-swipe='true']:not([data-side='bottom']) { touch-action: pan-y; } /* ↔️ sideways drags reach us, vertical scroll stays native */
128
+
129
+ /* ➖ the handle: a 40×4 bar in a 24px strip at the very top; its touch zone reaches 44px (over the header) */
130
+ .abDrawerHandle {
131
+ flex: none; position: relative; z-index: 1; display: block; box-sizing: border-box; /* 📐 */
132
+ inline-size: 100%; block-size: 24px; margin: 0; padding: 0; border: 0; /* 📏 */
133
+ background: transparent; cursor: grab; touch-action: none; /* 🤏 the drag is ours */
134
+ }
135
+ .abDrawerHandle::before { content: ''; position: absolute; inset-block-start: 10px; inset-inline-start: calc(50% - 20px); inline-size: 40px; block-size: 4px; border-radius: 2px; background: var(--ab-color-handle, rgb(25 18 12 / 0.18)); } /* ➖ the bar */
136
+ .abDrawerHandle::after { content: ''; position: absolute; inset: 0 0 -20px; } /* 🖐️ 24 + 20 = 44px touch zone */
137
+ .abDrawerHandle:focus { outline: none; }
138
+ .abDrawerHandle:focus-visible::before { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 4px; } /* ♿ */
139
+ .abDrawer[data-snap] > .abDrawerHeader { touch-action: none; } /* 🤏 the header drags the sheet too */
140
+
141
+ /* 🧲 snap points (bottom, below 768px): the sheet is full height (top at the safe-area top) and slides:
142
+ closed = off-screen, S1 = 70% of the app visible (JS measures --ab-drawer-partial-offset), S2 = all of it */
143
+ .abDrawer[data-side='bottom'][data-snap] { inset: env(safe-area-inset-top, 0px) 0 0 0; max-height: none; transform: translateY(100%); }
144
+ .abDrawerFrame[data-state='open'] > .abDrawer[data-snap='partial'] { transform: translateY(var(--ab-drawer-partial-offset, 30%)); } /* 🧲 S1 */
145
+ .abDrawerFrame[data-state='open'] > .abDrawer[data-snap='full'] { transform: none; } /* 🧲 S2 */
146
+
147
+ /* 💻 laptop (768px and up): centred in the main pane, min(640px, main width), at most 70% of the app height */
148
+ .abDrawer[data-side='bottom'][data-center='main'] {
149
+ --ab-drawer-w: min(var(--ab-drawer-max-width, 640px), var(--ab-drawer-main-width, 100%)); /* 📏 never wider than main */
150
+ inset: auto auto 0 calc(var(--ab-drawer-main-left, 0px) + (var(--ab-drawer-main-width, 100%) - var(--ab-drawer-w)) / 2); /* 🎯 centred */
151
+ inline-size: var(--ab-drawer-w); max-inline-size: none; margin: 0; /* 📏 */
152
+ max-block-size: 70%; /* 📏 ≤ 70% of the app (567px at 810) */
153
+ }
154
+
116
155
  /* 🧩 D41 no-JS fallback: an in-flow section; hidden as soon as scripting runs (hydration swaps in the drawer) */
117
156
  .abDrawerFallback { display: block; margin-block: 16px; border: var(--ab-divider-hairline, 1px solid rgb(0 0 0 / 0.12)); border-radius: 12px; }
118
157
  .abDrawerFallback .abDrawerTitle { padding: 12px 20px 0; }