manifesto.js 4.2.21 → 4.2.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist-commonjs/AnnotationBody.d.ts +2 -0
- package/dist-commonjs/AnnotationBody.js +6 -0
- package/dist-commonjs/AnnotationBody.js.map +1 -1
- package/dist-commonjs/AnnotationList.js.map +1 -1
- package/dist-commonjs/Canvas.d.ts +2 -1
- package/dist-commonjs/Canvas.js +24 -6
- package/dist-commonjs/Canvas.js.map +1 -1
- package/dist-commonjs/Collection.js +8 -1
- package/dist-commonjs/Collection.js.map +1 -1
- package/dist-commonjs/Duration.js.map +1 -1
- package/dist-commonjs/IIIFResource.js +1 -1
- package/dist-commonjs/IIIFResource.js.map +1 -1
- package/dist-commonjs/Manifest.js +9 -3
- package/dist-commonjs/Manifest.js.map +1 -1
- package/dist-commonjs/PropertyValue.js.map +1 -1
- package/dist-commonjs/Range.js +8 -1
- package/dist-commonjs/Range.js.map +1 -1
- package/dist-commonjs/Sequence.js +8 -1
- package/dist-commonjs/Sequence.js.map +1 -1
- package/dist-commonjs/Serialisation.js.map +1 -1
- package/dist-commonjs/Utils.d.ts +1 -1
- package/dist-commonjs/Utils.js.map +1 -1
- package/dist-esmodule/Annotation.js +1 -1
- package/dist-esmodule/Annotation.js.map +1 -1
- package/dist-esmodule/AnnotationBody.d.ts +2 -0
- package/dist-esmodule/AnnotationBody.js +6 -0
- package/dist-esmodule/AnnotationBody.js.map +1 -1
- package/dist-esmodule/AnnotationList.js +1 -1
- package/dist-esmodule/AnnotationList.js.map +1 -1
- package/dist-esmodule/Canvas.d.ts +2 -1
- package/dist-esmodule/Canvas.js +26 -8
- package/dist-esmodule/Canvas.js.map +1 -1
- package/dist-esmodule/Collection.js +10 -3
- package/dist-esmodule/Collection.js.map +1 -1
- package/dist-esmodule/Duration.js.map +1 -1
- package/dist-esmodule/IIIFResource.js +3 -3
- package/dist-esmodule/IIIFResource.js.map +1 -1
- package/dist-esmodule/Manifest.js +11 -5
- package/dist-esmodule/Manifest.js.map +1 -1
- package/dist-esmodule/ManifestResource.js +2 -2
- package/dist-esmodule/ManifestResource.js.map +1 -1
- package/dist-esmodule/PropertyValue.js.map +1 -1
- package/dist-esmodule/Range.js +10 -3
- package/dist-esmodule/Range.js.map +1 -1
- package/dist-esmodule/Resource.js +1 -1
- package/dist-esmodule/Resource.js.map +1 -1
- package/dist-esmodule/Sequence.js +9 -2
- package/dist-esmodule/Sequence.js.map +1 -1
- package/dist-esmodule/Serialisation.js +1 -1
- package/dist-esmodule/Serialisation.js.map +1 -1
- package/dist-esmodule/Utils.d.ts +1 -1
- package/dist-esmodule/Utils.js +3 -3
- package/dist-esmodule/Utils.js.map +1 -1
- package/dist-umd/manifesto.js +1 -1
- package/dist-var/manifesto.js +1 -1
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +64 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1633 -0
- package/docs/classes/Annotation.html +29 -0
- package/docs/classes/AnnotationBody.html +30 -0
- package/docs/classes/AnnotationList.html +13 -0
- package/docs/classes/AnnotationPage.html +25 -0
- package/docs/classes/Canvas.html +53 -0
- package/docs/classes/Collection.html +55 -0
- package/docs/classes/Deserialiser.html +10 -0
- package/docs/classes/Duration.html +5 -0
- package/docs/classes/IIIFResource.html +41 -0
- package/docs/classes/JSONLDResource.html +6 -0
- package/docs/classes/LabelValuePair.html +12 -0
- package/docs/classes/LanguageMap.html +199 -0
- package/docs/classes/LocalizedValue.html +21 -0
- package/docs/classes/Manifest.html +58 -0
- package/docs/classes/ManifestResource.html +24 -0
- package/docs/classes/PropertyValue.html +216 -0
- package/docs/classes/Range.html +37 -0
- package/docs/classes/Rendering.html +25 -0
- package/docs/classes/Resource.html +32 -0
- package/docs/classes/Sequence.html +48 -0
- package/docs/classes/Service.html +32 -0
- package/docs/classes/Size.html +4 -0
- package/docs/classes/Thumb.html +10 -0
- package/docs/classes/Thumbnail.html +32 -0
- package/docs/classes/TreeNode.html +14 -0
- package/docs/classes/Utils.html +39 -0
- package/docs/enums/ManifestType.html +4 -0
- package/docs/enums/StatusCode.html +5 -0
- package/docs/enums/TreeNodeType.html +4 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +22 -274
- package/docs/interfaces/IAccessToken.html +6 -0
- package/docs/interfaces/IExternalImageResourceData.html +8 -0
- package/docs/interfaces/IExternalResource.html +22 -0
- package/docs/interfaces/IExternalResourceData.html +6 -0
- package/docs/interfaces/IExternalResourceOptions.html +2 -0
- package/docs/interfaces/IManifestoOptions.html +7 -0
- package/docs/modules.html +1 -0
- package/docs/variables/loadManifest.html +1 -0
- package/docs/variables/parseManifest.html +1 -0
- package/eslint.config.cjs +25 -0
- package/package.json +24 -20
- package/pkg-tests/node-umd.js +3 -0
- package/test/fixtures/manifests.js +2 -1
- package/test/fixtures/pres3-annotations-embedded.json +66 -0
- package/test/index.js +1 -0
- package/test/tests/pres3-annotations-embedded.js +55 -0
- package/tsconfig.docs.json +13 -0
- package/types/index.d.ts +4 -1
- package/docs/assets/css/main.css +0 -865
- package/docs/assets/css/main.css.map +0 -7
- package/docs/assets/images/icons.png +0 -0
- package/docs/assets/images/icons@2x.png +0 -0
- package/docs/assets/images/widgets.png +0 -0
- package/docs/assets/images/widgets@2x.png +0 -0
- package/docs/assets/js/main.js +0 -5
- package/docs/assets/js/search.js +0 -3
- package/docs/classes/_annotation_.annotation.html +0 -809
- package/docs/classes/_annotationbody_.annotationbody.html +0 -788
- package/docs/classes/_annotationlist_.annotationlist.html +0 -443
- package/docs/classes/_annotationpage_.annotationpage.html +0 -719
- package/docs/classes/_canvas_.canvas.html +0 -1049
- package/docs/classes/_collection_.collection.html +0 -1286
- package/docs/classes/_duration_.duration.html +0 -284
- package/docs/classes/_iiifresource_.iiifresource.html +0 -995
- package/docs/classes/_jsonldresource_.jsonldresource.html +0 -309
- package/docs/classes/_labelvaluepair_.labelvaluepair.html +0 -417
- package/docs/classes/_language_.language.html +0 -255
- package/docs/classes/_languagemap_.languagemap.html +0 -2050
- package/docs/classes/_manifest_.manifest.html +0 -1482
- package/docs/classes/_manifestresource_.manifestresource.html +0 -710
- package/docs/classes/_range_.range.html +0 -1004
- package/docs/classes/_rendering_.rendering.html +0 -719
- package/docs/classes/_resource_.resource.html +0 -876
- package/docs/classes/_sequence_.sequence.html +0 -1308
- package/docs/classes/_serialisation_.deserialiser.html +0 -438
- package/docs/classes/_service_.service.html +0 -884
- package/docs/classes/_size_.size.html +0 -255
- package/docs/classes/_thumb_.thumb.html +0 -325
- package/docs/classes/_thumbnail_.thumbnail.html +0 -876
- package/docs/classes/_treenode_.treenode.html +0 -437
- package/docs/classes/_utils_.utils.html +0 -2045
- package/docs/enums/_manifesttype_.manifesttype.html +0 -223
- package/docs/enums/_statuscode_.statuscode.html +0 -237
- package/docs/enums/_treenodetype_.treenodetype.html +0 -223
- package/docs/globals.html +0 -300
- package/docs/interfaces/_iaccesstoken_.iaccesstoken.html +0 -259
- package/docs/interfaces/_iexternalimageresourcedata_.iexternalimageresourcedata.html +0 -282
- package/docs/interfaces/_iexternalresource_.iexternalresource.html +0 -518
- package/docs/interfaces/_iexternalresourcedata_.iexternalresourcedata.html +0 -250
- package/docs/interfaces/_iexternalresourceoptions_.iexternalresourceoptions.html +0 -203
- package/docs/interfaces/_imanifestooptions_.imanifestooptions.html +0 -273
- package/docs/modules/_annotation_.html +0 -170
- package/docs/modules/_annotationbody_.html +0 -170
- package/docs/modules/_annotationlist_.html +0 -170
- package/docs/modules/_annotationpage_.html +0 -170
- package/docs/modules/_canvas_.html +0 -170
- package/docs/modules/_collection_.html +0 -170
- package/docs/modules/_duration_.html +0 -170
- package/docs/modules/_iaccesstoken_.html +0 -170
- package/docs/modules/_iexternalimageresourcedata_.html +0 -170
- package/docs/modules/_iexternalresource_.html +0 -170
- package/docs/modules/_iexternalresourcedata_.html +0 -170
- package/docs/modules/_iexternalresourceoptions_.html +0 -170
- package/docs/modules/_iiifresource_.html +0 -170
- package/docs/modules/_imanifestooptions_.html +0 -170
- package/docs/modules/_index_.__global.html +0 -180
- package/docs/modules/_index_.__global.manifesto.html +0 -245
- package/docs/modules/_index_.html +0 -240
- package/docs/modules/_jsonldresource_.html +0 -170
- package/docs/modules/_labelvaluepair_.html +0 -170
- package/docs/modules/_language_.html +0 -170
- package/docs/modules/_languagemap_.html +0 -170
- package/docs/modules/_manifest_.html +0 -170
- package/docs/modules/_manifestresource_.html +0 -170
- package/docs/modules/_manifesttype_.html +0 -170
- package/docs/modules/_range_.html +0 -170
- package/docs/modules/_rendering_.html +0 -170
- package/docs/modules/_resource_.html +0 -170
- package/docs/modules/_sequence_.html +0 -170
- package/docs/modules/_serialisation_.html +0 -170
- package/docs/modules/_service_.html +0 -170
- package/docs/modules/_size_.html +0 -170
- package/docs/modules/_statuscode_.html +0 -170
- package/docs/modules/_thumb_.html +0 -170
- package/docs/modules/_thumbnail_.html +0 -170
- package/docs/modules/_treenode_.html +0 -170
- package/docs/modules/_treenodetype_.html +0 -170
- package/docs/modules/_utils_.html +0 -220
- package/tslint.json +0 -40
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// eslint.config.js
|
|
2
|
+
const { defineConfig } = require("eslint/config");
|
|
3
|
+
const tsPlugin = require("@typescript-eslint/eslint-plugin");
|
|
4
|
+
const tsParser = require("@typescript-eslint/parser");
|
|
5
|
+
const prettierConfig = require("eslint-config-prettier");
|
|
6
|
+
|
|
7
|
+
module.exports = defineConfig([
|
|
8
|
+
{
|
|
9
|
+
files: ["**/*.{js,jsx,ts,tsx}"],
|
|
10
|
+
languageOptions: {
|
|
11
|
+
parser: tsParser,
|
|
12
|
+
parserOptions: {
|
|
13
|
+
sourceType: "module",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
plugins: {
|
|
17
|
+
"@typescript-eslint": tsPlugin,
|
|
18
|
+
},
|
|
19
|
+
rules: {
|
|
20
|
+
semi: "error",
|
|
21
|
+
"prefer-const": "error",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
prettierConfig,
|
|
25
|
+
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "manifesto.js",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.23",
|
|
4
4
|
"description": "IIIF Presentation API utility library for client and server",
|
|
5
5
|
"main": "./dist-commonjs/index.js",
|
|
6
6
|
"module": "./dist-esmodule/index.js",
|
|
@@ -9,14 +9,16 @@
|
|
|
9
9
|
"types": "./dist-esmodule/index.d.ts",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build:commonjs": "tsc",
|
|
12
|
-
"
|
|
12
|
+
"docs": "rimraf -rf docs && typedoc --tsconfig tsconfig.docs.json --out docs --name manifesto --theme default src/",
|
|
13
13
|
"build:esmodule": "tsc -m es6 --outDir dist-esmodule",
|
|
14
14
|
"build:types": "dts-bundle-generator --umd-module-name manifesto -o types/index.d.ts dist-esmodule/index.d.ts",
|
|
15
15
|
"build:umd": "webpack",
|
|
16
16
|
"build:var": "cross-env NODE_WEBPACK_LIBRARY_PATH=dist-var NODE_WEBPACK_LIBRARY_TARGET=var webpack",
|
|
17
|
-
"build": "npm run
|
|
17
|
+
"build": "npm run fix && npm run clean && npm run build:commonjs && npm run build:esmodule && npm run build:umd && npm run build:var && npm run build:types",
|
|
18
18
|
"clean": "rimraf -rf dist-umd dist-commonjs dist-esmodule dist-var types",
|
|
19
|
-
"lint
|
|
19
|
+
"lint": "eslint --fix \"./src/**/*.{js,jsx,json,css,ts,tsx}\"",
|
|
20
|
+
"prettify": "prettier --write \"./src/**/*.{js,jsx,json,css,ts,tsx}\" --ignore-path .prettierignore",
|
|
21
|
+
"fix": "npm run lint && npm run prettify",
|
|
20
22
|
"prepublishOnly": "npm run build && npm run test",
|
|
21
23
|
"test": "mocha",
|
|
22
24
|
"watch": "npm run build:esmodule -- --watch"
|
|
@@ -39,29 +41,31 @@
|
|
|
39
41
|
},
|
|
40
42
|
"homepage": "https://github.com/iiif-commons/manifesto",
|
|
41
43
|
"devDependencies": {
|
|
42
|
-
"@types/node": "
|
|
43
|
-
"chai": "2.
|
|
44
|
-
"cross-env": "^
|
|
44
|
+
"@types/node": "24.0.10",
|
|
45
|
+
"chai": "5.2.0",
|
|
46
|
+
"cross-env": "^7.0.3",
|
|
45
47
|
"dts-bundle-generator": "^9.5.1",
|
|
46
|
-
"
|
|
48
|
+
"eslint": "9.27.0",
|
|
49
|
+
"eslint-config-prettier": "10.1.5",
|
|
50
|
+
"eslint-plugin-prettier": "5.4.0",
|
|
51
|
+
"finalhandler": "2.1.0",
|
|
47
52
|
"http": "0.0.0",
|
|
48
|
-
"mocha": "^
|
|
49
|
-
"prettier": "^
|
|
53
|
+
"mocha": "^11.7.1",
|
|
54
|
+
"prettier": "^3.6.2",
|
|
50
55
|
"prettier-check": "^2.0.0",
|
|
51
|
-
"rimraf": "^
|
|
52
|
-
"serve-static": "^
|
|
53
|
-
"ts-loader": "^
|
|
54
|
-
"
|
|
55
|
-
"typedoc": "^0.26.10",
|
|
56
|
+
"rimraf": "^6.0.1",
|
|
57
|
+
"serve-static": "^2.2.0",
|
|
58
|
+
"ts-loader": "^9",
|
|
59
|
+
"typedoc": "^0.28.7",
|
|
56
60
|
"typescript": "^5",
|
|
57
|
-
"typescript-
|
|
58
|
-
"webpack": "^
|
|
59
|
-
"webpack-cli": "^
|
|
60
|
-
"yargs": "
|
|
61
|
+
"typescript-eslint": "8.32.1",
|
|
62
|
+
"webpack": "^5.99.9",
|
|
63
|
+
"webpack-cli": "^6.0.1",
|
|
64
|
+
"yargs": "18.0.0"
|
|
61
65
|
},
|
|
62
66
|
"dependencies": {
|
|
63
67
|
"@edsilv/http-status-codes": "^1.0.3",
|
|
64
|
-
"@iiif/vocabulary": "^1.0.
|
|
68
|
+
"@iiif/vocabulary": "^1.0.28",
|
|
65
69
|
"isomorphic-unfetch": "^3.0.0",
|
|
66
70
|
"lodash": "^4.17.21"
|
|
67
71
|
},
|
package/pkg-tests/node-umd.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// @todo works, but with these specific workarounds.
|
|
2
2
|
globalThis.window = globalThis.window || {};
|
|
3
3
|
globalThis.fetch = require('node-fetch');
|
|
4
|
+
if (typeof self === 'undefined') {
|
|
5
|
+
global.self = global;
|
|
6
|
+
}
|
|
4
7
|
|
|
5
8
|
const Manifesto = require('../dist-umd/manifesto');
|
|
6
9
|
|
|
@@ -61,7 +61,8 @@ module.exports = {
|
|
|
61
61
|
"riksmuseumimageapiv3thumbnails": "http://localhost:3001/riksmuseum-image-api-v3-thumbnails.json",
|
|
62
62
|
//"query-bodleian": "http://iiif.bodleian.ox.ac.uk/iiif/manifest/f22e9dae-c070-48eb-be0b-aa6c5bc195a6.json",
|
|
63
63
|
//"query-gams": "http://gams.uni-graz.at/cocoon/mets2json?source=http%3A%2F%2Fgams.uni-graz.at%2Farchive%2Fget%2Fo%3Asrbas.1535%2FMETS_SOURCE",
|
|
64
|
-
"v3ProviderNoLogo": "http://localhost:3001/YaleCanterburyTalesV3ProviderNoLogo.json"
|
|
64
|
+
"v3ProviderNoLogo": "http://localhost:3001/YaleCanterburyTalesV3ProviderNoLogo.json",
|
|
65
|
+
"pres3AnnotationsEmbedded": "http://localhost:3001/pres3-annotations-embedded.json"
|
|
65
66
|
};
|
|
66
67
|
|
|
67
68
|
//BBoM: http://wellcomelibrary.org/iiif/b18031511/manifest
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": "http://iiif.io/api/presentation/3/context.json",
|
|
3
|
+
"id": "https://iiif.io/api/cookbook/recipe/0266-full-canvas-annotation/manifest.json",
|
|
4
|
+
"type": "Manifest",
|
|
5
|
+
"label": {
|
|
6
|
+
"en": [
|
|
7
|
+
"Picture of Göttingen taken during the 2019 IIIF Conference"
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"items": [
|
|
11
|
+
{
|
|
12
|
+
"id": "https://iiif.io/api/cookbook/recipe/0266-full-canvas-annotation/canvas-1",
|
|
13
|
+
"type": "Canvas",
|
|
14
|
+
"height": 3024,
|
|
15
|
+
"width": 4032,
|
|
16
|
+
"items": [
|
|
17
|
+
{
|
|
18
|
+
"id": "https://iiif.io/api/cookbook/recipe/0266-full-canvas-annotation/canvas-1/annopage-1",
|
|
19
|
+
"type": "AnnotationPage",
|
|
20
|
+
"items": [
|
|
21
|
+
{
|
|
22
|
+
"id": "https://iiif.io/api/cookbook/recipe/0266-full-canvas-annotation/canvas-1/annopage-1/anno-1",
|
|
23
|
+
"type": "Annotation",
|
|
24
|
+
"motivation": "painting",
|
|
25
|
+
"body": {
|
|
26
|
+
"id": "https://iiif.io/api/image/3.0/example/reference/918ecd18c2592080851777620de9bcb5-gottingen/full/max/0/default.jpg",
|
|
27
|
+
"type": "Image",
|
|
28
|
+
"format": "image/jpeg",
|
|
29
|
+
"height": 3024,
|
|
30
|
+
"width": 4032,
|
|
31
|
+
"service": [
|
|
32
|
+
{
|
|
33
|
+
"id": "https://iiif.io/api/image/3.0/example/reference/918ecd18c2592080851777620de9bcb5-gottingen",
|
|
34
|
+
"profile": "level1",
|
|
35
|
+
"type": "ImageService3"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"target": "https://iiif.io/api/cookbook/recipe/0266-full-canvas-annotation/canvas-1"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"annotations": [
|
|
45
|
+
{
|
|
46
|
+
"id": "https://iiif.io/api/cookbook/recipe/0266-full-canvas-annotation/canvas-1/annopage-2",
|
|
47
|
+
"type": "AnnotationPage",
|
|
48
|
+
"items": [
|
|
49
|
+
{
|
|
50
|
+
"id": "https://iiif.io/api/cookbook/recipe/0266-full-canvas-annotation/canvas-1/annopage-2/anno-1",
|
|
51
|
+
"type": "Annotation",
|
|
52
|
+
"motivation": "commenting",
|
|
53
|
+
"body": {
|
|
54
|
+
"type": "TextualBody",
|
|
55
|
+
"language": "de",
|
|
56
|
+
"format": "text/plain",
|
|
57
|
+
"value": "Göttinger Marktplatz mit Gänseliesel Brunnen"
|
|
58
|
+
},
|
|
59
|
+
"target": "https://iiif.io/api/cookbook/recipe/0266-full-canvas-annotation/canvas-1"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
package/test/index.js
CHANGED
|
@@ -94,3 +94,4 @@ importTest('translations', './tests/translations');
|
|
|
94
94
|
importTest('witnesstopeter', './tests/witnesstopeter');
|
|
95
95
|
importTest('Utils', './tests/Utils.test');
|
|
96
96
|
importTest('v3ProviderNoLogo', './tests/v3ProviderNoLogo');
|
|
97
|
+
importTest('pres3AnnotationsEmbedded', './tests/pres3-annotations-embedded');
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var expect = require('chai').expect;
|
|
2
|
+
var should = require('chai').should();
|
|
3
|
+
var manifesto = require('../../dist-commonjs/');
|
|
4
|
+
var manifests = require('../fixtures/manifests');
|
|
5
|
+
var manifest, canvas, annotationPages, annotations, annotation, body
|
|
6
|
+
|
|
7
|
+
describe('#getAnnotations', function() {
|
|
8
|
+
it('manifest loads successfully', function (done) {
|
|
9
|
+
manifesto.loadManifest(manifests.pres3AnnotationsEmbedded).then(function(data) {
|
|
10
|
+
manifest = manifesto.parseManifest(data);
|
|
11
|
+
done();
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('has a sequence', function() {
|
|
16
|
+
sequence = manifest.getSequenceByIndex(0);
|
|
17
|
+
expect(sequence).to.exist;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('has a canvas', function() {
|
|
21
|
+
canvas = sequence.getCanvases()[0];
|
|
22
|
+
expect(canvas).to.exist;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('has annotation pages', function () {
|
|
26
|
+
annotationPages = canvas.getAnnotations();
|
|
27
|
+
expect(annotationPages).to.be.an('array');
|
|
28
|
+
expect(annotationPages).to.have.lengthOf(1);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('annotation page has correct id', function () {
|
|
32
|
+
expect(annotationPages[0].id).to.equal('https://iiif.io/api/cookbook/recipe/0266-full-canvas-annotation/canvas-1/annopage-2');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('annotation page contains annotations', function () {
|
|
36
|
+
annotations = annotationPages[0].getItems();
|
|
37
|
+
expect(annotations).to.be.an('array');
|
|
38
|
+
expect(annotations).to.have.lengthOf(1);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('annotation has commenting motivation', function () {
|
|
42
|
+
annotations = annotationPages[0].getItems();
|
|
43
|
+
annotation = new manifesto.Annotation(annotations[0]);
|
|
44
|
+
expect(annotation.getMotivation()).to.equal('commenting');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('annotation body has value', function () {
|
|
48
|
+
body = annotation.getBody()[0];
|
|
49
|
+
expect(body.getValue()).to.equal('Göttinger Marktplatz mit Gänseliesel Brunnen');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('annotation body has language', function () {
|
|
53
|
+
expect(body.getLanguage()).to.equal('de');
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ES5",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"experimentalDecorators": true,
|
|
8
|
+
"emitDecoratorMetadata": true,
|
|
9
|
+
"preserveConstEnums": true,
|
|
10
|
+
"stripInternal": true
|
|
11
|
+
},
|
|
12
|
+
"include": ["src/**/*"]
|
|
13
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -80,6 +80,8 @@ export declare class AnnotationBody extends ManifestResource {
|
|
|
80
80
|
constructor(jsonld?: any, options?: IManifestoOptions);
|
|
81
81
|
getFormat(): MediaType | null;
|
|
82
82
|
getType(): ExternalResourceType | null;
|
|
83
|
+
getValue(): string | null;
|
|
84
|
+
getLanguage(): string | null;
|
|
83
85
|
getWidth(): number;
|
|
84
86
|
getHeight(): number;
|
|
85
87
|
}
|
|
@@ -103,6 +105,7 @@ export declare class Canvas extends Resource {
|
|
|
103
105
|
getCanonicalImageUri(w?: number): string;
|
|
104
106
|
getMaxDimensions(): Size | null;
|
|
105
107
|
getContent(): Annotation[];
|
|
108
|
+
getAnnotations(): AnnotationPage[];
|
|
106
109
|
getDuration(): number | null;
|
|
107
110
|
getImages(): Annotation[];
|
|
108
111
|
getIndex(): number;
|
|
@@ -477,7 +480,7 @@ export declare class Utils {
|
|
|
477
480
|
* @example Utils.traverseAndFind({foo: 'bar'}, 'foo', 'bar')
|
|
478
481
|
*/
|
|
479
482
|
static traverseAndFind(object: any, k: string, v: string): object | undefined;
|
|
480
|
-
static getServices(resource: any, { onlyService, onlyServices, skipParentResources }?: {
|
|
483
|
+
static getServices(resource: any, { onlyService, onlyServices, skipParentResources, }?: {
|
|
481
484
|
onlyServices?: boolean;
|
|
482
485
|
skipParentResources?: boolean;
|
|
483
486
|
onlyService?: boolean;
|