@hansenexus/hud 0.3.0 → 0.4.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 +186 -4
- package/dist/access-CNvJOwKM.d.ts +54 -0
- package/dist/capabilities-CjulXFQX.js +189 -0
- package/dist/{define-hud-BHQR8Lbv.d.ts → define-hud-BBzsSl8b.d.ts} +6 -1
- package/dist/env-DfxpPfs9.js +28 -0
- package/dist/env-vEjyJfPW.d.ts +17 -0
- package/dist/force-state-BaqWsmrf.js +153 -0
- package/dist/force-state-CCqoTfVB.d.ts +23 -0
- package/dist/handler-WmE4Lu7l.d.ts +39 -0
- package/dist/index-BYsdS-7d.d.ts +55 -0
- package/dist/index.d.ts +6 -36
- package/dist/index.js +119 -202
- package/dist/marker-C66LxOhJ.d.ts +9 -0
- package/dist/marker-CMrvxPmS.d.ts +12 -0
- package/dist/marker-DjeGvL-F.js +9 -0
- package/dist/marker-uZYPOJ4M.js +12 -0
- package/dist/markers.d.ts +3 -0
- package/dist/markers.js +3 -0
- package/dist/next.d.ts +3 -18
- package/dist/next.js +3 -28
- package/dist/payload-CLKDVZWl.d.ts +68 -0
- package/dist/plugins/access/server.d.ts +122 -0
- package/dist/plugins/access/server.js +339 -0
- package/dist/plugins/access.d.ts +41 -0
- package/dist/plugins/access.js +250 -0
- package/dist/plugins/agent/server.d.ts +129 -0
- package/dist/plugins/agent/server.js +429 -0
- package/dist/plugins/agent.d.ts +37 -0
- package/dist/plugins/agent.js +411 -0
- package/dist/plugins/design.d.ts +125 -0
- package/dist/plugins/design.js +619 -0
- package/dist/plugins/observe.d.ts +64 -0
- package/dist/plugins/observe.js +617 -0
- package/dist/plugins/ops/server.d.ts +82 -0
- package/dist/plugins/ops/server.js +380 -0
- package/dist/plugins/ops.d.ts +26 -0
- package/dist/plugins/ops.js +362 -0
- package/dist/plugins/vitals.js +3 -86
- package/dist/{plugins-1QmTmZyL.d.ts → plugins-CQ_0w1ot.d.ts} +39 -1
- package/dist/{plugins-CzUiTn_r.js → plugins-DVy_vaYr.js} +3 -1
- package/dist/review.d.ts +181 -0
- package/dist/review.js +1017 -0
- package/dist/selector-NSYSe7AZ.js +28 -0
- package/dist/server.d.ts +3 -39
- package/dist/server.js +1 -1
- package/dist/shortcut-U6ftVY06.js +222 -0
- package/dist/state-boundary.d.ts +26 -0
- package/dist/state-boundary.js +61 -0
- package/dist/styles--slk86ZQ.js +332 -0
- package/dist/types-DADBRiGk.d.ts +50 -0
- package/dist/types-QJUajwWq.js +35 -0
- package/dist/types-f3jlNxzw.d.ts +92 -0
- package/dist/vitals-panel-Dvc5dnR-.js +87 -0
- package/package.json +23 -3
package/dist/review.d.ts
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { t as HUD_REVIEW_MARKER } from "./marker-C66LxOhJ.js";
|
|
2
|
+
//#region src/review/anchor/types.d.ts
|
|
3
|
+
/** Which breakpoint band a pin was planted in. Cut on Tailwind's `md` and `xl`. */
|
|
4
|
+
type ViewportBucket = "mobile" | "tablet" | "desktop";
|
|
5
|
+
/** Box in viewport percentages. Kept only to draw the highlight on a stored screenshot. */
|
|
6
|
+
interface PinRect {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Everything stored when a pin is planted.
|
|
14
|
+
*
|
|
15
|
+
* The grabber's `buildGrabAnchor` stores a viewport-relative rect, which is correct for
|
|
16
|
+
* a grab that is dispatched in the same second and wrong for anything that
|
|
17
|
+
* persists: reload at a different scroll offset and the box has moved. A pin is
|
|
18
|
+
* therefore located by `selector` + `docX`/`docY` (fractions of the *document*,
|
|
19
|
+
* not the viewport), with the viewport rect kept only for the screenshot overlay.
|
|
20
|
+
*/
|
|
21
|
+
interface PinAnchor {
|
|
22
|
+
/** Lowercase tag name. Guards strategy 1 against matching a different node of the same shape. */
|
|
23
|
+
tag: string;
|
|
24
|
+
/** `nth-of-type` path from `document.body`. */
|
|
25
|
+
selector: string;
|
|
26
|
+
/** Unique, non-generated `#id` / `[data-testid=…]` selector, on the element or an ancestor. */
|
|
27
|
+
stableId?: string;
|
|
28
|
+
/** Path from the stable node down to the element. This is what makes strategy 2 more than a fallback. */
|
|
29
|
+
selectorFromStable?: string;
|
|
30
|
+
/** Human label, e.g. `button “Termin buchen”`. */
|
|
31
|
+
label: string;
|
|
32
|
+
/** Normalised leading text, for strategy 3. Absent when the element holds too much text to identify. */
|
|
33
|
+
textPrefix?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Stable-ish identity for elements that carry no text — an icon button, an
|
|
36
|
+
* image, an input. Without it a text-less element can only ever be
|
|
37
|
+
* corroborated by its tag, which is far too weak.
|
|
38
|
+
*/
|
|
39
|
+
signature?: string;
|
|
40
|
+
/** Where inside the element the reviewer clicked, 0..1. */
|
|
41
|
+
offsetX: number;
|
|
42
|
+
offsetY: number;
|
|
43
|
+
/** Position as a fraction of the full scrollable document — scroll-independent. */
|
|
44
|
+
docX: number;
|
|
45
|
+
docY: number;
|
|
46
|
+
rect: PinRect;
|
|
47
|
+
viewportWidth: number;
|
|
48
|
+
viewportHeight: number;
|
|
49
|
+
scrollY: number;
|
|
50
|
+
viewportBucket: ViewportBucket;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* How a pin was located on this render.
|
|
54
|
+
*
|
|
55
|
+
* There is deliberately no "container" outcome. Falling back to a surviving
|
|
56
|
+
* ancestor was tried and removed: text matching already recovers the reshuffle
|
|
57
|
+
* case it was meant for, and in the only case left — the element is genuinely
|
|
58
|
+
* gone — putting the pin on its parent asserts that the comment still applies
|
|
59
|
+
* to something on screen. It does not. That pin belongs in "Ohne Position".
|
|
60
|
+
*/
|
|
61
|
+
type AnchorStrategy = "exact" | "stable" | "identity";
|
|
62
|
+
interface AnchorResolution {
|
|
63
|
+
element: Element;
|
|
64
|
+
strategy: AnchorStrategy;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/review/anchor/capture.d.ts
|
|
68
|
+
interface CapturePoint {
|
|
69
|
+
clientX: number;
|
|
70
|
+
clientY: number;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Snapshot everything needed to find this element again on a later render, at a
|
|
74
|
+
* possibly different scroll offset, viewport and content revision.
|
|
75
|
+
*/
|
|
76
|
+
export declare function capturePinAnchor(el: Element, point?: CapturePoint): PinAnchor;
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/review/anchor/resolve.d.ts
|
|
79
|
+
/**
|
|
80
|
+
* Locate a stored anchor on the current document.
|
|
81
|
+
*
|
|
82
|
+
* Returns null rather than guessing. A null resolution is a first-class
|
|
83
|
+
* outcome, not an error: the pin is shown in the "Ohne Position" list with its
|
|
84
|
+
* screenshot, where it stays actionable — and a pin that stops resolving is
|
|
85
|
+
* itself a signal that the thing it complained about is gone.
|
|
86
|
+
*/
|
|
87
|
+
export declare function resolveAnchor(anchor: PinAnchor, doc?: Document): AnchorResolution | null;
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/review/anchor/viewport.d.ts
|
|
90
|
+
export declare function viewportBucket(width: number): ViewportBucket;
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/review/backend.d.ts
|
|
93
|
+
interface ReviewSession {
|
|
94
|
+
sessionToken: string;
|
|
95
|
+
projectSlug: string;
|
|
96
|
+
displayName: string;
|
|
97
|
+
}
|
|
98
|
+
interface Reviewer {
|
|
99
|
+
displayName: string;
|
|
100
|
+
role: string;
|
|
101
|
+
}
|
|
102
|
+
interface ReviewPin {
|
|
103
|
+
_id: string;
|
|
104
|
+
number: number;
|
|
105
|
+
body: string;
|
|
106
|
+
authorName: string;
|
|
107
|
+
lane: "client" | "internal";
|
|
108
|
+
status: string;
|
|
109
|
+
anchor: PinAnchor;
|
|
110
|
+
viewportBucket: ViewportBucket;
|
|
111
|
+
}
|
|
112
|
+
interface PlantPin {
|
|
113
|
+
sessionToken: string;
|
|
114
|
+
route: string;
|
|
115
|
+
rawPath: string;
|
|
116
|
+
locale: string;
|
|
117
|
+
body: string;
|
|
118
|
+
anchor: PinAnchor;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* What the widget needs from the review deployment. `convexReview()` is the
|
|
122
|
+
* one implementation; the seam exists so tests and the playground can run the
|
|
123
|
+
* widget without a Convex backend.
|
|
124
|
+
*
|
|
125
|
+
* `watch*` deliver the current value and every later change until the
|
|
126
|
+
* returned function is called. `null` from `watchReviewer` means the token is
|
|
127
|
+
* not (or no longer) valid.
|
|
128
|
+
*/
|
|
129
|
+
interface ReviewBackend {
|
|
130
|
+
redeemGrant: (grant: string) => Promise<ReviewSession>;
|
|
131
|
+
watchReviewer: (sessionToken: string, onChange: (reviewer: Reviewer | null) => void) => () => void;
|
|
132
|
+
watchPins: (sessionToken: string, route: string, onChange: (pins: ReviewPin[]) => void) => () => void;
|
|
133
|
+
plant: (pin: PlantPin) => Promise<unknown>;
|
|
134
|
+
/** Releases the connection when the widget unmounts. */
|
|
135
|
+
close?: () => void;
|
|
136
|
+
}
|
|
137
|
+
/** The review app's Convex deployment at `url`. */
|
|
138
|
+
export declare function convexReview(url: string): ReviewBackend;
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/review/review.d.ts
|
|
141
|
+
interface ReviewProps {
|
|
142
|
+
/**
|
|
143
|
+
* Convex deployment of the review app. Empty or absent renders nothing, so
|
|
144
|
+
* the mounting app can switch the widget off per deployment at runtime.
|
|
145
|
+
*/
|
|
146
|
+
convexUrl?: string | undefined;
|
|
147
|
+
/** Project slug this surface belongs to. */
|
|
148
|
+
projectSlug: string;
|
|
149
|
+
/** Active locale, used to derive the locale-stripped route key. */
|
|
150
|
+
locale: string;
|
|
151
|
+
/** Replaces the Convex backend, for tests and the playground. Keep it stable. */
|
|
152
|
+
backend?: ReviewBackend | undefined;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The production-safe review widget: a pill, the element picker and a docked
|
|
156
|
+
* review sheet with the page's pins.
|
|
157
|
+
*
|
|
158
|
+
* Everything arrives as a prop and nothing is read from `process.env`. That is
|
|
159
|
+
* what makes the runtime gate work: an app that ships one image to two
|
|
160
|
+
* productions has identical build-time flags on both, so a build flag could not
|
|
161
|
+
* switch the widget off where it must be off. The mounting app decides, per
|
|
162
|
+
* deployment, by passing `convexUrl` or not.
|
|
163
|
+
*
|
|
164
|
+
* Nothing renders, and no DOM is touched, until a reviewer session exists:
|
|
165
|
+
* a visitor without a review link never sees a pill.
|
|
166
|
+
*/
|
|
167
|
+
export declare function Review({ convexUrl, projectSlug, locale, backend }: ReviewProps): import("react").JSX.Element | null;
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/review/route.d.ts
|
|
170
|
+
/**
|
|
171
|
+
* The route a pin belongs to.
|
|
172
|
+
*
|
|
173
|
+
* Locale-stripped on purpose: with `localePrefix: "as-needed"` the German page
|
|
174
|
+
* is `/standorte/wedel` and the English one `/en/standorte/wedel`. Storing the
|
|
175
|
+
* raw path would make those two different routes, so a pin left by a German
|
|
176
|
+
* reviewer would be invisible to anyone reading the English page — and the same
|
|
177
|
+
* layout bug would be reported once per language.
|
|
178
|
+
*/
|
|
179
|
+
export declare function routeKey(pathname: string, locale: string): string;
|
|
180
|
+
//#endregion
|
|
181
|
+
export { type AnchorStrategy, HUD_REVIEW_MARKER, type PinAnchor, type PlantPin, type ReviewBackend, type ReviewPin, type ReviewProps, type ReviewSession, type Reviewer, type ViewportBucket };
|