@blueking/bk-weweb 0.0.19 → 0.0.20

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.
@@ -164,41 +164,6 @@ const isJsonpUrl = (url) => {
164
164
  return !pathname.match(/\.js$/);
165
165
  };
166
166
 
167
- /*
168
- * Tencent is pleased to support the open source community by making
169
- * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
170
- *
171
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
172
- *
173
- * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.
174
- *
175
- * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):
176
- *
177
- * ---------------------------------------------------
178
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
179
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
180
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
181
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
182
- *
183
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
184
- * the Software.
185
- *
186
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
187
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
188
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
189
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
190
- * IN THE SOFTWARE.
191
- */
192
- function activated(appKey, container, callback) {
193
- const app = appCache.getApp(appKey);
194
- if (app?.status === AppState.DEACTIVATED && app.keepAlive) {
195
- nextTask(() => app.activated(container, callback));
196
- }
197
- else {
198
- nextTask(() => app?.mount(container, callback));
199
- }
200
- }
201
-
202
167
  /*
203
168
  * Tencent is pleased to support the open source community by making
204
169
  * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
@@ -1638,6 +1603,48 @@ function beforeLoad() {
1638
1603
  rewriteDocumentPrototypeMethods();
1639
1604
  }
1640
1605
 
1606
+ /*
1607
+ * Tencent is pleased to support the open source community by making
1608
+ * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
1609
+ *
1610
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1611
+ *
1612
+ * 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.
1613
+ *
1614
+ * License for 蓝鲸智云PaaS平台 (BlueKing PaaS):
1615
+ *
1616
+ * ---------------------------------------------------
1617
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1618
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1619
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1620
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1621
+ *
1622
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1623
+ * the Software.
1624
+ *
1625
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1626
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1627
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1628
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1629
+ * IN THE SOFTWARE.
1630
+ */
1631
+ function activated(appKey, container, callback) {
1632
+ const app = appCache.getApp(appKey);
1633
+ if (app?.status === AppState.DEACTIVATED && app.keepAlive) {
1634
+ nextTask(() => {
1635
+ beforeLoad();
1636
+ app.activated(container, callback);
1637
+ });
1638
+ }
1639
+ else {
1640
+ app &&
1641
+ nextTask(() => {
1642
+ beforeLoad();
1643
+ app.mount(container, callback);
1644
+ });
1645
+ }
1646
+ }
1647
+
1641
1648
  /*
1642
1649
  * Tencent is pleased to support the open source community by making
1643
1650
  * 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
@@ -1740,13 +1747,13 @@ class BkWewebElement extends HTMLElement {
1740
1747
  };
1741
1748
  }
1742
1749
  attributeChangedCallback(attr, _oldVal, newVal) {
1743
- if (attr !== WewebCustomAttrs.url || this[attr] === newVal)
1750
+ if (attr !== WewebCustomAttrs.url || this[attr] === newVal || !this.connected)
1744
1751
  return;
1745
1752
  this.appUrl = newVal;
1746
- (this.connected || appCache.getApp(this.appKey)) && this.handleAttributeChanged();
1753
+ const cacheApp = appCache.getApp(this.appKey);
1754
+ (this.connected || cacheApp) && this.handleAttributeChanged();
1747
1755
  }
1748
1756
  async connectedCallback() {
1749
- beforeLoad();
1750
1757
  if (this.getBooleanAttr(WewebCustomAttrs.setShodowDom) && !this.shadowRoot) {
1751
1758
  this.attachShadow({ delegatesFocus: false, mode: 'open' });
1752
1759
  }
@@ -2242,8 +2249,6 @@ class SandBox {
2242
2249
  return;
2243
2250
  this.active = false;
2244
2251
  this.resetWindowFunction();
2245
- // this.injectedKeySet.forEach((key: PropertyKey) => Reflect.deleteProperty(this.fakeWindow, key));
2246
- // this.injectedKeySet.clear();
2247
2252
  this.inRawWindowKeySet.forEach((key) => Reflect.deleteProperty(window, key));
2248
2253
  this.inRawWindowKeySet.clear();
2249
2254
  this.resetDocumentAndBodyEvent?.();