@mathewjordan/hydroponic
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -1,20 +0,3 @@ | ||
import { Collection, ContentResource, ExternalWebResource, InternationalString, Manifest } from "@iiif/presentation-3"; | ||
export declare type HydroponicInstance = { | ||
id: string; | ||
label: InternationalString; | ||
summary?: InternationalString; | ||
homepage?: any; | ||
}; | ||
export declare type HydroponicItem = { | ||
id: string; | ||
href?: string; | ||
}; | ||
export interface HydroponicResource extends ExternalWebResource { | ||
label?: InternationalString; | ||
} | ||
export declare type HydroponicConfig = {}; | ||
export interface HydroponicGrow { | ||
instance: HydroponicInstance; | ||
items: HydroponicItem[]; | ||
} | ||
import { Collection, Manifest } from "@iiif/presentation-3"; | ||
import { HydroponicInstance, HydroponicItem } from "./types/hydroponic"; | ||
export declare class Hydroponic { | ||
@@ -25,5 +8,5 @@ vaultFetcher: (url: string) => Manifest | Collection | undefined; | ||
type: import("@iiif/presentation-3").ResourceType; | ||
label: InternationalString; | ||
thumbnail: ContentResource[] | undefined; | ||
homepage: ContentResource[] | undefined; | ||
label: import("@iiif/presentation-3").InternationalString; | ||
thumbnail: import("@iiif/presentation-3").ContentResource[] | undefined; | ||
homepage: import("@iiif/presentation-3").ContentResource[] | undefined; | ||
} | undefined; | ||
@@ -33,4 +16,4 @@ grow(instance: HydroponicInstance, items: HydroponicItem[]): { | ||
type: string; | ||
label: InternationalString; | ||
summary: InternationalString | undefined; | ||
label: import("@iiif/presentation-3").InternationalString; | ||
summary: import("@iiif/presentation-3").InternationalString | undefined; | ||
homepage: any; | ||
@@ -40,7 +23,7 @@ items: ({ | ||
type: import("@iiif/presentation-3").ResourceType; | ||
label: InternationalString; | ||
thumbnail: ContentResource[] | undefined; | ||
homepage: ContentResource[] | undefined; | ||
label: import("@iiif/presentation-3").InternationalString; | ||
thumbnail: import("@iiif/presentation-3").ContentResource[] | undefined; | ||
homepage: import("@iiif/presentation-3").ContentResource[] | undefined; | ||
} | undefined)[]; | ||
}; | ||
} |
@@ -1,1 +0,1 @@ | ||
var m=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames,g=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var b=(n,t,e)=>t in n?m(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,I=(n,t)=>{for(var e in t||(t={}))x.call(t,e)&&b(n,e,t[e]);if(g)for(var e of g(t))A.call(t,e)&&b(n,e,t[e]);return n};var R=(n,t)=>{for(var e in t)m(n,e,{get:t[e],enumerable:!0})},S=(n,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of v(t))!x.call(n,o)&&o!==e&&m(n,o,{get:()=>t[o],enumerable:!(a=C(t,o))||a.enumerable});return n};var E=n=>S(m({},"__esModule",{value:!0}),n);var P={};R(P,{Hydroponic:()=>d});module.exports=E(P);var H=require("@iiif/parser/presentation-2"),y=require("react"),d=class{vaultFetcher=t=>{let[e,a]=(0,y.useState)();if((0,y.useEffect)(()=>{fetch(t).then(o=>o.json().then(r=>{let i=r;i["@context"]==="http://iiif.io/api/presentation/2/context.json"&&(i=(0,H.convertPresentation2)(i)),a(i)}))},[]),e&&e.id)return e};loadItem(t){let e=this.vaultFetcher(t.id);if(e){let{id:a,type:o,label:r,thumbnail:i,homepage:c}=e,f={id:a,type:o,label:r,thumbnail:i,homepage:c};if(!i){let s,l,p,h;if(s=e==null?void 0:e.items[0],s&&s.items&&(l=s.items[0]),l&&l.items&&(p=l.items[0]),p&&p.body&&(h=p.body),h){let u=I({},h);delete u.label,f.thumbnail=[u]}}if(t!=null&&t.href){let s={id:t.href,type:"Text",label:r,format:"text/html"};f.homepage=[s]}return f}}grow(t,e){let{id:a,label:o,summary:r,homepage:i}=t;return{id:a,type:"Collection",label:o,summary:r,homepage:i,items:e.map(c=>this.loadItem(c)).filter(c=>c)}}}; | ||
var p=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames,b=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var g=(e,t,o)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,I=(e,t)=>{for(var o in t||(t={}))H.call(t,o)&&g(e,o,t[o]);if(b)for(var o of b(t))C.call(t,o)&&g(e,o,t[o]);return e};var P=(e,t)=>{for(var o in t)p(e,o,{get:t[o],enumerable:!0})},j=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of A(t))!H.call(e,n)&&n!==o&&p(e,n,{get:()=>t[n],enumerable:!(i=x(t,n))||i.enumerable});return e};var R=e=>j(p({},"__esModule",{value:!0}),e);var B={};P(B,{Hydroponic:()=>f});module.exports=R(B);var d=require("react"),v=require("@iiif/parser/presentation-2"),f=class{vaultFetcher=t=>{let[o,i]=(0,d.useState)();if((0,d.useEffect)(()=>{fetch(t).then(n=>n.json().then(r=>{let a=r;a["@context"]==="http://iiif.io/api/presentation/2/context.json"&&(a=(0,v.convertPresentation2)(a)),i(a)}))},[]),o&&o.id)return o};loadItem(t){let o=this.vaultFetcher(t.id);if(o){let{id:i,type:n,label:r,thumbnail:a,homepage:c}=o,y={id:i,type:n,label:r,thumbnail:a,homepage:c};if(!a){let s,l,m,h;if(s=o==null?void 0:o.items[0],s&&s.items&&(l=s.items[0]),l&&l.items&&(m=l.items[0]),m&&m.body&&(h=m.body),h){let u=I({},h);delete u.label,y.thumbnail=[u]}}if(t!=null&&t.href){let s={id:t.href,type:"Text",label:r,format:"text/html"};y.homepage=[s]}return y}}grow(t,o){let{id:i,label:n,summary:r,homepage:a}=t;return{id:i,type:"Collection",label:n,summary:r,homepage:a,items:o.map(c=>this.loadItem(c)).filter(c=>c)}}}; |
@@ -1,2 +0,2 @@ | ||
import { Hydroponic } from "@/hydroponic"; | ||
import { Hydroponic } from "./hydroponic"; | ||
export { Hydroponic }; |
@@ -1,1 +0,1 @@ | ||
var b=Object.defineProperty;var h=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var u=(o,e,t)=>e in o?b(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,g=(o,e)=>{for(var t in e||(e={}))x.call(e,t)&&u(o,t,e[t]);if(h)for(var t of h(e))I.call(e,t)&&u(o,t,e[t]);return o};import{convertPresentation2 as H}from"@iiif/parser/presentation-2";import{useEffect as C,useState as v}from"react";var y=class{vaultFetcher=e=>{let[t,r]=v();if(C(()=>{fetch(e).then(s=>s.json().then(i=>{let n=i;n["@context"]==="http://iiif.io/api/presentation/2/context.json"&&(n=H(n)),r(n)}))},[]),t&&t.id)return t};loadItem(e){let t=this.vaultFetcher(e.id);if(t){let{id:r,type:s,label:i,thumbnail:n,homepage:c}=t,m={id:r,type:s,label:i,thumbnail:n,homepage:c};if(!n){let a,l,p,d;if(a=t==null?void 0:t.items[0],a&&a.items&&(l=a.items[0]),l&&l.items&&(p=l.items[0]),p&&p.body&&(d=p.body),d){let f=g({},d);delete f.label,m.thumbnail=[f]}}if(e!=null&&e.href){let a={id:e.href,type:"Text",label:i,format:"text/html"};m.homepage=[a]}return m}}grow(e,t){let{id:r,label:s,summary:i,homepage:n}=e;return{id:r,type:"Collection",label:s,summary:i,homepage:n,items:t.map(c=>this.loadItem(c)).filter(c=>c)}}};export{y as Hydroponic}; | ||
var g=Object.defineProperty;var h=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var u=(n,o,t)=>o in n?g(n,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[o]=t,b=(n,o)=>{for(var t in o||(o={}))H.call(o,t)&&u(n,t,o[t]);if(h)for(var t of h(o))I.call(o,t)&&u(n,t,o[t]);return n};import{useEffect as v,useState as x}from"react";import{convertPresentation2 as A}from"@iiif/parser/presentation-2";var d=class{vaultFetcher=o=>{let[t,r]=x();if(v(()=>{fetch(o).then(s=>s.json().then(a=>{let e=a;e["@context"]==="http://iiif.io/api/presentation/2/context.json"&&(e=A(e)),r(e)}))},[]),t&&t.id)return t};loadItem(o){let t=this.vaultFetcher(o.id);if(t){let{id:r,type:s,label:a,thumbnail:e,homepage:c}=t,p={id:r,type:s,label:a,thumbnail:e,homepage:c};if(!e){let i,l,m,f;if(i=t==null?void 0:t.items[0],i&&i.items&&(l=i.items[0]),l&&l.items&&(m=l.items[0]),m&&m.body&&(f=m.body),f){let y=b({},f);delete y.label,p.thumbnail=[y]}}if(o!=null&&o.href){let i={id:o.href,type:"Text",label:a,format:"text/html"};p.homepage=[i]}return p}}grow(o,t){let{id:r,label:s,summary:a,homepage:e}=o;return{id:r,type:"Collection",label:s,summary:a,homepage:e,items:t.map(c=>this.loadItem(c)).filter(c=>c)}}};export{d as Hydroponic}; |
{ | ||
"name": "@mathewjordan/hydroponic", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "IIIF Collection grow kit for @samvera/bloom-iiif", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,3 +10,3 @@ # hydroponic :seedling: | ||
const instance = { | ||
id: "https://publisdhed.uri/for/the/collection.json", | ||
id: "https://published.uri/for/the/collection.json", | ||
label: { none: ["My Curated Collection"] }, | ||
@@ -39,3 +39,3 @@ summary: { none: ["A short summary of this collection, optionally."] }, | ||
// `collection` now can be written to file, screen, or elsewhere for your use. | ||
// `collection` now can be written to file or screen for use. | ||
``` | ||
@@ -42,0 +42,0 @@ |
9028
8
59