@popgrids/embed 0.0.5 → 0.0.7
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/AGENTS.md +23 -33
- package/README.md +22 -3
- package/dist/components/pop-comment-thread.d.ts.map +1 -1
- package/dist/components/pop-comment.d.ts.map +1 -1
- package/dist/components/pop-feed.d.ts.map +1 -1
- package/dist/components/pop-grid.d.ts +12 -0
- package/dist/components/pop-grid.d.ts.map +1 -1
- package/dist/components/pop-widget.d.ts.map +1 -1
- package/dist/embed.js +477 -443
- package/dist/embed.js.map +1 -1
- package/dist/index.cjs +56 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +125 -91
- package/dist/index.js.map +1 -1
- package/dist/lib/position-feed.d.ts +9 -0
- package/dist/lib/position-feed.d.ts.map +1 -0
- package/dist/loader.js +1 -0
- package/dist/store/embed-auth-store.d.ts +3 -0
- package/dist/store/embed-auth-store.d.ts.map +1 -1
- package/dist/store/grid-store.d.ts +12 -0
- package/dist/store/grid-store.d.ts.map +1 -1
- package/package.json +4 -3
package/AGENTS.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Project Instructions (
|
|
1
|
+
# Project Instructions (`packages/embed`)
|
|
2
2
|
|
|
3
3
|
This project contains the embeddable Web Component discussion widget for PopGrids. It is a lightweight, self-contained client-side bundle designed to be embedded on third-party websites.
|
|
4
4
|
|
|
@@ -13,11 +13,12 @@ This project contains the embeddable Web Component discussion widget for PopGrid
|
|
|
13
13
|
- **Build System**: Vite.
|
|
14
14
|
- `vite.config.ts` builds the library version.
|
|
15
15
|
- `vite.embed.config.ts` builds the single self-contained embeddable JS script.
|
|
16
|
+
- `vite.loader.config.ts` builds `dist/loader.js` from [loader.ts](./src/loader.ts): the tiny classic script served at `https://cdn.popgrids.io/embed.js`, which loads this release's `embed.js`.
|
|
16
17
|
|
|
17
18
|
## Core Development Commands
|
|
18
19
|
|
|
19
20
|
- `pnpm run dev` — Watch-builds both library and embed scripts.
|
|
20
|
-
- `pnpm run build` — Clean and build
|
|
21
|
+
- `pnpm run build` — Clean and build all three targets (`dist/`).
|
|
21
22
|
- `pnpm run demo:dev` — Launches concurrently the dev watch compiler and a live-reload server (`live-server`) on port 5500.
|
|
22
23
|
|
|
23
24
|
## Component Conventions
|
|
@@ -121,35 +122,24 @@ We propagate state using a custom context pattern instead of passing props manua
|
|
|
121
122
|
## Releasing
|
|
122
123
|
|
|
123
124
|
This package publishes to npm as [`@popgrids/embed`](https://www.npmjs.com/package/@popgrids/embed)
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
- **Every change that affects the published output** needs a changeset
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
-
|
|
132
|
-
|
|
133
|
-
workflow `release.yml`).
|
|
134
|
-
- `.github/workflows/ci.yml` typechecks + builds every PR.
|
|
125
|
+
through the monorepo's changesets flow; see "Releasing ui and embed" in the root `AGENTS.md`.
|
|
126
|
+
|
|
127
|
+
- **Every change that affects the published output** needs a changeset (`pnpm changeset` from the
|
|
128
|
+
root). web's Composer preview bundles the workspace copy, so it picks up an embed change on the
|
|
129
|
+
next deploy, released or not; customer sites get it only once it's released.
|
|
130
|
+
- **Auth is npm OIDC trusted publishing** — no `NPM_TOKEN`. The trusted publisher on npmjs.com
|
|
131
|
+
points at repo `popgrids/popgrids`, workflow `release.yml`.
|
|
132
|
+
- `prepublishOnly` runs `check` + `build`. The root `.github/workflows/ci.yml` runs embed's `check`
|
|
133
|
+
and `build` on every PR that touches it.
|
|
135
134
|
- The published package ships both entries: `.` (the library, deps external) and `./embed` /
|
|
136
|
-
`dist/embed.js` (the self-contained CDN bundle, also the `unpkg`/`jsdelivr` target)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
Issues and specs live as GitHub issues in `popgrids/popgrids-embed`. See `docs/agents/issue-tracker.md`.
|
|
148
|
-
|
|
149
|
-
### Triage labels
|
|
150
|
-
|
|
151
|
-
Default label vocabulary (`needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`). See `docs/agents/triage-labels.md`.
|
|
152
|
-
|
|
153
|
-
### Domain docs
|
|
154
|
-
|
|
155
|
-
Single-context: `CONTEXT.md` + `docs/adr/` at the repo root. See `docs/agents/domain.md`.
|
|
135
|
+
`dist/embed.js` (the self-contained CDN bundle, also the `unpkg`/`jsdelivr` target), plus
|
|
136
|
+
`dist/loader.js`.
|
|
137
|
+
- **Customer sites load releases from `cdn.popgrids.io`**, never from `main`. After a release,
|
|
138
|
+
`.github/workflows/embed-cdn.yml` copies the npm tarball's `embed.js`, its map and `loader.js` to
|
|
139
|
+
`embed/<version>/` in the `popgrids` R2 bucket (cached for a year), then that `loader.js` to
|
|
140
|
+
`embed.js` (cached 5 minutes). To roll back, run that workflow by hand with an earlier version
|
|
141
|
+
(0.0.7 or later; older releases have no loader). It uses the `CLOUDFLARE_R2_API_TOKEN` secret, an
|
|
142
|
+
R2 token scoped to the `popgrids` bucket, and writes only under the `embed` prefix: the same
|
|
143
|
+
bucket serves the marketing videos.
|
|
144
|
+
|
|
145
|
+
Issues, triage labels, domain docs, and Plan Mode are shared across the monorepo; see the root `AGENTS.md`.
|
package/README.md
CHANGED
|
@@ -38,15 +38,31 @@ import type { AuthUser, Comment, CommentAuthor, Grid } from "@popgrids/embed";
|
|
|
38
38
|
|
|
39
39
|
### Script tag / CDN
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
to load:
|
|
41
|
+
Add one tag where the grid should appear:
|
|
43
42
|
|
|
44
43
|
```html
|
|
45
|
-
<script
|
|
44
|
+
<script src="https://cdn.popgrids.io/embed.js" data-key="pk_your_public_key" async></script>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The grid renders right after the tag and takes its `data-*` attributes (see below), so
|
|
48
|
+
`data-id="article-hero"` on the tag names the thread. Repeat the tag for more grids; the widget
|
|
49
|
+
loads once.
|
|
50
|
+
|
|
51
|
+
`https://cdn.popgrids.io/embed.js` always serves the latest release, cached for 5 minutes. It's a
|
|
52
|
+
tiny loader for that release's bundle, which lives at an immutable, versioned URL. To pin a version,
|
|
53
|
+
load its loader instead: `https://cdn.popgrids.io/embed/0.0.7/loader.js`.
|
|
54
|
+
|
|
55
|
+
To place grids yourself, leave out `data-key` and add `<pop-grid>` elements anywhere on the page:
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<script src="https://cdn.popgrids.io/embed.js" async></script>
|
|
46
59
|
|
|
47
60
|
<pop-grid data-key="pk_your_public_key"></pop-grid>
|
|
48
61
|
```
|
|
49
62
|
|
|
63
|
+
The `./embed` subpath (`dist/embed.js`) is the bundle itself: a self-contained ES module with every
|
|
64
|
+
dependency inlined, also on unpkg and jsDelivr.
|
|
65
|
+
|
|
50
66
|
## `<pop-grid>` attributes
|
|
51
67
|
|
|
52
68
|
| Attribute | Required | Description |
|
|
@@ -54,6 +70,9 @@ to load:
|
|
|
54
70
|
| `data-key` | yes | Your grid's public key (`pk_…`). |
|
|
55
71
|
| `data-api-url` | no | Base URL of the PopGrids API. Defaults to `https://www.popgrids.io`. |
|
|
56
72
|
| `data-id` | no | Names the thread. Same `data-id` = same discussion across pages. Defaults to the page's canonical URL. |
|
|
73
|
+
| `data-demo` | no | Demo mode: no API, realtime or sign-in. Shows the data assigned to the element's `demo` property (`{ grid, comments }`, type `DemoData`). |
|
|
74
|
+
|
|
75
|
+
The element's `open` property reads or sets whether the panel is open, e.g. `grid.open = true` to show it from your own control.
|
|
57
76
|
|
|
58
77
|
## License
|
|
59
78
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pop-comment-thread.d.ts","sourceRoot":"","sources":["../../src/components/pop-comment-thread.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"pop-comment-thread.d.ts","sourceRoot":"","sources":["../../src/components/pop-comment-thread.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAC;AAuE7D,qBAAa,gBAAiB,SAAQ,WAAW;IAC3B,SAAS,EAAG,SAAS,CAAC;IAE1C,OAAO,CAAC,QAAQ,CAAS;IAEzB,SAAS,KAAK,WAAW,oBAExB;IAED,SAAS,CAAC,MAAM;;MAEd;IAEF,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU;IAMnC,SAAS,CAAC,YAAY;IAoBtB,SAAS,CAAC,WAAW,IAAI,MAAM;CAsChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pop-comment.d.ts","sourceRoot":"","sources":["../../src/components/pop-comment.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAC;AA0S7D,qBAAa,UAAW,SAAQ,WAAW;IACrB,SAAS,EAAG,SAAS,CAAC;IACjB,SAAS,EAAG,cAAc,CAAC;IAEpD,MAAM,KAAK,kBAAkB,aAE5B;IAED,iBAAiB;IAIjB,kBAAkB;IAIlB,IAAI,IAAI,IAAI,IAAI,GAAG,IAAI,CAEtB;IAED,IAAI,iBAAiB,IAAI,IAAI,GAAG,IAAI,CAEnC;IAED,SAAS,KAAK,WAAW,oBAExB;IAED,SAAS,CAAC,MAAM;;MAEd;IAEF,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,gBAAgB,CAA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C,gBAAgB,CAA8C;IAEtE,oBAAoB;IAMpB,OAAO,CAAC,gBAAgB;IA0CxB,OAAO,CAAC,eAAe;IAOvB,SAAS,CAAC,YAAY;IAkCtB,SAAS,CAAC,WAAW,IAAI,MAAM;CAoHhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pop-feed.d.ts","sourceRoot":"","sources":["../../src/components/pop-feed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAC;AAqM7D,qBAAa,OAAQ,SAAQ,WAAW;IAClB,SAAS,EAAG,SAAS,CAAC;IACjB,SAAS,EAAG,cAAc,CAAC;IAEpD,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,cAAc,CAAuB;IAE7C,SAAS,KAAK,WAAW,oBAExB;IAED,SAAS,CAAC,MAAM;;MAEd;IAEF,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU;IAOnC,iBAAiB;IAMjB,oBAAoB;IAOpB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAc/B,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,SAAS;IAejB,SAAS,CAAC,YAAY;IAuBtB;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,MAAM;
|
|
1
|
+
{"version":3,"file":"pop-feed.d.ts","sourceRoot":"","sources":["../../src/components/pop-feed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAC;AAqM7D,qBAAa,OAAQ,SAAQ,WAAW;IAClB,SAAS,EAAG,SAAS,CAAC;IACjB,SAAS,EAAG,cAAc,CAAC;IAEpD,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,cAAc,CAAuB;IAE7C,SAAS,KAAK,WAAW,oBAExB;IAED,SAAS,CAAC,MAAM;;MAEd;IAEF,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU;IAOnC,iBAAiB;IAMjB,oBAAoB;IAOpB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAc/B,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,SAAS;IAejB,SAAS,CAAC,YAAY;IAuBtB;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,MAAM;IAuEd,SAAS,CAAC,WAAW,IAAI,MAAM;CAmBhC"}
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
+
import { DemoData } from '../store/grid-store.js';
|
|
1
2
|
import { BaseElement } from './base-element.js';
|
|
2
3
|
export declare class PopGrid extends BaseElement {
|
|
3
4
|
private _initialized;
|
|
4
5
|
private _floatingCleanup?;
|
|
5
6
|
private _store;
|
|
6
7
|
private _authStore;
|
|
8
|
+
private _demo?;
|
|
9
|
+
/**
|
|
10
|
+
* The grid and comments a `data-demo` grid shows instead of fetching its
|
|
11
|
+
* own — the host page supplies them, so no sample data ships in the bundle.
|
|
12
|
+
* Shows the loading skeleton until it's set.
|
|
13
|
+
*/
|
|
14
|
+
get demo(): DemoData | undefined;
|
|
15
|
+
set demo(data: DemoData);
|
|
16
|
+
/** Whether the panel is open. Setting it opens or closes the panel; the visitor can still toggle it as usual. */
|
|
17
|
+
get open(): boolean;
|
|
18
|
+
set open(value: boolean);
|
|
7
19
|
protected get styleSheets(): CSSStyleSheet[];
|
|
8
20
|
static get observedAttributes(): string[];
|
|
9
21
|
connectedCallback(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pop-grid.d.ts","sourceRoot":"","sources":["../../src/components/pop-grid.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pop-grid.d.ts","sourceRoot":"","sources":["../../src/components/pop-grid.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,QAAQ,EAAsB,MAAM,wBAAwB,CAAC;AAGtF,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAC;AAmC7D,qBAAa,OAAQ,SAAQ,WAAW;IACtC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,gBAAgB,CAAC,CAAa;IACtC,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,KAAK,CAAC,CAAW;IAEzB;;;;OAIG;IACH,IAAI,IAAI,IAAI,QAAQ,GAAG,SAAS,CAE/B;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,QAAQ,EAGtB;IAED,iHAAiH;IACjH,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,OAAO,EAEtB;IAED,SAAS,KAAK,WAAW,oBAExB;IAMD,MAAM,KAAK,kBAAkB,aAE5B;IAED,iBAAiB;IAuDjB,OAAO,CAAC,4BAA4B;IAkCpC,OAAO,CAAC,6BAA6B;IAOrC,kBAAkB;IAIlB,mBAAmB;IAInB,qBAAqB;IAIrB,iBAAiB;IAIjB,yBAAyB;IAIzB,oBAAoB;IAQpB,SAAS,CAAC,YAAY;IA6CtB,SAAS,CAAC,WAAW,IAAI,MAAM;CAQhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pop-widget.d.ts","sourceRoot":"","sources":["../../src/components/pop-widget.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAC;AAkJ7D,qBAAa,SAAU,SAAQ,WAAW;IACpB,SAAS,EAAG,SAAS,CAAC;IAE1C,SAAS,KAAK,WAAW,oBAExB;IAED,SAAS,CAAC,MAAM;;MAEd;IAEF,SAAS,CAAC,OAAO;IAQjB,SAAS,CAAC,YAAY;IAmBtB,SAAS,CAAC,WAAW,IAAI,MAAM;
|
|
1
|
+
{"version":3,"file":"pop-widget.d.ts","sourceRoot":"","sources":["../../src/components/pop-widget.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAC;AAkJ7D,qBAAa,SAAU,SAAQ,WAAW;IACpB,SAAS,EAAG,SAAS,CAAC;IAE1C,SAAS,KAAK,WAAW,oBAExB;IAED,SAAS,CAAC,MAAM;;MAEd;IAEF,SAAS,CAAC,OAAO;IAQjB,SAAS,CAAC,YAAY;IAmBtB,SAAS,CAAC,WAAW,IAAI,MAAM;CA+ChC"}
|