@yuktishaalaa/yuktai 5.0.1 → 5.2.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/README.md +469 -625
- package/dist/index.d.mts +540 -2
- package/dist/index.d.ts +540 -2
- package/dist/index.js +67 -55
- package/dist/index.mjs +30 -18
- package/package.json +11 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import React, { ReactNode } from 'react';
|
|
2
|
+
import React, { ReactNode, CSSProperties } from 'react';
|
|
3
3
|
|
|
4
4
|
interface Plugin {
|
|
5
5
|
name: string;
|
|
@@ -687,6 +687,544 @@ declare function CheckIcon(props: IconProps): react_jsx_runtime.JSX.Element;
|
|
|
687
687
|
|
|
688
688
|
declare function CloseIcon(props: IconProps): react_jsx_runtime.JSX.Element;
|
|
689
689
|
|
|
690
|
+
type AuditRoot = Document | Element;
|
|
691
|
+
/** The label a screen reader would most likely announce for this element. */
|
|
692
|
+
declare function accessibleName(el: Element): string;
|
|
693
|
+
type RGBA = {
|
|
694
|
+
r: number;
|
|
695
|
+
g: number;
|
|
696
|
+
b: number;
|
|
697
|
+
a: number;
|
|
698
|
+
};
|
|
699
|
+
declare function parseColor(value: string | null | undefined): RGBA | null;
|
|
700
|
+
declare function relativeLuminance(c: RGBA): number;
|
|
701
|
+
declare function contrastRatio(fg: RGBA, bg: RGBA): number;
|
|
702
|
+
|
|
703
|
+
type AuditSeverity = "critical" | "serious" | "moderate" | "minor";
|
|
704
|
+
type AuditRuleId = "html-lang" | "page-title" | "image-alt" | "heading-order" | "single-h1" | "landmark-main" | "form-label" | "button-name" | "link-name" | "color-contrast" | "positive-tabindex" | "keyboard-access" | "duplicate-id" | "form-error" | "target-size";
|
|
705
|
+
interface AuditIssue {
|
|
706
|
+
/** Stable within one report, e.g. "image-alt-3". */
|
|
707
|
+
id: string;
|
|
708
|
+
rule: AuditRuleId;
|
|
709
|
+
severity: AuditSeverity;
|
|
710
|
+
/** WCAG success criterion, e.g. "1.1.1", or "best practice". */
|
|
711
|
+
wcag: string;
|
|
712
|
+
message: string;
|
|
713
|
+
/** Why it matters, in plain English. */
|
|
714
|
+
why: string;
|
|
715
|
+
/** What to change. */
|
|
716
|
+
fix: string;
|
|
717
|
+
selector: string;
|
|
718
|
+
snippet: string;
|
|
719
|
+
/** True when the copilot can apply a safe fix in the browser. */
|
|
720
|
+
autoFixable: boolean;
|
|
721
|
+
element?: Element;
|
|
722
|
+
}
|
|
723
|
+
interface AuditCheck {
|
|
724
|
+
rule: AuditRuleId;
|
|
725
|
+
title: string;
|
|
726
|
+
passed: boolean;
|
|
727
|
+
issueCount: number;
|
|
728
|
+
}
|
|
729
|
+
interface AuditReport {
|
|
730
|
+
url: string;
|
|
731
|
+
title: string;
|
|
732
|
+
generatedAt: string;
|
|
733
|
+
score: number;
|
|
734
|
+
passed: boolean;
|
|
735
|
+
checks: AuditCheck[];
|
|
736
|
+
issues: AuditIssue[];
|
|
737
|
+
summary: string;
|
|
738
|
+
}
|
|
739
|
+
interface AuditOptions {
|
|
740
|
+
root?: AuditRoot;
|
|
741
|
+
/** Skip rules you don't need. */
|
|
742
|
+
skip?: AuditRuleId[];
|
|
743
|
+
/** Cap contrast checks on very large pages (default 600 elements). */
|
|
744
|
+
maxContrastChecks?: number;
|
|
745
|
+
/** Minimum interactive target size in CSS px (WCAG 2.5.8 uses 24). */
|
|
746
|
+
minTargetSize?: number;
|
|
747
|
+
}
|
|
748
|
+
interface RuleInfo {
|
|
749
|
+
title: string;
|
|
750
|
+
wcag: string;
|
|
751
|
+
severity: AuditSeverity;
|
|
752
|
+
why: string;
|
|
753
|
+
}
|
|
754
|
+
declare const AUDIT_RULES: Record<AuditRuleId, RuleInfo>;
|
|
755
|
+
declare function runQaAudit(options?: AuditOptions): AuditReport;
|
|
756
|
+
/** Markdown report you can download, paste into a ticket or attach to a PR. */
|
|
757
|
+
declare function auditToMarkdown(report: AuditReport): string;
|
|
758
|
+
/** JSON without DOM references, safe to store or send to a server. */
|
|
759
|
+
declare function auditToJSON(report: AuditReport): string;
|
|
760
|
+
|
|
761
|
+
interface CopilotFixResult {
|
|
762
|
+
issueId: string;
|
|
763
|
+
applied: boolean;
|
|
764
|
+
message: string;
|
|
765
|
+
}
|
|
766
|
+
interface CopilotState {
|
|
767
|
+
report: AuditReport | null;
|
|
768
|
+
watching: boolean;
|
|
769
|
+
appliedFixes: number;
|
|
770
|
+
}
|
|
771
|
+
interface A11yCopilotOptions extends AuditOptions {
|
|
772
|
+
/** Called after every scan (initial, manual or caused by DOM changes). */
|
|
773
|
+
onUpdate?: (state: CopilotState) => void;
|
|
774
|
+
/** Wait this long after DOM changes before rescanning (default 600ms). */
|
|
775
|
+
debounceMs?: number;
|
|
776
|
+
/** Apply every safe fix automatically after each scan (default false). */
|
|
777
|
+
autoApply?: boolean;
|
|
778
|
+
/** Language used when the page has no lang attribute (default: browser language). */
|
|
779
|
+
defaultLang?: string;
|
|
780
|
+
}
|
|
781
|
+
interface A11yCopilot {
|
|
782
|
+
start(): void;
|
|
783
|
+
stop(): void;
|
|
784
|
+
scan(): AuditReport;
|
|
785
|
+
explain(issueId: string): string;
|
|
786
|
+
applyFix(issueId: string): CopilotFixResult;
|
|
787
|
+
applyAllFixes(): CopilotFixResult[];
|
|
788
|
+
undoAll(): number;
|
|
789
|
+
getState(): CopilotState;
|
|
790
|
+
}
|
|
791
|
+
declare function createA11yCopilot(options?: A11yCopilotOptions): A11yCopilot;
|
|
792
|
+
|
|
793
|
+
interface PageOutline {
|
|
794
|
+
title: string;
|
|
795
|
+
description: string;
|
|
796
|
+
language: string;
|
|
797
|
+
headings: Array<{
|
|
798
|
+
level: number;
|
|
799
|
+
text: string;
|
|
800
|
+
}>;
|
|
801
|
+
landmarks: Record<string, number>;
|
|
802
|
+
counts: {
|
|
803
|
+
links: number;
|
|
804
|
+
buttons: number;
|
|
805
|
+
images: number;
|
|
806
|
+
forms: number;
|
|
807
|
+
tables: number;
|
|
808
|
+
fields: number;
|
|
809
|
+
};
|
|
810
|
+
unlabeledFields: Array<{
|
|
811
|
+
type: string;
|
|
812
|
+
hint: string;
|
|
813
|
+
selector: string;
|
|
814
|
+
}>;
|
|
815
|
+
imagesWithoutAlt: Array<{
|
|
816
|
+
src: string;
|
|
817
|
+
selector: string;
|
|
818
|
+
}>;
|
|
819
|
+
purpose: string;
|
|
820
|
+
}
|
|
821
|
+
interface PageAnswer {
|
|
822
|
+
intent: PageIntent;
|
|
823
|
+
answer: string;
|
|
824
|
+
/** Elements the answer refers to, so the UI can highlight them. */
|
|
825
|
+
targets: string[];
|
|
826
|
+
suggestions: string[];
|
|
827
|
+
}
|
|
828
|
+
type PageIntent = "purpose" | "missing-labels" | "images" | "structure" | "forms" | "links" | "counts" | "unknown";
|
|
829
|
+
declare function analyzePage(root?: AuditRoot): PageOutline;
|
|
830
|
+
declare function detectPageIntent(question: string): PageIntent;
|
|
831
|
+
/**
|
|
832
|
+
* Answers a question about the current page.
|
|
833
|
+
* @param summarize Optional hook (e.g. Gemini Nano or your own model) used for "purpose" questions.
|
|
834
|
+
*/
|
|
835
|
+
declare function askAboutPage(question: string, options?: {
|
|
836
|
+
root?: AuditRoot;
|
|
837
|
+
summarize?: (pageText: string) => Promise<string>;
|
|
838
|
+
}): Promise<PageAnswer>;
|
|
839
|
+
|
|
840
|
+
interface ParsedGridQuery {
|
|
841
|
+
filters: GridToolFilter[];
|
|
842
|
+
/** Free-text terms that didn't map to a column; matched across all columns. */
|
|
843
|
+
search: string[];
|
|
844
|
+
sort: GridToolSort | null;
|
|
845
|
+
limit: number | null;
|
|
846
|
+
/** Assumptions the parser made (shown to the user so they can correct it). */
|
|
847
|
+
notes: string[];
|
|
848
|
+
/** Plain-English reading of the query. */
|
|
849
|
+
explanation: string;
|
|
850
|
+
}
|
|
851
|
+
interface GridQueryResult<T> {
|
|
852
|
+
rows: T[];
|
|
853
|
+
ids: string[];
|
|
854
|
+
parsed: ParsedGridQuery;
|
|
855
|
+
message: string;
|
|
856
|
+
}
|
|
857
|
+
type Row = Record<string, unknown>;
|
|
858
|
+
/** "₹10,000" → 10000, "1.5 lakh" → 150000, "2cr" → 20000000, "10k" → 10000. */
|
|
859
|
+
declare function parseAmount(text: string): number | null;
|
|
860
|
+
/** The column mentioned in `text` (longest name wins), or undefined. */
|
|
861
|
+
declare function findMentionedColumn(text: string, columns: GridToolColumn[], kind?: GridToolColumn["type"]): GridToolColumn | undefined;
|
|
862
|
+
interface ParseOptions<T = Row> {
|
|
863
|
+
/** Rows let the parser recognise values like "overdue" in a Status column. */
|
|
864
|
+
data?: T[];
|
|
865
|
+
}
|
|
866
|
+
declare function parseGridQuery<T = Row>(query: string, columns: GridToolColumn[], options?: ParseOptions<T>): ParsedGridQuery;
|
|
867
|
+
/** Runs a parsed query over rows without touching any UI. */
|
|
868
|
+
declare function executeGridQuery<T>(data: T[], columns: GridToolColumn[], parsed: ParsedGridQuery): T[];
|
|
869
|
+
/**
|
|
870
|
+
* Parses and runs a natural-language query, then pushes the result into the
|
|
871
|
+
* grid through the context callbacks (filters, sort, highlight).
|
|
872
|
+
*/
|
|
873
|
+
declare function runGridQuery<T>(query: string, context: GridToolContext<T>, options?: {
|
|
874
|
+
apply?: boolean;
|
|
875
|
+
}): GridQueryResult<T>;
|
|
876
|
+
interface GridAnomaly {
|
|
877
|
+
rowId: string;
|
|
878
|
+
column: string;
|
|
879
|
+
label: string;
|
|
880
|
+
value: unknown;
|
|
881
|
+
kind: "high" | "low" | "duplicate";
|
|
882
|
+
reason: string;
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* Finds unusual rows: numeric values far outside the typical range
|
|
886
|
+
* (interquartile-range rule) and rows that duplicate another row.
|
|
887
|
+
*/
|
|
888
|
+
declare function detectAnomalies<T>(data: T[], columns: GridToolColumn[], options?: {
|
|
889
|
+
rowKey?: string;
|
|
890
|
+
factor?: number;
|
|
891
|
+
columns?: string[];
|
|
892
|
+
}): GridAnomaly[];
|
|
893
|
+
declare function summarizeRows<T>(rows: T[], columns: GridToolColumn[]): string;
|
|
894
|
+
interface GridAnswer<T> {
|
|
895
|
+
kind: "query" | "anomalies" | "summary";
|
|
896
|
+
message: string;
|
|
897
|
+
ids: string[];
|
|
898
|
+
rows: T[];
|
|
899
|
+
anomalies?: GridAnomaly[];
|
|
900
|
+
}
|
|
901
|
+
declare function answerGridQuestion<T>(question: string, context: GridToolContext<T>): GridAnswer<T>;
|
|
902
|
+
|
|
903
|
+
type GridNavAction = "next-row" | "previous-row" | "first-row" | "last-row" | "open-row";
|
|
904
|
+
type VoiceA11yCommand = {
|
|
905
|
+
type: "setting";
|
|
906
|
+
patch: Partial<A11yConfig>;
|
|
907
|
+
say: string;
|
|
908
|
+
} | {
|
|
909
|
+
type: "reset";
|
|
910
|
+
say: string;
|
|
911
|
+
} | {
|
|
912
|
+
type: "grid";
|
|
913
|
+
action: GridNavAction;
|
|
914
|
+
say: string;
|
|
915
|
+
};
|
|
916
|
+
declare const FONT_STEP = 0.1;
|
|
917
|
+
declare const FONT_MIN = 0.8;
|
|
918
|
+
declare const FONT_MAX = 1.3;
|
|
919
|
+
/**
|
|
920
|
+
* Parses a transcript into a command. `current` is needed for relative
|
|
921
|
+
* changes such as "bigger text". Returns null when nothing matched, so you
|
|
922
|
+
* can pass the transcript on to other handlers (e.g. core/ai/voice.ts).
|
|
923
|
+
*/
|
|
924
|
+
declare function parseVoiceA11yCommand(transcript: string, current?: Partial<A11yConfig>): VoiceA11yCommand | null;
|
|
925
|
+
declare const DEFAULT_A11Y_SETTINGS: Partial<A11yConfig>;
|
|
926
|
+
declare function moveGridRowFocus(action: GridNavAction, options?: {
|
|
927
|
+
root?: ParentNode;
|
|
928
|
+
rowSelector?: string;
|
|
929
|
+
}): HTMLElement | null;
|
|
930
|
+
interface VoiceA11yControllerOptions {
|
|
931
|
+
/** Current settings; the controller keeps its own copy after each change. */
|
|
932
|
+
initial?: Partial<A11yConfig>;
|
|
933
|
+
/**
|
|
934
|
+
* Apply new settings. Default: yuktai's wcagPlugin.execute.
|
|
935
|
+
* Pass your own to sync with WidgetPanel state or a settings store.
|
|
936
|
+
*/
|
|
937
|
+
apply?: (config: A11yConfig) => unknown;
|
|
938
|
+
/** Speech recognition language, e.g. "en-IN" or "te-IN" (default "en-IN"). */
|
|
939
|
+
lang?: string;
|
|
940
|
+
/** Speak a confirmation after each command (default true). */
|
|
941
|
+
speak?: boolean;
|
|
942
|
+
/** Called for every recognised transcript, matched or not. */
|
|
943
|
+
onTranscript?: (text: string, command: VoiceA11yCommand | null) => void;
|
|
944
|
+
gridRoot?: ParentNode;
|
|
945
|
+
}
|
|
946
|
+
declare function createVoiceA11yController(options?: VoiceA11yControllerOptions): {
|
|
947
|
+
start: () => boolean;
|
|
948
|
+
stop: () => void;
|
|
949
|
+
/** Run a command from text (also handy for typed commands and tests). */
|
|
950
|
+
handle: (transcript: string) => Promise<VoiceA11yCommand | null>;
|
|
951
|
+
isListening: () => boolean;
|
|
952
|
+
getConfig: () => {
|
|
953
|
+
enabled: boolean;
|
|
954
|
+
highContrast?: boolean;
|
|
955
|
+
darkMode?: boolean;
|
|
956
|
+
reduceMotion?: boolean;
|
|
957
|
+
autoFix?: boolean;
|
|
958
|
+
fontSizeMultiplier?: number;
|
|
959
|
+
colorBlindMode?: ColorBlindMode;
|
|
960
|
+
keyboardHints?: boolean;
|
|
961
|
+
speechEnabled?: boolean;
|
|
962
|
+
showPreferencePanel?: boolean;
|
|
963
|
+
showAuditBadge?: boolean;
|
|
964
|
+
showSkipLinks?: boolean;
|
|
965
|
+
largeTargets?: boolean;
|
|
966
|
+
timeoutWarning?: number;
|
|
967
|
+
dyslexiaFont?: boolean;
|
|
968
|
+
localFont?: string;
|
|
969
|
+
plainEnglish?: boolean;
|
|
970
|
+
summarisePage?: boolean;
|
|
971
|
+
translateLanguage?: string;
|
|
972
|
+
voiceControl?: boolean;
|
|
973
|
+
smartLabels?: boolean;
|
|
974
|
+
};
|
|
975
|
+
};
|
|
976
|
+
|
|
977
|
+
type FormFindingLevel = "problem" | "improvement";
|
|
978
|
+
interface FormField {
|
|
979
|
+
label: string;
|
|
980
|
+
type: string;
|
|
981
|
+
name: string;
|
|
982
|
+
required: boolean;
|
|
983
|
+
hasVisibleLabel: boolean;
|
|
984
|
+
selector: string;
|
|
985
|
+
element: Element;
|
|
986
|
+
}
|
|
987
|
+
interface FormFinding {
|
|
988
|
+
level: FormFindingLevel;
|
|
989
|
+
message: string;
|
|
990
|
+
suggestion: string;
|
|
991
|
+
field?: string;
|
|
992
|
+
selector?: string;
|
|
993
|
+
}
|
|
994
|
+
interface FormReview {
|
|
995
|
+
name: string;
|
|
996
|
+
selector: string;
|
|
997
|
+
fields: FormField[];
|
|
998
|
+
findings: FormFinding[];
|
|
999
|
+
/** 0–100, higher is easier to complete. */
|
|
1000
|
+
score: number;
|
|
1001
|
+
summary: string;
|
|
1002
|
+
}
|
|
1003
|
+
interface FormReviewOptions {
|
|
1004
|
+
root?: AuditRoot;
|
|
1005
|
+
/** Extra checks for older users: font size, field count, vague buttons (default true). */
|
|
1006
|
+
seniorFriendly?: boolean;
|
|
1007
|
+
/** Forms with more fields than this get a "split into steps" suggestion (default 8). */
|
|
1008
|
+
maxFieldsPerStep?: number;
|
|
1009
|
+
}
|
|
1010
|
+
declare function readFormFields(form: Element): FormField[];
|
|
1011
|
+
declare function reviewForm(form: Element, options?: FormReviewOptions): FormReview;
|
|
1012
|
+
/** Reviews every <form> (and every role="form") on the page. */
|
|
1013
|
+
declare function reviewForms(options?: FormReviewOptions): FormReview[];
|
|
1014
|
+
|
|
1015
|
+
interface ContextPassage {
|
|
1016
|
+
id: string;
|
|
1017
|
+
source: "page" | "grid" | "custom";
|
|
1018
|
+
text: string;
|
|
1019
|
+
/** Grid row id or page section heading. */
|
|
1020
|
+
ref?: string;
|
|
1021
|
+
}
|
|
1022
|
+
interface ContextHit extends ContextPassage {
|
|
1023
|
+
score: number;
|
|
1024
|
+
}
|
|
1025
|
+
interface ContextAnswer {
|
|
1026
|
+
answer: string;
|
|
1027
|
+
hits: ContextHit[];
|
|
1028
|
+
/** True when `generate` produced the answer; false for extractive answers. */
|
|
1029
|
+
generated: boolean;
|
|
1030
|
+
}
|
|
1031
|
+
/** Unicode-aware tokens: keeps Telugu/Devanagari combining marks together. */
|
|
1032
|
+
declare function tokenize(text: string): string[];
|
|
1033
|
+
declare function pagePassages(root?: AuditRoot, maxChars?: number): ContextPassage[];
|
|
1034
|
+
declare function gridPassages<T>(data: T[], columns: GridToolColumn[], rowKey?: string): ContextPassage[];
|
|
1035
|
+
interface ContextIndexOptions<T = Record<string, unknown>> {
|
|
1036
|
+
/** Index the visible page text (default true). */
|
|
1037
|
+
includePage?: boolean;
|
|
1038
|
+
root?: AuditRoot;
|
|
1039
|
+
rows?: T[];
|
|
1040
|
+
columns?: GridToolColumn[];
|
|
1041
|
+
rowKey?: string;
|
|
1042
|
+
/** Extra documents, e.g. FAQ text or help articles. */
|
|
1043
|
+
documents?: Array<{
|
|
1044
|
+
id: string;
|
|
1045
|
+
text: string;
|
|
1046
|
+
}>;
|
|
1047
|
+
}
|
|
1048
|
+
declare function createContextIndex<T>(options?: ContextIndexOptions<T>): {
|
|
1049
|
+
search: (question: string, k?: number) => ContextHit[];
|
|
1050
|
+
ask: (question: string, opts?: {
|
|
1051
|
+
k?: number;
|
|
1052
|
+
generate?: (question: string, context: string) => Promise<string>;
|
|
1053
|
+
}) => Promise<ContextAnswer>;
|
|
1054
|
+
/** Call after the page or data changes. */
|
|
1055
|
+
rebuild: () => void;
|
|
1056
|
+
update(next: Partial<ContextIndexOptions<T>>): void;
|
|
1057
|
+
size: () => number;
|
|
1058
|
+
};
|
|
1059
|
+
|
|
1060
|
+
type TaskAction = "filter" | "highlight" | "sort" | "clear" | "count" | "summarize" | "anomalies" | "open" | "select";
|
|
1061
|
+
interface PlannedStep {
|
|
1062
|
+
action: TaskAction;
|
|
1063
|
+
/** The part of the instruction this step came from. */
|
|
1064
|
+
text: string;
|
|
1065
|
+
}
|
|
1066
|
+
interface StepResult extends PlannedStep {
|
|
1067
|
+
success: boolean;
|
|
1068
|
+
message: string;
|
|
1069
|
+
ids?: string[];
|
|
1070
|
+
}
|
|
1071
|
+
interface TaskRunResult {
|
|
1072
|
+
steps: StepResult[];
|
|
1073
|
+
before: {
|
|
1074
|
+
rows: number;
|
|
1075
|
+
filters: GridToolFilter[];
|
|
1076
|
+
};
|
|
1077
|
+
after: {
|
|
1078
|
+
rows: number;
|
|
1079
|
+
filters: GridToolFilter[];
|
|
1080
|
+
sort: GridToolSort | null;
|
|
1081
|
+
highlighted: string[];
|
|
1082
|
+
};
|
|
1083
|
+
/** "What changed", in plain English. */
|
|
1084
|
+
summary: string;
|
|
1085
|
+
}
|
|
1086
|
+
/** Splits an instruction into ordered steps. No model needed. */
|
|
1087
|
+
declare function planTasks(instruction: string): PlannedStep[];
|
|
1088
|
+
interface RunTasksOptions {
|
|
1089
|
+
/** Called after each step, so the UI can show progress. */
|
|
1090
|
+
onStep?: (result: StepResult, index: number, total: number) => void;
|
|
1091
|
+
}
|
|
1092
|
+
declare function runTasks<T extends Record<string, unknown>>(instruction: string, context: GridToolContext<T>, options?: RunTasksOptions): Promise<TaskRunResult>;
|
|
1093
|
+
|
|
1094
|
+
type Aggregation = "sum" | "avg" | "count" | "min" | "max";
|
|
1095
|
+
type Period = "day" | "week" | "month" | "quarter" | "year";
|
|
1096
|
+
interface GroupResult {
|
|
1097
|
+
group: string;
|
|
1098
|
+
value: number;
|
|
1099
|
+
count: number;
|
|
1100
|
+
}
|
|
1101
|
+
interface PeriodChange {
|
|
1102
|
+
group: string;
|
|
1103
|
+
current: number;
|
|
1104
|
+
previous: number;
|
|
1105
|
+
change: number;
|
|
1106
|
+
/** null when the previous value was 0 */
|
|
1107
|
+
changePct: number | null;
|
|
1108
|
+
}
|
|
1109
|
+
interface PeriodComparison {
|
|
1110
|
+
period: Period;
|
|
1111
|
+
current: {
|
|
1112
|
+
from: Date;
|
|
1113
|
+
to: Date;
|
|
1114
|
+
};
|
|
1115
|
+
previous: {
|
|
1116
|
+
from: Date;
|
|
1117
|
+
to: Date;
|
|
1118
|
+
};
|
|
1119
|
+
rows: PeriodChange[];
|
|
1120
|
+
}
|
|
1121
|
+
declare function aggregate(values: number[], agg: Aggregation): number;
|
|
1122
|
+
/** Groups rows by a column and aggregates a metric (or counts rows). Sorted high → low. */
|
|
1123
|
+
declare function groupBy<T>(data: T[], groupKey: string, metricKey: string | null, agg?: Aggregation): GroupResult[];
|
|
1124
|
+
declare function startOfPeriod(date: Date, period: Period, weekStartsOn?: number): Date;
|
|
1125
|
+
declare function addPeriods(date: Date, period: Period, n: number): Date;
|
|
1126
|
+
interface ComparePeriodsOptions {
|
|
1127
|
+
dateKey: string;
|
|
1128
|
+
metricKey: string;
|
|
1129
|
+
groupKey?: string;
|
|
1130
|
+
agg?: Aggregation;
|
|
1131
|
+
period: Period;
|
|
1132
|
+
/** "Now" for the comparison (default: today). */
|
|
1133
|
+
referenceDate?: Date | string;
|
|
1134
|
+
/**
|
|
1135
|
+
* true (default): compare the same elapsed time — e.g. Mon–Wed this week
|
|
1136
|
+
* vs Mon–Wed last week — so a half-finished week doesn't look like a drop.
|
|
1137
|
+
*/
|
|
1138
|
+
toDate?: boolean;
|
|
1139
|
+
weekStartsOn?: number;
|
|
1140
|
+
}
|
|
1141
|
+
declare function comparePeriods<T>(data: T[], o: ComparePeriodsOptions): PeriodComparison;
|
|
1142
|
+
/** Time series: one aggregated value per period, oldest first. */
|
|
1143
|
+
declare function trend<T>(data: T[], dateKey: string, metricKey: string, period: Period, agg?: Aggregation): Array<{
|
|
1144
|
+
start: Date;
|
|
1145
|
+
value: number;
|
|
1146
|
+
}>;
|
|
1147
|
+
interface InsightAnswer {
|
|
1148
|
+
kind: "period-change" | "group" | "trend" | "total" | "unknown";
|
|
1149
|
+
answer: string;
|
|
1150
|
+
table: Array<Record<string, string | number>>;
|
|
1151
|
+
}
|
|
1152
|
+
declare function askInsight<T>(question: string, data: T[], columns: GridToolColumn[], options?: {
|
|
1153
|
+
referenceDate?: Date | string;
|
|
1154
|
+
}): InsightAnswer;
|
|
1155
|
+
|
|
1156
|
+
type DesignCategory = "hierarchy" | "readability" | "interaction" | "clutter" | "consistency";
|
|
1157
|
+
interface DesignFinding {
|
|
1158
|
+
category: DesignCategory;
|
|
1159
|
+
severity: "high" | "medium" | "low";
|
|
1160
|
+
message: string;
|
|
1161
|
+
suggestion: string;
|
|
1162
|
+
selector?: string;
|
|
1163
|
+
}
|
|
1164
|
+
interface DesignReview {
|
|
1165
|
+
score: number;
|
|
1166
|
+
categories: Record<DesignCategory, {
|
|
1167
|
+
score: number;
|
|
1168
|
+
findings: number;
|
|
1169
|
+
}>;
|
|
1170
|
+
findings: DesignFinding[];
|
|
1171
|
+
summary: string;
|
|
1172
|
+
}
|
|
1173
|
+
interface DesignReviewOptions {
|
|
1174
|
+
root?: AuditRoot;
|
|
1175
|
+
/** Minimum body text size in px (default 14; 16 recommended for seniors). */
|
|
1176
|
+
minFontSize?: number;
|
|
1177
|
+
/** Maximum comfortable line length in characters (default 90). */
|
|
1178
|
+
maxLineLength?: number;
|
|
1179
|
+
}
|
|
1180
|
+
declare function reviewDesign(options?: DesignReviewOptions): DesignReview;
|
|
1181
|
+
|
|
1182
|
+
interface UseAgenticGridOptions<T> {
|
|
1183
|
+
data: T[];
|
|
1184
|
+
columns: Array<{
|
|
1185
|
+
key: string;
|
|
1186
|
+
label: string;
|
|
1187
|
+
type?: string;
|
|
1188
|
+
}>;
|
|
1189
|
+
rowKey?: string;
|
|
1190
|
+
/** "Now" for questions like "this week" (default: today). */
|
|
1191
|
+
referenceDate?: Date | string;
|
|
1192
|
+
onOpenRow?: (id: string) => void;
|
|
1193
|
+
}
|
|
1194
|
+
type AgenticAnswerKind = "query" | "anomalies" | "summary" | "insight" | "tasks";
|
|
1195
|
+
declare function useAgenticGrid<T extends Record<string, unknown>>(options: UseAgenticGridOptions<T>): {
|
|
1196
|
+
/** Pass to <YuktaiGrid data={…}> */
|
|
1197
|
+
gridData: T[];
|
|
1198
|
+
/** Pass to <YuktaiGrid highlightIds={…}> */
|
|
1199
|
+
highlightIds: string[];
|
|
1200
|
+
filters: GridToolFilter[];
|
|
1201
|
+
sort: GridToolSort | null;
|
|
1202
|
+
ask: (question: string) => Promise<void>;
|
|
1203
|
+
reset: () => void;
|
|
1204
|
+
answer: string;
|
|
1205
|
+
kind: AgenticAnswerKind | null;
|
|
1206
|
+
table: Record<string, string | number>[];
|
|
1207
|
+
steps: StepResult[];
|
|
1208
|
+
busy: boolean;
|
|
1209
|
+
visibleIds: string[];
|
|
1210
|
+
};
|
|
1211
|
+
declare function AgenticGridBar({ grid, placeholder, examples, style, }: {
|
|
1212
|
+
grid: ReturnType<typeof useAgenticGrid<any>>;
|
|
1213
|
+
placeholder?: string;
|
|
1214
|
+
examples?: string[];
|
|
1215
|
+
style?: CSSProperties;
|
|
1216
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1217
|
+
type Tab = "copilot" | "qa" | "forms" | "design" | "ask" | "voice";
|
|
1218
|
+
interface AgenticPanelProps {
|
|
1219
|
+
defaultTab?: Tab;
|
|
1220
|
+
/** Speech recognition language for the Voice tab (default "en-IN"). */
|
|
1221
|
+
voiceLang?: string;
|
|
1222
|
+
/** Optional model hook for Ask page, e.g. Gemini Nano or your own API. */
|
|
1223
|
+
generate?: (question: string, context: string) => Promise<string>;
|
|
1224
|
+
style?: CSSProperties;
|
|
1225
|
+
}
|
|
1226
|
+
declare function AgenticPanel({ defaultTab, voiceLang, generate, style }: AgenticPanelProps): react_jsx_runtime.JSX.Element;
|
|
1227
|
+
|
|
690
1228
|
declare global {
|
|
691
1229
|
var __yuktai_runtime__: Runtime | undefined;
|
|
692
1230
|
}
|
|
@@ -720,4 +1258,4 @@ declare const YuktAI: {
|
|
|
720
1258
|
scan(): A11yReport;
|
|
721
1259
|
};
|
|
722
1260
|
|
|
723
|
-
export { type A11yConfig, type A11yFix, type A11yReport, type AIFeatures, CheckIcon, ChevronLeftIcon, ChevronRightIcon, CloseIcon, type ColorBlindMode, type CreateGridToolsOptions, type FilterConfig, type FilterOperator, type GridAgentErrorCode, type GridAgentResult, type GridAgentStep, type GridAgentTool, type GridColumn, type GridInputLanguage, type GridIntent, type GridIntentContext, type GridLocale, type GridTheme, type GridTool, type GridToolColumn, type GridToolContext, type GridToolErrorCode, type GridToolFilter, type GridToolFilterOperator, type GridToolId, type GridToolLocale, type GridToolResult, type GridToolSort, type GridTranslations, IconBase, type IconProps, type IndicLanguageLocale, type PaginationConfig, Runtime, SearchIcon, type Severity, type SortConfig, type SortDirection, SortDownIcon, SortUpIcon, type UseGridOptions, type UseGridReturn, type ViewMode, type VoiceFeatures, type WebMCPState, type WebMCPStatus, YuktAI, YuktAIWrapper, type YuktAIWrapperProps, YuktaiGrid, YuktaiGridAI, type YuktaiGridAIProps, useYuktaiGridAgent as YuktaiGridAgent, type YuktaiGridAgentProps, type YuktaiGridProps, type YuktaiGridRule, type YuktaiGridRuleContext, YuktaiGridWebMCP, type YuktaiGridWebMCPProps, aiPlugin, applyGridFilters, clearFilters, clearSort, countGrid, createGridTools, YuktAIWrapper as default, filterGrid, getColumns, getRow, getRowId, highlightRows, openRow, parseGridIntent, searchGrid, selectRow, sortGrid, toGridToolColumns, useGrid, useYuktaiGridAgent, voicePlugin, wcagPlugin as wcag, wcagPlugin };
|
|
1261
|
+
export { type A11yConfig, type A11yCopilot, type A11yCopilotOptions, type A11yFix, type A11yReport, type AIFeatures, AUDIT_RULES, type AgenticAnswerKind, AgenticGridBar, AgenticPanel, type AgenticPanelProps, type Aggregation, type AuditCheck, type AuditIssue, type AuditOptions, type AuditReport, type AuditRoot, type AuditRuleId, type AuditSeverity, CheckIcon, ChevronLeftIcon, ChevronRightIcon, CloseIcon, type ColorBlindMode, type ComparePeriodsOptions, type ContextAnswer, type ContextHit, type ContextIndexOptions, type ContextPassage, type CopilotFixResult, type CopilotState, type CreateGridToolsOptions, DEFAULT_A11Y_SETTINGS, type DesignCategory, type DesignFinding, type DesignReview, type DesignReviewOptions, FONT_MAX, FONT_MIN, FONT_STEP, type FilterConfig, type FilterOperator, type FormField, type FormFinding, type FormFindingLevel, type FormReview, type FormReviewOptions, type GridAgentErrorCode, type GridAgentResult, type GridAgentStep, type GridAgentTool, type GridAnomaly, type GridAnswer, type GridColumn, type GridInputLanguage, type GridIntent, type GridIntentContext, type GridLocale, type GridNavAction, type GridQueryResult, type GridTheme, type GridTool, type GridToolColumn, type GridToolContext, type GridToolErrorCode, type GridToolFilter, type GridToolFilterOperator, type GridToolId, type GridToolLocale, type GridToolResult, type GridToolSort, type GridTranslations, type GroupResult, IconBase, type IconProps, type IndicLanguageLocale, type InsightAnswer, type PageAnswer, type PageIntent, type PageOutline, type PaginationConfig, type ParseOptions, type ParsedGridQuery, type Period, type PeriodChange, type PeriodComparison, type PlannedStep, type RGBA, type RunTasksOptions, Runtime, SearchIcon, type Severity, type SortConfig, type SortDirection, SortDownIcon, SortUpIcon, type StepResult, type TaskAction, type TaskRunResult, type UseAgenticGridOptions, type UseGridOptions, type UseGridReturn, type ViewMode, type VoiceA11yCommand, type VoiceA11yControllerOptions, type VoiceFeatures, type WebMCPState, type WebMCPStatus, YuktAI, YuktAIWrapper, type YuktAIWrapperProps, YuktaiGrid, YuktaiGridAI, type YuktaiGridAIProps, useYuktaiGridAgent as YuktaiGridAgent, type YuktaiGridAgentProps, type YuktaiGridProps, type YuktaiGridRule, type YuktaiGridRuleContext, YuktaiGridWebMCP, type YuktaiGridWebMCPProps, accessibleName, addPeriods, aggregate, aiPlugin, analyzePage, answerGridQuestion, applyGridFilters, askAboutPage, askInsight, auditToJSON, auditToMarkdown, clearFilters, clearSort, comparePeriods, contrastRatio, countGrid, createA11yCopilot, createContextIndex, createGridTools, createVoiceA11yController, YuktAIWrapper as default, detectAnomalies, detectPageIntent, executeGridQuery, filterGrid, findMentionedColumn, getColumns, getRow, getRowId, gridPassages, groupBy, highlightRows, moveGridRowFocus, openRow, pagePassages, parseAmount, parseColor, parseGridIntent, parseGridQuery, parseVoiceA11yCommand, planTasks, readFormFields, relativeLuminance, reviewDesign, reviewForm, reviewForms, runGridQuery, runQaAudit, runTasks, searchGrid, selectRow, sortGrid, startOfPeriod, summarizeRows, toGridToolColumns, tokenize, trend, useAgenticGrid, useGrid, useYuktaiGridAgent, voicePlugin, wcagPlugin as wcag, wcagPlugin };
|