concrete/contract/sources
No slot declares sources, since a media slot takes a pasted link wherever a link provider claims its kind; a media slot picks `from` a media list of the property, or owns its asset without one, and processes only what its kind takes; a slot bound to a fact states neither.
No slot declares sources, since a media slot takes a pasted link wherever a link provider claims its kind; a media slot picks from a media list of the property, or owns its asset without one, and processes only what its kind takes; a slot bound to a fact states neither.
Graded by the contracts stage of concrete check, in the contract venue. A violation reports this id and the file it failed at — see every rule and concrete check.
Reason
One declaration says where a media value may come from, and a second is refused.
No slot declares sources. Whether a pasted link may fill a media slot follows its
kind: a link's kind is its provider's, so every video and tour slot takes one, a
media slot takes one wherever its kinds include a video or a tour, and an image
or document slot takes none. A sources states nothing the kind does not already
say, so it is refused rather than ignored — an author reading it would expect a
narrowing the slot never applies.
from says which of the property's media lists the user picks a media value from —
what the editor's picker offers: fact.property.property_media for what shows the property,
fact.property.floor_plans for its plans, fact.property.property_documents for the
documents that set out its specifics, fact.property.uploads for everything it holds. Its candidates are that list's media of the slot's kind. from may name
several lists in order — from: [fact.property.floor_plans, fact.property.uploads] —
and the candidates are their union, a media value two of them hold offered once. Each list
is named once, and each must hold items that can be of the slot's kind: a document
picking from: fact.property.property_media, a list of photos, videos and tours, has nothing
there to pick. A media slot with
no from owns its media: the user uploads or pastes one into it, and nothing picks
it. process: [...] says what becomes of every media value that lands in the slot —
process.cutout(), the background removed, applies to an image alone. A slot bound to a fact (a row's
member, an element, or the item of a list so bound, a list over a unit's floor plans
among them) already has both answers: it holds what its fact holds, processed where
that fact declares it, so a from or a process: [...] beside the binding is a second,
disagreeing answer. A from naming anything but the three lists names no
candidates at all, and a category is refused outright: the list a slot picks from
is its from.
Type-caught for most of it: no builder admits sources, from is typed to the media
lists, the processes to those of the builder's kind, no builder admits category, and a
builder bound to a fact admits neither from nor a process. Check-caught for every
schema that never passed through the types.
Fix
Remove sources — concrete upgrade does it for you. Name the list or lists a
media slot bound to no fact picks from in from, each once and each holding its kind
— or none, for a slot that owns its media — declare only processes its kind takes, and
remove both from one bound to a fact.
Before and after
// A video declares no sources and takes no cutout, and a bound image picks from nothing: the compiler rejects all three, as the rule does.
// @noErrors
import { fact, image, process, row, video } from "@homepages/concrete";
const contact = row({ label: "Contact", from: fact.property.contacts, locked: true });
video({ label: "Property video", from: fact.property.property_media, process: [process.cutout()], sources: ["upload", "link"] });
image({ label: "Contact logo", from: fact.property.uploads, source: contact.logo_dark });import { fact, image, row, video } from "@homepages/concrete";
const contact = row({ label: "Contact", from: fact.property.contacts, locked: true });
video({ label: "Property video", from: fact.property.property_media });
image({ label: "Contact logo", source: contact.logo_dark });