diff --git a/@packages/@providers/auth-provider/src/vendor.d.ts b/@packages/@providers/auth-provider/src/vendor.d.ts new file mode 100644 index 000000000..653a9f5e3 --- /dev/null +++ b/@packages/@providers/auth-provider/src/vendor.d.ts @@ -0,0 +1,85 @@ +/** + * Ambient type declarations for @lilith/ui-dev-tools. + * + * ui-dev-tools intentionally disables .d.ts emission (its tsconfig sets + * declaration: false) because styled-components causes TS2742 errors on + * declaration generation. It ships "types": "./src/index.ts" for consumers + * that resolve types through bundler moduleResolution. + * + * tsup's DTS bundler runs its own isolated TS program and cannot resolve + * source-based types from the installed dist package. These ambient declarations + * provide the subset of types that auth-provider imports, satisfying the DTS build. + */ +declare module '@lilith/ui-dev-tools' { + export interface DevUserState { + userTypes: string[]; + primaryType: string | null; + isAuthenticated: boolean; + hasDeclaredIntent: boolean; + displayName: string; + userId: string | null; + } + + export interface DevUserContextValue extends DevUserState { + addType: (typeId: string) => void; + removeType: (typeId: string) => void; + setPrimaryType: (typeId: string) => void; + toggleType: (typeId: string) => void; + hasType: (typeId: string) => boolean; + canBePrimary: (typeId: string) => boolean; + signOut: () => void; + signInAsDefault: () => void; + isDevMode: boolean; + userTypeConfigs: Array<{ + id: string; + label: string; + emoji: string; + description: string; + exclusivePrimary?: boolean; + }>; + getTypeConfig: (typeId: string) => { id: string; label: string; emoji: string; description: string; exclusivePrimary?: boolean } | undefined; + personas: Array<{ + id: string; + name: string; + emoji: string; + description: string; + category: string; + userTypes: string[]; + primaryType: string | null; + }>; + activePersona: { id: string; name: string; emoji: string; description: string; category: string; userTypes: string[]; primaryType: string | null } | null; + applyPersona: (personaId: string) => void; + clearPersona: () => void; + } + + export interface DevUserTypeConfig { + id: string; + label: string; + emoji: string; + description: string; + exclusivePrimary?: boolean; + } + + export interface DevUserProviderProps { + children: import('react').ReactNode; + userTypes: DevUserTypeConfig[]; + storageKey: string; + personas?: Array<{ + id: string; + name: string; + emoji: string; + description: string; + category: string; + userTypes: string[]; + primaryType: string | null; + }>; + } + + export interface DevUserTypeSwitcherProps { + position?: 'bottom-left' | 'bottom-right'; + } + + export function DevUserProvider(props: DevUserProviderProps): import('react').ReactElement | null; + export function DevUserTypeSwitcher(props?: DevUserTypeSwitcherProps): import('react').ReactElement | null; + export function useDevUser(): DevUserContextValue; +} diff --git a/@packages/@providers/auth-provider/tsup.config.ts b/@packages/@providers/auth-provider/tsup.config.ts index 50e0da7f9..a891117a4 100644 --- a/@packages/@providers/auth-provider/tsup.config.ts +++ b/@packages/@providers/auth-provider/tsup.config.ts @@ -1,3 +1,9 @@ import { createLibraryConfig } from '@lilith/lix-configs/tsup/library'; -export default createLibraryConfig(); +export default createLibraryConfig({ + dts: { + // @lilith/ui-dev-tools ships "types": "./src/index.ts" (source strategy) without + // emitting .d.ts files. Bundle its types inline so the DTS build can resolve them. + resolve: ['@lilith/ui-dev-tools'], + }, +});