import { a as BuilderOp, c as OpPosition, d as applyOps, f as positionOf, i as AppliedOps, l as SlotAddress, m as sameStyleValue, n as propLabel, o as NodePatch, p as sameStoredValue, r as AppliedOp, s as OpError, t as fieldLabel, u as applyOp } from "./prop-label-DvFnzMno.js"; import { Binding, BindingFieldShape, BlockDocument, ComponentDocument, CompositionPlan, Condition, ConditionOp, CreatePlanResult, DocumentLimits, ExposeRequest, ExposureEdit, ExposureEditProblem, ExposureEditRefusal, ExposureEditResult, ExposureEditResult as ExposureEditResult$1, ExposureSources, ExposureSources as ExposureSources$1, ExposureTarget, InsertTarget, ListFilter, ListRelation, NewVariantSources, OpPosition as OpPosition$1, PlanProblem, PlanRefusal, PlanResult, PropSchema, PrunedVariant, RetiredExposures, StoredPattern, VariantEdit, VariantEditProblem, VariantEditRefusal, VariantEditResult, VariantEditResult as VariantEditResult$1, planAddVariant, planConvertToComponent, planDeleteVariant, planDetach, planDuplicateComponent, planExposeProperty, planInsertPattern, planRemoveExposedSlot, planRemoveExposure, planRenameExposure, planRenameVariant, planResetVariantValue, planRetargetExposure, planSaveAsComponent, planSaveAsPattern, planSetVariantValue, planUpdatePatternFromSelection } from "@nextlyhq/blocks-engine"; import { z } from "zod"; /** Where on the page an inserted block goes; the end of the page when absent. */ type ActionPosition = OpPosition$1; /** * One action on a stored page. * * @experimental Settles when the composition API ships. */ type PageAction = { readonly kind: "insert-pattern"; readonly patternId: string; readonly at?: ActionPosition; } | { readonly kind: "place-component"; readonly componentId: string; readonly variant?: string; readonly values?: Readonly>; readonly at?: ActionPosition; } | { readonly kind: "set-placement-values"; readonly instanceId: string; readonly values?: Readonly>; readonly reset?: readonly string[]; } | { readonly kind: "choose-variant"; readonly instanceId: string; readonly variant: string | null; } | { readonly kind: "set-list-query"; readonly listId: string; readonly query: ListQueryChange; } | { readonly kind: "set-conditions"; readonly nodeId: string; readonly conditions: readonly (readonly ConditionInput[])[] | null; } | { readonly kind: "bind-prop"; readonly nodeId: string; readonly prop: string; readonly binding: Binding; } | { readonly kind: "unbind-prop"; readonly nodeId: string; readonly prop: string; readonly keep?: UnbindKeep; } | { readonly kind: "set-layout"; readonly layout: string | null; readonly noHeaderFooter?: boolean; } | { readonly kind: "place-entry-content"; readonly field?: string; readonly at?: OpPosition$1; } | { readonly kind: "set-entry-content-field"; readonly nodeId: string; readonly field: string; }; /** * Which value an `unbind-prop` action keeps: the visitor's, as the page shows * it now (the default); that of a named entry or list item, read as a visitor * reads it; or a value the caller supplies. * * @experimental Settles when the composition API ships. */ type UnbindKeep = "visitor" | { readonly entry: string; } | { readonly item: string; } | { readonly value: unknown; }; /** * What an unbind kept in a prop's place and why, as the one unbind decision * answers the page actions API and the inspector alike. * * @experimental Settles when the composition API ships. */ interface UnbindAnswer { /** * What was kept: what a visitor sees now, the binding's fallback, the * prop's own value, or a value the caller gave. */ readonly kept: "visitor" | "fallback" | "own" | "value"; /** The value kept; absent when the prop keeps its own. */ readonly value?: unknown; /** The prop an image's address was kept in, where the bound prop could not hold it. */ readonly into?: string; /** * Set where the binding read a field visitors can't read: its value was * not copied in, and the fallback or the prop's own value was kept. */ readonly unreadable?: true; /** * Set where the unbound prop is a link's entry id, bound to a related * entry: the id visitors saw is kept beside the link's collection, so the * link keeps going to that entry's page, by reference. Its title where a * visitor may read it. */ readonly entry?: { readonly title?: string; }; /** Why, in words an author reads. */ readonly reason: string; } /** * The parts of a collection list's query a `set-list-query` action changes: * each one set when given, removed when `null`, kept when absent. Shaped as * the block stores them (`ListQuery` in the engine reads them back). * * @experimental Settles when the composition API ships. */ interface ListQueryChange { /** The collection read, or the one a related source's entries are in. */ readonly collection?: string | null; /** A to-many relation of the page's entry or of the outer list's item. */ readonly relation?: ListRelation | null; /** Rows an entry must all meet. */ readonly filters?: readonly ListFilter[] | null; /** Sort keys, comma-separated, `-` for descending: `-publishedAt,title`. */ readonly sort?: string | null; /** How many entries to show, 1 to 100. */ readonly limit?: number | null; /** How many matching entries to skip, from 0. */ readonly offset?: number | null; /** * Split into pages of `limit` entries, each at its own address * (`/news/page/2`). One list on a page may be, and not one inside another * list, one showing related entries, or one in a component or a Layout * region; the write is refused naming the reason. */ readonly paginate?: boolean | null; /** * A custom source: a named query the site registers, and one literal per * input set. Choosing one removes the collection, related entries, filters * and sort in the same write; inputs are replaced whole, not merged. */ readonly namedQuery?: { readonly name: string; readonly params?: Readonly>; } | null; } /** * One condition a `set-conditions` action sets, as a block stores it. * * @experimental Settles when the composition API ships. */ interface ConditionInput { readonly field: string; readonly op: ConditionOp; readonly value?: string | number | boolean; } /** Which part of a block an exposure targets: a prop, or its visibility. */ type ExposureTargetInput = { readonly nodeId: string; readonly propPath: string; } | { readonly nodeId: string; readonly visibility: true; }; /** * One edit to a component's definition, each the editor's own planner. * * @experimental Settles when the composition API ships. */ type DefinitionAction = ({ readonly kind: "expose"; readonly label: string; } & ExposureTargetInput) | { readonly kind: "rename-exposure"; readonly exposureId: string; readonly label: string; } | ({ readonly kind: "retarget-exposure"; readonly exposureId: string; } & ExposureTargetInput) | { readonly kind: "remove-exposure"; readonly exposureId: string; } | { readonly kind: "remove-exposed-slot"; readonly slotId: string; } | { readonly kind: "add-variant"; readonly label: string; } | { readonly kind: "rename-variant"; readonly variantId: string; readonly label: string; } | { readonly kind: "delete-variant"; readonly variantId: string; } | { readonly kind: "set-variant-value"; readonly variantId: string; readonly exposureId: string; readonly value: unknown; } | { readonly kind: "reset-variant-value"; readonly variantId: string; readonly exposureId: string; }; /** * A page action, as the page actions route reads `action`. * * @experimental Settles when the composition API ships. */ export declare const pageActionSchema: z.ZodType; /** Every page action's `kind`, in the order the schema lists them. */ export declare const PAGE_ACTION_KINDS: readonly PageAction["kind"][]; /** * A definition action, as the definition actions route reads `action`. * * @experimental Settles when the composition API ships. */ export declare const definitionActionSchema: z.ZodType; /** Every definition action's `kind`, in the order the schema lists them. */ export declare const DEFINITION_ACTION_KINDS: readonly DefinitionAction["kind"][]; /** * The JSON Schema form of a page action, as a client that does not run zod * reads it: the input the schema accepts, before the parse normalises it. * * A binding's `format` and an unbind's kept `value` are judged by a function, * which JSON Schema cannot state; the converter refuses such a schema outright * otherwise, and the manifest that carries this form with it. A format is * written as an object, which is what its function asks; a kept value as any * value (`{}`), since it may be any JSON. Each stays required where the action * requires it, and is judged by the route. * * @experimental Settles when the composition API ships. */ export declare function pageActionJsonSchema(): Record; /** * The JSON Schema form of a definition action. The refinement that a target * names exactly one of `propPath` and `visibility` has no JSON Schema form of * its own, so it is written into each targeted action here: a tool that * validates against this schema refuses what the route refuses. * * @experimental Settles when the composition API ships. */ export declare function definitionActionJsonSchema(): Record; /** * What a definition edit reads besides the definition. * * @experimental Settles when the composition API ships. */ interface DefinitionActionSources { /** The block definitions, for each prop's type and each slot's lock. */ readonly definitions: ExposureSources$1["definitions"]; /** The ids the component has retired, never to be handed out again. */ readonly retired?: RetiredExposures; /** The host's document limits, which its save judges the definition under. */ readonly limits?: DocumentLimits; } /** * Plan one definition edit with the editor's own planner: the edited * definition, or why the edit is refused. The definition passed in is never * changed. * * @experimental Settles when the composition API ships. */ export declare function planDefinitionAction(definition: BlockDocument, action: DefinitionAction, sources: DefinitionActionSources): ExposureEditResult$1 | VariantEditResult$1; /** * The op binding `prop` of block `id` to `binding`, replacing a binding the * prop already had; `null` when the document holds no such block. * * `clear` names props emptied in the same op, for a prop another prop would * win over once bound: a button's entry reference is followed before its * address, so binding the address alone would leave the button going to the * entry. Only props the block holds are named in the patch, so a bind with * nothing to clear writes the bindings alone. * * @experimental Settles with the editor's binding controls. */ export declare function bindOp(document: BlockDocument, id: string, prop: string, binding: Binding, clear?: readonly string[], more?: { /** * Props set in the same edit: what the bound value needs beside it, * such as the collection of the entry a link's bound id names. */ readonly set?: Readonly>; /** * Other props' bindings removed in the same edit: one the block would * follow before this one, such as a link's address bound before the * entry it now points at. */ readonly unbind?: readonly string[]; }): BuilderOp | null; /** * What an unbind keeps in the block's props: values to set, and props to * empty. For an image a visitor saw by its address, the address is set on * the declared address prop and the media prop emptied. * * @experimental Settles with the editor's binding controls. */ interface KeptProps { readonly set: Readonly>; readonly empty?: readonly string[]; } /** * The op unbinding `prop` of block `id`, keeping `kept` in its props; `null` * when the document holds no such block. A block left with no binding stores * none. * * @experimental Settles with the editor's binding controls. */ export declare function unbindOp(document: BlockDocument, id: string, prop: string, kept: KeptProps): BuilderOp | null; /** * What a host is asked to add: a setting of the component filled by one of * its block's props, named as given. * * @experimental Settles with the editor's binding controls. */ interface ComponentSettingAsk { readonly componentId: string; readonly nodeId: string; readonly propPath: string; readonly label: string; } /** * The new setting's id, which the placement binds under, or why the host * would not add it. * * @experimental Settles with the editor's binding controls. */ type ComponentSettingAnswer = { readonly settingId: string; } | { readonly refusal: string; }; /** * One field a binding can read, as the picker lists it. * * @experimental Settles with the editor's binding controls. */ interface BindingFieldChoice extends Omit { /** What the field is called, where its name alone reads poorly. */ readonly label?: string; /** Whether a visitor may read it; a binding to one shows its fallback. */ readonly public: boolean; /** * The start of its value, as the person editing reads it, a draft's * included (marked by `draft`). Absent for a field visitors can't read, an * empty one, and one whose value is not text, a number or a yes-or-no. */ readonly preview?: string; /** * Set when the value differs from what the published entry holds: the * picker shows it beside the value, so the author knows it isn't live yet. */ readonly draft?: true; /** * A small picture of the value, for a field holding an image visitors may * read: its address, as the author's read gave it. The picker draws it * beside the field's name. */ readonly thumbnail?: string; /** * Set on a field visitors may read that holds nothing: the picker says * "(empty)" beside it, rather than leaving the author to guess why no value * shows. */ readonly empty?: true; /** * The fields inside it: a group's own, or a relation's, one step in, as the * entry it names holds them. */ readonly fields?: readonly BindingFieldChoice[]; /** * Set on a related entry's own id, listed under a relation that names one * entry of one collection: the collection that entry is in. A link's entry * can be bound to it, and only a link's, since an id is no value a reader * is shown. */ readonly linksTo?: string; /** * Set on a related entry (`linksTo`) whose collection has no page yet, as * the host serves pages: the collection's name, which the picker says the * row is waiting for. Listed, so the author sees why, but not picked. */ readonly noPageFor?: string; } /** * One source of bound values, as the picker groups its fields. * * @experimental Settles with the editor's binding controls. */ interface BindingFieldSource { /** How a binding names the source. */ readonly binding: { readonly source: "entry"; } | { readonly source: "single"; readonly sourceKey: string; } | { readonly source: "site"; }; /** The source's name: a collection's or a Single's label. */ readonly label: string; readonly fields: readonly BindingFieldChoice[]; /** * Set where the source's read failed for a reason other than access: it is * named, with no fields, so the picker can say it could not be read while * the other sources still list. */ readonly readFailed?: true; } /** * An unbind the inspector asks the host to plan, in the document it holds. * * @experimental Settles with the editor's binding controls. */ interface UnbindAsk { readonly document: BlockDocument; readonly nodeId: string; readonly prop: string; readonly keep?: UnbindKeep; } /** * The props written in the binding's place and the answer, or why not. * * @experimental Settles with the editor's binding controls. */ type UnbindPlanAnswer = { readonly kept: KeptProps; readonly answer: UnbindAnswer; } | { readonly refusal: string; }; /** * The op setting a block's conditions to `conditions`, an OR of AND groups; * `null` or no groups removes them. `null` when the document holds no such * block. * * @experimental Settles with the editor's condition controls. */ export declare function conditionsOp(document: BlockDocument, id: string, conditions: readonly (readonly Condition[])[] | null): BuilderOp | null; /** * One action on a collection's template. * * @experimental Settles when collection templates ship. */ type TemplateAction = { readonly kind: "create-template"; /** The collection whose entries the template renders, by slug. */ readonly collection: string; /** The template's name in the admin; the collection's name by default. */ readonly title?: string; readonly publish?: boolean; } | { readonly kind: "publish-template"; readonly id: string; } | { readonly kind: "give-entry-design"; /** The entry's collection, by slug. */ readonly collection: string; /** The entry's id. */ readonly entry: string; /** The own design's name in the admin; the entry's title by default. */ readonly title?: string; } | { readonly kind: "remove-entry-design"; readonly collection: string; readonly entry: string; } | { readonly kind: "delete-template"; readonly id: string; } | { readonly kind: "set-template-address"; readonly id: string; /** A path such as `/blog`, in its one spelling, or `null` for none. */ readonly address: string | null; }; /** * A template action, as the template actions route reads `action`. * * @experimental Settles when collection templates ship. */ export declare const templateActionSchema: z.ZodType; /** Every template action's `kind`, in the order the schema lists them. */ export declare const TEMPLATE_ACTION_KINDS: readonly TemplateAction["kind"][]; /** * The JSON Schema form of a template action. * * @experimental Settles when collection templates ship. */ export declare function templateActionJsonSchema(): Record; export { type ActionPosition, type AppliedOp, type AppliedOps, type BindingFieldChoice, type BindingFieldSource, type BuilderOp, type ComponentSettingAnswer, type ComponentSettingAsk, type CompositionPlan, type ConditionInput, type CreatePlanResult, type DefinitionAction, type DefinitionActionSources, type ExposeRequest, type ExposureEdit, type ExposureEditProblem, type ExposureEditRefusal, type ExposureEditResult, type ExposureSources, type ExposureTarget, type ExposureTargetInput, type InsertTarget, type KeptProps, type ListQueryChange, type NewVariantSources, type NodePatch, OpError, type OpPosition, type PageAction, type PlanProblem, type PlanRefusal, type PlanResult, type PrunedVariant, type SlotAddress, type StoredPattern, type TemplateAction, type UnbindAnswer, type UnbindAsk, type UnbindKeep, type UnbindPlanAnswer, type VariantEdit, type VariantEditProblem, type VariantEditRefusal, type VariantEditResult, applyOp, applyOps, fieldLabel, planAddVariant, planConvertToComponent, planDeleteVariant, planDetach, planDuplicateComponent, planExposeProperty, planInsertPattern, planRemoveExposedSlot, planRemoveExposure, planRenameExposure, planRenameVariant, planResetVariantValue, planRetargetExposure, planSaveAsComponent, planSaveAsPattern, planSetVariantValue, planUpdatePatternFromSelection, positionOf, propLabel, sameStoredValue, sameStyleValue }; //# sourceMappingURL=ops.d.ts.map