import { type ComputedRef, type Ref } from '#imports'; import type { AdapterContext } from '#blokkli/editor/adapter'; import type { AdaptersProvider } from './adapters.js'; import type { DirectiveProvider } from './directive.js'; import type { FieldValueProvider, TextFieldValue } from './fieldValue.js'; import type { ReadabilityAnalysisResult, ReadabilityAnalyzer, ReadabilityChunkResult } from '../features/analyze/readability/types.js'; import '../features/analyze/readability/adapterTypes.js'; type ReadabilityScaleInfo = NonNullable>>; export type ReadabilityProvider = { /** * Whether a readability analyzer is registered and usable. * * Resolved at provider construction time. `true` when an adapter extension * supplied `getReadabilityAnalyzer` (typically via the `@blokkli/readability` * sub-module), `false` otherwise. Features that render readability UI * should gate on this flag; method calls are safe no-ops when false. */ isAvailable: Readonly>; /** * Label of the primary score metric for the current language * (e.g. "LIX", "Gulpease", "CEFR"). Empty string when no analyzer is * available. */ scoreLabel: ComputedRef; /** * Minimum word count required for a confident score in the current * language. `0` when no analyzer is available. */ minWordsForConfidence: ComputedRef; analyzeAllFields: () => Promise; analyzeText: (text: string, langcode: string, fieldType?: 'plain' | 'markup') => Promise; analyzeFieldValues: (fields: TextFieldValue[]) => Promise; getAgentContext: () => string; formatScore: (value: number) => string; /** * Return scale information for visualizing score bands, or `null` if no * analyzer is available (or it does not provide one). */ getScaleInfo: (langcode: string) => ReadabilityScaleInfo | null; /** * Find the DOM element for a specific editable field. * Used by the analyzer to scope DOM highlighting to the correct block. */ getFieldElement: (uuid: string, fieldName: string) => HTMLElement | undefined; }; export default function readabilityProvider(adapters: AdaptersProvider, context: ComputedRef, directive: DirectiveProvider, fieldValue: FieldValueProvider): Promise; export {};