@faith-tools/bible-sdk 0.0.0-stage → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ import { type ReferenceLayout } from "./scripture-passage";
2
+ import { type ProviderOptions } from "./providers";
3
+ export type CardOptions = ProviderOptions & {
4
+ /** How the card's passage shows its reference, as on <si-passage>. */
5
+ reference: ReferenceLayout;
6
+ };
7
+ /**
8
+ * One Scripture card per page, rendered in a Shadow DOM so the host page's
9
+ * CSS cannot reach it. `toggle(anchor)` opens it above the anchor.
10
+ */
11
+ export declare function createScriptureCard({ reference, ...options }: CardOptions): {
12
+ toggle(target: HTMLElement): void;
13
+ hover: (target: HTMLElement) => void;
14
+ unhover: (event?: PointerEvent) => void;
15
+ close: (immediate?: boolean) => void;
16
+ /** Closes the card at once if its link left the page, as when a router swaps the body. */
17
+ closeIfDetached(): void;
18
+ /** Closes the card at once and removes its host from the page. */
19
+ destroy(): void;
20
+ };
@@ -0,0 +1,206 @@
1
+ import { Effect, Layer } from "effect";
2
+ import { type BibleProvider } from "./providers.js";
3
+ import { BibleSource, ScriptureError, type BibleDataProvider } from "./data-types.js";
4
+ export { BibleBook, BibleChapter, BibleSource, BibleVersion, DisplayInstruction, ScriptureError, ScriptureErrorCode, ScripturePassage } from "./data-types.js";
5
+ export type { BibleDataProvider, BibleDisplayProvider } from "./data-types.js";
6
+ export { RequestPolicy } from "./runtime.js";
7
+ /** Service-based programs can use a test or application Layer without constructing a client. */
8
+ export declare const scripture: {
9
+ listVersions: () => Effect.Effect<readonly {
10
+ readonly id: string;
11
+ readonly abbreviation: string;
12
+ readonly title: string;
13
+ readonly language?: string | undefined;
14
+ readonly languageName?: string | undefined;
15
+ }[], ScriptureError, BibleSource>;
16
+ listBooks: (args_0?: {
17
+ versionId?: string;
18
+ } | undefined) => Effect.Effect<readonly {
19
+ readonly id: string;
20
+ readonly title: string;
21
+ }[], ScriptureError, BibleSource>;
22
+ listChapters: (args_0: {
23
+ versionId?: string;
24
+ bookId: string;
25
+ }) => Effect.Effect<readonly {
26
+ readonly passageId: string;
27
+ readonly number: number;
28
+ }[], ScriptureError, BibleSource>;
29
+ getPassage: (args_0: {
30
+ versionId?: string;
31
+ passageId: string;
32
+ }) => Effect.Effect<{
33
+ readonly provider: string;
34
+ readonly source: {
35
+ readonly url: string;
36
+ readonly versionId: string;
37
+ };
38
+ readonly requestedPassageId: string;
39
+ readonly passageId: string;
40
+ readonly reference: string;
41
+ readonly text: string;
42
+ readonly version: {
43
+ readonly id: string;
44
+ readonly abbreviation: string;
45
+ readonly title: string;
46
+ readonly language?: string | undefined;
47
+ readonly languageName?: string | undefined;
48
+ readonly sourceLanguage?: string | undefined;
49
+ };
50
+ readonly attribution: {
51
+ readonly text: string;
52
+ readonly urls: readonly string[];
53
+ };
54
+ readonly publisher?: {
55
+ readonly copyrightHtml: string;
56
+ readonly infoHtml: string;
57
+ } | undefined;
58
+ readonly reporting?: {
59
+ readonly kind: "api-bible-fums";
60
+ readonly token: string;
61
+ } | undefined;
62
+ readonly cache?: {
63
+ readonly expiresAt: number;
64
+ } | undefined;
65
+ readonly licenses: readonly {
66
+ readonly name?: string | undefined;
67
+ readonly url: string;
68
+ readonly restrictions?: {
69
+ readonly [x: string]: string | boolean;
70
+ } | undefined;
71
+ }[];
72
+ readonly numbering: "kjv" | "unknown";
73
+ readonly sourceLimitations?: readonly {
74
+ readonly kind: "source-trimming";
75
+ readonly startPassageId: string;
76
+ readonly endPassageId: string;
77
+ readonly appliesToRequest: boolean;
78
+ }[] | undefined;
79
+ readonly display: {
80
+ readonly format: "text";
81
+ readonly whitespace: "pre-wrap";
82
+ readonly attributionPlacement: "after-passage";
83
+ readonly direction?: "ltr" | "rtl" | undefined;
84
+ readonly language?: string | undefined;
85
+ readonly nativeHtml?: {
86
+ readonly containerAttributes: {
87
+ readonly [x: string]: string;
88
+ };
89
+ readonly stylesheets: readonly {
90
+ readonly kind: "bible" | "font";
91
+ readonly href: string;
92
+ }[];
93
+ } | undefined;
94
+ };
95
+ readonly instructions: readonly {
96
+ readonly code: string;
97
+ readonly level: "notice" | "recommended" | "required";
98
+ readonly appliesTo: "all" | "html" | "text";
99
+ readonly text: string;
100
+ readonly urls?: readonly string[] | undefined;
101
+ }[];
102
+ }, ScriptureError, BibleSource>;
103
+ clearCache: Effect.Effect<void, never, BibleSource>;
104
+ };
105
+ /** One source per client. Effects are lazy; run them at the application boundary. */
106
+ export declare function createScriptureClient({ provider }?: {
107
+ provider?: BibleProvider | BibleDataProvider;
108
+ }): {
109
+ provider: string;
110
+ layer: Layer.Layer<BibleSource, never, never>;
111
+ listVersions: () => Effect.Effect<readonly {
112
+ readonly id: string;
113
+ readonly abbreviation: string;
114
+ readonly title: string;
115
+ readonly language?: string | undefined;
116
+ readonly languageName?: string | undefined;
117
+ }[], ScriptureError, never>;
118
+ listBooks: (options?: {
119
+ versionId?: string;
120
+ }) => Effect.Effect<readonly {
121
+ readonly id: string;
122
+ readonly title: string;
123
+ }[], ScriptureError, never>;
124
+ listChapters: (options: {
125
+ versionId?: string;
126
+ bookId: string;
127
+ }) => Effect.Effect<readonly {
128
+ readonly passageId: string;
129
+ readonly number: number;
130
+ }[], ScriptureError, never>;
131
+ getPassage: (options: {
132
+ versionId?: string;
133
+ passageId: string;
134
+ }) => Effect.Effect<{
135
+ readonly provider: string;
136
+ readonly source: {
137
+ readonly url: string;
138
+ readonly versionId: string;
139
+ };
140
+ readonly requestedPassageId: string;
141
+ readonly passageId: string;
142
+ readonly reference: string;
143
+ readonly text: string;
144
+ readonly version: {
145
+ readonly id: string;
146
+ readonly abbreviation: string;
147
+ readonly title: string;
148
+ readonly language?: string | undefined;
149
+ readonly languageName?: string | undefined;
150
+ readonly sourceLanguage?: string | undefined;
151
+ };
152
+ readonly attribution: {
153
+ readonly text: string;
154
+ readonly urls: readonly string[];
155
+ };
156
+ readonly publisher?: {
157
+ readonly copyrightHtml: string;
158
+ readonly infoHtml: string;
159
+ } | undefined;
160
+ readonly reporting?: {
161
+ readonly kind: "api-bible-fums";
162
+ readonly token: string;
163
+ } | undefined;
164
+ readonly cache?: {
165
+ readonly expiresAt: number;
166
+ } | undefined;
167
+ readonly licenses: readonly {
168
+ readonly name?: string | undefined;
169
+ readonly url: string;
170
+ readonly restrictions?: {
171
+ readonly [x: string]: string | boolean;
172
+ } | undefined;
173
+ }[];
174
+ readonly numbering: "kjv" | "unknown";
175
+ readonly sourceLimitations?: readonly {
176
+ readonly kind: "source-trimming";
177
+ readonly startPassageId: string;
178
+ readonly endPassageId: string;
179
+ readonly appliesToRequest: boolean;
180
+ }[] | undefined;
181
+ readonly display: {
182
+ readonly format: "text";
183
+ readonly whitespace: "pre-wrap";
184
+ readonly attributionPlacement: "after-passage";
185
+ readonly direction?: "ltr" | "rtl" | undefined;
186
+ readonly language?: string | undefined;
187
+ readonly nativeHtml?: {
188
+ readonly containerAttributes: {
189
+ readonly [x: string]: string;
190
+ };
191
+ readonly stylesheets: readonly {
192
+ readonly kind: "bible" | "font";
193
+ readonly href: string;
194
+ }[];
195
+ } | undefined;
196
+ };
197
+ readonly instructions: readonly {
198
+ readonly code: string;
199
+ readonly level: "notice" | "recommended" | "required";
200
+ readonly appliesTo: "all" | "html" | "text";
201
+ readonly text: string;
202
+ readonly urls?: readonly string[] | undefined;
203
+ }[];
204
+ }, ScriptureError, never>;
205
+ clearCache: () => Effect.Effect<void, never, never>;
206
+ };
@@ -0,0 +1,21 @@
1
+ import { Duration, Effect, Schema } from "effect";
2
+ import { ScriptureError, type DisplayInstruction } from "./data-types.js";
3
+ /** Validate before passing source metadata to Intl constructors. */
4
+ export declare const SourceLanguage: Schema.String;
5
+ export declare const escapeHtml: (text: string) => string;
6
+ export declare function attributionLink(text: string, url: string): string;
7
+ /** Structural validation only. Availability always comes from the selected source. */
8
+ export declare const passageRange: (passageId: string) => Effect.Effect<{
9
+ readonly book: string;
10
+ readonly chapter: number;
11
+ readonly first?: number | undefined;
12
+ readonly last?: number | undefined;
13
+ }, ScriptureError, never>;
14
+ export declare const bookId: (value: string) => Effect.Effect<string, ScriptureError, never>;
15
+ export declare function validateVerses(numbers: readonly number[], first?: number, last?: number): Effect.Effect<void, ScriptureError>;
16
+ export declare function textInstructions(): DisplayInstruction[];
17
+ /** Bounded Effect cache. Failed exits expire immediately and lookups inherit caller services. */
18
+ export declare function requestCache(timeToLive?: Duration.Input): {
19
+ get<T>(key: string, load: () => Effect.Effect<T, ScriptureError>): Effect.Effect<T, ScriptureError>;
20
+ clear: Effect.Effect<void, never, never>;
21
+ };
@@ -0,0 +1,125 @@
1
+ import { Context, Duration, Effect, Schema } from "effect";
2
+ import type { PassageDisplay } from "./providers.js";
3
+ export declare const BibleVersion: Schema.Struct<{
4
+ readonly id: Schema.NonEmptyString;
5
+ readonly abbreviation: Schema.String;
6
+ readonly title: Schema.String;
7
+ readonly language: Schema.optional<Schema.String>;
8
+ readonly languageName: Schema.optional<Schema.String>;
9
+ }>;
10
+ export type BibleVersion = typeof BibleVersion.Type;
11
+ export declare const DisplayInstruction: Schema.Struct<{
12
+ readonly code: Schema.NonEmptyString;
13
+ readonly level: Schema.Literals<readonly ["required", "recommended", "notice"]>;
14
+ readonly appliesTo: Schema.Literals<readonly ["all", "text", "html"]>;
15
+ readonly text: Schema.NonEmptyString;
16
+ readonly urls: Schema.optional<Schema.$Array<Schema.String>>;
17
+ }>;
18
+ export type DisplayInstruction = typeof DisplayInstruction.Type;
19
+ export declare const BibleBook: Schema.Struct<{
20
+ readonly id: Schema.NonEmptyString;
21
+ readonly title: Schema.String;
22
+ }>;
23
+ export type BibleBook = typeof BibleBook.Type;
24
+ export declare const BibleChapter: Schema.Struct<{
25
+ readonly passageId: Schema.NonEmptyString;
26
+ readonly number: Schema.Int;
27
+ }>;
28
+ export type BibleChapter = typeof BibleChapter.Type;
29
+ export declare const ScripturePassage: Schema.Struct<{
30
+ readonly provider: Schema.NonEmptyString;
31
+ readonly source: Schema.Struct<{
32
+ readonly url: Schema.String;
33
+ readonly versionId: Schema.NonEmptyString;
34
+ }>;
35
+ readonly requestedPassageId: Schema.NonEmptyString;
36
+ readonly passageId: Schema.NonEmptyString;
37
+ readonly reference: Schema.String;
38
+ readonly text: Schema.String;
39
+ readonly version: Schema.Struct<{
40
+ readonly id: Schema.NonEmptyString;
41
+ readonly abbreviation: Schema.String;
42
+ readonly title: Schema.String;
43
+ readonly language: Schema.optional<Schema.String>;
44
+ readonly languageName: Schema.optional<Schema.String>;
45
+ readonly sourceLanguage: Schema.optional<Schema.String>;
46
+ }>;
47
+ readonly attribution: Schema.Struct<{
48
+ readonly text: Schema.NonEmptyString;
49
+ readonly urls: Schema.$Array<Schema.String>;
50
+ }>;
51
+ readonly publisher: Schema.optional<Schema.Struct<{
52
+ readonly copyrightHtml: Schema.String;
53
+ readonly infoHtml: Schema.String;
54
+ }>>;
55
+ readonly reporting: Schema.optional<Schema.Struct<{
56
+ readonly kind: Schema.Literal<"api-bible-fums">;
57
+ readonly token: Schema.NonEmptyString;
58
+ }>>;
59
+ readonly cache: Schema.optional<Schema.Struct<{
60
+ readonly expiresAt: Schema.Number;
61
+ }>>;
62
+ readonly licenses: Schema.$Array<Schema.Struct<{
63
+ readonly name: Schema.optional<Schema.String>;
64
+ readonly url: Schema.String;
65
+ readonly restrictions: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Boolean, Schema.String]>>>;
66
+ }>>;
67
+ readonly numbering: Schema.Literals<readonly ["kjv", "unknown"]>;
68
+ readonly sourceLimitations: Schema.optional<Schema.$Array<Schema.Struct<{
69
+ readonly kind: Schema.Literal<"source-trimming">;
70
+ readonly startPassageId: Schema.NonEmptyString;
71
+ readonly endPassageId: Schema.NonEmptyString;
72
+ readonly appliesToRequest: Schema.Boolean;
73
+ }>>>;
74
+ readonly display: Schema.Struct<{
75
+ readonly format: Schema.Literal<"text">;
76
+ readonly whitespace: Schema.Literal<"pre-wrap">;
77
+ readonly attributionPlacement: Schema.Literal<"after-passage">;
78
+ readonly direction: Schema.optional<Schema.Literals<readonly ["ltr", "rtl"]>>;
79
+ readonly language: Schema.optional<Schema.String>;
80
+ readonly nativeHtml: Schema.optional<Schema.Struct<{
81
+ readonly containerAttributes: Schema.$Record<Schema.String, Schema.String>;
82
+ readonly stylesheets: Schema.$Array<Schema.Struct<{
83
+ readonly kind: Schema.Literals<readonly ["bible", "font"]>;
84
+ readonly href: Schema.String;
85
+ }>>;
86
+ }>>;
87
+ }>;
88
+ readonly instructions: Schema.$Array<Schema.Struct<{
89
+ readonly code: Schema.NonEmptyString;
90
+ readonly level: Schema.Literals<readonly ["required", "recommended", "notice"]>;
91
+ readonly appliesTo: Schema.Literals<readonly ["all", "text", "html"]>;
92
+ readonly text: Schema.NonEmptyString;
93
+ readonly urls: Schema.optional<Schema.$Array<Schema.String>>;
94
+ }>>;
95
+ }>;
96
+ export type ScripturePassage = typeof ScripturePassage.Type;
97
+ /** Data capabilities are separate from the existing custom display-provider contract. */
98
+ export interface BibleDataProvider {
99
+ readonly id: string;
100
+ readonly defaultVersionId: string;
101
+ /** Discovery cache lifetime. Omitted preserves the existing unbounded lifetime. */
102
+ readonly cacheTimeToLive?: Duration.Input;
103
+ listVersions(): Effect.Effect<BibleVersion[], ScriptureError>;
104
+ listBooks(versionId: string): Effect.Effect<BibleBook[], ScriptureError>;
105
+ listChapters(versionId: string, bookId: string): Effect.Effect<BibleChapter[], ScriptureError>;
106
+ getPassageData(versionId: string, passageId: string): Effect.Effect<ScripturePassage, ScriptureError>;
107
+ readonly clearCache: Effect.Effect<void>;
108
+ }
109
+ export interface BibleDisplayProvider extends BibleDataProvider {
110
+ getPassageDisplay(versionId: string, passageId: string): Effect.Effect<PassageDisplay, ScriptureError>;
111
+ }
112
+ declare const BibleSource_base: Context.ServiceClass<BibleSource, "@faith-tools/scripture-inline/data/BibleSource", BibleDataProvider>;
113
+ export declare class BibleSource extends BibleSource_base {
114
+ }
115
+ export declare const ScriptureErrorCode: Schema.Literals<readonly ["invalid_reference", "unavailable", "unsupported", "authentication", "rate_limit", "network", "timeout", "invalid_response"]>;
116
+ export type ScriptureErrorCode = typeof ScriptureErrorCode.Type;
117
+ declare const ScriptureError_base: Schema.Class<ScriptureError, Schema.TaggedStruct<"ScriptureError", {
118
+ readonly code: Schema.Literals<readonly ["invalid_reference", "unavailable", "unsupported", "authentication", "rate_limit", "network", "timeout", "invalid_response"]>;
119
+ readonly message: Schema.String;
120
+ readonly cause: Schema.optional<Schema.Defect>;
121
+ }>, import("effect/Cause").YieldableError>;
122
+ export declare class ScriptureError extends ScriptureError_base {
123
+ get retryable(): boolean;
124
+ }
125
+ export {};
@@ -0,0 +1,102 @@
1
+ import { createScriptureClient as createEffectClient } from "./data-effect.js";
2
+ export { ScriptureError } from "./data-types.js";
3
+ export type { BibleBook, BibleChapter, BibleVersion, DisplayInstruction, ScriptureErrorCode, ScripturePassage } from "./data-types.js";
4
+ /** Async/await boundary over the same validated Effect operations and caches. */
5
+ export declare function createScriptureClient(options?: Parameters<typeof createEffectClient>[0]): {
6
+ provider: string;
7
+ listVersions: () => Promise<readonly {
8
+ readonly id: string;
9
+ readonly abbreviation: string;
10
+ readonly title: string;
11
+ readonly language?: string | undefined;
12
+ readonly languageName?: string | undefined;
13
+ }[]>;
14
+ listBooks: (options?: {
15
+ versionId?: string;
16
+ }) => Promise<readonly {
17
+ readonly id: string;
18
+ readonly title: string;
19
+ }[]>;
20
+ listChapters: (options: {
21
+ versionId?: string;
22
+ bookId: string;
23
+ }) => Promise<readonly {
24
+ readonly passageId: string;
25
+ readonly number: number;
26
+ }[]>;
27
+ getPassage: (options: {
28
+ versionId?: string;
29
+ passageId: string;
30
+ }) => Promise<{
31
+ readonly provider: string;
32
+ readonly source: {
33
+ readonly url: string;
34
+ readonly versionId: string;
35
+ };
36
+ readonly requestedPassageId: string;
37
+ readonly passageId: string;
38
+ readonly reference: string;
39
+ readonly text: string;
40
+ readonly version: {
41
+ readonly id: string;
42
+ readonly abbreviation: string;
43
+ readonly title: string;
44
+ readonly language?: string | undefined;
45
+ readonly languageName?: string | undefined;
46
+ readonly sourceLanguage?: string | undefined;
47
+ };
48
+ readonly attribution: {
49
+ readonly text: string;
50
+ readonly urls: readonly string[];
51
+ };
52
+ readonly publisher?: {
53
+ readonly copyrightHtml: string;
54
+ readonly infoHtml: string;
55
+ } | undefined;
56
+ readonly reporting?: {
57
+ readonly kind: "api-bible-fums";
58
+ readonly token: string;
59
+ } | undefined;
60
+ readonly cache?: {
61
+ readonly expiresAt: number;
62
+ } | undefined;
63
+ readonly licenses: readonly {
64
+ readonly name?: string | undefined;
65
+ readonly url: string;
66
+ readonly restrictions?: {
67
+ readonly [x: string]: string | boolean;
68
+ } | undefined;
69
+ }[];
70
+ readonly numbering: "kjv" | "unknown";
71
+ readonly sourceLimitations?: readonly {
72
+ readonly kind: "source-trimming";
73
+ readonly startPassageId: string;
74
+ readonly endPassageId: string;
75
+ readonly appliesToRequest: boolean;
76
+ }[] | undefined;
77
+ readonly display: {
78
+ readonly format: "text";
79
+ readonly whitespace: "pre-wrap";
80
+ readonly attributionPlacement: "after-passage";
81
+ readonly direction?: "ltr" | "rtl" | undefined;
82
+ readonly language?: string | undefined;
83
+ readonly nativeHtml?: {
84
+ readonly containerAttributes: {
85
+ readonly [x: string]: string;
86
+ };
87
+ readonly stylesheets: readonly {
88
+ readonly kind: "bible" | "font";
89
+ readonly href: string;
90
+ }[];
91
+ } | undefined;
92
+ };
93
+ readonly instructions: readonly {
94
+ readonly code: string;
95
+ readonly level: "notice" | "recommended" | "required";
96
+ readonly appliesTo: "all" | "html" | "text";
97
+ readonly text: string;
98
+ readonly urls?: readonly string[] | undefined;
99
+ }[];
100
+ }>;
101
+ clearCache: () => Promise<void>;
102
+ };
@@ -0,0 +1,5 @@
1
+ import { Effect } from "effect";
2
+ /** DOM resources live in the caller's Scope, not in detached event callbacks. */
3
+ export declare const listen: (target: EventTarget, type: string, listener: EventListener, options?: AddEventListenerOptions | boolean) => Effect.Effect<void, never, import("effect/Scope").Scope>;
4
+ export declare const nextFrame: Effect.Effect<void, never, never>;
5
+ export declare const waitForEvent: (target: EventTarget, types: readonly string[]) => Effect.Effect<void, never, never>;
@@ -0,0 +1,12 @@
1
+ import { type ParsedPassage } from "grab-bcv";
2
+ export type FoundReference = {
3
+ /** Offset of the first character of the reference in the scanned text. */
4
+ start: number;
5
+ /** Offset just past the last character of the reference. */
6
+ end: number;
7
+ /** The reference exactly as written, such as "1 Cor. 13:4-7". */
8
+ text: string;
9
+ passage: ParsedPassage;
10
+ };
11
+ /** Finds every Bible reference in `text`, in order, with its exact position. */
12
+ export declare function findReferences(text: string): FoundReference[];
@@ -0,0 +1,31 @@
1
+ import type { ReferenceLayout } from "./scripture-passage";
2
+ import type { ProviderOptions } from "./providers";
3
+ export { findReferences, type FoundReference } from "./find";
4
+ export { unwrapReferences, wrapReferences } from "./scan";
5
+ export { createScriptureCard } from "./card";
6
+ export { BIBLE_PASSAGE_INPUT_TAG, PASSAGE_INPUT_TAG, ScripturePassageInput, definePassageInput, type PassageInputDetail } from "./passage-input";
7
+ export { BIBLE_VERSION_INPUT_TAG, VERSION_INPUT_TAG, ScriptureVersionInput, defineVersionInput, type VersionInputDetail } from "./version-input";
8
+ export { BIBLE_PASSAGE_TAG, SCRIPTURE_PASSAGE_TAG, ScripturePassage, defineScripturePassage, type ReferenceLayout } from "./scripture-passage";
9
+ export { helloaoProvider, createYouVersionProvider, listBibleVersions, type BibleProvider, type BibleVersion, type PassageDisplay, type ProviderOptions } from "./providers";
10
+ export type Mode = "link" | "card";
11
+ export type Trigger = "click" | "hover";
12
+ export type ScriptureInlineOptions = ProviderOptions & {
13
+ /** "link" opens route.bible. "card" shows the passage in a card. Default: "card". */
14
+ mode?: Mode;
15
+ /** What opens a card: "click", or "hover" with a mouse (taps and clicks still work). Default: "click". */
16
+ trigger?: Trigger;
17
+ /** Where a card shows the reference: "heading", "citation", "quote", or "none". Default: "heading". */
18
+ reference?: ReferenceLayout;
19
+ /** Where to look for references. Default: the whole page, including a body that replaces it. */
20
+ root?: Node;
21
+ /** Keep linking references in content added later, such as pages swapped in by Turbo or a router. Default: true. */
22
+ watch?: boolean;
23
+ };
24
+ export type ScriptureInline = {
25
+ /** The links that replaced each reference. */
26
+ links: HTMLAnchorElement[];
27
+ /** Closes any card, removes the listeners, and turns the links back into plain text. */
28
+ stop(): void;
29
+ };
30
+ /** Finds Bible references on the page and makes them interactive. */
31
+ export declare function scriptureInline({ mode, trigger, reference, root, watch, ...providerOptions }?: ScriptureInlineOptions): ScriptureInline;
@@ -0,0 +1,57 @@
1
+ export declare const PASSAGE_INPUT_TAG = "si-passage-input";
2
+ export declare const BIBLE_PASSAGE_INPUT_TAG = "bible-sk-passage-input";
3
+ export type BookOrder = "canonical" | "alphabetical";
4
+ export type PassageInputDetail = {
5
+ passageId: string;
6
+ label: string;
7
+ };
8
+ /**
9
+ * A text input for a Bible passage. Typing "Roman 8" suggests Romans 8, and the element's
10
+ * `value` is the passage ID, such as "ROM.8" or "ROM.8.28-30". It submits with a form under
11
+ * `name`, and fires `change` with `detail: { passageId, label }` when the passage changes.
12
+ * Parts: `input`, `listbox`, `option`, `count`.
13
+ */
14
+ export declare class ScripturePassageInput extends HTMLElement {
15
+ static formAssociated: boolean;
16
+ static observedAttributes: string[];
17
+ private readonly internals;
18
+ private readonly input;
19
+ private readonly list;
20
+ private suggestions;
21
+ private active;
22
+ private committed;
23
+ constructor();
24
+ connectedCallback(): void;
25
+ attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
26
+ /** The passage ID, such as "ROM.8.28-30", or "" when the field is empty or not a passage. */
27
+ get value(): string;
28
+ set value(value: string);
29
+ get form(): HTMLFormElement | null;
30
+ get validity(): ValidityState;
31
+ get validationMessage(): string;
32
+ checkValidity(): boolean;
33
+ reportValidity(): boolean;
34
+ focus(options?: FocusOptions): void;
35
+ formResetCallback(): void;
36
+ formDisabledCallback(disabled: boolean): void;
37
+ /** Parses `text`. A passage replaces the text with its display form, such as "Romans 8". */
38
+ private commit;
39
+ /** "canonical" (default) lists books Genesis to Revelation; "alphabetical" lists them A to Z. */
40
+ get bookOrder(): BookOrder;
41
+ /** The options for the text typed so far, from the broadest choice to the narrowest. */
42
+ private options;
43
+ private suggest;
44
+ private highlight;
45
+ private close;
46
+ /** A book fills in its name and keeps typing going; a chapter or verse is a full passage. */
47
+ private accept;
48
+ private onKeydown;
49
+ }
50
+ /** Register once in a browser entry point. Importing this module does not register it. */
51
+ export declare function definePassageInput(): void;
52
+ declare global {
53
+ interface HTMLElementTagNameMap {
54
+ "si-passage-input": ScripturePassageInput;
55
+ "bible-sk-passage-input": ScripturePassageInput;
56
+ }
57
+ }
@@ -0,0 +1,37 @@
1
+ import { type BibleDataProvider } from "../data-types.js";
2
+ declare const rendering: {
3
+ readonly contentType: "json";
4
+ readonly includeTitles: true;
5
+ readonly includeNotes: false;
6
+ readonly includeChapterNumbers: false;
7
+ readonly includeVerseNumbers: false;
8
+ };
9
+ /** The official createBibleClient result satisfies this structural contract. */
10
+ export interface ApiBibleClient {
11
+ bibles: {
12
+ list(params: {
13
+ includeFullDetails: boolean;
14
+ }, signal?: AbortSignal): Promise<unknown>;
15
+ get(id: string, signal?: AbortSignal): Promise<unknown>;
16
+ };
17
+ books: {
18
+ list(id: string, params: undefined, signal?: AbortSignal): Promise<unknown>;
19
+ };
20
+ chapters: {
21
+ list(id: string, book: string, signal?: AbortSignal): Promise<unknown>;
22
+ get(id: string, chapter: string, params: typeof rendering, signal?: AbortSignal): Promise<unknown>;
23
+ };
24
+ passages: {
25
+ get(id: string, passage: string, params: typeof rendering, signal?: AbortSignal): Promise<unknown>;
26
+ };
27
+ }
28
+ /**
29
+ * Server-only, data-only adapter. Each application supplies its own official SDK
30
+ * client, configured with its private key and retry: { maxAttempts: 1 }.
31
+ * Fetching does not report a display. The host must report every actual web view.
32
+ */
33
+ export declare function createApiBibleProvider({ client, defaultVersionId }: {
34
+ client: ApiBibleClient;
35
+ defaultVersionId: string;
36
+ }): BibleDataProvider;
37
+ export {};
@@ -0,0 +1,14 @@
1
+ import { type BibleDisplayProvider } from "../data-types.js";
2
+ import type { BibleProvider } from "../providers.js";
3
+ export type FetchBibleOptions = {
4
+ /** Explicitly declare commercial use; the upstream default is noncommercial. */
5
+ usage: {
6
+ commercial: boolean;
7
+ attributionless?: boolean;
8
+ limitless?: boolean;
9
+ derivatives?: boolean | "same-license";
10
+ };
11
+ };
12
+ export declare function createFetchBibleProvider(options: FetchBibleOptions): BibleProvider & {
13
+ readonly effects: BibleDisplayProvider;
14
+ };
@@ -0,0 +1 @@
1
+ export { createHelloAOProvider, helloaoProvider } from "../providers.js";
@@ -0,0 +1 @@
1
+ export { createYouVersionProvider } from "../providers.js";