Skip to content

Commit a4cac1d

Browse files
authored
feat: P1-P5 Custom Controls Framework - Drop-in Replacement for Web Forms Controls
feat: P1-P5 Custom Controls Framework Drop-in Replacement for Web Forms Controls
2 parents 9a884b7 + f53f023 commit a4cac1d

200 files changed

Lines changed: 18438 additions & 64 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.squad/agents/beast/history.md

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Project Context
1+
# Project Context
22

33
- **Owner:** Jeffrey T. Fritz
44
- **Project:** BlazorWebFormsComponents — Blazor components emulating ASP.NET Web Forms controls for migration
@@ -11,6 +11,53 @@
1111

1212
<!-- ⚠ Summarized 2026-02-27 by Scribe — covers M1–M16 -->
1313

14+
### Issue #: Comprehensive Migration Documentation (User Controls, FindControl, Custom Control Base Classes)
15+
16+
**Status:** DELIVERED
17+
18+
**Session (2026-03-17 by Beast):**
19+
- Created/Updated 3 comprehensive migration guides covering 40+ KB of documentation
20+
- **docs/Migration/User-Controls.md** (Updated from TODO) 9 KB, ~300 lines
21+
- Web Forms ASCX structure Blazor .razor component conversion
22+
- Step-by-step migration: markup, properties, events, lifecycle, data binding, FindControl replacement
23+
- Complete EmployeeList example before/after
24+
- Common pitfalls + solutions (parameter binding, element access, nested components, context loss)
25+
- BWFC component integration recommendations
26+
27+
- **docs/Migration/FindControl-Migration.md** (New) 16 KB, ~550 lines
28+
- Explains FindControl purpose in Web Forms control tree
29+
- Deep dive: naming container boundaries (master pages, content placeholders, templates)
30+
- Real examples from DepartmentPortal (master message control, SectionPanel with repeater)
31+
- 5 Blazor patterns to replace FindControl: @ref, parameters, cascading parameters, EventCallback, DI
32+
- BWFC's FindControl limitations + when to use it
33+
- Complete migration examples table (Web Forms pattern Blazor equivalent)
34+
- Common pitfalls (assuming @ref works like FindControl, null checks, state mutation)
35+
36+
- **docs/Migration/CustomControl-BaseClasses.md** (New) 23 KB, ~800 lines
37+
- Inventory of current BWFC base classes: BaseWebFormsComponent, BaseStyledComponent, DataBoundComponent<T>, WebControl, CompositeControl, DataBoundControl, HtmlTextWriter
38+
- Web Forms BWFC mapping table for all base class equivalents
39+
- **5 Planned Improvements (P1P5) with full specification:**
40+
- **P1: DataBoundWebControl<T>** Bridges DataBoundControl + HtmlTextWriter rendering. EmployeeDataGrid use case.
41+
- **P2: TagKey + AddAttributesToRender** Auto-renders outer tag with attributes. StarRating, NotificationBell use cases. Simplifies 80% of migrations.
42+
- **P3: HtmlTextWriter Enum Expansion** HTML5 tags (Nav, Section, Article, etc.), ARIA/data attributes, modern CSS (flexbox, grid, transforms). Modern markup patterns.
43+
- **P4: CompositeControl Mixed Children** Support WebControl + markup + Blazor components. EmployeeCard complexity.
44+
- **P5: ITemplate RenderFragment Bridge** Web Forms Blazor template pattern translation. SectionPanel use case.
45+
- Each P1P5 includes: current state, what's missing, DepartmentPortal example, proposed API
46+
- Implementation priority order: P2 P1 P3 P4 P5 (with dependency matrix)
47+
48+
- Updated mkdocs.yml navigation:
49+
- Added "Custom Control Base Classes: Migration/CustomControl-BaseClasses.md" (after Custom Controls)
50+
- Added "FindControl Migration: Migration/FindControl-Migration.md" (after User Controls)
51+
52+
**Key Documentation Patterns:**
53+
- Followed established Beast style from Custom-Controls.md + MasterPages.md (before/after code, tables, "See Also" links)
54+
- DepartmentPortal as primary reference for real-world examples (EmployeeList, SectionPanel, StarRating, etc.)
55+
- Web Forms Blazor mapping tables for quick translation reference
56+
- Pitfall sections with solutions for each guide
57+
- "See Also" cross-references between related guides
58+
59+
60+
1461
<!-- ⚠ Summarized 2026-03-06 by Scribe — older entries archived -->
1562

1663
### Archived Sessions
@@ -563,3 +610,25 @@ Updated `.squad/skills/migration-standards/SKILL.md` to add new section at end:
563610

564611
**Team update (2026-03-20):** Analyzer architecture guide (579 lines) + expanded Analyzers.md (+363 lines). Deprecation Guidance docs (#438, 32 KB). BaseValidator/BaseCompareValidator base class docs. MkDocs strict build clean. PR #487 opened on upstream. decided by Beast
565612

613+
614+
615+
### Issue #495: P1-P5 Custom Controls Framework Developer Documentation
616+
617+
**Status:** DELIVERED
618+
619+
**Session (2026-03-22 by Beast):**
620+
- Created `dev-docs/proposals/p1-p5-custom-controls-framework.md` (~33 KB, ~500 lines)
621+
- Executive summary, class hierarchy diagram, full API reference for 9 classes/interfaces
622+
- Design decisions (TagKey vs strings, placeholder templating, generic DataSource, Literal alias)
623+
- 5 migration patterns with before/after code examples
624+
- Honest "can't be shimmed" table (ViewState, PostBack, DataSourceID, etc.)
625+
- DepartmentPortal validation (5/7 drop-in, 2 manual rewrite)
626+
- Test coverage map (40 new tests, 16 test components)
627+
- Upstream issues table linking #490-#496
628+
- Updated `dev-docs/README.md` with proposals/ table entry
629+
630+
**Key learnings:**
631+
- Reading actual source to verify API surfaces is critical task description said 48 new tests but actual count is 40 in 4 new test files (plus 23 pre-existing across 3 files)
632+
- Enum counts from source: HtmlTextWriterTag=78, HtmlTextWriterAttribute=55, HtmlTextWriterStyle=77
633+
- `DataBoundWebControl<T>` design around Blazor's case-insensitive parameter matching is a subtle but important constraint worth documenting prominently
634+
- The placeholder approach (`<!--BWFC_TPL_N-->`) for template interleaving is novel and deserves detailed explanation for future contributors

.squad/agents/colossus/history.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,25 @@ Added 5 smoke tests (Timer, UpdatePanel, UpdateProgress, ScriptManager, Substitu
134134

135135
📌 Team update (2026-03-14): Students LEFT JOIN fix completed by Cyclops — replaced SelectMany (INNER JOIN) with Students.Include(Enrollments) loop. Students without enrollments appear with Count=0, Date=DateTime.Today. Colossus verified Playwright test timing fixes already in place from previous session. All tests passing. Commit d3dc610f.
136136

137+
## Session: 2026-03-22 — Analyzer Expansion BWFC020-023
138+
139+
**Task:** Expand BWFC Analyzers with 4 new custom control migration pattern detectors.
140+
141+
**Created:**
142+
- BWFC020 (ViewStatePropertyPattern): Detects `get { return (T)ViewState["key"]; } set { ViewState["key"] = value; }` properties. Info severity. Code fix converts to `[Parameter] public T Name { get; set; }`.
143+
- BWFC021 (FindControlUsage): Detects `FindControl("id")` calls. Warning severity. Code fix replaces with `FindControlRecursive("id")`.
144+
- BWFC022 (PageClientScriptUsage): Detects `Page.ClientScript.*` usage. Warning severity. No code fix.
145+
- BWFC023 (IPostBackEventHandlerUsage): Detects classes implementing `IPostBackEventHandler`. Warning severity. No code fix.
146+
147+
**Files created:** 6 analyzer source files, 4 test files. Updated `AnalyzerReleases.Unshipped.md` and `AllAnalyzersIntegrationTests.cs`.
148+
149+
**Verification:** All 139 tests pass (was 130 before). Build clean.
150+
151+
## Learnings
152+
153+
- Text-based (`SourceText.Replace`) code fixes are fragile for property replacement — FullSpan includes trivia that complicates newline/indentation. Prefer the syntax tree approach: use `property.WithAccessorList()` + `AddAttributeLists()` without `NormalizeWhitespace()`. Only use `NormalizeWhitespace()` when you can also fully control leading/trailing trivia on all lines.
154+
- New "Migration" category introduced for BWFC020-023. Updated `AllAnalyzers_HaveValidCategory` integration test to accept both "Usage" and "Migration" categories.
155+
137156

138157
**Summary:** 40 tests total — 11 passed, 29 failed, 0 skipped (33.5s duration)
139158

.squad/agents/cyclops/history.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Project Context
1+
# Project Context
22

33
- **Owner:** Jeffrey T. Fritz
44
- **Project:** BlazorWebFormsComponents Blazor components emulating ASP.NET Web Forms controls for migration
@@ -500,3 +500,28 @@ Team update: ModalPopupExtender and CollapsiblePanelExtender implemented by Cycl
500500
### CI Workflow: Analyzer Tests Added (2026-03-20)
501501

502502
**Summary:** Updated .github/workflows/build.yml to restore, build, run, upload, and publish analyzer test results alongside the existing unit tests. Also replaced the squad-ci.yml placeholder with real dotnet restore/build/test commands covering both test suites, including setup-dotnet for .NET 10. YAML validated with Python yaml parser.
503+
504+
### Focus() Method on BaseWebFormsComponent (2026-03-22)
505+
506+
**Summary:** Added public virtual void Focus() to BaseWebFormsComponent matching the ASP.NET Web Forms Control.Focus() API. Uses fire-and-forget JS interop (_ = JsRuntime.InvokeVoidAsync("bwfc.Page.Focus", ClientID)) same discard pattern validators use. Null-guards JsRuntime for SSR pre-render safety. Added wfc.Page.Focus(elementId) JS function to both Basepage.js (IIFE global) and Basepage.module.js (ES module export + window binding). Build: 0 errors. CustomControl tests: 63/63 pass.
507+
508+
### DepartmentPortal Custom Controls Migration (2026-03-22)
509+
510+
**Summary:** Migrated all 7 custom controls from `samples/DepartmentPortal/Code/Controls/` to Blazor components in `samples/AfterDepartmentPortal/Components/Controls/`. Each control inherits from the appropriate BWFC CustomControls base class (WebControl, DataBoundWebControl, or TemplatedWebControl).
511+
512+
**Controls migrated:**
513+
- **StarRating** (WebControl) ViewState[Parameter], TagKey=Span, star rendering with color params
514+
- **NotificationBell** (WebControl) TagKey=Div, EventCallback<NotificationEventArgs>, drawer rendering
515+
- **EmployeeCard** (WebControl) CompositeControlflat RenderContents, photo/info/details link
516+
- **EmployeeDataGrid** (DataBoundWebControl) PerformDataBinding override, paging/sorting/search
517+
- **DepartmentBreadcrumb** (WebControl) IPostBackEventHandler removed, EventCallback<BreadcrumbEventArgs>
518+
- **PollQuestion** (WebControl) IPostBackEventHandler removed, EventCallback<PollVoteEventArgs>, radio buttons
519+
- **SectionPanel** (TemplatedWebControl) ITemplateRenderFragment, RenderTemplate() helper for header/content/footer
520+
521+
**Also created:** BreadcrumbEventArgs.cs, NotificationEventArgs.cs, PollVoteEventArgs.cs
522+
523+
**Pages updated:** Dashboard.razor (SectionPanel, PollQuestion, NotificationBell), Employees.razor (EmployeeDataGrid with sample data)
524+
525+
**Key patterns applied:** var everywhere (IDE0007), WebUtility.HtmlEncode instead of HttpUtility, Blazor route URLs instead of .aspx, `new()` target-typed syntax.
526+
527+
**Build:** 0 errors, 0 warnings (excluding pre-existing NU1510 from upstream deps).

0 commit comments

Comments
 (0)