@trunkjs/browser-utils 1.0.49 → 1.0.52

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/.ai-usage-info.md CHANGED
@@ -2,10 +2,11 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- Small browser-side helpers for DOM work, timing, events, storage, and custom-element mixins.
5
+ Small browser-side helpers for DOM work, form values, timing, events, storage, and custom-element mixins.
6
6
 
7
7
  Use this package when you need:
8
8
  - small DOM helpers
9
+ - dynamic named form values and element/value entries
9
10
  - debounce / wait helpers
10
11
  - localStorage / sessionStorage state
11
12
  - logging in custom elements
@@ -16,7 +17,7 @@ Do **not** use it for server-only code.
16
17
  ## Import
17
18
 
18
19
  ```ts
19
- import { create_element, Debouncer, waitForLoad } from '@trunkjs/browser-utils';
20
+ import { create_element, Debouncer, FormDataAccessor, waitForLoad } from '@trunkjs/browser-utils';
20
21
  ```
21
22
 
22
23
  ## Common examples
@@ -153,6 +154,10 @@ Empty slots get the CSS class:
153
154
  <slot class="slot-empty"></slot>
154
155
  ```
155
156
 
157
+ Notes:
158
+ - whitespace-only text nodes are treated as empty
159
+ - HTML comments are treated as empty as well (important for Lit comment markers)
160
+
156
161
  ## Other exports
157
162
 
158
163
  ```ts
package/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ ## 1.0.52 (2026-08-29)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - **browser-utils:** support non-iterable NodeList ([59b4feb](https://github.com/trunkjs/trunkjs-monorepo/commit/59b4feb))
6
+
7
+ ### ❤️ Thank You
8
+
9
+ - Matthias Leuffen
10
+
11
+ ## Unreleased
12
+
13
+ ## 1.0.51 (2026-08-29)
14
+
15
+ ### ✨ Features
16
+
17
+ - Add `FormDataAccessor` for dynamic named DOM values, element/value entries, and native `FormData` output.
18
+
19
+ ### 🩹 Fixes
20
+
21
+ - **browser-utils:** support non-iterable NodeList ([59b4feb](https://github.com/trunkjs/trunkjs-monorepo/commit/59b4feb))
22
+
23
+ ### ❤️ Thank You
24
+
25
+ - Matthias Leuffen
26
+
27
+ ## 1.0.50 (2026-05-19)
28
+
29
+ This was a version bump only for browser-utils to align it with other projects, there were no code changes.
30
+
1
31
  ## 1.0.49 (2026-05-18)
2
32
 
3
33
  This was a version bump only for browser-utils to align it with other projects, there were no code changes.
package/README.md CHANGED
@@ -4,6 +4,7 @@ A small collection of browser-focused, framework-agnostic utilities that make co
4
4
 
5
5
  Exports:
6
6
  - create_element: Minimal DOM element factory
7
+ - FormDataAccessor: Dynamic named form values and element/value entries
7
8
  - Debouncer: Debounce helper with optional max-delay
8
9
  - Stopwatch: Lightweight performance timer with lap logging
9
10
  - waitFor, waitForDomContentLoaded, waitForLoad, sleep, waitForAnimationEnd: Promise-based event and timing helpers
@@ -22,6 +23,25 @@ import { } from '@trunkjs/browser-utils';
22
23
 
23
24
  ## Quick start
24
25
 
26
+ ### `class FormDataAccessor`: Read and write named controls
27
+
28
+ ```ts
29
+ import { FormDataAccessor } from '@trunkjs/browser-utils';
30
+
31
+ const accessor = new FormDataAccessor(document.querySelector('#profile')!);
32
+ accessor.data = { name: 'Erika', topics: ['docs'] };
33
+
34
+ console.log(accessor.data);
35
+ console.log(accessor.formData);
36
+
37
+ accessor.entries.forEach(({ name, value, element }) => {
38
+ console.log(name, value, element);
39
+ });
40
+ ```
41
+
42
+ The control list is queried again on every access, so later DOM changes are reflected automatically. Use `entries`
43
+ when state such as `validated`, `invalid`, or `disabled` must be applied directly to the original elements.
44
+
25
45
  ### `function create_element()`: Create and append an element
26
46
 
27
47
  ```ts
package/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './lib/breakpoints';
2
2
  export * from './lib/create-element';
3
3
  export * from './lib/Debouncer';
4
+ export * from './lib/FormDataAccessor';
4
5
  export * from './lib/get-error-location';
5
6
  export * from './lib/Logger';
6
7
  export * from './lib/Stopwatch';