feat: add reusable record player packages#5
Open
vibium-agent wants to merge 4 commits into
Open
Conversation
66023e3 to
795dd19
Compare
- RecordStudio: use bundled jszip instead of runtime cdnjs loader (+regression test) - player-core: fix numberFrom treating null/empty string as 0 - player-element: drop dead storage-key attribute; add happy-path render test - vite.element.config: copyPublicDir:false to keep demo zips out of dist-element
795dd19 to
e6d84a6
Compare
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
Adds reusable
player-core,player-react, andplayer-elemententry points undersrc/packages/, while preserving the hosted Vite app. The custom element is a minimal, self-contained player built on the new public contracts; the hostedRecordStudiois left intact apart from dropping its runtime CDN dependency.What's here
player-core— framework-free ZIP loading/parsing (parseRecording,loadRecording) plusLoadedRecording,TimelineModel,RecordingEvent,ScreenshotIndex, andPlayerErrorcontracts. URL loading usesfetchwith browsersame-origincredentials by default and accepts an injectedfetch/AbortSignal. A test enforces that this module imports no React.player-react—RecordPlayer(renders an already-loaded recording) andRecordPlayerLoader(fetches a recording fromsrc, owns loading/error state).player-element—defineVibiumRecordPlayerElement()registers<vibium-record-player src="/record.zip">, an idempotent custom element that wrapsRecordPlayerLoader(element → player-react → player-core). It dispatchesvibium-player-readywith{ recording }andvibium-player-errorwith{ error }.RecordStudio— now uses the bundledjszipdependency instead of injecting a<script>from cdnjs at runtime (no CDN requirement; offline/CSP-friendly), guarded by a regression test.npm run build:element(vite.element.config.ts) emits a self-contained ESM bundle todist-element/, withcopyPublicDir:falseso the hosted app's demo recordings are excluded.Architecture notes
The element renders the minimal
RecordPlayer(transport, screenshot, timeline, event inspector) backed byplayer-core, rather than mounting the full hostedRecordStudio. This keeps a single clean dependency chain (element → player-react → player-core) and dogfoods the public contracts.Deferred (intentional follow-ups)
exports-mapped, so consumers can'timport "@vibium/record-player/element"yet. A later PR should addexportspointing at builtdistartifacts.player-corecurrently parses independently ofRecordStudio's in-component parser; a later PR should makeRecordStudioconsumeplayer-coreso there is a single source of truth.Test plan
npm test— 18 tests pass (player-core, player-react, player-element, record-studio)npx tsc -p tsconfig.app.json --noEmitnpm run build:element— bundles todist-element/vibium-record-player.jswith no stray public assets<vibium-record-player>loads the demo recording (213 events, ~19.5s) and plays back; the hosted app loads recordings via the bundled JSZip with no cdnjs request