Created/edited by GitHub Copilot; pending human review.
Package imports and exports
The toolkit has 3 packages. This page lists each package's import paths and the names each path exports. It's generated from the packages' export maps and type declarations.
Each package ships its own TypeScript types. To choose between the script tag and the packages, or to install a package, see Install and status.
Which release this describes
This page documents the code on the main branch. The source stamp is not an npm release or a development snapshot. This copy was built from commit 6fde603.
Install an exact npm version or use a version-pinned npm CDN module. The npm alpha tag moves between reviewed prereleases. It is not a main-build snapshot. Older pinned releases keep their own behavior and can lack APIs added since. Install and status lists package commands and jsDelivr/UNPKG files.
Register the elements
Import the web components package root once to register all the elements:
import "@sefaria/web-components";Only the package root registers elements. Element subpaths such as @sefaria/web-components/source-card, @sefaria/web-components/data-source, and @sefaria/web-components/reader-session export types and helpers. Import them alongside the package root, not instead of it.
The client package root re-exports the generated namespaces, contracts, schemas, validators, errors, validation helpers, and client factory. Import createSefariaClient from @sefaria/api-client or @sefaria/api-client/client. Import focused error and validation helpers from @sefaria/api-client/errors and @sefaria/api-client/validation.
@sefaria/api-client
Source-backed Sefaria API client with generated contracts, validators, and bounded caching. Package manifest version: 0.1.0-alpha.0. This is not evidence of publication. Reference.
| Import path | Exports |
|---|---|
@sefaria/api-client | 585 names; see the client reference |
@sefaria/api-client/client | SefariaCacheOptions, SefariaClient, SefariaClientOptions, createSefariaClient, requireSefariaClient |
@sefaria/api-client/contracts | 313 names; see the client reference |
@sefaria/api-client/errors | ContractIssue, SefariaContractError, SefariaContractErrorOptions |
@sefaria/api-client/schemas | 181 names; see the client reference |
@sefaria/api-client/validation | GeneratedResponseContract, ResponseSelector, ResponseValidationContext, ResponseValidatorLookup, ValidationResult, getResponseContract, getResponseValidator, validateExternalResponse, validateResponse |
@sefaria/api-client/validators | 65 names; see the client reference |
@sefaria/text-transform
Pure Sefaria text normalization, vocalization, footnote, and preview utilities. Package manifest version: 0.1.0-alpha.0. This is not evidence of publication. Reference.
| Import path | Exports |
|---|---|
@sefaria/text-transform | CommentaryReference, NormalizeTextOptions, NormalizedFootnote, NormalizedText, PaseqMode, TextPreview, VocalizationMode, VocalizationOptions, applyVocalization, applyVocalizationToHtml, createTextPreview, normalizeText |
@sefaria/web-components
Declarative Sefaria web components backed by corrected client payloads and safe text transforms. Package manifest version: 0.1.0-alpha.0. This is not evidence of publication. Reference.
| Import path | Exports |
|---|---|
@sefaria/web-components | BilingualPairContentLanguage, BilingualPairLayout, BilingualPairSide, BilingualPairSideOrder, BilingualSegmentContentLanguage, BilingualSegmentEditionSelection, BilingualSegmentLayout, BilingualSegmentRequest, BilingualSegmentSide, BilingualSegmentSideOrder, CONNECTIONS_PAGE_SIZE, ConnectionsProjection, ConnectionsRequest, ReaderPane, SefariaBilingualSegment, SefariaConnectionsPanel, SefariaDataLoader, SefariaDataLoaderResponse, SefariaDataSource, SefariaElement, SefariaElementStatus, SefariaLinksLoadRequest, SefariaReader, SefariaSourceCard, SefariaTextLoadRequest, SefariaTextSegment, SourceCardRequest, TextSegmentReferenceData, TextSegmentRequest, TextSegmentSelectedData, TextSegmentSelectedVersion, TextSegmentSelectedVersionInfo, TextSegmentVersionMetadata, TextSegmentVersionSelection, configureSefariaDataSource, sefariaTokenDefaults |
@sefaria/web-components/data-source | SefariaDataLoader, SefariaDataLoaderResponse, SefariaDataSource, SefariaLinksLoadRequest, SefariaTextLoadRequest, configureSefariaDataSource |
@sefaria/web-components/bilingual-segment | BilingualSegmentEditionSelection, BilingualSegmentRequest, BilingualSegmentSide |
@sefaria/web-components/connections-panel | CONNECTIONS_PAGE_SIZE, ConnectionsProjection, ConnectionsRequest |
@sefaria/web-components/reader | ReaderPane, ReaderRecordLoader, ReaderResolvedSource, createSefariaReaderRecordLoader, resolveReaderSource |
@sefaria/web-components/reader-session | ReaderBreadcrumb, ReaderConnectionsRecord, ReaderEntryInfo, ReaderOperationHandle, ReaderPinHandle, ReaderPresentation, ReaderPresentationPatch, ReaderSession, ReaderSessionConnectionsSeed, ReaderSessionOptions, ReaderSessionSeed, ReaderSessionSourceSeed, ReaderSessionState, ReaderSourceRecord, ReaderTransition, ReaderTransitionRejection, createReaderSession |
@sefaria/web-components/source-card | SourceCardRequest |
@sefaria/web-components/text-segment | TextSegmentReferenceData, TextSegmentRequest, TextSegmentSelectedData, TextSegmentSelectedVersion, TextSegmentSelectedVersionInfo, TextSegmentVersionMetadata, TextSegmentVersionSelection |
Where to go next
- Install and status explains how to install the packages.
- Use with a framework shows the package import in a build.