@gemina/elements 0.9.0 → 0.11.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.
@@ -45,7 +45,7 @@ async function readErrorEnvelope(error) {
45
45
  }
46
46
 
47
47
  // src/version.ts
48
- var VERSION = "0.9.0";
48
+ var VERSION = "0.11.0";
49
49
 
50
50
  export {
51
51
  getResponseLike,
@@ -53,4 +53,4 @@ export {
53
53
  readErrorEnvelope,
54
54
  VERSION
55
55
  };
56
- //# sourceMappingURL=chunk-S4KBJRIP.js.map
56
+ //# sourceMappingURL=chunk-XII4IQNS.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/internal/response-like.ts","../src/version.ts"],"sourcesContent":["/**\n * Shared transport-error helpers for the widgets (chat + verification).\n *\n * Extracted verbatim from chat.tsx so both components read thrown SDK errors\n * the same way. Pure and dependency-free: no React, no DOM.\n */\n\n/**\n * The response-like object carried by a thrown transport error. We pull it off\n * by shape rather than `instanceof ResponseError` — robust against duplicated\n * `@gemina/sdk` copies in a bundle (class identity is not shared across\n * copies). On the fetch transport this is the raw `Response`, so `status`,\n * `headers`, and the JSON body are all reachable from here.\n */\nexport interface ResponseLike {\n status?: number;\n headers?: { get?: (name: string) => string | null };\n json?: () => Promise<unknown>;\n clone?: () => ResponseLike;\n}\n\nexport function getResponseLike(error: unknown): ResponseLike | undefined {\n if (error !== null && typeof error === 'object' && 'response' in error) {\n const response = (error as { response?: unknown }).response;\n if (response !== null && typeof response === 'object') {\n return response as ResponseLike;\n }\n }\n return undefined;\n}\n\n/** Extract an HTTP status from a thrown value, or `undefined`. */\nexport function httpStatus(error: unknown): number | undefined {\n const status = getResponseLike(error)?.status;\n return typeof status === 'number' ? status : undefined;\n}\n\n/** What the standard backend error envelope reliably carries. */\nexport interface ErrorEnvelope {\n status: number | undefined;\n /** Stable backend `errors[0].error_code`. */\n errorCode: string | undefined;\n /** Human-readable server fallback (`errors[0].description`). */\n description: string | undefined;\n}\n\n/**\n * Read what the backend actually sent on an error. Only the HTTP status and\n * the stable `errors[0].error_code` / `description` are reliable across\n * environments — production strips `errors[0].detail`, so we never touch it.\n * The fetch body can be read once, so we clone defensively; if that fails\n * (non-JSON, empty, or already consumed) the status still stands.\n */\nexport async function readErrorEnvelope(error: unknown): Promise<ErrorEnvelope> {\n const response = getResponseLike(error);\n const info: ErrorEnvelope = {\n status: typeof response?.status === 'number' ? response.status : undefined,\n errorCode: undefined,\n description: undefined,\n };\n if (response === undefined) {\n return info;\n }\n\n let body: unknown;\n try {\n const source = typeof response.clone === 'function' ? response.clone() : response;\n body = typeof source.json === 'function' ? await source.json() : undefined;\n } catch {\n body = undefined;\n }\n if (body !== null && typeof body === 'object') {\n const errors = (body as { errors?: unknown }).errors;\n if (\n Array.isArray(errors) &&\n errors.length > 0 &&\n errors[0] !== null &&\n typeof errors[0] === 'object'\n ) {\n const first = errors[0] as { error_code?: unknown; description?: unknown };\n if (typeof first.error_code === 'string') {\n info.errorCode = first.error_code;\n }\n if (typeof first.description === 'string') {\n info.description = first.description;\n }\n }\n }\n return info;\n}\n","/** Package version. Keep in sync with package.json. */\nexport const VERSION = '0.9.0';\n"],"mappings":";AAqBO,SAAS,gBAAgB,OAA0C;AACxE,MAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,cAAc,OAAO;AACtE,UAAM,WAAY,MAAiC;AACnD,QAAI,aAAa,QAAQ,OAAO,aAAa,UAAU;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAGO,SAAS,WAAW,OAAoC;AAC7D,QAAM,SAAS,gBAAgB,KAAK,GAAG;AACvC,SAAO,OAAO,WAAW,WAAW,SAAS;AAC/C;AAkBA,eAAsB,kBAAkB,OAAwC;AAC9E,QAAM,WAAW,gBAAgB,KAAK;AACtC,QAAM,OAAsB;AAAA,IAC1B,QAAQ,OAAO,UAAU,WAAW,WAAW,SAAS,SAAS;AAAA,IACjE,WAAW;AAAA,IACX,aAAa;AAAA,EACf;AACA,MAAI,aAAa,QAAW;AAC1B,WAAO;AAAA,EACT;AAEA,MAAI;AACJ,MAAI;AACF,UAAM,SAAS,OAAO,SAAS,UAAU,aAAa,SAAS,MAAM,IAAI;AACzE,WAAO,OAAO,OAAO,SAAS,aAAa,MAAM,OAAO,KAAK,IAAI;AAAA,EACnE,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI,SAAS,QAAQ,OAAO,SAAS,UAAU;AAC7C,UAAM,SAAU,KAA8B;AAC9C,QACE,MAAM,QAAQ,MAAM,KACpB,OAAO,SAAS,KAChB,OAAO,CAAC,MAAM,QACd,OAAO,OAAO,CAAC,MAAM,UACrB;AACA,YAAM,QAAQ,OAAO,CAAC;AACtB,UAAI,OAAO,MAAM,eAAe,UAAU;AACxC,aAAK,YAAY,MAAM;AAAA,MACzB;AACA,UAAI,OAAO,MAAM,gBAAgB,UAAU;AACzC,aAAK,cAAc,MAAM;AAAA,MAC3B;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;;;ACxFO,IAAM,UAAU;","names":[]}
1
+ {"version":3,"sources":["../src/internal/response-like.ts","../src/version.ts"],"sourcesContent":["/**\n * Shared transport-error helpers for the widgets (chat + verification).\n *\n * Extracted verbatim from chat.tsx so both components read thrown SDK errors\n * the same way. Pure and dependency-free: no React, no DOM.\n */\n\n/**\n * The response-like object carried by a thrown transport error. We pull it off\n * by shape rather than `instanceof ResponseError` — robust against duplicated\n * `@gemina/sdk` copies in a bundle (class identity is not shared across\n * copies). On the fetch transport this is the raw `Response`, so `status`,\n * `headers`, and the JSON body are all reachable from here.\n */\nexport interface ResponseLike {\n status?: number;\n headers?: { get?: (name: string) => string | null };\n json?: () => Promise<unknown>;\n clone?: () => ResponseLike;\n}\n\nexport function getResponseLike(error: unknown): ResponseLike | undefined {\n if (error !== null && typeof error === 'object' && 'response' in error) {\n const response = (error as { response?: unknown }).response;\n if (response !== null && typeof response === 'object') {\n return response as ResponseLike;\n }\n }\n return undefined;\n}\n\n/** Extract an HTTP status from a thrown value, or `undefined`. */\nexport function httpStatus(error: unknown): number | undefined {\n const status = getResponseLike(error)?.status;\n return typeof status === 'number' ? status : undefined;\n}\n\n/** What the standard backend error envelope reliably carries. */\nexport interface ErrorEnvelope {\n status: number | undefined;\n /** Stable backend `errors[0].error_code`. */\n errorCode: string | undefined;\n /** Human-readable server fallback (`errors[0].description`). */\n description: string | undefined;\n}\n\n/**\n * Read what the backend actually sent on an error. Only the HTTP status and\n * the stable `errors[0].error_code` / `description` are reliable across\n * environments — production strips `errors[0].detail`, so we never touch it.\n * The fetch body can be read once, so we clone defensively; if that fails\n * (non-JSON, empty, or already consumed) the status still stands.\n */\nexport async function readErrorEnvelope(error: unknown): Promise<ErrorEnvelope> {\n const response = getResponseLike(error);\n const info: ErrorEnvelope = {\n status: typeof response?.status === 'number' ? response.status : undefined,\n errorCode: undefined,\n description: undefined,\n };\n if (response === undefined) {\n return info;\n }\n\n let body: unknown;\n try {\n const source = typeof response.clone === 'function' ? response.clone() : response;\n body = typeof source.json === 'function' ? await source.json() : undefined;\n } catch {\n body = undefined;\n }\n if (body !== null && typeof body === 'object') {\n const errors = (body as { errors?: unknown }).errors;\n if (\n Array.isArray(errors) &&\n errors.length > 0 &&\n errors[0] !== null &&\n typeof errors[0] === 'object'\n ) {\n const first = errors[0] as { error_code?: unknown; description?: unknown };\n if (typeof first.error_code === 'string') {\n info.errorCode = first.error_code;\n }\n if (typeof first.description === 'string') {\n info.description = first.description;\n }\n }\n }\n return info;\n}\n","/** Package version. Keep in sync with package.json. */\nexport const VERSION = '0.11.0';\n"],"mappings":";AAqBO,SAAS,gBAAgB,OAA0C;AACxE,MAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,cAAc,OAAO;AACtE,UAAM,WAAY,MAAiC;AACnD,QAAI,aAAa,QAAQ,OAAO,aAAa,UAAU;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAGO,SAAS,WAAW,OAAoC;AAC7D,QAAM,SAAS,gBAAgB,KAAK,GAAG;AACvC,SAAO,OAAO,WAAW,WAAW,SAAS;AAC/C;AAkBA,eAAsB,kBAAkB,OAAwC;AAC9E,QAAM,WAAW,gBAAgB,KAAK;AACtC,QAAM,OAAsB;AAAA,IAC1B,QAAQ,OAAO,UAAU,WAAW,WAAW,SAAS,SAAS;AAAA,IACjE,WAAW;AAAA,IACX,aAAa;AAAA,EACf;AACA,MAAI,aAAa,QAAW;AAC1B,WAAO;AAAA,EACT;AAEA,MAAI;AACJ,MAAI;AACF,UAAM,SAAS,OAAO,SAAS,UAAU,aAAa,SAAS,MAAM,IAAI;AACzE,WAAO,OAAO,OAAO,SAAS,aAAa,MAAM,OAAO,KAAK,IAAI;AAAA,EACnE,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI,SAAS,QAAQ,OAAO,SAAS,UAAU;AAC7C,UAAM,SAAU,KAA8B;AAC9C,QACE,MAAM,QAAQ,MAAM,KACpB,OAAO,SAAS,KAChB,OAAO,CAAC,MAAM,QACd,OAAO,OAAO,CAAC,MAAM,UACrB;AACA,YAAM,QAAQ,OAAO,CAAC;AACtB,UAAI,OAAO,MAAM,eAAe,UAAU;AACxC,aAAK,YAAY,MAAM;AAAA,MACzB;AACA,UAAI,OAAO,MAAM,gBAAgB,UAAU;AACzC,aAAK,cAAc,MAAM;AAAA,MAC3B;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;;;ACxFO,IAAM,UAAU;","names":[]}
package/dist/index.cjs CHANGED
@@ -221,7 +221,7 @@ async function readErrorEnvelope(error) {
221
221
  }
222
222
 
223
223
  // src/version.ts
224
- var VERSION = "0.9.0";
224
+ var VERSION = "0.11.0";
225
225
 
226
226
  // src/chat.tsx
227
227
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -1156,6 +1156,7 @@ function escapeSegment(segment) {
1156
1156
  var ROW_META_KEY = "_rowMeta";
1157
1157
  function classifyData(data) {
1158
1158
  const result = {
1159
+ overallConfidence: null,
1159
1160
  headers: [],
1160
1161
  simpleLists: [],
1161
1162
  entities: [],
@@ -1166,6 +1167,7 @@ function classifyData(data) {
1166
1167
  return result;
1167
1168
  }
1168
1169
  let rootData = data;
1170
+ result.overallConfidence = readOverallConfidence(rootData);
1169
1171
  let basePointer = "";
1170
1172
  if ("data" in rootData && typeof rootData.data === "object" && rootData.data !== null && !Array.isArray(rootData.data)) {
1171
1173
  for (const [key, value] of Object.entries(rootData)) {
@@ -1173,6 +1175,7 @@ function classifyData(data) {
1173
1175
  processField(key, value, result, rootData, "");
1174
1176
  }
1175
1177
  rootData = rootData.data;
1178
+ result.overallConfidence ?? (result.overallConfidence = readOverallConfidence(rootData));
1176
1179
  basePointer = "/data";
1177
1180
  }
1178
1181
  for (const [key, value] of Object.entries(rootData)) {
@@ -1180,8 +1183,23 @@ function classifyData(data) {
1180
1183
  }
1181
1184
  return result;
1182
1185
  }
1186
+ function readOverallConfidence(source) {
1187
+ const rawLevel = source.overall_confidence ?? source.overallConfidence;
1188
+ const value = extractValue(rawLevel);
1189
+ if (typeof value !== "string" || value.length === 0) return null;
1190
+ const rawReasons = source.confidence_reasons ?? source.confidenceReasons;
1191
+ const reasons = Array.isArray(rawReasons) ? rawReasons.filter((reason) => typeof reason === "string") : [];
1192
+ return { level: value, reasons };
1193
+ }
1183
1194
  function processField(key, value, result, parentObj, basePointer) {
1184
- if (["confidence", "confidence_reasons", "coordinates", "overall_confidence"].includes(key)) {
1195
+ if ([
1196
+ "confidence",
1197
+ "confidence_reasons",
1198
+ "confidenceReasons",
1199
+ "coordinates",
1200
+ "overall_confidence",
1201
+ "overallConfidence"
1202
+ ].includes(key)) {
1185
1203
  return;
1186
1204
  }
1187
1205
  const pointer = `${basePointer}/${escapeSegment(key)}`;
@@ -1255,11 +1273,6 @@ function processField(key, value, result, parentObj, basePointer) {
1255
1273
  level: parentObj[confidenceKey],
1256
1274
  reasons: parentObj[reasonsKey] || []
1257
1275
  };
1258
- } else if (parentObj["overall_confidence"]) {
1259
- overallConfidence = {
1260
- level: parentObj["overall_confidence"],
1261
- reasons: parentObj["confidence_reasons"] || []
1262
- };
1263
1276
  }
1264
1277
  }
1265
1278
  result.tables.push({
@@ -1588,8 +1601,11 @@ function planTableCells(table, plan, columns, bindingsByRawKey) {
1588
1601
  }
1589
1602
  function displayColumns(table, classifiedColumns) {
1590
1603
  const declared = table.columns.map((column) => column.key).filter((name) => typeof name === "string");
1591
- const seen = new Set(declared);
1592
- return [...declared, ...classifiedColumns.filter((name) => !seen.has(name))];
1604
+ const declaredAliases = new Set(declared.map(snakeToCamel));
1605
+ return [
1606
+ ...declared,
1607
+ ...classifiedColumns.filter((name) => !declaredAliases.has(snakeToCamel(name)))
1608
+ ];
1593
1609
  }
1594
1610
  function matchesTablePointer(serverPointer, classifiedPointer) {
1595
1611
  return serverPointer === classifiedPointer || snakeToCamel(serverPointer) === classifiedPointer;
@@ -2033,6 +2049,7 @@ function VerificationViewer(props) {
2033
2049
  const [magnifierOn, setMagnifierOn] = (0, import_react3.useState)(false);
2034
2050
  const [showMag, setShowMag] = (0, import_react3.useState)(false);
2035
2051
  const [mousePos, setMousePos] = (0, import_react3.useState)({ x: 0, y: 0 });
2052
+ const lastMouseClientRef = (0, import_react3.useRef)(null);
2036
2053
  const [isPanning, setIsPanning] = (0, import_react3.useState)(false);
2037
2054
  const panStart = (0, import_react3.useRef)(null);
2038
2055
  const [flashOpacity, setFlashOpacity] = (0, import_react3.useState)(0);
@@ -2217,15 +2234,38 @@ function VerificationViewer(props) {
2217
2234
  const handleTouchEnd = (0, import_react3.useCallback)((e) => {
2218
2235
  if (e.touches.length === 0) touchState.current = null;
2219
2236
  }, []);
2220
- const handleCanvasMouseMove = (0, import_react3.useCallback)((e) => {
2237
+ const syncMagnifierToClientPoint = (0, import_react3.useCallback)((clientX, clientY, assumeInside = false) => {
2221
2238
  const rect = canvasRef.current?.getBoundingClientRect();
2222
2239
  if (!rect) return;
2223
- setShowMag(true);
2224
- setMousePos({ x: e.clientX - rect.left, y: e.clientY - rect.top });
2240
+ const x = clientX - rect.left;
2241
+ const y = clientY - rect.top;
2242
+ const inside = assumeInside || x >= 0 && y >= 0 && x <= rect.width && y <= rect.height;
2243
+ setShowMag(inside);
2244
+ if (inside) {
2245
+ setMousePos({ x, y });
2246
+ }
2225
2247
  }, []);
2248
+ const handleCanvasMouseMove = (0, import_react3.useCallback)((e) => {
2249
+ lastMouseClientRef.current = { x: e.clientX, y: e.clientY };
2250
+ syncMagnifierToClientPoint(e.clientX, e.clientY, true);
2251
+ }, [syncMagnifierToClientPoint]);
2226
2252
  const handleCanvasMouseLeave = (0, import_react3.useCallback)(() => {
2253
+ lastMouseClientRef.current = null;
2227
2254
  setShowMag(false);
2228
2255
  }, []);
2256
+ (0, import_react3.useEffect)(() => {
2257
+ if (!magnifierOn || !showMag) return;
2258
+ const sync = () => {
2259
+ const point = lastMouseClientRef.current;
2260
+ if (point) syncMagnifierToClientPoint(point.x, point.y);
2261
+ };
2262
+ document.addEventListener("scroll", sync, true);
2263
+ window.addEventListener("resize", sync);
2264
+ return () => {
2265
+ document.removeEventListener("scroll", sync, true);
2266
+ window.removeEventListener("resize", sync);
2267
+ };
2268
+ }, [magnifierOn, showMag, syncMagnifierToClientPoint]);
2229
2269
  const handleDoubleClick = (0, import_react3.useCallback)(
2230
2270
  (e) => {
2231
2271
  cancelFlashTravel();
@@ -2772,7 +2812,10 @@ function TableRowView(props) {
2772
2812
  [rects, onFlash]
2773
2813
  );
2774
2814
  const cellFor = (column) => {
2775
- const classified = row?.[column];
2815
+ const direct = row?.[column];
2816
+ const alias = direct === void 0 ? row?.[snakeToCamel(column)] : void 0;
2817
+ const fallbackKey = direct === void 0 && alias === void 0 && row !== void 0 ? Object.keys(row).find((key) => snakeToCamel(key) === snakeToCamel(column)) : void 0;
2818
+ const classified = direct ?? alias ?? (fallbackKey === void 0 ? void 0 : row?.[fallbackKey]);
2776
2819
  const fromPlan = planned?.cells.find((cell) => cell.column === column);
2777
2820
  if (fromPlan) {
2778
2821
  return { classified, binding: fromPlan.binding, editKey: fromPlan.editKey };
@@ -2929,7 +2972,10 @@ function TableSection(props) {
2929
2972
  needsReview > 0 ? ` \xB7 ${needsReview} need review` : "",
2930
2973
  ")"
2931
2974
  ] }),
2932
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ConfidenceDot, { confidence: table.overallConfidence })
2975
+ table.overallConfidence ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "gemina-verification__overall-confidence", children: [
2976
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Overall confidence" }),
2977
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ConfidenceDot, { confidence: table.overallConfidence })
2978
+ ] }) : null
2933
2979
  ] }),
2934
2980
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "gemina-verification__table-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("table", { className: "gemina-verification__table", children: [
2935
2981
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("tr", { children: [
@@ -3063,6 +3109,10 @@ function VerificationForm(props) {
3063
3109
  "aria-label": "Extraction fields",
3064
3110
  onSubmit: (event) => event.preventDefault(),
3065
3111
  children: [
3112
+ classified.overallConfidence ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "gemina-verification__confidence-summary", children: [
3113
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Overall confidence" }),
3114
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ConfidenceDot, { confidence: classified.overallConfidence })
3115
+ ] }) : null,
3066
3116
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3067
3117
  HeaderSection,
3068
3118
  {
@@ -3136,6 +3186,27 @@ var VERIFICATION_CSS = `
3136
3186
  .gemina-verification--auto { ${DARK_VARS2} }
3137
3187
  }
3138
3188
  .gemina-verification--rtl { direction: rtl; }
3189
+ /* Content is not chrome: the document pane never mirrors (industry rule \u2014
3190
+ images/players/clocks keep their physical position under RTL), and dir="auto"
3191
+ flips per DOCUMENT, so mirroring would make the image jump side per row.
3192
+ Forcing the grid container LTR pins physical order (image inline-left, form
3193
+ right, every language); the form pane alone restores RTL so Hebrew labels
3194
+ and values keep their natural direction (per-input dir="auto" still handles
3195
+ mixed-language values). The viewer subtree deliberately stays LTR: it is
3196
+ pure geometry (scroll math, loupe projection, absolute positioning) and none
3197
+ of that math may be direction-dependent.
3198
+
3199
+ That last point is not theoretical \u2014 it IS the magnifier bug. The loupe's
3200
+ magnified inner layer is absolutely positioned with no inset (viewer.tsx
3201
+ gives it only a transform), so its static position is wherever the inherited
3202
+ direction puts the inline start. Under RTL that flips to the right edge and
3203
+ the layer lands (layerWidth - loupeWidth) away \u2014 measured as a constant
3204
+ -704px skew in BOTH chromium and firefox, at every pointer position, leaving
3205
+ the user an empty circle rather than a shifted one. Pinning this subtree LTR
3206
+ restores the skew to (0, 0), matching the LTR baseline exactly. Do not
3207
+ "simplify" this by mirroring the panes again. */
3208
+ .gemina-verification--rtl .gemina-verification__panes { direction: ltr; }
3209
+ .gemina-verification--rtl .gemina-verification__form { direction: rtl; }
3139
3210
 
3140
3211
  /* --- Two-pane layout ------------------------------------------------------ */
3141
3212
  .gemina-verification__panes {
@@ -3181,9 +3252,15 @@ var VERIFICATION_CSS = `
3181
3252
  background: var(--gemina-verification-bg);
3182
3253
  border: 1px solid var(--gemina-verification-border);
3183
3254
  border-radius: var(--gemina-verification-radius);
3184
- overflow: hidden;
3255
+ /* overflow hidden creates a scroll container and prevents the toolbar's sticky
3256
+ positioning from following the host modal's scrollport. Clip keeps the
3257
+ rounded frame without stealing sticky containment. */
3258
+ overflow: clip;
3185
3259
  }
3186
3260
  .gemina-verification__toolbar {
3261
+ position: sticky;
3262
+ top: 0;
3263
+ z-index: 5;
3187
3264
  display: flex;
3188
3265
  /* Narrow roots (~<330px) can't fit all 7 buttons on one line: wrap to a
3189
3266
  second row instead of clipping past the canvas edge. The gap shorthand
@@ -3193,6 +3270,7 @@ var VERIFICATION_CSS = `
3193
3270
  gap: 6px;
3194
3271
  flex: 0 0 auto;
3195
3272
  padding: 8px 10px;
3273
+ background: var(--gemina-verification-bg);
3196
3274
  border-block-end: 1px solid var(--gemina-verification-border);
3197
3275
  }
3198
3276
  .gemina-verification__toolbar-btn {
@@ -3302,6 +3380,28 @@ var VERIFICATION_CSS = `
3302
3380
  gap: 12px;
3303
3381
  min-width: 0;
3304
3382
  margin: 0;
3383
+ /* Every z-index inside the form is form-internal business, and nothing in
3384
+ here may ever paint over the document. Without a stacking context of its
3385
+ own, the form's descendants resolve against the SAME context as the
3386
+ stacked-mode viewer (position: sticky, z-index: 2) \u2014 so the sticky header
3387
+ row (z-index: 3) painted straight over the document image as the form
3388
+ scrolled under the floating viewer. Confirmed in chromium and firefox
3389
+ before this line existed. Isolating caps the whole subtree beneath the
3390
+ viewer no matter what numbers it uses later. */
3391
+ isolation: isolate;
3392
+ }
3393
+ .gemina-verification__confidence-summary {
3394
+ display: flex;
3395
+ align-items: center;
3396
+ justify-content: space-between;
3397
+ gap: 12px;
3398
+ padding: 9px 12px;
3399
+ background: var(--gemina-verification-surface);
3400
+ border: 1px solid var(--gemina-verification-border);
3401
+ border-radius: var(--gemina-verification-radius);
3402
+ color: var(--gemina-verification-muted);
3403
+ font-size: 12px;
3404
+ font-weight: 600;
3305
3405
  }
3306
3406
  .gemina-verification__section {
3307
3407
  background: var(--gemina-verification-bg);
@@ -3319,6 +3419,16 @@ var VERIFICATION_CSS = `
3319
3419
  font-size: 13px;
3320
3420
  font-weight: 600;
3321
3421
  }
3422
+ .gemina-verification__overall-confidence {
3423
+ display: inline-flex;
3424
+ align-items: center;
3425
+ gap: 6px;
3426
+ margin-inline-start: auto;
3427
+ color: var(--gemina-verification-muted);
3428
+ font-size: 11px;
3429
+ font-weight: 500;
3430
+ white-space: nowrap;
3431
+ }
3322
3432
  .gemina-verification__dl {
3323
3433
  display: grid;
3324
3434
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
@@ -3361,6 +3471,15 @@ var VERIFICATION_CSS = `
3361
3471
  border-radius: calc(var(--gemina-verification-radius) - 4px);
3362
3472
  padding: 5px 8px;
3363
3473
  }
3474
+ /* FieldInput is a fragment. Let its control take the remaining row width
3475
+ instead of forcing width:100%, so a coordinate eye can sit beside it rather
3476
+ than wrapping onto a visually disconnected second line. */
3477
+ .gemina-verification__dd > .gemina-verification__input,
3478
+ .gemina-verification__cell > .gemina-verification__input {
3479
+ flex: 1 1 8ch;
3480
+ width: auto;
3481
+ min-width: 0;
3482
+ }
3364
3483
  .gemina-verification__input--dirty { border-color: var(--gemina-verification-dirty); }
3365
3484
  .gemina-verification__input--missed {
3366
3485
  border-color: var(--gemina-verification-error);
@@ -3432,14 +3551,32 @@ var VERIFICATION_CSS = `
3432
3551
  padding: 0;
3433
3552
  list-style: none;
3434
3553
  }
3435
- .gemina-verification__table-wrap { overflow-x: auto; }
3554
+ .gemina-verification__table-wrap {
3555
+ overflow-x: auto;
3556
+ /* Sticky binds to the nearest scrollport, and in an embedded widget that
3557
+ must be THIS wrapper (no per-host offset math). Bounding the block size
3558
+ turns it into a vertical scrollport too: long tables scroll internally
3559
+ with the header row pinned; short tables never reach the cap and are
3560
+ unchanged. */
3561
+ overflow-y: auto;
3562
+ max-block-size: min(56vh, 520px);
3563
+ }
3436
3564
  .gemina-verification__table {
3437
3565
  width: 100%;
3438
- border-collapse: collapse;
3566
+ /* separate, not collapse: collapsed borders belong to the row grid, so a
3567
+ stuck header sheds its underline mid-scroll. With separate borders the
3568
+ border-block-end travels with the th. */
3569
+ border-collapse: separate;
3570
+ border-spacing: 0;
3439
3571
  font-size: 13px;
3440
3572
  font-variant-numeric: tabular-nums;
3441
3573
  }
3442
3574
  .gemina-verification__table th {
3575
+ position: sticky;
3576
+ inset-block-start: 0;
3577
+ /* Above cell content and focus rings; below the viewer toolbar (5) and the
3578
+ confirm scrim. */
3579
+ z-index: 3;
3443
3580
  text-align: start;
3444
3581
  padding: 6px 10px;
3445
3582
  font-size: 12px;
@@ -3731,7 +3868,7 @@ var VERIFICATION_CSS = `
3731
3868
  }
3732
3869
  .gemina-verification__table-footer {
3733
3870
  display: flex;
3734
- padding: 8px 10px 0;
3871
+ padding: 8px 10px;
3735
3872
  }
3736
3873
  .gemina-verification__add-row {
3737
3874
  font: inherit;