# Named HTML boxes, placed as copies or linked (Box.componentId); linked boxes # share only the html. Admin only, reads included. type Component { id: ID! createdAt: Time! updatedAt: Time! name: String! title: String html: String! w: Int! h: Int! framed: Boolean! shadow: String! adminOnly: Boolean! # How many boxes are linked to it. uses: Int! } input CreateComponentInput { name: String! title: String html: String! w: Int h: Int framed: Boolean shadow: String adminOnly: Boolean } input UpdateComponentInput { name: String title: String html: String w: Int h: Int framed: Boolean shadow: String adminOnly: Boolean } extend type Query { # By name. components: [Component!]! @admin } extend type Mutation { createComponent(input: CreateComponentInput!): Component! @admin # A new html changes every box linked to it. updateComponent(id: ID!, input: UpdateComponentInput!): Component! @admin # Detaches every linked box first, giving each its own copy of the html, so # no page changes. deleteComponent(id: ID!): Component! @admin # Makes html box `id` into a component named `name`, from its html, title, # size, frame, shadow and adminOnly, and links the box to it. Answers with the box. saveBoxAsComponent(id: ID!, name: String!): Box! @admin # Gives linked box `id` its own copy of the component's html and unlinks it. detachBox(id: ID!): Box! @admin }