{"_id":"@plugdash/heartpost","_rev":"5-7cb23eb385600da21e26701641bd1e5b","name":"@plugdash/heartpost","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@plugdash/heartpost","version":"0.1.0","keywords":["emdash","emdash-plugin","heartpost","like-button"],"license":"MIT","_id":"@plugdash/heartpost@0.1.0","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"dist":{"shasum":"f34ab9c6662c19889ab8818f5e1d00b2e15aaa5a","tarball":"https://registry.npmjs.org/@plugdash/heartpost/-/heartpost-0.1.0.tgz","fileCount":12,"integrity":"sha512-xDLfDiA+m1cd3jzURJpRW/3E9KQHofW0CtICLuq+Jw0sCQDS827ZZ0H94Rv/ga/WZJzOcih0NdSRMu4q6pvFCw==","signatures":[{"sig":"MEYCIQDz/LkmntTKCf7pFmgW1Q8K+nqMF4mbmD4fi/oICtOVXQIhAIJybZdOnr06bDZq71am6UJaK/7OS4zKBK52Wp0GU6MV","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33854},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-heartpost-0.1.0.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./HeartButton.astro":"./src/HeartButton.astro"},"scripts":{"test":"vitest run","build":"tsdown src/index.ts src/sandbox-entry.ts --dts.eager","typecheck":"tsc --noEmit"},"_npmUser":{"name":"abhinav061","email":"abhinav061@gmail.com"},"_resolved":"/private/var/folders/6y/57bqcl410dl_xsbfbpkrgv500000gn/T/763aea4534c84ad3ad18fdec2a64d7d0/plugdash-heartpost-0.1.0.tgz","_integrity":"sha512-xDLfDiA+m1cd3jzURJpRW/3E9KQHofW0CtICLuq+Jw0sCQDS827ZZ0H94Rv/ga/WZJzOcih0NdSRMu4q6pvFCw==","_npmVersion":"11.11.0","description":"Like button for EmDash posts - readers heart your content","directories":{},"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0"},"peerDependencies":{"emdash":"^0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/heartpost_0.1.0_1775374824603_0.046614373135717146","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@plugdash/heartpost","version":"0.2.0","keywords":["emdash","emdash-plugin","heartpost","like-button"],"license":"MIT","_id":"@plugdash/heartpost@0.2.0","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"homepage":"https://github.com/plugdash/plugdash#readme","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"421e013b51256930448ef3135055930f25d6a70e","tarball":"https://registry.npmjs.org/@plugdash/heartpost/-/heartpost-0.2.0.tgz","fileCount":12,"integrity":"sha512-lliGqCUVV7H1SFkdMLNvcjlu57479MfOSrII5IdFoGCtbMPchtE7MqjHzA1mN64uP+hunCEzMdijtj3AA4wfsw==","signatures":[{"sig":"MEUCIAKdli5LstQl2UmAHnncSUE+STFUWu1eR9aGGQVyAfJtAiEAkuIRn5mog/zaXfGr1dfTGafDZs4suxxcwQkBEwWkhac=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2fheartpost@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":46918},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-heartpost-0.2.0.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./HeartButton.astro":"./src/HeartButton.astro"},"scripts":{"test":"vitest run","build":"tsdown src/index.ts src/sandbox-entry.ts --dts.eager","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:03257302-7a04-472e-a683-d5d69117a78a"}},"_resolved":"/tmp/dd8dac15b85c4d355d27c963990a8dd2/plugdash-heartpost-0.2.0.tgz","_integrity":"sha512-lliGqCUVV7H1SFkdMLNvcjlu57479MfOSrII5IdFoGCtbMPchtE7MqjHzA1mN64uP+hunCEzMdijtj3AA4wfsw==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/heartpost"},"_npmVersion":"11.5.1","description":"Like button for EmDash posts - readers heart your content","directories":{},"_nodeVersion":"22.22.2","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0"},"peerDependencies":{"emdash":"^0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/heartpost_0.2.0_1775416193663_0.11885003428250074","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@plugdash/heartpost","version":"0.2.1","keywords":["emdash","emdash-plugin","heartpost","like-button"],"license":"MIT","_id":"@plugdash/heartpost@0.2.1","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"homepage":"https://github.com/plugdash/plugdash#readme","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"174dddada97a23bac494b11a18c88d41b4153067","tarball":"https://registry.npmjs.org/@plugdash/heartpost/-/heartpost-0.2.1.tgz","fileCount":12,"integrity":"sha512-dzMwtYIFSfdMaG+psBvGaJXKiZcEzB75Pcsqank8w09/LUyqGs9SAhUQLouiYgAqTA2Zb05KXYOfz7m2lthIRg==","signatures":[{"sig":"MEYCIQDF8AeiRte6fRhw/Cj/2KAdppufEQrUprW7Xyz6QVow5gIhAOBUacm6aafayg5h5mrBEs2es95BWCWIyh0u+31wXq8e","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDuUGVrpe3eYza1sTYRJ0pymBlk1gLLfyBOFhlt3brB5AIgEev++mXf7MkDhjHD7MbjL3GEIJFRpHqLngNx94WsC3w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2fheartpost@0.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":51332},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-heartpost-0.2.1.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./HeartButton.astro":"./src/HeartButton.astro"},"scripts":{"test":"vitest run","build":"tsdown src/index.ts src/sandbox-entry.ts --dts.eager","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:03257302-7a04-472e-a683-d5d69117a78a"}},"_resolved":"/tmp/dcf37cfd96175539bd235a3d1c4a07c4/plugdash-heartpost-0.2.1.tgz","_integrity":"sha512-dzMwtYIFSfdMaG+psBvGaJXKiZcEzB75Pcsqank8w09/LUyqGs9SAhUQLouiYgAqTA2Zb05KXYOfz7m2lthIRg==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/heartpost"},"_npmVersion":"11.5.1","description":"Like button for EmDash posts - readers heart your content","directories":{},"_nodeVersion":"22.23.2","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0"},"peerDependencies":{"emdash":">=0.13.0"},"_npmOperationalInternal":{"tmp":"tmp/heartpost_0.2.1_1790352126117_0.7458927174662493","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@plugdash/heartpost","version":"0.2.2","keywords":["emdash","emdash-plugin","heartpost","like-button"],"license":"MIT","_id":"@plugdash/heartpost@0.2.2","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"homepage":"https://github.com/plugdash/plugdash#readme","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"cf0a2a163b2afccb5f26be0da68ae0f5c43b5d79","tarball":"https://registry.npmjs.org/@plugdash/heartpost/-/heartpost-0.2.2.tgz","fileCount":12,"integrity":"sha512-HVunF32/fAU5KWvoX7Vz75uoRnS0Rr+t/f8PLgxY/PTEMnmfErfi9Lwk+9E+Cv1mIwXrNyD2fhjQeUFwLTdjFw==","signatures":[{"sig":"MEUCIFsGW4nir4Wv6v5xI4CTimuvGtngA00Ln7CY+fZMF17zAiEAl3VwPSpi9N7urUH7W1Xywx3k5jMD3YMT9tt6pmiOidk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIGhBfhTC3iHVmYRhJAXqtXpy2+GPWONLgBlXR/w1YEeRAiEAvFTTpI4YIMZhRAW21VcCnyTWnuQvVz6lRjGcOUXyMrY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2fheartpost@0.2.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":51479},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-heartpost-0.2.2.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./HeartButton.astro":"./src/HeartButton.astro"},"scripts":{"test":"vitest run","build":"tsdown src/index.ts src/sandbox-entry.ts --dts.eager","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:03257302-7a04-472e-a683-d5d69117a78a"}},"_resolved":"/tmp/208ff0f93ff2e48738d096209a8552a6/plugdash-heartpost-0.2.2.tgz","_integrity":"sha512-HVunF32/fAU5KWvoX7Vz75uoRnS0Rr+t/f8PLgxY/PTEMnmfErfi9Lwk+9E+Cv1mIwXrNyD2fhjQeUFwLTdjFw==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/heartpost"},"_npmVersion":"11.5.1","description":"Like button for EmDash posts - readers heart your content","directories":{},"_nodeVersion":"22.23.2","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0"},"peerDependencies":{"emdash":">=0.13.0"},"_npmOperationalInternal":{"tmp":"tmp/heartpost_0.2.2_1790409381899_0.3912341523918357","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"_id":"@plugdash/heartpost@0.3.0","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"be9194e5ff8afed8525de403ffdf3466cb9cd457","tarball":"https://registry.npmjs.org/@plugdash/heartpost/-/heartpost-0.3.0.tgz","fileCount":9,"integrity":"sha512-AzdVFEtc8Aqn+oeJNSXx7czDWwfqFnMRNdLVuRzpQ7Yj3tm4C7oZ/2d+lLirwOkpL4cTspbFajVhFS55KE9TzQ==","signatures":[{"sig":"MEYCIQCEuIvcxf0kak8f2vr95tOb8FkBoPrVFUd18txAwT/t9QIhAKxrxnYIgb07Qy2f2yJ62+BvaLELvR1fSdjvM002+A9W","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDMlz6TfYg/9ezJi83POo87nwrlcTRKhPxNw98/bSOBaQIhAPCT5dggIHGg43kcSweZnwUYFa4/vk7MZaf8Iln2fGxW"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2fheartpost@0.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":43626},"main":"./dist/index.mjs","name":"@plugdash/heartpost","type":"module","_from":"file:plugdash-heartpost-0.3.0.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./HeartButton.astro":"./src/HeartButton.astro"},"license":"MIT","scripts":{"test":"vitest run","build":"tsdown src/index.ts --dts.eager","typecheck":"tsc --noEmit"},"version":"0.3.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"03257302-7a04-472e-a683-d5d69117a78a"}},"homepage":"https://github.com/plugdash/plugdash#readme","keywords":["astro-component","emdash","emdash-plugin","heartpost","like-button"],"_resolved":"/tmp/05eccc77c2ed9c2547b03d5873696e45/plugdash-heartpost-0.3.0.tgz","_integrity":"sha512-AzdVFEtc8Aqn+oeJNSXx7czDWwfqFnMRNdLVuRzpQ7Yj3tm4C7oZ/2d+lLirwOkpL4cTspbFajVhFS55KE9TzQ==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/heartpost"},"_npmVersion":"11.5.1","description":"Like button for EmDash posts with one count per post, no per-visitor rows","directories":{},"maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"_nodeVersion":"22.23.3","_hasShrinkwrap":false,"devDependencies":{"emdash":"^1.0.1","vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0"},"peerDependencies":{"emdash":">=1.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/heartpost_0.3.0_1790936786785_0.009635889583553547"}}},"time":{"created":"2026-04-05T07:40:24.532Z","modified":"2026-10-02T10:26:27.279Z","0.1.0":"2026-04-05T07:40:24.753Z","0.2.0":"2026-04-05T19:09:53.822Z","0.2.1":"2026-09-25T16:02:06.227Z","0.2.2":"2026-09-26T07:56:21.990Z","0.3.0":"2026-10-02T10:26:26.872Z"},"bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"license":"MIT","homepage":"https://github.com/plugdash/plugdash#readme","keywords":["astro-component","emdash","emdash-plugin","heartpost","like-button"],"repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/heartpost"},"description":"Like button for EmDash posts with one count per post, no per-visitor rows","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"readme":"# @plugdash/heartpost\n\nReaders want to acknowledge a post without writing a comment, and a like\nbutton that writes a database row per visitor grows without bound.\nHeartpost keeps one count per post and remembers who hearted in the reader's\nown browser. Ships HeartButton.astro - a drop-in heart button with a\nbottom-to-top fill animation. No WordPress equivalent - only on EmDash.\n\n## Install\n\n```bash\npnpm add @plugdash/heartpost\n```\n\n## Register\n\n```js\n// astro.config.mjs\nimport { defineConfig } from \"astro/config\";\nimport emdash from \"emdash/astro\";\nimport { heartpostPlugin } from \"@plugdash/heartpost\";\n\nexport default defineConfig({\n\tintegrations: [\n\t\temdash({\n\t\t\tplugins: [heartpostPlugin()],\n\t\t}),\n\t],\n});\n```\n\n## Configuration\n\n| Option             | Type             | Default     | Description                                                          |\n| ------------------ | ---------------- | ----------- | -------------------------------------------------------------------- |\n| collections        | `string[]`       | `[\"posts\"]` | Collections whose entries can be hearted                             |\n| rateLimitPerMinute | `number`         | `10`        | Hearts per client IP per minute. `0` turns the limit off             |\n| trustProxyHeader   | `string \\| null` | `null`      | Header to read the client IP from when you sit behind your own proxy |\n| label              | `string`         | `\"hearts\"`  | Label for the heart count                                            |\n\n`collections` used to default to every collection. It now defaults to\n`[\"posts\"]`. Pass the collections you want if you heart anything else.\n\n## Companion component\n\n```astro\n---\nimport HeartButton from \"@plugdash/heartpost/HeartButton.astro\";\n---\n\n<HeartButton post={post} />\n```\n\n| Prop    | Type                            | Default    | Description                                                                 |\n| ------- | ------------------------------- | ---------- | --------------------------------------------------------------------------- |\n| post    | `Record<string, unknown>`       | (required) | Content item. Hearts are keyed on `post.data.id`, falling back to `post.id` |\n| variant | `\"circle\" \\| \"pill\" \\| \"ghost\"` | `\"circle\"` | Visual style                                                                |\n| size    | `\"sm\" \\| \"md\" \\| \"lg\"`          | `\"md\"`     | Component size                                                              |\n| theme   | `\"auto\" \\| \"dark\" \\| \"light\"`   | `\"auto\"`   | Color scheme                                                                |\n| class   | `string`                        | `\"\"`       | Additional CSS class                                                        |\n\nCSS custom properties: `--plugdash-heart-color`, `--plugdash-heart-fill-duration`,\n`--plugdash-engage-size`, `--plugdash-engage-radius`, `--plugdash-engage-border`,\n`--plugdash-engage-bg`, `--plugdash-engage-bg-hover`.\n\n## How it works\n\n- One KV row per post: `count:<entry id>`. 1,000 hearts on a post is still one row.\n- Whether a visitor hearted is stored in their browser (`localStorage`, key\n  `plugdash-heart-<entry id>`). Clearing site data or switching browsers lets the\n  same person heart again. The count is a soft count, not a vote.\n- The button loads its count only when it is within 200px of the viewport. A page\n  that is never scrolled that far makes no request. Several buttons for one post\n  share a single request and update together.\n- Hearting needs a published entry in one of the `collections`. Anything else is rejected.\n- Rate limiting counts hearts per client IP per minute in a small storage collection.\n  Old buckets are removed as new ones are written.\n\n## Rate limiting and the client IP\n\nThe IP comes from EmDash's `requestMeta.ip`, which only trusts forwarding headers\non Cloudflare or when you declare them. A spoofed `X-Forwarded-For` is ignored.\nWhen there is no trusted IP (for example a plain local `node` server) the plugin\nlogs one warning and skips the limit. If you run behind your own proxy, set\n`trustProxyHeader` to the header it sets.\n\nThe built-in limit is a speed bump. For a public site, add a platform rate limit\non `POST /_emdash/api/plugins/heartpost/heart` and `heart-remove` too, for example\na Cloudflare Rate Limiting rule on that path.\n\n## Upgrading from 0.2.x\n\n- Existing counts carry over. The first heart on a post reads the old\n  `heartpost:<id>:count` key and continues from the larger number.\n- Old per-visitor rows are not deleted automatically. Open the EmDash admin,\n  go to Plugins - Heart Post, and use \"Remove old visitor rows\".\n- The sandboxed `./sandbox` export is gone. Heartpost is a native plugin now.\n- The `content:afterSave` hook is gone. Counts are created on the first heart.\n\n## What it does not do\n\n- Does not stop a determined visitor from hearting more than once\n- Does not store IPs, fingerprints, or any visitor data in the database\n- Does not heart drafts, archived, or scheduled entries\n- Does not provide an admin page for viewing counts\n","readmeFilename":"README.md"}