Skip to content

KISS/DRY/YAGNI pass: shared navigation registry, hide tracker, press gates - #63

Merged
ivanbanov merged 5 commits into
mainfrom
chore/kiss-dry-yagni
Nov 19, 2026
Merged

ivanbanov merged 5 commits into
mainfrom
chore/kiss-dry-yagni

Conversation

@ivanbanov

Copy link
Copy Markdown
Member

A fresh start of #55 on current main: the same simplicity pass over the DOM layer and the dialog substrates, plus the principles it was held to, written into AGENTS.md. #55 is the reference; this PR replaces it.

What changed

@dunky.dev/browser-navigation: fix (patch). The guard registry and the popstate listener now live on a realm-global keyed by Symbol.for, the same way dom-overlay and dom-scroll-lock already work. Before, two copies of the module (monorepo, micro-frontend) each kept their own registry while sharing the one real session history, so a Back could close a layer in every copy at once. The store also remembers the attached listener, because each copy's function has its own identity and the browser's (type, listener) dedupe can't span copies.

@dunky.dev/dom-dialog: press gates replace the predicates (minor). With acceptsBackdropPress / acceptsViewportPress, React and Solid each wrote the same onClick wrapper by hand. gateBackdropPress(id, bindings) / gateViewportPress(id, bindings) take the part's normalized bindings and return them with the press gated, so each substrate's Backdrop/Viewport is now one mergeProps call. The gating rules have not changed.

@dunky.dev/dom-overlay + @dunky.dev/overlay: refactors, no behavior change. hideOutside and hideExitingLayer now share one hide/undo tracker, so the author-hidden skip and the exact-restore undo can't drift apart. below(id) now slices ordered() instead of carrying a second copy of the depth/open-order ranking.

AGENTS.md. A Principles table (KISS, DRY, YAGNI) at the top of the Code section.

Different from #55

Not changed, on purpose

The forward-reopen half of closeOnBack is where most of the complexity is (parked guards, claim watchers, the consumption chain). Whether it is worth keeping is a product decision, so this PR leaves it as it is.

Follow-up

The vue-dialog-next and svelte-dialog branches still use acceptsBackdropPress / acceptsViewportPress and will need the gate* API after this merges.

Verification

typecheck, lint, and format:check pass. Tests: 297 vitest + 13 native pass.

🤖 Generated with Claude Code

ivanbanov and others added 5 commits November 19, 2026 09:19
…e copies

Duplicate copies of the module forked the guard registry while sharing the
one real session history, so a Back could be answered by every copy at once.
The registry now anchors on a realm-global keyed by Symbol.for, like
dom-overlay and dom-scroll-lock, and remembers the attached listener so only
one is ever attached.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed()

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he predicates

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ivanbanov
ivanbanov merged commit 6584b8a into main Nov 19, 2026
6 checks passed
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