Apply Butil improvements (#12393)#12419
Conversation
|
Important Review skippedToo many files! This PR contains 226 files, which is 76 over the limit of 150. To get a review, narrow the scope: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (226)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai re-review |
|
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Pull request overview
This PR delivers a large set of "Butil improvements" (closes #12393). It expands the Bit.Butil JS-interop surface with many new Web-API wrappers (Battery, BroadcastChannel, ContactPicker, EyeDropper, Fetch, FileReader, Geolocation, IdleDetector, IndexedDb, MediaDevices, Mutation/Resize/Intersection Observers, NetworkInformation, Nfc, ObjectUrls, Performance, Permissions, Push, Reporting, SpeechRecognition/Synthesis, StorageManager, WakeLock, WebAudio, WebLocks, CookieStore, etc.), refactors the demo project (new MainLayout/NavMenu, DemoCard/DemoConsole/PageHeader shared components, redesigned Index/Keyboard/UserAgent pages), and adds a new end-to-end test project plus a CI workflow.
Changes:
- Adds ~40 new public service classes plus matching listener managers, DTOs, and TypeScript modules implementing the wrappers.
- Reworks the Butil demo UI shell and several pages, drops the old
Header.razor/CSS, and swaps_content/Bit.Butil.Demo.Core/app.cssinto the host HTML. - Adds
Bit.Butil.E2ETestsPlaywright/NUnit suite (and CI workflow) plus tweaksJSRuntimeExtensions/BitButil.cs(service lifetime change toScoped, simplified runtime-validity check, no longer swallowingJsonException).
Reviewed changes
Copilot reviewed 225 out of 225 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Butil/Bit.Butil/BitButil.cs | Switches all service registrations from Transient to Scoped and registers the many new services. |
| src/Butil/Bit.Butil/Extensions/{InternalJSRuntimeExtensions,JSRuntimeExtensions}.cs | Simplifies runtime-validity detection and stops swallowing JsonException in FastInvoke*. |
| src/Butil/Bit.Butil/Publics/**/*.cs | Adds wrapper classes (Fetch, Push, Permissions, WakeLock, MediaDevices, Nfc, …) and DTOs/handles. |
| src/Butil/Bit.Butil/Internals/**/*ListenersManager.cs | New static managers for the corresponding listener types, with [JSInvokable] callbacks. |
| src/Butil/Bit.Butil/Scripts/*.ts | New TS modules implementing every JS-side counterpart, plus tweaks to existing events.ts, keyboard.ts, navigator.ts, storage.ts, userAgent.ts, utils.ts, document.ts. |
| src/Butil/Bit.Butil/Publics/{History,Screen,ScreenOrientation,VisualViewport,Keyboard,Notification}.cs | Adds Subscribe* variants returning ButilSubscription, plus tracked-notification and element-scoped keyboard. |
| src/Butil/Bit.Butil/Publics/Cookie.cs | Hardens parsing of empty / malformed cookie strings. |
| src/Butil/Demo/Bit.Butil.Demo.Core/Shared/* | Replaces Header.razor with new MainLayout/NavMenu and adds DemoCard/DemoConsole/PageHeader. |
| src/Butil/Demo/Bit.Butil.Demo.Core/Pages/{Index,Keyboard,UserAgent}.razor | Redesigns landing and a couple of demo pages around the new shared components. |
| src/Butil/Demo/Bit.Butil.Demo.{Web,Maui}/wwwroot/index.html | Pulls in the new shared app.css. |
| src/Butil/tests/Bit.Butil.E2ETests/** | New Playwright/NUnit test project, infrastructure, page-scoped bases, README, CI workflow. |
|
@coderabbitai re-review |
|
✅ Actions performedFull review triggered. |
|
@coderabbitai re-review |
|
✅ Action performedFull review finished. |
|
@coderabbitai re-review |
|
✅ Action performedFull review finished. |
| var props = await userAgent.Extract(); // current browser | ||
| var props = await userAgent.Extract(uaString); // a specific string |
| public async ValueTask<bool> IsSupported() | ||
| => await js.Invoke<bool>("BitButil.permissions.isSupported"); |
| /// <summary> | ||
| /// Mirrors <see href="https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo">MediaDeviceInfo</see>. | ||
| /// </summary> | ||
| public class MediaDeviceInfoItem | ||
| { |
closes #12393