Skip to content

feat: row-spanning overlays (:spans) — clock, pie, flank, vector image#6

Merged
chiply merged 1 commit into
mainfrom
feat/spans-overlays
Jun 12, 2026
Merged

feat: row-spanning overlays (:spans) — clock, pie, flank, vector image#6
chiply merged 1 commit into
mainfrom
feat/spans-overlays

Conversation

@chiply

@chiply chiply commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a :spans option to svg-line-image / svg-line-define: a list of centred overlays drawn once over a row range, on top of the rows.

Span types

  • (:clock (A . B) COLOR ACCENT) — analog clock showing the current time
  • (:pie (A . B) FRAC FILL BG) — progress pie
  • (:flank (A . B) LEFT RIGHT [COLOR GAP GLYPH-SIZE]) — two text clusters flanking the centred overlay; each side a string or a (TIME . GLYPH) cons, glyph drawn larger (default 1.7×) so squat Nerd-Font glyphs read at text scale
  • (:image (A . B) SVG [ALIGN GAP]) — splice an svg.el DOM / SVG string as a transformed <g> (stays vector/sharp, unlike a rasterised <image>)

Helpers: svg-line--draw-clock, svg-line--draw-pie-at (extracted from the inline :pie run), svg-line--parse-svg, svg-line--attr-num, svg-line--splice-svg (deep-copies children so a cached/shared input DOM is never aliased), plus svg-line--embed-image / --svg-intrinsic-size for the raster alternative.

Also: :seg runs gain :bg (persistent background pill) and :weight.

Add a `:spans' option to `svg-line-image' / `svg-line-define': a list of
centred overlays drawn once over a row range, on top of the rows (whose
`:center' should be empty there to avoid collision).

Span types:
- (:clock (A . B) COLOR ACCENT) — analog clock showing the current time
- (:pie   (A . B) FRAC FILL BG) — progress pie
- (:flank (A . B) LEFT RIGHT [COLOR GAP GLYPH-SIZE]) — two text clusters
  flanking the centred overlay; each side a string or a (TIME . GLYPH)
  cons with the glyph drawn larger (default 1.7x) so squat Nerd-Font
  weather/icon glyphs read at text scale
- (:image (A . B) SVG [ALIGN GAP]) — splice an svg.el DOM / SVG string as
  a transformed <g> (stays vector/sharp, unlike a rasterised <image>)

Supporting helpers: svg-line--draw-clock, svg-line--draw-pie-at (extracted
from the inline :pie run), svg-line--parse-svg, svg-line--attr-num,
svg-line--splice-svg (deep-copies children so a cached/shared input DOM is
never aliased into the rendered tree), plus svg-line--embed-image /
--svg-intrinsic-size for the raster alternative.

Also: :seg runs gain :bg (a persistent background pill) and :weight.
Copilot AI review requested due to automatic review settings June 12, 2026 15:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds support for row-spanning, centered overlays in the lines layout via a new :spans option, enabling single overlay renderings across a row range (clock/pie/flank/image) and extending segment styling.

Changes:

  • Add :spans support to svg-line-image / spec plumbing, rendering overlays on top of a row range.
  • Extract pie rendering into svg-line--draw-pie-at and add new overlay helpers (clock + SVG parsing/splicing).
  • Extend :seg runs with :bg (persistent pill) and :weight (font weight) support.
Comments suppressed due to low confidence (1)

svg-line.el:541

  • The public svg-line-image docstring doesn’t mention the new SPANS keyword argument, and it also doesn’t document the newly supported (:seg STR PLIST) styling keys (:bg / :weight). Please update the docstring so callers can discover these options via help.
                               (icon-scale 0.74)
                               (spans nil))
  "Build a `lines'-layout SVG from ROWS.
Each ROW is either a cons (LEFT . RIGHT) -- left- and right-aligned content --
or a vector [LEFT CENTER RIGHT] which adds horizontally-centred content.
Each of LEFT, CENTER and RIGHT is either:

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread svg-line.el
Comment on lines +645 to +651
(let* ((rng (nth 1 span))
(a (if (consp rng) (car rng) 0))
(b (if (consp rng) (cdr rng) (1- (length rows))))
(sh (* lh (1+ (- b a))))
(cx (/ width 2))
(cy (round (+ (* lh a) (/ sh 2.0))))
(r (max 3 (round (* (/ sh 2.0) 0.86)))))
Comment thread svg-line.el
Comment on lines +708 to +717
(let* ((attrs (cadr dom))
(iw (max 1 (round (svg-line--attr-num (cdr (assq 'width attrs))))))
(ih (max 1 (round (svg-line--attr-num (cdr (assq 'height attrs))))))
(scale (/ (float sh) ih))
(dw (max 1 (round (* iw scale))))
(ix (pcase align
('left (+ pad gap))
('right (max pad (- width dw gap)))
(_ (round (- cx (/ dw 2.0))))))
(iy (round (- cy (/ sh 2.0)))))
Comment thread svg-line.el
Comment on lines +639 to +643
;; Centred, row-spanning overlays drawn once over a row range, on top of
;; the rows (whose `:center' should be empty there to avoid collision).
;; SPEC: (:clock (ROW-A . ROW-B) COLOR ACCENT) or
;; (:pie (ROW-A . ROW-B) FRACTION FILL BG). Rows 0-indexed, inclusive.
(dolist (span spans)
@chiply chiply merged commit 11721ed into main Jun 12, 2026
8 checks passed
@chiply chiply deleted the feat/spans-overlays branch June 12, 2026 15:28
@chiply chiply mentioned this pull request Jun 12, 2026
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.

2 participants