@tempots/dom 33.0.0 → 33.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/dom",
3
- "version": "33.0.0",
3
+ "version": "33.1.1",
4
4
  "type": "module",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
package/std/signal.d.ts CHANGED
@@ -18,6 +18,12 @@ export type ListenerOptions = {
18
18
  skipInitial?: boolean;
19
19
  once?: boolean;
20
20
  abortSignal?: AbortSignal;
21
+ /**
22
+ * If true, the listener will not be automatically disposed when the current scope ends.
23
+ * Use this when you need explicit control over the listener lifecycle.
24
+ * @internal
25
+ */
26
+ noAutoDispose?: boolean;
21
27
  };
22
28
  /**
23
29
  * A reactive signal that holds a value and notifies listeners when the value changes.
@@ -153,8 +159,28 @@ export declare class Signal<T> {
153
159
  * The listener function will be immediately called with the current value of the signal.
154
160
  * Returns a function that can be called to unregister the listener.
155
161
  *
162
+ * When called within a DisposalScope (e.g., inside a renderable), the listener is
163
+ * automatically cleaned up when the scope is disposed. This prevents memory leaks
164
+ * when listening to outer-scope signals from inner scopes.
165
+ *
156
166
  * @param listener - The listener function to be called when the value of the signal changes.
157
167
  * @param options - Options for the listener.
168
+ *
169
+ * @example
170
+ * ```typescript
171
+ * // Automatic cleanup when scope disposes
172
+ * const MyComponent = () => {
173
+ * const outerSignal = prop(0)
174
+ *
175
+ * return html.div(
176
+ * When(someCondition, () => {
177
+ * // This listener is automatically cleaned up when the When() disposes
178
+ * outerSignal.on(value => console.log(value))
179
+ * return html.span('Inner content')
180
+ * })
181
+ * )
182
+ * }
183
+ * ```
158
184
  */
159
185
  readonly on: (listener: (value: T, previousValue: T | undefined) => void, options?: ListenerOptions) => () => void;
160
186
  /**
@@ -187,6 +213,7 @@ export declare class Signal<T> {
187
213
  readonly onDispose: (listener: () => void) => void;
188
214
  /**
189
215
  * Disposes the signal, releasing any resources associated with it.
216
+ * This clears all listeners, derivatives, and disposal callbacks.
190
217
  */
191
218
  readonly dispose: () => void;
192
219
  /**