a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky
atproto bluesky typescript npm
105
fork

Configure Feed

Select the types of activity you want to include in your feed.

README.md

@atcute/leaflet#

Leaflet (pub.leaflet.*) schema definitions

npm install @atcute/leaflet

usage#

import { PubLeafletDocument } from '@atcute/leaflet';
import { is } from '@atcute/lexicons';

const document: PubLeafletDocument.Main = {
	$type: 'pub.leaflet.document',
	title: 'Article title',
	author: 'did:plc:ia76kvnndjutgedggx2ibrem',
	description: 'Article description',
	publication: 'at://did:plc:ia76kvnndjutgedggx2ibrem/pub.leaflet.publication/3lpyvgcwc722m',
	publishedAt: '2025-05-25T14:44:37.870Z',
	pages: [
		{
			$type: 'pub.leaflet.pages.linearDocument',
			blocks: [
				{
					$type: 'pub.leaflet.pages.linearDocument#block',
					block: {
						$type: 'pub.leaflet.blocks.text',
						facets: [{ index: { byteEnd: 12, byteStart: 0 }, features: [] }],
						plaintext: 'Hello world!',
					},
				},
				{
					$type: 'pub.leaflet.pages.linearDocument#block',
					block: {
						$type: 'pub.leaflet.blocks.text',
						facets: [
							{
								index: { byteEnd: 9, byteStart: 0 },
								features: [{ $type: 'pub.leaflet.richtext.facet#bold' }],
							},
						],
						plaintext: 'Bold text',
					},
				},
				{
					$type: 'pub.leaflet.pages.linearDocument#block',
					block: {
						$type: 'pub.leaflet.blocks.text',
						facets: [
							{
								index: { byteEnd: 11, byteStart: 0 },
								features: [{ $type: 'pub.leaflet.richtext.facet#italic' }],
							},
						],
						plaintext: 'Italic text',
					},
				},
				{
					$type: 'pub.leaflet.pages.linearDocument#block',
					block: {
						$type: 'pub.leaflet.blocks.text',
						facets: [
							{
								index: { byteEnd: 16, byteStart: 0 },
								features: [
									{ $type: 'pub.leaflet.richtext.facet#bold' },
									{ $type: 'pub.leaflet.richtext.facet#italic' },
								],
							},
						],
						plaintext: 'Bold italic text',
					},
				},
				{
					$type: 'pub.leaflet.pages.linearDocument#block',
					block: { $type: 'pub.leaflet.blocks.text', facets: [], plaintext: '' },
				},
			],
		},
	],
};

is(PubLeafletDocument.mainSchema, document);
// -> true

with @atcute/client#

pick either one of these 3 options to register the ambient declarations

// tsconfig.json
{
	"compilerOptions": {
		"types": ["@atcute/leaflet"],
	},
}
// env.d.ts
/// <reference types="@atcute/leaflet" />
// index.ts
import type {} from '@atcute/leaflet';

now all the XRPC operations should be visible in the client

with @atcute/lex-cli#

when building your own lexicons that reference Leaflet types, configure lex-cli to import from this package:

// file: lex.config.js
import { defineLexiconConfig } from '@atcute/lex-cli';

export default defineLexiconConfig({
	files: ['lexicons/**/*.json'],
	outdir: 'src/lexicons/',
	imports: ['@atcute/leaflet'],
});