@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.
package/dist/index.esm.js CHANGED
@@ -2293,6 +2293,7 @@ class MicroAppModel {
2293
2293
  container.innerHTML = '';
2294
2294
  container.appendChild(fragment);
2295
2295
  this.container = container;
2296
+ this.initShadowRootContainer();
2296
2297
  this.sandBox?.activeated(this.data);
2297
2298
  callback?.(this);
2298
2299
  }
@@ -2326,9 +2327,21 @@ class MicroAppModel {
2326
2327
  this.state = AppState.DEACTIVATED;
2327
2328
  this.sandBox?.deactivated();
2328
2329
  }
2330
+ initShadowRootContainer() {
2331
+ if (this.container instanceof ShadowRoot) {
2332
+ Object.defineProperties(this.container, {
2333
+ getBoundingClientRect: {
2334
+ get() {
2335
+ return this.container.host.getBoundingClientRect;
2336
+ },
2337
+ },
2338
+ });
2339
+ }
2340
+ }
2329
2341
  mount(container, callback) {
2330
2342
  this.isPreLoad = false;
2331
2343
  this.container = container ?? this.container;
2344
+ this.initShadowRootContainer();
2332
2345
  this.state = AppState.MOUNTING;
2333
2346
  const app = this;
2334
2347
  if (this.container) {