@reticlehq/browser 2.7.0 → 2.9.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/NOTICE +7 -0
- package/README.md +2 -2
- package/dist/actions/actions-dom.js +23 -15
- package/dist/actions/actions.d.ts +17 -0
- package/dist/actions/actions.js +132 -29
- package/dist/actions/synthetic-input.d.ts +9 -0
- package/dist/actions/synthetic-input.js +40 -0
- package/dist/commands/commands.js +18 -1
- package/dist/connect-options.d.ts +9 -9
- package/dist/dom/a11y.d.ts +9 -0
- package/dist/dom/a11y.js +19 -0
- package/dist/dom/desktop-capture.js +20 -3
- package/dist/dom/dom-ignore.d.ts +19 -6
- package/dist/dom/dom-ignore.js +20 -13
- package/dist/dom/query.d.ts +2 -2
- package/dist/dom/query.js +85 -45
- package/dist/dom/refs.d.ts +28 -0
- package/dist/dom/refs.js +87 -0
- package/dist/dom/snapshot.d.ts +5 -0
- package/dist/dom/snapshot.js +34 -0
- package/dist/dom/source.d.ts +14 -0
- package/dist/dom/source.js +16 -0
- package/dist/dom/theme.d.ts +33 -10
- package/dist/dom/theme.js +109 -50
- package/dist/observers/console.js +5 -2
- package/dist/observers/install-all.js +4 -1
- package/dist/observers/ipc.d.ts +16 -0
- package/dist/observers/ipc.js +19 -1
- package/dist/observers/network.d.ts +8 -0
- package/dist/observers/network.js +29 -6
- package/dist/observers/state.js +21 -2
- package/dist/presenter/presenter-brand.d.ts +24 -7
- package/dist/presenter/presenter-brand.js +23 -6
- package/dist/presenter/presenter-config.d.ts +102 -9
- package/dist/presenter/presenter-config.js +94 -8
- package/dist/presenter/presenter-controls.d.ts +10 -10
- package/dist/presenter/presenter-controls.js +175 -85
- package/dist/presenter/presenter-dock-layout.d.ts +6 -0
- package/dist/presenter/presenter-dock-layout.js +170 -0
- package/dist/presenter/presenter-drag.d.ts +48 -0
- package/dist/presenter/presenter-drag.js +198 -0
- package/dist/presenter/presenter-effects.d.ts +1 -1
- package/dist/presenter/presenter-effects.js +1 -1
- package/dist/presenter/presenter-glow.d.ts +5 -5
- package/dist/presenter/presenter-glow.js +7 -7
- package/dist/presenter/presenter-heroicons-data.d.ts +41 -0
- package/dist/presenter/presenter-heroicons-data.js +38 -0
- package/dist/presenter/presenter-hud-chrome.d.ts +17 -0
- package/dist/presenter/presenter-hud-chrome.js +41 -0
- package/dist/presenter/presenter-icons.d.ts +44 -0
- package/dist/presenter/presenter-icons.js +100 -0
- package/dist/presenter/presenter-log.d.ts +27 -5
- package/dist/presenter/presenter-log.js +114 -28
- package/dist/presenter/presenter-report-copy.d.ts +83 -0
- package/dist/presenter/presenter-report-copy.js +127 -0
- package/dist/presenter/presenter-report-styles.d.ts +7 -0
- package/dist/presenter/presenter-report-styles.js +102 -0
- package/dist/presenter/presenter-report.d.ts +23 -0
- package/dist/presenter/presenter-report.js +217 -0
- package/dist/presenter/presenter-run-state.d.ts +1 -1
- package/dist/presenter/presenter-settings-styles.d.ts +2 -0
- package/dist/presenter/presenter-settings-styles.js +153 -0
- package/dist/presenter/presenter-settings.d.ts +82 -0
- package/dist/presenter/presenter-settings.js +494 -0
- package/dist/presenter/presenter-shell-styles.d.ts +1 -0
- package/dist/presenter/presenter-shell-styles.js +375 -0
- package/dist/presenter/presenter-shell.d.ts +48 -0
- package/dist/presenter/presenter-shell.js +408 -0
- package/dist/presenter/presenter-styles.d.ts +9 -4
- package/dist/presenter/presenter-styles.js +61 -125
- package/dist/presenter/presenter-tally.d.ts +8 -11
- package/dist/presenter/presenter-tally.js +48 -23
- package/dist/presenter/presenter-test-helpers.d.ts +1 -1
- package/dist/presenter/presenter-test-helpers.js +1 -1
- package/dist/presenter/presenter-verbs.js +2 -2
- package/dist/presenter/presenter-workspace.d.ts +15 -0
- package/dist/presenter/presenter-workspace.js +180 -0
- package/dist/presenter/presenter.d.ts +15 -10
- package/dist/presenter/presenter.js +194 -46
- package/dist/registry/emitter.d.ts +2 -2
- package/dist/reticle.d.ts +2 -2
- package/dist/reticle.js +27 -25
- package/dist/review/annotator-styles.d.ts +6 -0
- package/dist/review/annotator-styles.js +81 -0
- package/dist/review/annotator.d.ts +29 -17
- package/dist/review/annotator.js +477 -146
- package/dist/timers/clock.js +8 -5
- package/dist/transport/unreachable-message.d.ts +12 -0
- package/dist/transport/unreachable-message.js +20 -0
- package/dist/util/captured-method.d.ts +37 -0
- package/dist/util/captured-method.js +45 -0
- package/package.json +9 -6
package/dist/timers/clock.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// can deterministically advance time (toasts, debounces, auto-dismiss, commit-on-blur).
|
|
3
3
|
// We do NOT patch requestAnimationFrame/microtasks/MessageChannel — React's scheduler relies
|
|
4
4
|
// on those, and freezing them would stall the page. Opt-in + reversible.
|
|
5
|
+
import { requireCapturedMethod } from '../util/captured-method.js';
|
|
5
6
|
let installed = false;
|
|
6
7
|
let virtualNow = 0;
|
|
7
8
|
let realBase = 0;
|
|
@@ -17,12 +18,14 @@ export function freezeClock() {
|
|
|
17
18
|
installed = true;
|
|
18
19
|
virtualNow = 0;
|
|
19
20
|
realBase = Date.now();
|
|
21
|
+
// Captured as stored VALUES, so teardown restores the same function objects the page had. See
|
|
22
|
+
// capturedMethod: these are deliberate unbound captures and the descriptor read says so.
|
|
20
23
|
originals = {
|
|
21
|
-
setTimeout: window
|
|
22
|
-
clearTimeout: window
|
|
23
|
-
setInterval: window
|
|
24
|
-
clearInterval: window
|
|
25
|
-
dateNow: Date
|
|
24
|
+
setTimeout: requireCapturedMethod(window, 'setTimeout'),
|
|
25
|
+
clearTimeout: requireCapturedMethod(window, 'clearTimeout'),
|
|
26
|
+
setInterval: requireCapturedMethod(window, 'setInterval'),
|
|
27
|
+
clearInterval: requireCapturedMethod(window, 'clearInterval'),
|
|
28
|
+
dateNow: requireCapturedMethod(Date, 'now'),
|
|
26
29
|
};
|
|
27
30
|
const schedule = (cb, delay, interval) => {
|
|
28
31
|
const id = seq;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the page says when its websocket never opened.
|
|
3
|
+
*
|
|
4
|
+
* Pulled out of the connect path so it is a pure string function with a test on its CLAIMS rather
|
|
5
|
+
* than a template inlined in a warn call. The rule it exists to hold: report what this page observed
|
|
6
|
+
* and what it could not determine, never a cause. See unreachable-message.test.ts.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The page tried, failed, and cannot see why. Names the address and the attempt count, refuses to
|
|
10
|
+
* diagnose the daemon, and lists the checks in the order that actually resolves the ambiguity.
|
|
11
|
+
*/
|
|
12
|
+
export declare function unreachableMessage(url: string, attempts: number): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the page says when its websocket never opened.
|
|
3
|
+
*
|
|
4
|
+
* Pulled out of the connect path so it is a pure string function with a test on its CLAIMS rather
|
|
5
|
+
* than a template inlined in a warn call. The rule it exists to hold: report what this page observed
|
|
6
|
+
* and what it could not determine, never a cause. See unreachable-message.test.ts.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The page tried, failed, and cannot see why. Names the address and the attempt count, refuses to
|
|
10
|
+
* diagnose the daemon, and lists the checks in the order that actually resolves the ambiguity.
|
|
11
|
+
*/
|
|
12
|
+
export function unreachableMessage(url, attempts) {
|
|
13
|
+
return (`[Reticle] this page could not open a websocket to ${url}. ${String(attempts)} attempts, all ` +
|
|
14
|
+
`failed. That is everything the page can see: from inside the browser it cannot tell a daemon ` +
|
|
15
|
+
`that is not there from one it is not allowed to reach, so this is not evidence about the ` +
|
|
16
|
+
`daemon. What answers it: run \`npx @reticlehq/server status\` to see whether one is listening ` +
|
|
17
|
+
`and on which port. If your app runs in a container, devcontainer or WSL, the daemon is on a ` +
|
|
18
|
+
`different host, so set the URL explicitly (Vite: VITE_RETICLE_WS_URL, or ` +
|
|
19
|
+
`reticle.connect({ url })). An https page cannot open a ws:// socket at all. Still retrying…`);
|
|
20
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a host object's method as a STORED VALUE, for code that has to put it back.
|
|
3
|
+
*
|
|
4
|
+
* Every observer here patches a global and must be able to undo it: `console.error`, `window.fetch`,
|
|
5
|
+
* `window.setTimeout`, `Date.now`. Undoing means holding the true original — the same function
|
|
6
|
+
* object, so teardown restores exactly what was there and a later install can recognise it by
|
|
7
|
+
* identity — and calling through a separately bound copy, because a host method invoked with the
|
|
8
|
+
* wrong receiver throws (`fetch` gives "Illegal invocation").
|
|
9
|
+
*
|
|
10
|
+
* Written as `const original = window.fetch`, that is a bare unbound method reference, and
|
|
11
|
+
* `@typescript-eslint/unbound-method` is right to flag the SHAPE even though this use is deliberate:
|
|
12
|
+
* the rule cannot see that the next line binds it, nor that the raw value only ever goes back into
|
|
13
|
+
* the slot it came from.
|
|
14
|
+
*
|
|
15
|
+
* The two obvious ways out are both wrong here. An `eslint-disable` is against this repo's standing
|
|
16
|
+
* rule and hides the shape from every future reader. Annotating `this: void` asserts the function
|
|
17
|
+
* does not use its receiver — which for a console method or `fetch` is simply false, and is the very
|
|
18
|
+
* reason the binding exists.
|
|
19
|
+
*
|
|
20
|
+
* So the intent is expressed instead of suppressed. A property descriptor's `value` is a stored
|
|
21
|
+
* value, not a method being detached from its object, which is exactly the distinction the rule is
|
|
22
|
+
* drawing and exactly what this code wants. It is also strictly more accurate for the restore case:
|
|
23
|
+
* it reads what the slot HOLDS rather than what calling the property would do, so an accessor
|
|
24
|
+
* defined on the object cannot be silently flattened into its result.
|
|
25
|
+
*
|
|
26
|
+
* Returns undefined when the property is absent or inherited rather than own — a caller that needs a
|
|
27
|
+
* fallback to the prototype chain should say so at its own call site rather than have it hidden here.
|
|
28
|
+
*/
|
|
29
|
+
export declare function capturedMethod<T>(target: object, key: PropertyKey): T | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* The same, for a property this code knows is present — the globals every observer patches.
|
|
32
|
+
*
|
|
33
|
+
* Throws rather than returning a broken teardown. A missing `window.fetch` is not a condition any
|
|
34
|
+
* caller here can recover from, and silently installing a patch that cannot be undone is worse than
|
|
35
|
+
* refusing: the page keeps the wrapper for the rest of its life with nothing able to remove it.
|
|
36
|
+
*/
|
|
37
|
+
export declare function requireCapturedMethod<T>(target: object, key: PropertyKey): T;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a host object's method as a STORED VALUE, for code that has to put it back.
|
|
3
|
+
*
|
|
4
|
+
* Every observer here patches a global and must be able to undo it: `console.error`, `window.fetch`,
|
|
5
|
+
* `window.setTimeout`, `Date.now`. Undoing means holding the true original — the same function
|
|
6
|
+
* object, so teardown restores exactly what was there and a later install can recognise it by
|
|
7
|
+
* identity — and calling through a separately bound copy, because a host method invoked with the
|
|
8
|
+
* wrong receiver throws (`fetch` gives "Illegal invocation").
|
|
9
|
+
*
|
|
10
|
+
* Written as `const original = window.fetch`, that is a bare unbound method reference, and
|
|
11
|
+
* `@typescript-eslint/unbound-method` is right to flag the SHAPE even though this use is deliberate:
|
|
12
|
+
* the rule cannot see that the next line binds it, nor that the raw value only ever goes back into
|
|
13
|
+
* the slot it came from.
|
|
14
|
+
*
|
|
15
|
+
* The two obvious ways out are both wrong here. An `eslint-disable` is against this repo's standing
|
|
16
|
+
* rule and hides the shape from every future reader. Annotating `this: void` asserts the function
|
|
17
|
+
* does not use its receiver — which for a console method or `fetch` is simply false, and is the very
|
|
18
|
+
* reason the binding exists.
|
|
19
|
+
*
|
|
20
|
+
* So the intent is expressed instead of suppressed. A property descriptor's `value` is a stored
|
|
21
|
+
* value, not a method being detached from its object, which is exactly the distinction the rule is
|
|
22
|
+
* drawing and exactly what this code wants. It is also strictly more accurate for the restore case:
|
|
23
|
+
* it reads what the slot HOLDS rather than what calling the property would do, so an accessor
|
|
24
|
+
* defined on the object cannot be silently flattened into its result.
|
|
25
|
+
*
|
|
26
|
+
* Returns undefined when the property is absent or inherited rather than own — a caller that needs a
|
|
27
|
+
* fallback to the prototype chain should say so at its own call site rather than have it hidden here.
|
|
28
|
+
*/
|
|
29
|
+
export function capturedMethod(target, key) {
|
|
30
|
+
return Object.getOwnPropertyDescriptor(target, key)?.value;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The same, for a property this code knows is present — the globals every observer patches.
|
|
34
|
+
*
|
|
35
|
+
* Throws rather than returning a broken teardown. A missing `window.fetch` is not a condition any
|
|
36
|
+
* caller here can recover from, and silently installing a patch that cannot be undone is worse than
|
|
37
|
+
* refusing: the page keeps the wrapper for the rest of its life with nothing able to remove it.
|
|
38
|
+
*/
|
|
39
|
+
export function requireCapturedMethod(target, key) {
|
|
40
|
+
const value = capturedMethod(target, key);
|
|
41
|
+
if (value === undefined) {
|
|
42
|
+
throw new Error(`[Reticle] cannot patch ${String(key)}: it is not an own property of the target`);
|
|
43
|
+
}
|
|
44
|
+
return value;
|
|
45
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reticlehq/browser",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Reticle browser SDK — installs observers, builds semantic snapshots, executes actions, talks to the bridge.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,17 +14,20 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@testing-library/dom": "^10.4.1",
|
|
17
|
-
"@reticlehq/core": "2.
|
|
17
|
+
"@reticlehq/core": "2.9.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
+
"@iconify-json/heroicons-outline": "^1.2.1",
|
|
21
|
+
"@iconify-json/heroicons-solid": "^1.2.1",
|
|
20
22
|
"@tanstack/query-core": "^5.101.4",
|
|
21
|
-
"@types/jsdom": "^
|
|
23
|
+
"@types/jsdom": "^30.0.0",
|
|
22
24
|
"jotai": "^2.20.2",
|
|
23
|
-
"jsdom": "^
|
|
25
|
+
"jsdom": "^30.0.1",
|
|
24
26
|
"mobx": "^7.0.0",
|
|
25
|
-
"pinia": "^4.0.
|
|
27
|
+
"pinia": "^4.0.3",
|
|
26
28
|
"react": "^19.2.8",
|
|
27
29
|
"recoil": "^0.7.7",
|
|
30
|
+
"sharp": "^0.35.3",
|
|
28
31
|
"svelte": "^5.56.8",
|
|
29
32
|
"valtio": "^2.3.2",
|
|
30
33
|
"vue": "^3.5.41",
|
|
@@ -59,7 +62,7 @@
|
|
|
59
62
|
"node": ">=20.0.0"
|
|
60
63
|
},
|
|
61
64
|
"scripts": {
|
|
62
|
-
"build": "tsc -b",
|
|
65
|
+
"build": "node scripts/embed-heroicons.mjs && tsc -b",
|
|
63
66
|
"typecheck": "tsc -b",
|
|
64
67
|
"lint": "eslint src",
|
|
65
68
|
"test:unit": "vitest run src --passWithNoTests",
|