lucent-ui 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -283,8 +283,9 @@ export declare interface ComponentManifest {
283
283
  * - block: Page-section-level composition (PageHeader, SidebarNav…)
284
284
  * - flow: Multi-step or stateful sequences (Wizard, Onboarding…)
285
285
  * - overlay: Layers above page content (Modal, Drawer, Tooltip…)
286
+ * - provider: Root configuration wrapper (LucentProvider…)
286
287
  */
287
- export declare type ComponentTier = 'atom' | 'molecule' | 'block' | 'flow' | 'overlay';
288
+ export declare type ComponentTier = 'atom' | 'molecule' | 'block' | 'flow' | 'overlay' | 'provider';
288
289
 
289
290
  export declare interface CompositionNode {
290
291
  /** Component id this node refers to */
@@ -297,6 +298,35 @@ export declare interface CompositionNode {
297
298
  required: boolean;
298
299
  }
299
300
 
301
+ /**
302
+ * Build a complete `LucentTokens` object from a minimal set of anchor colors.
303
+ *
304
+ * Variant tokens (hover, active, subtle, text, border, etc.) are derived
305
+ * automatically — you only need to specify the 9 anchor colors. The result
306
+ * can be passed directly to `<LucentProvider tokens={...}>`, or use the
307
+ * `anchors` prop shorthand to skip this call entirely.
308
+ *
309
+ * @param anchors - The 9 brand/semantic anchor colors.
310
+ * @param theme - Target theme; defaults to `'light'`.
311
+ * @returns A fully-resolved `LucentTokens` ready for `LucentProvider`.
312
+ *
313
+ * @example
314
+ * const tokens = createTheme({
315
+ * bgBase: '#ffffff',
316
+ * surface: '#f9fafb',
317
+ * borderDefault: '#e5e7eb',
318
+ * textPrimary: '#111827',
319
+ * accentDefault: '#6366f1',
320
+ * successDefault: '#22c55e',
321
+ * warningDefault: '#f59e0b',
322
+ * dangerDefault: '#ef4444',
323
+ * infoDefault: '#3b82f6',
324
+ * });
325
+ *
326
+ * // <LucentProvider tokens={tokens}>...</LucentProvider>
327
+ */
328
+ export declare function createTheme(anchors: ThemeAnchors, theme?: Theme): LucentTokens;
329
+
300
330
  export declare const darkTokens: LucentTokens;
301
331
 
302
332
  export declare const DATA_TABLE_MANIFEST: ComponentManifest;
@@ -368,6 +398,43 @@ export declare interface DateRangePickerProps {
368
398
  style?: CSSProperties;
369
399
  }
370
400
 
401
+ /**
402
+ * Derives a complete dark-mode token set from a light-mode token set.
403
+ *
404
+ * Non-color tokens (typography, spacing, radius, motion) are inherited
405
+ * unchanged. Each semantic color group is mapped with a calibrated
406
+ * lightness inversion so the result is visually consistent with a
407
+ * hand-crafted dark theme.
408
+ *
409
+ * @example
410
+ * // Replacing the hardcoded dark.ts:
411
+ * export const darkTokens = deriveDarkFromLight(lightTokens);
412
+ *
413
+ * // Generating a dark theme from any custom light palette:
414
+ * const myDark = deriveDarkFromLight({ ...lightTokens, bgBase: '#f0f4ff' });
415
+ */
416
+ export declare function deriveDarkFromLight(light: LucentTokens): LucentTokens;
417
+
418
+ /**
419
+ * Derive variant tokens from anchor overrides.
420
+ *
421
+ * When the user provides an anchor token (e.g. `borderDefault`) without
422
+ * providing its variants (e.g. `borderSubtle`, `borderStrong`), this
423
+ * function computes those variants automatically using theme-calibrated
424
+ * lightness deltas.
425
+ *
426
+ * Rules:
427
+ * - Derivation only runs when the anchor is present in `overrides`.
428
+ * - A variant is only filled when it is absent from `overrides`.
429
+ * - Uses `'key' in overrides` (not truthiness) to respect
430
+ * `exactOptionalPropertyTypes: true`.
431
+ *
432
+ * @param overrides - Raw `tokens` prop from the consumer.
433
+ * @param merged - Base theme tokens already merged with overrides.
434
+ * @param theme - Current theme; determines lightness delta direction.
435
+ */
436
+ export declare function deriveTokens(overrides: Partial<LucentTokens>, merged: LucentTokens, theme: Theme): Partial<LucentTokens>;
437
+
371
438
  export declare function Divider({ orientation, label, spacing, style }: DividerProps): JSX_2.Element;
372
439
 
373
440
  export declare const DividerManifest: ComponentManifest;
@@ -486,15 +553,34 @@ declare interface LucentContextValue {
486
553
  * styles are applied synchronously before first paint.
487
554
  *
488
555
  * @example
489
- * <LucentProvider theme="dark">
556
+ * // Minimal: 9 anchor colors → full theme
557
+ * <LucentProvider anchors={{ bgBase: '#fff', accentDefault: '#6366f1', ... }}>
558
+ * <App />
559
+ * </LucentProvider>
560
+ *
561
+ * @example
562
+ * // Full control via partial overrides
563
+ * <LucentProvider theme="dark" tokens={{ accentDefault: '#f59e0b' }}>
490
564
  * <App />
491
565
  * </LucentProvider>
492
566
  */
493
- export declare function LucentProvider({ theme, tokens: tokenOverrides, children, }: LucentProviderProps): JSX_2.Element;
567
+ export declare function LucentProvider({ theme, tokens: tokenOverrides, anchors, children, }: LucentProviderProps): JSX_2.Element;
568
+
569
+ export declare const LucentProviderManifest: ComponentManifest;
494
570
 
495
571
  export declare interface LucentProviderProps {
496
572
  theme?: Theme;
573
+ /**
574
+ * Full or partial token overrides. Individual tokens can be set here and
575
+ * any missing variant tokens will be derived automatically.
576
+ */
497
577
  tokens?: Partial<LucentTokens>;
578
+ /**
579
+ * Shorthand for specifying only the 9 anchor colors and letting the library
580
+ * derive the full token set automatically. When provided, `tokens` is ignored.
581
+ * Equivalent to passing `tokens={createTheme(anchors, theme)}`.
582
+ */
583
+ anchors?: ThemeAnchors;
498
584
  children: ReactNode;
499
585
  }
500
586
 
@@ -689,9 +775,9 @@ export declare type SelectSize = 'sm' | 'md' | 'lg';
689
775
  declare interface SemanticColorTokens {
690
776
  bgBase: string;
691
777
  bgSubtle: string;
692
- bgMuted: string;
693
778
  bgOverlay: string;
694
- surfaceDefault: string;
779
+ surface: string;
780
+ surfaceSecondary: string;
695
781
  surfaceRaised: string;
696
782
  surfaceOverlay: string;
697
783
  borderDefault: string;
@@ -903,6 +989,44 @@ export declare type TextWeight = 'regular' | 'medium' | 'semibold' | 'bold';
903
989
 
904
990
  export declare type Theme = 'light' | 'dark';
905
991
 
992
+ /**
993
+ * The minimal set of color tokens needed to produce a complete theme.
994
+ * Pass these to `createTheme()` or `<LucentProvider anchors={...}>` and
995
+ * all variant tokens (hover, active, subtle, text, etc.) are derived
996
+ * automatically.
997
+ *
998
+ * @example
999
+ * const myTheme = createTheme({
1000
+ * bgBase: '#ffffff',
1001
+ * surface: '#f9fafb',
1002
+ * borderDefault: '#e5e7eb',
1003
+ * textPrimary: '#111827',
1004
+ * accentDefault: '#6366f1',
1005
+ * successDefault: '#22c55e',
1006
+ * warningDefault: '#f59e0b',
1007
+ * dangerDefault: '#ef4444',
1008
+ * infoDefault: '#3b82f6',
1009
+ * });
1010
+ */
1011
+ export declare type ThemeAnchors = Pick<LucentTokens, 'bgBase' | 'surface' | 'borderDefault' | 'textPrimary' | 'accentDefault' | 'successDefault' | 'warningDefault' | 'dangerDefault' | 'infoDefault'>;
1012
+
1013
+ /**
1014
+ * Semantic guidance for each ThemeAnchors key.
1015
+ *
1016
+ * An LLM reading this can translate a brand brief or hex palette directly
1017
+ * into a valid ThemeAnchors object without needing to know internal token
1018
+ * names or the derivation system. Each entry describes:
1019
+ * - what the token controls visually
1020
+ * - what range of colors is appropriate
1021
+ * - which variant tokens are automatically derived from it
1022
+ */
1023
+ export declare const ThemeAnchorsSpec: Record<keyof ThemeAnchors, {
1024
+ description: string;
1025
+ lightGuidance: string;
1026
+ darkGuidance: string;
1027
+ derives: string[];
1028
+ }>;
1029
+
906
1030
  export declare function Timeline({ items, style }: TimelineProps): JSX_2.Element;
907
1031
 
908
1032
  export declare const TIMELINE_MANIFEST: ComponentManifest;