refactor: harden type safety and modernize core forms for Svelte 5
- Standardize 'ae_BaseObj' and event types in 'ae_types.ts' to handle nullable fields from V3 API/Dexie. - Modernize Person, Address, and Contact forms with Svelte 5 Runes and reactive synchronization. - Refactor Event Settings and its sub-components to use the 'onsave' callback pattern, removing deprecated dispatchers. - Hardened 'element_data_store_v2' with safe initialization and localStorage caching logic. - Clean up unused 'element_data_store.svelte' (V1) and suppress Electron environment type errors in 'tmp_shell_handlers.ts'. - Update documentation and workspace settings to reflect Phase 5 reactive patterns.
This commit is contained in:
@@ -19,23 +19,42 @@
|
||||
|
||||
// Form State (Runes)
|
||||
let formData = $state({
|
||||
attention_to: address?.attention_to ?? '',
|
||||
organization_name: address?.organization_name ?? '',
|
||||
line_1: address?.line_1 ?? '',
|
||||
line_2: address?.line_2 ?? '',
|
||||
line_3: address?.line_3 ?? '',
|
||||
city: address?.city ?? '',
|
||||
state_province: address?.state_province ?? '',
|
||||
postal_code: address?.postal_code ?? '',
|
||||
country: address?.country ?? '',
|
||||
// country_name: address?.country_name ?? '', // DO NOT USE - Scott 2026-01-09
|
||||
timezone: address?.timezone ?? '',
|
||||
latitude: address?.latitude ?? '',
|
||||
longitude: address?.longitude ?? '',
|
||||
notes: address?.notes ?? '',
|
||||
enable: address?.enable ?? true,
|
||||
hide: address?.hide ?? false,
|
||||
priority: address?.priority ?? false
|
||||
attention_to: '',
|
||||
organization_name: '',
|
||||
line_1: '',
|
||||
line_2: '',
|
||||
line_3: '',
|
||||
city: '',
|
||||
state_province: '',
|
||||
postal_code: '',
|
||||
country: '',
|
||||
timezone: '',
|
||||
latitude: '',
|
||||
longitude: '',
|
||||
notes: '',
|
||||
enable: true,
|
||||
hide: false,
|
||||
priority: false
|
||||
});
|
||||
|
||||
// Reset form when address prop changes
|
||||
$effect(() => {
|
||||
formData.attention_to = address?.attention_to ?? '';
|
||||
formData.organization_name = address?.organization_name ?? '';
|
||||
formData.line_1 = address?.line_1 ?? '';
|
||||
formData.line_2 = address?.line_2 ?? '';
|
||||
formData.line_3 = address?.line_3 ?? '';
|
||||
formData.city = address?.city ?? '';
|
||||
formData.state_province = address?.state_province ?? '';
|
||||
formData.postal_code = address?.postal_code ?? '';
|
||||
formData.country = address?.country ?? '';
|
||||
formData.timezone = address?.timezone ?? '';
|
||||
formData.latitude = address?.latitude ?? '';
|
||||
formData.longitude = address?.longitude ?? '';
|
||||
formData.notes = address?.notes ?? '';
|
||||
formData.enable = address?.enable ?? true;
|
||||
formData.hide = address?.hide ?? false;
|
||||
formData.priority = address?.priority ?? false;
|
||||
});
|
||||
|
||||
let is_loading = $state(false);
|
||||
|
||||
@@ -19,19 +19,36 @@
|
||||
|
||||
// Form State (Runes)
|
||||
let formData = $state({
|
||||
title: contact?.title ?? '',
|
||||
tagline: contact?.tagline ?? '',
|
||||
email: contact?.email ?? '',
|
||||
phone_mobile: contact?.phone_mobile ?? '',
|
||||
phone_office: contact?.phone_office ?? '',
|
||||
website_url: contact?.website_url ?? '',
|
||||
facebook_url: contact?.facebook_url ?? '',
|
||||
instagram_url: contact?.instagram_url ?? '',
|
||||
linkedin_url: contact?.linkedin_url ?? '',
|
||||
notes: contact?.notes ?? '',
|
||||
enable: contact?.enable ?? true,
|
||||
hide: contact?.hide ?? false,
|
||||
priority: contact?.priority ?? false
|
||||
title: '',
|
||||
tagline: '',
|
||||
email: '',
|
||||
phone_mobile: '',
|
||||
phone_office: '',
|
||||
website_url: '',
|
||||
facebook_url: '',
|
||||
instagram_url: '',
|
||||
linkedin_url: '',
|
||||
notes: '',
|
||||
enable: true,
|
||||
hide: false,
|
||||
priority: false
|
||||
});
|
||||
|
||||
// Reset form when contact prop changes
|
||||
$effect(() => {
|
||||
formData.title = contact?.title ?? '';
|
||||
formData.tagline = contact?.tagline ?? '';
|
||||
formData.email = contact?.email ?? '';
|
||||
formData.phone_mobile = contact?.phone_mobile ?? '';
|
||||
formData.phone_office = contact?.phone_office ?? '';
|
||||
formData.website_url = contact?.website_url ?? '';
|
||||
formData.facebook_url = contact?.facebook_url ?? '';
|
||||
formData.instagram_url = contact?.instagram_url ?? '';
|
||||
formData.linkedin_url = contact?.linkedin_url ?? '';
|
||||
formData.notes = contact?.notes ?? '';
|
||||
formData.enable = contact?.enable ?? true;
|
||||
formData.hide = contact?.hide ?? false;
|
||||
formData.priority = contact?.priority ?? false;
|
||||
});
|
||||
|
||||
let is_loading = $state(false);
|
||||
|
||||
@@ -19,22 +19,42 @@
|
||||
|
||||
// Form State (Runes)
|
||||
let formData = $state({
|
||||
given_name: person?.given_name ?? '',
|
||||
family_name: person?.family_name ?? '',
|
||||
middle_name: person?.middle_name ?? '',
|
||||
prefix: person?.prefix ?? person?.title_names ?? '',
|
||||
suffix: person?.suffix ?? person?.designations ?? '',
|
||||
nickname: person?.informal_name ?? '',
|
||||
professional_title: person?.professional_title ?? '',
|
||||
affiliations: person?.affiliations ?? '',
|
||||
primary_email: person?.primary_email ?? '',
|
||||
phone: person?.phone ?? '',
|
||||
tagline: person?.tagline ?? '',
|
||||
notes: person?.notes ?? '',
|
||||
user_id_random: person?.user_id_random ?? '',
|
||||
enable: person?.enable ?? true,
|
||||
hide: person?.hide ?? false,
|
||||
priority: person?.priority ?? false
|
||||
given_name: '',
|
||||
family_name: '',
|
||||
middle_name: '',
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
nickname: '',
|
||||
professional_title: '',
|
||||
affiliations: '',
|
||||
primary_email: '',
|
||||
phone: '',
|
||||
tagline: '',
|
||||
notes: '',
|
||||
user_id_random: '',
|
||||
enable: true,
|
||||
hide: false,
|
||||
priority: false
|
||||
});
|
||||
|
||||
// Reset form when person prop changes
|
||||
$effect(() => {
|
||||
formData.given_name = person?.given_name ?? '';
|
||||
formData.family_name = person?.family_name ?? '';
|
||||
formData.middle_name = person?.middle_name ?? '';
|
||||
formData.prefix = (person?.prefix ?? person?.title_names) ?? '';
|
||||
formData.suffix = (person?.suffix ?? person?.designations) ?? '';
|
||||
formData.nickname = person?.informal_name ?? '';
|
||||
formData.professional_title = person?.professional_title ?? '';
|
||||
formData.affiliations = person?.affiliations ?? '';
|
||||
formData.primary_email = person?.primary_email ?? '';
|
||||
formData.phone = person?.phone ?? '';
|
||||
formData.tagline = person?.tagline ?? '';
|
||||
formData.notes = person?.notes ?? '';
|
||||
formData.user_id_random = person?.user_id_random ?? '';
|
||||
formData.enable = person?.enable ?? true;
|
||||
formData.hide = person?.hide ?? false;
|
||||
formData.priority = person?.priority ?? false;
|
||||
});
|
||||
|
||||
let is_loading = $state(false);
|
||||
|
||||
Reference in New Issue
Block a user