@loupekit/shared 0.2.0 → 0.2.1-next.2
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 +51 -27
- package/package.json +25 -6
package/README.md
CHANGED
|
@@ -1,38 +1,62 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
<a href="https://mohamed-ashraf-elsaed.github.io/loupe/">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/mohamed-ashraf-elsaed/loupe/main/docs/store/promo-marquee-1400x560.jpg" alt="Loupe — Pin feedback to the live UI. Hand it to Claude." width="100%" />
|
|
5
|
+
</a>
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<h1>@loupekit/shared</h1>
|
|
8
|
+
|
|
9
|
+
<p><strong>The canonical TypeScript types and pure helpers shared across Loupe.</strong><br />
|
|
10
|
+
The SDK, backend API, dashboard, and MCP server all import from here — so a comment means the
|
|
11
|
+
same thing everywhere in the loop.</p>
|
|
12
|
+
|
|
13
|
+
<p>
|
|
14
|
+
<a href="https://www.npmjs.com/package/@loupekit/shared"><img src="https://img.shields.io/npm/v/@loupekit/shared?color=4a55d6&label=npm" alt="npm version" /></a>
|
|
15
|
+
<a href="https://www.npmjs.com/package/@loupekit/shared"><img src="https://img.shields.io/npm/dm/@loupekit/shared?color=4a55d6" alt="npm downloads" /></a>
|
|
16
|
+
<img src="https://img.shields.io/npm/types/@loupekit/shared?color=4a55d6" alt="TypeScript types" />
|
|
17
|
+
<img src="https://img.shields.io/badge/dependencies-0-4a55d6" alt="Zero dependencies" />
|
|
18
|
+
<img src="https://img.shields.io/npm/l/@loupekit/shared?color=4a55d6" alt="MIT license" />
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<p>
|
|
22
|
+
<a href="https://mohamed-ashraf-elsaed.github.io/loupe/"><b>Website</b></a> ·
|
|
23
|
+
<a href="https://github.com/mohamed-ashraf-elsaed/loupe"><b>GitHub</b></a> ·
|
|
24
|
+
<a href="https://www.npmjs.com/package/@loupekit/sdk"><b>SDK</b></a> ·
|
|
25
|
+
<a href="https://www.npmjs.com/package/@loupekit/mcp"><b>MCP server</b></a>
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
</div>
|
|
8
29
|
|
|
9
30
|
---
|
|
10
31
|
|
|
32
|
+
This is the **contract layer** of the [Loupe](https://github.com/mohamed-ashraf-elsaed/loupe)
|
|
33
|
+
visual-feedback platform — no runtime dependencies, not a feature. If you're building on
|
|
34
|
+
Loupe, install the [SDK](https://www.npmjs.com/package/@loupekit/sdk) or
|
|
35
|
+
[MCP server](https://www.npmjs.com/package/@loupekit/mcp) instead; this package is pulled in
|
|
36
|
+
for you.
|
|
37
|
+
|
|
11
38
|
## Install
|
|
12
39
|
|
|
13
40
|
```bash
|
|
14
41
|
npm i @loupekit/shared
|
|
15
42
|
```
|
|
16
43
|
|
|
17
|
-
> Also mirrored to **GitHub Packages** as `@mohamed-ashraf-elsaed/shared
|
|
18
|
-
>
|
|
44
|
+
> Also mirrored to **GitHub Packages** as `@mohamed-ashraf-elsaed/shared` — add
|
|
45
|
+
> `@mohamed-ashraf-elsaed:registry=https://npm.pkg.github.com` to your `.npmrc` to install from there.
|
|
19
46
|
|
|
20
47
|
## Types
|
|
21
48
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- **`RegionRect`** — a free-region rectangle in document coordinates, with optional
|
|
30
|
-
element-relative fractions (`rel`) so regions track responsive reflow.
|
|
31
|
-
- **`LoupeUser`**, **`CommentStatus`**, **`CommentKind`** — identity and workflow enums.
|
|
49
|
+
| Type | Purpose |
|
|
50
|
+
| --- | --- |
|
|
51
|
+
| **`Comment`** | A piece of visual feedback: body, author, status, element `anchor`, captured `context` (HTML + styles), screenshot URL, and — for free-region comments — `kind: "region"` + a `region` rectangle. |
|
|
52
|
+
| **`Anchor`** | The multi-signal element fingerprint (tag, CSS path, XPath, testid, text, attributes, nth-of-type, rect, viewport) used to re-locate an element after a redeploy. |
|
|
53
|
+
| **`ElementContext`** | The target's `outerHTML` + a curated slice of computed styles. |
|
|
54
|
+
| **`RegionRect`** | A free-region rectangle in document coordinates, with optional element-relative fractions (`rel`) so regions track responsive reflow. |
|
|
55
|
+
| **`LoupeUser`**, **`CommentStatus`**, **`CommentKind`** | Identity and workflow enums. |
|
|
32
56
|
|
|
33
57
|
## Helper: `normalizeUrl(input)`
|
|
34
58
|
|
|
35
|
-
Normalizes a page URL so comments don't fragment across tracking/volatile query params.
|
|
59
|
+
Normalizes a page URL so comments don't fragment across tracking / volatile query params.
|
|
36
60
|
|
|
37
61
|
```ts
|
|
38
62
|
import { normalizeUrl } from "@loupekit/shared";
|
|
@@ -43,23 +67,23 @@ normalizeUrl("/checkout?utm_source=x&gclid=123&step=2");
|
|
|
43
67
|
|
|
44
68
|
It:
|
|
45
69
|
|
|
46
|
-
- strips `utm_*`, click ids (`gclid`, `fbclid`, `msclkid`, …), and Loupe's own dev params
|
|
47
|
-
(`api`, `key`),
|
|
70
|
+
- strips `utm_*`, click ids (`gclid`, `fbclid`, `msclkid`, …), and Loupe's own dev params (`api`, `key`),
|
|
48
71
|
- sorts the remaining params for stability,
|
|
49
72
|
- drops trailing slashes.
|
|
50
73
|
|
|
51
|
-
So a comment on `/checkout?utm_source=x` and one on `/checkout` land on the **same** page
|
|
52
|
-
don't split into two buckets.
|
|
74
|
+
So a comment on `/checkout?utm_source=x` and one on `/checkout` land on the **same** page.
|
|
53
75
|
|
|
54
|
-
##
|
|
76
|
+
## Notes
|
|
55
77
|
|
|
56
|
-
- ESM-only
|
|
57
|
-
- Node packages
|
|
78
|
+
- ESM-only; ships compiled JS + `.d.ts` (`main` / `types` → `dist`).
|
|
79
|
+
- Node packages import the compiled JS; browser packages import the types.
|
|
58
80
|
|
|
59
81
|
## Related packages
|
|
60
82
|
|
|
61
|
-
|
|
62
|
-
|
|
83
|
+
| Package | Description |
|
|
84
|
+
| --- | --- |
|
|
85
|
+
| [`@loupekit/sdk`](https://www.npmjs.com/package/@loupekit/sdk) | The embeddable visual-feedback widget. |
|
|
86
|
+
| [`@loupekit/mcp`](https://www.npmjs.com/package/@loupekit/mcp) | The MCP server that hands comments to Claude Code. |
|
|
63
87
|
|
|
64
88
|
## License
|
|
65
89
|
|
package/package.json
CHANGED
|
@@ -1,19 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loupekit/shared",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1-next.2",
|
|
4
4
|
"description": "Canonical TypeScript types + helpers (normalizeUrl) shared across the Loupe visual-feedback platform.",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
|
+
"loupe",
|
|
7
|
+
"types",
|
|
8
|
+
"shared",
|
|
9
|
+
"visual-feedback",
|
|
10
|
+
"annotation",
|
|
11
|
+
"normalize-url",
|
|
12
|
+
"typescript"
|
|
13
|
+
],
|
|
6
14
|
"license": "MIT",
|
|
7
|
-
"repository": {
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/mohamed-ashraf-elsaed/loupe.git",
|
|
18
|
+
"directory": "packages/shared"
|
|
19
|
+
},
|
|
8
20
|
"homepage": "https://mohamed-ashraf-elsaed.github.io/loupe/",
|
|
9
|
-
"publishConfig": {
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
10
24
|
"type": "module",
|
|
11
25
|
"main": "./dist/index.js",
|
|
12
26
|
"types": "./dist/index.d.ts",
|
|
13
27
|
"exports": {
|
|
14
|
-
".": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js"
|
|
31
|
+
}
|
|
15
32
|
},
|
|
16
|
-
"files": [
|
|
33
|
+
"files": [
|
|
34
|
+
"dist"
|
|
35
|
+
],
|
|
17
36
|
"scripts": {
|
|
18
37
|
"build": "tsc -p tsconfig.json"
|
|
19
38
|
}
|