refactor(managers): accept registry parameter via constructor injection

All 16 managers now receive ManagerRegistry instance through constructor
instead of calling ManagerRegistry.getInstance(). This enables each
BimEngine instance to have its own isolated set of managers.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
yuding
2026-02-28 10:08:36 +08:00
parent 963e0d6cad
commit 73edf0b3b8
16 changed files with 86 additions and 30 deletions

View File

@@ -6,6 +6,7 @@ import { BimButtonGroup } from '../components/button-group';
import type { ButtonGroupOptions } from '../components/button-group/index.type';
import type { ThemeConfig } from '../themes/types';
import { BaseManager } from '../core/base-manager';
import { ManagerRegistry } from '../core/manager-registry';
/**
* 按钮组管理器
@@ -17,8 +18,8 @@ export class ButtonGroupManager extends BaseManager {
/** 容器元素 */
private container: HTMLElement;
constructor(container: HTMLElement) {
super();
constructor(container: HTMLElement, registry: ManagerRegistry) {
super(registry);
this.container = container;
}
@@ -31,6 +32,7 @@ export class ButtonGroupManager extends BaseManager {
public create(id: string, options: Omit<ButtonGroupOptions, 'container'>): BimButtonGroup {
const group = new BimButtonGroup({
container: this.container,
registry: this.registry,
...options
});