Skip to content

refactor: dedupe embed core across platform wrappers - #22

Merged
sagar-kap merged 1 commit into
mainfrom
refactor/dedupe-embed-core
Aug 7, 2026
Merged

refactor: dedupe embed core across platform wrappers#22
sagar-kap merged 1 commit into
mainfrom
refactor/dedupe-embed-core

Conversation

@sagar-kap

Copy link
Copy Markdown
Member

Summary

De-duplicates the shared presentation and embed lifecycle across YouTubeCarousel, TikTokCarousel, and InstagramCarousel per the repo instructions (compound shared props, stateless reusable helpers/composables).

Changes

  • CarouselSharedProps in types.ts — the wrappers and BaseCarousel extend it instead of redeclaring the ten presentation props in each file.
  • utils/embeds.ts — pure, unit-tested URL builders (YouTube embed/watch/thumb, TikTok embembed, Instagram captioned embed with tracker stripping).
  • CarouselCaption / CarouselActiveCaption — replaces the triplicated caption block + scoped CSS + fade transition in all three wrappers.
  • useYouTubeMedia composable — owns facade activation, thumbnail fallbacks, iframe handshake, player-api registration, and control dispatch (was four near-identical *ByVideo functions).
  • Removed useInstagramEmbed / useTikTokEmbed — dead code (never imported by any component), so their auto-imports are gone.

Public API

Prop/slot/event names, DOM classes, and embed URLs are unchanged. The two removed auto-imports are the only breaking change.

Verification

  • pnpm test — 54 tests (was 39; 15 new URL tests), SSR fixture suite still green
  • pnpm lint, pnpm test:types, pnpm prepack — all pass

- Share CarouselSharedProps in types.ts; components extend it instead of
  redeclaring the ten forwarding props per file
- Extract pure per-platform embed URL builders into utils/embeds with unit
  tests (keyless thumbnails + Instagram tracker stripping preserved)
- Add CarouselCaption/CarouselActiveCaption to replace the triplicated
  caption template and CSS
- Introduce useYouTubeMedia to own the YouTube facade/player-api lifecycle
- Drop dead useInstagramEmbed/useTikTokEmbed auto-imports
@sagar-kap
sagar-kap merged commit 55af024 into main Aug 7, 2026
1 check passed
@sagar-kap
sagar-kap deleted the refactor/dedupe-embed-core branch August 7, 2026 10:57
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