cozy-iiif 0.1.1 → 0.1.3

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/dist/index.js CHANGED
@@ -552,7 +552,7 @@ var G = class z {
552
552
  }
553
553
  }
554
554
  };
555
- const K = (t) => p(t, "type").startsWith("ImageService"), Q = (t) => {
555
+ const K = (t) => p(t, "type").startsWith("ImageService") || t.profile && t.profile.toString().includes("iiif.io/api/image/"), Q = (t) => {
556
556
  const e = p(t, "type"), r = p(t, "context");
557
557
  if (e === "ImageService2" || r != null && r.includes("image/2")) {
558
558
  const i = t, s = ["level0", "level1", "level2"];
@@ -627,7 +627,7 @@ const K = (t) => p(t, "type").startsWith("ImageService"), Q = (t) => {
627
627
  const e = [];
628
628
  return new G({
629
629
  annotation: [(i) => {
630
- if (i.motivation === "painting") {
630
+ if (i.motivation === "painting" || !i.motivation) {
631
631
  const n = (i.body ? Array.isArray(i.body) ? i.body : [i.body] : []).filter((a) => a.type === "Image");
632
632
  e.push(...n.map((a) => It(a)));
633
633
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-iiif",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "A developer-friendly collection of abstractions and utilities built on top of @iiif/presentation-3 and @iiif/parser",
5
5
  "license": "MIT",
6
6
  "author": "Rainer Simon",
@@ -26,8 +26,8 @@
26
26
  "./level-0": "./dist/level-0/index.js"
27
27
  },
28
28
  "devDependencies": {
29
- "vite": "^6.1.0",
30
- "vite-plugin-dts": "^4.5.0"
29
+ "vite": "^6.2.2",
30
+ "vite-plugin-dts": "^4.5.3"
31
31
  },
32
32
  "dependencies": {
33
33
  "@iiif/parser": "^2.1.7",
@@ -54,6 +54,7 @@ const toCozyImageResource = (resource: IIIFExternalWebResource) => {
54
54
  const imageService = (resource.service || []).find(isImageService);
55
55
 
56
56
  const service = imageService ? parseImageService(imageService) : undefined;
57
+
57
58
  if (service) {
58
59
  const image = {
59
60
  source: resource,
@@ -90,7 +91,7 @@ export const getImages = (canvas: Canvas): CozyImageResource[] => {
90
91
 
91
92
  const builder = new Traverse({
92
93
  annotation: [anno => {
93
- if (anno.motivation === 'painting') {
94
+ if (anno.motivation === 'painting' || !anno.motivation) {
94
95
  const bodies = anno.body ?
95
96
  Array.isArray(anno.body) ? anno.body : [anno.body]
96
97
  : [];
@@ -6,7 +6,10 @@ type ImageService = ImageService2 | ImageService3;
6
6
 
7
7
  export const isImageService = (data: any): data is ImageService => {
8
8
  const t = getPropertyValue<string>(data, 'type');
9
- return t.startsWith('ImageService');
9
+
10
+ return t.startsWith('ImageService') || (
11
+ data.profile && data.profile.toString().includes('iiif.io/api/image/')
12
+ );
10
13
  }
11
14
 
12
15
  export const parseImageService = (service: Service) => {