@xingtukeji/micro 1.1.4 → 1.1.5

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.
Files changed (2) hide show
  1. package/dist/index.js +15 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3,15 +3,15 @@ var C = Object.defineProperty, U = Object.defineProperties;
3
3
  var A = Object.getOwnPropertyDescriptors;
4
4
  var I = Object.getOwnPropertySymbols;
5
5
  var S = Object.prototype.hasOwnProperty, L = Object.prototype.propertyIsEnumerable;
6
- var w = (e, t, n) => t in e ? C(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, d = (e, t) => {
6
+ var y = (e, t, n) => t in e ? C(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, d = (e, t) => {
7
7
  for (var n in t || (t = {}))
8
- S.call(t, n) && w(e, n, t[n]);
8
+ S.call(t, n) && y(e, n, t[n]);
9
9
  if (I)
10
10
  for (var n of I(t))
11
- L.call(t, n) && w(e, n, t[n]);
11
+ L.call(t, n) && y(e, n, t[n]);
12
12
  return e;
13
13
  }, m = (e, t) => U(e, A(t));
14
- var p = (e, t, n) => (w(e, typeof t != "symbol" ? t + "" : t, n), n);
14
+ var p = (e, t, n) => (y(e, typeof t != "symbol" ? t + "" : t, n), n);
15
15
  var g = (e, t, n) => new Promise((r, o) => {
16
16
  var s = (l) => {
17
17
  try {
@@ -70,7 +70,7 @@ Object.defineProperty(window, c.IS_MICRO, {
70
70
  M.value = e;
71
71
  }
72
72
  });
73
- const y = (e) => `${c.DOM_ID_PREFIX}${e}`, B = (e) => {
73
+ const w = (e) => `${c.DOM_ID_PREFIX}${e}`, B = (e) => {
74
74
  function t(i) {
75
75
  return i !== null && typeof i == "object" && !Array.isArray(i);
76
76
  }
@@ -92,13 +92,13 @@ const y = (e) => `${c.DOM_ID_PREFIX}${e}`, B = (e) => {
92
92
  }, j = () => {
93
93
  const e = document.createElement("div");
94
94
  return e.innerHTML = "应用加载中...", e.style.textAlign = "center", e.style.lineHeight = "100px", e.style.fontSize = "20px", e.style.color = "#999", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.right = "0", e.style.bottom = "0", e.style.zIndex = "999", e.style.background = "#fff", e.style.opacity = "0", e.style.transition = "opacity 0.5s", e;
95
- }, D = (e) => {
95
+ }, F = (e) => {
96
96
  e.style.opacity = "0", setTimeout(() => {
97
97
  e.remove();
98
98
  }, 500);
99
- }, F = (e) => {
99
+ }, K = (e) => {
100
100
  const t = document.createElement("iframe");
101
- t.id = y(e.app.name);
101
+ t.id = w(e.app.name);
102
102
  const n = B(e.app);
103
103
  t.src = n, t.style.width = "100%", t.style.height = "100%", t.style.border = "none", t.style.margin = "0", t.style.padding = "0", t.addEventListener("load", (o) => e.onLoad.call(e, o)), t.addEventListener("error", (o) => e.onError.call(e, o)), t.addEventListener("unload", (o) => e.onUnload.call(e, o));
104
104
  const r = new MutationObserver((o) => {
@@ -108,7 +108,7 @@ const y = (e) => `${c.DOM_ID_PREFIX}${e}`, B = (e) => {
108
108
  });
109
109
  return r.observe(e.panel, { childList: !0 }), t;
110
110
  };
111
- class K {
111
+ class D {
112
112
  constructor(t) {
113
113
  p(this, "app");
114
114
  p(this, "dom");
@@ -121,8 +121,8 @@ class K {
121
121
  let r;
122
122
  if (t ? (typeof t == "string" ? r = document.querySelector(t) : r = t, r.innerHTML = "") : r = document.body, r) {
123
123
  this.panel = r;
124
- let o = document.getElementById(y(this.app.name));
125
- o || (o = F(this), this.dom = o), n ? o.style.display = "none" : o.style.removeProperty("display");
124
+ let o = document.getElementById(w(this.app.name));
125
+ o || (o = K(this), this.dom = o), n ? o.style.display = "none" : o.style.removeProperty("display");
126
126
  const s = j();
127
127
  this.loadingTimer = setTimeout(() => {
128
128
  this.loading = s, r.appendChild(s);
@@ -132,7 +132,7 @@ class K {
132
132
  }
133
133
  unmount() {
134
134
  var n;
135
- const t = document.getElementById(y(this.app.name));
135
+ const t = document.getElementById(w(this.app.name));
136
136
  if (t)
137
137
  this.app.preload ? (t.style.display = "none", document.body.appendChild(t)) : (n = this.panel) == null || n.removeChild(t);
138
138
  else
@@ -154,13 +154,13 @@ class K {
154
154
  }
155
155
  reload() {
156
156
  const t = this.dom.src;
157
- this.dom.src = t + (t.includes("?") ? "&" : "?") + "__t=" + Date.now();
157
+ this.dom.src = t;
158
158
  }
159
159
  changeOptions(t) {
160
160
  this.app = d(d({}, this.app), t);
161
161
  }
162
162
  onLoad(t) {
163
- console.debug("app onLoad", this.app.name, t), this.loadingTimer && clearTimeout(this.loadingTimer), this.loading && D(this.loading), W(this), this.app.onLoad && this.app.onLoad(t, this);
163
+ console.debug("app onLoad", this.app.name, t), this.loadingTimer && clearTimeout(this.loadingTimer), this.loading && F(this.loading), W(this), this.app.onLoad && this.app.onLoad(t, this);
164
164
  }
165
165
  onUnload(t) {
166
166
  console.debug("app onUnload", this.app.name, t), this.app.onUnload && this.app.onUnload(t, this);
@@ -259,7 +259,7 @@ const G = {
259
259
  }
260
260
  const t = Object.assign({}, G, e);
261
261
  return f[e.name] = m(d({}, t), {
262
- instance: new K(e)
262
+ instance: new D(e)
263
263
  }), f[e.name];
264
264
  }, R = (e) => f[e], Q = (e, t) => f[e.name] = d(d({}, e), t), Y = (e, t) => new Promise((n, r) => {
265
265
  let o = R(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xingtukeji/micro",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "main": "dist/index.js",