@cartridge/controller 0.9.1 → 0.9.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cartridge/controller",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "Cartridge Controller",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -53,7 +53,7 @@
53
53
  "vite-plugin-node-polyfills": "^0.23.0",
54
54
  "vite-plugin-top-level-await": "^1.4.4",
55
55
  "vite-plugin-wasm": "^3.4.1",
56
- "@cartridge/tsconfig": "0.9.1"
56
+ "@cartridge/tsconfig": "0.9.2"
57
57
  },
58
58
  "scripts": {
59
59
  "build:deps": "pnpm build",
package/src/controller.ts CHANGED
@@ -89,8 +89,12 @@ export default class ControllerProvider extends BaseProvider {
89
89
  iframes.forEach((iframe) => {
90
90
  const container = iframe.parentElement;
91
91
  if (container) {
92
- container.style.visibility = "hidden";
92
+ // Start fade-out transition
93
93
  container.style.opacity = "0";
94
+ // Set display: none after transition completes
95
+ setTimeout(() => {
96
+ container.style.display = "none";
97
+ }, 200);
94
98
  }
95
99
  });
96
100
 
@@ -15,6 +15,7 @@ export class IFrame<CallSender extends {}> implements Modal {
15
15
  private container?: HTMLDivElement;
16
16
  private onClose?: () => void;
17
17
  private child?: AsyncMethodReturns<CallSender>;
18
+ private closeTimeout?: NodeJS.Timeout;
18
19
 
19
20
  constructor({
20
21
  id,
@@ -64,12 +65,11 @@ export class IFrame<CallSender extends {}> implements Modal {
64
65
  container.style.left = "0";
65
66
  container.style.zIndex = "10000";
66
67
  container.style.backgroundColor = "rgba(0,0,0,0.6)";
67
- container.style.display = "flex";
68
+ container.style.display = "none"; // Use display: none to completely hide from password managers
68
69
  container.style.alignItems = "center";
69
70
  container.style.justifyContent = "center";
70
- container.style.visibility = "hidden";
71
- container.style.opacity = "0";
72
71
  container.style.transition = "opacity 0.2s ease";
72
+ container.style.opacity = "0";
73
73
  container.style.pointerEvents = "auto";
74
74
  container.appendChild(iframe);
75
75
 
@@ -134,10 +134,22 @@ export class IFrame<CallSender extends {}> implements Modal {
134
134
  open() {
135
135
  if (!this.container || typeof document === "undefined" || !document.body)
136
136
  return;
137
+
138
+ // Clear any pending close timeout to prevent race condition
139
+ if (this.closeTimeout) {
140
+ clearTimeout(this.closeTimeout);
141
+ this.closeTimeout = undefined;
142
+ }
143
+
137
144
  document.body.style.overflow = "hidden";
138
145
 
139
- this.container.style.visibility = "visible";
140
- this.container.style.opacity = "1";
146
+ this.container.style.display = "flex";
147
+ // Use requestAnimationFrame to ensure display change is processed before opacity change
148
+ requestAnimationFrame(() => {
149
+ if (this.container) {
150
+ this.container.style.opacity = "1";
151
+ }
152
+ });
141
153
  }
142
154
 
143
155
  close() {
@@ -147,8 +159,16 @@ export class IFrame<CallSender extends {}> implements Modal {
147
159
 
148
160
  document.body.style.overflow = "auto";
149
161
 
150
- this.container.style.visibility = "hidden";
162
+ // Start fade-out transition
151
163
  this.container.style.opacity = "0";
164
+
165
+ // Set display: none after transition completes (200ms)
166
+ this.closeTimeout = setTimeout(() => {
167
+ if (this.container) {
168
+ this.container.style.display = "none";
169
+ }
170
+ this.closeTimeout = undefined;
171
+ }, 200);
152
172
  }
153
173
 
154
174
  sendBackward() {
@@ -179,6 +199,6 @@ export class IFrame<CallSender extends {}> implements Modal {
179
199
  }
180
200
 
181
201
  isOpen() {
182
- return this.iframe?.style.display !== "none";
202
+ return this.container?.style.display !== "none";
183
203
  }
184
204
  }