Closed stephenwf closed 3 months ago
Currently this will produce a tree with two types of node.
Full interface:
interface RangeTableOfContentsNode { id: string; type: 'Canvas' | 'Range'; label: InternationalString | null; resource?: SpecificResource; untitled?: boolean; isCanvasLeaf: boolean; isRangeLeaf: boolean; isVirtual?: boolean; firstCanvas?: SpecificResource<Reference<'Canvas'>> | null; items?: Array<RangeTableOfContentsNode>; }
Example Range node:
{ "id": "https://iiif.io/api/cookbook/recipe/0024-book-4-toc/range/r1", "type": "Range", "isCanvasLeaf": false, "isRangeLeaf": true, "label": { "gez": [ "Tabiba Tabiban [ጠቢበ ጠቢባን]", ], }, "untitled": false, "firstCanvas": { "source": { "id": "https://iiif.io/api/cookbook/recipe/0024-book-4-toc/canvas/p1", "type": "Canvas", }, "type": "SpecificResource", }, "items": [ ... ], }
The "Range" node contains the following:
isRangeLeaf
label
"Untitled"
untitled
firstCanvas
items
Example Canvas node:
{ "id": "https://iiif.io/api/cookbook/recipe/0024-book-4-toc/canvas/p2", "isCanvasLeaf": true, "isRangeLeaf": false, "label": { "en": [ "f. 1v", ], }, "resource": { "source": { "id": "https://iiif.io/api/cookbook/recipe/0024-book-4-toc/canvas/p2", "type": "Canvas", }, "type": "SpecificResource", }, "type": "Canvas", "untitled": false, }
Similar properties to the range, if you wanted to display each canvas. The label is grabbed from the canvas (if you use the helper with Vault).
It will also work with AV or regions, and use the normalized "SpecificResource" format, to make it easier to use.
{ "id": "https://iiif.io/api/cookbook/recipe/0026-toc-opera/canvas/1#t=0,302.05", "isCanvasLeaf": true, "isRangeLeaf": false, "label": { "none": [ "Untitled", ], }, "resource": { "selector": { "type": "FragmentSelector", "value": "t=0,302.05", }, "source": { "id": "https://iiif.io/api/cookbook/recipe/0026-toc-opera/canvas/1", "type": "Canvas", }, "type": "SpecificResource", }, "type": "Canvas", "untitled": true, }
In this example, the canvas ID is pulled out, but the range is Untitled and marked as untitled. The time selector is also pulled out. (Other helpers in the repo can be used to parse it further).
Untitled
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Currently this will produce a tree with two types of node.
Full interface:
Example Range node:
The "Range" node contains the following:
isRangeLeaf
: if this range only contains canvaseslabel
: from the range itself, will be"Untitled"
if not founduntitled
: boolean, if it is untitled (for display)firstCanvas
: SpecificResource with optional selector of the first canvas, for navigation.items
: list of items inside the range.Example Canvas node:
Similar properties to the range, if you wanted to display each canvas. The label is grabbed from the canvas (if you use the helper with Vault).
It will also work with AV or regions, and use the normalized "SpecificResource" format, to make it easier to use.
In this example, the canvas ID is pulled out, but the range is
Untitled
and marked as untitled. The time selector is also pulled out. (Other helpers in the repo can be used to parse it further).