From 528fb9b33f9c316f53bae2081bffe1d26966d573 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Tue, 16 Jun 2026 16:47:36 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20scaffold=20element=5Fae=5Fobj=5Ffield?= =?UTF-8?q?=5Feditor=5Fnew=20=E2=80=94=20parallel-run=20rewrite=20of=20inl?= =?UTF-8?q?ine=20field=20editor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Creates the _new version of the field editor element alongside the working original (which remains untouched). The _new file starts from the original's hardened optimistic-update state machine and adds: - Svelte 5 generics (T) on current_value/draft_value instead of any - email / url / tel added to the field_type union with edit-mode branches - object_reload prop removed (was declared, never implemented — on_success is and remains the caller's cache-refresh hook) - to_input_value() / from_input_value() stubs at the two right call sites for datetime conversion (both directions, TODO #4 to implement) - coerce_select_value() stub for select type-mismatch fix (TODO #5) - Inline TODO mini how-to checked-list mirroring the project doc - Styling still uses Skeleton classes — tagged for Tailwind/Flowbite swap (TODO #6) and a11y gaps marked at their exact markup locations (TODO #7) Companion files: - documentation/PROJECT__AE_Obj_Field_Editor_New.md — full plan, migration order for all 8 call sites, naming convention note - documentation/TODO__Agents.md — new entry pointing to the project doc - documentation/README__Docs_Index.md — project doc added to Active Projects npx svelte-check: 0 errors, 1 expected benign warning (state_referenced_locally on the field_type initializer, documented in-file). Co-Authored-By: Claude Sonnet 4.6 --- .../PROJECT__AE_Obj_Field_Editor_New.md | 202 +++++++ documentation/README__Docs_Index.md | 1 + documentation/TODO__Agents.md | 6 + .../element_ae_obj_field_editor_new.svelte | 534 ++++++++++++++++++ 4 files changed, 743 insertions(+) create mode 100644 documentation/PROJECT__AE_Obj_Field_Editor_New.md create mode 100644 src/lib/elements/element_ae_obj_field_editor_new.svelte diff --git a/documentation/PROJECT__AE_Obj_Field_Editor_New.md b/documentation/PROJECT__AE_Obj_Field_Editor_New.md new file mode 100644 index 00000000..e7b99ee2 --- /dev/null +++ b/documentation/PROJECT__AE_Obj_Field_Editor_New.md @@ -0,0 +1,202 @@ +# Project: AE Obj Field Editor — `_new` Rewrite + +**Status:** 🟡 Planning +**Priority:** Medium — quality-of-life primitive, no event deadline attached +**Created:** 2026-06-16 +**Last Updated:** 2026-06-16 +**Related:** `BOOTSTRAP__AI_Agent_Quickstart.md`, `AE__Naming_Conventions.md` + +--- + +## Background + +`src/lib/elements/element_ae_obj_field_editor.svelte` is the generic inline +field editor: given `object_type` + `object_id` + `field_name` + `current_value`, +it renders a "click pencil → edit one field → Save" UI and PATCHes just that +field via `api.update_ae_obj()`. It's used in 8 call sites today (session_view, +presenter_view, location_view, person_view, device list, presentation list, +location list, leads manage tab). + +This component already went through one rename cycle — it was originally built +as `element_ae_obj_field_editor_v3.svelte` (replacing an older CRUD v1/v2 +pattern), then renamed to drop the `_v3` suffix once it became canonical. That +migration (build new → migrate callers one at a time → delete old → drop +suffix) worked well and is the template for this project. + +**Review findings (2026-06-16)** — see `REFERENCE__Common_Agent_Mistakes.md` +context and the chat log for full detail: + +1. **Built entirely on Skeleton UI classes** (`btn-icon`, `variant-soft-*`, + `variant-filled-*`, `.input`/`.select`/`.textarea`/`.checkbox`, `badge`). + Conflicts with the stated Tailwind v4 + Flowbite/ShadCN direction. This is + the highest-leverage place to do that swap — fix once in `elements/`, + every call site benefits. +2. **`object_reload` prop is dead.** Declared, defaults to `true`, commented + "SWR pattern" — never read in the script. Every call site compensates by + hand-rolling identical `on_success={() => events_func.load_ae_obj_id__*(...)}` + boilerplate. Either implement it for real or remove it and document + `on_success` as the actual refresh mechanism. +3. **Datetime fields need manual format conversion at every call site, only + on the way in, never on the way out.** Confirmed in `session_view.svelte`: + callers must pre-convert with `to_datetime_local(...)` before passing + `current_value` because the component does no normalization between the + stored datetime string and ``'s expected + format. On save, the native datetime-local string goes straight to the + PATCH body with no reverse conversion. Works today because the backend is + forgiving, but the contract is leaky. +4. **Select-binding type mismatch is a latent landmine.** `Object.entries()` + always yields string `val`s for `