2.2.2 • Published 2 months ago

@iiif/presentation-3 v2.2.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

IIIF Presentation 3 types

A set of types that describe the format of the IIIF Presentation 3.0 specification as accurately as possible.

Installation:

$ npm i @iiif/presentation-3

Installation (yarn):

$ yarn add @iiif/presentation-3

Usage (Typescript):

import { Manifest } from '@iiif/presentation-3';

const manifest = getManifestFromSomewhere() as Manifest;

function doSomethingWithManifest(manifest: Manifest) {
  // ...
}

Usage (Javascript):

/**
 * @typedef { import("@iiif/presentation-3").Manifest } Manifest
 */

/**
 * @type {Manifest}
 */
const manifest = {};


/**
 * @param manifest {Manifest}
 */
function doSomethingWithManifest(manifest) {
  console.log(manifest.label);
}

// You can also inline the import:

/**
 * @type {import("@iiif/presentation-3").Manifest}
 */
const manifest2 = {};

This will enable types completions in VSCode and IDEA, along with inline documentation from the IIIF specification:

Support

The following types are supported:

  • Manifest
  • Collection
  • Canvas
  • Annotation
  • Annotation Collection
  • Annotation Page
  • Content Resource
  • Provider
  • Range
  • Service

With some other types that aim to cover common services:

  • Auth service
  • GeoJSON service
  • Image service
  • Search service

Full List of types

Basic types

TypeDescription
ResourceTypeString literals for the possible values of type
InternationalStringCommon language property ({ "none": ["..."] })
ReferenceA reference to another resources ({id: '..', type: '..'})
JsonLDContextA partial of {'@context': ... }, extended by resources with contexts
MetadataItemLabel value pair used in the metadata field
SpecificationBehaviorsString literals for supported behaviors mentioned in the specification
SpecificationTimeModeString literals for supported time modes mentioned in the specification
ViewingDirectionString literal for the 4 supported viewing directions

Resources

TypeDescription
ServiceAny service that can appear in services property. Union of generic and specific services.
ManifestTypes for a valid IIIF Manifest
CanvasTypes for a valid IIIF Canvas
ContentResourceTypes for a Content Resource - warning this can be many things!
AnnotationPageTypes for a valid Annotation page
AnnotationTypes for a valid Annotation in the context of a IIIF manifest
AnnotationW3CTypes for a valid W3C annotation (different from above)
CollectionTypes for a valid IIIF Collection
RangeTypes for a valid IIIF Range
AnnotationCollectionTypes for a valid Annotation collection
IIIFExternalWebResourceAbstract type for an external web resource
ContentResourceStringAlias for string

Resource items (structural)

TypeDescription
CanvasItemsAlias for Annotation Page
CollectionItemsUnion of Manifest or Collection
ManifestItemsAlias for Canvas
RangeItemsUnion of Range, Canvas or string

Services

TypeDescription
AuthAccessTokenServiceErrortodo
AuthAccessTokenServiceResponsetodo
AuthAbstractServicetodo
AuthAccessTokenServicetodo
AuthExternalServicetodo
AuthClickThroughServicetodo
AuthKioskServicetodo
AuthLoginServicetodo
AuthLogoutServicetodo
AuthServicetodo
GeoJsonServicetodo
ImageServicetodo
ImageService2todo
ImageServiceProfiletodo
ImageProfiletodo
ImageService3todo
ImageSizetodo
ImageTiletodo
SearchServicetodo
SearchServiceAutocompletetodo
SearchServiceAutocompleteQueryParamstodo
SearchServiceAutocompleteResponsetodo
SearchServiceCommonHitSelectorstodo
SearchServiceCommonResourcestodo
SearchServiceQueryParamstodo
SearchServiceSearchCommonSelectorstodo
SearchServiceSearchResponsetodo

W3C Annotations

Most of these types are not exported, but internally follows the full W3C specification.

W3C Model Specification

TypeDescription
Agenttodo
AnnotationBodytodo
AnnotationTargettodo
AnyMotivationtodo
Audiencetodo
Bodytodo
ChoiceBodytodo
ChoiceTargettodo
Creatortodo
BasicStatetodo
CssSelectortodo
DataPositionSelectortodo
FragmentSelectortodo
Selectortodo
RefinedBytodo
RefinedByStatetodo
EmbeddedResourcetodo
ExternalResourceTypestodo
ExternalWebResourcetodo
RangeSelectortodo
RequestHeaderStatetodo
SpecificResourcetodo
Statetodo
SvgSelectortodo
TextPositionSelectortodo
TextQuoteSelectortodo
TimeStatetodo
XPathSelectortodo
Stylesheettodo
Targettodo
TargetCompositetodo
TargetListtodo
TargetIndependentstodo
W3CAnnotationBodytodo
W3CAnnotationCollectiontodo
W3CAnnotationPagetodo
W3CAnnotationTargettodo
W3CMotivationtodo
LinkedResourcetodo
ResourceBasePropertiestodo
OtherPropertiestodo

Normalized resources

The normalized types have moved to @iiif/presentation-3-normalized.

Partial / Abstract types

These types are building blocks of other types.

TypeDescription
LinkingPropertiesThe linking properties of IIIF in a map LinkingProperties['seeAlso']
DescriptivePropertiesThe descriptive properties of IIIF in a map DescriptiveProperties['label']
TechnicalPropertiesThe technical properties of IIIF in a map DescriptiveProperties['id']
StructuralPropertiesThe structural properties of IIIF in a map DescriptiveProperties['annotations']

Helpers

TypeDescription
OmitPropertiesHelper for removing properties from another type
IdOrAtIdHelper for resources that can have either id or @id
SomeRequiredHelper for requiring some properties from another type
RequiredHelper for requiring all properties from another type