Attachment embeds as floating cards, with menus that fit each kind #172

Open
opened 2026-10-14 07:11:20 +00:00 by kayg · 2 comments
Owner

kayg, 2026-10-14:

  • "all the attachment embeds should feel like a floating card with some depth and they should scale on hover like github.com/kaygdotorg/website (i very much love the ui there)"
  • "we should be able to right click on things and get contextual menus"
  • Images, for example: two icons, Large (the full width of the editor even when the text is narrower) and Card (the image in a constrained card). Later, several images in a row become a carousel automatically. Then Copy image, then the generic actions: copy link, copy as, delete.
  • "think about various kinds of attachments and what their embeds and contextual menus should be!"

Look: kayg's website (github.com/kaygdotorg/website) is the reference. Read its card and hover CSS: depth, scale on hover and spring. Every embed (image, video, audio, PDF, file, note card, link preview) is a floating card with depth that lifts and scales slightly on hover. With the keyboard it focuses with no motion.

Deliverable 1 (design, in the mockup on preview.calternal.cloud first): a table of attachment kinds × embed look × context menu × layout options:

  • image (Large / Card, later Gallery or carousel), GIF, video (inline player), audio (waveform card), PDF (first page and page count, opens a viewer)
  • other files (icon, name, size, Download, Open with)
  • embedded note card (from #165: Expand / Collapse / Open / Unembed)
  • link preview card (Card / Pill / Plain link)
  • code file, CSV (table preview), HEIC from phones, maps or location

Menus are contextual (only what fits that kind) and share a generic tail: Copy link to block, Copy as (Markdown / Plain text / HTML / Deeplink), Duplicate, Move to…, Delete. A floating mini-toolbar on hover or selection, like kayg's second screenshot, offers the top 3–4 layout actions for that kind.

Deliverable 2: build it in the real editor once kayg okays the mockup. Layout choices are stored in the markdown in the most portable way (for example ![alt](<file> "large") or a {.large} attribute; research which survives other editors best). Carousel auto-detection for consecutive images.

kayg, 2026-10-14: - "all the attachment embeds should feel like a floating card with some depth and they should scale on hover like github.com/kaygdotorg/website (i very much love the ui there)" - "we should be able to right click on things and get contextual menus" - Images, for example: two icons, **Large** (the full width of the editor even when the text is narrower) and **Card** (the image in a constrained card). Later, several images in a row become a carousel automatically. Then **Copy image**, then the generic actions: copy link, copy as, delete. - "think about various kinds of attachments and what their embeds and contextual menus should be!" **Look:** kayg's website (github.com/kaygdotorg/website) is the reference. Read its card and hover CSS: depth, scale on hover and spring. Every embed (image, video, audio, PDF, file, note card, link preview) is a floating card with depth that lifts and scales slightly on hover. With the keyboard it focuses with no motion. **Deliverable 1 (design, in the mockup on preview.calternal.cloud first):** a table of attachment kinds × embed look × context menu × layout options: - image (Large / Card, later Gallery or carousel), GIF, video (inline player), audio (waveform card), PDF (first page and page count, opens a viewer) - other files (icon, name, size, Download, Open with) - embedded note card (from #165: Expand / Collapse / Open / Unembed) - link preview card (Card / Pill / Plain link) - code file, CSV (table preview), HEIC from phones, maps or location Menus are contextual (only what fits that kind) and share a generic tail: Copy link to block, Copy as (Markdown / Plain text / HTML / Deeplink), Duplicate, Move to…, Delete. A floating mini-toolbar on hover or selection, like kayg's second screenshot, offers the top 3–4 layout actions for that kind. **Deliverable 2:** build it in the real editor once kayg okays the mockup. Layout choices are stored in the markdown in the most portable way (for example `![alt](<file> "large")` or a `{.large}` attribute; research which survives other editors best). Carousel auto-detection for consecutive images.
Author
Owner

Deliverable 1: the design, live on preview

Try it: https://preview.calternal.cloud/#/note/autumn-trip?list=all (the pinned note "Autumn trip" has every kind). Hover a card, right-click it, click ⋯ in its toolbar, Tab to it and press Enter, Space, ← →, Shift+F10 or ⌫. Branch issue/172-attachment-cards, PR #232. This is the mockup only. Nothing is in the real editor yet (that's deliverable 2, waiting for your OK).

The look (from github.com/kaygdotorg/website)

What I took from the site's CSS (global.css .md-unified-card img, .bento-card, index.astro bento):

  • Depth: stacked shadows with a negative spread, so the shadow sits under the card, plus a 1 px hairline edge (dark: white 8%, light: black 8%). The site uses three layers (40/80 −20, 24/40 −18, 16/24 −12). Ours are the same shape, warmer and a bit softer because cards sit inside writing.
  • Hover: the site lifts and scales (translateY(-8px) scale(1.02) on images, -4px / 1.01 on bento cards), deepens the shadow, and zooms the photo inside the card a little more slowly (scale(1.05) over 0.8 s). We do the same: lift 4 px, grow 1.8%. Large photos grow only 0.6% and lift 3 px, so their edges move about as far as a small card's do. The photo inside drifts to 1.025 over 0.9 s.
  • Motion: the site eases with cubic-bezier(.2,.8,.2,1) over 0.4 to 0.5 s and only transitions transform, shadow and border. We use a real spring instead (damping 0.72, response 0.42 s, 672 ms to settle) with a small overshoot: scale peaks at 1.0187 at about 300 ms and settles at 1.0180 (measured frames are below). Only transform and opacity animate. The deeper shadow is its own layer that fades in, so nothing repaints per frame and the text never moves.
  • Keyboard: focus shows a ring on the card's own shape (a pill stays a pill) and no motion. Pressing a card settles it halfway back down. Reduced motion keeps only the shadow change.

Shared rules

  • Context menu: same order for every kind:
    1. Show as: the layouts, as a row of icons at the top (the one in use is filled in the accent).
    2. The kind's own actions.
    3. The shared tail: Copy link to block · Copy as › (Markdown / Plain text / HTML / Deeplink) · Duplicate · Move to… · Delete.
    • It is the one shared menu surface. #155 owns its opening animation, so this inherits that when it lands.
  • Mini toolbar: a small glass pill. It holds the layouts as a segmented choice, then one or two actions, then ⋯, which opens the full menu.
    • It appears at once on hover, stays while the card is selected or focused, and fades out in 120 ms.
    • It floats over the card's own picture or preview, never over writing. Rows put it over the row's end. A recording puts it in the middle of its time row. A pill puts it beside the pill (on a phone, just under it).
    • On touch, a tap selects the card and shows the toolbar.
  • Margin controls: the drag handle stays. The → / ⋯ pill is hidden for embeds, because the toolbar's ⋯ replaces it.
  • In the file: one ordinary line per embed: ![alt](<file> "layout"). Leaving out the word means the default layout. Every markdown app still shows at least a link. Places use the standard geo:lat,lon link.
  • Galleries are automatic: photos on adjacent lines become one gallery; a blank line between them splits them.

Kinds × look × menu × layouts

Kind Embed look Layouts (first = default) Toolbar Context menu (before the shared tail)
Photo (jpg, png, webp) Floating card. The photo keeps its aspect ratio from the start (no jump on load). Caption from the alt text, size on the right. Card (up to 560 px) · Large (the editor's whole visible width even when the text column is narrower; in Card mode it bleeds to the card's edges) Card / Large · Copy image · ⋯ View full size · Copy image · Download · Edit description
Gallery (adjacent photos) Carousel: the photo in front, neighbours peeking and dimmed, arrows on hover, dots and "2 / 4", swipe or ← →. Each photo is its own floating card. Carousel · Grid (2 across, 3 on very wide) Carousel / Grid · Copy image · ⋯ View full size · Copy image (the one in front) · Split into separate photos
GIF Like a photo, with a GIF badge. Plays unless reduced motion; paused shows its first frame. Card · Large Card / Large · Pause or Play · ⋯ Pause or Play · View full size · Copy image · Download
HEIC (from phones) Shown as a photo (the server makes the preview), with a HEIC badge. Card · Large Card / Large · Copy image · ⋯ View full size · Copy image · Save a JPEG copy · Download · Edit description
Video The poster with a round glass ▶ and its length. It plays in place; the player is only created on the first play (nothing downloads for a video nobody watches). Slim progress line and time while playing. Card · Large Card / Large · Play or Pause · ⋯ Play/Pause (Space) · Mute · Loop · Picture in picture · Download
Recording (m4a, mp3, wav…) Waveform card: an accent ▶, name, "Recording · 1.8 MB", a waveform you tap to jump (played bars fill in), times. Card · Compact (one row: ▶, name, time) Card / Compact · Play · ⋯ Play/Pause (Space) · Speed › 0.75–2× · Loop · Download
PDF The first page standing up out of the card (it tilts slightly on hover), a PDF tile, name, "3 pages · 312 KB". Opens the viewer. First page · File (a row) First page / File · Open · ⋯ Open · Download · Open with…
Table (CSV, TSV) Header with name and "23 rows · 4 columns", the first rows as a real table that fades out, numbers right-aligned. Table · File Table / File · Show all rows · Copy as a table · ⋯ Show all rows · Copy as a table (Markdown) · Download · Open with…
Code file (py, ts, rs, sh, json…) Header with name, language and line count; the first 7 lines with line numbers in Maple Mono, fading out. Preview · File Preview / File · Show all lines · Copy code · ⋯ Show all lines · Copy code · Download · Open with…
Other file (zip, key, anything) A row: a tile with the file's type in a colour per family, name, "File · 48.2 MB". File (only) Download · Open with… · ⋯ Download · Open with… · Rename
Embedded note (#165) The note's own words, live and read-only: title (click to open), first lines, then "Show all 26 lines". An accent edge on the left. Card · Link (a row) Card / Link · Expand · Open · ⋯ Expand / Collapse · Open · Unembed (back to a plain link)
Link (http, https) Card: picture on the right, site with its initial, title, a two-line description, fetched by our server. Stacks on phones. Card · Pill (like a note pill, with ↗) · Plain link Card / Pill / Plain link · Open ↗ · ⋯ Open · Copy address · Refresh preview
Place (geo:) A calm drawn map with an accent pin; name and coordinates under it. The real version gets a tile from our server. Map · Pill Map / Pill · Open in Maps · ⋯ Open in Maps · Copy coordinates

Viewer: "View full size", double-click or Enter opens one. It shows a photo, a gallery (← →) or a PDF's pages over a dimmed, blurred note. It grows in from a pointer and simply appears from the keyboard. Esc or a click outside closes it.

Keys on a focused card: Enter does the obvious thing (view, open, expand, play). Space plays. ← → move through a gallery. ⌫ deletes, with the usual Undo toast. Shift+F10 or the menu key opens the menu. Esc lets go.

Notes and open questions for you

  1. Your reference screenshots: the two newest images I was pointed to are a note-link pill and a link picker, not the "Copy as" menu or the floating media toolbar. So the toolbar and menu here follow the issue text. If you have those two screenshots, attach them and I'll compare.
  2. The toolbar sits inside the card's top corner, so it covers a little of the photo while you hover. The alternative is above the card's top edge, which would cover the line of text above it (TASTE: nothing covers the text). Which do you prefer?
  3. Galleries are as wide as Large by default, so the neighbours can peek in. A narrow carousel felt cramped.
  4. For deliverable 2, the layout word in the image title ("large") is what I'd store. Most editors keep it as a tooltip or ignore it, and {.large} attributes break in many renderers. I'll research properly in deliverable 2.
  5. Menus over photos: the shared glass menu reads less well over a dark photo than over paper. That is the menu material, not the embed; worth a look alongside #155.

Screenshots (mockup build, Chromium unless marked)

1440 light: Large photo, gallery (carousel), video, recording, table, embedded note, link card, right-click menu, Copy as, keyboard focus on a place

1440 light: Large photo, gallery (carousel), video, recording, table, embedded note, link card, right-click menu, Copy as, keyboard focus on a place

1440 dark, the same ten

1440 dark, the same ten

390 light: top, gallery, recording selected (toolbar in the time row), file selected, link pill focused (toolbar under it), table right-click

390 light: top, gallery, recording selected (toolbar in the time row), file selected, link pill focused (toolbar under it), table right-click

390 dark

390 dark

320 light

320 light

320 dark

320 dark

Hover lift, light: frames at 0, 50, 100, 150, 200 / 250, 300, 400, 500, 700 ms

Hover lift, light: frames at 0, 50, 100, 150, 200 / 250, 300, 400, 500, 700 ms

Hover lift, dark, same frames

Hover lift, dark, same frames

WebKit 1440: Large hovered, gallery selected (dark), right-click menu (this headless WebKit draws no backdrop blur, so the menu glass looks clearer than in Safari)

WebKit 1440: Large hovered, gallery selected (dark), right-click menu (this headless WebKit draws no backdrop blur, so the menu glass looks clearer than in Safari)

## Deliverable 1: the design, live on preview **Try it:** https://preview.calternal.cloud/#/note/autumn-trip?list=all (the pinned note "Autumn trip" has every kind). Hover a card, right-click it, click ⋯ in its toolbar, Tab to it and press Enter, Space, ← →, Shift+F10 or ⌫. Branch `issue/172-attachment-cards`, PR #232. This is the mockup only. Nothing is in the real editor yet (that's deliverable 2, waiting for your OK). ### The look (from github.com/kaygdotorg/website) What I took from the site's CSS (`global.css` `.md-unified-card img`, `.bento-card`, `index.astro` bento): - **Depth:** stacked shadows with a negative spread, so the shadow sits *under* the card, plus a 1 px hairline edge (dark: white 8%, light: black 8%). The site uses three layers (40/80 −20, 24/40 −18, 16/24 −12). Ours are the same shape, warmer and a bit softer because cards sit inside writing. - **Hover:** the site lifts and scales (`translateY(-8px) scale(1.02)` on images, `-4px / 1.01` on bento cards), deepens the shadow, and zooms the photo *inside* the card a little more slowly (`scale(1.05)` over 0.8 s). We do the same: **lift 4 px, grow 1.8%**. Large photos grow only 0.6% and lift 3 px, so their edges move about as far as a small card's do. The photo inside drifts to 1.025 over 0.9 s. - **Motion:** the site eases with `cubic-bezier(.2,.8,.2,1)` over 0.4 to 0.5 s and only transitions transform, shadow and border. We use a real spring instead (damping 0.72, response 0.42 s, 672 ms to settle) with a small overshoot: scale peaks at 1.0187 at about 300 ms and settles at 1.0180 (measured frames are below). Only `transform` and `opacity` animate. The deeper shadow is its own layer that fades in, so nothing repaints per frame and the text never moves. - **Keyboard:** focus shows a ring on the card's own shape (a pill stays a pill) and **no motion**. **Pressing** a card settles it halfway back down. **Reduced motion** keeps only the shadow change. ### Shared rules - **Context menu:** same order for every kind: 1. **Show as**: the layouts, as a row of icons at the top (the one in use is filled in the accent). 2. **The kind's own actions.** 3. The shared tail: **Copy link to block · Copy as › (Markdown / Plain text / HTML / Deeplink) · Duplicate · Move to… · Delete**. - It is the one shared menu surface. #155 owns its opening animation, so this inherits that when it lands. - **Mini toolbar:** a small glass pill. It holds the layouts as a segmented choice, then one or two actions, then ⋯, which opens the full menu. - It appears at once on hover, stays while the card is selected or focused, and fades out in 120 ms. - It floats over the card's own picture or preview, **never over writing**. Rows put it over the row's end. A recording puts it in the middle of its time row. A pill puts it beside the pill (on a phone, just under it). - On touch, a tap selects the card and shows the toolbar. - **Margin controls:** the drag handle stays. The → / ⋯ pill is hidden for embeds, because the toolbar's ⋯ replaces it. - **In the file:** one ordinary line per embed: `![alt](<file> "layout")`. Leaving out the word means the default layout. Every markdown app still shows at least a link. Places use the standard `geo:lat,lon` link. - **Galleries are automatic:** photos on adjacent lines become one gallery; a blank line between them splits them. ### Kinds × look × menu × layouts | Kind | Embed look | Layouts (first = default) | Toolbar | Context menu (before the shared tail) | |---|---|---|---|---| | **Photo** (jpg, png, webp) | Floating card. The photo keeps its aspect ratio from the start (no jump on load). Caption from the alt text, size on the right. | **Card** (up to 560 px) · **Large** (the editor's whole visible width even when the text column is narrower; in Card mode it bleeds to the card's edges) | Card / Large · Copy image · ⋯ | View full size · Copy image · Download · Edit description | | **Gallery** (adjacent photos) | Carousel: the photo in front, neighbours peeking and dimmed, arrows on hover, dots and "2 / 4", swipe or ← →. Each photo is its own floating card. | **Carousel** · **Grid** (2 across, 3 on very wide) | Carousel / Grid · Copy image · ⋯ | View full size · Copy image (the one in front) · Split into separate photos | | **GIF** | Like a photo, with a GIF badge. Plays unless reduced motion; paused shows its first frame. | Card · Large | Card / Large · Pause or Play · ⋯ | Pause or Play · View full size · Copy image · Download | | **HEIC** (from phones) | Shown as a photo (the server makes the preview), with a HEIC badge. | Card · Large | Card / Large · Copy image · ⋯ | View full size · Copy image · **Save a JPEG copy** · Download · Edit description | | **Video** | The poster with a round glass ▶ and its length. It plays in place; the player is only created on the first play (nothing downloads for a video nobody watches). Slim progress line and time while playing. | Card · Large | Card / Large · Play or Pause · ⋯ | Play/Pause (Space) · Mute · Loop · Picture in picture · Download | | **Recording** (m4a, mp3, wav…) | Waveform card: an accent ▶, name, "Recording · 1.8 MB", a waveform you tap to jump (played bars fill in), times. | **Card** · **Compact** (one row: ▶, name, time) | Card / Compact · Play · ⋯ | Play/Pause (Space) · Speed › 0.75–2× · Loop · Download | | **PDF** | The first page standing up out of the card (it tilts slightly on hover), a PDF tile, name, "3 pages · 312 KB". Opens the viewer. | **First page** · **File** (a row) | First page / File · Open · ⋯ | Open · Download · Open with… | | **Table** (CSV, TSV) | Header with name and "23 rows · 4 columns", the first rows as a real table that fades out, numbers right-aligned. | **Table** · **File** | Table / File · Show all rows · Copy as a table · ⋯ | Show all rows · Copy as a table (Markdown) · Download · Open with… | | **Code file** (py, ts, rs, sh, json…) | Header with name, language and line count; the first 7 lines with line numbers in Maple Mono, fading out. | **Preview** · **File** | Preview / File · Show all lines · Copy code · ⋯ | Show all lines · Copy code · Download · Open with… | | **Other file** (zip, key, anything) | A row: a tile with the file's type in a colour per family, name, "File · 48.2 MB". | File (only) | Download · Open with… · ⋯ | Download · Open with… · Rename | | **Embedded note** (#165) | The note's own words, live and read-only: title (click to open), first lines, then "Show all 26 lines". An accent edge on the left. | **Card** · **Link** (a row) | Card / Link · Expand · Open · ⋯ | Expand / Collapse · Open · Unembed (back to a plain link) | | **Link** (http, https) | Card: picture on the right, site with its initial, title, a two-line description, fetched by our server. Stacks on phones. | **Card** · **Pill** (like a note pill, with ↗) · **Plain link** | Card / Pill / Plain link · Open ↗ · ⋯ | Open · Copy address · Refresh preview | | **Place** (`geo:`) | A calm drawn map with an accent pin; name and coordinates under it. The real version gets a tile from our server. | **Map** · **Pill** | Map / Pill · Open in Maps · ⋯ | Open in Maps · Copy coordinates | **Viewer:** "View full size", double-click or Enter opens one. It shows a photo, a gallery (← →) or a PDF's pages over a dimmed, blurred note. It grows in from a pointer and simply appears from the keyboard. Esc or a click outside closes it. **Keys on a focused card:** Enter does the obvious thing (view, open, expand, play). Space plays. ← → move through a gallery. ⌫ deletes, with the usual Undo toast. Shift+F10 or the menu key opens the menu. Esc lets go. ### Notes and open questions for you 1. **Your reference screenshots:** the two newest images I was pointed to are a note-link pill and a link picker, not the "Copy as" menu or the floating media toolbar. So the toolbar and menu here follow the issue text. If you have those two screenshots, attach them and I'll compare. 2. **The toolbar sits inside the card's top corner,** so it covers a little of the photo while you hover. The alternative is above the card's top edge, which would cover the line of text above it (TASTE: nothing covers the text). Which do you prefer? 3. **Galleries are as wide as Large by default,** so the neighbours can peek in. A narrow carousel felt cramped. 4. **For deliverable 2,** the layout word in the image title (`"large"`) is what I'd store. Most editors keep it as a tooltip or ignore it, and `{.large}` attributes break in many renderers. I'll research properly in deliverable 2. 5. **Menus over photos:** the shared glass menu reads less well over a dark photo than over paper. That is the menu material, not the embed; worth a look alongside #155. ## Screenshots (mockup build, Chromium unless marked) **1440 light: Large photo, gallery (carousel), video, recording, table, embedded note, link card, right-click menu, Copy as, keyboard focus on a place** ![1440 light: Large photo, gallery (carousel), video, recording, table, embedded note, link card, right-click menu, Copy as, keyboard focus on a place](https://git.kayg.org/attachments/92039f69-1030-4558-b673-29631ad4f33e) **1440 dark, the same ten** ![1440 dark, the same ten](https://git.kayg.org/attachments/2be72b20-52b8-43ee-9936-a416bc2181ff) **390 light: top, gallery, recording selected (toolbar in the time row), file selected, link pill focused (toolbar under it), table right-click** ![390 light: top, gallery, recording selected (toolbar in the time row), file selected, link pill focused (toolbar under it), table right-click](https://git.kayg.org/attachments/b2f31372-e298-4278-a6d4-f8fb156f37da) **390 dark** ![390 dark](https://git.kayg.org/attachments/f6cba69d-9d30-48dc-81bb-614839d9e606) **320 light** ![320 light](https://git.kayg.org/attachments/d5fd8209-cb79-4d95-bcf1-e6dcc8317303) **320 dark** ![320 dark](https://git.kayg.org/attachments/25fb7be0-0509-4396-a7f0-22b335445783) **Hover lift, light: frames at 0, 50, 100, 150, 200 / 250, 300, 400, 500, 700 ms** ![Hover lift, light: frames at 0, 50, 100, 150, 200 / 250, 300, 400, 500, 700 ms](https://git.kayg.org/attachments/d60d1b3a-c90e-42a7-a259-d7532c96b880) **Hover lift, dark, same frames** ![Hover lift, dark, same frames](https://git.kayg.org/attachments/3304d9f2-f45b-4a80-93a9-aef195a563f4) **WebKit 1440: Large hovered, gallery selected (dark), right-click menu (this headless WebKit draws no backdrop blur, so the menu glass looks clearer than in Safari)** ![WebKit 1440: Large hovered, gallery selected (dark), right-click menu (this headless WebKit draws no backdrop blur, so the menu glass looks clearer than in Safari)](https://git.kayg.org/attachments/5a65bf52-419f-4125-acae-11c9a75c27d5)
Author
Owner

Decided (kayg, G12): where attachments live. There is no Attachments/ folder. Files go by type and date, the way v0 did, so attachments added later through the Photos and Files plugins land in the same place:

  • Photos/YYYY/YYYY-MM-DD/<name>: pictures and video.
  • Documents/YYYY/YYYY-MM-DD/<name>: documents.
  • Anything not recognised goes to Documents or a third Others/ folder with the same date layout. Open question, Claude recommends Documents.

Moving or reorganising a file updates every link to it (the #9 rename and link jobs). Links in the markdown stay relative. kayg's archived v0 Documents and Photos (/mnt/hdd/calternal-v0-archive/2026-10-14/files/) can later be imported into the same layout.

**Decided (kayg, G12): where attachments live.** There is no `Attachments/` folder. Files go by type and date, the way v0 did, so attachments added later through the Photos and Files plugins land in the same place: - `Photos/YYYY/YYYY-MM-DD/<name>`: pictures and video. - `Documents/YYYY/YYYY-MM-DD/<name>`: documents. - Anything not recognised goes to Documents or a third `Others/` folder with the same date layout. **Open question**, Claude recommends Documents. Moving or reorganising a file updates every link to it (the #9 rename and link jobs). Links in the markdown stay relative. kayg's archived v0 Documents and Photos (`/mnt/hdd/calternal-v0-archive/2026-10-14/files/`) can later be imported into the same layout.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#172
No description provided.