Skip to content

feat(core): add passage display model - #393

Open
cameronapak wants to merge 6 commits into
mainfrom
YPE-4857-passage-display-api
Open

feat(core): add passage display model#393
cameronapak wants to merge 6 commits into
mainfrom
YPE-4857-passage-display-api

Conversation

@cameronapak

@cameronapak cameronapak commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a high-level getPassageDisplay API for transformed Bible HTML, current attribution, stylesheet descriptors, and required container attributes
  • preserve a declarative core boundary with no DOM mutation, resource injection, or attribution caching
  • document the contract and decision, expose tree-shakable helpers, and add a core minor changeset

Behavior

  • always returns transformed HTML
  • fetches passage and version metadata concurrently when filters permit
  • prefers copyright attribution, falls back to promotional content, and fails closed when neither exists
  • provides the versioned Bible CSS and Fonts API stylesheet for permanent Untitled Serif font ID 1

Verification

  • pnpm lint
  • YVP_API_HOST=api.youversion.com pnpm --filter @youversion/platform-core test (22 files, 442 tests)
  • pnpm check:tree-shaking
  • pnpm --filter @youversion/platform-core build

Greptile Summary

Adds a declarative core passage-display API for transformed Bible HTML, current attribution, stylesheet descriptors, and required container attributes.

  • Fetches and schema-validates passage and version data while respecting configured version filters.
  • Exposes focused display-resource helpers and package entry points with tree-shaking checks.
  • Adds documentation, tests, CDN CSS-major validation, and a core minor changeset.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
packages/core/src/bible-passage-display.ts Introduces the display-model orchestration, version-filter handling, attribution selection, and declarative resource assembly.
packages/core/src/bible-passage.ts Extracts validated passage fetching and adds schema validation at the API response boundary.
packages/core/src/bible-display-resources.ts Defines stable Bible CSS and configured Fonts API stylesheet descriptors without DOM side effects.
packages/core/src/schemas/passage-display.ts Defines schema-first input and output contracts for the new public display model.
packages/core/src/tests/bible-passage-display.test.ts Covers display output, attribution behavior, filters, concurrency, validation, and explicit per-test HTTP setup; the previous hidden-handler concern is resolved.
scripts/check-cdn-css-major.mjs Adds a lint-time consistency guard between the core stylesheet URL and the UI CDN compatibility major.
scripts/check-tree-shaking.mjs Extends consumer-bundle checks to verify that the focused stylesheet helper remains isolated from display orchestration.

Sequence Diagram

sequenceDiagram
    participant App as Consumer
    participant Display as getPassageDisplay
    participant API as Platform API
    participant Transform as HTML Transformer
    App->>Display: versionId, passageId, options
    par When filters permit concurrency
        Display->>API: Fetch passage HTML
        Display->>API: Fetch version metadata
    end
    API-->>Display: Passage and version
    Display->>Transform: Transform passage HTML
    Transform-->>Display: Display-ready HTML
    Display->>Display: Select current attribution
    Display-->>App: HTML, attribution, stylesheets, container attributes
Loading

Reviews (4): Last reviewed commit: "fix(core): simplify passage display boun..." | Re-trigger Greptile

Context used (4)

@changeset-bot

changeset-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4e7793c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@youversion/platform-core Minor
@youversion/platform-react-hooks Minor
@youversion/platform-react-ui Minor
vite-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cameronapak cameronapak self-assigned this Sep 10, 2026
@cameronapak cameronapak added the enhancement New feature or request label Sep 10, 2026
Comment thread packages/core/src/__tests__/bible-passage-display.test.ts Outdated
Comment thread packages/core/src/bible-passage-display.ts Outdated
Comment thread packages/core/src/bible-passage-display.ts Outdated
Comment thread packages/core/src/bible-passage-display.ts Outdated
Comment thread packages/core/src/__tests__/bible-passage-display.test.ts
Comment thread packages/core/src/__tests__/bible-passage-display.test.ts
Comment thread CONTEXT.md Outdated
Comment thread packages/core/src/bible-passage.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants