@ikaros-arch/react-3dhop-iiif 0.2.0 → 0.3.1

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.d.mts CHANGED
@@ -168,6 +168,12 @@ type IIIFCollectionItem = {
168
168
  label?: LocalizableValue;
169
169
  summary?: LocalizableValue;
170
170
  thumbnail?: IIIFThumbnail | IIIFThumbnail[];
171
+ /**
172
+ * The IIIF Cookbook's "Simple Collection" recipe names "minimal metadata" as a property a
173
+ * Manifest reference may carry for presentation, alongside `thumbnail`, so clients can list and
174
+ * filter without dereferencing every Manifest: https://iiif.io/api/cookbook/recipe/0032-collection/
175
+ */
176
+ metadata?: IIIFMetadataEntry[];
171
177
  };
172
178
  type IIIFCollection = {
173
179
  id?: string;
@@ -182,6 +188,11 @@ type ParsedCollectionItem = {
182
188
  summary?: string;
183
189
  /** URL of the first thumbnail image, when the item has one. */
184
190
  thumbnail?: string;
191
+ /** The item's own `metadata` entries, resolved into the active language. Empty when absent. */
192
+ fields: Array<{
193
+ label: string;
194
+ value: string;
195
+ }>;
185
196
  };
186
197
  type ParsedCollection = {
187
198
  collection: IIIFCollection;
package/dist/index.d.ts CHANGED
@@ -168,6 +168,12 @@ type IIIFCollectionItem = {
168
168
  label?: LocalizableValue;
169
169
  summary?: LocalizableValue;
170
170
  thumbnail?: IIIFThumbnail | IIIFThumbnail[];
171
+ /**
172
+ * The IIIF Cookbook's "Simple Collection" recipe names "minimal metadata" as a property a
173
+ * Manifest reference may carry for presentation, alongside `thumbnail`, so clients can list and
174
+ * filter without dereferencing every Manifest: https://iiif.io/api/cookbook/recipe/0032-collection/
175
+ */
176
+ metadata?: IIIFMetadataEntry[];
171
177
  };
172
178
  type IIIFCollection = {
173
179
  id?: string;
@@ -182,6 +188,11 @@ type ParsedCollectionItem = {
182
188
  summary?: string;
183
189
  /** URL of the first thumbnail image, when the item has one. */
184
190
  thumbnail?: string;
191
+ /** The item's own `metadata` entries, resolved into the active language. Empty when absent. */
192
+ fields: Array<{
193
+ label: string;
194
+ value: string;
195
+ }>;
185
196
  };
186
197
  type ParsedCollection = {
187
198
  collection: IIIFCollection;
package/dist/index.js CHANGED
@@ -904,6 +904,7 @@ var IIIFViewer = ({
904
904
  space,
905
905
  config,
906
906
  trackball,
907
+ toolbar: toolbarProp,
907
908
  children,
908
909
  ...viewerProps
909
910
  }) => {
@@ -984,6 +985,8 @@ var IIIFViewer = ({
984
985
  if (!scene || !localized) {
985
986
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: loadingFallback });
986
987
  }
988
+ const { toolbar: extractedToolbar, rest } = (0, import_react_3dhop2.extractToolbar)(children);
989
+ const toolbar = toolbarProp ?? extractedToolbar;
987
990
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
988
991
  import_react_3dhop2.ThreeDHopViewer,
989
992
  {
@@ -993,6 +996,7 @@ var IIIFViewer = ({
993
996
  config: scene.config,
994
997
  trackball: scene.trackball,
995
998
  measurementUnits: viewerProps.measurementUnits ?? scene.displayUnit,
999
+ toolbar,
996
1000
  children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
997
1001
  IIIFProvider,
998
1002
  {
@@ -1005,7 +1009,7 @@ var IIIFViewer = ({
1005
1009
  setLanguage,
1006
1010
  children: [
1007
1011
  applyInitialCamera && localized.cameras.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(InitialCamera, {}) : null,
1008
- children
1012
+ rest
1009
1013
  ]
1010
1014
  }
1011
1015
  )
@@ -1303,6 +1307,7 @@ var IIIFMultiManifestViewer = ({
1303
1307
  space,
1304
1308
  config,
1305
1309
  trackball,
1310
+ toolbar: toolbarProp,
1306
1311
  children,
1307
1312
  ...viewerProps
1308
1313
  }) => {
@@ -1385,6 +1390,8 @@ var IIIFMultiManifestViewer = ({
1385
1390
  if (!scene) {
1386
1391
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: loadingFallback });
1387
1392
  }
1393
+ const { toolbar: extractedToolbar, rest } = (0, import_react_3dhop4.extractToolbar)(children);
1394
+ const toolbar = toolbarProp ?? extractedToolbar;
1388
1395
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1389
1396
  import_react_3dhop4.ThreeDHopViewer,
1390
1397
  {
@@ -1394,7 +1401,8 @@ var IIIFMultiManifestViewer = ({
1394
1401
  config: scene.config,
1395
1402
  trackball: scene.trackball,
1396
1403
  measurementUnits: viewerProps.measurementUnits ?? scene.displayUnit,
1397
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IIIFMultiManifestProvider, { status, error, diagnostics, scene, children })
1404
+ toolbar,
1405
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IIIFMultiManifestProvider, { status, error, diagnostics, scene, children: rest })
1398
1406
  }
1399
1407
  );
1400
1408
  };
@@ -1427,11 +1435,16 @@ function parseCollection(collection, options = {}) {
1427
1435
  onDiagnostic?.({ level: "warning", message: "Collection item has no id; skipping." });
1428
1436
  return;
1429
1437
  }
1438
+ const fields = (item.metadata ?? []).map((entry) => ({
1439
+ label: resolve(entry.label),
1440
+ value: resolve(entry.value)
1441
+ }));
1430
1442
  items.push({
1431
1443
  id: item.id,
1432
1444
  label: resolve(item.label) || item.id,
1433
1445
  summary: resolve(item.summary) || void 0,
1434
- thumbnail: firstThumbnail(item)
1446
+ thumbnail: firstThumbnail(item),
1447
+ fields
1435
1448
  });
1436
1449
  });
1437
1450
  return {