@cs-object/react 0.1.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.
@@ -0,0 +1,118 @@
1
+ import { RefAttributes, DOMAttributes, CSSProperties, ReactNode, ReactElement } from 'react';
2
+ import { SheetDocument, PreparedDocument, Diagnostic, ExecutionPayload, ResolvedAsset, HistoricalReview, CalculationSourceObject, LegacyAssetManifest } from '@cs-object/core';
3
+
4
+ type MathMLAttributeMathDisplay = 'block' | 'inline';
5
+ interface MathMLGlobalAttributes extends RefAttributes<MathMLElement>, DOMAttributes<MathMLElement> {
6
+ className?: string | undefined;
7
+ dir?: string | undefined;
8
+ id?: string | undefined;
9
+ nonce?: string | undefined;
10
+ style?: CSSProperties | undefined;
11
+ tabIndex?: number | undefined;
12
+ mathbackground?: string | undefined;
13
+ mathcolor?: string | undefined;
14
+ }
15
+ interface MathMLTokenAttributes extends MathMLGlobalAttributes {
16
+ children?: string | undefined;
17
+ }
18
+ interface IdentifierMathMLAttributes extends MathMLTokenAttributes {
19
+ mathvariant?: 'normal' | undefined;
20
+ }
21
+ interface OperatorMathMLAttributes extends MathMLTokenAttributes {
22
+ form?: 'prefix' | 'infix' | 'postfix' | undefined;
23
+ lspace?: string | undefined;
24
+ rspace?: string | undefined;
25
+ fence?: 'true' | 'false' | undefined;
26
+ separator?: 'true' | 'false' | undefined;
27
+ stretchy?: 'true' | 'false' | undefined;
28
+ }
29
+ interface SpaceMathMLAttributes extends MathMLGlobalAttributes {
30
+ width?: string;
31
+ }
32
+ interface MathMathMLAttributes extends MathMLGlobalAttributes {
33
+ children?: ReactNode | undefined;
34
+ display?: MathMLAttributeMathDisplay | undefined;
35
+ xmlns?: string | undefined;
36
+ }
37
+ interface FractionMathMLAttributes extends MathMLGlobalAttributes {
38
+ children?: [ReactNode, ReactNode];
39
+ linethickness?: undefined;
40
+ numAlign?: 'left' | 'center' | 'right' | undefined;
41
+ }
42
+ interface MathMLTableAttributes extends MathMLGlobalAttributes {
43
+ readonly columnalign?: string;
44
+ readonly columnspacing?: string;
45
+ readonly rowspacing?: string;
46
+ }
47
+
48
+ declare module 'react' {
49
+ namespace JSX {
50
+ interface IntrinsicElements {
51
+ math: MathMathMLAttributes;
52
+ mi: IdentifierMathMLAttributes;
53
+ mn: MathMLTokenAttributes;
54
+ mo: OperatorMathMLAttributes;
55
+ mtext: MathMLTokenAttributes;
56
+ mspace: SpaceMathMLAttributes;
57
+ mfrac: FractionMathMLAttributes;
58
+ mroot: MathMathMLAttributes;
59
+ mrow: MathMathMLAttributes;
60
+ msqrt: MathMathMLAttributes;
61
+ mtable: MathMLTableAttributes;
62
+ mtr: MathMathMLAttributes;
63
+ mtd: MathMathMLAttributes;
64
+ msub: MathMathMLAttributes;
65
+ msubsup: MathMathMLAttributes;
66
+ msup: MathMathMLAttributes;
67
+ mstyle: MathMathMLAttributes;
68
+ }
69
+ }
70
+ }
71
+
72
+ interface FormulaSheetProps {
73
+ sheet: SheetDocument;
74
+ }
75
+ declare const FormulaSheet: ({ sheet }: FormulaSheetProps) => ReactElement;
76
+
77
+ interface FormulaSheetPrintOptions {
78
+ readonly target?: string | HTMLElement;
79
+ readonly title?: string;
80
+ readonly onError?: (error: unknown) => void;
81
+ }
82
+ declare const printFormulaSheet: (options?: FormulaSheetPrintOptions) => boolean;
83
+
84
+ interface AsciiMathViewProps extends MathMathMLAttributes {
85
+ readonly expression: string;
86
+ readonly identifierMathVariant?: 'normal';
87
+ readonly optional?: boolean;
88
+ }
89
+ declare const AsciiMathView: ({ expression, identifierMathVariant, optional, ...mathProps }: AsciiMathViewProps) => ReactElement;
90
+
91
+ interface PreparedFormulaSheetProps {
92
+ readonly document: PreparedDocument;
93
+ readonly showSourceDetails?: boolean;
94
+ }
95
+ declare const PreparedFormulaSheet: ({ document: input, showSourceDetails, }: PreparedFormulaSheetProps) => ReactElement;
96
+
97
+ declare class DocumentPreparationError extends Error {
98
+ readonly diagnostics: Diagnostic[];
99
+ constructor(diagnostics: Diagnostic[]);
100
+ }
101
+ interface PrepareExecutionDocumentOptions {
102
+ readonly execution: ExecutionPayload;
103
+ readonly assets: readonly ResolvedAsset[];
104
+ readonly historicalReviews?: readonly HistoricalReview[];
105
+ }
106
+ /** Pure preparation. The caller captures and validates media bytes before this call. */
107
+ declare const prepareExecutionDocument: (options: PrepareExecutionDocumentOptions) => PreparedDocument;
108
+ interface PrepareLegacyDocumentOptions {
109
+ readonly cso: CalculationSourceObject;
110
+ readonly fixtureId: string;
111
+ readonly fixtureSha256: string;
112
+ readonly assets: readonly ResolvedAsset[];
113
+ readonly manifest: LegacyAssetManifest;
114
+ readonly historicalReviews?: readonly HistoricalReview[];
115
+ }
116
+ declare const prepareLegacyDocument: (options: PrepareLegacyDocumentOptions) => PreparedDocument;
117
+
118
+ export { AsciiMathView, DocumentPreparationError, FormulaSheet, type FormulaSheetPrintOptions, type FormulaSheetProps, type PrepareExecutionDocumentOptions, type PrepareLegacyDocumentOptions, PreparedFormulaSheet, type PreparedFormulaSheetProps, prepareExecutionDocument, prepareLegacyDocument, printFormulaSheet };
@@ -0,0 +1,118 @@
1
+ import { RefAttributes, DOMAttributes, CSSProperties, ReactNode, ReactElement } from 'react';
2
+ import { SheetDocument, PreparedDocument, Diagnostic, ExecutionPayload, ResolvedAsset, HistoricalReview, CalculationSourceObject, LegacyAssetManifest } from '@cs-object/core';
3
+
4
+ type MathMLAttributeMathDisplay = 'block' | 'inline';
5
+ interface MathMLGlobalAttributes extends RefAttributes<MathMLElement>, DOMAttributes<MathMLElement> {
6
+ className?: string | undefined;
7
+ dir?: string | undefined;
8
+ id?: string | undefined;
9
+ nonce?: string | undefined;
10
+ style?: CSSProperties | undefined;
11
+ tabIndex?: number | undefined;
12
+ mathbackground?: string | undefined;
13
+ mathcolor?: string | undefined;
14
+ }
15
+ interface MathMLTokenAttributes extends MathMLGlobalAttributes {
16
+ children?: string | undefined;
17
+ }
18
+ interface IdentifierMathMLAttributes extends MathMLTokenAttributes {
19
+ mathvariant?: 'normal' | undefined;
20
+ }
21
+ interface OperatorMathMLAttributes extends MathMLTokenAttributes {
22
+ form?: 'prefix' | 'infix' | 'postfix' | undefined;
23
+ lspace?: string | undefined;
24
+ rspace?: string | undefined;
25
+ fence?: 'true' | 'false' | undefined;
26
+ separator?: 'true' | 'false' | undefined;
27
+ stretchy?: 'true' | 'false' | undefined;
28
+ }
29
+ interface SpaceMathMLAttributes extends MathMLGlobalAttributes {
30
+ width?: string;
31
+ }
32
+ interface MathMathMLAttributes extends MathMLGlobalAttributes {
33
+ children?: ReactNode | undefined;
34
+ display?: MathMLAttributeMathDisplay | undefined;
35
+ xmlns?: string | undefined;
36
+ }
37
+ interface FractionMathMLAttributes extends MathMLGlobalAttributes {
38
+ children?: [ReactNode, ReactNode];
39
+ linethickness?: undefined;
40
+ numAlign?: 'left' | 'center' | 'right' | undefined;
41
+ }
42
+ interface MathMLTableAttributes extends MathMLGlobalAttributes {
43
+ readonly columnalign?: string;
44
+ readonly columnspacing?: string;
45
+ readonly rowspacing?: string;
46
+ }
47
+
48
+ declare module 'react' {
49
+ namespace JSX {
50
+ interface IntrinsicElements {
51
+ math: MathMathMLAttributes;
52
+ mi: IdentifierMathMLAttributes;
53
+ mn: MathMLTokenAttributes;
54
+ mo: OperatorMathMLAttributes;
55
+ mtext: MathMLTokenAttributes;
56
+ mspace: SpaceMathMLAttributes;
57
+ mfrac: FractionMathMLAttributes;
58
+ mroot: MathMathMLAttributes;
59
+ mrow: MathMathMLAttributes;
60
+ msqrt: MathMathMLAttributes;
61
+ mtable: MathMLTableAttributes;
62
+ mtr: MathMathMLAttributes;
63
+ mtd: MathMathMLAttributes;
64
+ msub: MathMathMLAttributes;
65
+ msubsup: MathMathMLAttributes;
66
+ msup: MathMathMLAttributes;
67
+ mstyle: MathMathMLAttributes;
68
+ }
69
+ }
70
+ }
71
+
72
+ interface FormulaSheetProps {
73
+ sheet: SheetDocument;
74
+ }
75
+ declare const FormulaSheet: ({ sheet }: FormulaSheetProps) => ReactElement;
76
+
77
+ interface FormulaSheetPrintOptions {
78
+ readonly target?: string | HTMLElement;
79
+ readonly title?: string;
80
+ readonly onError?: (error: unknown) => void;
81
+ }
82
+ declare const printFormulaSheet: (options?: FormulaSheetPrintOptions) => boolean;
83
+
84
+ interface AsciiMathViewProps extends MathMathMLAttributes {
85
+ readonly expression: string;
86
+ readonly identifierMathVariant?: 'normal';
87
+ readonly optional?: boolean;
88
+ }
89
+ declare const AsciiMathView: ({ expression, identifierMathVariant, optional, ...mathProps }: AsciiMathViewProps) => ReactElement;
90
+
91
+ interface PreparedFormulaSheetProps {
92
+ readonly document: PreparedDocument;
93
+ readonly showSourceDetails?: boolean;
94
+ }
95
+ declare const PreparedFormulaSheet: ({ document: input, showSourceDetails, }: PreparedFormulaSheetProps) => ReactElement;
96
+
97
+ declare class DocumentPreparationError extends Error {
98
+ readonly diagnostics: Diagnostic[];
99
+ constructor(diagnostics: Diagnostic[]);
100
+ }
101
+ interface PrepareExecutionDocumentOptions {
102
+ readonly execution: ExecutionPayload;
103
+ readonly assets: readonly ResolvedAsset[];
104
+ readonly historicalReviews?: readonly HistoricalReview[];
105
+ }
106
+ /** Pure preparation. The caller captures and validates media bytes before this call. */
107
+ declare const prepareExecutionDocument: (options: PrepareExecutionDocumentOptions) => PreparedDocument;
108
+ interface PrepareLegacyDocumentOptions {
109
+ readonly cso: CalculationSourceObject;
110
+ readonly fixtureId: string;
111
+ readonly fixtureSha256: string;
112
+ readonly assets: readonly ResolvedAsset[];
113
+ readonly manifest: LegacyAssetManifest;
114
+ readonly historicalReviews?: readonly HistoricalReview[];
115
+ }
116
+ declare const prepareLegacyDocument: (options: PrepareLegacyDocumentOptions) => PreparedDocument;
117
+
118
+ export { AsciiMathView, DocumentPreparationError, FormulaSheet, type FormulaSheetPrintOptions, type FormulaSheetProps, type PrepareExecutionDocumentOptions, type PrepareLegacyDocumentOptions, PreparedFormulaSheet, type PreparedFormulaSheetProps, prepareExecutionDocument, prepareLegacyDocument, printFormulaSheet };