Skip to content

Commit 89ee766

Browse files
feat: dynamic tabs.
1 parent d22f9c9 commit 89ee766

11 files changed

Lines changed: 375 additions & 656 deletions

docs/editor-workspace-architecture.md

Lines changed: 0 additions & 45 deletions
This file was deleted.

docs/full-pass-editor-workspace-refactor-prompt.md

Lines changed: 0 additions & 121 deletions
This file was deleted.
Lines changed: 57 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,109 @@
1-
# Issue #62 Continuation Prompt: Pick Up Where We Left Off
1+
# Issue #62 Continuation Prompt: Remaining Hardening Scope
22

3-
Use this as the handoff prompt for continuing work on:
3+
Use this as the handoff prompt for any remaining work related to:
44
https://github.com/knightedcodemonkey/develop/issues/62
55

66
## Prompt
77

8-
You are resuming implementation for issue #62 in `@knighted/develop`.
8+
You are continuing issue #62 in `@knighted/develop` after the main multi-tab
9+
workspace refactor is already complete.
910

1011
### Goal
1112

12-
Finish the dynamic multi-tab workspace/editor refactor and close remaining
13-
behavior gaps without doing a broad visual redesign.
13+
Harden the current tab-id-first workspace/editor behavior and close any
14+
remaining edge-case regressions without broad UI redesign.
1415

1516
### Current project constraints
1617

1718
- Keep changes localized to `@knighted/develop`.
1819
- Preserve CDN-first runtime/fallback behavior.
19-
- Preserve existing lint/build pipeline.
20+
- Preserve existing lint/build/test pipeline.
2021
- Do not add dependencies without asking first.
2122
- Prefer focused, minimal diffs over broad rewrites.
2223

23-
### What is already done
24+
### What is already complete
2425

25-
- Dynamic workspace tabs exist with add, rename, remove, and local persistence.
26-
- Entry-role guard exists (entry tab cannot be removed).
27-
- Tab strip was moved to a dedicated full-width row in the editor area.
28-
- Tab visuals were updated toward IDE-like tabs.
29-
- Rename flow was hardened against re-entrant render races.
30-
- Add-tab naming prompt was removed in favor of generated default names.
31-
- Active tab is re-applied on startup to reduce initial-load drift.
32-
- Focus-based kind switching was removed from editor focus handlers.
33-
- `setActiveWorkspaceTabForKind` has been removed.
34-
- Lint/build were passing after the most recent structural change.
26+
- Dynamic workspace tabs are in place (add/rename/remove) with persistence.
27+
- Entry-role guard is in place (entry tab cannot be removed).
28+
- Entry filename contract is enforced (`App.tsx` or `App.js`).
29+
- One-visible-editor behavior is in place with tab-driven visibility.
30+
- Full Playwright suite was passing after test cleanup and refactor alignment.
3531

36-
### Known remaining risk areas
32+
### Remaining focus areas
3733

38-
- Residual component/styles lane assumptions still exist in `src/app.js`
39-
(for example cached loaded tab ids and kind-based branches).
40-
- App entry tab selection on initial load has historically been flaky.
41-
- Remove-tab fallback and active-tab/editor sync should stay strictly
42-
tab-id-driven.
43-
- Preview entry/hydration behavior must remain consistent with tab metadata.
34+
1. Tab-id-first activation hardening
4435

45-
### Required outcomes for this continuation
36+
- Keep active tab id as the single source of truth for visible editor content.
37+
- Prevent hidden-panel interactions or stale branch logic from mutating active tab state.
4638

47-
1. Make active tab id the single source of truth
39+
2. Entry and startup determinism
4840

49-
- Eliminate or isolate remaining lane-coupled activation logic.
50-
- Ensure selecting a tab always controls visible editor content.
41+
- Verify entry tab restore and initial-load selection remain stable.
42+
- Keep preview entry resolution aligned with tab metadata (`role: entry`) and documented fallback behavior.
5143

52-
2. Preserve entry contract and startup determinism
44+
3. Remove/add/rename coherence
5345

54-
- Entry tab path should remain `src/components/App.tsx` or `src/components/App.jsx`.
55-
- On first load/restore, App entry tab must be selectable and render correctly.
46+
- Keep fallback tab selection deterministic after remove.
47+
- Ensure add and rename flows do not drift name/path/content synchronization.
5648

57-
3. Keep one-visible-editor behavior stable
49+
4. Dead migration branch cleanup
5850

59-
- Only one editor panel should be visible at a time.
60-
- Internal pooling can remain, but hidden editor focus/state must not mutate
61-
active tab.
51+
- Remove clearly obsolete helper paths or style/DOM hooks that are no longer used.
52+
- Avoid speculative cleanup outside touched areas.
6253

63-
4. Keep remove/add/rename flows coherent
54+
5. Workspace import specifier compatibility
6455

65-
- Remove fallback must be deterministic and tab-first.
66-
- Rename/add should not produce stale active state or content drift.
56+
- Support ESM-style runtime specifiers for workspace modules (for example importing
57+
`./src/components/module.js` from an underlying `.ts`/`.tsx` tab when appropriate).
58+
- Keep resolution deterministic: exact-match path first, extension-compat fallback second,
59+
with explicit handling for ambiguous matches.
6760

68-
5. Clean dead branches introduced during migration
61+
6. Extension-driven tab kind detection
6962

70-
- Remove obsolete helpers and stale wiring once replacement paths are active.
71-
- Remove only clearly dead CSS/DOM hooks tied to removed behavior.
63+
- Ensure new tabs can be created as CSS tabs without relying on active-tab lane assumptions.
64+
- Add flow should expose explicit editor type selection (`Component`, `Styles`, `Auto`)
65+
so users can disambiguate toolsets at creation time.
66+
- Infer tab kind from filename extension/path when adding or renaming tabs
67+
(for example `.css`, `.less`, `.sass` -> styles tab behavior).
68+
- `Auto` should infer from extension, while explicit user selection should override inference.
69+
- Keep editor language, tools, and render pipeline wiring aligned with inferred tab kind.
7270

7371
### Suggested execution sequence
7472

75-
1. Audit active-tab flow in `src/app.js`:
73+
1. Audit high-risk flows in `src/app.js`:
7674

7775
- `setActiveWorkspaceTab`
7876
- `loadWorkspaceTabIntoEditor`
7977
- remove-tab fallback logic
80-
- startup restore logic
78+
- startup restore path
8179

82-
2. Convert remaining kind-branch activation to tab-id-first selection.
80+
2. Confirm entry resolution consistency with `src/modules/preview-entry-resolver.js`.
8381

84-
3. Re-test high-risk interactions manually:
82+
3. Re-test high-risk interactions:
8583

86-
- initial load with App entry tab
87-
- select between multiple component and style tabs
84+
- first load/restore with entry tab
85+
- tab switching across component and style tabs
8886
- add tab, rename tab, remove non-entry tab
89-
- switch style modes and verify preview keeps rendering
87+
- style mode switches with preview render continuity
88+
- importing workspace modules via `.js` specifiers when source tabs are `.ts`/`.tsx`
89+
- creating and renaming tabs with style extensions to verify styles-tab behavior
9090

9191
4. Run validation:
9292

9393
```bash
9494
npm run lint
9595
npm run build
96+
npm run test:e2e
9697
```
9798

98-
5. If behavior changed, update docs briefly in `docs/`.
99+
5. Update docs only if behavior contract changes.
99100

100101
### Definition of done
101102

102-
- App entry tab is reliably selectable on initial load.
103-
- No hidden-focus path can override active tab unexpectedly.
104-
- Active tab, visible editor, and persisted content stay in sync.
105-
- Remove/add/rename flows are stable and deterministic.
106-
- Lint/build pass.
103+
- Active tab id, visible editor, and persisted content remain synchronized.
104+
- Entry tab is stable on startup and remains renderable.
105+
- Remove/add/rename flows are deterministic under rapid interaction.
106+
- Workspace import resolution supports documented ESM-style extension compatibility.
107+
- New tab behavior correctly recognizes style-file extensions and routes to styles semantics.
108+
- No stale migration branches remain in touched code.
109+
- Lint/build/e2e pass.

0 commit comments

Comments
 (0)