/** 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; /** Aggregate transport counters only; contains no object identities or values. */ export function getFieldTransportMetrics(): Partial>>; export type ObjectRef = string & { readonly $quixosAtom: AtomId; }; export type ReadableField = {readonly value?: T; readonly $field: "query" | "independent"}; export type QueryField = ReadableField & {readonly $field: "query"}; export type IndependentField = ReadableField & {readonly $field: "independent"}; /** 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}; export type WritableQueryField = WritableField & QueryField; export type WritableIndependentField = WritableField & IndependentField; export function detachField(field: WritableQueryField): WritableIndependentField; export function detachField(field: QueryField): IndependentField; 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 type QueryLiveProjection = {path: readonly string[]; selectionId: string; interfaceRevisionId: string; getOperationId: string; setOperationId?: string; watchOperationId?: string; inputKind: "fields" | "value"; valueType: QueryValueType; conditions: {include: boolean; defaultValue?: boolean; value: {kind: "variable"; name: string} | {kind: "literal"; value: unknown}}[]}; export interface QueryDescriptor {readonly id: string; readonly definitionDigest: string; readonly root: {readonly kind: Kind; readonly interface: string}; readonly variables: QueryValueType; readonly output: QueryValueType; readonly watch: boolean; readonly liveFields?: readonly QueryLiveProjection[]; readonly $types?: (variables: Variables, result: Result) => [Variables, Result]} export type QueryPartial = T extends {readonly $quixosRef: string} | ReadableField ? 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 type WorkspaceQueryScope = {readonly $workspaceQueryScope: true}; export function getWorkspaceQueryScope(descriptor: QueryDescriptor): Promise; export function useQuery(descriptor: QueryDescriptor, options: {root: string | {readonly $quixosRef: string}; variables: Variables}): QueryState & {refresh(): void}; export function useQuery(descriptor: QueryDescriptor, options: {scope: WorkspaceQueryScope; 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 type FieldReadState = "connecting" | "live" | "snapshot" | "inactive" | "not-selected" | "error" | "obsolete"; export type LiveFieldState = {readState: FieldReadState; refreshing: boolean; stale: boolean; pendingWrites: number; writeError?: Error; refresh(): Promise; discard(): void} & ({status: "loading"; value?: undefined; error?: undefined} | {status: "ready"; value: T; error?: Error} | {status: "error"; value?: undefined; error: Error}); export type WritableLiveFieldState = LiveFieldState & {set(value: T): Promise; retry(): Promise}; export function useLiveField(field: ReadableField, options: {id: string; write: (value: T) => Promise}): WritableLiveFieldState; export function useLiveField(field: WritableField): WritableLiveFieldState; export function useLiveField(field: ReadableField): LiveFieldState; export function useSuspenseLiveField(field: WritableField): WritableLiveFieldState & {status: "ready"; value: T}; export function useSuspenseLiveField(field: ReadableField): LiveFieldState & {status: "ready"; value: T}; } `;