Define isChanged() before first snapshot + emit form-changed on control changes

isChanged() compared against a fabricated '{}' baseline before the first
snapshot() call, so the first query on any non-empty form reported true.
Consumers that embed the boolean in their own baseline (settings dirty
guards) froze that false positive in. Now reports false until a baseline
exists; hasSnapshot getter exposes the state.

New: form listens (capture phase, so non-bubbling events are caught) to
the tp-* control change events and re-emits them as 'form-changed'
(detail.changed = isChanged()), scoped to its own registered controls.
Consumers can drop polling.
This commit is contained in:
pk committed 2026-10-22 23:51:12 +02:00
1 parent 354b0ab720
commit 82adb306b6
2 files changed
+65 -3

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@tp/tp-form",
"version": "1.2.1",
"version": "1.3.0",
"description": "",
"main": "tp-form.js",
"scripts": {