@iyulab/lowline-form 0.6.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/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
@@ -23,6 +23,8 @@ export interface Proposal {
23
23
  asks?: [string, string][];
24
24
  /** For `together`: the fields of its group, still open, that are shown no suggestion. */
25
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;
26
28
  /**
27
29
  * How often an answer of this kind for this field has been right — the replay's precision at the threshold the
28
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 (this.draw(field, suggestion))
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.6.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.25.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
- "vitest": "^5.0.2",
49
- "vite": "^8.3.1"
48
+ "vite": "^8.3.1",
49
+ "vitest": "^5.0.2"
50
50
  }
51
51
  }