feat(slidewise): add jsonDeck prop for AI-generated decks#52
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
jsonDeck?: Deck | stringprop onSlidewiseEditor/Slidewise.Root. AI emits either a parsedDeckor a JSON string and Slidewise handlesJSON.parse+migrate()internally — no host glue needed. Takes precedence overdeck;deckis now optional and one of the two must be provided.resolveJsonDeck(input)— the same parse + migrate helper, surfaced so hosts can validate model output before mounting (or use it in non-React tooling).Decktype — no new shape to learn.SlidewiseFileEditoris intentionally untouched — it sources its deck from a PPTX blob, so the JSON path doesn't apply.Test plan
tsc -p tsconfig.lib.json --noEmitcleanresolveJsonDeck: object input, string input, malformed JSON, future-version rejection)<SlidewiseEditor jsonDeck={...} />in the website demo with both aDeckobject and a JSON string<SlidewiseEditor deck={...} />callers are unaffected