@blueking/bk-weweb 0.0.2-5.beta.13 → 0.0.2-5.beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2408,6 +2408,7 @@ class MicroAppModel {
2408
2408
  container.innerHTML = '';
2409
2409
  container.appendChild(fragment);
2410
2410
  this.container = container;
2411
+ this.initShadowRootContainer();
2411
2412
  this.sandBox?.activeated(this.data);
2412
2413
  callback?.(this);
2413
2414
  }
@@ -2441,9 +2442,21 @@ class MicroAppModel {
2441
2442
  this.state = AppState.DEACTIVATED;
2442
2443
  this.sandBox?.deactivated();
2443
2444
  }
2445
+ initShadowRootContainer() {
2446
+ if (this.container instanceof ShadowRoot) {
2447
+ Object.defineProperties(this.container, {
2448
+ getBoundingClientRect: {
2449
+ get() {
2450
+ return this.container.host.getBoundingClientRect;
2451
+ },
2452
+ },
2453
+ });
2454
+ }
2455
+ }
2444
2456
  mount(container, callback) {
2445
2457
  this.isPreLoad = false;
2446
2458
  this.container = container ?? this.container;
2459
+ this.initShadowRootContainer();
2447
2460
  this.state = AppState.MOUNTING;
2448
2461
  const app = this;
2449
2462
  if (this.container) {