x-essential-lib 0.10.3 → 0.10.4

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.d.ts CHANGED
@@ -104,7 +104,7 @@ declare const globalObjects: {
104
104
  declare const eventBus: Emitter<Record<EventType, unknown>>;
105
105
  declare function waitMs(ms: number): Promise<void>;
106
106
  declare function waitUtil(conditionFunc: () => boolean, timeout?: number, interval?: number): Promise<boolean>;
107
- declare function appAppear(name: string, forward: boolean): void;
107
+ declare function appAppear(name: string, diff: number): void;
108
108
  //#endregion
109
109
  //#region src/utils/permission.d.ts
110
110
  declare enum Permission {
package/dist/index.js CHANGED
@@ -121,12 +121,12 @@ async function waitUtil(conditionFunc, timeout, interval) {
121
121
  check();
122
122
  });
123
123
  }
124
- function appAppear(name, forward) {
124
+ function appAppear(name, diff) {
125
125
  const appElement = document.getElementById("single-spa-application:" + name);
126
126
  if (!appElement) return;
127
127
  appElement.classList.remove("app-left", "app-right", "app-reset");
128
- if (forward) appElement.classList.add("app-left");
129
- else appElement.classList.add("app-right");
128
+ if (diff > 0) appElement.classList.add("app-left");
129
+ else if (diff < 0) appElement.classList.add("app-right");
130
130
  setTimeout(() => {
131
131
  appElement.classList.add("app-reset");
132
132
  }, 50);
@@ -586,13 +586,13 @@ function onBeforeChange(toPath, fromPath, lastAppPath) {
586
586
  console.info(`~~~~routeChange~~~~ ${fromPath} -> ${toPath}`);
587
587
  if (!fromRouteMeta) return;
588
588
  const sameApp = toRouteMeta.app === fromRouteMeta.app;
589
- const samePath = toRouteMeta.path === fromRouteMeta.path;
590
- const forward = toRouteMeta.level >= fromRouteMeta.level;
591
- if (sameApp) if (samePath) routeTransName.value = "";
592
- else routeTransName.value = forward ? "inner-left" : "inner-right";
589
+ const diff = toRouteMeta.level - fromRouteMeta.level;
590
+ if (sameApp) if (diff > 0) routeTransName.value = "inner-left";
591
+ else if (diff < 0) routeTransName.value = "inner-right";
592
+ else routeTransName.value = "";
593
593
  else {
594
594
  routeTransName.value = "";
595
- appAppear(toRouteMeta.app, forward);
595
+ appAppear(toRouteMeta.app, diff);
596
596
  }
597
597
  }
598
598
  function isHasAccessToken() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
- "version": "0.10.3",
3
+ "version": "0.10.4",
4
4
  "files": [
5
5
  "dist"
6
6
  ],