Skip to content

feat(slidewise): add jsonDeck prop for AI-generated decks#52

Merged
karthikmudunuri merged 1 commit into
mainfrom
karthikmudunuri/expose-deck-json-format
May 18, 2026
Merged

feat(slidewise): add jsonDeck prop for AI-generated decks#52
karthikmudunuri merged 1 commit into
mainfrom
karthikmudunuri/expose-deck-json-format

Conversation

@karthikmudunuri
Copy link
Copy Markdown
Member

Summary

  • New top-level jsonDeck?: Deck | string prop on SlidewiseEditor / Slidewise.Root. AI emits either a parsed Deck or a JSON string and Slidewise handles JSON.parse + migrate() internally — no host glue needed. Takes precedence over deck; deck is now optional and one of the two must be provided.
  • New export resolveJsonDeck(input) — the same parse + migrate helper, surfaced so hosts can validate model output before mounting (or use it in non-React tooling).
  • The schema LLMs target is the existing public Deck type — no new shape to learn.
import { SlidewiseEditor, resolveJsonDeck } from "@textcortex/slidewise";

// Pass JSON straight from the model:
<SlidewiseEditor jsonDeck={aiGeneratedJsonString} />

// Or validate first:
const deck = resolveJsonDeck(aiGeneratedJsonString);
<SlidewiseEditor deck={deck} />

SlidewiseFileEditor is intentionally untouched — it sources its deck from a PPTX blob, so the JSON path doesn't apply.

Test plan

  • tsc -p tsconfig.lib.json --noEmit clean
  • Full vitest suite: 39 passed / 3 skipped (unchanged baseline + 4 new tests for resolveJsonDeck: object input, string input, malformed JSON, future-version rejection)
  • Smoke: mount <SlidewiseEditor jsonDeck={...} /> in the website demo with both a Deck object and a JSON string
  • Smoke: confirm existing <SlidewiseEditor deck={...} /> callers are unaffected

Adds a top-level `jsonDeck?: Deck | string` prop on `SlidewiseEditor` and
`Slidewise.Root` so hosts can feed model-generated decks directly into
the editor without manual `JSON.parse` / `migrate()` glue. Takes
precedence over `deck` when both are passed; `deck` is now optional and
one of the two must be supplied.

Also exports `resolveJsonDeck(input)` — the same parse + migrate helper
the editor uses internally — for hosts that want to validate AI output
before mounting, or for tools that emit `Deck` JSON outside of React.

The schema LLMs target is the existing public `Deck` type.
@karthikmudunuri karthikmudunuri merged commit 9ceb038 into main May 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant