ab-nextjs-components 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## 0.1.9 — 2026-10-14
2
+
3
+ - **AbLogo:** `wordmark` prop (`true` → "Elements", or any string) renders a mark + Quicksand Bold lockup (`font-quicksand-bold` from ab-nextjs-fonts); `color` prop (`--ab-logo-color`); light / dark (`html.dark`)
4
+ - **AbLogo fix:** `naked` with no `src` now masks with the shipped Ab mark (via `--app-logo-url` fallback) instead of a bronze square when the chrome CSS isn't loaded
5
+ - **AbSplash (new, `ab-nextjs-components/ab-splash`):** brand overlay + `abSplashGateScript` / `buildAbSplashGateScript({ locales, defaultLocale })`; root-path RegExp built from locales minus the default and JSON-injected; skips `navigator.webdriver` / bot UAs; standalone via `matchMedia` OR `navigator.standalone`; each storage get/set in its own try (failed get = seen); `data-ab-splash` set last; page behind is `inert` while shown; track `min(18rem, 28vw)`
6
+ - **CSP:** `ab-nextjs-components/ab-splash/csp` → `getAbSplashGateSha256(script)`, `buildAbSplashGate(options)`, `AB_SPLASH_GATE_SHA256`
7
+ - **AbLinearProgress (new here, `ab-nextjs-components/ab-linear-progress`):** ported from the reviewed core work — determinate / indeterminate, `color`, reduced motion, dark, RTL sweep, empty `aria-label` dropped; shipped CSS module. AbSplash uses it, so **no `ab-nextjs-core` peer is needed**
8
+ - **CSP (P1):** `ab-nextjs-components/ab-splash/csp` now ships compiled `csp.mjs` + `csp.d.ts` (Node-loadable from `next.config.*`); `build:csp` script, `check:publish` / `prepublishOnly` fail when it's stale
9
+ - **AbSplash:** unmount removes `data-ab-splash` + `inert`; scroll lock gets the same 1.2 s CSS failsafe; surfaces `#FFF8F3` / `#1A1310` (mocks)
10
+ - **Tooling:** `esbuild ^0.28.2` is now an explicit devDependency (direct in `pnpm-lock.yaml`; frozen install verified)
11
+ - **AbSplash:** StrictMode-safe teardown (`scheduleAbSplashFinish` / `cancelAbSplashFinish`); overflow failsafe verified in Chromium + WebKit
12
+ - **Tooling:** `typecheck` script, `types/css.d.ts`, vitest automatic JSX, `scripts/build-demo.mjs`
13
+
1
14
  ## 0.1.8 — 2026-10-05
2
15
 
3
16
  - **Chrome styles:** dialog, toast, logo (`span.app-logo`), spinner, and empty-state doodle CSS + SVG assets now ship here via `@import "ab-nextjs-components/styles.css"` (import after `ab-nextjs-theme/styles.css`)
@@ -0,0 +1,125 @@
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: AB Linear Progress
28
+ * @file: ab-linear-progress/index.tsx
29
+ * @type: Component (server-safe, no hooks) — ported from the reviewed ab-nextjs-core version
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ */
32
+
33
+ /*
34
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
+ * MOTTO: We'll always do more 😜!!!
36
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
+ */
38
+
39
+ // 🧩 React types only (no runtime hooks → works in server components too)
40
+ import type { CSSProperties, ReactElement } from 'react';
41
+ // 🧵 tiny class-name joiner
42
+ import clsx from 'clsx';
43
+ // 🎨 package-shipped CSS module (no Tailwind scanning of node_modules needed)
44
+ import styles from './styles.module.css';
45
+
46
+ // 📐 public props of <AbLinearProgress />
47
+ export interface AbLinearProgressProps {
48
+ // 🏷️ extra class names from the consumer
49
+ className?: string;
50
+ // 🎨 bar color (any CSS color); defaults to the bronze brand color
51
+ color?: string;
52
+ // 🙈 hide the whole bar (kept for API parity with LYD chrome)
53
+ hidden?: boolean;
54
+ // 🔁 indeterminate mode: no known value, bar sweeps back and forth
55
+ isIndeterminate?: boolean;
56
+ // 📊 determinate value from 0 to 100
57
+ progress?: number;
58
+ // 🗣️ accessible name for screen readers
59
+ label?: string;
60
+ }
61
+
62
+ // 🔒 clamp any number into the 0..100 range (NaN → 0)
63
+ export const clampAbProgress = (value: number): number => {
64
+ // 🚫 non-finite values become 0
65
+ if (!Number.isFinite(value)) return 0;
66
+ // ✂️ clamp and return
67
+ return Math.min(100, Math.max(0, value));
68
+ };
69
+
70
+ /**
71
+ * 📊 AbLinearProgress — determinate (`progress`) or indeterminate (`isIndeterminate`)
72
+ * linear progress bar. Respects prefers-reduced-motion and html.dark.
73
+ */
74
+ const AbLinearProgress = ({
75
+ className, // 🏷️ consumer classes
76
+ color, // 🎨 optional custom color
77
+ hidden = false, // 👀 visible by default
78
+ isIndeterminate = false, // 🔁 determinate by default
79
+ progress = 0, // 📊 start empty
80
+ label = 'Loading', // 🗣️ default accessible name
81
+ }: AbLinearProgressProps): ReactElement => {
82
+ // ✂️ safe 0..100 value
83
+ const value = clampAbProgress(progress);
84
+ // 🎨 expose the color as a CSS custom property (only when provided)
85
+ const rootStyle = (color ? { '--ab-linear-progress-color': color } : undefined) as CSSProperties | undefined;
86
+
87
+ // 🧱 render the track + bar
88
+ return (
89
+ <div
90
+ // 🏷️ stable public class + module class + consumer class
91
+ className={clsx('AbLinearProgress', styles.abLinearProgress, className)}
92
+ // 🎨 custom color, if any
93
+ style={rootStyle}
94
+ // 🙈 native hidden attribute
95
+ hidden={hidden}
96
+ // ♿ ARIA progressbar role
97
+ role="progressbar"
98
+ // 🗣️ accessible name (dropped when empty, e.g. inside an aria-hidden overlay)
99
+ aria-label={label ? label : undefined}
100
+ // 📏 range lower bound
101
+ aria-valuemin={0}
102
+ // 📏 range upper bound
103
+ aria-valuemax={100}
104
+ // 📊 current value only in determinate mode (omitted = indeterminate per ARIA)
105
+ aria-valuenow={isIndeterminate ? undefined : value}
106
+ // ⏳ tell AT we're busy while indeterminate
107
+ aria-busy={isIndeterminate ? true : undefined}
108
+ // 🙈 hide from AT when hidden
109
+ aria-hidden={hidden ? true : undefined}
110
+ // 🔖 mode hook for styling/tests
111
+ data-ab-mode={isIndeterminate ? 'indeterminate' : 'determinate'}
112
+ >
113
+ {/* 🟫 the moving / filling bar */}
114
+ <div
115
+ // 🏷️ bar class (indeterminate gets the sweep class)
116
+ className={clsx(styles.abLinearProgress__bar, isIndeterminate && styles.abLinearProgress__bar_indeterminate)}
117
+ // 📐 determinate width via transform (GPU friendly) — none in indeterminate
118
+ style={isIndeterminate ? undefined : { transform: `scaleX(${value / 100})` }}
119
+ />
120
+ </div>
121
+ );
122
+ };
123
+
124
+ // 📦 default export
125
+ export default AbLinearProgress;
@@ -0,0 +1,121 @@
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: AB Linear Progress - Component Stylesheet (plain CSS, Tailwind-independent)
28
+ * @file: ab-linear-progress/styles.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
+ /* ===== 📊 AB LINEAR PROGRESS ===== */
40
+
41
+ /* 🧱 track */
42
+ .abLinearProgress {
43
+ /* 🎨 default bronze color (light) */
44
+ --_ab-lp-color: var(--ab-linear-progress-color, #A67C52);
45
+ /* 📏 default height, overridable */
46
+ --_ab-lp-height: var(--ab-linear-progress-height, 4px);
47
+ position: relative; /* 📌 anchor for the bar */
48
+ display: block; /* 🧱 full-width block */
49
+ width: 100%; /* ↔️ fill the parent */
50
+ height: var(--_ab-lp-height); /* ↕️ thin bar */
51
+ overflow: hidden; /* ✂️ clip the sweeping bar */
52
+ border-radius: 9999px; /* 💊 pill */
53
+ /* 🌫️ faint track tinted by the bar color */
54
+ background-color: color-mix(in srgb, var(--_ab-lp-color) 18%, transparent);
55
+ }
56
+
57
+ /* 🙈 honor the hidden attribute even if display is set */
58
+ .abLinearProgress[hidden] {
59
+ display: none;
60
+ }
61
+
62
+ /* 🌙 dark mode: lighter bronze on dark surfaces */
63
+ :global(html.dark) .abLinearProgress {
64
+ --_ab-lp-color: var(--ab-linear-progress-color, #C9A27A);
65
+ background-color: color-mix(in srgb, var(--_ab-lp-color) 22%, transparent);
66
+ }
67
+
68
+ /* 🟫 bar */
69
+ .abLinearProgress__bar {
70
+ position: absolute; /* 📌 sits on the track */
71
+ inset: 0; /* 📐 full size, scaled via transform */
72
+ border-radius: inherit; /* 💊 same pill */
73
+ background-color: var(--_ab-lp-color); /* 🎨 bar color */
74
+ transform-origin: left center; /* ⬅️ grow from the start */
75
+ transition: transform 240ms ease-out; /* 🎞️ smooth value changes */
76
+ }
77
+
78
+ /* ↔️ RTL: grow from the right */
79
+ :global([dir='rtl']) .abLinearProgress__bar {
80
+ transform-origin: right center;
81
+ }
82
+
83
+ /* 🔁 indeterminate: a 40% segment sweeping across */
84
+ .abLinearProgress__bar_indeterminate {
85
+ right: auto; /* 🔓 free the right edge */
86
+ width: 40%; /* 📏 segment width */
87
+ animation: abLinearProgressSweep 1.4s ease-in-out infinite; /* 🔁 loop */
88
+ }
89
+
90
+ /* 🎞️ sweep keyframes */
91
+ @keyframes abLinearProgressSweep {
92
+ 0% { transform: translateX(-100%); } /* ⬅️ off-screen left */
93
+ 100% { transform: translateX(250%); } /* ➡️ off-screen right */
94
+ }
95
+
96
+ /* ↔️ RTL indeterminate: anchor on the right and sweep right → left (mirrored keyframes) */
97
+ :global([dir='rtl']) .abLinearProgress__bar_indeterminate {
98
+ left: auto; /* 🔓 free the left edge */
99
+ right: 0; /* 📌 start on the right */
100
+ animation-name: abLinearProgressSweepRtl; /* ⬅️ mirrored sweep */
101
+ }
102
+
103
+ /* 🎞️ mirrored sweep keyframes (RTL) */
104
+ @keyframes abLinearProgressSweepRtl {
105
+ 0% { transform: translateX(100%); } /* ➡️ off-screen right */
106
+ 100% { transform: translateX(-250%); } /* ⬅️ off-screen left */
107
+ }
108
+
109
+ /* ♿ reduced motion: no animation, static bar */
110
+ @media (prefers-reduced-motion: reduce) {
111
+ .abLinearProgress__bar {
112
+ transition: none; /* 🚫 no value tween */
113
+ }
114
+ .abLinearProgress__bar_indeterminate,
115
+ :global([dir='rtl']) .abLinearProgress__bar_indeterminate {
116
+ animation: none; /* 🚫 no sweep (LTR + RTL) */
117
+ width: 100%; /* 🟫 full static bar */
118
+ opacity: 0.55; /* 🌫️ softened so it reads as "busy", not "done" */
119
+ transform: none; /* 📐 in place */
120
+ }
121
+ }
package/ab-logo/index.tsx CHANGED
@@ -27,70 +27,128 @@
27
27
  * @project: ab-nextjs-components
28
28
  * @name: AbLogo - Client
29
29
  * @file: ab-logo/index.tsx
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
30
31
  */
31
32
 
32
- 'use client';
33
+ /*
34
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
+ * MOTTO: We'll always do more 😜!!!
36
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
+ */
38
+
39
+ 'use client'; // 💧 client build (the server twin lives in `server/ab-logo`)
33
40
 
34
- import type { ReactElement } from 'react';
41
+ // 🧩 React types only
42
+ import type { CSSProperties, ReactElement } from 'react';
43
+ // 🧵 class-name joiner
35
44
  import clsx from 'clsx';
45
+ // 🎨 package-shipped CSS module (Tailwind-independent)
36
46
  import styles from './styles.module.css';
37
47
 
48
+ // 🅰️ the four logo looks
38
49
  export type AbLogoType = 'contained' | 'outlined' | 'hollow' | 'naked';
39
50
 
51
+ // 📐 public props
40
52
  export interface AbLogoProps {
53
+ // 🅰️ look of the mark (default: naked)
41
54
  type?: AbLogoType;
55
+ // 🏷️ consumer classes
42
56
  className?: string;
43
- /** Optional image src (contained). Defaults to the Ab logo shipped in this package (data URI). */
57
+ /** 🖼️ Optional image src. Defaults to the Ab mark shipped in this package (data URI). */
44
58
  src?: string;
45
- /** Optional CSS mask value for outlined/hollow/naked. */
59
+ /** 🎭 Optional CSS mask value for outlined/hollow/naked. */
46
60
  mask?: string;
61
+ // 🗣️ accessible name of the mark
47
62
  alt?: string;
63
+ // 📏 mark size (or wordmark font-size when `wordmark` is on)
48
64
  size?: number | string;
65
+ /** 🔤 Show the wordmark next to the mark: `true` → "Elements", or any string. */
66
+ wordmark?: boolean | string;
67
+ /** 🎨 Mark + wordmark color (CSS color). Defaults to bronze (light) / #FFF8F5 (dark). */
68
+ color?: string;
49
69
  }
50
70
 
51
- /** Inlined Ab logo shipped with this package (also at `ab-logo/ab-logo.svg`). */
52
- const DEFAULT_SRC = 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xml%3Aspace%3D%22preserve%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23A67C52%22%20d%3D%22m1.8%2020.5%209.3-17v17zM22.2%207.7l-9.3-4.2v17l9.3-4.2-4.7-4.3z%22/%3E%3Cpath%20d%3D%22m12.9%2020.5%209.3-4.2-9.3-8.6z%22%20opacity%3D%22.1%22/%3E%3C/svg%3E';
71
+ /** 🅰️ Inlined Ab logo shipped with this package (also at `ab-logo/ab-logo.svg`). */
72
+ export const AB_LOGO_DEFAULT_SRC = 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xml%3Aspace%3D%22preserve%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23A67C52%22%20d%3D%22m1.8%2020.5%209.3-17v17zM22.2%207.7l-9.3-4.2v17l9.3-4.2-4.7-4.3z%22/%3E%3Cpath%20d%3D%22m12.9%2020.5%209.3-4.2-9.3-8.6z%22%20opacity%3D%22.1%22/%3E%3C/svg%3E';
73
+
74
+ // 🔤 the default wordmark text (a brand name, never translated)
75
+ export const AB_LOGO_DEFAULT_WORDMARK = 'Elements';
76
+
77
+ // 📏 number → px, string → as is
78
+ const toCssSize = (size?: number | string): string | undefined =>
79
+ size != null ? (typeof size === 'number' ? `${size}px` : size) : undefined;
53
80
 
54
81
  const AbLogo = ({
55
- type = 'naked',
56
- className,
57
- src,
58
- mask,
59
- alt = 'Ab',
60
- size,
82
+ type = 'naked', // 🅰️ naked by default
83
+ className, // 🏷️ consumer classes
84
+ src, // 🖼️ optional image
85
+ mask, // 🎭 optional mask
86
+ alt = 'Ab', // 🗣️ default name
87
+ size, // 📏 optional size
88
+ wordmark, // 🔤 optional wordmark
89
+ color, // 🎨 optional color
61
90
  }: AbLogoProps): ReactElement => {
62
- const dim = size != null ? (typeof size === 'number' ? `${size}px` : size) : undefined;
91
+ // 📏 normalized size
92
+ const dim = toCssSize(size);
93
+ // 🔤 wordmark text (null = no wordmark)
94
+ const text = wordmark === true ? AB_LOGO_DEFAULT_WORDMARK : typeof wordmark === 'string' && wordmark ? wordmark : null;
95
+ // 🎨 color as a custom property consumed by the CSS module
96
+ const colorVar = (color ? { '--ab-logo-color': color } : {}) as CSSProperties;
63
97
 
98
+ // 🖼️ build the mark
99
+ let mark: ReactElement;
64
100
  if (type === 'contained') {
65
- return (
101
+ // 🖼️ contained = a real <img>
102
+ mark = (
103
+ // eslint-disable-next-line @next/next/no-img-element -- 🖼️ the default src is an inline data-URI SVG (nothing for next/image to optimize), and this package must not require next/image's loader config in consumer apps
66
104
  <img
67
- className={clsx('AbLogo', 'app-logo', styles.abLogoContained, className)}
68
- src={src ?? DEFAULT_SRC}
69
- alt={alt}
105
+ className={clsx(!text && ['AbLogo', 'app-logo', className], styles.abLogoContained, text && styles.abLogo__mark)}
106
+ src={src ?? AB_LOGO_DEFAULT_SRC}
107
+ alt={text ? '' : alt}
108
+ aria-hidden={text ? true : undefined}
70
109
  data-type="contained"
71
- style={dim ? { width: dim, height: dim } : undefined}
110
+ style={!text && dim ? { width: dim, height: dim } : undefined}
111
+ />
112
+ );
113
+ } else {
114
+ // 🎭 explicit mask/src wins; otherwise the CSS module masks with `--app-logo-url` or the shipped mark (no brown square ✅)
115
+ const maskValue = mask ?? (src ? `url('${src}') no-repeat 50% 50%` : undefined);
116
+ mark = (
117
+ <span
118
+ className={clsx(!text && ['AbLogo', 'app-logo', className], styles.abLogo, text && styles.abLogo__mark)}
119
+ data-type={type}
120
+ role={text ? undefined : 'img'}
121
+ aria-label={text ? undefined : alt}
122
+ aria-hidden={text ? true : undefined}
123
+ style={{
124
+ ...(!text ? colorVar : {}), // 🎨 color (standalone mark only; lockup sets it on the wrapper)
125
+ ...(!text && dim ? { width: dim, height: dim } : {}), // 📏 size
126
+ ...(maskValue ? { WebkitMask: maskValue, mask: maskValue, WebkitMaskSize: 'cover', maskSize: 'cover' } : {}), // 🎭 custom mask
127
+ }}
72
128
  />
73
129
  );
74
130
  }
75
131
 
76
- // With no `mask`/`src`, leave the mask to `ab-nextjs-components` chrome (`--app-logo-url` / `.app-logo`).
77
- // When `mask` or `src` is set, apply it inline (src becomes a CSS mask url).
78
- const maskValue = mask ?? (src ? `url('${src}') no-repeat 50% 50%` : undefined);
132
+ // 🅰️ no wordmark → just the mark (unchanged API)
133
+ if (!text) return mark;
134
+
135
+ // 🔤 lockup: mark + wordmark, one accessible image
79
136
  return (
80
137
  <span
81
- className={clsx('AbLogo', 'app-logo', styles.abLogo, className)}
138
+ className={clsx('AbLogo', 'AbLogo--wordmark', styles.abLogo__lockup, className)}
82
139
  data-type={type}
83
140
  role="img"
84
- aria-label={alt}
85
- style={{
86
- ...(dim ? { width: dim, height: dim } : {}),
87
- ...(maskValue
88
- ? { WebkitMask: maskValue, mask: maskValue, WebkitMaskSize: 'cover', maskSize: 'cover' }
89
- : {}),
90
- }}
91
- />
141
+ aria-label={`${alt} ${text}`.trim()}
142
+ style={{ ...colorVar, ...(dim ? { fontSize: dim } : {}) }}
143
+ >
144
+ {/* 🅰️ the mark */}
145
+ {mark}
146
+ {/* 🔤 the wordmark — Quicksand Bold from ab-nextjs-fonts */}
147
+ <span className={clsx('font-quicksand-bold', styles.abLogo__wordmark)} aria-hidden="true">{text}</span>
148
+ </span>
92
149
  );
93
150
  };
94
151
 
152
+ // 📦 exports
95
153
  export default AbLogo;
96
154
  export { AbLogo };
@@ -4,7 +4,31 @@
4
4
  * ab-nextjs-components
5
5
  * ~~~~~~~~~~~~
6
6
  * Copyright (c) 2026 Abraham Ukachi. The abElements Project.
7
- * Plain CSS modules — no Tailwind Tailwind apply (Turbopack-safe).
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: AbLogo - Component Stylesheet (plain CSS, Tailwind-independent)
29
+ * @file: ab-logo/styles.module.css
30
+ * @type: CSS Module
31
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
8
32
  */
9
33
 
10
34
  /*
@@ -13,18 +37,62 @@
13
37
  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14
38
  */
15
39
 
40
+ /* 🅰️ masked mark (naked / outlined / hollow) */
16
41
  .abLogo {
17
- display: block;
18
- position: relative;
19
- width: 1.5rem;
20
- height: 1.5rem;
21
- background-color: var(--app-logo-color, #a67c52);
42
+ display: block; /* 🧱 block box */
43
+ position: relative; /* 📌 positioning context */
44
+ width: 1.5rem; /* ↔️ default size */
45
+ height: 1.5rem; /* ↕️ default size */
46
+ /* 🎨 bronze by default; `--app-logo-color` (chrome) or `--ab-logo-color` (prop) override */
47
+ background-color: var(--app-logo-color, var(--ab-logo-color, #A67C52));
48
+ /* 🎭 the shipped Ab mark as mask → no brown square without chrome CSS ✅ */
49
+ -webkit-mask: var(--app-logo-url, url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xml%3Aspace%3D%22preserve%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23A67C52%22%20d%3D%22m1.8%2020.5%209.3-17v17zM22.2%207.7l-9.3-4.2v17l9.3-4.2-4.7-4.3z%22/%3E%3Cpath%20d%3D%22m12.9%2020.5%209.3-4.2-9.3-8.6z%22%20opacity%3D%22.1%22/%3E%3C/svg%3E")) no-repeat 50% 50%;
50
+ mask: var(--app-logo-url, url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xml%3Aspace%3D%22preserve%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23A67C52%22%20d%3D%22m1.8%2020.5%209.3-17v17zM22.2%207.7l-9.3-4.2v17l9.3-4.2-4.7-4.3z%22/%3E%3Cpath%20d%3D%22m12.9%2020.5%209.3-4.2-9.3-8.6z%22%20opacity%3D%22.1%22/%3E%3C/svg%3E")) no-repeat 50% 50%;
51
+ -webkit-mask-size: contain; /* 📐 keep proportions */
52
+ mask-size: contain; /* 📐 keep proportions */
53
+ }
54
+
55
+ /* 🌙 dark: light mark on dark surfaces */
56
+ :global(html.dark) .abLogo:not(.abLogo__mark) {
57
+ background-color: var(--app-logo-color, var(--ab-logo-color, #FFF8F5));
22
58
  }
23
59
 
60
+ /* 🖼️ contained mark (a real <img>) */
24
61
  .abLogoContained {
25
- display: block;
26
- position: relative;
27
- width: 1.5rem;
28
- height: 1.5rem;
29
- object-fit: contain;
62
+ display: block; /* 🧱 block box */
63
+ position: relative; /* 📌 positioning context */
64
+ width: 1.5rem; /* ↔️ default size */
65
+ height: 1.5rem; /* ↕️ default size */
66
+ object-fit: contain; /* 📐 keep proportions */
67
+ }
68
+
69
+ /* 🔤 lockup = mark + wordmark */
70
+ .abLogo__lockup {
71
+ display: inline-flex; /* ➡️ one row */
72
+ align-items: center; /* ↕️ centered */
73
+ gap: 0.28em; /* ↔️ gap scales with the text */
74
+ font-size: 2rem; /* 📏 default lockup size (override with `size`) */
75
+ line-height: 1; /* 📐 tight */
76
+ color: var(--ab-logo-color, #A67C52); /* 🎨 bronze */
77
+ }
78
+
79
+ /* 🌙 dark lockup */
80
+ :global(html.dark) .abLogo__lockup {
81
+ color: var(--ab-logo-color, #FFF8F5);
82
+ }
83
+
84
+ /* 🅰️ the mark inside a lockup follows the text size & color */
85
+ .abLogo__mark {
86
+ width: 1.15em; /* ↔️ ≈ cap height + descender, as in the splash mock */
87
+ height: 1.15em; /* ↕️ square */
88
+ flex: none; /* 🚫 never shrink */
89
+ background-color: currentColor; /* 🎨 same as the wordmark */
90
+ }
91
+
92
+ /* 🔤 the wordmark — Quicksand Bold (font files ship with ab-nextjs-fonts/quicksand/styles.css) */
93
+ .abLogo__wordmark {
94
+ font-family: 'Quicksand-Bold', 'Quicksand', ui-rounded, system-ui, sans-serif; /* 🔤 */
95
+ font-weight: 700; /* 💪 bold */
96
+ letter-spacing: 0.01em; /* ↔️ as in the mock */
97
+ white-space: nowrap; /* 🚫 no wrap */
30
98
  }
@@ -0,0 +1,54 @@
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: AbSplash - CSP hash helpers (types for csp.mjs)
29
+ * @file: ab-splash/csp.d.ts
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ */
32
+
33
+ /*
34
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
+ * MOTTO: We'll always do more 😜!!!
36
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
+ */
38
+
39
+ // ⚙️ gate options (mirror of `AbSplashGateOptions` in ./gate.ts)
40
+ export interface AbSplashGateOptions {
41
+ // 🌍 every configured locale
42
+ locales?: readonly string[]
43
+ // 🏠 the default (unprefixed) locale
44
+ defaultLocale?: string
45
+ // 🚪 extra root sub-paths (default ['welcome'])
46
+ rootSubPaths?: readonly string[]
47
+ }
48
+
49
+ // 🔐 `'sha256-<base64>'` CSP source for an inline script
50
+ export declare function getAbSplashGateSha256(script: string): string
51
+ // 🔐 the gate script + its hash, from the same options
52
+ export declare function buildAbSplashGate(options?: AbSplashGateOptions): { script: string; sha256: string }
53
+ // 🔐 hash of the default `abSplashGateScript`
54
+ export declare const AB_SPLASH_GATE_SHA256: string
@@ -0,0 +1,82 @@
1
+ /*
2
+ * @license MIT
3
+ * ~~~~~~~~~~~~
4
+ * ab-nextjs-components
5
+ * ~~~~~~~~~~~~
6
+ * Copyright (c) 2026 Abraham Ukachi. The abElements Project.
7
+ * (MIT license text: see LICENSE)
8
+ *
9
+ * @project: ab-nextjs-components
10
+ * @name: AbSplash - CSP hash helpers (COMPILED, do not edit — run `node scripts/build-csp.mjs`)
11
+ * @file: ab-splash/csp.mjs
12
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
13
+ */
14
+ // 🤖 generated from ab-splash/csp.ts + ab-splash/gate.ts (bundled, ESM, Node)
15
+
16
+ // ab-splash/csp.ts
17
+ import { createHash } from "node:crypto";
18
+
19
+ // ab-splash/gate.ts
20
+ var AB_SPLASH_ATTRIBUTE = "data-ab-splash";
21
+ var AB_SPLASH_VISITED_KEY = "ab-splash-visited";
22
+ var AB_SPLASH_SESSION_KEY = "ab-splash-session";
23
+ var AB_SPLASH_BOT_PATTERN = "bot|crawl|spider|slurp|bingpreview|facebookexternalhit|embedly|quora link preview|whatsapp|telegrambot|discordbot|headlesschrome|lighthouse|pagespeed|prerender";
24
+ var escapeRe = (value) => value.replace(/[.*+?^${}()|[\]\\/-]/g, "\\$&");
25
+ function buildAbSplashRootPathPattern(options = {}) {
26
+ const prefixed = (options.locales ?? []).filter((locale) => locale && locale !== options.defaultLocale).map(escapeRe);
27
+ const subPaths = (options.rootSubPaths ?? ["welcome"]).filter(Boolean).map(escapeRe);
28
+ const localePart = prefixed.length ? `(?:\\/(?:${prefixed.join("|")}))?` : "";
29
+ const subPart = subPaths.length ? `(?:\\/(?:${subPaths.join("|")}))?` : "";
30
+ return `^${localePart}${subPart}\\/?$`;
31
+ }
32
+ function buildAbSplashGateScript(options = {}) {
33
+ const pattern = JSON.stringify(buildAbSplashRootPathPattern(options));
34
+ const bots = JSON.stringify(AB_SPLASH_BOT_PATTERN);
35
+ return `(function () {
36
+ // \u{1F9ED} shortcuts
37
+ var w = window, d = document, nav = w.navigator || {};
38
+ // \u{1F916} skip automation and bots (no Splash for crawlers, previews or headless tests)
39
+ if (nav.webdriver || new RegExp(${bots}, 'i').test(nav.userAgent || '')) return;
40
+ // \u{1F4D6} safe storage read: a failing get counts as "already seen" ('1')
41
+ function get(store, key) { try { return w[store].getItem(key); } catch (e) { return '1'; } }
42
+ // \u270D\uFE0F safe storage write: a failing set is ignored
43
+ function set(store, key) { try { w[store].setItem(key, '1'); } catch (e) {} }
44
+ // \u{1F4F1} installed PWA? (matchMedia OR iOS navigator.standalone)
45
+ var mm = false;
46
+ try { mm = !!(w.matchMedia && w.matchMedia('(display-mode: standalone)').matches); } catch (e) {}
47
+ var isStandalone = mm || nav.standalone === true;
48
+ // \u{1F3E0} a root page? (/, /<locale>, /welcome, /<locale>/welcome \u2014 never the default locale prefix)
49
+ var isRootPage = false;
50
+ try { isRootPage = new RegExp(${pattern}).test(w.location.pathname); } catch (e) {}
51
+ // \u{1F6A6} decision
52
+ var show = false;
53
+ // \u{1F4F1} standalone: once per session
54
+ if (isStandalone) {
55
+ if (!get('sessionStorage', ${JSON.stringify(AB_SPLASH_SESSION_KEY)})) show = true;
56
+ set('sessionStorage', ${JSON.stringify(AB_SPLASH_SESSION_KEY)});
57
+ }
58
+ // \u{1F463} first ever visit, on a root page only
59
+ if (!get('localStorage', ${JSON.stringify(AB_SPLASH_VISITED_KEY)})) {
60
+ if (isRootPage) show = true;
61
+ set('localStorage', ${JSON.stringify(AB_SPLASH_VISITED_KEY)});
62
+ }
63
+ // \u{1F6A9} last step: turn the Splash on
64
+ if (show) { try { d.documentElement.setAttribute(${JSON.stringify(AB_SPLASH_ATTRIBUTE)}, 'on'); } catch (e) {} }
65
+ })();`;
66
+ }
67
+ var abSplashGateScript = buildAbSplashGateScript();
68
+
69
+ // ab-splash/csp.ts
70
+ function getAbSplashGateSha256(script) {
71
+ return `'sha256-${createHash("sha256").update(script, "utf8").digest("base64")}'`;
72
+ }
73
+ function buildAbSplashGate(options = {}) {
74
+ const script = buildAbSplashGateScript(options);
75
+ return { script, sha256: getAbSplashGateSha256(script) };
76
+ }
77
+ var AB_SPLASH_GATE_SHA256 = getAbSplashGateSha256(abSplashGateScript);
78
+ export {
79
+ AB_SPLASH_GATE_SHA256,
80
+ buildAbSplashGate,
81
+ getAbSplashGateSha256
82
+ };