how can we match the look and feel and features of this projects in our framework?…
- User
how can we match the look and feel and features of this projects in our framework? https://nova.lightmode.io/ but keeping our "terminal chat" in the bottom. the canvas movement options should be similar with the second image but still have our own way of doing, context menu etc. pay atention to their feature of Website cards (Follow a snippet of a website instead of refreshing every day. Keep what matters visible)
- User
[Image: image/png]
- User
[Image: image/png]
Assistant
Let me explore the current codebase and the Nova website to understand what we're working with.
Assistant
Now let me design the implementation plan.
Assistant
Let me read a few critical files to verify details before writing the plan.
Assistant
Now I have a thorough understanding of both systems. Let me write the plan.
Assistant
Good — Nokogiri for proper HTML parsing and 8 curated color presets. Let me finalize the plan with those choices.
Assistant
The plan is ready. It covers 6 areas:
- Warm dark theme — update CSS tokens from cold black to warm dark
- Card headers — colored uppercase titles with icons, matching Nova's style
- Floating toolbar — replaces right-click on components with a Nova-style toolbar (move, 8-color picker, font size A/A/A, duplicate, delete)
- Sidebar enhancement — "CANVASES" heading, component counts,
+button - Website card widget — new widget using Nokogiri to fetch/display website snippets with CSS selector support
- Polish — selection state, double-click to add, smoother panning
Assistant
Good question. Looking at the existing widget JS architecture — all client-side widget behaviors use the
window.registerWidget(type, behavior)pattern fromweb/public/js/widgets/registry.js, not Stimulus controllers. The canvas controller (Stimulus) handles the canvas-level concerns (pan/zoom/drag), while individual widget behaviors are plain JS registered via the widget registry.The website widget JS should follow this same pattern — it goes in
web/public/js/widgets/website.jsusingregisterWidget('website', { init(el), destroy(el) }). Theinitfunction would handle the empty-state URL input form and submit behavior. No Stimulus controller needed — consistent with how clock.js, chart.js, and data_table.js already work.Let me update the plan to clarify this.
Assistant
Great question. There are two distinct approaches with different tradeoffs:
Server-side fetch (Nokogiri) — what the plan currently describes:
- Fetches the URL from the server, extracts content via CSS selector, sanitizes and displays as static HTML
- Matches Nova's "snippet" concept — a snapshot that refreshes periodically
- Works with any public site, can target specific selectors
- Cannot access authenticated/logged-in content (fetches anonymously)
iframe approach:
- Embeds the live site in an
<iframe>— preserves the user's browser session/cookies/auth - Shows live interactive content, not a snapshot
- Many sites block iframing (
X-Frame-Options: DENY, CSPframe-ancestors) - Can't extract specific CSS selectors — shows the whole page (or nothing if blocked)
Most sites that matter (dashboards, news, etc.) block iframes, so it's unreliable as a primary approach. The Nova-style "snippet" is fundamentally a server-side extraction.
Assistant
Dual mode it is. Let me update the plan with the iframe + server-side fallback approach.
Assistant
Plan updated with dual-mode website widget.
Assistant
Unfortunately, you can't reliably crop/clip specific parts of a cross-origin iframe due to browser security (same-origin policy). The browser blocks any JS interaction with the iframe's DOM if it's from a different domain.
There are a couple of workarounds, but each has limits:
-
CSS clip/transform trick — Use
transform: scale()+clip-pathoroverflow: hiddenon a wrapper div, combined with negativemarginortransform: translate()to "pan" the iframe to the area you want. This is purely visual — you position the iframe so only the desired region is visible. But it requires the user to manually dial in pixel offsets (x, y, width, height) which is tedious. -
Scroll the iframe — For same-origin or sites that allow it, you can use
#:~:text=fragment or anchor links to scroll to a section, but this is unreliable cross-origin. -
Server-side proxy — Fetch the page server-side, extract the snippet, serve it from our own origin in the iframe. This gives full DOM control but loses user auth (same as snippet mode).
Realistically, the is the right tool for "show just this part of the page." The iframe mode is better for "embed the whole page/app where I'm logged in" (like a dashboard, email, calendar).
-
Assistant
Good — clean separation: iframe for full-page embeds, snippet mode for extracted sections. The plan already reflects this correctly.
Assistant
Yes, exactly. When the user adds a Website widget (from the context menu), they'll see an initial setup form where they:
- Enter the URL
- Choose the mode: "Embed (iframe)" or "Snippet"
- If snippet mode is selected, an additional optional field appears for the CSS selector
They can also switch modes later via the floating toolbar or a small toggle in the card. The mode is stored in metadata as
mode: 'iframe'ormode: 'snippet'.The empty-state form in the card would look something like:
code┌─────────────────────────────┐ │ 🌐 WEBSITE │ │ │ │ URL: [________________] │ │ │ │ ○ Embed (live page) │ │ ○ Snippet (extract part) │ │ │ │ Selector: [________] │ ← only visible in snippet mode │ │ │ [Add Website] │ └─────────────────────────────┘Assistant
Makes sense — snippet as default since it's more reliable and supports CSS selectors. Let me update the plan.
Assistant
Updated — snippet mode is now the default, iframe is opt-in for auth-required sites.
Assistant
That's a much better approach for OpenFang's architecture. So instead of the user manually typing CSS selectors, the flow would be:
- User adds a Website widget and enters the URL + a natural language description like "Show me the top 5 headlines" or "Just the price table"
- This gets sent to the AI agent (Claude subprocess) which analyzes the page and generates the extraction logic — could be a CSS selector, or even custom Ruby code via
run_codethat fetches and transforms the data - The widget stores and uses that extraction config to refresh periodically
The AI would use the existing MCP tools (
run_codeto test extraction, PATCH the component metadata/content) to set up the snippet. The user never needs to know about CSS selectors.For iframe mode, it stays simple — just the URL, no AI involvement needed.
Assistant
This aligns perfectly with the existing
evaluate_data_sourcepattern inBaseWidget(line 56-68) which already doesinstance_evalon a Ruby code string. Let me update the plan.Assistant
Updated. The snippet flow is now: user describes what they want in natural language → AI generates Ruby extraction code → stored in metadata → evaluated on each refresh via the existing
evaluate_data_sourcepattern.Assistant
Good call. Let me add that to the toolbar.
Assistant
Added "Chat about this" button to the toolbar between the font sizes and duplicate/delete. It reuses the same logic from the current context menu.
- User
[Request interrupted by user for tool use]