@symbo.ls/connect 3.3.7 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Artboard.png ADDED
Binary file
package/SESSION_LOG.md ADDED
@@ -0,0 +1,190 @@
1
+ # Chrome Inspect2 — Session Log
2
+
3
+ Full development session covering major features added to the Symbols Connect Chrome DevTools extension.
4
+
5
+ ---
6
+
7
+ ## Architecture Overview
8
+
9
+ - **Chrome Extension Manifest V3**: DevTools panel, service worker, content scripts
10
+ - **Files**: `static/panel.js` (main UI logic), `static/panel.html`, `static/panel.css`, `static/page-agent.js` (injected into page), `static/picker.js` (folder picker tab), `static/auth.js`, `src/service_worker.js`
11
+ - **IndexedDB v3**: Three stores — `handles` (folder handles), `files` (file caches), `threads` (chat threads with `project` index)
12
+ - **Connection modes**: `local` (folder picker), `platform` (symbols.app), `runtime` (auto-detect DOMQL page)
13
+
14
+ ---
15
+
16
+ ## Features Implemented (in order)
17
+
18
+ ### 1. Source/Code Editor Tab Fix
19
+ - `.tab-panel.active` used `display: block` but code editor needed flex layout
20
+ - Fixed with `#tab-source.active { display: flex; flex-direction: column; height: 100%; }`
21
+
22
+ ### 2. AI System (replaced broken smart-assistant)
23
+ - **Starter AI** (`starterAI()`): Local rule-based command parser (free tier) — handles set/change, add, remove, colors, themes, flow, text, spacing, hide/show
24
+ - **Claude API**: Direct call to `api.anthropic.com/v1/messages` with own API key, or proxy through `api.symbols.app/v1/ai/claude` if signed in
25
+ - **Service worker**: `declarativeNetRequest` rule to remove Origin header for Anthropic API (CORS)
26
+ - **AI Settings dialog**: Gear button next to model selector, stores API key in `chrome.storage.local`
27
+ - **Model selector**: Starter (free) / Claude / Chrome AI (local)
28
+
29
+ ### 3. Folder Picker Fix
30
+ - `showDirectoryPicker()` was auto-called on page load (no user gesture) — removed auto-call, only triggers on button click
31
+
32
+ ### 4. Chat Threads with Persistence
33
+ - Thread model: `{ id, project, title, messages[], createdAt, updatedAt }`
34
+ - Saved per-project in IndexedDB, survives reloads
35
+ - Thread tabs bar, new thread button, thread history panel
36
+ - Editor AI bar prompts also saved to threads
37
+
38
+ ### 5. Universal Data Flow for AI Changes
39
+ - `applyChanges(parsed, scope)`: Single function that applies changes to DOM via `pageEval` AND refreshes panel via `selectElement`
40
+ - Supports both element and section scope
41
+
42
+ ### 6. Scope Switcher (Element / Section)
43
+ - Toggle in both AI input rows (editor + chat)
44
+ - Element: applies to selected element only
45
+ - Section: walks DOMQL tree children via `pageEval` and applies changes to all descendants
46
+
47
+ ### 7. Add New Props/State Values
48
+ - `createAddButton(type)`: Inline key:value editor for adding new props or state entries
49
+ - Appears at bottom of props and state tabs
50
+
51
+ ### 8. State Tree Tab
52
+ - Added as second tab in tree pane alongside Active Nodes
53
+ - `renderStateTree()`: Uses `pageEval` with `findRoot()` to walk actual DOMQL elements
54
+ - **State nesting fix**: Only shows elements with their OWN state (different from parent's state). Elements that inherit the same state are skipped but their children are still traversed to find deeper state boundaries.
55
+ - `renderStateTreeNode()`: Renders tree with badges (state key count), click-to-select, collapsible
56
+ - **Click fix**: Clicking state values no longer re-renders the entire tree. Selection highlighting done via CSS class toggling without full rebuild.
57
+
58
+ ### 9. Auto-Refresh
59
+ - `chrome.devtools.network.onNavigated` listener + 2-second polling for tree hash changes
60
+ - Re-loads tree and re-selects current element on page navigation
61
+
62
+ ### 10. Props Sub-tabs: Computed / Original
63
+ - **Computed**: Shows rendered prop values from the live DOM
64
+ - **Original**: Shows definition values from `__ref`/extends chain
65
+ - **Function detection**: Walks `__ref` and extends chain in `page-agent.js` to identify `typeof def.props[key] === 'function'`
66
+ - Function props marked with `f()` badge, non-editable, tooltip explains it's dynamic
67
+
68
+ ### 11. Methods Inline
69
+ - Element methods appended at bottom of Computed props panel under "Methods" header
70
+ - State methods appended at bottom of State tab under "State Methods" header
71
+ - Removed standalone Methods tab
72
+
73
+ ### 12. Design System Tab
74
+ - Third tab in tree pane: Active Nodes / State Tree / Design System
75
+ - **Runtime extraction**: `getDesignSystem()` in `page-agent.js` reads `root.context.designSystem` or any child element's context
76
+ - Custom serializer handles DOM nodes, circular refs, skips `parent`/`node`/`context`/`__element`
77
+ - **File fallback**: Scans `fileCache` for files with "designSystem" in path
78
+ - **Categorized display**: Known categories (color, theme, spacing, typography, etc.) shown first
79
+ - **Color swatches**: Hex/rgb/hsl values show color preview
80
+ - **Inline editing**: Click leaf values to edit, updates `root.context.designSystem` in live page
81
+ - Retry logic if page not ready yet
82
+
83
+ ### 13. Auto-Connect for Symbols Sites
84
+ - On panel init, checks if inspected page has `__DOMQL_INSPECTOR__`
85
+ - If yes, skips connect screen → enters `runtime` mode immediately
86
+ - Shows "Connect" button in header bar for saving changes
87
+ - Connect dialog: "Local Folder" or "Platform (sign in)"
88
+ - Picking folder while in runtime mode seamlessly upgrades to `local` mode
89
+ - `connectionMode` now supports: `'local'` | `'platform'` | `'runtime'`
90
+
91
+ ### 14. Object/Array Props Editor
92
+ - Props with object/array values open structured inline editor (not flat text input)
93
+ - Each key-value pair gets its own row with type-preserving inputs
94
+ - `parsePreservingType()` tracks original type (string, number, boolean, null, json) and converts back correctly
95
+ - Add/remove entries, Save/Cancel buttons
96
+ - Inline key input for adding new object keys (replaced `prompt()` which doesn't work in DevTools panels)
97
+
98
+ ---
99
+
100
+ ## Key Functions Reference
101
+
102
+ ### panel.js
103
+ | Function | Purpose |
104
+ |---|---|
105
+ | `tryAutoConnect()` | Check if page is DOMQL site, auto-enter runtime mode |
106
+ | `connectLocal(name, cache)` | Connect with local folder |
107
+ | `connectPlatform(project)` | Connect with symbols.app platform |
108
+ | `connectRuntime()` | Auto-connect without folder/platform |
109
+ | `showConnectDialog()` | Dropdown to choose local/platform |
110
+ | `updateConnectButton()` | Show/hide Connect button in header |
111
+ | `loadTree()` | Load DOMQL element tree from page |
112
+ | `selectElement(path)` | Select element by key path |
113
+ | `renderDetail()` | Render selected element's detail pane |
114
+ | `renderPropsTab()` | Render Computed/Original props with function detection |
115
+ | `renderStateTab()` | Render state values + state methods |
116
+ | `renderStateTree()` | Build state tree from runtime (only own-state elements) |
117
+ | `renderDesignSystem()` | Load and render design system from runtime/files |
118
+ | `startEditing()` | Inline text editor for primitive values |
119
+ | `startObjectEditing()` | Structured editor for objects/arrays |
120
+ | `createPropRow()` | Create a property row with key:value display |
121
+ | `applyChanges(parsed, scope)` | Apply AI changes to DOM + refresh panel |
122
+ | `starterAI(query, context)` | Local rule-based AI command parser |
123
+ | `callClaudeAPI(prompt, context)` | Call Claude API (own key or platform proxy) |
124
+ | `handleAIPrompt()` | Editor AI bar handler |
125
+ | `handleChatPrompt()` | Chat mode handler |
126
+ | `initAutoRefresh()` | Set up navigation + polling refresh |
127
+
128
+ ### page-agent.js
129
+ | Function | Purpose |
130
+ |---|---|
131
+ | `findRoot()` | Find root DOMQL element |
132
+ | `getElementInfo(el)` | Serialize element info (props, state, methods, originalProps, functionProps) |
133
+ | `getDesignSystem(el)` | Extract designSystem from element context |
134
+ | `updateProp(path, key, value)` | Update a prop value on live element |
135
+ | `updateState(path, key, value)` | Update a state value on live element |
136
+ | `navigatePath(path)` | Navigate to element by dot-separated key path |
137
+
138
+ ---
139
+
140
+ ### 15. Design System Original/Computed Tabs
141
+ - **Original tab**: Reads from source files (`fileCache` designSystem folder) — individual category files like `color.js`, `theme.js`, `spacing.js`
142
+ - **Computed tab**: Reads from runtime `context.designSystem` (post-processed by framework)
143
+ - Improved `buildDesignSystemFromFiles()`: Sort index files last, category files first; handle both lowercase (color.js) and uppercase (COLOR.js) naming
144
+ - Source file editing: Edits in Original tab update the source files via regex replacement
145
+ - DS tokens cached in `cachedDesignSystem` for use by autocomplete
146
+ - If no source files connected, defaults to Computed tab
147
+
148
+ ### 16. IntelliSense/Autocomplete from Design System Tokens
149
+ - **`getSuggestionsForProp()`** now pulls real tokens from `cachedDesignSystem`:
150
+ - Color props → DS color tokens with hex swatches
151
+ - Theme → DS theme names with modifiers
152
+ - Spacing props → DS spacing tokens (from base/ratio config)
153
+ - Font size → DS typography tokens
154
+ - Timing → DS timing values
155
+ - Font family → DS font_family entries
156
+ - Falls back to hardcoded defaults if DS not loaded
157
+ - **DS value editing autocomplete**: `editDSValue()` now has autocomplete dropdown with `getDSSuggestionsForPath()`
158
+ - **Add property IntelliSense**: `createAddButton()` now has:
159
+ - Key input with dropdown of all known CSS/DOMQL property names (filtered by what's already set)
160
+ - Value input with context-aware suggestions (based on selected key → pulls from `getSuggestionsForProp`)
161
+ - Arrow key navigation, Tab to move between key/value
162
+
163
+ ### 17. updateDesignSystem Pattern (from platform)
164
+ - Researched platform's `updateDesignSystem(key, val, opts)` in `platform/uikit/functions/design-system.js`
165
+ - Path pattern: dot-notation like `'COLOR.primary'` → array `['designSystem', 'COLOR', 'primary']`
166
+ - Categories are uppercase: COLOR, GRADIENT, THEME, FONT, TYPOGRAPHY, SPACING, TIMING, etc.
167
+ - DS files follow modular structure: `designSystem/color.js`, `designSystem/theme.js`, etc. with `index.js` aggregating all
168
+ - Extension now uses same path convention for source file updates
169
+
170
+ ---
171
+
172
+ ## Pending / Not Yet Done
173
+
174
+ 1. **Verify Claude API works end-to-end** — Integration added but not confirmed by user
175
+ 2. **Platform proxy endpoint** — `api.symbols.app/v1/ai/claude` may not exist on backend yet
176
+ 3. **Runtime error** — User reported "Saved 1 file(s), 1 error(s)" but specific error message unknown.
177
+ 4. **Platform remote DS data** — Currently only local folder files supported for Original tab. Platform API integration for remote DS data pending.
178
+
179
+ ---
180
+
181
+ ## File Changes Summary
182
+
183
+ | File | Changes |
184
+ |---|---|
185
+ | `static/panel.html` | Added: tree pane tabs (3 tabs), thread bar, thread history, scope toggle, AI settings dialog, props sub-tabs, design system panel, model selectors |
186
+ | `static/panel.css` | Added: tree pane tabs, thread bar, scope toggle, props sub-tabs, function badges, state tree, design system, AI dialog, connect dialog, object editor styles |
187
+ | `static/panel.js` | Major: IndexedDB v3, thread system, starterAI, Claude API, scope system, auto-connect, state tree (own-state only), design system tab, object/array editor, auto-refresh, universal applyChanges |
188
+ | `static/page-agent.js` | Added: `originalProps`/`functionProps` extraction, `getDesignSystem()` with custom serializer |
189
+ | `static/picker.js` | Bumped IndexedDB to v3, removed auto-call to `pickFolder()` |
190
+ | `src/service_worker.js` | Replaced smart-assistant rule with Anthropic API CORS rule |
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Symbols Connect",
4
- "version": "3.3.4",
4
+ "version": "3.4.0",
5
5
  "description": "symbols.app connect — DOMQL Inspector and element grabber for the Symbols design system",
6
6
  "permissions": [
7
7
  "scripting",