MCPcopy Index your code
hub / github.com/ChrisShank/progressive-element

github.com/ChrisShank/progressive-element @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
16 symbols 20 edges 5 files 4 documented · 25%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Towards a behavioral paradigm for building web interfaces

image

Principles

  • Subtractive mindset + remove layers of abstraction
  • Behavior is more important to understanding than UI hierarchy.
  • Leverage new (and old) features of the browser.
  • Optional patterns than can be layered together.
  • Stop combining the server/client into one.

Patterns

  • Use event delegation to avoid needing to attach event listeners directly to DOM elements or attaching global event listeners.
  • Declare "intentions" in HTML that map raw DOM event to semantically meaningful events. (e.g. <form on:submit="ADD_TODO">)
  • Use custom elements to organize & reuse behavior by the progressively enhancing the light DOM.
  • Progressively hydrate custom elements based on when they are used. This could be when the CPU first becomes idle, when the custom element becomes visible on the page, or when the custom element was first interacted with.
  • CSS "reactivity" that conditionally styles the page based on DOM attributes or other state-based selectors (e.g. :has). Originally written about by Noam.

Provided in the repo are some optional/unopionated helpers that implement these patterns.

For a more detailed explanation check out this

Extension points exported contracts — how you extend this code

AnyEvent (Interface)
(no doc)
src/progressive-element.ts
Intention (Interface)
(no doc)
src/intentions.ts

Core symbols most depended-on inside this repo

handleEvent
called by 1
src/progressive-element.ts
connectedCallback
called by 0
src/server-islands.ts
hydrateOnIdle
called by 0
src/hydration.ts
hydrateOnVisible
called by 0
src/hydration.ts
hydrateOnInteraction
called by 0
src/hydration.ts
listener
called by 0
src/hydration.ts
register
called by 0
src/progressive-element.ts
constructor
called by 0
src/progressive-element.ts

Shape

Function 6
Class 4
Method 4
Interface 2

Languages

TypeScript100%

Modules by API surface

src/progressive-element.ts6 symbols
src/hydration.ts4 symbols
src/server-islands.ts3 symbols
src/intentions.ts3 symbols

For agents

$ claude mcp add progressive-element \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact