@bigmistqke/whiteboard 0.2.0 → 0.2.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.
@@ -1132,12 +1132,12 @@ function morph(html) {
1132
1132
  for (const { name, value } of [...from.attributes]) if (name.startsWith("data-wb-") && name !== "data-wb-mounted" && !to.hasAttribute(name)) to.setAttribute(name, value);
1133
1133
  for (const c of KEEP_CLASSES) if (from.classList.contains(c)) to.classList.add(c);
1134
1134
  return true;
1135
- },
1136
- onBeforeNodeDiscarded(node) {
1137
- disposeWithin(node);
1138
- return true;
1139
1135
  }
1140
1136
  });
1137
+ for (const [el, dispose] of disposers) if (!el.isConnected) {
1138
+ dispose();
1139
+ disposers.delete(el);
1140
+ }
1141
1141
  }
1142
1142
  document.documentElement.style.overflowAnchor = "none";
1143
1143
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigmistqke/whiteboard",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "A whiteboard for you and your agent: it writes markdown pages you read live in the browser, you answer through forms it waits on",
5
5
  "keywords": [
6
6
  "agent",
@@ -170,11 +170,13 @@ function morph(html: string) {
170
170
  for (const c of KEEP_CLASSES) if (from.classList.contains(c)) to.classList.add(c)
171
171
  return true
172
172
  },
173
- onBeforeNodeDiscarded(node) {
174
- disposeWithin(node)
175
- return true
176
- },
173
+ // An element morphdom discards can hold an island it is about to move elsewhere (a form that
174
+ // moved down: its old place became the new paragraph, and the chat in it, keyed, goes into the
175
+ // form's new place). So islands are not disposed here, but after the patch, if gone.
177
176
  })
177
+ for (const [el, dispose] of disposers) {
178
+ if (!el.isConnected) { dispose(); disposers.delete(el) }
179
+ }
178
180
  }
179
181
 
180
182
  // The page keeps the reader's place itself: the browser's own scroll anchoring loses its anchor