react-iiif-vault 0.9.7 → 0.9.8

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/cjs/index.js CHANGED
@@ -874,7 +874,7 @@ function RenderImage({
874
874
  }, /* @__PURE__ */ React__default["default"].createElement(TileSet, {
875
875
  viewport: isStatic,
876
876
  tiles: {
877
- id: image.service.id,
877
+ id: image.service.id || image.service["@id"],
878
878
  height: image.height,
879
879
  width: image.width,
880
880
  imageService: image.service,
@@ -1298,6 +1298,9 @@ function getImageStrategy(canvas, paintables, loadImageService) {
1298
1298
  height: imageSelector.selector.spatial.height
1299
1299
  }
1300
1300
  } : defaultImageSelector;
1301
+ if (imageService && !imageService.id) {
1302
+ imageService.id = imageService["@id"];
1303
+ }
1301
1304
  const imageType = {
1302
1305
  id: resource.id,
1303
1306
  type: "Image",
@@ -1318,6 +1321,21 @@ function getImageStrategy(canvas, paintables, loadImageService) {
1318
1321
  };
1319
1322
  }
1320
1323
 
1324
+ const supportedFormats = ["model/gltf-binary"];
1325
+ function get3dStrategy(canvas, paintables) {
1326
+ const first = paintables.items[0];
1327
+ if (!first.format) {
1328
+ return unsupportedStrategy("Unknown format");
1329
+ }
1330
+ if (supportedFormats.indexOf(first.format) === -1) {
1331
+ return unsupportedStrategy(`3D format: ${first.format} is unsupported`);
1332
+ }
1333
+ return {
1334
+ type: "3d-model",
1335
+ model: first
1336
+ };
1337
+ }
1338
+
1321
1339
  var __defProp$1 = Object.defineProperty;
1322
1340
  var __defProps = Object.defineProperties;
1323
1341
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -1365,6 +1383,12 @@ function useRenderingStrategy(options) {
1365
1383
  }
1366
1384
  return getImageStrategy(canvas, paintables, loadImageService);
1367
1385
  }
1386
+ if (mainType === "Model") {
1387
+ if (supports.indexOf("3d-model") === -1) {
1388
+ return unsupportedStrategy("3D not supported");
1389
+ }
1390
+ return get3dStrategy(canvas, paintables);
1391
+ }
1368
1392
  if (mainType === "audio") {
1369
1393
  if (supports.indexOf("media") === -1) {
1370
1394
  return unsupportedStrategy("Media not supported");
@@ -866,7 +866,7 @@ function RenderImage({
866
866
  }, /* @__PURE__ */ React.createElement(TileSet, {
867
867
  viewport: isStatic,
868
868
  tiles: {
869
- id: image.service.id,
869
+ id: image.service.id || image.service["@id"],
870
870
  height: image.height,
871
871
  width: image.width,
872
872
  imageService: image.service,
@@ -1290,6 +1290,9 @@ function getImageStrategy(canvas, paintables, loadImageService) {
1290
1290
  height: imageSelector.selector.spatial.height
1291
1291
  }
1292
1292
  } : defaultImageSelector;
1293
+ if (imageService && !imageService.id) {
1294
+ imageService.id = imageService["@id"];
1295
+ }
1293
1296
  const imageType = {
1294
1297
  id: resource.id,
1295
1298
  type: "Image",
@@ -1310,6 +1313,21 @@ function getImageStrategy(canvas, paintables, loadImageService) {
1310
1313
  };
1311
1314
  }
1312
1315
 
1316
+ const supportedFormats = ["model/gltf-binary"];
1317
+ function get3dStrategy(canvas, paintables) {
1318
+ const first = paintables.items[0];
1319
+ if (!first.format) {
1320
+ return unsupportedStrategy("Unknown format");
1321
+ }
1322
+ if (supportedFormats.indexOf(first.format) === -1) {
1323
+ return unsupportedStrategy(`3D format: ${first.format} is unsupported`);
1324
+ }
1325
+ return {
1326
+ type: "3d-model",
1327
+ model: first
1328
+ };
1329
+ }
1330
+
1313
1331
  var __defProp$1 = Object.defineProperty;
1314
1332
  var __defProps = Object.defineProperties;
1315
1333
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -1357,6 +1375,12 @@ function useRenderingStrategy(options) {
1357
1375
  }
1358
1376
  return getImageStrategy(canvas, paintables, loadImageService);
1359
1377
  }
1378
+ if (mainType === "Model") {
1379
+ if (supports.indexOf("3d-model") === -1) {
1380
+ return unsupportedStrategy("3D not supported");
1381
+ }
1382
+ return get3dStrategy(canvas, paintables);
1383
+ }
1360
1384
  if (mainType === "audio") {
1361
1385
  if (supports.indexOf("media") === -1) {
1362
1386
  return unsupportedStrategy("Media not supported");
package/dist/index.d.ts CHANGED
@@ -2,9 +2,10 @@ import * as _atlas_viewer_atlas from '@atlas-viewer/atlas';
2
2
  import * as React from 'react';
3
3
  import React__default, { ReactNode, FC } from 'react';
4
4
  import * as _iiif_presentation_3 from '@iiif/presentation-3';
5
- import { InternationalString, ImageService, AnnotationPageNormalized, ContentResource, IIIFExternalWebResource, SpecificResource, AnnotationNormalized, CanvasNormalized, CollectionNormalized, Reference, ManifestNormalized, RangeNormalized, SearchService, Annotation, ExternalWebResource, W3CAnnotationTarget, Selector } from '@iiif/presentation-3';
5
+ import { InternationalString, ImageService, AnnotationPageNormalized, ContentResource, IIIFExternalWebResource, SpecificResource, AnnotationNormalized, CanvasNormalized, CollectionNormalized, Reference, ManifestNormalized, RangeNormalized, SearchService, Annotation, ExternalWebResource as ExternalWebResource$1, W3CAnnotationTarget, Selector } from '@iiif/presentation-3';
6
6
  import { AtlasProps } from '@atlas-viewer/atlas/dist/types/modules/react-reconciler/Atlas';
7
7
  import { Vault, VaultOptions, ReduxStore, NormalizedEntity, IIIFStore } from '@iiif/vault';
8
+ import { ExternalWebResource } from '@iiif/presentation-3/resources/annotation';
8
9
  import { ImageCandidate, ImageServiceLoader, ImageCandidateRequest } from '@atlas-viewer/iiif-image-api';
9
10
  import * as _iiif_vault__ from '@iiif/vault/*';
10
11
  import * as _iiif_vault_helpers from '@iiif/vault-helpers';
@@ -162,6 +163,13 @@ declare type SingleImageStrategy = {
162
163
  };
163
164
  declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): RenderingStrategy;
164
165
 
166
+ declare type Single3DModelStrategy = {
167
+ type: '3d-model';
168
+ model: ExternalWebResource;
169
+ choice?: ChoiceDescription;
170
+ annotations?: AnnotationPageDescription;
171
+ };
172
+
165
173
  declare type MediaStrategy = {
166
174
  type: 'media';
167
175
  media: SingleAudio | SingleVideo | AudioSequence | VideoSequence;
@@ -179,7 +187,7 @@ declare type UnknownStrategy = {
179
187
  reason?: string;
180
188
  annotations?: AnnotationPageDescription;
181
189
  };
182
- declare type RenderingStrategy = SingleImageStrategy | MediaStrategy | ComplexTimelineStrategy | UnknownStrategy;
190
+ declare type RenderingStrategy = SingleImageStrategy | MediaStrategy | ComplexTimelineStrategy | Single3DModelStrategy | UnknownStrategy;
183
191
 
184
192
  declare type StrategyActions = {
185
193
  makeChoice: (id: string, options?: {
@@ -488,7 +496,7 @@ declare function VirtualAnnotationProvider({ children }: {
488
496
 
489
497
  declare type SupportedTarget = {
490
498
  type: 'SpecificResource';
491
- source: ExternalWebResource | {
499
+ source: ExternalWebResource$1 | {
492
500
  id: string;
493
501
  type: 'Unknown' | 'Canvas' | 'Range' | 'Manifest';
494
502
  partOf?: Array<{
package/dist/index.umd.js CHANGED
@@ -30103,7 +30103,7 @@
30103
30103
  }, /* @__PURE__ */ React__default["default"].createElement(TileSet, {
30104
30104
  viewport: isStatic,
30105
30105
  tiles: {
30106
- id: image.service.id,
30106
+ id: image.service.id || image.service["@id"],
30107
30107
  height: image.height,
30108
30108
  width: image.width,
30109
30109
  imageService: image.service,
@@ -30527,6 +30527,9 @@
30527
30527
  height: imageSelector.selector.spatial.height
30528
30528
  }
30529
30529
  } : defaultImageSelector;
30530
+ if (imageService && !imageService.id) {
30531
+ imageService.id = imageService["@id"];
30532
+ }
30530
30533
  const imageType = {
30531
30534
  id: resource.id,
30532
30535
  type: "Image",
@@ -30547,6 +30550,21 @@
30547
30550
  };
30548
30551
  }
30549
30552
 
30553
+ const supportedFormats = ["model/gltf-binary"];
30554
+ function get3dStrategy(canvas, paintables) {
30555
+ const first = paintables.items[0];
30556
+ if (!first.format) {
30557
+ return unsupportedStrategy("Unknown format");
30558
+ }
30559
+ if (supportedFormats.indexOf(first.format) === -1) {
30560
+ return unsupportedStrategy(`3D format: ${first.format} is unsupported`);
30561
+ }
30562
+ return {
30563
+ type: "3d-model",
30564
+ model: first
30565
+ };
30566
+ }
30567
+
30550
30568
  var __defProp$1 = Object.defineProperty;
30551
30569
  var __defProps = Object.defineProperties;
30552
30570
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -30594,6 +30612,12 @@
30594
30612
  }
30595
30613
  return getImageStrategy(canvas, paintables, loadImageService);
30596
30614
  }
30615
+ if (mainType === "Model") {
30616
+ if (supports.indexOf("3d-model") === -1) {
30617
+ return unsupportedStrategy("3D not supported");
30618
+ }
30619
+ return get3dStrategy(canvas, paintables);
30620
+ }
30597
30621
  if (mainType === "audio") {
30598
30622
  if (supports.indexOf("media") === -1) {
30599
30623
  return unsupportedStrategy("Media not supported");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-iiif-vault",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
4
4
  "main": "./dist/cjs/index.js",
5
5
  "module": "./dist/esm/index.mjs",
6
6
  "types": "./dist/index.d.ts",