@thehammer/template-verification 0.2.14 → 0.2.16

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 CHANGED
@@ -30,10 +30,17 @@ itself is two products fighting over one viewport — in a frame that cannot rea
30
30
  any of the viewers the embedding app already has. Reviewing a value now happens
31
31
  in that app, which opens the citation and the record beside the letter.
32
32
 
33
- `initVerification` still **accepts** `saveOverride` and `detailUrl` and ignores
34
- both. That is compile-time compatibility for already-built templates, whose
35
- `App.vue` is generated from a snippet that still passes them; it is not a
36
- feature. See `src/context.ts`.
33
+ `initVerification` still **accepts** `saveOverride` and ignores it. That is
34
+ compile-time compatibility for already-built templates, whose `App.vue` is
35
+ generated from a snippet that still passes it; it is not a feature. See
36
+ `src/context.ts`.
37
+
38
+ `detailUrl` was the same story until SG-689, when gpt-manager's wiring snippet
39
+ and its server-side sidecar both stopped emitting it — it is no longer part of
40
+ `InitVerificationConfig` at all. An already-built template's source that still
41
+ names it keeps building (the template build does not type-check) and keeps
42
+ harmlessly passing an unread property, same as before it had a name in this
43
+ interface.
37
44
 
38
45
  ## Install
39
46
 
@@ -24,46 +24,86 @@ import type { MetaCarrier } from "../types";
24
24
  * hover panel, so the same sentence reaches a screen reader and a mouse
25
25
  * hovering the glyph, and neither costs a second piece of chrome in the page.
26
26
  *
27
- * ==== NOTHING MOVES, AND NOTHING IS COVERED ====
27
+ * ==== PLACEMENT: MOSTLY OUTSIDE THE VALUE, NEVER IN ITS OWN RESERVED SPACE ====
28
28
  *
29
- * Two requirements, and the shape below is the one that satisfies BOTH.
29
+ * Operator decision (SG-432 comment #4534/#4536, SG-638), verbatim: "Absolute
30
+ * positioned OUTSIDE of the data point, should overlay partially like 50%
31
+ * outside and 50% above so it covers a very small portion of the text. Hover
32
+ * over the text should fade to 30% the overlay checkmark, but still clickable
33
+ * for the action."
30
34
  *
31
- * 1. NO REFLOW. Turning the overlay on or off, or a field going from
32
- * "unverified" to "verified", must not move a single character of the
33
- * letter. The document is the deliverable, and a reviewer toggling the
34
- * overlay must be looking at the same pagination they will print.
35
- * 2. NO OCCLUSION. The value must stay fully readable. A mark that hides the
36
- * claimant's surname or the year of the accident makes the letter unusable,
37
- * which is worse than any layout wobble.
35
+ * That is exactly what renders below, and nothing reserves space for it:
38
36
  *
39
- * The mark therefore lives in a PERMANENTLY RESERVED SLOT: `.tv-mark-slot` is
40
- * an empty fixed-width inline-block rendered beside every value ALWAYS —
41
- * overlay on, overlay off, tracked or untracked, on screen and on paper. It is
42
- * the slot, not the mark, that occupies the inline space, so the space never
43
- * appears or disappears and nothing ever reflows. The mark is absolutely
44
- * positioned INSIDE that slot, so its own width — a bare confidence dot, a
45
- * verified chip, either of them wearing a discrepancy flag — can never push a
46
- * character either.
37
+ * 1. NO REFLOW. The mark is always `position: absolute`, taken out of normal
38
+ * flow. Turning the overlay on or off, or a field going from "unverified"
39
+ * to "verified", moves no character — there is no slot to appear, grow, or
40
+ * disappear, on screen or in print.
41
+ * 2. MOSTLY OUTSIDE THE VALUE. The mark is centred on a point at the TOP-RIGHT
42
+ * corner of the value's own trailing edge — half its width sits to the
43
+ * right of that corner (outside the text entirely) and half sits to the
44
+ * left (over the last character); half its height sits above that corner
45
+ * (outside, above the line) and half sits below (over the top of the last
46
+ * character). Only that one small corner is ever covered, never the whole
47
+ * glyph the old zero-space `right: 0` shape used to hide (`Abdinasir Abdi`
48
+ * rendering as `Abdinasir ✔`).
47
49
  *
48
- * Two earlier shapes, and why each one loses:
50
+ * ==== ANCHORING TO THE TRAILING EDGE OF WRAPPED TEXT ====
49
51
  *
50
- * - `inline-flex` row with a gap (the original): every mark pushed the rest of
51
- * its line along, so the whole letter reflowed the moment the overlay was
52
- * switched on. Fails (1).
53
- * - Absolute at `right: 0` against the wrapper, occupying zero inline space
54
- * (the shape this replaces): it bought (1) by overlaying the last characters
55
- * of the value — `Abdinasir Abdi` rendered as `Abdinasir ✔`, `October 23,
56
- * 2024` as `October 23, 2 ✔`. Fails (2), and fails it on exactly the two
57
- * fields a reader most needs. `left: 100%` is the same trade with the damage
58
- * moved onto whatever the template wrote next, which is no better.
52
+ * A value can wrap across lines, and the mark has to track wherever the LAST
53
+ * line ends — not the value's own bounding box, which spans every line. The
54
+ * fix is a trailing, zero-size `<span class="tv-mark-anchor">`, written as the
55
+ * next inline SIBLING immediately after `.tv-field-value` (both children of
56
+ * `.tv-field`) — not nested inside the value, so the mark's own glyph is never
57
+ * part of the value's own text/accessible content (copy/paste and
58
+ * `.textContent` on the value read exactly the value, nothing appended). As
59
+ * an ordinary inline box with zero width and zero height, the anchor takes up
60
+ * no visual space and is laid out by the browser exactly where an extra
61
+ * character would have gone — because inline layout is one continuous
62
+ * formatting context across element boundaries, a `<span>` boundary does not
63
+ * start a new line, so the anchor lands on whatever line the value's own text
64
+ * wrapped to, exactly as if it were one more character of that text. It is
65
+ * `position: relative`, so it is the positioning containing block for the
66
+ * mark, which is `position: absolute; left: 0; top: 0; transform:
67
+ * translate(-50%, -50%)` inside it — centring the mark's box exactly on the
68
+ * anchor's own (0, 0) point, which is what produces the 50%-outside / 50%-
69
+ * above split described above. This is the correct technique for inline text
70
+ * specifically because an inline box's position is resolved by the same
71
+ * line-breaking algorithm that wraps the text itself; a box anchored to
72
+ * `.tv-field-value`'s own (single) bounding rect cannot express "the end of
73
+ * whichever line is last."
59
74
  *
60
- * What the reserved slot costs, stated plainly: about one-and-a-bit character
61
- * widths of permanent space after every data point, present even in print. That
62
- * is the price of never covering a value, and it is deliberately paid in the
63
- * one place a document can absorb it — inter-word space — rather than on top of
64
- * the words themselves. It is NOT hidden by the `@media print` chrome rule: the
65
- * slot is not chrome, so the printed page is laid out identically to the screen
66
- * and only the glyph goes away.
75
+ * ==== HOVER FADE, STILL CLICKABLE, FULL OPACITY ON FOCUS ====
76
+ *
77
+ * `.tv-field-value:hover ~ .tv-mark-anchor .tv-overlay` fades the mark to 30%
78
+ * opacity while the VALUE is hovered (the general-sibling combinator reaches
79
+ * the anchor from its preceding sibling). `.tv-overlay:hover` covers hovering
80
+ * the MARK directly — together the two satisfy the operator's decision
81
+ * ("hover over the text... the overlay checkmark") without nesting the mark
82
+ * inside the value's own text. Opacity never disables pointer events, so the
83
+ * mark stays a real, clickable `<button>` at 30%. `:focus-visible` raises it
84
+ * back to full opacity with higher selector specificity than either hover
85
+ * rule, so a keyboard user tabbing to the mark while the pointer happens to
86
+ * be resting on the value still sees it clearly.
87
+ *
88
+ * ==== SG-693: THE DEFAULT SLOT RENDERS MARKDOWN, WHICH IS BLOCK-LEVEL ====
89
+ *
90
+ * The inline-anchoring contract above ("ANCHORING TO THE TRAILING EDGE OF
91
+ * WRAPPED TEXT") assumes `.tv-field-value`'s content is plain inline text
92
+ * flowing across possibly-several lines. The markdown fallback (see the
93
+ * template below) renders through danx-ui's `CodeViewer`, which is a `<div>`
94
+ * — block-level, not inline — wrapping a `<p>` (or `<ul>`/`<table>`/etc. for
95
+ * richer markdown). A `<span>` containing an in-flow block box gets split
96
+ * into anonymous block boxes around it per CSS2.1 §9.2.1.1, so the mark
97
+ * anchor no longer lands on "the end of the last wrapped line" the way it
98
+ * does for plain text — it lands after the whole rendered block instead.
99
+ * This is a real, deliberate trade-off, not an oversight: every real
100
+ * self-closing `<VerifiedField>` usage in the two in-scope templates
101
+ * (TPL-1/TPL-2 — see SG-693's investigation) is already the SOLE content of
102
+ * its own `<p class="dl-prose">` wrapper, never inline mid-sentence, so the
103
+ * mark simply sits at the end of that paragraph either way. A future caller
104
+ * that binds `<VerifiedField>` truly inline within running prose (not as a
105
+ * paragraph's only child) would see the mark detach from the trailing text
106
+ * for exactly this reason — worth revisiting if that usage shape appears.
67
107
  */
68
108
  type __VLS_Props = {
69
109
  source?: MetaCarrier;
package/dist/context.d.ts CHANGED
@@ -42,15 +42,6 @@ export interface InitVerificationConfig {
42
42
  * {@link ../lib/hostBridge.DataPointActivatedMessage}.
43
43
  */
44
44
  workflowInputId?: number | string | null;
45
- /**
46
- * ACCEPTED AND IGNORED, for the same reason as `saveOverride` above.
47
- *
48
- * This was the Inspector dialog's lazy per-field detail endpoint. The
49
- * Inspector is gone, and the embedder fetches a data point's citations and
50
- * history against its own authenticated session rather than against a
51
- * token-sealed url handed into an iframe.
52
- */
53
- detailUrl?: string | null;
54
45
  /** Seeds the overlay toggle ONLY when localStorage holds no prior value. */
55
46
  defaultEnabled?: boolean;
56
47
  /**
package/dist/index.d.ts CHANGED
@@ -41,4 +41,4 @@ export type { WalkedDataPoint } from "./lib/walk";
41
41
  export { computeProgress } from "./lib/progress";
42
42
  export type { VerificationProgress } from "./lib/progress";
43
43
  export { CHROME_CLASS, ENABLED_STORAGE_KEY } from "./constants";
44
- export type { VerificationStatus, ResolvedSource, SourceChoice, VerificationSource, ExtractedCandidate, OverrideCandidate, ClaimCandidate, CandidateSet, DataPointAnchor, ResolvedValue, DataPointMeta, MetaCarrier, SaveOverrideArgs, SaveOverrideFn, } from "./types";
44
+ export type { VerificationStatus, ResolvedSource, SourceChoice, VerificationSource, ExtractedCandidate, HumanCitation, OverrideCandidate, ClaimCandidate, CandidateSet, DataPointAnchor, ResolvedValue, DataPointMeta, MetaCarrier, SaveOverrideArgs, SaveOverrideFn, } from "./types";