Refactor/module 4.0.0#36
Conversation
- Restructure the core JS interop surface around BqObject and module constants - Add selective window event binding and async event handlers for Blazor integration - Introduce the BlazorAppAuto sample and update sample projects to the new src layout (cherry picked from commit 38dc741f98aeefc24be1c7f9ad241faaac53bffa) Signed-off-by: zxyao145 <zxyao145@gmail.com>
- move event registration from static interop to scoped BqObject instances - add listener removal and disposal paths to avoid shared window handlers
- replace static Bq access with DI-backed BqObject services - unify window event registration names and close event forwarding - update docs and samples for the scoped API surface
Improve robustness by catching and reporting exceptions from both sync and async event handlers in BqEvents. Faulty handlers no longer prevent others from running. Async handlers are awaited in parallel, and all exceptions are logged to the console. Applies to both single- and two-argument event slots.
- route BqObject window event and user agent calls through string-based global methods - simplify BqViewport to use IJSRuntime directly instead of module references
- replace the DbClick event surface with DoubleClick naming - rework drag handling to use pointer events and expose reset helpers - initialize bQuery on script load to simplify app startup BREAKING CHANGE: public DbClick event members and JS callback names are now DoubleClick
- Introduce a Roslyn generator to derive JS interop method keys from constants - Move the main library under src/BQuery and update project references
- Generate BqEvents members from WindowEvents metadata to remove repetitive boilerplate - Standardize JS interop callers on generated method constants and document the pattern in CLAUDE.md
…eeventargs Refactor resize event payload to ResizeEventArgs
🎯 Project: BQuery (C#/.NET + TypeScript) 📍 Milestone: v10.0.0 开发中 - 模块化重构 🏥 Health Score: 8.5/10 📋 Initial State: • 34个源码文件 (C#/TypeScript) • README.md 已更新 (版本表、ES模块路径) • 源代码生成器架构已实现 ✅ Documentation Updates: • README.md: 更新版本表 (10.x -> .NET 8.0/10.0) • README.md: 更新脚本引用为 ES 模块格式 (.mjs) • CLAUDE.md: 添加 Checkpoint 记录章节 🔍 checkpoint | Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…ndowevent Generate WindowEvent-to-EventSlot dictionary in window events generator
- Updated version in TS-API.md, BQuery.csproj, package.json, and index.ts to 4.0.0. - Removed obsolete ServiceExtension and WebAssemblyHostExtension files. - Introduced new Bq class for managing window events and viewport operations. - Enhanced BqEvents class with improved event listener management. - Added debugging logs in event handling for better traceability. - Cleaned up JS runtime extensions and ensured compatibility with new structure.
Comprehensive refactor of BQuery C# and TypeScript APIs: - Introduced explicit SetAttr/GetAttr/RemoveAttr methods for DOM attributes - Switched extension methods to ValueTask, removed IJSRuntime params - Deprecated DomHelper in favor of extension methods - Updated JsModuleConstants and event binding logic - Rewrote and reorganized documentation (README, API.md, TS-API.md, agent guides) - Added Biome for formatting/linting; updated build scripts and configs - Reformatted all TypeScript code for consistency - Improved event binding and cleanup logic - Cleaned up imports and sample code for clarity and maintainability
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1f29d38af
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| export function beforeWebStart() { | ||
| loadScriptAndStyle(); | ||
| } |
There was a problem hiding this comment.
Await bQuery script load during beforeWebStart
beforeWebStart returns immediately after appending the script tag, so Blazor startup can continue before _content/BQuery/dist/bQuery.min.js has executed and created window.bQuery. On slower/cold loads this causes the first JS interop calls (for example in first render) to fail intermittently with missing-function errors; returning/awaiting a load promise here avoids that race.
Useful? React with 👍 / 👎.
| foreach (var windowEvent in eventList) | ||
| { | ||
| _registeredEvents.Remove(windowEvent); | ||
| } |
There was a problem hiding this comment.
Track event listener ownership before removing scoped events
RemoveWindowEventListeners unconditionally removes each event from JS for the whole BqEvents scope, but AddWindowEventListeners only stores a de-duplicated HashSet and does not track how many callers requested the same event. In Blazor (where scoped services are shared across components per circuit/app), one component disposing/unregistering OnResize will stop delivery for other components in the same scope that still rely on it.
Useful? React with 👍 / 👎.
|
@codex generate the breaking changes |
|
Summary
Testing
|
No description provided.