// engine/detectors/advanced-framework-detector/css-state-detector.ts
// Detects CSS-in-JS approaches and state management libraries.
import { join } from 'node:path';
import { fileExists, readFileContent } from './helpers.js';
export async function detectCSSInJS(projectPath, deps) {
    if (deps.has('@vanilla-extract/css')) {
        return 'vanilla-extract';
    }
    if (deps.has('@pandacss/dev') || (await fileExists(join(projectPath, 'panda.config.ts')))) {
        return 'panda-css';
    }
    if (deps.has('@stylexjs/stylex') || deps.has('babel-plugin-stylex')) {
        return 'stylex';
    }
    if (deps.has('unocss') || (await fileExists(join(projectPath, 'uno.config.ts')))) {
        return 'unocss';
    }
    if (deps.has('open-props')) {
        return 'open-props';
    }
    const globalCss = await readFileContent(join(projectPath, 'src/index.css'));
    const appCss = await readFileContent(join(projectPath, 'src/app.css'));
    const globalsCss = await readFileContent(join(projectPath, 'src/globals.css'));
    if (/@layer\s+(base|components|utilities)/.test(globalCss + appCss + globalsCss)) {
        return 'css-layers';
    }
    return null;
}
export function detectStateManagement(deps) {
    const found = [];
    if (deps.has('@tanstack/react-query') ||
        deps.has('@tanstack/vue-query') ||
        deps.has('@tanstack/solid-query')) {
        found.push('tanstack-query');
    }
    if (deps.has('zustand')) {
        found.push('zustand');
    }
    if (deps.has('jotai')) {
        found.push('jotai');
    }
    if (deps.has('xstate')) {
        found.push('xstate');
    }
    if (deps.has('@preact/signals-react') ||
        deps.has('@preact/signals') ||
        deps.has('@angular/core')) {
        found.push('signals');
    }
    if (deps.has('nanostores')) {
        found.push('nanostores');
    }
    return found;
}
export function buildSignalSources(deps) {
    const sources = [];
    if (deps.has('@angular/core')) {
        sources.push('Angular Signals: signal(), computed(), effect() from @angular/core');
    }
    if (deps.has('@preact/signals-react')) {
        sources.push('Preact Signals: signal(), computed() from @preact/signals-react');
    }
    if (deps.has('solid-js')) {
        sources.push('SolidJS Signals: createSignal(), createMemo(), createEffect() from solid-js');
    }
    if (deps.has('vue') || deps.has('@vue/reactivity')) {
        sources.push('Vue Reactivity: ref(), computed(), reactive() from vue');
    }
    return sources;
}
//# sourceMappingURL=css-state-detector.js.map