@manifest-editor/creators 2.2.2-next.0.a82700e → 2.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manifest-editor/creators",
3
- "version": "2.2.2-next.0.a82700e",
3
+ "version": "2.3.0",
4
4
  "type": "module",
5
5
  "bugs": "https://github.com/digirati-co-uk/iiif-manifest-editor/issues",
6
6
  "repository": {
@@ -39,29 +39,31 @@
39
39
  "prepack": "tsdown src/index.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@atlas-viewer/atlas": "3.3.0",
43
- "@iiif/helpers": "4.0.0",
44
- "@iiif/parser": "4.0.1",
42
+ "@atlas-viewer/atlas": "3.3.6",
43
+ "@iiif/helpers": "4.0.5",
44
+ "@iiif/parser": "4.0.7",
45
45
  "@iiif/presentation-3": "^2.2.3",
46
46
  "@iiif/presentation-3-normalized": "^0.9.7",
47
- "@manifest-editor/components": "2.2.2-next.0.a82700e",
48
- "@manifest-editor/creator-api": "2.2.2-next.0.a82700e",
49
- "@manifest-editor/editor-api": "2.2.2-next.0.a82700e",
50
- "@manifest-editor/editors": "2.2.2-next.0.a82700e",
51
- "@manifest-editor/shell": "2.2.2-next.0.a82700e",
52
- "iiif-browser": "https://pkg.pr.new/digirati-co-uk/iiif-browser/iiif-browser@4934ee2",
47
+ "@manifest-editor/components": "2.3.0",
48
+ "@manifest-editor/creator-api": "2.3.0",
49
+ "@manifest-editor/editor-api": "2.3.0",
50
+ "@manifest-editor/editors": "2.3.0",
51
+ "@manifest-editor/i18n": "2.3.0",
52
+ "@manifest-editor/shell": "2.3.0",
53
+ "iiif-browser": "2.3.2",
53
54
  "react": "19.2.8",
54
55
  "react-dom": "19.2.8",
55
56
  "react-error-boundary": "^4.0.13",
56
- "react-iiif-vault": "4.0.0",
57
+ "react-iiif-vault": "4.1.0",
57
58
  "styled-components": "6.1.8"
58
59
  },
59
60
  "devDependencies": {
60
61
  "@atlas-viewer/iiif-image-api": "^2.2.0",
61
- "@manifest-editor/ui": "2.2.1",
62
+ "@manifest-editor/ui": "2.3.0",
62
63
  "@tsdown/css": "0.22.14",
63
64
  "@types/react": "19.2.18",
64
65
  "@types/react-dom": "19.2.4",
66
+ "jsdom": "26.1.0",
65
67
  "tiny-invariant": "^1.3.3",
66
68
  "tsdown": "0.22.14",
67
69
  "vitest": "4.1.10"
@@ -69,7 +71,7 @@
69
71
  "publishConfig": {
70
72
  "access": "public"
71
73
  },
72
- "gitHead": "a82700eb6b66d398882f7d40ad7603771edcabcf",
74
+ "gitHead": "34c06c440b1788a470f3da536169560ab1c0d3a3",
73
75
  "inlinedDependencies": {
74
76
  "@atlas-viewer/iiif-image-api": "2.2.0",
75
77
  "tiny-invariant": "1.3.3"
@@ -1,2 +0,0 @@
1
- const e=require("./iiif-browser-output-IFaBMvwa.cjs");let t=require("react"),n=require("react/jsx-runtime"),r=require("@manifest-editor/shell"),i=require("iiif-browser");function a(a){let o=(0,t.useMemo)(()=>a.options.initialData||{},[a.options.initialData]),s=(0,r.usePreviewVault)(),c=(0,t.useMemo)(()=>[{type:`callback`,label:`Select`,supportedTypes:[`Canvas`,`CanvasList`,`CanvasRegion`,`ImageService`,`ImageServiceRegion`],cb:e=>a.runCreate({output:e}),format:{type:`custom`,format:e.r}}],[a.runCreate]),l=(0,t.useMemo)(()=>({canCropImage:!0,canSelectCanvas:!0,canSelectManifest:!1,canSelectCollection:!1,multiSelect:!0,...o.iiifBrowserOptions?.navigation||{}}),[o]),u=(0,t.useMemo)(()=>({buttonClassName:`bg-me-primary-500 text-white hover:bg-me-primary-600`,homeLink:o.url||(typeof a.config?.defaultCollection==`string`?a.config.defaultCollection:void 0),...o.iiifBrowserOptions?.ui||{}}),[o,a.config]),d=(0,t.useMemo)(()=>{let e=o.iiifBrowserOptions?.history||{};return o.url?{...e,restoreFromLocalStorage:!1,saveToLocalStorage:!1,initialHistory:[{url:o.url,resource:null,route:`/loading?id=${encodeURIComponent(o.url)}`}]}:e},[o]);return(0,n.jsx)(r.PreviewVaultBoundary,{children:(0,n.jsx)(i.IIIFBrowser,{ui:u,vault:s,className:`iiif-browser border-none border-t rounded-none h-[70vh] min-h-[60vh] max-h-full max-w-full`,output:c,navigation:l,customPages:o.iiifBrowserOptions?.customPages||{},history:d})})}exports.default=a;
2
- //# sourceMappingURL=iiif-browser-form.lazy-Df2fAM6b.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"iiif-browser-form.lazy-Df2fAM6b.cjs","names":["useMemo","usePreviewVault","formatIIIFBrowserOutput","PreviewVaultBoundary","IIIFBrowser"],"sources":["../src/ContentResource/IIIFBrowserCreator/iiif-browser-form.lazy.tsx"],"sourcesContent":["import type { CreatorContext } from \"@manifest-editor/creator-api\";\nimport { PreviewVaultBoundary, usePreviewVault } from \"@manifest-editor/shell\";\nimport { IIIFBrowser, type IIIFBrowserProps } from \"iiif-browser\";\nimport { useMemo } from \"react\";\nimport { formatIIIFBrowserOutput } from \"./iiif-browser-output\";\n\nexport interface IIIFBrowserCreatorInitialData {\n url?: string;\n iiifBrowserOptions?: Partial<IIIFBrowserProps>;\n}\n\nexport default function IIIFBrowserCreatorForm(props: CreatorContext) {\n const initialData: IIIFBrowserCreatorInitialData = useMemo(() => {\n return props.options.initialData || {};\n }, [props.options.initialData]);\n\n const vault = usePreviewVault();\n const output = useMemo(() => {\n return [\n {\n type: \"callback\",\n label: \"Select\",\n supportedTypes: [\n \"Canvas\",\n \"CanvasList\",\n \"CanvasRegion\",\n \"ImageService\",\n \"ImageServiceRegion\",\n ],\n cb: (resource) => props.runCreate({ output: resource }),\n format: {\n type: \"custom\",\n format: formatIIIFBrowserOutput,\n },\n },\n ] as IIIFBrowserProps[\"output\"];\n }, [props.runCreate]);\n\n const navigationOptions = useMemo(() => {\n return {\n canCropImage: true,\n canSelectCanvas: true,\n canSelectManifest: false,\n canSelectCollection: false,\n // @todo fix the output so this one works.\n multiSelect: true,\n ...(initialData.iiifBrowserOptions?.navigation || {}),\n } as IIIFBrowserProps[\"navigation\"];\n }, [initialData]);\n\n const uiOptions = useMemo(() => {\n return {\n buttonClassName: \"bg-me-primary-500 text-white hover:bg-me-primary-600\",\n homeLink:\n initialData.url ||\n (typeof props.config?.defaultCollection === \"string\" ? props.config.defaultCollection : undefined),\n ...(initialData.iiifBrowserOptions?.ui || {}),\n } as IIIFBrowserProps[\"ui\"];\n }, [initialData, props.config]);\n const historyOptions = useMemo(() => {\n const history = initialData.iiifBrowserOptions?.history || {};\n if (!initialData.url) return history;\n return {\n ...history,\n restoreFromLocalStorage: false,\n saveToLocalStorage: false,\n initialHistory: [\n {\n url: initialData.url,\n resource: null,\n route: `/loading?id=${encodeURIComponent(initialData.url)}`,\n },\n ],\n } as IIIFBrowserProps[\"history\"];\n }, [initialData]);\n\n return (\n <PreviewVaultBoundary>\n <IIIFBrowser\n ui={uiOptions}\n vault={vault}\n className=\"iiif-browser border-none border-t rounded-none h-[70vh] min-h-[60vh] max-h-full max-w-full\"\n output={output}\n navigation={navigationOptions}\n customPages={initialData.iiifBrowserOptions?.customPages || {}}\n history={historyOptions}\n />\n </PreviewVaultBoundary>\n );\n}\n"],"mappings":"0KAWA,SAAwB,EAAuB,EAAuB,CACpE,IAAM,GAAA,EAA6CA,EAAAA,QAAAA,KAC1C,EAAM,QAAQ,aAAe,CAAC,EACpC,CAAC,EAAM,QAAQ,WAAW,CAAC,EAExB,GAAA,EAAQC,EAAAA,gBAAAA,CAAgB,EACxB,GAAA,EAASD,EAAAA,QAAAA,KACN,CACL,CACE,KAAM,WACN,MAAO,SACP,eAAgB,CACd,SACA,aACA,eACA,eACA,oBACF,EACA,GAAK,GAAa,EAAM,UAAU,CAAE,OAAQ,CAAS,CAAC,EACtD,OAAQ,CACN,KAAM,SACN,OAAQE,EAAAA,CACV,CACF,CACF,EACC,CAAC,EAAM,SAAS,CAAC,EAEd,GAAA,EAAoBF,EAAAA,QAAAA,MACjB,CACL,aAAc,GACd,gBAAiB,GACjB,kBAAmB,GACnB,oBAAqB,GAErB,YAAa,GACb,GAAI,EAAY,oBAAoB,YAAc,CAAC,CACrD,GACC,CAAC,CAAW,CAAC,EAEV,GAAA,EAAYA,EAAAA,QAAAA,MACT,CACL,gBAAiB,uDACjB,SACE,EAAY,MACX,OAAO,EAAM,QAAQ,mBAAsB,SAAW,EAAM,OAAO,kBAAoB,IAAA,IAC1F,GAAI,EAAY,oBAAoB,IAAM,CAAC,CAC7C,GACC,CAAC,EAAa,EAAM,MAAM,CAAC,EACxB,GAAA,EAAiBA,EAAAA,QAAAA,KAAc,CACnC,IAAM,EAAU,EAAY,oBAAoB,SAAW,CAAC,EAE5D,OADK,EAAY,IACV,CACL,GAAG,EACH,wBAAyB,GACzB,mBAAoB,GACpB,eAAgB,CACd,CACE,IAAK,EAAY,IACjB,SAAU,KACV,MAAO,eAAe,mBAAmB,EAAY,GAAG,GAC1D,CACF,CACF,EAZ6B,CAa/B,EAAG,CAAC,CAAW,CAAC,EAEhB,OACE,EAAA,EAAA,IAAA,CAACG,EAAAA,qBAAD,CAAA,UACE,EAAA,EAAA,IAAA,CAACC,EAAAA,YAAD,CACE,GAAI,EACG,QACP,UAAU,6FACF,SACR,WAAY,EACZ,YAAa,EAAY,oBAAoB,aAAe,CAAC,EAC7D,QAAS,CACV,CAAA,CACmB,CAAA,CAE1B"}
@@ -1,2 +0,0 @@
1
- import{r as e}from"./iiif-browser-output-DSDX-M6m.js";import{useMemo as t}from"react";import{jsx as n}from"react/jsx-runtime";import{PreviewVaultBoundary as r,usePreviewVault as i}from"@manifest-editor/shell";import{IIIFBrowser as a}from"iiif-browser";function o(o){let s=t(()=>o.options.initialData||{},[o.options.initialData]),c=i(),l=t(()=>[{type:`callback`,label:`Select`,supportedTypes:[`Canvas`,`CanvasList`,`CanvasRegion`,`ImageService`,`ImageServiceRegion`],cb:e=>o.runCreate({output:e}),format:{type:`custom`,format:e}}],[o.runCreate]),u=t(()=>({canCropImage:!0,canSelectCanvas:!0,canSelectManifest:!1,canSelectCollection:!1,multiSelect:!0,...s.iiifBrowserOptions?.navigation||{}}),[s]),d=t(()=>({buttonClassName:`bg-me-primary-500 text-white hover:bg-me-primary-600`,homeLink:s.url||(typeof o.config?.defaultCollection==`string`?o.config.defaultCollection:void 0),...s.iiifBrowserOptions?.ui||{}}),[s,o.config]),f=t(()=>{let e=s.iiifBrowserOptions?.history||{};return s.url?{...e,restoreFromLocalStorage:!1,saveToLocalStorage:!1,initialHistory:[{url:s.url,resource:null,route:`/loading?id=${encodeURIComponent(s.url)}`}]}:e},[s]);return n(r,{children:n(a,{ui:d,vault:c,className:`iiif-browser border-none border-t rounded-none h-[70vh] min-h-[60vh] max-h-full max-w-full`,output:l,navigation:u,customPages:s.iiifBrowserOptions?.customPages||{},history:f})})}export{o as default};
2
- //# sourceMappingURL=iiif-browser-form.lazy-DtTHoW1Q.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"iiif-browser-form.lazy-DtTHoW1Q.js","names":[],"sources":["../src/ContentResource/IIIFBrowserCreator/iiif-browser-form.lazy.tsx"],"sourcesContent":["import type { CreatorContext } from \"@manifest-editor/creator-api\";\nimport { PreviewVaultBoundary, usePreviewVault } from \"@manifest-editor/shell\";\nimport { IIIFBrowser, type IIIFBrowserProps } from \"iiif-browser\";\nimport { useMemo } from \"react\";\nimport { formatIIIFBrowserOutput } from \"./iiif-browser-output\";\n\nexport interface IIIFBrowserCreatorInitialData {\n url?: string;\n iiifBrowserOptions?: Partial<IIIFBrowserProps>;\n}\n\nexport default function IIIFBrowserCreatorForm(props: CreatorContext) {\n const initialData: IIIFBrowserCreatorInitialData = useMemo(() => {\n return props.options.initialData || {};\n }, [props.options.initialData]);\n\n const vault = usePreviewVault();\n const output = useMemo(() => {\n return [\n {\n type: \"callback\",\n label: \"Select\",\n supportedTypes: [\n \"Canvas\",\n \"CanvasList\",\n \"CanvasRegion\",\n \"ImageService\",\n \"ImageServiceRegion\",\n ],\n cb: (resource) => props.runCreate({ output: resource }),\n format: {\n type: \"custom\",\n format: formatIIIFBrowserOutput,\n },\n },\n ] as IIIFBrowserProps[\"output\"];\n }, [props.runCreate]);\n\n const navigationOptions = useMemo(() => {\n return {\n canCropImage: true,\n canSelectCanvas: true,\n canSelectManifest: false,\n canSelectCollection: false,\n // @todo fix the output so this one works.\n multiSelect: true,\n ...(initialData.iiifBrowserOptions?.navigation || {}),\n } as IIIFBrowserProps[\"navigation\"];\n }, [initialData]);\n\n const uiOptions = useMemo(() => {\n return {\n buttonClassName: \"bg-me-primary-500 text-white hover:bg-me-primary-600\",\n homeLink:\n initialData.url ||\n (typeof props.config?.defaultCollection === \"string\" ? props.config.defaultCollection : undefined),\n ...(initialData.iiifBrowserOptions?.ui || {}),\n } as IIIFBrowserProps[\"ui\"];\n }, [initialData, props.config]);\n const historyOptions = useMemo(() => {\n const history = initialData.iiifBrowserOptions?.history || {};\n if (!initialData.url) return history;\n return {\n ...history,\n restoreFromLocalStorage: false,\n saveToLocalStorage: false,\n initialHistory: [\n {\n url: initialData.url,\n resource: null,\n route: `/loading?id=${encodeURIComponent(initialData.url)}`,\n },\n ],\n } as IIIFBrowserProps[\"history\"];\n }, [initialData]);\n\n return (\n <PreviewVaultBoundary>\n <IIIFBrowser\n ui={uiOptions}\n vault={vault}\n className=\"iiif-browser border-none border-t rounded-none h-[70vh] min-h-[60vh] max-h-full max-w-full\"\n output={output}\n navigation={navigationOptions}\n customPages={initialData.iiifBrowserOptions?.customPages || {}}\n history={historyOptions}\n />\n </PreviewVaultBoundary>\n );\n}\n"],"mappings":"4PAWA,SAAwB,EAAuB,EAAuB,CACpE,IAAM,EAA6C,MAC1C,EAAM,QAAQ,aAAe,CAAC,EACpC,CAAC,EAAM,QAAQ,WAAW,CAAC,EAExB,EAAQ,EAAgB,EACxB,EAAS,MACN,CACL,CACE,KAAM,WACN,MAAO,SACP,eAAgB,CACd,SACA,aACA,eACA,eACA,oBACF,EACA,GAAK,GAAa,EAAM,UAAU,CAAE,OAAQ,CAAS,CAAC,EACtD,OAAQ,CACN,KAAM,SACN,OAAQ,CACV,CACF,CACF,EACC,CAAC,EAAM,SAAS,CAAC,EAEd,EAAoB,OACjB,CACL,aAAc,GACd,gBAAiB,GACjB,kBAAmB,GACnB,oBAAqB,GAErB,YAAa,GACb,GAAI,EAAY,oBAAoB,YAAc,CAAC,CACrD,GACC,CAAC,CAAW,CAAC,EAEV,EAAY,OACT,CACL,gBAAiB,uDACjB,SACE,EAAY,MACX,OAAO,EAAM,QAAQ,mBAAsB,SAAW,EAAM,OAAO,kBAAoB,IAAA,IAC1F,GAAI,EAAY,oBAAoB,IAAM,CAAC,CAC7C,GACC,CAAC,EAAa,EAAM,MAAM,CAAC,EACxB,EAAiB,MAAc,CACnC,IAAM,EAAU,EAAY,oBAAoB,SAAW,CAAC,EAE5D,OADK,EAAY,IACV,CACL,GAAG,EACH,wBAAyB,GACzB,mBAAoB,GACpB,eAAgB,CACd,CACE,IAAK,EAAY,IACjB,SAAU,KACV,MAAO,eAAe,mBAAmB,EAAY,GAAG,GAC1D,CACF,CACF,EAZ6B,CAa/B,EAAG,CAAC,CAAW,CAAC,EAEhB,OACE,EAAC,EAAD,CAAA,SACE,EAAC,EAAD,CACE,GAAI,EACG,QACP,UAAU,6FACF,SACR,WAAY,EACZ,YAAa,EAAY,oBAAoB,aAAe,CAAC,EAC7D,QAAS,CACV,CAAA,CACmB,CAAA,CAE1B"}
@@ -1,2 +0,0 @@
1
- function e(e,t,n){return(Array.isArray(e)?e:[{...e,parent:e.parent??t??void 0}]).map(e=>({resource:n.get(e),parent:e.parent,selector:e.selector,rotation:e.rotation}))}function t(e,t){let n=e?.type===`BoxSelector`?[~~e.spatial.x,~~e.spatial.y,~~e.spatial.width,~~e.spatial.height].join(`,`):void 0;if(!(!n&&!t))return{type:`ImageApiSelector`,...n?{region:n}:{},...t?{rotation:`${t}`}:{}}}function n(e,t){let n=Number.isFinite(t)?(t%360+360)%360:0;return n===90||n===270?{width:e.height,height:e.width}:e}export{n,e as r,t};
2
- //# sourceMappingURL=iiif-browser-output-DSDX-M6m.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"iiif-browser-output-DSDX-M6m.js","names":[],"sources":["../src/ContentResource/IIIFBrowserCreator/iiif-browser-output.ts"],"sourcesContent":["import type { BoxSelector } from \"@iiif/helpers\";\nimport type { IIIFBrowserProps } from \"iiif-browser\";\n\ntype IIIFBrowserCustomFormat = Extract<NonNullable<IIIFBrowserProps[\"output\"]>[number][\"format\"], { type: \"custom\" }>;\n\nexport type IIIFBrowserSelectedItem = Parameters<IIIFBrowserCustomFormat[\"format\"]>[0];\n\nexport interface IIIFBrowserOutputItem {\n resource: any;\n parent: IIIFBrowserSelectedItem[\"parent\"];\n selector: IIIFBrowserSelectedItem[\"selector\"];\n rotation: IIIFBrowserSelectedItem[\"rotation\"];\n}\n\nexport function formatIIIFBrowserOutput(\n resource: IIIFBrowserSelectedItem | IIIFBrowserSelectedItem[],\n parent: IIIFBrowserSelectedItem | null,\n vault: Parameters<IIIFBrowserCustomFormat[\"format\"]>[2],\n): IIIFBrowserOutputItem[] {\n const selectedItems = Array.isArray(resource)\n ? resource\n : [{ ...resource, parent: resource.parent ?? parent ?? undefined }];\n\n return selectedItems.map((item) => ({\n resource: vault.get(item),\n parent: item.parent,\n selector: item.selector,\n rotation: item.rotation,\n }));\n}\n\nexport function browserImageApiSelector(selector: BoxSelector | undefined, rotation: number | undefined) {\n const region =\n selector?.type === \"BoxSelector\"\n ? [~~selector.spatial.x, ~~selector.spatial.y, ~~selector.spatial.width, ~~selector.spatial.height].join(\",\")\n : undefined;\n\n if (!region && !rotation) return undefined;\n\n return {\n type: \"ImageApiSelector\" as const,\n ...(region ? { region } : {}),\n ...(rotation ? { rotation: `${rotation}` } : {}),\n };\n}\n\nexport function browserTransformDimensions(\n dimensions: { width: number; height: number },\n rotation: number | undefined,\n) {\n const angle = Number.isFinite(rotation) ? (((rotation as number) % 360) + 360) % 360 : 0;\n return angle === 90 || angle === 270 ? { width: dimensions.height, height: dimensions.width } : dimensions;\n}\n"],"mappings":"AAcA,SAAgB,EACd,EACA,EACA,EACyB,CAKzB,OAJsB,MAAM,QAAQ,CAAQ,EACxC,EACA,CAAC,CAAE,GAAG,EAAU,OAAQ,EAAS,QAAU,GAAU,IAAA,EAAU,CAAC,EAAA,CAE/C,IAAK,IAAU,CAClC,SAAU,EAAM,IAAI,CAAI,EACxB,OAAQ,EAAK,OACb,SAAU,EAAK,SACf,SAAU,EAAK,QACjB,EAAE,CACJ,CAEA,SAAgB,EAAwB,EAAmC,EAA8B,CACvG,IAAM,EACJ,GAAU,OAAS,cACf,CAAC,CAAC,CAAC,EAAS,QAAQ,EAAG,CAAC,CAAC,EAAS,QAAQ,EAAG,CAAC,CAAC,EAAS,QAAQ,MAAO,CAAC,CAAC,EAAS,QAAQ,MAAM,CAAC,CAAC,KAAK,GAAG,EAC1G,IAAA,GAEF,MAAC,GAAU,CAAC,GAEhB,MAAO,CACL,KAAM,mBACN,GAAI,EAAS,CAAE,QAAO,EAAI,CAAC,EAC3B,GAAI,EAAW,CAAE,SAAU,GAAG,GAAW,EAAI,CAAC,CAChD,CACF,CAEA,SAAgB,EACd,EACA,EACA,CACA,IAAM,EAAQ,OAAO,SAAS,CAAQ,GAAO,EAAsB,IAAO,KAAO,IAAM,EACvF,OAAO,IAAU,IAAM,IAAU,IAAM,CAAE,MAAO,EAAW,OAAQ,OAAQ,EAAW,KAAM,EAAI,CAClG"}
@@ -1,2 +0,0 @@
1
- function e(e,t,n){return(Array.isArray(e)?e:[{...e,parent:e.parent??t??void 0}]).map(e=>({resource:n.get(e),parent:e.parent,selector:e.selector,rotation:e.rotation}))}function t(e,t){let n=e?.type===`BoxSelector`?[~~e.spatial.x,~~e.spatial.y,~~e.spatial.width,~~e.spatial.height].join(`,`):void 0;if(!(!n&&!t))return{type:`ImageApiSelector`,...n?{region:n}:{},...t?{rotation:`${t}`}:{}}}function n(e,t){let n=Number.isFinite(t)?(t%360+360)%360:0;return n===90||n===270?{width:e.height,height:e.width}:e}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
2
- //# sourceMappingURL=iiif-browser-output-IFaBMvwa.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"iiif-browser-output-IFaBMvwa.cjs","names":[],"sources":["../src/ContentResource/IIIFBrowserCreator/iiif-browser-output.ts"],"sourcesContent":["import type { BoxSelector } from \"@iiif/helpers\";\nimport type { IIIFBrowserProps } from \"iiif-browser\";\n\ntype IIIFBrowserCustomFormat = Extract<NonNullable<IIIFBrowserProps[\"output\"]>[number][\"format\"], { type: \"custom\" }>;\n\nexport type IIIFBrowserSelectedItem = Parameters<IIIFBrowserCustomFormat[\"format\"]>[0];\n\nexport interface IIIFBrowserOutputItem {\n resource: any;\n parent: IIIFBrowserSelectedItem[\"parent\"];\n selector: IIIFBrowserSelectedItem[\"selector\"];\n rotation: IIIFBrowserSelectedItem[\"rotation\"];\n}\n\nexport function formatIIIFBrowserOutput(\n resource: IIIFBrowserSelectedItem | IIIFBrowserSelectedItem[],\n parent: IIIFBrowserSelectedItem | null,\n vault: Parameters<IIIFBrowserCustomFormat[\"format\"]>[2],\n): IIIFBrowserOutputItem[] {\n const selectedItems = Array.isArray(resource)\n ? resource\n : [{ ...resource, parent: resource.parent ?? parent ?? undefined }];\n\n return selectedItems.map((item) => ({\n resource: vault.get(item),\n parent: item.parent,\n selector: item.selector,\n rotation: item.rotation,\n }));\n}\n\nexport function browserImageApiSelector(selector: BoxSelector | undefined, rotation: number | undefined) {\n const region =\n selector?.type === \"BoxSelector\"\n ? [~~selector.spatial.x, ~~selector.spatial.y, ~~selector.spatial.width, ~~selector.spatial.height].join(\",\")\n : undefined;\n\n if (!region && !rotation) return undefined;\n\n return {\n type: \"ImageApiSelector\" as const,\n ...(region ? { region } : {}),\n ...(rotation ? { rotation: `${rotation}` } : {}),\n };\n}\n\nexport function browserTransformDimensions(\n dimensions: { width: number; height: number },\n rotation: number | undefined,\n) {\n const angle = Number.isFinite(rotation) ? (((rotation as number) % 360) + 360) % 360 : 0;\n return angle === 90 || angle === 270 ? { width: dimensions.height, height: dimensions.width } : dimensions;\n}\n"],"mappings":"AAcA,SAAgB,EACd,EACA,EACA,EACyB,CAKzB,OAJsB,MAAM,QAAQ,CAAQ,EACxC,EACA,CAAC,CAAE,GAAG,EAAU,OAAQ,EAAS,QAAU,GAAU,IAAA,EAAU,CAAC,EAAA,CAE/C,IAAK,IAAU,CAClC,SAAU,EAAM,IAAI,CAAI,EACxB,OAAQ,EAAK,OACb,SAAU,EAAK,SACf,SAAU,EAAK,QACjB,EAAE,CACJ,CAEA,SAAgB,EAAwB,EAAmC,EAA8B,CACvG,IAAM,EACJ,GAAU,OAAS,cACf,CAAC,CAAC,CAAC,EAAS,QAAQ,EAAG,CAAC,CAAC,EAAS,QAAQ,EAAG,CAAC,CAAC,EAAS,QAAQ,MAAO,CAAC,CAAC,EAAS,QAAQ,MAAM,CAAC,CAAC,KAAK,GAAG,EAC1G,IAAA,GAEF,MAAC,GAAU,CAAC,GAEhB,MAAO,CACL,KAAM,mBACN,GAAI,EAAS,CAAE,QAAO,EAAI,CAAC,EAC3B,GAAI,EAAW,CAAE,SAAU,GAAG,GAAW,EAAI,CAAC,CAChD,CACF,CAEA,SAAgB,EACd,EACA,EACA,CACA,IAAM,EAAQ,OAAO,SAAS,CAAQ,GAAO,EAAsB,IAAO,KAAO,IAAM,EACvF,OAAO,IAAU,IAAM,IAAU,IAAM,CAAE,MAAO,EAAW,OAAQ,OAAQ,EAAW,KAAM,EAAI,CAClG"}