···11+Permission is hereby granted, free of charge, to any person obtaining a copy
22+of this software and associated documentation files (the "Software"), to deal
33+in the Software without restriction, including without limitation the rights
44+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
55+copies of the Software, and to permit persons to whom the Software is
66+furnished to do so, subject to the following conditions:
77+88+The above copyright notice and this permission notice shall be included in all
99+copies or substantial portions of the Software.
1010+1111+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1212+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1313+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1414+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1515+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1616+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1717+SOFTWARE.
+12
README.md
···11+# <bluesky-embed>
22+33+> [!CAUTION]
44+> This is a new, work-in-progress version of `bluesky-post-embed`, things aren't done yet.
55+66+A custom element for embedding Bluesky posts.
77+88+- **Lightweight**, the entire package + dependencies is only ~20 KB (~6 KB gzipped)
99+- **Standalone**, no middleman involved, directly calls Bluesky's API
1010+- **Server-side rendering possible**, allows for no-JavaScript usage
1111+1212+
···11+# <bluesky-post-embed>
22+33+> [!CAUTION]
44+> This is a new, work-in-progress version of `bluesky-post-embed`, things aren't done yet.
55+66+A custom element for embedding Bluesky posts.
77+88+## Installation
99+1010+### via npm
1111+1212+```
1313+npm install bluesky-post-embed
1414+```
1515+1616+then, import the package on your app.
1717+1818+```js
1919+import 'bluesky-post-embed';
2020+2121+import 'bluesky-post-embed/style.css';
2222+import 'bluesky-post-embed/themes/light.css';
2323+```
2424+2525+## Usage
2626+2727+```html
2828+<bluesky-post src="at://did:plc:ragtjsm2j2vknwkz3zp4oxrd/app.bsky.feed.post/3kj2umze7zj2n">
2929+ <blockquote class="bluesky-post-fallback">
3030+ <p dir="auto">angel mode</p>
3131+ — Paul Frazee (@pfrazee.com)
3232+ <a href="https://bsky.app/profile/did:plc:ragtjsm2j2vknwkz3zp4oxrd/post/3kj2umze7zj2n"
3333+ >January 16, 2024 at 9:11 AM</a
3434+ >
3535+ </blockquote>
3636+</bluesky-post>
3737+```
3838+3939+### Attributes
4040+4141+- `src` **Required**
4242+ AT-URI of the post record
4343+- `contextless` **Optional**
4444+ Whether to show the post without any context (no parent reply)
4545+- `allow-unauthenticated` **Optional**
4646+ Whether to allow unauthenticated viewing
4747+- `service-uri` **Optional**
4848+ URL to an AppView service, defaults to `https://public.api.bsky.app`
4949+5050+### Events
5151+5252+- `loaded`
5353+ Fired when the embed has successfully loaded the post
5454+- `error`
5555+ Fired when the embed fails to load the post
5656+5757+## SSR usage
5858+5959+The embeds are powered by a static HTML renderer, this renderer can be used directly in your
6060+server-rendering framework of choice for a zero-JS experience.
6161+6262+```tsx
6363+import { fetchPost, renderPost } from 'bluesky-post-embed/core';
6464+6565+import 'bluesky-post-embed/style.css';
6666+import 'bluesky-post-embed/themes/light.css';
6767+6868+// fetch the post
6969+const controller = new AbortController();
7070+const data = await fetchPost({
7171+ src: `at://did:plc:ragtjsm2j2vknwkz3zp4oxrd/app.bsky.feed.post/3kj2umze7zj2n`,
7272+ signal: controller.signal,
7373+});
7474+7575+// render the post
7676+const html = renderPost(data);
7777+return (
7878+ <bluesky-post
7979+ src={data.thread?.post.uri}
8080+ dangerouslySetInnerHTML={{ __html: html }}
8181+ ></bluesky-post>
8282+);
8383+```
8484+8585+Check out examples for [Astro](https://github.com/mary-ext/bluesky-embed-astro) and
8686+[SvelteKit](https://github.com/mary-ext/bluesky-embed-sveltekit).
···11+# <bluesky-profile-feed-embed>
22+33+> [!CAUTION]
44+> This is a new, work-in-progress version of `bluesky-post-embed`, things aren't done yet.
55+66+A custom element for embedding Bluesky profile feeds.
77+88+## Installation
99+1010+### via npm
1111+1212+```
1313+npm install bluesky-profile-feed-embed
1414+```
1515+1616+then, import the package on your app.
1717+1818+```js
1919+import 'bluesky-profile-feed-embed';
2020+2121+import 'bluesky-profile-feed-embed/style.css';
2222+import 'bluesky-profile-feed-embed/themes/light.css';
2323+```
2424+2525+## Usage
2626+2727+```html
2828+<bluesky-profile-feed actor="did:plc:ragtjsm2j2vknwkz3zp4oxrd" include-pins>
2929+ <a
3030+ target="_blank"
3131+ href="https://bsky.app/profile/did:plc:ragtjsm2j2vknwkz3zp4oxrd"
3232+ class="bluesky-profile-feed-fallback"
3333+ >
3434+ Posts by Paul Frazee (@pfrazee.com)
3535+ </a>
3636+</bluesky-profile-feed>
3737+```
3838+3939+### Attributes
4040+4141+- `actor` **Required**
4242+ DID or handle of the account
4343+- `include-pins` **Optional**
4444+ Whether to show pinned posts
4545+- `allow-unauthenticated` **Optional**
4646+ Whether to allow unauthenticated viewing
4747+- `service-uri` **Optional**
4848+ URL to an AppView service, defaults to `https://public.api.bsky.app`
4949+5050+### Events
5151+5252+- `loaded`
5353+ Fired when the embed has successfully loaded the post
5454+- `error`
5555+ Fired when the embed fails to load the post
5656+5757+## SSR usage
5858+5959+The embeds are powered by a static HTML renderer, this renderer can be used directly in your
6060+server-rendering framework of choice for a zero-JS experience.
6161+6262+```tsx
6363+import { fetchProfileFeed, renderProfileFeed } from 'bluesky-profile-feed-embed/core';
6464+6565+import 'bluesky-post-embed/style.css';
6666+import 'bluesky-post-embed/themes/light.css';
6767+6868+// fetch the profile
6969+const controller = new AbortController();
7070+const data = await fetchProfileFeed({
7171+ actor: `did:plc:ragtjsm2j2vknwkz3zp4oxrd`,
7272+ includePins: true,
7373+ signal: controller.signal,
7474+});
7575+7676+// render the profile
7777+const html = renderProfileFeed(data);
7878+return (
7979+ <bluesky-profile-feed
8080+ src={data.thread?.post.uri}
8181+ dangerouslySetInnerHTML={{ __html: html }}
8282+ ></bluesky-profile-feed>
8383+);
8484+```
8585+8686+Check out examples for [Astro](https://github.com/mary-ext/bluesky-embed-astro) and
8787+[SvelteKit](https://github.com/mary-ext/bluesky-embed-sveltekit).