Skip to content

Commit cb41bc7

Browse files
committed
AI: Work on devtools plan
1 parent 78d1a4b commit cb41bc7

File tree

1 file changed

+102
-9
lines changed

1 file changed

+102
-9
lines changed

ai/workspace/plans/devtools/devtools-extension-plan.md

Lines changed: 102 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
77
---
88

9+
## Project Location
10+
11+
```
12+
/tools/devtools/
13+
```
14+
15+
The extension lives in the monorepo's `/tools/` directory alongside other development utilities. This keeps it separate from the core packages while maintaining access to SUI dependencies for bundling.
16+
17+
---
18+
919
## Document Relationship
1020

1121
This document is paired with **`sui-devtools-proposal.md`** which contains:
@@ -25,14 +35,15 @@ When implementing, read relevant sections from both:
2535

2636
## Table of Contents
2737

28-
1. [Project Overview](#project-overview)
29-
2. [Context Loading Strategy](#context-loading-strategy)
30-
3. [Verified API Reference](#verified-api-reference)
31-
4. [Build Phases](#build-phases)
32-
5. [Testing Strategy](#testing-strategy)
33-
6. [File Structure](#file-structure)
34-
7. [Validated Example: ui-menu](#validated-example-ui-menu)
35-
8. [API Quick Reference](#api-quick-reference)
38+
1. [Project Location](#project-location)
39+
2. [Project Overview](#project-overview)
40+
3. [Context Loading Strategy](#context-loading-strategy)
41+
4. [Verified API Reference](#verified-api-reference)
42+
5. [Build Phases](#build-phases)
43+
6. [Testing Strategy](#testing-strategy)
44+
7. [File Structure](#file-structure)
45+
8. [Validated Example: ui-menu](#validated-example-ui-menu)
46+
9. [API Quick Reference](#api-quick-reference)
3647

3748
---
3849

@@ -959,6 +970,88 @@ interface InspectedElement {
959970
- User expands nodes manually via click or arrow keys
960971
- When selecting via element picker, auto-expand path to selected node
961972
973+
```javascript
974+
// Tree node rendering (pseudocode)
975+
function renderTreeNode(node, showFiltered, expandedNodes) {
976+
// Skip filtered nodes unless showFiltered is true
977+
if (node.filtered && !showFiltered) {
978+
return null;
979+
}
980+
981+
const isExpanded = expandedNodes.has(node.id);
982+
const classes = [
983+
'tree-node',
984+
node.isSUI ? 'sui-component' : 'dom-element',
985+
node.nodeType === 'text' ? 'text-node' : '',
986+
node.nodeType === 'comment' ? 'comment-node' : '',
987+
node.filtered ? 'filtered' : '',
988+
].filter(Boolean).join(' ');
989+
990+
// Render node with expander, icon, name
991+
// Render #shadow-root as collapsible child if hasShadow
992+
// Render children recursively if expanded
993+
}
994+
```
995+
996+
**Example tree for nested components:**
997+
```
998+
▶ ui-card ← SUI component (bold, indigo)
999+
▶ #shadow-root ← Collapsible shadow boundary
1000+
div.card ← Regular DOM inside shadow
1001+
slot ← Slot element
1002+
▶ ui-button ← Nested SUI component (in light DOM)
1003+
▶ #shadow-root
1004+
button.button
1005+
"Click Me"Text node
1006+
```
1007+
1008+
**CSS styling for visual distinction**:
1009+
```css
1010+
.tree-node.sui-component {
1011+
font-weight: 600;
1012+
color: var(--sui-component-color, #6366f1); /* Indigo for SUI */
1013+
}
1014+
.tree-node.dom-element {
1015+
color: var(--dom-element-color, #888);
1016+
}
1017+
.tree-node.text-node {
1018+
color: var(--text-node-color, #666);
1019+
font-style: italic;
1020+
}
1021+
.tree-node.filtered {
1022+
opacity: 0.5;
1023+
}
1024+
.shadow-label {
1025+
font-style: italic;
1026+
color: var(--shadow-label-color, #666);
1027+
}
1028+
```
1029+
1030+
5. **Filter Settings Panel** (panel/components/filter-settings.js)
1031+
```html
1032+
<div class="filter-settings">
1033+
<h4>Tree Filters</h4>
1034+
<label>
1035+
<input type="checkbox" id="hide-comments" checked>
1036+
Hide comment nodes (Lit markers)
1037+
</label>
1038+
<label>
1039+
<input type="checkbox" id="hide-wrappers" checked>
1040+
Hide wrapper elements (astro-island, etc.)
1041+
</label>
1042+
<label>
1043+
<input type="checkbox" id="hide-scripts" checked>
1044+
Hide script tags
1045+
</label>
1046+
<label>
1047+
<input type="checkbox" id="hide-empty-text" checked>
1048+
Hide whitespace-only text nodes
1049+
</label>
1050+
</div>
1051+
```
1052+
1053+
Filter changes trigger `setFilterSettings()` on bridge and tree re-render.
1054+
9621055
**Files to Create**:
9631056
- `manifest.json`
9641057
- `devtools.html` / `devtools.js`
@@ -1486,7 +1579,7 @@ Create test HTML files with various SUI components:
14861579
## File Structure
14871580
14881581
```
1489-
sui-devtools/
1582+
tools/devtools/
14901583
├── manifest.json
14911584
├── devtools.html
14921585
├── devtools.js

0 commit comments

Comments
 (0)