Code Monkey home page Code Monkey logo

presentation-2-types's Introduction

IIIF Presentation 2 types

A set of types that describe the format of the IIIF Presentation 2.1.1 specification as accurately as possible. Types are also available for IIIF Presentation 3

Installation:

$ npm i @iiif/presentation-2

Installation (yarn):

$ yarn add @iiif/presentation-2

Usage (Typescript):

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

const manifest = getManifestFromSomewhere() as Manifest;

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

Usage (Javascript):

/**
 * @typedef { import("@iiif/presentation-2").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-2").Manifest}
 */
const manifest2 = {};

This will enable types completions in VSCode and IDEA, along with inline documentation from the IIIF specification: Screenshot 2021-03-28 at 17 11 14

Support

The following types are supported:

  • Manifest
  • Collection
  • Canvas
  • Annotation (Open Annotation)
  • Annotation List (Open Annotation)
  • Layer
  • Content Resource
  • Provider
  • Range
  • Service

Partial / Abstract types

These types are building blocks of other types.

Type Description
TechnicalProperties The technical properties of IIIF in a map TechnicalProperties['id']
DescriptiveProperties The descriptive properties of IIIF in a map DescriptiveProperties['label']
LinkingProperties The linking properties of IIIF in a map LinkingProperties['related']
PagingProperties The paging properties of IIIF in a map PagingProperties['first']
RightsProperties The structural properties of IIIF in a map RightsProperties['attribution']

presentation-2-types's People

Contributors

stephenwf avatar jbaiter avatar edsilv avatar

Watchers

Drew Winget avatar Oh, Hey! avatar James Cloos avatar  avatar Glen Robson avatar Rashmi Singhal avatar  avatar  avatar

Forkers

jbaiter

presentation-2-types's Issues

tsc complains about bad import for `../../types/resources/annotation` in `annotation.d.ts`

../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@iiif/presentation-2/resources/annotation.d.ts:6:34 - error TS2307: Cannot find module '../../types/resources/annotation' or its corresponding type declarations.

import { SpecificResource } from '../../types/resources/annotation';
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

https://github.com/IIIF-Commons/presentation-2-types/blob/main/resources/annotation.d.ts#L6

It seems to me that SpecificResource is not included in the @iiif/presentation-2 module, but is instead part of @iiif/presentation-3: https://github.com/IIIF-Commons/presentation-3-types/blob/b6a207ca7ae5d72651363c52e4111738f91dccb4/resources/annotation.d.ts

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.