@iyulab/lowline-form 0.5.0 → 0.7.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/bundle/lowline-form.bundle.js +1182 -1127
- package/dist/client.d.ts +5 -0
- package/dist/session.d.ts +5 -1
- package/dist/session.js +9 -3
- package/package.json +4 -4
package/dist/client.d.ts
CHANGED
|
@@ -24,6 +24,11 @@ export interface ThresholdChoice {
|
|
|
24
24
|
*/
|
|
25
25
|
export interface FieldReport {
|
|
26
26
|
field: string;
|
|
27
|
+
/**
|
|
28
|
+
* How many settled records the thresholds were chosen on — the records the report speaks for. Records settled since
|
|
29
|
+
* are answered from, but not in the replay until the thresholds are chosen again.
|
|
30
|
+
*/
|
|
31
|
+
chosenOn: number;
|
|
27
32
|
lookups: number;
|
|
28
33
|
/** The threshold at which values settled alongside answer; absent while none was right often enough. */
|
|
29
34
|
key?: ThresholdChoice;
|
package/dist/session.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type Basis = {
|
|
|
10
10
|
similarity: number;
|
|
11
11
|
};
|
|
12
12
|
/** Why a decided field is shown no suggestion. */
|
|
13
|
-
export type Abstain = 'off' | 'no-evidence' | 'unsure' | 'not-allowed' | 'needs-judgement' | 'not-a-choice' | 'malformed';
|
|
13
|
+
export type Abstain = 'off' | 'no-evidence' | 'unsure' | 'not-allowed' | 'needs-judgement' | 'not-a-choice' | 'malformed' | 'together';
|
|
14
14
|
/** What the host's engine says to show for one decided field. */
|
|
15
15
|
export interface Proposal {
|
|
16
16
|
field: string;
|
|
@@ -21,6 +21,10 @@ export interface Proposal {
|
|
|
21
21
|
basis?: Basis[];
|
|
22
22
|
abstain: Abstain | null;
|
|
23
23
|
asks?: [string, string][];
|
|
24
|
+
/** For `together`: the fields of its group, still open, that are shown no suggestion. */
|
|
25
|
+
with?: string[];
|
|
26
|
+
/** The group of fields settled together the field is in, if any: a field held back for a check holds its group's back. */
|
|
27
|
+
together?: string | null;
|
|
24
28
|
/**
|
|
25
29
|
* How often an answer of this kind for this field has been right — the replay's precision at the threshold the
|
|
26
30
|
* suggestion was held to. Absent with no suggestion, for a judgement or a value from elsewhere, and before thresholds
|
package/dist/session.js
CHANGED
|
@@ -32,13 +32,19 @@ export class Session {
|
|
|
32
32
|
*/
|
|
33
33
|
apply(proposals, values) {
|
|
34
34
|
const round = { fieldStates: Object.fromEntries(this.written), prefill: {} };
|
|
35
|
+
for (const { field, suggestion } of proposals) {
|
|
36
|
+
if (suggestion && !this.written.has(field))
|
|
37
|
+
this.draw(field, suggestion);
|
|
38
|
+
}
|
|
39
|
+
// A field held back for a check holds back the open fields of its group: the person settling it with nothing in view
|
|
40
|
+
// is not shown what is suggested alongside it. Only the held field is the check.
|
|
41
|
+
const held = proposals.filter((p) => this.draft.held(p.field) !== undefined);
|
|
42
|
+
const hidden = (p) => held.some((h) => h.field === p.field || (h.together != null && h.together === p.together));
|
|
35
43
|
for (const proposal of proposals) {
|
|
36
44
|
const { field, suggestion } = proposal;
|
|
37
45
|
if (!suggestion || this.written.has(field))
|
|
38
46
|
continue;
|
|
39
|
-
if (
|
|
40
|
-
continue;
|
|
41
|
-
if (this.draft.held(field) !== undefined)
|
|
47
|
+
if (hidden(proposal))
|
|
42
48
|
continue;
|
|
43
49
|
// Turned down, it stays down for this record: neither shown again nor put back in.
|
|
44
50
|
if (this.draft.declined(field, suggestion))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iyulab/lowline-form",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "The Lowline form element: a formdown form whose decided fields are suggested from the records people confirmed, talking to a Lowline host's routes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"bundle": "vite build --config vite.bundle.config.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@formdown/ui": "^0.
|
|
43
|
+
"@formdown/ui": "^0.26.0",
|
|
44
44
|
"lit": "^3.3.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"typescript": "^6.0.3",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
48
|
+
"vite": "^8.3.1",
|
|
49
|
+
"vitest": "^5.0.2"
|
|
50
50
|
}
|
|
51
51
|
}
|