@gemina/elements 0.13.3 → 0.15.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 +78 -7
- package/dist/chat.cjs +1 -1
- package/dist/chat.cjs.map +1 -1
- package/dist/chat.js +2 -2
- package/dist/{chunk-GWTTD7QH.js → chunk-CVL3O5SG.js} +2 -2
- package/dist/{chunk-GWTTD7QH.js.map → chunk-CVL3O5SG.js.map} +1 -1
- package/dist/{chunk-XEWKY2DW.js → chunk-SVP3I3SY.js} +314 -111
- package/dist/chunk-SVP3I3SY.js.map +1 -0
- package/dist/{chunk-MPBZCA44.js → chunk-YVDLYEGU.js} +2 -2
- package/dist/index.cjs +313 -110
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/verification.cjs +313 -110
- package/dist/verification.cjs.map +1 -1
- package/dist/verification.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-XEWKY2DW.js.map +0 -1
- /package/dist/{chunk-MPBZCA44.js.map → chunk-YVDLYEGU.js.map} +0 -0
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
VERSION,
|
|
3
3
|
httpStatus,
|
|
4
4
|
readErrorEnvelope
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-CVL3O5SG.js";
|
|
6
6
|
|
|
7
7
|
// src/verification/index.tsx
|
|
8
8
|
import { useCallback as useCallback3, useEffect as useEffect3, useId as useId2, useMemo, useRef as useRef3, useState as useState3 } from "react";
|
|
@@ -745,6 +745,51 @@ function displayColumns(table, classifiedColumns) {
|
|
|
745
745
|
function matchesTablePointer(serverPointer, classifiedPointer) {
|
|
746
746
|
return serverPointer === classifiedPointer || snakeToCamel(serverPointer) === classifiedPointer;
|
|
747
747
|
}
|
|
748
|
+
function columnsForTable(mutable, classifiedColumns) {
|
|
749
|
+
return mutable ? displayColumns(mutable, classifiedColumns) : classifiedColumns;
|
|
750
|
+
}
|
|
751
|
+
function tableColumns(table, rowMutableTables) {
|
|
752
|
+
const mutable = rowMutableTables.find((entry) => matchesTablePointer(entry.pointer, table.pointer));
|
|
753
|
+
return { mutable, columns: columnsForTable(mutable, table.columns) };
|
|
754
|
+
}
|
|
755
|
+
function declaredTableColumns(mutable, classifiedTables) {
|
|
756
|
+
const classified = classifiedTables.find(
|
|
757
|
+
(candidate) => matchesTablePointer(mutable.pointer, candidate.pointer)
|
|
758
|
+
);
|
|
759
|
+
return columnsForTable(mutable, classified?.columns ?? []);
|
|
760
|
+
}
|
|
761
|
+
function tableRows(table, planned) {
|
|
762
|
+
if (planned === void 0) {
|
|
763
|
+
return table.rows.map((row, position) => ({
|
|
764
|
+
row,
|
|
765
|
+
added: false,
|
|
766
|
+
planned: void 0,
|
|
767
|
+
position
|
|
768
|
+
}));
|
|
769
|
+
}
|
|
770
|
+
return planned.map((plannedRow, position) => {
|
|
771
|
+
const { source } = plannedRow.entry;
|
|
772
|
+
return {
|
|
773
|
+
// An added row was never extracted, so it exists only in the plan.
|
|
774
|
+
row: source === null ? void 0 : table.rows[source],
|
|
775
|
+
added: source === null,
|
|
776
|
+
planned: plannedRow,
|
|
777
|
+
position
|
|
778
|
+
};
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
function resolveRowCell(row, column, planned, bindingIndex) {
|
|
782
|
+
const direct = row?.[column];
|
|
783
|
+
const alias = direct === void 0 ? row?.[snakeToCamel(column)] : void 0;
|
|
784
|
+
const fallbackKey = direct === void 0 && alias === void 0 && row !== void 0 ? Object.keys(row).find((key) => snakeToCamel(key) === snakeToCamel(column)) : void 0;
|
|
785
|
+
const classified = direct ?? alias ?? (fallbackKey === void 0 ? void 0 : row?.[fallbackKey]);
|
|
786
|
+
const fromPlan = planned?.cells.find((cell) => cell.column === column);
|
|
787
|
+
if (fromPlan) {
|
|
788
|
+
return { classified, binding: fromPlan.binding, editKey: fromPlan.editKey };
|
|
789
|
+
}
|
|
790
|
+
const binding = classified === void 0 ? void 0 : bindingIndex.get(classified.pointer);
|
|
791
|
+
return { classified, binding, editKey: binding?.key.raw };
|
|
792
|
+
}
|
|
748
793
|
function splitPointer(pointer) {
|
|
749
794
|
const cut = pointer.lastIndexOf("/");
|
|
750
795
|
return cut <= 0 ? null : { row: pointer.slice(0, cut), field: pointer.slice(cut + 1) };
|
|
@@ -827,9 +872,6 @@ function pruneEmptyAddedRows(plannedTables, edits) {
|
|
|
827
872
|
return out;
|
|
828
873
|
}
|
|
829
874
|
|
|
830
|
-
// src/verification/form.tsx
|
|
831
|
-
import React from "react";
|
|
832
|
-
|
|
833
875
|
// src/verification/review-filter.ts
|
|
834
876
|
function isHighConfidence(confidence) {
|
|
835
877
|
return (confidence?.level ?? "").toLowerCase() === "high";
|
|
@@ -839,6 +881,14 @@ var NOTHING_HIDDEN = {
|
|
|
839
881
|
rows: /* @__PURE__ */ new Set()
|
|
840
882
|
};
|
|
841
883
|
var unplannedRowKey = (tablePointer, index) => `${tablePointer}/${index}`;
|
|
884
|
+
function planForTable(plannedTables, tablePointer) {
|
|
885
|
+
const exact = plannedTables.get(tablePointer);
|
|
886
|
+
if (exact !== void 0) return exact;
|
|
887
|
+
for (const [serverPointer, planned] of plannedTables) {
|
|
888
|
+
if (matchesTablePointer(serverPointer, tablePointer)) return planned;
|
|
889
|
+
}
|
|
890
|
+
return void 0;
|
|
891
|
+
}
|
|
842
892
|
function forEachFieldUnit(classified, visit) {
|
|
843
893
|
for (const header of classified.headers) visit(header.pointer, header.confidence);
|
|
844
894
|
for (const list of classified.simpleLists) {
|
|
@@ -855,26 +905,12 @@ function forEachRowUnit(tables, plannedTables, visit) {
|
|
|
855
905
|
const meta = row?.[ROW_META_KEY];
|
|
856
906
|
return meta?.confidence ?? null;
|
|
857
907
|
};
|
|
858
|
-
const planFor = (tablePointer) => {
|
|
859
|
-
const exact = plannedTables.get(tablePointer);
|
|
860
|
-
if (exact !== void 0) return exact;
|
|
861
|
-
for (const [serverPointer, planned] of plannedTables) {
|
|
862
|
-
if (matchesTablePointer(serverPointer, tablePointer)) return planned;
|
|
863
|
-
}
|
|
864
|
-
return void 0;
|
|
865
|
-
};
|
|
866
908
|
for (const table of tables) {
|
|
867
|
-
const
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
visit(row.entry.id, source === null ? null : confidenceOf(table.rows[source]), source === null);
|
|
872
|
-
}
|
|
873
|
-
continue;
|
|
909
|
+
for (const ref of tableRows(table, planForTable(plannedTables, table.pointer))) {
|
|
910
|
+
const added = ref.added;
|
|
911
|
+
const rowKey = ref.planned ? ref.planned.entry.id : unplannedRowKey(table.pointer, ref.position);
|
|
912
|
+
visit(rowKey, confidenceOf(ref.row), added);
|
|
874
913
|
}
|
|
875
|
-
table.rows.forEach((row, index) => {
|
|
876
|
-
visit(unplannedRowKey(table.pointer, index), confidenceOf(row), false);
|
|
877
|
-
});
|
|
878
914
|
}
|
|
879
915
|
}
|
|
880
916
|
function computeHidden(input) {
|
|
@@ -933,6 +969,60 @@ function hasAnyConfidence(classified, tables, plannedTables) {
|
|
|
933
969
|
return found;
|
|
934
970
|
}
|
|
935
971
|
|
|
972
|
+
// src/verification/empty-columns.ts
|
|
973
|
+
var NO_EMPTY_COLUMNS = /* @__PURE__ */ new Map();
|
|
974
|
+
function qualifies(cell, touchedEver, pairErrors) {
|
|
975
|
+
const { editKey } = cell;
|
|
976
|
+
if (editKey !== void 0 && (touchedEver.has(editKey) || pairErrors.has(editKey))) {
|
|
977
|
+
return false;
|
|
978
|
+
}
|
|
979
|
+
const value = cell.binding === void 0 ? cell.classified?.value : cell.binding.extracted;
|
|
980
|
+
return toInputString(value).trim() === "";
|
|
981
|
+
}
|
|
982
|
+
function computeEmptyColumns(input) {
|
|
983
|
+
const {
|
|
984
|
+
tables,
|
|
985
|
+
plannedTables,
|
|
986
|
+
rowMutableTables,
|
|
987
|
+
bindingIndex,
|
|
988
|
+
touchedEver,
|
|
989
|
+
pairErrors
|
|
990
|
+
} = input;
|
|
991
|
+
const empty = /* @__PURE__ */ new Map();
|
|
992
|
+
for (const table of tables) {
|
|
993
|
+
const { columns } = tableColumns(table, rowMutableTables);
|
|
994
|
+
if (columns.length === 0) {
|
|
995
|
+
continue;
|
|
996
|
+
}
|
|
997
|
+
const rows = tableRows(table, planForTable(plannedTables, table.pointer));
|
|
998
|
+
if (!rows.some((row) => !row.added)) {
|
|
999
|
+
continue;
|
|
1000
|
+
}
|
|
1001
|
+
const hidden = /* @__PURE__ */ new Set();
|
|
1002
|
+
for (const column of columns) {
|
|
1003
|
+
const blankEverywhere = rows.every((row) => qualifies(
|
|
1004
|
+
resolveRowCell(row.row, column, row.planned, bindingIndex),
|
|
1005
|
+
touchedEver,
|
|
1006
|
+
pairErrors
|
|
1007
|
+
));
|
|
1008
|
+
if (blankEverywhere) {
|
|
1009
|
+
hidden.add(column);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
if (hidden.size === 0) {
|
|
1013
|
+
continue;
|
|
1014
|
+
}
|
|
1015
|
+
if (hidden.size === columns.length) {
|
|
1016
|
+
continue;
|
|
1017
|
+
}
|
|
1018
|
+
empty.set(table.pointer, hidden);
|
|
1019
|
+
}
|
|
1020
|
+
return empty.size === 0 ? NO_EMPTY_COLUMNS : empty;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
// src/verification/form.tsx
|
|
1024
|
+
import React from "react";
|
|
1025
|
+
|
|
936
1026
|
// src/verification/tip.tsx
|
|
937
1027
|
import {
|
|
938
1028
|
cloneElement,
|
|
@@ -2070,18 +2160,7 @@ function TableRowView(props) {
|
|
|
2070
2160
|
},
|
|
2071
2161
|
[rects, onFlash]
|
|
2072
2162
|
);
|
|
2073
|
-
const cellFor = (column) =>
|
|
2074
|
-
const direct = row?.[column];
|
|
2075
|
-
const alias = direct === void 0 ? row?.[snakeToCamel(column)] : void 0;
|
|
2076
|
-
const fallbackKey = direct === void 0 && alias === void 0 && row !== void 0 ? Object.keys(row).find((key) => snakeToCamel(key) === snakeToCamel(column)) : void 0;
|
|
2077
|
-
const classified = direct ?? alias ?? (fallbackKey === void 0 ? void 0 : row?.[fallbackKey]);
|
|
2078
|
-
const fromPlan = planned?.cells.find((cell) => cell.column === column);
|
|
2079
|
-
if (fromPlan) {
|
|
2080
|
-
return { classified, binding: fromPlan.binding, editKey: fromPlan.editKey };
|
|
2081
|
-
}
|
|
2082
|
-
const binding = classified === void 0 ? void 0 : bindingIndex.get(classified.pointer);
|
|
2083
|
-
return { classified, binding, editKey: binding?.key.raw };
|
|
2084
|
-
};
|
|
2163
|
+
const cellFor = (column) => resolveRowCell(row, column, planned, bindingIndex);
|
|
2085
2164
|
const firstRect = rects.length > 0 ? rects[0] : null;
|
|
2086
2165
|
const showControls = planned !== void 0 && tablePointer !== void 0 && !readOnly && !shared.filterOn;
|
|
2087
2166
|
const rowLevel = (row?.[ROW_META_KEY]?.confidence?.level ?? "").toLowerCase();
|
|
@@ -2184,15 +2263,19 @@ var EMPTY_SUPPRESSED = /* @__PURE__ */ new Set();
|
|
|
2184
2263
|
function TableSection(props) {
|
|
2185
2264
|
const { table, shared } = props;
|
|
2186
2265
|
const label = formatLabel(table.key);
|
|
2187
|
-
const
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
const columns = React.useMemo(
|
|
2192
|
-
() => mutable ? displayColumns(mutable, table.columns) : table.columns,
|
|
2193
|
-
[mutable, table.columns]
|
|
2266
|
+
const addLineNoteId = React.useId();
|
|
2267
|
+
const { mutable, columns } = React.useMemo(
|
|
2268
|
+
() => tableColumns(table, shared.rowMutableTables),
|
|
2269
|
+
[table, shared.rowMutableTables]
|
|
2194
2270
|
);
|
|
2195
2271
|
const planned = mutable ? shared.plannedTables.get(mutable.pointer) : void 0;
|
|
2272
|
+
const hiddenColumns = shared.emptyColumns.get(table.pointer);
|
|
2273
|
+
const mask = columns.map((column) => hiddenColumns?.has(column) ? "1" : "0").join("");
|
|
2274
|
+
const visibleColumns = React.useMemo(
|
|
2275
|
+
() => mask.includes("1") ? columns.filter((_column, index) => mask[index] !== "1") : columns,
|
|
2276
|
+
[columns, mask]
|
|
2277
|
+
);
|
|
2278
|
+
const hiddenColumnCount = columns.length - visibleColumns.length;
|
|
2196
2279
|
const hasCoords = React.useMemo(
|
|
2197
2280
|
() => table.rows.some(
|
|
2198
2281
|
(row) => Object.entries(row).some(([key, cell]) => key !== ROW_META_KEY && cell.coordinates !== null)
|
|
@@ -2212,7 +2295,8 @@ function TableSection(props) {
|
|
|
2212
2295
|
}
|
|
2213
2296
|
return map;
|
|
2214
2297
|
}, [mutable]);
|
|
2215
|
-
const
|
|
2298
|
+
const rows = React.useMemo(() => tableRows(table, planned), [table, planned]);
|
|
2299
|
+
const rowCount = rows.length;
|
|
2216
2300
|
const needsReview = React.useMemo(
|
|
2217
2301
|
() => table.rows.filter((row) => {
|
|
2218
2302
|
const level = (row[ROW_META_KEY]?.confidence?.level ?? "").toLowerCase();
|
|
@@ -2221,10 +2305,11 @@ function TableSection(props) {
|
|
|
2221
2305
|
[table.rows]
|
|
2222
2306
|
);
|
|
2223
2307
|
const showControls = planned !== void 0 && mutable !== void 0 && !shared.readOnly && !shared.filterOn;
|
|
2224
|
-
const
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
const allHidden =
|
|
2308
|
+
const visibleRows = rows.filter(({ planned: plannedRow, position }) => !shared.hidden.rows.has(
|
|
2309
|
+
plannedRow ? plannedRow.entry.id : unplannedRowKey(table.pointer, position)
|
|
2310
|
+
));
|
|
2311
|
+
const allHidden = visibleRows.length === 0 && rowCount > 0;
|
|
2312
|
+
const tablePointer = planned ? mutable.pointer : void 0;
|
|
2228
2313
|
return /* @__PURE__ */ jsxs3("section", { className: "gemina-verification__section", "aria-label": label, children: [
|
|
2229
2314
|
/* @__PURE__ */ jsxs3("div", { className: "gemina-verification__section-header", children: [
|
|
2230
2315
|
/* @__PURE__ */ jsxs3("span", { children: [
|
|
@@ -2236,6 +2321,7 @@ function TableSection(props) {
|
|
|
2236
2321
|
")"
|
|
2237
2322
|
] }),
|
|
2238
2323
|
shared.filterOn && mutable !== void 0 && !shared.readOnly ? /* @__PURE__ */ jsx3("span", { className: "gemina-verification__filter-note", children: "Row editing is off while filtering" }) : null,
|
|
2324
|
+
hiddenColumnCount > 0 && !allHidden ? /* @__PURE__ */ jsx3("span", { className: "gemina-verification__filter-note", children: `${hiddenColumnCount} ${hiddenColumnCount === 1 ? "column" : "columns"} hidden \u2014 blank in every row` }) : null,
|
|
2239
2325
|
table.overallConfidence ? /* @__PURE__ */ jsxs3("span", { className: "gemina-verification__overall-confidence", children: [
|
|
2240
2326
|
/* @__PURE__ */ jsx3("span", { children: "Overall confidence" }),
|
|
2241
2327
|
/* @__PURE__ */ jsx3(ConfidenceDot, { confidence: table.overallConfidence })
|
|
@@ -2249,7 +2335,7 @@ function TableSection(props) {
|
|
|
2249
2335
|
/* @__PURE__ */ jsx3("thead", { children: /* @__PURE__ */ jsxs3("tr", { children: [
|
|
2250
2336
|
hasCoords ? /* @__PURE__ */ jsx3("th", { "aria-label": "Show row on document" }) : null,
|
|
2251
2337
|
hasRowConfidence ? /* @__PURE__ */ jsx3("th", { "aria-label": "Row confidence" }) : null,
|
|
2252
|
-
|
|
2338
|
+
visibleColumns.map((column) => /* @__PURE__ */ jsx3("th", { children: /* @__PURE__ */ jsx3(
|
|
2253
2339
|
FieldLabel,
|
|
2254
2340
|
{
|
|
2255
2341
|
label: formatLabel(column),
|
|
@@ -2258,43 +2344,35 @@ function TableSection(props) {
|
|
|
2258
2344
|
) }, column)),
|
|
2259
2345
|
showControls ? /* @__PURE__ */ jsx3("th", { "aria-label": "Row actions" }) : null
|
|
2260
2346
|
] }) }),
|
|
2261
|
-
/* @__PURE__ */ jsx3("tbody", { children:
|
|
2347
|
+
/* @__PURE__ */ jsx3("tbody", { children: visibleRows.map(({ row, planned: plannedRow, position }) => /* @__PURE__ */ jsx3(
|
|
2262
2348
|
TableRow,
|
|
2263
2349
|
{
|
|
2264
|
-
row
|
|
2350
|
+
row,
|
|
2265
2351
|
rowIndex: position,
|
|
2266
|
-
columns,
|
|
2352
|
+
columns: visibleColumns,
|
|
2267
2353
|
tableLabel: label,
|
|
2268
2354
|
hasCoords,
|
|
2269
2355
|
hasRowConfidence,
|
|
2270
2356
|
shared,
|
|
2271
2357
|
planned: plannedRow,
|
|
2272
|
-
tablePointer
|
|
2358
|
+
tablePointer
|
|
2273
2359
|
},
|
|
2274
|
-
plannedRow.entry.id
|
|
2275
|
-
)) : visibleRowIndices.map((rowIndex) => /* @__PURE__ */ jsx3(
|
|
2276
|
-
TableRow,
|
|
2277
|
-
{
|
|
2278
|
-
row: table.rows[rowIndex],
|
|
2279
|
-
rowIndex,
|
|
2280
|
-
columns,
|
|
2281
|
-
tableLabel: label,
|
|
2282
|
-
hasCoords,
|
|
2283
|
-
hasRowConfidence,
|
|
2284
|
-
shared
|
|
2285
|
-
},
|
|
2286
|
-
rowIndex
|
|
2360
|
+
plannedRow ? plannedRow.entry.id : position
|
|
2287
2361
|
)) })
|
|
2288
2362
|
] }) }),
|
|
2289
|
-
showControls ? /* @__PURE__ */
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2363
|
+
showControls ? /* @__PURE__ */ jsxs3("div", { className: "gemina-verification__table-footer", children: [
|
|
2364
|
+
/* @__PURE__ */ jsx3(
|
|
2365
|
+
"button",
|
|
2366
|
+
{
|
|
2367
|
+
type: "button",
|
|
2368
|
+
className: "gemina-verification__add-row",
|
|
2369
|
+
onClick: () => shared.onAddRow(mutable.pointer, rowCount - 1),
|
|
2370
|
+
"aria-describedby": hiddenColumnCount > 0 ? addLineNoteId : void 0,
|
|
2371
|
+
children: "Add line"
|
|
2372
|
+
}
|
|
2373
|
+
),
|
|
2374
|
+
hiddenColumnCount > 0 ? /* @__PURE__ */ jsx3("span", { className: "gemina-verification__filter-note", id: addLineNoteId, children: "New lines can only fill the visible columns \u2014 turn off \u201CHide empty columns\u201D to reach the rest." }) : null
|
|
2375
|
+
] }) : null
|
|
2298
2376
|
] });
|
|
2299
2377
|
}
|
|
2300
2378
|
var FallbackSection = React.memo(function FallbackSection2(props) {
|
|
@@ -2348,7 +2426,8 @@ function VerificationForm(props) {
|
|
|
2348
2426
|
onAddRow,
|
|
2349
2427
|
onRemoveRow,
|
|
2350
2428
|
hidden,
|
|
2351
|
-
filterOn
|
|
2429
|
+
filterOn,
|
|
2430
|
+
emptyColumns
|
|
2352
2431
|
} = props;
|
|
2353
2432
|
const { tables: promotedTables, suppressed } = React.useMemo(
|
|
2354
2433
|
() => withEmptyMutableTables(classified, rowMutableTables ?? NO_TABLES),
|
|
@@ -2366,7 +2445,8 @@ function VerificationForm(props) {
|
|
|
2366
2445
|
onAddRow: onAddRow ?? NOOP_ROW,
|
|
2367
2446
|
onRemoveRow: onRemoveRow ?? NOOP_ROW,
|
|
2368
2447
|
hidden: hidden ?? NOTHING_HIDDEN,
|
|
2369
|
-
filterOn: filterOn ?? false
|
|
2448
|
+
filterOn: filterOn ?? false,
|
|
2449
|
+
emptyColumns: emptyColumns ?? NO_EMPTY_COLUMNS
|
|
2370
2450
|
};
|
|
2371
2451
|
return (
|
|
2372
2452
|
// A real, labeled <form> (role "form" landmark): AT users can jump
|
|
@@ -2683,8 +2763,20 @@ var VERIFICATION_CSS = `
|
|
|
2683
2763
|
}
|
|
2684
2764
|
.gemina-verification__section-header {
|
|
2685
2765
|
display: flex;
|
|
2766
|
+
/* Wraps for the same reason the footer does, and it was measured the same
|
|
2767
|
+
way: with BOTH review filters on this row carries four children \u2014 the
|
|
2768
|
+
label, the confidence filter's "row editing is off" note, the column
|
|
2769
|
+
filter's count, and the overall-confidence readout, which is
|
|
2770
|
+
white-space: nowrap on margin-inline-start: auto. At 320 that readout
|
|
2771
|
+
was pushed 36px (chromium) / 48px (firefox) past the header's edge and
|
|
2772
|
+
clipped, in BOTH directions. Without wrapping, the three text children
|
|
2773
|
+
also squeeze into narrow word-per-line columns from ~420px down, which is
|
|
2774
|
+
the state the screenshots showed before this rule. Row gap is tighter
|
|
2775
|
+
than the column gap: wrapped lines are one meta line continued, not
|
|
2776
|
+
separate blocks. */
|
|
2777
|
+
flex-wrap: wrap;
|
|
2686
2778
|
align-items: center;
|
|
2687
|
-
gap: 8px;
|
|
2779
|
+
gap: 4px 8px;
|
|
2688
2780
|
padding: 8px 12px;
|
|
2689
2781
|
background: var(--gemina-verification-surface);
|
|
2690
2782
|
border-block-end: 1px solid var(--gemina-verification-border);
|
|
@@ -2944,6 +3036,13 @@ var VERIFICATION_CSS = `
|
|
|
2944
3036
|
padding-block-start: 12px;
|
|
2945
3037
|
border-block-start: 1px solid var(--gemina-verification-border);
|
|
2946
3038
|
}
|
|
3039
|
+
/* Programmatic focus landing (tabIndex -1), not an interactive control, and
|
|
3040
|
+
the same treatment the done state gets: no ring. Focus arrives here only
|
|
3041
|
+
when the empty-columns switch deletes itself and Submit is disabled, purely
|
|
3042
|
+
so keyboard/AT users don't drop to <body>; outlining the whole footer row
|
|
3043
|
+
would read as a control the reviewer had somehow activated. */
|
|
3044
|
+
.gemina-verification__footer:focus,
|
|
3045
|
+
.gemina-verification__footer:focus-visible { outline: none; }
|
|
2947
3046
|
.gemina-verification__footer .gemina-verification__submit { margin-inline-start: auto; }
|
|
2948
3047
|
.gemina-verification__submit {
|
|
2949
3048
|
font: inherit;
|
|
@@ -2978,16 +3077,56 @@ var VERIFICATION_CSS = `
|
|
|
2978
3077
|
border-color: var(--gemina-verification-accent);
|
|
2979
3078
|
color: var(--gemina-verification-accent-fg);
|
|
2980
3079
|
}
|
|
2981
|
-
/* Stands in for a table's grid when every row of it scored high. Muted and
|
|
2982
|
-
unemphatic on purpose \u2014 it reports an absence, it is not a finding. */
|
|
2983
3080
|
.gemina-verification__filter-count {
|
|
2984
3081
|
font-size: 12px;
|
|
2985
3082
|
color: var(--gemina-verification-muted);
|
|
3083
|
+
/* "Showing 6 of 11" is untranslated English chrome whose first characters
|
|
3084
|
+
are a digit run, and it sits in a footer that takes the widget's
|
|
3085
|
+
direction. Same fix, same reason as __progress above: base the line's
|
|
3086
|
+
direction on its own first strong character. */
|
|
3087
|
+
unicode-bidi: plaintext;
|
|
2986
3088
|
}
|
|
3089
|
+
/* One class, THREE statements \u2014 two in the section header and one below the
|
|
3090
|
+
grid. The confidence filter's "row editing is off while filtering" (a
|
|
3091
|
+
constraint), the column filter's "N columns hidden" (a report), and the note
|
|
3092
|
+
beside *Add line* saying a new line cannot reach the hidden columns (an
|
|
3093
|
+
instruction). Muted and unemphatic on purpose in all three roles: none of
|
|
3094
|
+
them is a finding about the document, and the instruction is a limit the
|
|
3095
|
+
reviewer meets rarely, not a warning.
|
|
3096
|
+
Explicitly 400 for the two in the header: it sets font-weight: 600 for its
|
|
3097
|
+
LABEL, and without this they inherit it and become the boldest thing in the
|
|
3098
|
+
row after the label itself. The header's three weights are the hierarchy \u2014
|
|
3099
|
+
600 label, 500 confidence readout, 400 notes. (The table footer inherits
|
|
3100
|
+
400 anyway; stating it keeps all three instances identical wherever they
|
|
3101
|
+
are read.) */
|
|
2987
3102
|
.gemina-verification__filter-note {
|
|
2988
3103
|
font-size: 12px;
|
|
3104
|
+
font-weight: 400;
|
|
2989
3105
|
color: var(--gemina-verification-muted);
|
|
3106
|
+
/* Observed at 320 RTL before this rule: "1 empty column hidden" rendered as
|
|
3107
|
+
"empty 1 column hidden" \u2014 the RTL paragraph direction reordered the
|
|
3108
|
+
leading number run. The copy is English chrome either way, so it takes
|
|
3109
|
+
its direction from its own first strong character. */
|
|
3110
|
+
unicode-bidi: plaintext;
|
|
2990
3111
|
}
|
|
3112
|
+
/* Two notes side by side is a reachable state \u2014 the confidence filter's
|
|
3113
|
+
constraint and this filter's count \u2014 and unseparated they read as one
|
|
3114
|
+
sentence ("\u2026while filtering 11 columns hidden"). A hairline rather than the
|
|
3115
|
+
house middot, because a separator CHARACTER cannot land on the right side
|
|
3116
|
+
here: the note carries unicode-bidi: plaintext, so its own content resolves
|
|
3117
|
+
LTR even inside an RTL header, and a ::before then paints at the note's left
|
|
3118
|
+
edge \u2014 the side AWAY from the sibling it is separating from. Measured that
|
|
3119
|
+
way at 780 RTL before this rule. A border-inline-start resolves against the
|
|
3120
|
+
direction property, which plaintext does not touch, so it faces the previous
|
|
3121
|
+
sibling in both directions. It also survives the header wrapping: when the
|
|
3122
|
+
two notes land on different lines the hairline leads the second one, where a
|
|
3123
|
+
rule reads as an indent and a stray middot would have read as a typo. */
|
|
3124
|
+
.gemina-verification__filter-note + .gemina-verification__filter-note {
|
|
3125
|
+
border-inline-start: 1px solid var(--gemina-verification-border);
|
|
3126
|
+
padding-inline-start: 8px;
|
|
3127
|
+
}
|
|
3128
|
+
/* Stands in for a table's grid when every row of it scored high. Muted and
|
|
3129
|
+
unemphatic on purpose \u2014 it reports an absence, it is not a finding. */
|
|
2991
3130
|
.gemina-verification__all-scored {
|
|
2992
3131
|
margin: 0;
|
|
2993
3132
|
padding: 12px;
|
|
@@ -3184,6 +3323,12 @@ var VERIFICATION_CSS = `
|
|
|
3184
3323
|
}
|
|
3185
3324
|
.gemina-verification__table-footer {
|
|
3186
3325
|
display: flex;
|
|
3326
|
+
/* *Add line* sits here alone until the column filter hides something, and
|
|
3327
|
+
then a note joins it \u2014 long enough to need its own line at 390 and below,
|
|
3328
|
+
which is why this row wraps and centres what is on it. */
|
|
3329
|
+
flex-wrap: wrap;
|
|
3330
|
+
align-items: center;
|
|
3331
|
+
gap: 8px;
|
|
3187
3332
|
padding: 8px 10px;
|
|
3188
3333
|
}
|
|
3189
3334
|
.gemina-verification__add-row {
|
|
@@ -3352,7 +3497,9 @@ function GeminaVerification(props) {
|
|
|
3352
3497
|
const [flashRects, setFlashRects] = useState3(null);
|
|
3353
3498
|
const [stacked, setStacked] = useState3(false);
|
|
3354
3499
|
const [filterOn, setFilterOn] = useState3(false);
|
|
3500
|
+
const [hideEmptyColumns, setHideEmptyColumns] = useState3(false);
|
|
3355
3501
|
const rootRef = useRef3(null);
|
|
3502
|
+
const touchedEverRef = useRef3(/* @__PURE__ */ new Set());
|
|
3356
3503
|
const mountedRef = useRef3(false);
|
|
3357
3504
|
const loadSeqRef = useRef3(0);
|
|
3358
3505
|
const lastImageRefreshRef = useRef3(0);
|
|
@@ -3368,6 +3515,7 @@ function GeminaVerification(props) {
|
|
|
3368
3515
|
const cancelButtonRef = useRef3(null);
|
|
3369
3516
|
const retrySubmitButtonRef = useRef3(null);
|
|
3370
3517
|
const doneStateRef = useRef3(null);
|
|
3518
|
+
const footerRef = useRef3(null);
|
|
3371
3519
|
const enterUnavailable = useCallback3(
|
|
3372
3520
|
(reason, message, canRetry, detail) => {
|
|
3373
3521
|
setPhase({ name: "unavailable", reason, message, canRetry });
|
|
@@ -3429,6 +3577,8 @@ function GeminaVerification(props) {
|
|
|
3429
3577
|
});
|
|
3430
3578
|
setEdits(NO_EDITS);
|
|
3431
3579
|
setFilterOn(false);
|
|
3580
|
+
setHideEmptyColumns(false);
|
|
3581
|
+
touchedEverRef.current = /* @__PURE__ */ new Set();
|
|
3432
3582
|
setRowPlans(seedRowPlans(readRowMutableTables(view.meta.validationFeedback?.rowMutableTables), view.values));
|
|
3433
3583
|
const url = view.document.imageUrl;
|
|
3434
3584
|
setImageUrl(typeof url === "string" && url.length > 0 ? url : null);
|
|
@@ -3557,6 +3707,7 @@ function GeminaVerification(props) {
|
|
|
3557
3707
|
);
|
|
3558
3708
|
const effectiveDir = dir === "auto" ? hasHebrewContent ? "rtl" : "ltr" : dir;
|
|
3559
3709
|
const handleEdit = useCallback3((editKey, value, binding) => {
|
|
3710
|
+
touchedEverRef.current.add(editKey);
|
|
3560
3711
|
const pristine = value === toInputString(binding.extracted);
|
|
3561
3712
|
setEdits((prev) => {
|
|
3562
3713
|
if (pristine) {
|
|
@@ -3586,10 +3737,7 @@ function GeminaVerification(props) {
|
|
|
3586
3737
|
if (plan === void 0) {
|
|
3587
3738
|
continue;
|
|
3588
3739
|
}
|
|
3589
|
-
const
|
|
3590
|
-
(candidate) => matchesTablePointer(table.pointer, candidate.pointer)
|
|
3591
|
-
);
|
|
3592
|
-
const columns = displayColumns(table, classifiedTable?.columns ?? []);
|
|
3740
|
+
const columns = declaredTableColumns(table, classified.tables);
|
|
3593
3741
|
out.set(table.pointer, planTableCells(table, plan, columns, bindingsByRawKey));
|
|
3594
3742
|
}
|
|
3595
3743
|
return out;
|
|
@@ -3707,6 +3855,31 @@ function GeminaVerification(props) {
|
|
|
3707
3855
|
);
|
|
3708
3856
|
const visibleUnits = totalUnits - hidden.fields.size - hidden.rows.size;
|
|
3709
3857
|
const allClear = filterOn && totalUnits > 0 && visibleUnits === 0;
|
|
3858
|
+
const emptyColumns = useMemo(
|
|
3859
|
+
() => computeEmptyColumns({
|
|
3860
|
+
// The RENDERED tables, not `classified.tables`: a server-declared
|
|
3861
|
+
// zero-row row-mutable table is promoted into the rendered list and the
|
|
3862
|
+
// rule has to see it (it hides nothing there, by its own row gate).
|
|
3863
|
+
tables: rendered.tables,
|
|
3864
|
+
plannedTables,
|
|
3865
|
+
rowMutableTables: loaded?.rowMutableTables ?? [],
|
|
3866
|
+
bindingIndex,
|
|
3867
|
+
touchedEver: touchedEverRef.current,
|
|
3868
|
+
// §D5: read-only drops the pair-error clause. Nothing renders an error
|
|
3869
|
+
// there and Submit is permanently disabled, so keeping a blank
|
|
3870
|
+
// pair-partner visible would be a rule with no observable reason.
|
|
3871
|
+
// The form's own shared empty map, so "no row errors" has one name on
|
|
3872
|
+
// both sides — nothing compares it by reference (see NO_PAIR_ERRORS).
|
|
3873
|
+
pairErrors: alreadyValidated ? NO_PAIR_ERRORS : pairErrors
|
|
3874
|
+
}),
|
|
3875
|
+
// Spelled out rather than elided, and `edits` STAYS in it although the body
|
|
3876
|
+
// no longer reads it: it is what re-runs this memo as the reviewer types,
|
|
3877
|
+
// which is what keeps a just-touched column from qualifying under their
|
|
3878
|
+
// cursor. This repo has no ESLint — nothing mechanical will tell you if you
|
|
3879
|
+
// drop a dependency here.
|
|
3880
|
+
[rendered, plannedTables, loaded, bindingIndex, edits, pairErrors, alreadyValidated]
|
|
3881
|
+
);
|
|
3882
|
+
const canHideEmptyColumns = emptyColumns.size > 0 || hideEmptyColumns;
|
|
3710
3883
|
const invalidCount = useMemo(() => {
|
|
3711
3884
|
const rowLevel = pairErrors.size;
|
|
3712
3885
|
if (edits.size === 0) {
|
|
@@ -3881,6 +4054,7 @@ function GeminaVerification(props) {
|
|
|
3881
4054
|
rowMutableTables: loaded?.rowMutableTables,
|
|
3882
4055
|
hidden,
|
|
3883
4056
|
filterOn,
|
|
4057
|
+
emptyColumns: hideEmptyColumns ? emptyColumns : NO_EMPTY_COLUMNS,
|
|
3884
4058
|
plannedTables,
|
|
3885
4059
|
onAddRow: handleAddRow,
|
|
3886
4060
|
onRemoveRow: handleRemoveRow
|
|
@@ -3907,34 +4081,63 @@ function GeminaVerification(props) {
|
|
|
3907
4081
|
]
|
|
3908
4082
|
}
|
|
3909
4083
|
),
|
|
3910
|
-
/* @__PURE__ */ jsxs4(
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
4084
|
+
/* @__PURE__ */ jsxs4(
|
|
4085
|
+
"div",
|
|
4086
|
+
{
|
|
4087
|
+
className: "gemina-verification__footer",
|
|
4088
|
+
ref: footerRef,
|
|
4089
|
+
tabIndex: -1,
|
|
4090
|
+
children: [
|
|
4091
|
+
!alreadyValidated && (invalidCount > 0 ? /* @__PURE__ */ jsx4("div", { className: "gemina-verification__attention", "aria-live": "polite", children: invalidCount === 1 ? "1 field needs attention" : `${invalidCount} fields need attention` }) : /* @__PURE__ */ jsx4("div", { className: "gemina-verification__progress", "aria-live": "polite", children: `${submission.confirmed} confirmed \xB7 ${submission.corrected} corrected` })),
|
|
4092
|
+
canFilter && /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
4093
|
+
/* @__PURE__ */ jsx4(
|
|
4094
|
+
"button",
|
|
4095
|
+
{
|
|
4096
|
+
type: "button",
|
|
4097
|
+
role: "switch",
|
|
4098
|
+
"aria-checked": filterOn,
|
|
4099
|
+
className: "gemina-verification__review-filter",
|
|
4100
|
+
onClick: () => setFilterOn((on) => !on),
|
|
4101
|
+
children: "Hide high-confidence fields"
|
|
4102
|
+
}
|
|
4103
|
+
),
|
|
4104
|
+
filterOn && /* @__PURE__ */ jsx4("span", { className: "gemina-verification__filter-count", "aria-live": "polite", children: `Showing ${visibleUnits} of ${totalUnits}` })
|
|
4105
|
+
] }),
|
|
4106
|
+
canHideEmptyColumns && /* @__PURE__ */ jsx4(
|
|
4107
|
+
"button",
|
|
4108
|
+
{
|
|
4109
|
+
type: "button",
|
|
4110
|
+
role: "switch",
|
|
4111
|
+
"aria-checked": hideEmptyColumns,
|
|
4112
|
+
className: "gemina-verification__review-filter",
|
|
4113
|
+
onClick: () => {
|
|
4114
|
+
if (hideEmptyColumns && emptyColumns.size === 0) {
|
|
4115
|
+
const submit = submitButtonRef.current;
|
|
4116
|
+
if (submit !== null && !submit.disabled) {
|
|
4117
|
+
submit.focus();
|
|
4118
|
+
} else {
|
|
4119
|
+
footerRef.current?.focus();
|
|
4120
|
+
}
|
|
4121
|
+
}
|
|
4122
|
+
setHideEmptyColumns((on) => !on);
|
|
4123
|
+
},
|
|
4124
|
+
children: "Hide empty columns"
|
|
4125
|
+
}
|
|
4126
|
+
),
|
|
4127
|
+
/* @__PURE__ */ jsx4(
|
|
4128
|
+
"button",
|
|
4129
|
+
{
|
|
4130
|
+
type: "button",
|
|
4131
|
+
ref: submitButtonRef,
|
|
4132
|
+
className: "gemina-verification__submit",
|
|
4133
|
+
disabled: alreadyValidated || reviewPhase.name !== "review" || invalidCount > 0,
|
|
4134
|
+
onClick: handleSubmitClick,
|
|
4135
|
+
children: "Submit"
|
|
4136
|
+
}
|
|
4137
|
+
)
|
|
4138
|
+
]
|
|
4139
|
+
}
|
|
4140
|
+
),
|
|
3938
4141
|
overlayUp && /* @__PURE__ */ jsx4(
|
|
3939
4142
|
"div",
|
|
3940
4143
|
{
|
|
@@ -4038,4 +4241,4 @@ function GeminaVerification(props) {
|
|
|
4038
4241
|
export {
|
|
4039
4242
|
GeminaVerification
|
|
4040
4243
|
};
|
|
4041
|
-
//# sourceMappingURL=chunk-
|
|
4244
|
+
//# sourceMappingURL=chunk-SVP3I3SY.js.map
|