Skip to content

Commit 43dca78

Browse files
feat: start dynamic tabs.
1 parent 7832231 commit 43dca78

10 files changed

Lines changed: 2334 additions & 279 deletions
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Full Pass Refactor Prompt: Workspace-First Editor + UI Cleanup
2+
3+
Use this document as the implementation prompt for a full-pass refactor of
4+
`@knighted/develop` editor workspace UX and runtime wiring.
5+
6+
## Prompt
7+
8+
You are refactoring `@knighted/develop` in one cohesive pass.
9+
10+
### Primary objective
11+
12+
Deliver a clean, workspace-first editor architecture with dynamic tabs and a
13+
single generalized editor model, then remove obsolete code and CSS. Do not
14+
keep transitional compatibility layers unless required for current behavior.
15+
16+
### Product direction
17+
18+
- The app has editor panel(s) and a preview panel.
19+
- Do not model the editor UI as fixed "Component panel" and "Styles panel".
20+
- Tabs are the source of truth for editor content and editor identity.
21+
- Entry behavior is tab metadata-driven (`role: entry`) rather than filename
22+
heuristics alone.
23+
- Default workspace includes an entry tab (`src/components/App.tsx`) and a
24+
style tab (`src/styles/app.css`).
25+
26+
### Required outcomes
27+
28+
1. Generalized editor model
29+
30+
- Replace component/styles-specific control flow with a generalized editor-tab
31+
flow where possible.
32+
- Keep legacy identifiers only where integration boundaries require them, and
33+
document each remaining boundary.
34+
35+
2. Tab UX completeness
36+
37+
- Selecting any tab always reveals the correct editor content.
38+
- Add flow supports explicit custom tab naming at creation time.
39+
- Rename is first-class and discoverable (not hidden-only gesture).
40+
- Tab remove behavior is consistent and guarded for `entry` role.
41+
42+
3. Editor panel behavior
43+
44+
- Default behavior: one active editor visible.
45+
- Architecture allows future expansion to dual editor view (pin/split) without
46+
major rewrites.
47+
48+
4. Preview consistency
49+
50+
- Preview uses the resolved entry tab and workspace dependency hydration.
51+
- Error states are surfaced clearly (no silent blank preview when avoidable).
52+
53+
5. CSS and DOM cleanup
54+
55+
- Remove obsolete selectors, dead classes, and stale panel-specific style
56+
branches introduced by transition work.
57+
- Remove styles and markup that no longer map to active UI behavior.
58+
- Keep naming consistent with the new generalized model.
59+
60+
6. State and persistence cleanup
61+
62+
- Workspace state should be centered on IndexedDB-backed workspace records.
63+
- Remove or minimize stale localStorage-driven UI context persistence where it
64+
is no longer aligned with the new model.
65+
- Preserve only local storage that is still intentionally in scope (for
66+
example token storage) and document why.
67+
68+
### Refactor constraints
69+
70+
- Keep changes focused to `@knighted/develop`.
71+
- Preserve CDN-first runtime behavior.
72+
- Preserve current lint/build/test pipelines.
73+
- Prefer replacing old code over layering additional compatibility logic.
74+
- Avoid broad visual rewrites unrelated to workspace/editor architecture.
75+
76+
### Cleanup policy
77+
78+
For every modified area:
79+
80+
- Delete dead code in the same pass.
81+
- Delete unreachable CSS in the same pass.
82+
- Delete unused DOM hooks in the same pass.
83+
- Delete stale helper functions once call sites are migrated.
84+
- Do not leave TODO-only transition stubs unless explicitly necessary.
85+
86+
### Validation checklist (must run)
87+
88+
```bash
89+
npm run lint
90+
npm run build
91+
```
92+
93+
If UI interactions changed materially, run relevant Playwright coverage for
94+
workspace tabs and preview rendering paths.
95+
96+
### Deliverables
97+
98+
1. Refactored implementation in `src/` and related modules.
99+
2. Removed obsolete code and CSS (not just deprecated).
100+
3. Updated docs for any behavior/workflow changes.
101+
4. Short migration summary including:
102+
103+
- What was removed.
104+
- What remains intentionally legacy and why.
105+
- Follow-up items only if truly blocked.
106+
107+
### Acceptance criteria
108+
109+
- No known bug where selecting an entry tab fails to show its editor.
110+
- No permanently hidden primary editor panel due to stale panel assumptions.
111+
- Users can name tabs on add and rename any non-restricted tab directly.
112+
- CSS does not include obvious dead/legacy panel-era branches.
113+
- Lint/build pass.
114+
115+
## Suggested execution order
116+
117+
1. Stabilize editor visibility and tab activation semantics.
118+
2. Generalize editor model and panel naming in code.
119+
3. Migrate add/rename/remove flows to final UX.
120+
4. Remove stale component/styles-specific branches and dead CSS.
121+
5. Re-run validation and update docs.

0 commit comments

Comments
 (0)