@dataimago/ui 0.1.0-alpha.3 → 0.1.0-alpha.35
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/README.md +19 -5
- package/dist/index.cjs +431 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +251 -9
- package/dist/index.d.ts +251 -9
- package/dist/index.js +422 -3
- package/dist/index.js.map +1 -1
- package/package.json +12 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { LogoId, LogoVariant, AnimationId, NavbarLogoId } from '@dataimago/brand';
|
|
3
4
|
|
|
4
5
|
type ButtonVariant = 'primary' | 'secondary' | 'ghost';
|
|
5
6
|
type ButtonSize = 'sm' | 'md' | 'lg';
|
|
@@ -49,8 +50,8 @@ declare function LogoMonogram({ size, title, ...rest }: LogoMonogramProps): reac
|
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
52
|
* <LogoMonogramBg /> — the dataimago 'a + i' monogram with a rounded accent
|
|
52
|
-
* backplate. White letters on the
|
|
53
|
-
* (var(--color-interactive-accent),
|
|
53
|
+
* backplate. White letters on the brand-accent role
|
|
54
|
+
* (var(--color-interactive-accent), iteration-2 sky-blue).
|
|
54
55
|
*
|
|
55
56
|
* Use this variant on neutral surfaces where the no-background monogram
|
|
56
57
|
* would lack presence — favicons, app icons, social-media avatars, or any
|
|
@@ -60,10 +61,16 @@ declare function LogoMonogram({ size, title, ...rest }: LogoMonogramProps): reac
|
|
|
60
61
|
* FOUNDATIONS/background/04_dataimago_Content/Design_Assets/logos/
|
|
61
62
|
* ai_monogram_supreme_bg_1_PATH.svg
|
|
62
63
|
*
|
|
63
|
-
* Theming: the background uses var(--color-interactive-accent),
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
64
|
+
* Theming: the background uses var(--color-interactive-accent), which
|
|
65
|
+
* resolves via theme-colors.json's mode-aware role mapping — accent-500
|
|
66
|
+
* (#1f618d) on light surfaces, accent-300 (#3498DB) on dark. The letter
|
|
67
|
+
* fill is hard-set to white; both accent stops have AA-or-better contrast
|
|
68
|
+
* with white letters (light-mode 6.66:1 AA, dark-mode 3.15:1 AA-large for
|
|
69
|
+
* the dot-and-stem heading-size letters used in the monogram). The
|
|
70
|
+
* literal-fallback in this component is light-mode (#1f618d, sky-blue
|
|
71
|
+
* iteration-2) for rare non-CSS-aware contexts. Iteration-1's copper-red
|
|
72
|
+
* fallback (#b54a27) was retired in iteration-2-B.2; see
|
|
73
|
+
* wiki/decisions/iteration-2-blue-accent.md for the rationale.
|
|
67
74
|
*
|
|
68
75
|
* Usage:
|
|
69
76
|
* <LogoMonogramBg size={64} aria-label="dataimago" />
|
|
@@ -78,8 +85,8 @@ declare function LogoMonogramBg({ size, title, ...rest }: LogoMonogramBgProps):
|
|
|
78
85
|
|
|
79
86
|
/**
|
|
80
87
|
* <LogoWordmark /> — the full "dataimago" wordmark with the 'ai' overlap.
|
|
81
|
-
* White letters on a rounded accent backplate
|
|
82
|
-
* var(--color-interactive-accent)
|
|
88
|
+
* White letters on a rounded accent backplate, themed via
|
|
89
|
+
* var(--color-interactive-accent).
|
|
83
90
|
*
|
|
84
91
|
* Use this variant for primary brand surfaces: site headers, document
|
|
85
92
|
* letterheads, large-format presentations, business materials. For compact
|
|
@@ -95,6 +102,15 @@ declare function LogoMonogramBg({ size, title, ...rest }: LogoMonogramBgProps):
|
|
|
95
102
|
* FOUNDATIONS/background/04_dataimago_Content/Design_Assets/logos/
|
|
96
103
|
* dataimago_supreme_1_PATH.svg
|
|
97
104
|
*
|
|
105
|
+
* Theming: the backplate uses var(--color-interactive-accent), which resolves
|
|
106
|
+
* via theme-colors.json's mode-aware role mapping — accent-500 (#1f618d) on
|
|
107
|
+
* light surfaces, accent-300 (#3498DB) on dark. The literal-fallback in this
|
|
108
|
+
* component is light-mode (#1f618d, sky-blue iteration-2) for the rare cases
|
|
109
|
+
* where the SVG is consumed without CSS-variable resolution (printed PDFs from
|
|
110
|
+
* raw SVG, third-party platforms that strip CSS). Iteration-1's copper-red
|
|
111
|
+
* fallback (#b54a27) was retired in iteration-2-B.2; see
|
|
112
|
+
* wiki/decisions/iteration-2-blue-accent.md for the rationale.
|
|
113
|
+
*
|
|
98
114
|
* Usage:
|
|
99
115
|
* <LogoWordmark width={240} aria-label="dataimago" />
|
|
100
116
|
*
|
|
@@ -109,4 +125,230 @@ interface LogoWordmarkProps extends React.SVGAttributes<SVGSVGElement> {
|
|
|
109
125
|
}
|
|
110
126
|
declare function LogoWordmark({ width, title, ...rest }: LogoWordmarkProps): react_jsx_runtime.JSX.Element;
|
|
111
127
|
|
|
112
|
-
|
|
128
|
+
interface LogoProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
129
|
+
/** Mark id, e.g. `dissertation_ai_OVERLAP`. */
|
|
130
|
+
name: LogoId;
|
|
131
|
+
/** PATH (default), CUTOUT, BG, or LETTERS. See @dataimago/brand. */
|
|
132
|
+
variant?: LogoVariant;
|
|
133
|
+
/**
|
|
134
|
+
* Render width (px number or any CSS length). Height scales proportionally
|
|
135
|
+
* via the SVG viewBox. Omit to use the mark's intrinsic size.
|
|
136
|
+
*/
|
|
137
|
+
width?: number | string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Manifest-driven brand mark from `@dataimago/brand`. Inlines the SVG string so
|
|
141
|
+
* `currentColor` (PATH/LETTERS), the `--color-interactive-accent` badge fill
|
|
142
|
+
* (CUTOUT/BG), and the per-letter interaction classes (`.glyph`, `.logo-*`) all
|
|
143
|
+
* work — an `<img src>` can't receive those interior styles.
|
|
144
|
+
*
|
|
145
|
+
* Color flows from CSS: set `color` (PATH/LETTERS) on this element or an
|
|
146
|
+
* ancestor. Size via `width` (or CSS on the wrapper).
|
|
147
|
+
*/
|
|
148
|
+
declare function Logo({ name, variant, width, style, ...rest }: LogoProps): react_jsx_runtime.JSX.Element | null;
|
|
149
|
+
|
|
150
|
+
/** A link the lockup renders; pass one to route through a framework link (e.g. next/link). */
|
|
151
|
+
interface CopulaLinkProps {
|
|
152
|
+
href: string;
|
|
153
|
+
'aria-label': string;
|
|
154
|
+
className?: string;
|
|
155
|
+
style?: React.CSSProperties;
|
|
156
|
+
children: React.ReactNode;
|
|
157
|
+
}
|
|
158
|
+
interface CopulaLockupProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
159
|
+
/** The property's wordmark id, e.g. `dissertation_ai`. Its PATH variant is drawn. */
|
|
160
|
+
property: LogoId;
|
|
161
|
+
/** Accessible name of the property link, e.g. `dissertation-ai`. */
|
|
162
|
+
propertyLabel: string;
|
|
163
|
+
/** Where the property mark links. Defaults to `/`. */
|
|
164
|
+
propertyHref?: string;
|
|
165
|
+
/**
|
|
166
|
+
* `shown` (default): "<property> is dataimago". `hidden`: the property mark
|
|
167
|
+
* alone, with no badge, no dataimago wordmark and no link to dataimago, for
|
|
168
|
+
* apps that keep dataimago out of view while it is in stealth.
|
|
169
|
+
*/
|
|
170
|
+
dataimago?: 'shown' | 'hidden';
|
|
171
|
+
/** Where the dataimago wordmark links. Defaults to https://dataimago.ai. */
|
|
172
|
+
brandHref?: string;
|
|
173
|
+
/** Wordmark height in px. Defaults to 32; the badge and spacing scale with it. */
|
|
174
|
+
height?: number;
|
|
175
|
+
/** Class for each link (colour and hover); both links share one treatment. */
|
|
176
|
+
linkClassName?: string;
|
|
177
|
+
/**
|
|
178
|
+
* Class for the `is` disc. It is not a link, so `linkClassName` does not reach
|
|
179
|
+
* it: give it the links' rest colour here (e.g. the same `text-*` class
|
|
180
|
+
* without the hover). Without it the disc takes the lockup's colour.
|
|
181
|
+
*/
|
|
182
|
+
badgeClassName?: string;
|
|
183
|
+
/** Render the links with a framework component. Defaults to a plain `<a>`. */
|
|
184
|
+
renderLink?: (props: CopulaLinkProps) => React.ReactNode;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The copula lockup, "dissertation-ai **is** dataimago": the property wordmark,
|
|
188
|
+
* the `is_badge` disc and the dataimago wordmark, each wordmark its own link
|
|
189
|
+
* (wiki/connections/is-copula-coupling.md). The badge is a mark, not a link: at
|
|
190
|
+
* 16px it is below the 24px pointer-target floor (WCAG 2.5.8), so it is read as
|
|
191
|
+
* "is" and the philosophy page stays reachable from the nav.
|
|
192
|
+
*
|
|
193
|
+
* Spacing is ink-symmetric about the badge centre, computed from each mark's
|
|
194
|
+
* `ink` box in the @dataimago/brand manifest, so any property mark lines up
|
|
195
|
+
* without hand-tuned margins. Geometry is inline style (no Tailwind), so a
|
|
196
|
+
* consumer on plain CSS can use it too. Every piece is `currentColor`: the
|
|
197
|
+
* wordmarks take their link's colour (`linkClassName`, or the page's link
|
|
198
|
+
* colour), the disc takes `badgeClassName`'s, or the lockup's.
|
|
199
|
+
*/
|
|
200
|
+
declare function CopulaLockup({ property, propertyLabel, propertyHref, dataimago, brandHref, height, linkClassName, badgeClassName, renderLink, style, ...rest }: CopulaLockupProps): react_jsx_runtime.JSX.Element | null;
|
|
201
|
+
|
|
202
|
+
interface BrandAnimationProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
203
|
+
/** Animation id, e.g. `dissertation-ai`. See @dataimago/brand animations.json. */
|
|
204
|
+
name: AnimationId;
|
|
205
|
+
/**
|
|
206
|
+
* Render width (px number or any CSS length). Height scales via the SVG
|
|
207
|
+
* viewBox. Omit to use the animation's intrinsic size.
|
|
208
|
+
*/
|
|
209
|
+
width?: number | string;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Decorative brand animation from `@dataimago/brand` (the animation-foundry).
|
|
213
|
+
* Inlines the pure-SMIL SVG string so its interior `<style>` works — an
|
|
214
|
+
* `<img src>` can't receive those styles (same rationale as `<Logo>`).
|
|
215
|
+
*
|
|
216
|
+
* Motion-dignity: decorative brand animation is a distinct category from the
|
|
217
|
+
* 300ms UI-transition ceiling, but it is contractually gated on
|
|
218
|
+
* `prefers-reduced-motion`. When the user prefers reduced motion this renders
|
|
219
|
+
* the static brand mark the animation settles to (its `poster`) via `<Logo>`,
|
|
220
|
+
* so no consumer can ship the motion without the fallback.
|
|
221
|
+
*/
|
|
222
|
+
declare function BrandAnimation({ name, width, style, ...rest }: BrandAnimationProps): react_jsx_runtime.JSX.Element | null;
|
|
223
|
+
|
|
224
|
+
interface NavbarLogoProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
225
|
+
/** Navbar mark id, e.g. `dissertation-ai`. See @dataimago/brand navbar.json. */
|
|
226
|
+
name: NavbarLogoId;
|
|
227
|
+
/**
|
|
228
|
+
* Render width (px number or any CSS length). Height scales via the SVG
|
|
229
|
+
* viewBox. Omit to use the mark's intrinsic size.
|
|
230
|
+
*/
|
|
231
|
+
width?: number | string;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Animated brand mark for an app navbar, from `@dataimago/brand` (the
|
|
235
|
+
* animation-foundry's navbar set). Inlines the self-contained CSS-animated SVG
|
|
236
|
+
* so its interior `<style>` works — an `<img src>` can't receive those styles.
|
|
237
|
+
*
|
|
238
|
+
* Behaviour by mark kind (from the navbar manifest):
|
|
239
|
+
* - `assemble` (L2: dissertation-ai, rpkg-ai, SGPc-ai): the trailing `a`/`i`
|
|
240
|
+
* start apart and the `i` slides onto the `a`. Plays once on mount; replays
|
|
241
|
+
* on pointer-enter via a remount (`replayKey`).
|
|
242
|
+
* - `shimmer` (L1: dataimago-ai): the monogram is always superimposed; an
|
|
243
|
+
* accent shimmer sweeps on `:hover` from the SVG's own CSS (no JS trigger).
|
|
244
|
+
* - `dream` (promoted dream marks, `tools/dream-foundry/drop.mjs promote`):
|
|
245
|
+
* a self-contained CSS hover gesture like liftwash; the poster is the mark's
|
|
246
|
+
* own static form (`dream_<slug>` / `DREAM`). Ink is `currentColor`.
|
|
247
|
+
*
|
|
248
|
+
* Motion-dignity: the embedded CSS animation is <= 300ms and gated on
|
|
249
|
+
* `@media (prefers-reduced-motion: no-preference)`. When the user prefers
|
|
250
|
+
* reduced motion this renders the static settled mark (the manifest `poster`,
|
|
251
|
+
* the superimposed monogram) via `<Logo>` — so no consumer can ship the motion
|
|
252
|
+
* without the fallback.
|
|
253
|
+
*/
|
|
254
|
+
declare function NavbarLogo({ name, width, style, ...rest }: NavbarLogoProps): react_jsx_runtime.JSX.Element | null;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Light/dark theme preference for dataimago apps.
|
|
258
|
+
*
|
|
259
|
+
* The house tokens (`@dataimago/tokens`) follow the operating system through
|
|
260
|
+
* `prefers-color-scheme` and yield to an explicit `data-bs-theme` on the root:
|
|
261
|
+
* `light` or `dark` forces that theme, no attribute means "follow the system".
|
|
262
|
+
* This module owns that attribute: it reads and stores the reader's choice,
|
|
263
|
+
* applies it, and reports the theme actually in effect (for canvas and WebGL
|
|
264
|
+
* surfaces that cannot read CSS variables).
|
|
265
|
+
*
|
|
266
|
+
* The choice is a per-browser convenience in localStorage. Every read and write
|
|
267
|
+
* is guarded: in a private window or with storage blocked the page simply
|
|
268
|
+
* follows the system.
|
|
269
|
+
*/
|
|
270
|
+
type ThemePreference = 'system' | 'light' | 'dark';
|
|
271
|
+
type ResolvedTheme = 'light' | 'dark';
|
|
272
|
+
declare const THEME_STORAGE_KEY = "dataimago-theme";
|
|
273
|
+
declare const THEME_ATTRIBUTE = "data-bs-theme";
|
|
274
|
+
/**
|
|
275
|
+
* Inline this in `<head>` before any stylesheet paints, so a stored choice is
|
|
276
|
+
* on the root before first paint (no flash of the other theme). The server
|
|
277
|
+
* markup cannot know the choice, so the consumer also puts
|
|
278
|
+
* `suppressHydrationWarning` on `<html>`. From a React server layout, render
|
|
279
|
+
* `<ThemeScript />` instead: this package is a client bundle, so a server
|
|
280
|
+
* component cannot import the string itself.
|
|
281
|
+
*
|
|
282
|
+
* ```tsx
|
|
283
|
+
* <html lang="en" suppressHydrationWarning>
|
|
284
|
+
* <head><ThemeScript /></head>
|
|
285
|
+
* ```
|
|
286
|
+
*/
|
|
287
|
+
declare const themeInitScript: string;
|
|
288
|
+
/** The stored choice, or `'system'` when there is none (or storage is unavailable). */
|
|
289
|
+
declare function readThemePreference(): ThemePreference;
|
|
290
|
+
/** Store, apply and announce a choice. `'system'` clears the stored choice. */
|
|
291
|
+
declare function setThemePreference(preference: ThemePreference): void;
|
|
292
|
+
/** The theme in effect: the root attribute when set, otherwise the system's. */
|
|
293
|
+
declare function resolveTheme(): ResolvedTheme;
|
|
294
|
+
/**
|
|
295
|
+
* The reader's choice and a setter. Server render and hydration see
|
|
296
|
+
* `'system'`; the stored choice arrives right after.
|
|
297
|
+
*/
|
|
298
|
+
declare function useThemePreference(): [ThemePreference, (p: ThemePreference) => void];
|
|
299
|
+
/**
|
|
300
|
+
* The theme in effect, for surfaces that cannot read CSS variables (canvas,
|
|
301
|
+
* WebGL maps). Follows the toggle and, under "system", the operating system.
|
|
302
|
+
* Server render and hydration see `'light'`.
|
|
303
|
+
*/
|
|
304
|
+
declare function useResolvedTheme(): ResolvedTheme;
|
|
305
|
+
|
|
306
|
+
interface ThemeToggleLabels {
|
|
307
|
+
/** What the control sets, read before the theme in effect ("Theme: Light"). */
|
|
308
|
+
name: string;
|
|
309
|
+
/** Added when the theme follows the operating system ("Theme: Light (System)"). */
|
|
310
|
+
system: string;
|
|
311
|
+
light: string;
|
|
312
|
+
dark: string;
|
|
313
|
+
}
|
|
314
|
+
interface ThemeToggleProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'children' | 'type'> {
|
|
315
|
+
/** Accessible and tooltip text; pass the property's own wording. */
|
|
316
|
+
labels?: Partial<ThemeToggleLabels>;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* The choice one click makes: the other theme, stored as "system" when that is
|
|
320
|
+
* the operating system's own, so the page goes back to following it.
|
|
321
|
+
*/
|
|
322
|
+
declare function nextThemePreference(shown: ResolvedTheme, system: ResolvedTheme): ThemePreference;
|
|
323
|
+
/**
|
|
324
|
+
* Light/dark toggle for an app navbar: one button, and one click always flips
|
|
325
|
+
* the theme on screen. The page follows the operating system until the first
|
|
326
|
+
* click; a click that lands on the system's own theme goes back to following
|
|
327
|
+
* it (no stored choice), and the other theme is stored and set as
|
|
328
|
+
* `data-bs-theme` on the root, which the house tokens obey. The icon shows the
|
|
329
|
+
* theme in effect: a sun in light, a moon in dark.
|
|
330
|
+
*
|
|
331
|
+
* A 48px target (the dataimago touch floor). The icon is `currentColor`.
|
|
332
|
+
* Inline styles would beat a consumer's `:hover` rule, so the two colours a
|
|
333
|
+
* navbar restyles read custom properties instead: set `--di-theme-toggle-fg`
|
|
334
|
+
* and `--di-theme-toggle-bg` on `.di-ui-theme-toggle` (and its `:hover`).
|
|
335
|
+
* Pair it with `<ThemeScript />` in `<head>` so a stored choice applies before
|
|
336
|
+
* first paint.
|
|
337
|
+
*/
|
|
338
|
+
declare function ThemeToggle({ labels, className, style, ...rest }: ThemeToggleProps): react_jsx_runtime.JSX.Element;
|
|
339
|
+
|
|
340
|
+
interface ThemeScriptProps {
|
|
341
|
+
/** Content-Security-Policy nonce, when the app sets one. */
|
|
342
|
+
nonce?: string;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Renders `themeInitScript` as an inline `<script>`, so a stored choice is on
|
|
346
|
+
* the root before first paint. Use this from a server layout: this package is
|
|
347
|
+
* a client bundle, so a server component cannot import the plain string, but
|
|
348
|
+
* it can render this component. Put it in `<head>` and add
|
|
349
|
+
* `suppressHydrationWarning` to `<html>` (the script changes its attributes
|
|
350
|
+
* before React hydrates).
|
|
351
|
+
*/
|
|
352
|
+
declare function ThemeScript({ nonce }: ThemeScriptProps): react_jsx_runtime.JSX.Element;
|
|
353
|
+
|
|
354
|
+
export { BrandAnimation, type BrandAnimationProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, type CopulaLinkProps, CopulaLockup, type CopulaLockupProps, Logo, LogoMonogram, LogoMonogramBg, type LogoMonogramBgProps, type LogoMonogramProps, type LogoProps, LogoWordmark, type LogoWordmarkProps, NavbarLogo, type NavbarLogoProps, type ResolvedTheme, THEME_ATTRIBUTE, THEME_STORAGE_KEY, type ThemePreference, ThemeScript, type ThemeScriptProps, ThemeToggle, type ThemeToggleLabels, type ThemeToggleProps, nextThemePreference, readThemePreference, resolveTheme, setThemePreference, themeInitScript, useResolvedTheme, useThemePreference };
|