Skip to content

feat(plugins): let a plugin set coords inside its slot (#1044) - #1049

Open
gloubix wants to merge 2 commits into
Ludea:mainfrom
gloubix:feat/plugin-position-coords
Open

gloubix wants to merge 2 commits into
Ludea:mainfrom
gloubix:feat/plugin-position-coords

Conversation

@gloubix

@gloubix gloubix commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Closes #1044 — following your comment that position means coords inside "body" or "footer".

What this adds

register() gains an optional third argument:

register(position, element, coords?: { x: number | string; y: number | string })
  • With coords → the element renders absolutely positioned at (x, y) inside its slot area. A number is px, a string is any CSS length ("10%", "2rem", …).
  • Without coords → exactly today's in-flow behavior. Existing plugins keep working unchanged.

Example from a plugin:

register("body", <MyWidget />, { x: 40, y: "20%" });
register("footer", <StatusBadge />, { x: "80%", y: 0 });

Anchoring

  • body: the slot is wrapped in a position: relative container in Index.tsx, so coords are offsets from the body area's top-left.
  • footer: <PluginSlot position="footer" /> is now mounted inside Footer's fixed root Grid (footer was in the position enum but no slot was rendered anywhere) — coords anchor to the footer area.

Notes

  • Plugins.tsx reuses the shared RegisterPluginFn type so remote bundles see the new signature (and can also target options, which the local type copy didn't include).
  • 4 files, +74/−34. tsc and vp lint clean.
  • If by "coords" you had something else in mind (grid cells, anchor presets like top-left/center…), say the word and I'll adjust — the registry shape supports swapping the placement semantics without touching the plugin ABI again.

register() gains an optional third argument:

  register(position, element, coords?: { x, y })

Entries registered with coords render absolutely positioned at (x, y)
inside their slot area (number = px, string = any CSS length such as
"10%"). Entries without coords keep today's in-flow behavior, so
existing plugins are unaffected.

The body slot is wrapped in a position: relative container so coords
anchor to the body area; the footer slot is now mounted inside Footer's
fixed root Grid (footer was in the enum but never rendered anywhere).
Plugins.tsx reuses the RegisterPluginFn type so remote bundles see the
new signature.
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.

Set remote plugin position

1 participant