{"_id":"@daviddarnes/bluesky-replies","name":"@daviddarnes/bluesky-replies","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@daviddarnes/bluesky-replies","version":"1.0.0","description":"A Web Component to display Bluesky post replies","main":"bluesky-replies.js","scripts":{"start":"npx http-server ."},"repository":{"type":"git","url":"git+https://github.com/daviddarnes/bluesky-replies.git"},"keywords":["web","component","components","web components","custom elements"],"license":"MIT","publishConfig":{"access":"public"},"bugs":{"url":"https://github.com/daviddarnes/bluesky-replies/issues"},"author":{"name":"David Darnes","email":"me@daviddarnes.com","url":"https://darn.es/"},"homepage":"https://github.com/daviddarnes/bluesky-replies#readme","gitHead":"bcdb7e11995ca92c8b29eef3464620faea3f7c3f","_id":"@daviddarnes/bluesky-replies@1.0.0","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-GImK7wSB67jh/iNlFtZDWx56yZ8O7/1BDKmFO8e3VyrwdnLk5/bOU2dinMtF8uOfUR7iAI/YJpCmqgpRaRTa0g==","shasum":"b0664e2acd80411b84c114a34704e7065c6cc94d","tarball":"https://registry.npmjs.org/@daviddarnes/bluesky-replies/-/bluesky-replies-1.0.0.tgz","fileCount":10,"unpackedSize":16019,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD6qy9w42RdbNHu6j1+8578NssjcSVn/jgfNf5sE7Nb6gIhAMHUzJCb1ZC+GREbaIha3dpZYoTHfYdi6F2o2KbM3pMC"}]},"_npmUser":{"name":"daviddarnes","email":"me@daviddarnes.com"},"directories":{},"maintainers":[{"name":"daviddarnes","email":"me@daviddarnes.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bluesky-replies_1.0.0_1733506159364_0.5931543212227584"},"_hasShrinkwrap":false}},"time":{"created":"2024-12-06T17:29:19.250Z","1.0.0":"2024-12-06T17:29:19.519Z","modified":"2024-12-06T17:29:19.791Z"},"maintainers":[{"name":"daviddarnes","email":"me@daviddarnes.com"}],"description":"A Web Component to display Bluesky post replies","homepage":"https://github.com/daviddarnes/bluesky-replies#readme","keywords":["web","component","components","web components","custom elements"],"repository":{"type":"git","url":"git+https://github.com/daviddarnes/bluesky-replies.git"},"author":{"name":"David Darnes","email":"me@daviddarnes.com","url":"https://darn.es/"},"bugs":{"url":"https://github.com/daviddarnes/bluesky-replies/issues"},"license":"MIT","readme":"# `bluesky-replies`\n\nA Web Component to display Bluesky post replies.\n\n**[Demo](https://daviddarnes.github.io/bluesky-replies/demo.html)** | **[Further reading](https://darn.es/bluesky-replies-web-component/)**\n\n## Examples\n\nGeneral usage example:\n\n```html\n<script type=\"module\" src=\"bluesky-replies.js\"></script>\n\n<bluesky-replies>\n  <a href=\"https://bsky.app/profile/darn.es/post/3laucrkat3s2c\">\n    Discuss on Bluesky\n  </a>\n</bluesky-replies>\n```\n\nExample usage combined with [`bluesky-post`](https://darn.es/bluesky-post-web-component/):\n\n```html\n<script type=\"module\" src=\"bluesky-replies.js\"></script>\n<script type=\"module\" src=\"bluesky-post.js\"></script>\n\n<bluesky-replies>\n  <bluesky-post>\n    <a href=\"https://bsky.app/profile/darn.es/post/3laucrkat3s2c\">\n      Discuss on Bluesky\n    </a>\n  </bluesky-post>\n</bluesky-replies>\n```\n\nExample using a custom template:\n\n```html\n<script type=\"module\" src=\"bluesky-replies.js\"></script>\n\n<template id=\"bluesky-replies-template\">\n  <ul>\n    <li data-key=\"reply\">\n      <details>\n        <summary data-key=\"author.handle\"></summary>\n        <span data-key=\"record.text\"></span>\n      </details>\n    </li>\n  </ul>\n</template>\n\n<bluesky-replies>\n  <a href=\"https://bsky.app/profile/darn.es/post/3laucrkat3s2c\">\n    Discuss on Bluesky\n  </a>\n</bluesky-replies>\n```\n\n## Features\n\nThis Web Component allows you to:\n\n- Turn a regular Bluesky post link into a list of replies to that post\n- Surface reply metadata alongside the reply, e.g. reply count, repost count, like count\n- Use a custom template for all instances of the component on the page using a `data-key=\"name\"` data attributes\n- Use a custom template for specific instances using the `template` attribute\n- Retrieve nested data using the `data-key` attribute and typical JavaScript key referencing, e.g. `data-key=\"reocrd.text\"`\n\n## Installation\n\nYou have a few options (choose one of these):\n\n1. Install via [npm](https://www.npmjs.com/package/@daviddarnes/bluesky-replies): `npm install @daviddarnes/bluesky-replies`\n1. [Download the source manually from GitHub](https://github.com/daviddarnes/bluesky-replies/releases) into your project.\n1. Skip this step and use the script directly via a 3rd party CDN (not recommended for production use)\n\n### Usage\n\nMake sure you include the `<script>` in your project (choose one of these):\n\n```html\n<!-- Host yourself -->\n<script type=\"module\" src=\"bluesky-replies.js\"></script>\n```\n\n```html\n<!-- 3rd party CDN, not recommended for production use -->\n<script\n  type=\"module\"\n  src=\"https://www.unpkg.com/@daviddarnes/bluesky-replies@1.0.0/bluesky-replies.js\"\n></script>\n```\n\n```html\n<!-- 3rd party CDN, not recommended for production use -->\n<script\n  type=\"module\"\n  src=\"https://esm.sh/@daviddarnes/bluesky-replies@1.0.0\"\n></script>\n```\n\n### Using a custom template\n\nThe default template for the component looks like this:\n\n```html\n<ul>\n  <li data-key=\"reply\">\n    <figure>\n      <figcaption>\n        <cite data-key=\"author.displayName\"></cite>\n      </figcaption>\n      <blockquote data-key=\"record.text\"></blockquote>\n    </figure>\n  </li>\n</ul>\n```\n\nHowever you can customise the template by using a `<template>` element with an `id` of `bluesky-replies-template`, which will be used for every instance of the component on the page. Here's an example which just exposes the vanity metrics of the Bluesky post as a `<dl>`:\n\n```html\n<template id=\"bluesky-replies-template\">\n  <ul>\n    <li data-key=\"reply\">\n      <details>\n        <summary data-key=\"author.handle\"></summary>\n        <span data-key=\"record.text\"></span>\n      </details>\n    </li>\n  </ul>\n</template>\n```\n\nYou can also use different templates on the same page by using the `template` attribute to target `<template>` elements with a specific `id`:\n\n```html\n<template id=\"custom-template\">\n  <ul>\n    <li data-key=\"reply\">\n      <strong data-key=\"author.displayName\"></strong>\n      <span data-key=\"record.text\"></span>\n    </li>\n  </ul>\n</template>\n\n<bluesky-replies template=\"custom-template\">\n  <a href=\"https://bsky.app/profile/darn.es/post/3laucrkat3s2c\">\n    Discuss on Bluesky\n  </a>\n</bluesky-replies>\n```\n\nData is applied using a `data-key` data attribute. The value of this attribute should correspond to a data point within a [Bluesky public post API response](https://docs.bsky.app/docs/api/app-bsky-feed-get-posts). The official Bluesky documentation has [an example of a status response here](https://docs.bsky.app/docs/api/app-bsky-feed-get-posts#responses).\n\nThe only `data-key` value unique to `bluesky-replies` is the `reply` value, which denotes the element which will be used to iterate for each reply, which will often be an `li` element or similar.\n\n_Note that for `<a>` and `<img>` elements the value won't be applied to it's content if the string being returned starts with `http` and instead will be applied to the `href` and `src` attributes respectively._\n\nCheck out the [custom template demo](https://daviddarnes.github.io/bluesky-replies/demo-custom-template.html) as well as [the source code](https://github.com/daviddarnes/bluesky-replies/blob/main/demo-custom-template.html) for reference.\n\n## Credit\n\nWith thanks to the following people:\n\n- [Zach Leatherman](https://zachleat.com) for inspiring this [Web Component repo template](https://github.com/daviddarnes/component-template)\n","readmeFilename":"README.md"}