{"_id":"@edrlab/thorium-badges","_rev":"4-91e224dd05bb1f295d2a1e1ddc3b075a","name":"@edrlab/thorium-badges","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@edrlab/thorium-badges","version":"1.0.0","_id":"@edrlab/thorium-badges@1.0.0","maintainers":[{"name":"hadrien.gardeur","email":"hadrien.gardeur@gmail.com"},{"name":"danielweck","email":"daniel.weck@gmail.com"},{"name":"jaypanoz","email":"jiminy@chapalpanoz.com"},{"name":"llemeur","email":"laurent.lemeur@edrlab.org"}],"dist":{"shasum":"54ca77a1296aa03d76141800024b81b46721ce55","tarball":"https://registry.npmjs.org/@edrlab/thorium-badges/-/thorium-badges-1.0.0.tgz","fileCount":6,"integrity":"sha512-rkVL2Mz3oNhBObbjuk4J5oRTb5ZHUrgQXEc9vEb2cakHtlauoGIX2DGA5z9pgLKTSJcb6m3BGAFle49RN62aYQ==","signatures":[{"sig":"MEUCIGVVzSveSDliN0GJR6WohGnRbu8/wu1f1iXwylehbP5RAiEAwZaD1igxXc8Si0l/gIwXYnN8SbPWQnDJNfwsUyaRrws=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24782},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","unpkg":"dist/thorium-badges.iife.js","module":"dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"d726cda4568ce6a72d3822d5ba9cffae82fc07fb","scripts":{"dev":"vite build --watch","build":"vite build && vite build --config vite.iife.config.ts","predev":"pnpm run generate","generate":"node scripts/generate-badge-texts.mjs","prebuild":"pnpm run generate"},"_npmUser":{"name":"jaypanoz","email":"jiminy@chapalpanoz.com"},"jsdelivr":"dist/thorium-badges.iife.js","_npmVersion":"11.12.1","description":"Web components for embedding \"Add to Thorium Reader\" badges (catalog and publication) on any page.","directories":{},"_nodeVersion":"24.15.0","_hasShrinkwrap":false,"devDependencies":{"vite":"^7.3.3","typescript":"^5.9.3","vite-plugin-dts":"^5.0.3"},"_npmOperationalInternal":{"tmp":"tmp/thorium-badges_1.0.0_1786011175455_0.05090528698609331","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@edrlab/thorium-badges","version":"1.0.1","_id":"@edrlab/thorium-badges@1.0.1","maintainers":[{"name":"hadrien.gardeur","email":"hadrien.gardeur@gmail.com"},{"name":"danielweck","email":"daniel.weck@gmail.com"},{"name":"jaypanoz","email":"jiminy@chapalpanoz.com"},{"name":"llemeur","email":"laurent.lemeur@edrlab.org"}],"dist":{"shasum":"1824dcb5cd0cd67cc81a8cf211aff7f37dcd0826","tarball":"https://registry.npmjs.org/@edrlab/thorium-badges/-/thorium-badges-1.0.1.tgz","fileCount":6,"integrity":"sha512-rcaTL0IQiqOdAFfcQxBpUzRa85StNK3zKCau0RKqoDRdcvSHRRJh07PvYtHm0uZKDB8Jv0eWY4bASC4JBb30wA==","signatures":[{"sig":"MEUCIFK0zscPmIqtZfsYR+8OsQJwLng+v1AzPM576SEwstETAiEA09/xImt6ystasxcuxa1YwIgTuvnVmXgsJmUlgLcw3bQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25161},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","unpkg":"dist/thorium-badges.iife.js","module":"dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"99b8ad6efe57dfc0a56cddec47e2f2e94734bbf5","scripts":{"dev":"vite build --watch","build":"vite build && vite build --config vite.iife.config.ts","predev":"pnpm run generate","generate":"node scripts/generate-badge-texts.mjs","prebuild":"pnpm run generate"},"_npmUser":{"name":"jaypanoz","email":"jiminy@chapalpanoz.com"},"jsdelivr":"dist/thorium-badges.iife.js","_npmVersion":"11.12.1","description":"Web components for embedding \"Add to Thorium Reader\" badges (catalog and publication) on any page.","directories":{},"_nodeVersion":"24.15.0","_hasShrinkwrap":false,"devDependencies":{"vite":"^7.3.3","typescript":"^5.9.3","vite-plugin-dts":"^5.0.3"},"_npmOperationalInternal":{"tmp":"tmp/thorium-badges_1.0.1_1786087252583_0.497450812406959","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@edrlab/thorium-badges","version":"1.0.2","_id":"@edrlab/thorium-badges@1.0.2","maintainers":[{"name":"hadrien.gardeur","email":"hadrien.gardeur@gmail.com"},{"name":"danielweck","email":"daniel.weck@gmail.com"},{"name":"jaypanoz","email":"jiminy@chapalpanoz.com"},{"name":"llemeur","email":"laurent.lemeur@edrlab.org"}],"homepage":"https://github.com/edrlab/thorium-reader-website#readme","bugs":{"url":"https://github.com/edrlab/thorium-reader-website/issues"},"dist":{"shasum":"f144df99c5b50de3e5c9b2944603ada1554962fd","tarball":"https://registry.npmjs.org/@edrlab/thorium-badges/-/thorium-badges-1.0.2.tgz","fileCount":7,"integrity":"sha512-R8Ja0VzzX2EkGt4Wjzt4d5uelAL0AH+Szx79llocecxmvyBI3zXxltbPKnwoYhQaqBF5xpTd6Qgah3zyRVSGNA==","signatures":[{"sig":"MEQCIBK7o3cH/Eg+XNztBY1RJjrPudCkfvNAZKKjVykgjt+CAiBqINYdR0p39JipxOMNkBKEERQmR1cnEYu0oKXRxNKUyg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":35284},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","unpkg":"dist/thorium-badges.iife.js","module":"dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"4375d673cd6f3cd66781eaa89163c9002f8939f1","scripts":{"dev":"vite build --watch","build":"vite build && vite build --config vite.iife.config.ts","predev":"pnpm run generate","generate":"node scripts/generate-badge-texts.mjs","prebuild":"pnpm run generate"},"_npmUser":{"name":"jaypanoz","email":"jiminy@chapalpanoz.com"},"jsdelivr":"dist/thorium-badges.iife.js","repository":{"url":"git+https://github.com/edrlab/thorium-reader-website.git","type":"git","directory":"packages/thorium-badges"},"_npmVersion":"11.12.1","description":"Web components for embedding \"Add to Thorium Reader\" badges (catalog and publication) on any page.","directories":{},"_nodeVersion":"24.15.0","_hasShrinkwrap":false,"devDependencies":{"vite":"^7.3.3","typescript":"^5.9.3","vite-plugin-dts":"^5.0.3"},"_npmOperationalInternal":{"tmp":"tmp/thorium-badges_1.0.2_1786087671995_0.3756639360713041","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"_id":"@edrlab/thorium-badges@1.1.0","bugs":{"url":"https://github.com/edrlab/thorium-reader-website/issues"},"dist":{"shasum":"606c17cb4333cd14ad93e65874bf87120156f1e4","tarball":"https://registry.npmjs.org/@edrlab/thorium-badges/-/thorium-badges-1.1.0.tgz","fileCount":7,"integrity":"sha512-oQvSIZqP9quzjlL4s5CdqatxW7Y4+NYoSHzZ72Ma0NqTDZdJ+bbPs1iez3B05KYJiYTztGm7cwCI3p8XVzS/bA==","signatures":[{"sig":"MEUCIQCCvyFzYM1Lws4xldMZa957Xi8vLt8aHzYv8ajVeHUX3QIgYhVLDXv1NAdvfXHb3kpsL9rHDWW8SoWuoXCWvewsDds=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIF222paTQvOl+tLZt+r0CPSY1/BIMFDLPKunfXDgDP3XAiEApdWZtTUq4szKtBsHO0B/+YgiedMcjrBp/3J8Bqba2VE="}],"unpackedSize":36144},"main":"dist/index.js","name":"@edrlab/thorium-badges","type":"module","types":"./dist/index.d.ts","unpkg":"dist/thorium-badges.iife.js","module":"dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"e0ec54460e8ce805fdef4fdbbea6d4f40f34df60","scripts":{"dev":"vite build --watch","build":"vite build && vite build --config vite.iife.config.ts","predev":"pnpm run generate","generate":"node scripts/generate-badge-texts.mjs","prebuild":"pnpm run generate"},"version":"1.1.0","_npmUser":{"name":"jaypanoz","email":"jiminy@chapalpanoz.com"},"homepage":"https://github.com/edrlab/thorium-reader-website#readme","jsdelivr":"dist/thorium-badges.iife.js","repository":{"url":"git+https://github.com/edrlab/thorium-reader-website.git","type":"git","directory":"packages/thorium-badges"},"_npmVersion":"11.12.1","description":"Web components for embedding \"Add to Thorium Reader\" badges (catalog and publication) on any page.","directories":{},"maintainers":[{"name":"hadrien.gardeur","email":"hadrien.gardeur@gmail.com"},{"name":"danielweck","email":"daniel.weck@gmail.com"},{"name":"jaypanoz","email":"jiminy@chapalpanoz.com"},{"name":"llemeur","email":"laurent.lemeur@edrlab.org"}],"_nodeVersion":"24.15.0","_hasShrinkwrap":false,"devDependencies":{"vite":"^7.3.3","typescript":"^5.9.3","vite-plugin-dts":"^5.0.3"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/thorium-badges_1.1.0_1789126055596_0.9151963465957276"}}},"time":{"created":"2026-08-06T10:12:55.283Z","modified":"2026-09-11T11:27:35.862Z","1.0.0":"2026-08-06T10:12:55.595Z","1.0.1":"2026-08-07T07:20:52.735Z","1.0.2":"2026-08-07T07:27:52.138Z","1.1.0":"2026-09-11T11:27:35.681Z"},"bugs":{"url":"https://github.com/edrlab/thorium-reader-website/issues"},"homepage":"https://github.com/edrlab/thorium-reader-website#readme","repository":{"url":"git+https://github.com/edrlab/thorium-reader-website.git","type":"git","directory":"packages/thorium-badges"},"description":"Web components for embedding \"Add to Thorium Reader\" badges (catalog and publication) on any page.","maintainers":[{"name":"hadrien.gardeur","email":"hadrien.gardeur@gmail.com"},{"name":"danielweck","email":"daniel.weck@gmail.com"},{"name":"jaypanoz","email":"jiminy@chapalpanoz.com"},{"name":"llemeur","email":"laurent.lemeur@edrlab.org"}],"readme":"# @edrlab/thorium-badges\n\n![Add to Thorium Reader](assets/thorium-badge.png)\n\nWeb components for embedding \"Add to Thorium Reader\" badges on any page. Two custom elements are provided:\n\n- `<thorium-badge-catalog>` — adds a catalog (and optional bookshelf), OPDS or web, to Thorium Reader.\n- `<thorium-badge-publication>` — adds a single publication to Thorium Reader.\n\nEach element renders as a link — the inline SVG badge wrapped in an `<a>` to the corresponding Thorium universal link ([`/add/catalog`](https://www.thoriumreader.com/add/catalog) or [`/add/publication`](https://www.thoriumreader.com/add/publication)). Its required attributes must be set, or it throws (see below). Catalog/bookshelf URLs can be either OPDS feeds or plain web URLs; the publication URL is a direct link to a publication file.\n\n## Installation\n\n```sh\nnpm install @edrlab/thorium-badges\n```\n\n```sh\npnpm add @edrlab/thorium-badges\n```\n\n## Usage\n\n### As a package import\n\nImport the package once (for its side effect of registering the custom elements), then use the elements in markup:\n\n```js\nimport \"@edrlab/thorium-badges\";\n```\n\n```html\n<thorium-badge-catalog\n  title=\"My Library\"\n  main=\"https://example.com/catalog\"\n></thorium-badge-catalog>\n\n<thorium-badge-publication\n  publication=\"https://example.com/publication\"\n  title=\"My Book\"\n  author=\"Jane Doe\"\n></thorium-badge-publication>\n```\n\n### Via `<script src>` (no build step)\n\n`pnpm run build` also produces an IIFE bundle at `dist/thorium-badges.iife.js`, which self-registers both custom elements when loaded directly with a `<script src>` tag instead of being imported as a module — useful for hosting the bundle and letting third parties embed the badge without a build step. \n\nSince the package is also published to npm, the same bundle is available from unpkg or jsDelivr with no need to host it yourself:\n\n```html\n<script src=\"https://www.thoriumreader.com/embed/thorium-badges.js\"></script>\n<!-- or -->\n<script src=\"https://unpkg.com/@edrlab/thorium-badges\"></script>\n<!-- or -->\n<script src=\"https://cdn.jsdelivr.net/npm/@edrlab/thorium-badges\"></script>\n\n<thorium-badge-catalog title=\"My Library\" main=\"https://example.com/catalog\"></thorium-badge-catalog>\n```\n\n## Attributes\n\n### `<thorium-badge-catalog>`\n\n| Attribute            | Required | Description                                                  |\n| -------------------- | -------- | -------------------------------------------------------------- |\n| `title`              | ✓        | Catalog display name.                                          |\n| `main` / `bookshelf` | one of   | OPDS or web URL to browse the catalog and/or access the user's bookshelf. |\n| `passphrase`         |          | Plain-text passphrase, if the feed is protected.                |\n| `hashed-passphrase`  |          | Pre-hashed passphrase, as an alternative to `passphrase`.        |\n| `open-in`            |          | Where Thorium should open the catalog.                          |\n| `icon`               |          | URL of an icon to show for the catalog.                        |\n| `banner`             |          | URL of a banner image.                                          |\n| `color`              |          | Accent color for the catalog entry.                            |\n| `lang`               |          | Badge locale (`\"auto\"` to detect from the browser; unset behaves the same as `\"auto\"`). |\n\nThrows if `title` or at least one of `main`/`bookshelf` isn't set.\n\n### `<thorium-badge-publication>`\n\n| Attribute            | Required | Description                                            |\n| -------------------- | -------- | -------------------------------------------------------- |\n| `publication`        | ✓        | Direct URL to the publication file.                       |\n| `title`              |          | Publication title.                                       |\n| `author`             |          | Publication author.                                       |\n| `cover`              |          | URL of the cover image.                                   |\n| `passphrase`         |          | Plain-text passphrase, if the publication is protected.   |\n| `hashed-passphrase`  |          | Pre-hashed passphrase, as an alternative to `passphrase`. |\n| `lang`               |          | Badge locale (`\"auto\"` to detect from the browser; unset behaves the same as `\"auto\"`). |\n\nThrows if `publication` isn't set.\n\nAny attribute pointing to a URL (`main`, `bookshelf`, `icon`, `banner`, `publication`, `cover`) is also validated and throws if it isn't a well-formed URL.\n\n## Localization\n\nSupported `lang` values are `en`, `es`, `fi`, `fr`, `it`, `lt`, and `sl`.\n\n- Set `lang` to one of those codes to force that locale.\n- Leaving `lang` unset, or setting it to `\"auto\"`, matches the visitor's browser language (`navigator.languages`) against the supported list, using the first one that matches.\n- If that match fails to find a supported locale — or `lang` is any other unsupported value — the badge falls back to `en`.\n\n## Development\n\nFrom this package directory:\n\n```sh\npnpm run dev    # regenerate badge texts, then vite build --watch\npnpm run build  # regenerate badge texts, then build ESM + IIFE bundles into dist/\n```\n","readmeFilename":"README.md"}