import { ListCollection } from "@zag-js/collection"; import { Attrs, VanillaMachine, VanillaMachine as Machine, mergeProps, normalizeProps, spreadProps } from "@zag-js/vanilla"; //#region Resources/Private/Client/src/types.d.ts declare global { interface Window { FluidPrimitives: { hydrationData: { [componentName: string]: { [id: string]: ComponentHydrationData; }; }; globals?: FluidPrimitivesGlobals; uncontrolledInstances: { [componentName: string]: { [id: string]: Component; }; }; }; } } interface ComponentInterface { document: Document; machine: VanillaMachine; api: Api; hydrator: ComponentHydrator | null; init(): void; destroy(): void; render(): void; } interface ComponentHydrationData { controlled: boolean; props: { id: string; ids: { [key: string]: string; }; [key: string]: unknown; }; } interface FluidPrimitivesGlobals { locale?: string; [key: string]: unknown; } //#endregion //#region Resources/Private/Client/src/lib/component.d.ts declare abstract class Component implements ComponentInterface { document: Document; machine: Machine; api: Api; hydrator: ComponentHydrator | null; userProps?: Partial; static name: string; get doc(): Document; constructor(props: Props, userDocument?: Document); abstract initMachine(props: Props): Machine; abstract initApi(): Api; initHydrator(props: Props): ComponentHydrator; init(): void; getName(): string; /** * Override in consumer for example when a getter is used for collection * Needs to be used manually inside the initMachine method */ transformProps(props: Partial): Partial; updateProps(newProps: Partial): void; destroy(): void; spreadProps(node: HTMLElement, attrs: Attrs): void; getElement(part: string, parent?: HTMLElement | Document): T | null; getElements(part: string, parent?: HTMLElement | Document): T[]; abstract render(): void; } //#endregion //#region Resources/Private/Primitives/Field/src/field.registry.d.ts type FieldMachine = Machine; //#endregion //#region Resources/Private/Client/src/lib/field-aware-component.d.ts declare abstract class FieldAwareComponent extends Component { protected subscribedToField: boolean; protected fieldMachine: FieldMachine | undefined; protected closestField: HTMLElement | null; protected abstract propsWithField(props: Partial, fieldMachine: FieldMachine): Props; protected getClosestField(): HTMLElement; protected withFieldProps(props: Props): Props; subscribeToFieldService(): void; } //#endregion //#region Resources/Private/Client/src/lib/hydration.d.ts declare function getHydrationData(component: string): Record | null; declare function getHydrationData(component: string, id: string): ComponentHydrationData | null; declare function mount(componentName: string, callback: (data: ComponentHydrationData & { createHydrator: () => ComponentHydrator; }) => Component | void): void; declare function mountControlled(componentName: string, rootId: string, callback: (data: ComponentHydrationData & { createHydrator: () => ComponentHydrator; }) => Component | void): void | Component; declare class ComponentHydrator { componentName: string; doc: Document; rootId: string; ids: { [key: string]: string; }; elementRefs: Map; constructor(componentName: string, rootId: string | undefined, ids?: { [key: string]: string; }, doc?: Document); getElement(part: string, parent?: Element | Document): T | null; getElements(part: string, parent?: Element | Document): T[]; generateRefAttributesString(part: string): string; setRefAttributes(element: Element, part: string): void; destroy(): void; } //#endregion //#region Resources/Private/Client/src/lib/uid.d.ts declare function uid(prefix?: string): string; //#endregion export { Machine as a, mount as c, FieldMachine as d, Component as f, FluidPrimitivesGlobals as h, mergeProps as i, mountControlled as l, ComponentInterface as m, spreadProps as n, ComponentHydrator as o, ComponentHydrationData as p, normalizeProps as r, getHydrationData as s, uid as t, FieldAwareComponent as u };