@graffiticode/l0000-view 0.1.4 → 0.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/dist/index.d.ts +24 -1
- package/dist/index.js +275 -810
- package/dist/index.js.map +1 -1
- package/dist/style.css +2 -1
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
2
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* The host's Check button and the score it reveals. Exported for hosts that mount a Form without
|
|
6
|
+
* the View (the MCP widget), so every one of our hosts checks the same way.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CheckBar: ({ result, checked, onCheck, }: {
|
|
9
|
+
result: Score;
|
|
10
|
+
checked: boolean;
|
|
11
|
+
onCheck: () => void;
|
|
12
|
+
}) => JSX_2.Element;
|
|
13
|
+
|
|
4
14
|
export declare interface CompileError {
|
|
5
15
|
message: string;
|
|
6
16
|
from?: number;
|
|
@@ -34,15 +44,28 @@ export declare interface FormProps {
|
|
|
34
44
|
*/
|
|
35
45
|
export declare type LanguageReducer = (data: any, action: StateAction) => any | undefined;
|
|
36
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Score the live model, or return `undefined` when it has nothing to check (no answer key, no
|
|
49
|
+
* blanks). Called on every change, so keep it cheap and never throw.
|
|
50
|
+
*/
|
|
51
|
+
export declare type LanguageScore = (data: any) => Score | undefined;
|
|
52
|
+
|
|
53
|
+
/** A learner's score, as the Check button reports it. */
|
|
54
|
+
export declare interface Score {
|
|
55
|
+
score: number;
|
|
56
|
+
max: number;
|
|
57
|
+
}
|
|
58
|
+
|
|
37
59
|
export declare interface StateAction {
|
|
38
60
|
type: string;
|
|
39
61
|
args?: any;
|
|
40
62
|
}
|
|
41
63
|
|
|
42
|
-
export declare const View: ({ Form, reduce, formModel, }: {
|
|
64
|
+
export declare const View: ({ Form, reduce, formModel, score, }: {
|
|
43
65
|
Form: FormComponent;
|
|
44
66
|
reduce?: LanguageReducer;
|
|
45
67
|
formModel?: FormModel;
|
|
68
|
+
score?: LanguageScore;
|
|
46
69
|
}) => JSX_2.Element;
|
|
47
70
|
|
|
48
71
|
export { }
|