OPF
SpecDefinition referenceView source

Catalogs

The catalog records a document embeds, grouped by the catalog they came from. Each property is a group; inside a group, records are keyed by kind and then by id. - 'default': the catalog bare ids come from. It needs a 'source' when it holds records. Omitted: bare ids fall back to the host's default catalog. false: no catalog fallback, so every bare id must be embedded (under 'custom' or 'default'). - 'custom': the records the document defines itself. It has no source. - any other name ('acme'): an extra catalog, identified by its 'source'. The name is the prefix references use ('acme:hero'). Names are lowercase kebab-case; 'default' and 'custom' are reserved. Resolution, for every kind: a bare id resolves in 'custom', then in the records embedded under 'default', then in the catalog the host registered for default.source (the host's default catalog when 'default' is omitted). 'name:id' resolves in that group's records, then in the catalog the host registered for its source. A reference written inside an embedded record (a theme's colorScheme) resolves in that record's own group first. A prefix that names no group is a validation error; a reference that resolves nowhere is the warning opf/unresolved-reference. Engines never fetch a source: hosts register catalogs by their source string, and authoring tools embed every record a document uses when they save it.

Metadata

Definition
#/$defs/Catalogs
Form
object
Source
spec/schemas/opf.schema.json

Field index

FieldTypeReq.Description
defaultref:CatalogGroup + object | const—The catalog bare ids come from: its source and the records of it this document embeds. false turns off the catalog fallback for bare ids.
default · Named choices (see schema for other values and constraints)
false
customref:CatalogGroup + restriction—Records the document defines itself, referenced by bare id. Checked first for every bare id. Forking a catalog record copies it here under a new id, so the change of ownership is visible.

default

typeref:CatalogGroup + object | constrequirednodefault—

The catalog bare ids come from: its source and the records of it this document embeds. false turns off the catalog fallback for bare ids.

default · Named choices (see schema for other values and constraints)
false
default.json
{
  "default": {
    "source": "https://www.pptx.gallery",
    "layouts": {
      "two-column": {
        "name": "Two column",
        "regions": [
          {
            "name": "title"
          },
          {
            "direction": "row",
            "regions": [
              {
                "name": "primary",
                "accepts": [
                  "text"
                ]
              },
              {
                "name": "secondary",
                "accepts": [
                  "text"
                ]
              }
            ]
          }
        ]
      }
    }
  }
}

custom

typeref:CatalogGroup + restrictionrequirednodefault—

Records the document defines itself, referenced by bare id. Checked first for every bare id. Forking a catalog record copies it here under a new id, so the change of ownership is visible.

Complete definition constraints
Schema constraints
{
  "type": "object",
  "description": "The catalog records a document embeds, grouped by the catalog they came from. Each property is a group; inside a group, records are keyed by kind and then by id.\n- 'default': the catalog bare ids come from. It needs a 'source' when it holds records. Omitted: bare ids fall back to the host's default catalog. false: no catalog fallback, so every bare id must be embedded (under 'custom' or 'default').\n- 'custom': the records the document defines itself. It has no source.\n- any other name ('acme'): an extra catalog, identified by its 'source'. The name is the prefix references use ('acme:hero'). Names are lowercase kebab-case; 'default' and 'custom' are reserved.\n\nResolution, for every kind: a bare id resolves in 'custom', then in the records embedded under 'default', then in the catalog the host registered for default.source (the host's default catalog when 'default' is omitted). 'name:id' resolves in that group's records, then in the catalog the host registered for its source. A reference written inside an embedded record (a theme's colorScheme) resolves in that record's own group first. A prefix that names no group is a validation error; a reference that resolves nowhere is the warning opf/unresolved-reference. Engines never fetch a source: hosts register catalogs by their source string, and authoring tools embed every record a document uses when they save it.",
  "properties": {
    "default": {
      "oneOf": [
        {
          "allOf": [
            {
              "$ref": "#/$defs/CatalogGroup"
            },
            {
              "if": {
                "anyOf": [
                  {
                    "required": [
                      "layouts"
                    ]
                  },
                  {
                    "required": [
                      "themes"
                    ]
                  },
                  {
                    "required": [
                      "colorSchemes"
                    ]
                  },
                  {
                    "required": [
                      "fontSchemes"
                    ]
                  },
                  {
                    "required": [
                      "narratives"
                    ]
                  },
                  {
                    "required": [
                      "audiences"
                    ]
                  },
                  {
                    "required": [
                      "purposes"
                    ]
                  },
                  {
                    "required": [
                      "tones"
                    ]
                  }
                ]
              },
              "then": {
                "required": [
                  "source"
                ]
              }
            }
          ]
        },
        {
          "const": false
        }
      ],
      "description": "The catalog bare ids come from: its source and the records of it this document embeds. false turns off the catalog fallback for bare ids.",
      "examples": [
        {
          "source": "https://www.pptx.gallery",
          "layouts": {
            "two-column": {
              "name": "Two column",
              "regions": [
                {
                  "name": "title"
                },
                {
                  "direction": "row",
                  "regions": [
                    {
                      "name": "primary",
                      "accepts": [
                        "text"
                      ]
                    },
                    {
                      "name": "secondary",
                      "accepts": [
                        "text"
                      ]
                    }
                  ]
                }
              ]
            }
          }
        },
        false
      ]
    },
    "custom": {
      "allOf": [
        {
          "$ref": "#/$defs/CatalogGroup"
        },
        {
          "not": {
            "required": [
              "source"
            ]
          }
        }
      ],
      "description": "Records the document defines itself, referenced by bare id. Checked first for every bare id. Forking a catalog record copies it here under a new id, so the change of ownership is visible."
    }
  },
  "propertyNames": {
    "pattern": "^[a-z][a-z0-9-]*$",
    "description": "Group name: lowercase kebab-case. 'default' and 'custom' are reserved."
  },
  "additionalProperties": {
    "allOf": [
      {
        "$ref": "#/$defs/CatalogGroup"
      },
      {
        "required": [
          "source"
        ]
      }
    ],
    "description": "A named catalog: its source and the records of it this document embeds. References name it as a prefix ('acme:hero')."
  },
  "examples": [
    {
      "default": {
        "source": "https://www.pptx.gallery",
        "themes": {
          "minimal": {
            "name": "Minimal",
            "colorScheme": "cool-horizon",
            "fontScheme": "aptos"
          }
        }
      },
      "acme": {
        "source": "pkg:@acme/opf-catalog",
        "layouts": {
          "hero": {
            "name": "Hero",
            "regions": [
              {
                "name": "title"
              }
            ]
          }
        }
      },
      "custom": {
        "layouts": {
          "q4-special": {
            "name": "Q4 special",
            "regions": [
              {
                "name": "title"
              },
              {
                "name": "chart",
                "accepts": [
                  "chart"
                ],
                "flow": "none"
              }
            ]
          }
        }
      }
    }
  ]
}