/** One authoring contract, distributed by scaffolding and immutable codegen. * Web Studio checks its concrete exports against this contract during its build. */ export const reactPlatformTypes = `// Generated by the Quixos React platform contract. Do not edit. declare module "@quixos/web-studio-react-runtime" { import type * as React from "react"; export function useComponentOverlayContainer(): HTMLElement; export function useComponentStyleRoot(): ShadowRoot; export type ObjectRef = string & { readonly $quixosAtom: AtomId; }; export type FieldCapability = {objectId: string; interfaceRevisionId: string; getOperationId: string; watchOperationId?: string; setOperationId?: string; inputKind?: "fields" | "value"}; export type ReadableField = {readonly value?: T; readonly capability: FieldCapability}; /** set(T) uses the resolved capability: native CRDT fields send incremental edits; * custom/manual setters receive semantic values. Storage provenance grants no authority. */ export type WritableField = ReadableField & {readonly $writeType?: (value: T) => T; readonly writable: true; readonly capability: FieldCapability & {setOperationId: string}}; export type LiveFieldProp = ReadableField; export type InterfaceReference = {readonly $quixosRef: string; readonly interfaceRevisionId: I; readonly fields: Fields}; export type ReactInterfaceContract = {readonly interfaceRevisionId: string; readonly $viewType?: (view: View) => View}; export function defineReactInterfaceContract(interfaceRevisionId: string, interfaces: unknown): ReactInterfaceContract; export function tryConform(object: string | {readonly $quixosRef: string}, contract: ReactInterfaceContract, options?: {signal?: AbortSignal}): Promise; export type ConformanceResult = {status: "loading"} | {status: "absent"} | {status: "available"; view: View} | {status: "error"; error: Error}; export function useTryConform(object: string | {readonly $quixosRef: string}, contract: ReactInterfaceContract): ConformanceResult; export type QueryValueType = {kind: "builtin" | "scalar"; name: string} | {kind: "record"; fields: Record} | {kind: "optional" | "list"; value: QueryValueType} | {kind: "object-ref"; expectation: {kind: "atom"; atomId: string} | {kind: "interface"; interfaceRevisionId: string}}; export type QueryReference = {readonly $quixosRef: string; readonly queryContract: Contract}; export interface QueryDescriptor {readonly id: string; readonly definitionDigest: string; readonly rootInterfaceRevisionId: string; readonly variables: QueryValueType; readonly output: QueryValueType; readonly watch: boolean; readonly $types?: (variables: Variables, result: Result) => [Variables, Result]} export type QueryPartial = T extends QueryReference ? T : T extends readonly (infer Item)[] ? QueryPartial[] : T extends object ? {[Key in keyof T]?: QueryPartial} : T; export type QueryFieldState = {path: readonly (string | number)[]; status: "pending" | "error"; error?: string}; export type QueryState = {refreshing: boolean; fields: QueryFieldState[]; runId?: string; sequence?: bigint; consistency?: string} & ({status: "loading"; data?: undefined; error?: undefined} | {status: "ready"; data: T; error?: undefined} | {status: "partial"; data: QueryPartial; error?: undefined} | {status: "error"; data?: T | QueryPartial; error: Error}); export function useQuery(descriptor: QueryDescriptor, options: {root: string | {readonly $quixosRef: string}; variables: Variables}): QueryState & {refresh(): void}; export interface QueryConnection {entries: {key: string; node: Row; cursor?: string | null}[]; pageInfo: {hasNextPage: boolean; endCursor?: string | null}} export function CollectionView(props: {result: QueryState & {refresh(): void}; connection(data: QueryPartial): QueryPartial> | undefined; renderItem(row: QueryPartial, entryKey: string): React.ReactNode; onCreate?: () => void; onLoadMore?: (cursor: string | null) => void; onReset?: () => void; loadingMore?: boolean; empty?: React.ReactNode; prefetch?: boolean}): React.ReactElement; export type ReactComponentHostProps = { onAction?: (action: Action) => void; fallback?: React.ReactNode; className?: string; style?: React.CSSProperties; /** Optional extra action. The host still displays and reports errors by default. */ extraErrorAction?: (error: Error) => void; }; export type ReactComponentImplementationProps = { camino: CaminoProps; render: RenderProps; dispatch: (action: Action) => void; }; export const createWebStudioComponent: < ForObject extends ObjectRef, RenderProps extends object, Action, >(config: { expectedAtomId: string }) => (props: { forObject: ForObject; } & RenderProps & ReactComponentHostProps) => any; export const invokeCapability: ( objectId: string, interfaceRevisionId: string, operationId: string, value?: unknown, options?: {clientMutationId?: string; signal?: AbortSignal}, ) => Promise; export const h: typeof React.createElement; export function useLiveField(field: ReadableField, options: {write: (value: T) => Promise}): readonly [T, (value: T) => Promise]; export function useLiveField(field: WritableField): readonly [T, (value: T) => Promise]; export function useLiveField(field: ReadableField): readonly [T]; } `;