@projektemacher/storymapjs 0.10.8 → 0.11.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/CHANGELOG +81 -0
- package/README.md +129 -12
- package/dist/assets/{demo-DBpeF31K.js → demo-bWnOyfUw.js} +1 -1
- package/dist/assets/harness-C3JUv5Ii.js +1 -0
- package/dist/assets/{harness-multi-CYHgI0a9.js → harness-multi-XZNex3tb.js} +1 -1
- package/dist/assets/{harness-support-Do7sIp2j.js → harness-support-CjfZIVeb.js} +1 -1
- package/dist/assets/main-DQ32hWBM.js +17 -0
- package/dist/context.json +13 -2
- package/dist/css/storymap.css +1 -1
- package/dist/demo.html +3 -2
- package/dist/docs/api/assets/navigation.js +1 -1
- package/dist/docs/api/assets/search.js +1 -1
- package/dist/docs/api/classes/StoryMap.html +777 -269
- package/dist/docs/api/functions/MediaType.html +1 -1
- package/dist/docs/api/functions/isPresentation3Collection.html +1 -1
- package/dist/docs/api/functions/isPresentation3Manifest.html +1 -1
- package/dist/docs/api/functions/isSlideshowCollection.html +51 -0
- package/dist/docs/api/functions/loadCSS.html +1 -1
- package/dist/docs/api/functions/manifestToStorymapData.html +1 -1
- package/dist/docs/api/functions/setLanguage.html +1 -1
- package/dist/docs/api/functions/slideshowToStorymapData.html +51 -0
- package/dist/docs/api/functions/slideshowVersion.html +48 -0
- package/dist/docs/api/functions/storymapToManifest.html +1 -1
- package/dist/docs/api/functions/validateStorymap.html +1 -1
- package/dist/docs/api/functions/validateStorymapAndReport.html +1 -1
- package/dist/docs/api/index.html +115 -12
- package/dist/docs/api/interfaces/AnimationHandle.html +2 -2
- package/dist/docs/api/interfaces/ImagereadyPayload.html +4 -4
- package/dist/docs/api/interfaces/LanguageEntry.html +6 -6
- package/dist/docs/api/interfaces/LatLngLiteral.html +4 -4
- package/dist/docs/api/interfaces/LoadOptions.html +2 -2
- package/dist/docs/api/interfaces/MapEvents.html +116 -0
- package/dist/docs/api/interfaces/MapMarkerEvents.html +66 -0
- package/dist/docs/api/interfaces/MarkerEventPayload.html +57 -0
- package/dist/docs/api/interfaces/MediaEvents.html +78 -0
- package/dist/docs/api/interfaces/MenuBarEvents.html +114 -0
- package/dist/docs/api/interfaces/MessageEvents.html +72 -0
- package/dist/docs/api/interfaces/OlLayer.html +1 -1
- package/dist/docs/api/interfaces/OlMap.html +1 -1
- package/dist/docs/api/interfaces/OlSource.html +1 -1
- package/dist/docs/api/interfaces/OlTileLayer.html +1 -1
- package/dist/docs/api/interfaces/OlVectorLayer.html +1 -1
- package/dist/docs/api/interfaces/OlView.html +1 -1
- package/dist/docs/api/interfaces/SlideBackgroundState.html +66 -0
- package/dist/docs/api/interfaces/SlideEvents.html +78 -0
- package/dist/docs/api/interfaces/SlideNavEvents.html +72 -0
- package/dist/docs/api/interfaces/SlideshowPlayerSettings.html +182 -0
- package/dist/docs/api/interfaces/SlideshowToStorymapResult.html +60 -0
- package/dist/docs/api/interfaces/SlideshowTranslatorOptions.html +65 -0
- package/dist/docs/api/interfaces/SlideshowWarning.html +72 -0
- package/dist/docs/api/interfaces/StoryMapEvents.html +146 -0
- package/dist/docs/api/interfaces/StoryMapMarker.html +763 -0
- package/dist/docs/api/interfaces/StorySliderEvents.html +102 -0
- package/dist/docs/api/interfaces/StorymapBasemap.html +69 -0
- package/dist/docs/api/interfaces/StorymapData.html +12 -6
- package/dist/docs/api/interfaces/StorymapDataWrapper.html +2 -2
- package/dist/docs/api/interfaces/StorymapDocument.html +2 -2
- package/dist/docs/api/interfaces/StorymapError.html +3 -3
- package/dist/docs/api/interfaces/StorymapGeoreference.html +5 -5
- package/dist/docs/api/interfaces/StorymapGeoreferenceBody.html +4 -4
- package/dist/docs/api/interfaces/StorymapGroundControlPoint.html +4 -4
- package/dist/docs/api/interfaces/StorymapLanguageMap.html +2 -2
- package/dist/docs/api/interfaces/StorymapManifest.html +12 -12
- package/dist/docs/api/interfaces/StorymapManifestAnnotation.html +43 -11
- package/dist/docs/api/interfaces/StorymapManifestBackground.html +6 -6
- package/dist/docs/api/interfaces/StorymapManifestCanvas.html +65 -17
- package/dist/docs/api/interfaces/StorymapManifestContentResource.html +8 -8
- package/dist/docs/api/interfaces/StorymapManifestFeatureCollection.html +4 -4
- package/dist/docs/api/interfaces/StorymapManifestGeoreferencing.html +7 -7
- package/dist/docs/api/interfaces/StorymapManifestImageService.html +4 -4
- package/dist/docs/api/interfaces/StorymapManifestRange.html +5 -5
- package/dist/docs/api/interfaces/StorymapManifestService.html +4 -4
- package/dist/docs/api/interfaces/StorymapManifestSpecificResource.html +4 -4
- package/dist/docs/api/interfaces/StorymapManifestStatement.html +3 -3
- package/dist/docs/api/interfaces/StorymapMapOptions.html +5 -5
- package/dist/docs/api/interfaces/StorymapOptions.html +277 -75
- package/dist/docs/api/interfaces/StorymapOverlayLayer.html +42 -11
- package/dist/docs/api/interfaces/StorymapSlide.html +70 -16
- package/dist/docs/api/interfaces/StorymapSlideBackground.html +4 -4
- package/dist/docs/api/interfaces/StorymapSlideLocation.html +58 -14
- package/dist/docs/api/interfaces/StorymapSlideMarker.html +8 -9
- package/dist/docs/api/interfaces/StorymapSlideMedia.html +49 -10
- package/dist/docs/api/interfaces/StorymapSlideNarration.html +61 -9
- package/dist/docs/api/interfaces/StorymapSlideText.html +4 -4
- package/dist/docs/api/interfaces/StorymapTilejson.html +8 -8
- package/dist/docs/api/interfaces/SwipableEvents.html +102 -0
- package/dist/docs/api/interfaces/TextEvents.html +66 -0
- package/dist/docs/api/media/events.md +66 -0
- package/dist/docs/api/media/migration-from-knightlab.md +89 -49
- package/dist/docs/api/media/slideshow.md +109 -0
- package/dist/docs/api/media/storymap-as-iiif-manifest.md +1007 -0
- package/dist/docs/api/modules.html +6 -6
- package/dist/docs/api/types/ContentState.html +3 -3
- package/dist/docs/api/types/FiredEvent.html +43 -0
- package/dist/docs/api/types/ImagereadyKind.html +1 -1
- package/dist/docs/api/types/MediaTypeMatch.html +5 -5
- package/dist/docs/api/types/SwipeDirection.html +36 -0
- package/dist/docs/api/types/TileSourceFactory.html +1 -1
- package/dist/docs/authoring.html +20 -7
- package/dist/docs/events.html +263 -0
- package/dist/docs/iiif.html +136 -22
- package/dist/docs/migration.html +66 -19
- package/dist/docs/readme.html +113 -12
- package/dist/embed/index.html +7 -0
- package/dist/examples/font-css-false.json +33 -0
- package/dist/examples/issue-image-region.json +1 -1
- package/dist/examples/layers-control.json +60 -0
- package/dist/examples/map-template-provider.json +36 -0
- package/dist/examples/multi-media.json +71 -0
- package/dist/examples-iiif/annotated-image.json +16 -0
- package/dist/examples-iiif/font-css-false.json +114 -0
- package/dist/examples-iiif/issue-image-region.json +1 -1
- package/dist/examples-iiif/layers-control.json +226 -0
- package/dist/examples-iiif/map-template-provider.json +133 -0
- package/dist/examples-iiif/multi-media.json +237 -0
- package/dist/examples-slideshow/single.json +79 -0
- package/dist/examples-slideshow/static/pixel.png +0 -0
- package/dist/examples-slideshow/static.json +44 -0
- package/dist/harness-multi.html +3 -3
- package/dist/harness.html +4 -3
- package/dist/index.html +3 -2
- package/dist/js/storymap.d.ts +1326 -289
- package/dist/js/storymap.js +6690 -4784
- package/dist/js/storymap.js.map +1 -1
- package/dist/navplace-properties.json +14 -0
- package/dist/site.css +54 -36
- package/docs/migration-from-knightlab.md +89 -49
- package/docs/storymap-as-iiif-manifest.md +199 -126
- package/package.json +4 -2
- package/schema/storymap.schema.json +334 -34
- package/src/core/Util.ts +3 -1
- package/src/core/mixins.ts +42 -28
- package/src/language/Language.ts +7 -0
- package/src/language/locale/.expected-gaps.json +287 -27
- package/src/language/locale/de.json +11 -1
- package/src/language/locale/en.json +11 -1
- package/src/main.ts +51 -0
- package/src/map/Map.ts +44 -6
- package/src/map/MapMarker.ts +16 -3
- package/src/map/openlayers/Map.OpenLayers.ts +787 -62
- package/src/map/openlayers/MapMarker.OpenLayers.ts +113 -13
- package/src/map/slideView.ts +149 -0
- package/src/map/types.ts +2 -0
- package/src/media/EmbedUtil.ts +27 -2
- package/src/media/Media.ts +27 -4
- package/src/media/embedId.ts +6 -0
- package/src/media/types/Flickr.ts +14 -3
- package/src/media/types/HtmlMedia.ts +66 -0
- package/src/media/types/Image.ts +15 -3
- package/src/media/types/SoundCloud.ts +1 -1
- package/src/media/types/Text.ts +27 -8
- package/src/media/types/Twitter.ts +9 -7
- package/src/media/types/Vimeo.ts +1 -1
- package/src/media/types/YouTube.ts +2 -2
- package/src/scss/Typography.scss +15 -15
- package/src/scss/VCO.StoryMap.scss +173 -8
- package/src/scss/core/Reset.scss +5 -18
- package/src/scss/map/VCO.Map.scss +1 -1
- package/src/scss/map/VCO.MapMarker.scss +20 -9
- package/src/scss/map/openlayers/VCO.Map.OpenLayers.scss +7 -4
- package/src/scss/media/VCO.Media.scss +7 -7
- package/src/scss/media/types/VCO.Media.Blockquote.scss +1 -1
- package/src/scss/media/types/VCO.Media.Text.scss +5 -5
- package/src/scss/media/types/VCO.Media.Twitter.scss +4 -4
- package/src/scss/media/types/VCO.Media.Wikipedia.scss +2 -19
- package/src/scss/site/site.scss +55 -36
- package/src/scss/slider/VCO.Slide.scss +49 -11
- package/src/scss/slider/VCO.SlideNav.scss +23 -7
- package/src/scss/slider/VCO.StorySlider.scss +50 -0
- package/src/scss/snapmap/VCO.SnapMap.scss +3 -3
- package/src/scss/ui/VCO.Consent.scss +20 -14
- package/src/scss/ui/VCO.Layers.scss +119 -0
- package/src/scss/ui/VCO.MenuBar.Button.scss +140 -19
- package/src/scss/ui/VCO.MenuBar.scss +9 -2
- package/src/scss/ui/VCO.Message.scss +14 -0
- package/src/slider/Slide.ts +232 -74
- package/src/slider/SlideNav.ts +15 -4
- package/src/slider/StorySlider.ts +203 -22
- package/src/storymap/Consent.ts +22 -0
- package/src/storymap/StoryMap.ts +944 -131
- package/src/storymap/content-state.ts +3 -8
- package/src/storymap/font-css.ts +72 -0
- package/src/storymap/from-slideshow.ts +785 -0
- package/src/storymap/iiif-shared.ts +228 -0
- package/src/storymap/iiif.ts +289 -100
- package/src/storymap/to-iiif.ts +131 -44
- package/src/types.ts +382 -17
- package/src/ui/LayersControl.ts +302 -0
- package/src/ui/MenuBar.ts +232 -21
- package/src/ui/Message.ts +36 -3
- package/src/ui/Swipable.ts +25 -7
- package/dist/assets/harness-Cr0rYpvt.js +0 -1
- package/dist/assets/main-DXalctuR.js +0 -17
- package/src/scss/VCO.StoryMap.Dark.scss +0 -150
- package/src/scss/Variables.Dark.scss +0 -57
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { asRecord, isHttpUrl } from "./iiif-shared";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* IIIF Content State 1.0 — the `iiif-content` initialization parameter.
|
|
3
5
|
*
|
|
@@ -21,8 +23,6 @@
|
|
|
21
23
|
* This module reads all four forms and writes the simplest one that can carry
|
|
22
24
|
* the state, which is the Target URI for a whole canvas and the Target Body for
|
|
23
25
|
* a region.
|
|
24
|
-
*
|
|
25
|
-
* See docs/plans/iiif-interop.md §5.1.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
/** The initialization parameter the spec names. */
|
|
@@ -63,11 +63,6 @@ export function decodeContentState(encoded: string): string {
|
|
|
63
63
|
return decodeURIComponent(atob(base64url.replace(/-/g, "+").replace(/_/g, "/")));
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
function asRecord(value: unknown): Json | null {
|
|
67
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
68
|
-
return value as Json;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
66
|
/** `[x, y, w, h]` from an `xywh=` / `xywh=pixel:` fragment, or null. */
|
|
72
67
|
function regionFromFragment(id: string): [string, [number, number, number, number]] | null {
|
|
73
68
|
const at = id.indexOf("#");
|
|
@@ -136,7 +131,7 @@ export function parseContentState(value: string | null | undefined): ContentStat
|
|
|
136
131
|
return stateFromJson(trimmed);
|
|
137
132
|
}
|
|
138
133
|
|
|
139
|
-
if (
|
|
134
|
+
if (isHttpUrl(trimmed)) {
|
|
140
135
|
// 2.2.2 or 2.2.4: a plain URI, never encoded. It is either the target
|
|
141
136
|
// itself or a content state Annotation we would have to dereference,
|
|
142
137
|
// and dereferencing is the host's call, not ours.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Font-theme stylesheet resolution.
|
|
3
|
+
*
|
|
4
|
+
* Pure functions (no viewer state), extracted from `StoryMap.ts` so the
|
|
5
|
+
* 2000-line viewer file does not also own URL policy. Both are re-exported
|
|
6
|
+
* from `./StoryMap`, so existing import paths keep working.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The configured theme source, or null when the host bundles the theme
|
|
11
|
+
* itself (`font_css: false`, or `"none"` for JSON-friendliness): the viewer
|
|
12
|
+
* injects no stylesheet in that case. Empty/absent falls back to
|
|
13
|
+
* `"stock:default"`, as before.
|
|
14
|
+
*/
|
|
15
|
+
export function fontCssOriginal(configured: string | false | undefined | null): string | null {
|
|
16
|
+
if (configured === false || configured === "none") return null;
|
|
17
|
+
return configured || "stock:default";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Resolve a `font_css` value to an absolute stylesheet URL, or null when
|
|
22
|
+
* there is no theme stylesheet to inject (`font_css: false` / `"none"`).
|
|
23
|
+
*
|
|
24
|
+
* - `stock:<name>` resolves against the library location.
|
|
25
|
+
* - Absolute URLs pass through untouched.
|
|
26
|
+
* - Anything else resolves against the page URL, so hosts can reference
|
|
27
|
+
* themes vendored into their own public dir (e.g. "fonts/font.css").
|
|
28
|
+
*/
|
|
29
|
+
export function resolveFontCssUrl(font: string | false): string | null {
|
|
30
|
+
// the theme ships in the host bundle: nothing for the viewer to inject
|
|
31
|
+
if (font === false || font === "none") return null;
|
|
32
|
+
if (font.startsWith("stock:")) {
|
|
33
|
+
const font_name = font.split(":")[1] || "default";
|
|
34
|
+
// A crafted name ("stock:../../secret") would otherwise resolve to an
|
|
35
|
+
// arbitrary same-origin file next to the bundle, because the name is
|
|
36
|
+
// concatenated into a URL path. Only accept a bare theme name.
|
|
37
|
+
if (!/^[a-z0-9-]+$/i.test(font_name)) {
|
|
38
|
+
console.warn(
|
|
39
|
+
"StoryMapJS: ignoring font_css with an invalid stock theme name",
|
|
40
|
+
font_name,
|
|
41
|
+
);
|
|
42
|
+
return new URL(/* @vite-ignore */ "../css/fonts/font.default.css", import.meta.url)
|
|
43
|
+
.href;
|
|
44
|
+
}
|
|
45
|
+
// resolved against the library location: one directory up from
|
|
46
|
+
// src/main.ts (dev) and js/storymap.js (build) in both cases
|
|
47
|
+
return new URL("../css/fonts/font." + font_name + ".css", import.meta.url).href;
|
|
48
|
+
}
|
|
49
|
+
// Absolute URL, protocol-relative, or a data: URL. Note this must be a
|
|
50
|
+
// real URL test, not a `/^(http|https|\/\/)/` prefix check: the old prefix
|
|
51
|
+
// test false-positived on a relative path that merely *starts* with those
|
|
52
|
+
// letters (e.g. "httpfonts.css"), which raised a spurious consent prompt
|
|
53
|
+
// for a same-origin file.
|
|
54
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(font) || font.startsWith("//")) {
|
|
55
|
+
return font;
|
|
56
|
+
}
|
|
57
|
+
return new URL(font, document.baseURI).href;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** True when `url` points off-origin (or at a data: URL) and needs a consent ask. */
|
|
61
|
+
export function isExternalUrl(url: string): boolean {
|
|
62
|
+
// data:/blob: are not off-origin but are not a theme stylesheet either
|
|
63
|
+
if (/^(data|blob):/i.test(url)) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
return new URL(url, document.baseURI).origin !== window.location.origin;
|
|
68
|
+
} catch {
|
|
69
|
+
// unparseable: treat as external, so we err towards asking
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
}
|