Cotton code
595 lines · 12.2 KB · JSONRaw
{  "format_version": 1,  "id": "media",  "name": "Photo or video",  "plural": "Photos and videos",  "picture": {    "photo": "photo:cd1fef04863a8c429257401e6b4da235458215a00395ffecd58b3eda10ab3172",    "object": "tool-photos"  },  "builtin": true,  "engine": "media",  "takes_files": true,  "create": {    "label": "Add photos",    "doors": [      {        "id": "library",        "label": "Choose photos",        "object": "sheet",        "pick": {          "source": "library",          "kinds": [            "photo",            "video"          ],          "many": true        }      },      {        "id": "camera",        "label": "Take a photo",        "object": "camera",        "pick": {          "source": "camera",          "kinds": [            "photo",            "video"          ]        }      },      {        "id": "files",        "label": "From Files",        "object": "canister",        "files": {          "types": [            "public.image",            "public.movie"          ],          "many": true        }      }    ]  },  "columns": [    {      "key": "kind",      "name": "Kind",      "type": "choice",      "choices": [        "photo",        "video"      ],      "readonly": true,      "labels": {        "photo": "Photo",        "video": "Video"      }    },    {      "key": "key",      "name": "Picture",      "type": "photo",      "readonly": true    },    {      "key": "caption",      "name": "Caption",      "type": "text",      "readonly": true    },    {      "key": "taken_at",      "name": "Taken",      "type": "date",      "readonly": true    },    {      "key": "place_name",      "name": "Place",      "type": "text",      "readonly": true    },    {      "key": "summary",      "name": "Description",      "type": "longtext",      "readonly": true    },    {      "key": "duration_ms",      "name": "Length",      "type": "number",      "readonly": true,      "format": "duration_ms"    },    {      "key": "size_bytes",      "name": "Size",      "type": "number",      "readonly": true,      "format": "bytes"    },    {      "key": "albums",      "name": "Albums",      "type": "link",      "link_to": "album",      "readonly": true,      "multiple": true    },    {      "key": "people",      "name": "People",      "type": "link",      "link_to": "person",      "readonly": true,      "multiple": true    },    {      "key": "place_city",      "name": "City",      "type": "text",      "readonly": true    },    {      "key": "camera_make",      "name": "Camera make",      "type": "text",      "readonly": true    },    {      "key": "camera_model",      "name": "Camera",      "type": "text",      "readonly": true    },    {      "key": "favourite",      "name": "Favourite",      "type": "bool",      "readonly": true    },    {      "key": "on_phone",      "name": "On this phone",      "type": "choice",      "choices": [        "absent",        "kept"      ],      "labels": {        "absent": "Not on this phone",        "kept": "On this phone"      },      "readonly": true    }  ],  "title": "caption",  "date": null,  "project": null,  "order": null,  "slip": {    "title": "caption",    "subtitle": "place_name",    "trailing": "taken_at",    "photo": "key",    "toggle": null,    "title_fallback": "place_name",    "badge": {      "column": "kind",      "values": [        "video"      ],      "symbol": "play.fill",      "spoken": "Video"    }  },  "viewer": {    "words": {      "close": "Close",      "details": "Details",      "more": "More",      "share": "Share",      "position": "{n} of {count}",      "absent": "Not on this phone yet",      "removed": "This was removed.",      "fetch": "Fetch",      "fetching": "Fetching…",      "map_absent": "Map not fetched yet",      "play": "Play",      "pause": "Pause",      "mute": "Mute",      "unmute": "Sound on",      "picture_in_picture": "Picture in picture",      "search": "Search this document",      "no_match": "Nothing matches",      "page": "Page {n} of {count}",      "go_to_page": "Go to page",      "go": "Go",      "pin_press": "long press to leave a pin",      "pin_hint": "A pin on this picture, at the point you pressed.",      "pin_placeholder": "What is this about?",      "cancel": "Cancel",      "save": "Save",      "saving": "Saving…"    }  },  "tile": {    "face": "polaroid-grid"  },  "polaroid": {    "caption": "duration_ms"  },  "layout": "sheet",  "grid": {    "columns": 4  },  "sort": {    "column": "taken_at",    "descending": true  },  "by_month": "taken_at",  "months": {    "over": 0,    "undated": "No date"  },  "count_words": {    "column": "kind",    "units": {      "photo": {        "one": "photo",        "other": "photos"      },      "video": {        "one": "video",        "other": "videos"      }    }  },  "filter": {    "column": "kind",    "tabs": false,    "all": "All",    "words": {      "photo": "Photos",      "video": "Videos"    },    "empty": {      "photo": {        "title": "No photos yet.",        "message": "Pictures and videos from your chats land here on their own."      },      "video": {        "title": "No videos yet.",        "message": "Pictures and videos from your chats land here on their own."      }    }  },  "search": [    "caption",    "summary"  ],  "search_placeholder": "What's in your photos",  "empty": {    "title": "No photos yet.",    "message": "Pictures and videos from your chats land here on their own.",    "search": {      "title": "No matches yet"    }  },  "delete_when": {    "column": "kind",    "present": true  },  "select": {    "verb": "delete"  },  "deletion": {    "bin": true  },  "links": [    {      "label": "Albums",      "table": "album",      "where": {        "state": "open"      },      "words": "suggested",      "path": "/photos/albums",      "review": true    },    {      "label": "Duplicates",      "table": "duplicate",      "path": "/photos/duplicates",      "review": true,      "hides_empty": true,      "units": {        "one": "{n} duplicate",        "other": "{n} duplicates"      }    },    {      "label": "People to confirm",      "table": "face",      "path": "/photos/people",      "review": true,      "hides_empty": true,      "units": {        "one": "{n} person to confirm",        "other": "{n} people to confirm"      }    },    {      "label": "Deleted",      "table": "bin",      "where": {        "table": [          "photo",          "video"        ]      }    }  ],  "page": [    {      "heading": null,      "columns": [        "key",        "caption",        "taken_at",        "place_name"      ]    }  ],  "instructions": "The owner's pictures and films as one library, newest first: each row is a photo or a video (kind), read from the photo and video tables. A row opens its photo's or video's own page. Its groups are the albums: create_group on it makes an album of the pictures named, update_group renames one or puts pictures in or takes them out, and delete_group dismisses one. on_phone is answered by each phone (absent, or kept: the picture's own bytes are on it) and never stored. A picture comes in by the + : Choose photos (the system's photo picker, which hands over only what the owner chose and never the whole library), Take a photo (the camera) or From Files; each becomes a photo or a video row with its bytes, kept on the phone and backed up to the object once it is signed in. Cotton never mirrors the camera roll.",  "groups": {    "stack": "polaroids",    "kept_in": {      "table": "album",      "items": "album_item"    }  },  "parts": {    "shape": "desk",    "head": {      "facts": [        "taken_at",        "place_name"      ]    },    "links": [],    "body": "summary",    "lists": [],    "acts": {      "main": "share",      "more": [        "favourite",        "unfavourite"      ],      "away": "delete"    },    "strip": [      {        "column": "taken_at"      },      {        "column": "place_name"      },      {        "column": "key"      }    ]  },  "commands": [    {      "id": "share",      "label": "Share",      "kind": "update",      "method": "media.share",      "receipt": "Ready to share",      "bindings": {        "key": "key"      },      "object": "tag"    },    {      "id": "favourite",      "label": "Favourite",      "kind": "update",      "verb": "update_record",      "data": {        "table": "media",        "patch": {          "favourite": true        }      },      "bindings": {        "id": "$id"      },      "when": {        "favourite": false      },      "receipt": "{name} is a favourite",      "undo": "unfavourite",      "object": "star"    },    {      "id": "unfavourite",      "label": "Not a favourite",      "kind": "update",      "verb": "update_record",      "data": {        "table": "media",        "patch": {          "favourite": false        }      },      "bindings": {        "id": "$id"      },      "when": {        "favourite": true      },      "receipt": "{name} is not a favourite",      "undo": "favourite",      "object": "star"    },    {      "id": "delete",      "label": "Delete",      "kind": "delete",      "verb": "delete_record",      "data": {        "table": "media"      },      "bindings": {        "id": "$id"      },      "when": {        "kind": {          "not": null        }      },      "confirm": "Undo on the receipt brings it back.",      "receipt": "Deleted",      "does": "destroys",      "object": "bin"    }  ],  "tool": {    "views": [      {        "id": "all",        "label": "Recent",        "is_default": true,        "visibility": "owner",        "read": {          "table": "media"        }      },      {        "id": "albums",        "label": "Albums",        "is_default": false,        "visibility": "owner",        "read": {          "table": "album"        }      },      {        "id": "favourites",        "label": "Favourites",        "is_default": false,        "visibility": "owner",        "read": {          "table": "media",          "where": {            "favourite": true          },          "empty": {            "line": "empty_views.photos.favourites",            "table": true          }        }      },      {        "id": "videos",        "label": "Videos",        "is_default": false,        "visibility": "owner",        "read": {          "table": "media",          "where": {            "kind": "video"          },          "empty": {            "line": "empty_views.photos.videos",            "table": true          }        }      },      {        "id": "on_phone",        "label": "On this phone",        "is_default": false,        "visibility": "owner",        "read": {          "table": "media",          "where": {            "on_phone": [              "kept"            ]          },          "empty": {            "line": "empty_views.photos.on_phone",            "table": true          }        }      }    ],    "name": "Photos",    "key": "photos",    "icon": "image",    "card_stock": "slate",    "route": "/photos",    "purpose": "Your photos and the moments they capture."  },  "tables": [],  "card": {    "face": "photo.print",    "fields": [      {        "slot": "photo",        "column": "key"      },      {        "slot": "title",        "column": "caption"      },      {        "slot": "date",        "column": "taken_at",        "form": "weekday_date_year"      },      {        "slot": "place",        "column": "place_name"      },      {        "slot": "people",        "column": "people"      },      {        "slot": "album",        "column": "albums"      },      {        "slot": "city",        "column": "place_city"      },      {        "slot": "model",        "column": "camera_make",        "also": [          "camera_model"        ]      }    ]  },  "seal": {    "clear": [      "kind",      "key",      "taken_at",      "duration_ms",      "size_bytes",      "albums",      "people",      "favourite",      "on_phone"    ]  }}