terraphim / terraphim/terraphim-ai

[Research] Shadow DOM vs Light DOM Strategy

Open
#221 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

architecture research web-components
Dominant language
Rust
Stars
62
Forks
5
Avg merge
2h 27m
Merged PRs (30d)
1

Description

Research Objective

Determine optimal Shadow DOM strategy for Web Components migration.

Current State

  • Svelte components use scoped styles
  • Bulma CSS framework with global styles
  • FontAwesome icons via global CSS
  • Theme switching with CSS custom properties

Research Questions

  1. Should we use Shadow DOM or Light DOM for each component type?
  2. How to handle global Bulma styles in Shadow DOM?
  3. What are the performance implications?
  4. How does Shadow DOM affect third-party library integration?

Decision Matrix

Shadow DOM (Encapsulated)

Use For:

  • Leaf components (buttons, inputs, chips)
  • Self-contained widgets (theme switcher, shortcuts)
  • Components with unique styling

Pros:

  • Style isolation prevents conflicts
  • True component encapsulation
  • Can distribute as standalone

Cons:

  • Need to import styles into each component
  • Global CSS (Bulma, FontAwesome) not accessible
  • More complex style inheritance
  • Event delegation complexity
Light DOM (Open)

Use For:

  • Layout components (app shell, navigation)
  • Components requiring global Bulma classes
  • Components integrating third-party libs (D3, TipTap)

Pros:

  • Access to global styles
  • Simpler third-party integration
  • Standard event bubbling
  • Easier debugging

Cons:

  • Style conflicts possible
  • Less encapsulation
  • Cannot distribute independently

Components Classification Needed

Likely Shadow DOM:
  • <terraphim-term-chip>
  • <terraphim-back-button>
  • <terraphim-theme-switcher>
Likely Light DOM:
  • <terraphim-app> (shell)
  • <terraphim-editor> (TipTap)
  • <terraphim-rolegraph> (D3.js)
Needs Research:
  • <terraphim-search> - uses Bulma Field/Input
  • <terraphim-chat> - uses Bulma layout
  • <terraphim-modal> - needs global positioning

Acceptance Criteria

  • Component-by-component Shadow DOM decision
  • Global CSS strategy documented
  • Performance benchmark comparison
  • Third-party library compatibility matrix
  • Style inheritance pattern defined
  • Event handling strategy documented

References

  • Bulma usage: desktop/src/App.svelte
  • Styled components: All .svelte files with <style> blocks

Documentation

Findings will be documented in: .docs/research-shadow-dom-strategy.md

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with desktop/src/App.svelte and the .svelte files containing <style> blocks. Compare the listed Shadow DOM and Light DOM candidates against Bulma, FontAwesome, theme custom properties, TipTap, and D3 integration. Document component decisions, CSS and event strategies, benchmark results, and compatibility findings in .docs/research-shadow-dom-strategy.md.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript
Domain
documentation, frontend
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.