Skip to content

feat(blocks): add image/gallery/video, product list, and cart blocks - #28

Merged
mayeedwin merged 2 commits into
mainfrom
feat/media-product-cart-cards
Jul 29, 2026
Merged

feat(blocks): add image/gallery/video, product list, and cart blocks#28
mayeedwin merged 2 commits into
mainfrom
feat/media-product-cart-cards

Conversation

@mayeedwin

Copy link
Copy Markdown
Owner

Summary

Adds five new content blocks to the Conversed AST, plus a native <dialog> lightbox and CSS scroll-snap for horizontal strips. Ships in @conversed/core, @conversed/react, and @conversed/angular.

New blocks

  • image — single image with optional aspect ratio; href opens a modal preview
  • gallery — horizontal snap-scroll (default) or responsive grid of images; per-item click-through opens the shared modal
  • video — HTML5 <video> with poster, aspect, and native controls
  • product / products — full vertical ecommerce card (image on top, title, subtitle, rating, price + strike-through, badge, CTAs); wrap multiple in <section data-products> for a horizontal scroll strip or data-layout=\"grid\"
  • cart — line items with thumbnail/qty/note, summary rows (with emphasized total), and checkout CTAs

Modal preview

  • Native <dialog> lightbox with prev/next navigation, ArrowLeft/ArrowRight keys, click-to-zoom, ESC and backdrop-to-close
  • Sized to min(70vw, 820px) at rest; expands to 92vw when zoomed to native size

Polish

  • Horizontal strips (gallery, products) hide scrollbar chrome and use scroll-snap-type: x mandatory + scroll-behavior: smooth
  • System prompt spec (CONVERSED_SYSTEM_PROMPT) updated with the new block shapes so LLMs can emit them
  • Four new demo presets: Field gallery, Shop the store, Deals under $50, Order history

Why

The existing media block was a single-image blob with no distinction for video, no gallery, and no ecommerce shape. Agents commonly emit product listings, cart summaries, image galleries, and short walkthrough clips — landing these before 0.0.1 keeps the AST complete on release.

Reviewer notes

  • MediaBlock (the pre-existing {src,alt,caption} shape from <figure><img>) is untouched for backward compatibility — the new ImageBlock opts in via data-image, data-aspect, or data-href on the <figure>
  • Parser adds ~15 new reserved data-attrs; product/cart use idiomatic HTML (<article data-product>, <section data-cart>, <ul data-items>, <ul data-summary>) so payloads stay readable
  • Angular ConversedGalleryComponent uses @ViewChild('dlg') for the shared modal because template refs can't cross @if/@for sibling boundaries
  • Parser tests cover the new blocks (24/24 passing); library builds green for core, react, and angular

Test plan

  • Trigger "Field gallery" preset → hero image opens modal, prev/next steps through Recent scans, video plays inline
  • Trigger "Shop the store" → 4-product horizontal scroll snaps between cards, cart renders with 2 lines + 3 summary rows + Checkout/Continue shopping
  • Follow-up chips "Show me deals under $50" and "What's in my order history?" resolve to their own presets
  • Modal close (×, ESC, click backdrop) all clear the .zoomed state
  • Confirm no horizontal page scroll on mobile viewport (375px)

Adds five new content blocks to the AST with parsers, renderers (React + Angular), styles, and demo coverage:

- image: single image with optional aspect ratio and href-driven lightbox
- gallery: horizontal snap-scroll or grid of images; per-item click-through
- video: HTML5 video with poster, aspect, and native controls
- products (+ single product): full vertical ecommerce card with rating, badge, and CTAs; horizontal scroll or grid via <section data-products>
- cart: line items, summary rows (with emphasized total), and checkout CTAs

Also:
- native <dialog> lightbox for image/gallery preview with prev/next navigation, keyboard arrows, click-to-zoom, and click/ESC to close
- hidden scrollbars + smooth CSS scroll-snap on horizontal strips
- new demo presets: Field gallery, Shop the store, Deals under $50, Order history
- system prompt spec updated to document each new block

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Lists every block with its purpose and HTML shape so authors and LLMs
can scan the emit contract in one place. Includes the newly-added
image/gallery/video/product/products/cart blocks.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@mayeedwin mayeedwin self-assigned this Jul 29, 2026

@mayeedwin mayeedwin left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mayeedwin
mayeedwin merged commit 33c6555 into main Jul 29, 2026
1 check passed
@mayeedwin
mayeedwin deleted the feat/media-product-cart-cards branch July 29, 2026 22:30
@mayeedwin mayeedwin mentioned this pull request Jul 29, 2026
3 tasks
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