@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
package/src/ui/Message.ts
CHANGED
|
@@ -15,12 +15,19 @@ interface MessageOptions {
|
|
|
15
15
|
[key: string]: unknown;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
export interface MessageEvents {
|
|
19
|
+
clicked: MessageOptions;
|
|
20
|
+
loaded: Record<string, unknown>;
|
|
21
|
+
added: Record<string, unknown>;
|
|
22
|
+
removed: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
|
|
18
25
|
class MessageBase {
|
|
19
26
|
declare "_el": Record<string, HTMLElement>;
|
|
20
27
|
declare "options": MessageOptions;
|
|
21
28
|
"data": Record<string, unknown>;
|
|
22
29
|
declare "animator": Record<string, unknown>;
|
|
23
|
-
declare "fire": EventedInstance["fire"];
|
|
30
|
+
declare "fire": EventedInstance<MessageEvents>["fire"];
|
|
24
31
|
|
|
25
32
|
/* Constructor
|
|
26
33
|
================================================== */
|
|
@@ -82,6 +89,12 @@ class MessageBase {
|
|
|
82
89
|
} else {
|
|
83
90
|
this._el.message.innerHTML = t;
|
|
84
91
|
}
|
|
92
|
+
// the container dismisses on click, so it is a button to assistive
|
|
93
|
+
// tech too; its name tracks the message text
|
|
94
|
+
const label = this._el.message.textContent?.trim() ?? "";
|
|
95
|
+
if (label !== "") {
|
|
96
|
+
this._el.container.setAttribute("aria-label", label);
|
|
97
|
+
}
|
|
85
98
|
}
|
|
86
99
|
|
|
87
100
|
/* Events
|
|
@@ -91,10 +104,24 @@ class MessageBase {
|
|
|
91
104
|
this.fire("clicked", this.options);
|
|
92
105
|
}
|
|
93
106
|
|
|
107
|
+
_onKeyDown(e: Event) {
|
|
108
|
+
const key = (e as KeyboardEvent).key;
|
|
109
|
+
if (key === "Enter" || key === " " || key === "Spacebar") {
|
|
110
|
+
e.preventDefault();
|
|
111
|
+
this._onMouseClick();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
94
115
|
/* Private Methods
|
|
95
116
|
================================================== */
|
|
96
117
|
_initLayout() {
|
|
97
118
|
// Create Layout
|
|
119
|
+
// Dismissable by click and keyboard alike (see _onKeyDown): the
|
|
120
|
+
// fixed hook below carries the focus ring, whatever message_class
|
|
121
|
+
// the host configured.
|
|
122
|
+
this._el.container.classList.add("vco-message-dismiss");
|
|
123
|
+
this._el.container.setAttribute("role", "button");
|
|
124
|
+
this._el.container.setAttribute("tabindex", "0");
|
|
98
125
|
this._el.message_container = Dom.create("div", "vco-message-container", this._el.container);
|
|
99
126
|
this._el.loading_icon = Dom.create(
|
|
100
127
|
"div",
|
|
@@ -108,19 +135,25 @@ class MessageBase {
|
|
|
108
135
|
|
|
109
136
|
_initEvents() {
|
|
110
137
|
DomEvent.addListener(this._el.container, "click", this._onMouseClick, this);
|
|
138
|
+
DomEvent.addListener(this._el.container, "keydown", this._onKeyDown, this);
|
|
111
139
|
}
|
|
112
140
|
|
|
113
141
|
/**
|
|
114
|
-
* Release the
|
|
142
|
+
* Release the listeners and drop the element. Called by
|
|
115
143
|
* `StorySlider.dispose()`; the message must not be used afterwards.
|
|
116
144
|
*/
|
|
117
145
|
dispose() {
|
|
118
146
|
DomEvent.removeListener(this._el.container, "click", this._onMouseClick, this);
|
|
147
|
+
DomEvent.removeListener(this._el.container, "keydown", this._onKeyDown, this);
|
|
119
148
|
this._el.container.remove();
|
|
120
149
|
}
|
|
121
150
|
}
|
|
122
151
|
|
|
123
|
-
|
|
152
|
+
const EventedMessageBase = Evented<MessageEvents, typeof MessageBase>(MessageBase);
|
|
153
|
+
|
|
154
|
+
export default class Message extends DomMixed<MessageEvents, typeof EventedMessageBase>(
|
|
155
|
+
EventedMessageBase,
|
|
156
|
+
) {
|
|
124
157
|
constructor(...args: ConstructorParameters<typeof MessageBase>) {
|
|
125
158
|
super(...args);
|
|
126
159
|
}
|
package/src/ui/Swipable.ts
CHANGED
|
@@ -49,7 +49,7 @@ interface SwipableOptions {
|
|
|
49
49
|
|
|
50
50
|
interface DragData {
|
|
51
51
|
sliding: boolean;
|
|
52
|
-
direction:
|
|
52
|
+
direction: SwipeDirection | null;
|
|
53
53
|
pagex: { start: number; end: number };
|
|
54
54
|
pagey: { start: number; end: number };
|
|
55
55
|
pos: { start: { x: number; y: number }; end: { x: number; y: number } };
|
|
@@ -59,6 +59,23 @@ interface DragData {
|
|
|
59
59
|
touch: boolean;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/** The four swipe directions. `"none"` is not one: an undecided gesture
|
|
63
|
+
* carries `null`, and the truthiness guard at the fire site treats it as
|
|
64
|
+
* "no swipe" rather than a fifth direction. */
|
|
65
|
+
export type SwipeDirection = "left" | "right" | "up" | "down";
|
|
66
|
+
|
|
67
|
+
export interface SwipableEvents {
|
|
68
|
+
dragstart: DragData;
|
|
69
|
+
dragend: DragData;
|
|
70
|
+
dragmove: DragData;
|
|
71
|
+
momentum: DragData;
|
|
72
|
+
swipe_left: DragData;
|
|
73
|
+
swipe_right: DragData;
|
|
74
|
+
swipe_up: DragData;
|
|
75
|
+
swipe_down: DragData;
|
|
76
|
+
swipe_nodirection: DragData;
|
|
77
|
+
}
|
|
78
|
+
|
|
62
79
|
class SwipableBase {
|
|
63
80
|
declare "mousedrag": DragEventNames;
|
|
64
81
|
declare "touchdrag": DragEventNames;
|
|
@@ -67,7 +84,7 @@ class SwipableBase {
|
|
|
67
84
|
declare "animator": AnimationHandle | null;
|
|
68
85
|
declare "dragevent": DragEventNames;
|
|
69
86
|
declare "data": DragData;
|
|
70
|
-
declare "fire": EventedInstance["fire"];
|
|
87
|
+
declare "fire": EventedInstance<SwipableEvents>["fire"];
|
|
71
88
|
|
|
72
89
|
//_el: {},
|
|
73
90
|
|
|
@@ -124,7 +141,7 @@ class SwipableBase {
|
|
|
124
141
|
// Draggable Data
|
|
125
142
|
this.data = {
|
|
126
143
|
sliding: false,
|
|
127
|
-
direction:
|
|
144
|
+
direction: null,
|
|
128
145
|
pagex: {
|
|
129
146
|
start: 0,
|
|
130
147
|
end: 0,
|
|
@@ -405,9 +422,10 @@ class SwipableBase {
|
|
|
405
422
|
}
|
|
406
423
|
}
|
|
407
424
|
this._animateMomentum();
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
425
|
+
const direction = this.data.direction;
|
|
426
|
+
if (swipe && direction) {
|
|
427
|
+
this.fire(`swipe_${direction}`, this.data);
|
|
428
|
+
} else if (direction) {
|
|
411
429
|
this.fire("swipe_nodirection", this.data);
|
|
412
430
|
} else if (this.options.snap) {
|
|
413
431
|
this.animator?.stop();
|
|
@@ -448,7 +466,7 @@ class SwipableBase {
|
|
|
448
466
|
}
|
|
449
467
|
}
|
|
450
468
|
|
|
451
|
-
export default class Swipable extends Evented(SwipableBase) {
|
|
469
|
+
export default class Swipable extends Evented<SwipableEvents, typeof SwipableBase>(SwipableBase) {
|
|
452
470
|
constructor(...args: ConstructorParameters<typeof SwipableBase>) {
|
|
453
471
|
super(...args);
|
|
454
472
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./modulepreload-polyfill-P2Xu9kJm.js";import{t as e}from"./main-DXalctuR.js";import{n as t,t as n}from"./harness-support-Do7sIp2j.js";window.__smErrors=[],window.__smReady=!1,window.addEventListener(`error`,e=>{window.__smErrors.push(String(e.message||e))});var r=new URLSearchParams(window.location.search),i=r.get(`manifest`),a=r.get(`url`),o=i===null?r.get(`example`):i,s=i===null?`/examples/`:`/examples-iiif/`,c={};if(r.get(`options`))try{c=JSON.parse(r.get(`options`))}catch(e){window.__smErrors.push(`harness: bad options param: `+e)}var l=t(window);l&&(c.tile_source_factory=l);var u=a??s+o+`.json`;fetch(u).then(e=>e.json()).then(t=>{let i=new e(`storymap-embed`,t,c,{});window.__sm=i,n(i,r.get(`record`),window),window.__smReady=!0}).catch(e=>{window.__smErrors.push(`harness: `+(e&&e.message?e.message:String(e))),window.__smReady=!0});
|