///
import { Cell, computed, Default, NAME, pattern, UI } from "commontools";
/** Wrap all fields of T in Cell<> for write access */
type Cellify = { [K in keyof T]: Cell };
/** Raw data shape - use in collection patterns */
export interface Contact {
name: string;
email: Default;
phone: Default;
company: Default;
tags: Default;
notes: Default;
createdAt: number;
}
interface Input {
contact: Cellify;
}
/** #contact #person */
interface Output {
contact: Contact;
}
export default pattern(({ contact }) => {
return {
[NAME]: computed(() => `Contact: ${contact.name}`),
[UI]: (
{contact.name || "New Contact"}
),
contact,
};
});