react-iiif-vault 2.0.19 → 4.0.0

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.
Files changed (67) hide show
  1. package/README.md +77 -1
  2. package/dist/Image-CXsx26cA.d.ts +45 -0
  3. package/dist/Image-g-DyBvi0.d.cts +45 -0
  4. package/dist/ImageStrategy-BHLIi5gd.d.ts +55 -0
  5. package/dist/ImageStrategy-Be9YES5a.d.cts +55 -0
  6. package/dist/SimpleViewerContext.hooks-CTgfe0Gg.d.cts +617 -0
  7. package/dist/SimpleViewerContext.hooks-DYJSrd-U.d.ts +617 -0
  8. package/dist/SimpleViewerContext.types-CWf5OFM7.d.ts +51 -0
  9. package/dist/SimpleViewerContext.types-Df-cpBss.d.cts +51 -0
  10. package/dist/ViewerPresetContext-D7N6KH9p.d.ts +144 -0
  11. package/dist/ViewerPresetContext-DwFTIkDx.d.cts +144 -0
  12. package/dist/bundle.d.ts +290 -196
  13. package/dist/bundle.global.js +45 -74
  14. package/dist/canvas-panel/scene.cjs +1 -0
  15. package/dist/canvas-panel/scene.d.cts +133 -0
  16. package/dist/canvas-panel/scene.d.ts +133 -0
  17. package/dist/canvas-panel/scene.js +1 -0
  18. package/dist/canvas-panel.cjs +1 -47
  19. package/dist/canvas-panel.d.cts +10 -5
  20. package/dist/canvas-panel.d.ts +10 -5
  21. package/dist/canvas-panel.js +1 -1
  22. package/dist/chunk-3XPYQXUE.js +48 -0
  23. package/dist/chunk-6WG6RPHU.js +1 -0
  24. package/dist/chunk-DXC5VCRN.js +1 -0
  25. package/dist/chunk-DZ7DMQ3V.cjs +1 -0
  26. package/dist/chunk-HFC72RK6.js +1 -0
  27. package/dist/chunk-L2GTJVPY.js +1 -0
  28. package/dist/chunk-L576POBV.cjs +2 -0
  29. package/dist/chunk-LKWFF45D.cjs +1 -0
  30. package/dist/chunk-MEQI335A.js +2 -0
  31. package/dist/chunk-MIANDAMK.cjs +1 -0
  32. package/dist/chunk-ND2R7OTX.js +1 -0
  33. package/dist/chunk-R7HZTE2T.cjs +48 -0
  34. package/dist/chunk-WBVFSMED.cjs +1 -0
  35. package/dist/chunk-XULFR6E3.cjs +1 -0
  36. package/dist/chunk-YEU5T67O.js +1 -0
  37. package/dist/chunk-ZBGD3VEW.cjs +1 -0
  38. package/dist/chunk-ZEGT4BAR.cjs +1 -0
  39. package/dist/core.cjs +1 -0
  40. package/dist/core.d.cts +133 -0
  41. package/dist/core.d.ts +133 -0
  42. package/dist/core.js +1 -0
  43. package/dist/{index-DijgVxjb.d.ts → index-ClFUurPI.d.ts} +15 -69
  44. package/dist/{index-DHghDluJ.d.cts → index-QFlDahI_.d.cts} +15 -69
  45. package/dist/index.cjs +1 -49
  46. package/dist/index.d.cts +33 -1496
  47. package/dist/index.d.ts +33 -1496
  48. package/dist/index.js +1 -1
  49. package/dist/presentation-4.cjs +1 -0
  50. package/dist/presentation-4.d.cts +304 -0
  51. package/dist/presentation-4.d.ts +304 -0
  52. package/dist/presentation-4.js +1 -0
  53. package/dist/ranges-Cc2ppjFD.d.ts +689 -0
  54. package/dist/ranges-D-UBNcsJ.d.cts +689 -0
  55. package/dist/{useRenderingStrategy-CoKE915F.d.cts → useRenderingStrategy-Vubk-vUU.d.cts} +47 -24
  56. package/dist/{useRenderingStrategy-CoKE915F.d.ts → useRenderingStrategy-Vubk-vUU.d.ts} +47 -24
  57. package/dist/utils-DHWZGbVU.d.ts +54 -0
  58. package/dist/utils-De5WTLDh.d.cts +54 -0
  59. package/dist/utils.cjs +1 -1
  60. package/dist/utils.d.cts +7 -5
  61. package/dist/utils.d.ts +7 -5
  62. package/dist/utils.js +1 -1
  63. package/package.json +54 -15
  64. package/dist/chunk-OGCPXOIP.js +0 -49
  65. package/dist/chunk-P7XHGETS.js +0 -1
  66. package/dist/utils-BKdiug6F.d.cts +0 -41
  67. package/dist/utils-CmwQWQLa.d.ts +0 -41
package/README.md CHANGED
@@ -528,4 +528,80 @@ Would be transformed to:
528
528
  ]
529
529
  ```
530
530
 
531
- So the metadata that wasn't configured is skipped, values mapped and combined.
531
+ So the metadata that wasn't configured is skipped, values mapped and combined.
532
+ ## Presentation 3 and Presentation 4 compatibility
533
+
534
+ The root entry point keeps Presentation 3 types and defaults to the Presentation 3
535
+ `Vault` from `@iiif/helpers/vault` (not the old `@iiif/vault` package):
536
+
537
+ ```tsx
538
+ import { Vault, VaultProvider } from 'react-iiif-vault';
539
+
540
+ const vault = new Vault();
541
+
542
+ <VaultProvider vault={vault}>
543
+ <ExistingViewer />
544
+ </VaultProvider>;
545
+ ```
546
+
547
+ Use the explicit entry point for native Presentation 4 resources and hook types:
548
+
549
+ ```tsx
550
+ import { Vault, VaultProvider, useManifest } from 'react-iiif-vault/presentation-4';
551
+
552
+ const vault = new Vault(); // Vault4; also exported under its own name.
553
+
554
+ function ManifestLabel() {
555
+ const manifest = useManifest(); // Presentation 4 ManifestNormalized | undefined
556
+ return <pre>{JSON.stringify(manifest?.label)}</pre>;
557
+ }
558
+
559
+ // Load the resource before selecting it, or use useExternalManifest to load it.
560
+ await vault.loadManifest(manifestId);
561
+
562
+ <VaultProvider vault={vault} resources={{ manifest: manifestId }}>
563
+ <ManifestLabel />
564
+ </VaultProvider>;
565
+ ```
566
+
567
+ The shared root provider accepts either vault and retains `version={4}`. Changing
568
+ that prop **does not change the TypeScript types of root-imported hooks**. Choose
569
+ `/presentation-4`, or bind the low-level hooks with `createVaultHooks(4)`.
570
+ `createVaultHooks()` and `createVaultHooks(3)` bind Presentation 3. Bound hooks reject
571
+ an incompatible provider. Separate providers can host both versions in one app;
572
+ providers and hooks from different entry points share context within each output
573
+ format. Avoid mixing CommonJS and ESM copies in the same component tree.
574
+
575
+ Existing CanvasPanel image, text, audio/video, and Timeline paths are retained.
576
+ Native v4 Canvas backgrounds, Canvas placeholders/accompanying containers, and
577
+ Timeline sequencing are supported. Scene resources can be loaded and inspected,
578
+ but Scene rendering is unsupported and follows the existing unknown/empty fallback.
579
+ This branch adds no ScenePanel, 3D renderer, waveform feature, or 3D dependencies.
580
+ Rendering descriptions carry annotations from either normalized model; use the
581
+ versioned resource hooks when a specific normalized resource type is required.
582
+
583
+ Existing hook and component names remain exported. Migration is additive:
584
+
585
+ | Existing API | Preferred API | Compatibility |
586
+ | --- | --- | --- |
587
+ | `useExternalCollection().manifest` | `.collection` | Deprecated alias; both properties reference the same resource at the root |
588
+ | `useCanvasSequence(options)` | `useContainerSequence(options)` | Deprecated name retained; root keeps P3 Canvas item types, `/presentation-4` includes Timeline items |
589
+ | `seraliseSupportedSelector` | `serialiseSupportedSelector` | Deprecated spelling remains an alias of the same function |
590
+ | `ImageService`, `ResourceProvider` | Same names | Still React components; IIIF data types use `IIIFImageService` and `IIIFResourceProvider` |
591
+ | `PointSelector`, `SvgSelector` at the root | Same names | Still the existing helper selector types |
592
+
593
+ The Presentation 4 collection hook uses `collection`. Unchanged hooks are not
594
+ deprecated simply because this is a major release. Shared rendering descriptions
595
+ and viewer context items can contain either model (including Timeline references);
596
+ code inspecting those types must narrow them. Errors from external loading are now
597
+ `Error | undefined`, rather than untyped values.
598
+
599
+ The supported runtime is React / React DOM **19.2+**, Atlas **3.2.1+ in 3.x**,
600
+ and `react-reconciler ~0.33.0` (a direct dependency). Main's workspace already used
601
+ this stack through overrides. Its advertised React 18 combination failed packed
602
+ imports with both Atlas 3.1.0 and 3.2.1, so this branch does not advertise it.
603
+ Restoring React 18 requires an upstream Atlas compatibility fix and consumer tests.
604
+
605
+ For the UMD bundle, provide matching `React`, `ReactDOM`, and `ReactReconciler`
606
+ globals. The package keeps its root, `/canvas-panel`, and `/utils` ESM/CommonJS
607
+ exports and adds `/presentation-4` with declarations in both formats.
@@ -0,0 +1,45 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ImageCandidate, BoxSelector } from '@iiif/helpers';
3
+ import React__default, { ReactNode } from 'react';
4
+ import { I as ImageWithOptionalService } from './useRenderingStrategy-Vubk-vUU.js';
5
+ import { CompositeResourceProps } from '@atlas-viewer/atlas';
6
+
7
+ /** Shared image options. Hosts translate legacy skip/disable flags into enable flags. */
8
+ interface ImageOptions {
9
+ isStatic?: boolean;
10
+ enableSizes?: boolean;
11
+ enableThumbnail?: boolean;
12
+ /** Additional, already resolved image candidates (including virtual sizes). */
13
+ imageCandidates?: Array<{
14
+ id: string;
15
+ width: number;
16
+ height: number;
17
+ }>;
18
+ useFloorCalc?: boolean;
19
+ format?: string;
20
+ renderOptions?: CompositeResourceProps;
21
+ style?: {
22
+ opacity?: number;
23
+ [key: string]: unknown;
24
+ };
25
+ }
26
+
27
+ declare function ImageContent({ id, image, thumbnail, isStatic, x, y, children, selector, onClick, rotation: _rotation, enableSizes, enableAnnotations, events, ...options }: ImageOptions & {
28
+ events?: Record<string, unknown>;
29
+ id: string;
30
+ image: ImageWithOptionalService;
31
+ thumbnail?: ImageCandidate;
32
+ isStatic?: boolean;
33
+ enableSizes?: boolean;
34
+ enableAnnotations?: boolean;
35
+ selector?: BoxSelector;
36
+ x?: number;
37
+ y?: number;
38
+ children?: ReactNode;
39
+ onClick?: (e: any) => void;
40
+ rotation?: number;
41
+ }): react_jsx_runtime.JSX.Element;
42
+ type RenderImageProps = React__default.ComponentProps<typeof ImageContent>;
43
+ declare function RenderImage(props: RenderImageProps): react_jsx_runtime.JSX.Element;
44
+
45
+ export { type ImageOptions as I, RenderImage as R };
@@ -0,0 +1,45 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ImageCandidate, BoxSelector } from '@iiif/helpers';
3
+ import React__default, { ReactNode } from 'react';
4
+ import { I as ImageWithOptionalService } from './useRenderingStrategy-Vubk-vUU.cjs';
5
+ import { CompositeResourceProps } from '@atlas-viewer/atlas';
6
+
7
+ /** Shared image options. Hosts translate legacy skip/disable flags into enable flags. */
8
+ interface ImageOptions {
9
+ isStatic?: boolean;
10
+ enableSizes?: boolean;
11
+ enableThumbnail?: boolean;
12
+ /** Additional, already resolved image candidates (including virtual sizes). */
13
+ imageCandidates?: Array<{
14
+ id: string;
15
+ width: number;
16
+ height: number;
17
+ }>;
18
+ useFloorCalc?: boolean;
19
+ format?: string;
20
+ renderOptions?: CompositeResourceProps;
21
+ style?: {
22
+ opacity?: number;
23
+ [key: string]: unknown;
24
+ };
25
+ }
26
+
27
+ declare function ImageContent({ id, image, thumbnail, isStatic, x, y, children, selector, onClick, rotation: _rotation, enableSizes, enableAnnotations, events, ...options }: ImageOptions & {
28
+ events?: Record<string, unknown>;
29
+ id: string;
30
+ image: ImageWithOptionalService;
31
+ thumbnail?: ImageCandidate;
32
+ isStatic?: boolean;
33
+ enableSizes?: boolean;
34
+ enableAnnotations?: boolean;
35
+ selector?: BoxSelector;
36
+ x?: number;
37
+ y?: number;
38
+ children?: ReactNode;
39
+ onClick?: (e: any) => void;
40
+ rotation?: number;
41
+ }): react_jsx_runtime.JSX.Element;
42
+ type RenderImageProps = React__default.ComponentProps<typeof ImageContent>;
43
+ declare function RenderImage(props: RenderImageProps): react_jsx_runtime.JSX.Element;
44
+
45
+ export { type ImageOptions as I, RenderImage as R };
@@ -0,0 +1,55 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import { o as UseRenderingStrategyOptions, R as RenderingStrategy, l as StrategyActions, M as MediaStrategy, a as SingleImageStrategy, E as EmptyStrategy, C as ComplexTimelineStrategy, I as ImageWithOptionalService } from './useRenderingStrategy-Vubk-vUU.js';
4
+ import { ChoiceDescription } from '@iiif/helpers';
5
+ import { I as ImageOptions } from './Image-CXsx26cA.js';
6
+
7
+ interface CanvasStrategyProviderProps {
8
+ /** Keep default-choice opacity local instead of writing shared Vault metadata. */
9
+ scopedStyles?: boolean;
10
+ emitter?: UseRenderingStrategyOptions["emitter"];
11
+ annotationPageManagerId?: string;
12
+ onChoiceChange?: (choice?: ChoiceDescription) => void;
13
+ strategies?: Array<RenderingStrategy['type']>;
14
+ registerActions?: (actions: StrategyActions) => void;
15
+ defaultChoices?: Array<{
16
+ id: string;
17
+ opacity?: number;
18
+ }>;
19
+ children: ReactNode;
20
+ renderMediaControls?: (strategy: MediaStrategy) => ReactNode;
21
+ viewControlsDeps?: any[];
22
+ renderViewerControls?: (strategy: SingleImageStrategy | EmptyStrategy) => ReactNode;
23
+ renderComplexTimelineControls?: (strategy: ComplexTimelineStrategy) => ReactNode;
24
+ complexTimelineControlsDeps?: any[];
25
+ mediaControlsDeps?: any[];
26
+ throwOnUnknown?: boolean;
27
+ }
28
+ declare function CanvasStrategyProvider({ strategies, scopedStyles, emitter, annotationPageManagerId, registerActions, defaultChoices, onChoiceChange, mediaControlsDeps, renderMediaControls, renderViewerControls, viewControlsDeps, renderComplexTimelineControls, complexTimelineControlsDeps, throwOnUnknown, children, }: CanvasStrategyProviderProps): react_jsx_runtime.JSX.Element;
29
+
30
+ interface CanvasWorldObjectProps {
31
+ x?: number;
32
+ y?: number;
33
+ keepCanvasScale?: boolean;
34
+ children?: ReactNode;
35
+ events?: Record<string, unknown>;
36
+ onPositionChange?: (canvasId: string, position: {
37
+ x: number;
38
+ y: number;
39
+ width: number;
40
+ height: number;
41
+ } | null) => void;
42
+ }
43
+ declare function CanvasWorldObject({ x, y, keepCanvasScale, events, onPositionChange, children, }: CanvasWorldObjectProps): react_jsx_runtime.JSX.Element | null;
44
+
45
+ interface ImageStrategyProps extends ImageOptions {
46
+ isStatic?: boolean;
47
+ enableSizes?: boolean;
48
+ enableAnnotations?: boolean;
49
+ onClickPaintingAnnotation?: (id: string, image: ImageWithOptionalService, e: any) => void;
50
+ rotation?: number;
51
+ children?: ReactNode;
52
+ }
53
+ declare function RenderImageStrategy({ isStatic, enableSizes, enableAnnotations, onClickPaintingAnnotation, rotation, children, ...options }: ImageStrategyProps): react_jsx_runtime.JSX.Element | null;
54
+
55
+ export { type CanvasStrategyProviderProps as C, type ImageStrategyProps as I, RenderImageStrategy as R, CanvasStrategyProvider as a, type CanvasWorldObjectProps as b, CanvasWorldObject as c };
@@ -0,0 +1,55 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import { o as UseRenderingStrategyOptions, R as RenderingStrategy, l as StrategyActions, M as MediaStrategy, a as SingleImageStrategy, E as EmptyStrategy, C as ComplexTimelineStrategy, I as ImageWithOptionalService } from './useRenderingStrategy-Vubk-vUU.cjs';
4
+ import { ChoiceDescription } from '@iiif/helpers';
5
+ import { I as ImageOptions } from './Image-g-DyBvi0.cjs';
6
+
7
+ interface CanvasStrategyProviderProps {
8
+ /** Keep default-choice opacity local instead of writing shared Vault metadata. */
9
+ scopedStyles?: boolean;
10
+ emitter?: UseRenderingStrategyOptions["emitter"];
11
+ annotationPageManagerId?: string;
12
+ onChoiceChange?: (choice?: ChoiceDescription) => void;
13
+ strategies?: Array<RenderingStrategy['type']>;
14
+ registerActions?: (actions: StrategyActions) => void;
15
+ defaultChoices?: Array<{
16
+ id: string;
17
+ opacity?: number;
18
+ }>;
19
+ children: ReactNode;
20
+ renderMediaControls?: (strategy: MediaStrategy) => ReactNode;
21
+ viewControlsDeps?: any[];
22
+ renderViewerControls?: (strategy: SingleImageStrategy | EmptyStrategy) => ReactNode;
23
+ renderComplexTimelineControls?: (strategy: ComplexTimelineStrategy) => ReactNode;
24
+ complexTimelineControlsDeps?: any[];
25
+ mediaControlsDeps?: any[];
26
+ throwOnUnknown?: boolean;
27
+ }
28
+ declare function CanvasStrategyProvider({ strategies, scopedStyles, emitter, annotationPageManagerId, registerActions, defaultChoices, onChoiceChange, mediaControlsDeps, renderMediaControls, renderViewerControls, viewControlsDeps, renderComplexTimelineControls, complexTimelineControlsDeps, throwOnUnknown, children, }: CanvasStrategyProviderProps): react_jsx_runtime.JSX.Element;
29
+
30
+ interface CanvasWorldObjectProps {
31
+ x?: number;
32
+ y?: number;
33
+ keepCanvasScale?: boolean;
34
+ children?: ReactNode;
35
+ events?: Record<string, unknown>;
36
+ onPositionChange?: (canvasId: string, position: {
37
+ x: number;
38
+ y: number;
39
+ width: number;
40
+ height: number;
41
+ } | null) => void;
42
+ }
43
+ declare function CanvasWorldObject({ x, y, keepCanvasScale, events, onPositionChange, children, }: CanvasWorldObjectProps): react_jsx_runtime.JSX.Element | null;
44
+
45
+ interface ImageStrategyProps extends ImageOptions {
46
+ isStatic?: boolean;
47
+ enableSizes?: boolean;
48
+ enableAnnotations?: boolean;
49
+ onClickPaintingAnnotation?: (id: string, image: ImageWithOptionalService, e: any) => void;
50
+ rotation?: number;
51
+ children?: ReactNode;
52
+ }
53
+ declare function RenderImageStrategy({ isStatic, enableSizes, enableAnnotations, onClickPaintingAnnotation, rotation, children, ...options }: ImageStrategyProps): react_jsx_runtime.JSX.Element | null;
54
+
55
+ export { type CanvasStrategyProviderProps as C, type ImageStrategyProps as I, RenderImageStrategy as R, CanvasStrategyProvider as a, type CanvasWorldObjectProps as b, CanvasWorldObject as c };