@n1kname/components 0.31.0 → 0.31.1

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/package.json +1 -1
  2. package/src/cardlist.js +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n1kname/components",
3
- "version": "0.31.0",
3
+ "version": "0.31.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
package/src/cardlist.js CHANGED
@@ -84,7 +84,10 @@ export const removeCard = (root, id) =>
84
84
  new Promise((done) => {
85
85
  const li = [...root.children].find((x) => x.dataset.key === String(id));
86
86
  if (!li) return done();
87
+ let gone = false;
87
88
  const go = () => {
89
+ if (gone) return;
90
+ gone = true;
88
91
  const before = snapshot(root);
89
92
  li.remove();
90
93
  flip(root, before);
@@ -92,6 +95,8 @@ export const removeCard = (root, id) =>
92
95
  };
93
96
  if (reduced()) return go();
94
97
  li.animate([{ opacity: 1, transform: 'none' }, { opacity: 0, transform: 'translateX(24px)' }], { duration: 180, easing: 'ease-in' }).finished.then(go, go);
98
+ // A hidden or background tab doesn't paint, so `finished` may never come: don't let a caller hang.
99
+ setTimeout(go, 280);
95
100
  });
96
101
 
97
102
  export const wireCards = (root) => {