Skip to content

Refactor/module 4.0.0#36

Merged
zxyao145 merged 19 commits into
mainfrom
refactor/module-4.0.0
Mar 11, 2026
Merged

Refactor/module 4.0.0#36
zxyao145 merged 19 commits into
mainfrom
refactor/module-4.0.0

Conversation

@zxyao145
Copy link
Copy Markdown
Owner

No description provided.

zxyao145 and others added 18 commits March 1, 2026 23:59
- 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
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +1 to +3
export function beforeWebStart() {
loadScriptAndStyle();
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment thread src/BQuery/BqEvents.cs
Comment on lines +101 to +104
foreach (var windowEvent in eventList)
{
_registeredEvents.Remove(windowEvent);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@zxyao145
Copy link
Copy Markdown
Owner Author

@codex generate the breaking changes

@chatgpt-codex-connector
Copy link
Copy Markdown

Summary

  • Added a new “Breaking changes (4.0.0)” section to the README documenting upgrade-impacting changes for 3.x → 4.x (TFM support change, startup extension removal, and resize payload update). README.mdL25-L31
  • Added a concise upgrade checklist with concrete migration steps (update TFM, use AddBQuery(), ensure script load, update resize handler signatures). README.mdL33-L38
  • Committed the change as 991711a and created a follow-up PR via the make_pr tool titled “[Follow-up] Document 4.0.0 breaking changes for Refactor/module 4.0.0”.

Testing

  • ⚠️ curl -I https://keepachangelog.com/en/1.1.0/ | head (network egress blocked in this environment; received HTTP 403 CONNECT tunnel error)
  • dotnet build (failed because dotnet is not installed in this environment: command not found)

View task →

@zxyao145 zxyao145 merged commit 8cdccf7 into main Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant