import type { Optional, Unformatted } from '../index.js' import { nanoid } from './values/id.js' import type * as Style from './index.js' import { TypeDefinitions } from './definition.js' export interface Details { id: string title: string collectionId?: string slug?: string description?: string exampleContent?: any elementId?: string instanceId?: string isDefault?: boolean isHidden?: boolean isInternal?: boolean override?: string } export type AspectForm = (typeof TypeDefinitions)[T]['forms'] export type Form

= { id: string label: string extractProperties: (props: P) => Partial

validate: (props: Partial

) => boolean fieldset?: any } export type FormsByAspect = { [key in T]: (typeof Style.TypeDefinitions)[key]['forms'][number] } export const DetailsForm: Style.Form = { label: 'Details', id: 'details', validate: () => true, extractProperties(props) { return props } } export const OverrideForm: Style.Form = { label: 'Custom CSS', id: 'override', validate: () => true, extractProperties(props) { return { override: props.override } } } export function Details(details: Unformatted>) { return { title: '', description: '', id: details?.id || nanoid(10), ...details } } /* type Aspect = { type: Type } export function Form(form: { id: Type label: Label extractProperties: (props: any) => Partial validate: (props: Partial) => boolean fieldset?: any }) { return form } */