From d06dcae94bb5626bc2ff4281ce1e9a28c2341460 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Wed, 17 Jun 2026 18:01:08 -0400 Subject: [PATCH] feat(field-editor): modernize field editor with non-blocking modal and viewport clamping - Completed rewrite of `element_ae_obj_field_editor.svelte` to Svelte 5 + Tailwind v4 - Set `display_modal = true`, `modal_blocking = false`, and `modal_placement = 'center'` as new defaults - Implemented trigger-relative modal positioning with automatic viewport boundary clamping to prevent off-screen rendering - Migrated all 12 call sites across core and events modules (Session, Presenter, Location, Exhibit, etc.) - Removed legacy datetime-to-local manual conversion logic from views as the component now handles it natively - Retired Skeleton-based legacy component - Updated testing page and documentation to reflect the new standardized primitive --- .../PROJECT__AE_Obj_Field_Editor_New.md | 200 +------ documentation/TODO__Agents.md | 4 +- .../element_ae_obj_field_editor.svelte | 562 +++++++++++++----- .../element_ae_obj_field_editor_new.svelte | 557 ----------------- src/routes/core/data_stores/+page.svelte | 8 +- src/routes/core/person_view.svelte | 2 +- .../[exhibit_id]/ae_tab__manage.svelte | 2 +- .../ae_comp__event_device_obj_li.svelte | 2 +- .../[event_location_id]/location_view.svelte | 2 +- .../ae_comp__event_location_obj_li.svelte | 2 +- .../[presenter_id]/presenter_view.svelte | 2 +- .../session/[session_id]/session_view.svelte | 11 +- .../ae_comp__event_presentation_obj_li.svelte | 2 +- .../testing/ae_obj_field_editor/+page.svelte | 246 +++----- 14 files changed, 527 insertions(+), 1075 deletions(-) delete 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 index e7b99ee2..8a8242d6 100644 --- a/documentation/PROJECT__AE_Obj_Field_Editor_New.md +++ b/documentation/PROJECT__AE_Obj_Field_Editor_New.md @@ -1,6 +1,6 @@ # Project: AE Obj Field Editor — `_new` Rewrite -**Status:** 🟡 Planning +**Status:** ✅ Complete (2026-06-16) **Priority:** Medium — quality-of-life primitive, no event deadline attached **Created:** 2026-06-16 **Last Updated:** 2026-06-16 @@ -13,190 +13,42 @@ `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). +field via `api.update_ae_obj()`. It's used in 10+ call sites today. -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 `