@dmitryvim/form-builder 0.3.1 → 0.3.3

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.
@@ -173,4 +173,5 @@ export declare class FormBuilderInstance {
173
173
  * Destroy instance and clean up resources
174
174
  */
175
175
  destroy(): void;
176
+ private disconnectEnableIfObservers;
176
177
  }
@@ -13,4 +13,14 @@ export interface State {
13
13
  syntheticElementIds: WeakMap<Element, string>;
14
14
  /** Counter for generating unique synthetic IDs. */
15
15
  syntheticElementIdCounter: number;
16
+ /**
17
+ * Pending MutationObservers from setupEnableIfListeners that are waiting for a
18
+ * dependency input to appear in the DOM. They must be disconnected on destroy()
19
+ * (and on every renderForm) — otherwise they survive the instance lifecycle and
20
+ * later attach orphan change/input listeners to inputs of a *new* instance that
21
+ * happens to mount into the same container, causing
22
+ * "Cannot re-evaluate enableIf: formRoot is null" once the orphan callbacks fire
23
+ * with a torn-down ctx. Reproducible under React StrictMode (double mount).
24
+ */
25
+ enableIfObservers: Set<MutationObserver>;
16
26
  }
@@ -37,6 +37,21 @@ export declare function ensureThemingHooks(doc: Document): void;
37
37
  * makes the total box (border + padding + content) equal scrollHeight, which
38
38
  * leaves the content area short by `2 * border-width` — at compact density
39
39
  * (8px padding, 21px line-height) that's enough to clip a single line.
40
+ *
41
+ * Deferred-layout recovery (v0.3.2):
42
+ * A `ResizeObserver` re-runs `resize()` whenever the textarea's content-box
43
+ * WIDTH changes. Two host patterns the one-shot `setTimeout(0)` below can't
44
+ * survive on its own:
45
+ * 1. Form mounted inside a still-hidden / 0-width container (e.g. inactive
46
+ * tab, collapsed accordion, modal that isn't open yet). At setTimeout
47
+ * firing time `scrollHeight === 0` → height collapses to ~borderY (~2px).
48
+ * Once the host reveals the container, width transitions 0 → real and we
49
+ * re-measure.
50
+ * 2. Responsive width changes (host resizes the column). Wrapped content
51
+ * re-flows so the textarea grows/shrinks to fit.
52
+ * Loop guard: `resize()` only writes the HEIGHT, so we ignore observer fires
53
+ * where width hasn't moved — otherwise our own height writes would feed back
54
+ * into the observer.
40
55
  */
41
56
  export declare function applyAutoExpand(textarea: HTMLTextAreaElement): void;
42
57
  /**
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.1",
6
+ "version": "0.3.3",
7
7
  "description": "A reusable JSON schema form builder library",
8
8
  "main": "./dist/cjs/index.cjs",
9
9
  "module": "./dist/esm/index.js",