@gemina/elements 0.10.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.10.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-TSOUHYYB.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.10.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.10.0";
224
+ var VERSION = "0.11.0";
225
225
 
226
226
  // src/chat.tsx
227
227
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -3186,6 +3186,27 @@ var VERIFICATION_CSS = `
3186
3186
  .gemina-verification--auto { ${DARK_VARS2} }
3187
3187
  }
3188
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; }
3189
3210
 
3190
3211
  /* --- Two-pane layout ------------------------------------------------------ */
3191
3212
  .gemina-verification__panes {
@@ -3359,6 +3380,15 @@ var VERIFICATION_CSS = `
3359
3380
  gap: 12px;
3360
3381
  min-width: 0;
3361
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;
3362
3392
  }
3363
3393
  .gemina-verification__confidence-summary {
3364
3394
  display: flex;
@@ -3521,14 +3551,32 @@ var VERIFICATION_CSS = `
3521
3551
  padding: 0;
3522
3552
  list-style: none;
3523
3553
  }
3524
- .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
+ }
3525
3564
  .gemina-verification__table {
3526
3565
  width: 100%;
3527
- 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;
3528
3571
  font-size: 13px;
3529
3572
  font-variant-numeric: tabular-nums;
3530
3573
  }
3531
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;
3532
3580
  text-align: start;
3533
3581
  padding: 6px 10px;
3534
3582
  font-size: 12px;