@thehammer/template-verification 0.2.13 → 0.2.15

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.
@@ -24,46 +24,66 @@ 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.
67
87
  */
68
88
  type __VLS_Props = {
69
89
  source?: MetaCarrier;
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";