@gramps-connect/story 0.7.1 → 0.7.2

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.
Files changed (67) hide show
  1. package/dist/editor.js +34 -6
  2. package/dist/editor.js.map +2 -2
  3. package/dist/embed.js +41 -41
  4. package/dist/index.js.map +1 -1
  5. package/dist/map-edit.js.map +1 -1
  6. package/dist/player.js +32 -5
  7. package/dist/player.js.map +2 -2
  8. package/dist/types/editor/DateField.d.ts +3 -3
  9. package/dist/types/editor/MapEditor.d.ts +5 -4
  10. package/dist/types/editor/PhotosField.d.ts +2 -2
  11. package/dist/types/editor/PlaceField.d.ts +4 -4
  12. package/dist/types/editor/PlaceMap.d.ts +2 -2
  13. package/dist/types/editor/PlaceMapDialog.d.ts +4 -4
  14. package/dist/types/editor/StoryEditor.d.ts +7 -7
  15. package/dist/types/editor/index.d.ts +14 -14
  16. package/dist/types/editor/model.d.ts +1 -1
  17. package/dist/types/editor/placeShapes.d.ts +2 -2
  18. package/dist/types/editor/strings.d.ts +1 -1
  19. package/dist/types/editor/translations/de.d.ts +2 -2
  20. package/dist/types/editor/translations/es.d.ts +2 -2
  21. package/dist/types/editor/translations/fr.d.ts +2 -2
  22. package/dist/types/editor/translations/index.d.ts +2 -2
  23. package/dist/types/editor/translations/nl.d.ts +2 -2
  24. package/dist/types/index.d.ts +5 -5
  25. package/dist/types/mapEdit/index.d.ts +3 -3
  26. package/dist/types/mapEdit/mapFile.d.ts +1 -1
  27. package/dist/types/player/MapBackground.d.ts +3 -3
  28. package/dist/types/player/MapModeControl.d.ts +2 -2
  29. package/dist/types/player/StoryPlayer.d.ts +4 -4
  30. package/dist/types/player/TimelineStrip.d.ts +1 -1
  31. package/dist/types/player/dates.d.ts +1 -1
  32. package/dist/types/player/geo.d.ts +1 -1
  33. package/dist/types/player/index.d.ts +10 -10
  34. package/dist/types/version.d.ts +1 -1
  35. package/dist/types/zip.d.ts +3 -3
  36. package/package.json +2 -2
  37. package/src/editor/DateField.tsx +5 -5
  38. package/src/editor/MapEditor.tsx +10 -8
  39. package/src/editor/PhotosField.tsx +2 -2
  40. package/src/editor/PlaceField.tsx +6 -6
  41. package/src/editor/PlaceMap.tsx +5 -5
  42. package/src/editor/PlaceMapDialog.tsx +11 -11
  43. package/src/editor/StoryEditor.tsx +18 -18
  44. package/src/editor/index.ts +14 -14
  45. package/src/editor/mapEditorStrings.ts +1 -1
  46. package/src/editor/model.ts +2 -2
  47. package/src/editor/placeShapes.ts +3 -3
  48. package/src/editor/strings.ts +1 -1
  49. package/src/editor/translations/de.ts +2 -2
  50. package/src/editor/translations/es.ts +2 -2
  51. package/src/editor/translations/fr.ts +2 -2
  52. package/src/editor/translations/index.ts +6 -6
  53. package/src/editor/translations/nl.ts +2 -2
  54. package/src/embed/index.tsx +2 -2
  55. package/src/index.ts +5 -5
  56. package/src/mapEdit/index.ts +3 -3
  57. package/src/mapEdit/mapFile.ts +1 -1
  58. package/src/player/MapBackground.tsx +5 -5
  59. package/src/player/MapModeControl.tsx +2 -2
  60. package/src/player/StoryPlayer.tsx +50 -13
  61. package/src/player/TimelineStrip.tsx +2 -2
  62. package/src/player/dates.ts +1 -1
  63. package/src/player/geo.ts +1 -1
  64. package/src/player/index.ts +10 -10
  65. package/src/validate.ts +2 -2
  66. package/src/version.ts +1 -1
  67. package/src/zip.ts +3 -3
@@ -1,11 +1,11 @@
1
1
  import { type ReactNode } from "react";
2
- import type { StoryDoc } from "../types";
3
- import type { PlayerStrings } from "../player/strings";
4
- import { type DateTextParser } from "./dates";
5
- import { type NewImage } from "./model";
6
- import type { MapEditorStrings } from "./mapEditorStrings";
7
- import { type PlaceSearch } from "./placeSearch";
8
- import { type EditorStrings } from "./strings";
2
+ import type { StoryDoc } from "../types.js";
3
+ import type { PlayerStrings } from "../player/strings.js";
4
+ import { type DateTextParser } from "./dates.js";
5
+ import { type NewImage } from "./model.js";
6
+ import type { MapEditorStrings } from "./mapEditorStrings.js";
7
+ import { type PlaceSearch } from "./placeSearch.js";
8
+ import { type EditorStrings } from "./strings.js";
9
9
  export interface StoryEditorProps {
10
10
  /** The story to start from, and its files (paths as in media `src`).
11
11
  * Changing these later has no effect: remount (a new `key`) to edit
@@ -1,14 +1,14 @@
1
- export { prepareImage, StoryEditor, type StoryEditorProps } from "./StoryEditor";
2
- export { MapEditor, MapEditorHelp, type MapEditorHandle, type MapEditorOverlay, type MapEditorProps, type MapEditorResult, type MapEditorStatus, } from "./MapEditor";
3
- export { MAP_EDITOR_ENGLISH, mapEditorStringsFor, type MapEditorStrings } from "./mapEditorStrings";
4
- export { PhotosField, type PhotosFieldProps } from "./PhotosField";
5
- export { PlaceField, type PlaceFieldProps, type PlaceUpdate } from "./PlaceField";
6
- export { PlaceMapDialog, type PlaceMapDialogProps } from "./PlaceMapDialog";
7
- export { editorToPlace, placeFeatures, placeToEditor } from "./placeShapes";
8
- export { searchWikidataPlaces, wikidataPoint, WIKIDATA_PLACE_SEARCH, type PlaceSearch, type PlaceSearchResult } from "./placeSearch";
9
- export { StoryTextField, type StoryTextFieldProps } from "./StoryTextField";
10
- export { SlideList, type SlideListProps } from "./SlideList";
11
- export { DateField, type DateFieldProps } from "./DateField";
12
- export { suggestEdtf, type DateTextParser } from "./dates";
13
- export { browserLanguages, EDITOR_ENGLISH, EDITOR_LANGUAGES, editorLanguage, editorStringsFor, type EditorStrings } from "./strings";
14
- export { addImage, addSlide, blankStory, COALESCE_MS, deleteSlide, duplicateSlide, findMedia, formatLatLon, moveSlide, nextSlideId, parseLatLon, patchPlace, pruneMedia, record, redo, roundDegrees, setSlidePhotos, slideDate, startHistory, storyFileName, storyPlaceChoices, undo, updateMedia, updateSlide, updateStory, usedMedia, type History, type NewImage, } from "./model";
1
+ export { prepareImage, StoryEditor, type StoryEditorProps } from "./StoryEditor.js";
2
+ export { MapEditor, MapEditorHelp, type MapEditorHandle, type MapEditorOverlay, type MapEditorProps, type MapEditorResult, type MapEditorStatus, } from "./MapEditor.js";
3
+ export { MAP_EDITOR_ENGLISH, mapEditorStringsFor, type MapEditorStrings } from "./mapEditorStrings.js";
4
+ export { PhotosField, type PhotosFieldProps } from "./PhotosField.js";
5
+ export { PlaceField, type PlaceFieldProps, type PlaceUpdate } from "./PlaceField.js";
6
+ export { PlaceMapDialog, type PlaceMapDialogProps } from "./PlaceMapDialog.js";
7
+ export { editorToPlace, placeFeatures, placeToEditor } from "./placeShapes.js";
8
+ export { searchWikidataPlaces, wikidataPoint, WIKIDATA_PLACE_SEARCH, type PlaceSearch, type PlaceSearchResult } from "./placeSearch.js";
9
+ export { StoryTextField, type StoryTextFieldProps } from "./StoryTextField.js";
10
+ export { SlideList, type SlideListProps } from "./SlideList.js";
11
+ export { DateField, type DateFieldProps } from "./DateField.js";
12
+ export { suggestEdtf, type DateTextParser } from "./dates.js";
13
+ export { browserLanguages, EDITOR_ENGLISH, EDITOR_LANGUAGES, editorLanguage, editorStringsFor, type EditorStrings } from "./strings.js";
14
+ export { addImage, addSlide, blankStory, COALESCE_MS, deleteSlide, duplicateSlide, findMedia, formatLatLon, moveSlide, nextSlideId, parseLatLon, patchPlace, pruneMedia, record, redo, roundDegrees, setSlidePhotos, slideDate, startHistory, storyFileName, storyPlaceChoices, undo, updateMedia, updateSlide, updateStory, usedMedia, type History, type NewImage, } from "./model.js";
@@ -1,4 +1,4 @@
1
- import type { MediaItem, Place, Slide, SlideMedia, StoryDate, StoryDoc } from "../types";
1
+ import type { MediaItem, Place, Slide, SlideMedia, StoryDate, StoryDoc } from "../types.js";
2
2
  /** A story with one empty slide: the smallest valid one. */
3
3
  export declare function blankStory(title: string, language?: string): StoryDoc;
4
4
  /** "s<n>" past every id already of that form, so it's unique however the
@@ -1,6 +1,6 @@
1
1
  import type { Feature } from "geojson";
2
- import type { Place, StoryDate } from "../types";
3
- import type { MapEditorOverlay, MapEditorResult } from "./MapEditor";
2
+ import type { Place, StoryDate } from "../types.js";
3
+ import type { MapEditorOverlay, MapEditorResult } from "./MapEditor.js";
4
4
  /** The features in a place's `geometry`, whichever form it takes. */
5
5
  export declare function placeFeatures(place: Place | undefined): Feature[];
6
6
  /** What the map editor opens with for a place. */
@@ -89,7 +89,7 @@ export declare function browserLanguages(): readonly string[];
89
89
  export declare function editorLanguage(languages: readonly (string | undefined)[]): string | undefined;
90
90
  /** The translations for the first of `languages` the editors have;
91
91
  * none for English. */
92
- export declare function translationFor(languages: readonly (string | undefined)[]): import("./translations").EditorTranslation | undefined;
92
+ export declare function translationFor(languages: readonly (string | undefined)[]): import("./translations/index.js").EditorTranslation | undefined;
93
93
  /** The editor's words in the first of `languages` it has; English when
94
94
  * none. */
95
95
  export declare function editorStringsFor(...languages: (string | undefined)[]): EditorStrings;
@@ -1,4 +1,4 @@
1
- import type { EditorStrings } from "../strings";
2
- import type { MapEditorStrings } from "../mapEditorStrings";
1
+ import type { EditorStrings } from "../strings.js";
2
+ import type { MapEditorStrings } from "../mapEditorStrings.js";
3
3
  export declare const editor: EditorStrings;
4
4
  export declare const mapEditor: MapEditorStrings;
@@ -1,4 +1,4 @@
1
- import type { EditorStrings } from "../strings";
2
- import type { MapEditorStrings } from "../mapEditorStrings";
1
+ import type { EditorStrings } from "../strings.js";
2
+ import type { MapEditorStrings } from "../mapEditorStrings.js";
3
3
  export declare const editor: EditorStrings;
4
4
  export declare const mapEditor: MapEditorStrings;
@@ -1,4 +1,4 @@
1
- import type { EditorStrings } from "../strings";
2
- import type { MapEditorStrings } from "../mapEditorStrings";
1
+ import type { EditorStrings } from "../strings.js";
2
+ import type { MapEditorStrings } from "../mapEditorStrings.js";
3
3
  export declare const editor: EditorStrings;
4
4
  export declare const mapEditor: MapEditorStrings;
@@ -1,5 +1,5 @@
1
- import type { EditorStrings } from "../strings";
2
- import type { MapEditorStrings } from "../mapEditorStrings";
1
+ import type { EditorStrings } from "../strings.js";
2
+ import type { MapEditorStrings } from "../mapEditorStrings.js";
3
3
  export interface EditorTranslation {
4
4
  editor: EditorStrings;
5
5
  mapEditor: MapEditorStrings;
@@ -1,4 +1,4 @@
1
- import type { EditorStrings } from "../strings";
2
- import type { MapEditorStrings } from "../mapEditorStrings";
1
+ import type { EditorStrings } from "../strings.js";
2
+ import type { MapEditorStrings } from "../mapEditorStrings.js";
3
3
  export declare const editor: EditorStrings;
4
4
  export declare const mapEditor: MapEditorStrings;
@@ -1,5 +1,5 @@
1
- export type { LonLat, MediaItem, Overlay, Place, Presentation, Slide, SlideMedia, StoryDate, StoryDoc, } from "./types";
2
- export { CURRENT_MAJOR, FORMAT_ID, FORMAT_VERSION, parseVersion, StoryFormatError, SUPPORTED_FORMAT_MAJORS, upgradeStory, type ParsedVersion, type StoryErrorCode, } from "./version";
3
- export { validate, type StoryIssue, type ValidationResult } from "./validate";
4
- export { mediaBlob, readStoryZip, StoryValidationError, writeStoryZip, type ReadLimits, type StoryPackage, } from "./zip";
5
- export { DEFAULT_MAX_EDGE, encodingCandidates, fitWithin, optimizeImage, type ImagePurpose, type OptimizedImage, type OptimizeOptions, } from "./image";
1
+ export type { LonLat, MediaItem, Overlay, Place, Presentation, Slide, SlideMedia, StoryDate, StoryDoc, } from "./types.js";
2
+ export { CURRENT_MAJOR, FORMAT_ID, FORMAT_VERSION, parseVersion, StoryFormatError, SUPPORTED_FORMAT_MAJORS, upgradeStory, type ParsedVersion, type StoryErrorCode, } from "./version.js";
3
+ export { validate, type StoryIssue, type ValidationResult } from "./validate.js";
4
+ export { mediaBlob, readStoryZip, StoryValidationError, writeStoryZip, type ReadLimits, type StoryPackage, } from "./zip.js";
5
+ export { DEFAULT_MAX_EDGE, encodingCandidates, fitWithin, optimizeImage, type ImagePurpose, type OptimizedImage, type OptimizeOptions, } from "./image.js";
@@ -1,3 +1,3 @@
1
- export { addToSession, assembleForSaving, lockPart, prepareForEditing, type EditableGeometry, type EditablePart, type EditMode, type EditSession, type SavedPart, } from "./model";
2
- export { IMAGE_OVERLAY_PROPERTY, isKmlLine, isKmlRegion, lineCoordsOf, mapItemToGeoJson, MEDIA_HANDLE_PREFIX, overlaySourceOfText, parseMapFile, polygonRingsOf, SOURCE_PROPERTY, type ImageOverlay, } from "./mapFile";
3
- export { cornersFromBox, kmlBounds, kmlCenter, kmlOverlayBounds, kmlOverlayCenter, mercatorBearing, mercatorDistance, rotatePoint, scalePoint, unionBounds, type OverlayCorners, } from "./geometry";
1
+ export { addToSession, assembleForSaving, lockPart, prepareForEditing, type EditableGeometry, type EditablePart, type EditMode, type EditSession, type SavedPart, } from "./model.js";
2
+ export { IMAGE_OVERLAY_PROPERTY, isKmlLine, isKmlRegion, lineCoordsOf, mapItemToGeoJson, MEDIA_HANDLE_PREFIX, overlaySourceOfText, parseMapFile, polygonRingsOf, SOURCE_PROPERTY, type ImageOverlay, } from "./mapFile.js";
3
+ export { cornersFromBox, kmlBounds, kmlCenter, kmlOverlayBounds, kmlOverlayCenter, mercatorBearing, mercatorDistance, rotatePoint, scalePoint, unionBounds, type OverlayCorners, } from "./geometry.js";
@@ -1,5 +1,5 @@
1
1
  import type { Feature, Position } from "geojson";
2
- import type { OverlayCorners } from "./geometry";
2
+ import type { OverlayCorners } from "./geometry.js";
3
3
  /** An image overlay's picture, as a Media handle behind this marker (not a
4
4
  * real URL: an app-internal reference, since a resolvable link would need
5
5
  * an expiring auth token baked in) -- in a KML GroundOverlay's href, and
@@ -1,7 +1,7 @@
1
1
  import "maplibre-gl/dist/maplibre-gl.css";
2
- import type { Place } from "../types";
3
- import { type StoryPlaces } from "./geo";
4
- import { type PlayerColors } from "./theme";
2
+ import type { Place } from "../types.js";
3
+ import { type StoryPlaces } from "./geo.js";
4
+ import { type PlayerColors } from "./theme.js";
5
5
  /** The current slide, as far as the map cares. `key` is the slide id:
6
6
  * what tells "a new slide" from "the same slide, re-rendered". */
7
7
  export interface MapSlide {
@@ -1,5 +1,5 @@
1
- import type { PlayerStrings } from "./strings";
2
- import type { PlayerColors } from "./theme";
1
+ import type { PlayerStrings } from "./strings.js";
2
+ import type { PlayerColors } from "./theme.js";
3
3
  /** "standard" is today's map; "historical" a map of the year the viewer
4
4
  * picks; "auto" a map of each slide's own year as the story moves. */
5
5
  export type MapMode = "auto" | "standard" | "historical";
@@ -1,8 +1,8 @@
1
1
  import { type ReactNode } from "react";
2
- import type { MediaItem, StoryDoc } from "../types";
3
- import { type MapModeControlProps } from "./MapModeControl";
4
- import { type PlayerStrings } from "./strings";
5
- import { type PlayerColors } from "./theme";
2
+ import type { MediaItem, StoryDoc } from "../types.js";
3
+ import { type MapModeControlProps } from "./MapModeControl.js";
4
+ import { type PlayerStrings } from "./strings.js";
5
+ import { type PlayerColors } from "./theme.js";
6
6
  export interface StoryPlayerProps {
7
7
  story: StoryDoc;
8
8
  /** A URL the browser can load for a media key: a blob: URL for a file
@@ -1,4 +1,4 @@
1
- import { type PlayerColors } from "./theme";
1
+ import { type PlayerColors } from "./theme.js";
2
2
  export declare const TIMELINE_HEIGHT = 70;
3
3
  export interface TimelinePoint {
4
4
  index: number;
@@ -1,4 +1,4 @@
1
- import type { StoryDate } from "../types";
1
+ import type { StoryDate } from "../types.js";
2
2
  export interface YearRange {
3
3
  /** Undefined for an open start ("../1850"). */
4
4
  min?: number;
@@ -1,4 +1,4 @@
1
- import type { LonLat, Place } from "../types";
1
+ import type { LonLat, Place } from "../types.js";
2
2
  export type Bounds = [west: number, south: number, east: number, north: number];
3
3
  /** The box around a place's shape and overlays, or null when it has
4
4
  * neither (or they hold no coordinates). */
@@ -1,10 +1,10 @@
1
- export { StoryPlayer, type StoryPlayerProps } from "./StoryPlayer";
2
- export { VIEWER_NAME, VIEWER_URL, ViewerBrand, ViewerIcon, type ViewerBrandProps } from "./brand";
3
- export { MapModeControl, type MapMode, type MapModeControlProps } from "./MapModeControl";
4
- export { defaultColors, PIN_PATH_D, type PlayerColors } from "./theme";
5
- export { ENGLISH, PLAYER_LANGUAGES, stringsFor, type PlayerStrings } from "./strings";
6
- export { parseStoryText, type ParsedText, type TextSpan } from "./text";
7
- export { dateCoversYear, edtfYearRange, timelineYear, type YearRange } from "./dates";
8
- export { placeBounds, placeCenter, type Bounds } from "./geo";
9
- export { axisTicks, storyDomain, tickLabel, xForYear, type AxisTick } from "./timelineLayout";
10
- export { applyOhmYear, crossfadeStyleSwap, mapStyleKey, mapStyleUrl, OHM_STYLE, STYLE_DARK, STYLE_LIGHT, } from "./mapStyles";
1
+ export { StoryPlayer, type StoryPlayerProps } from "./StoryPlayer.js";
2
+ export { VIEWER_NAME, VIEWER_URL, ViewerBrand, ViewerIcon, type ViewerBrandProps } from "./brand.js";
3
+ export { MapModeControl, type MapMode, type MapModeControlProps } from "./MapModeControl.js";
4
+ export { defaultColors, PIN_PATH_D, type PlayerColors } from "./theme.js";
5
+ export { ENGLISH, PLAYER_LANGUAGES, stringsFor, type PlayerStrings } from "./strings.js";
6
+ export { parseStoryText, type ParsedText, type TextSpan } from "./text.js";
7
+ export { dateCoversYear, edtfYearRange, timelineYear, type YearRange } from "./dates.js";
8
+ export { placeBounds, placeCenter, type Bounds } from "./geo.js";
9
+ export { axisTicks, storyDomain, tickLabel, xForYear, type AxisTick } from "./timelineLayout.js";
10
+ export { applyOhmYear, crossfadeStyleSwap, mapStyleKey, mapStyleUrl, OHM_STYLE, STYLE_DARK, STYLE_LIGHT, } from "./mapStyles.js";
@@ -1,4 +1,4 @@
1
- import type { StoryDoc } from "./types";
1
+ import type { StoryDoc } from "./types.js";
2
2
  export declare const FORMAT_ID = "gramps-connect-story";
3
3
  /** The version this package writes. */
4
4
  export declare const FORMAT_VERSION = "1.0";
@@ -1,6 +1,6 @@
1
- import { StoryFormatError } from "./version";
2
- import { type StoryIssue } from "./validate";
3
- import type { StoryDoc } from "./types";
1
+ import { StoryFormatError } from "./version.js";
2
+ import { type StoryIssue } from "./validate.js";
3
+ import type { StoryDoc } from "./types.js";
4
4
  export interface StoryPackage {
5
5
  doc: StoryDoc;
6
6
  /** Every file under the story root, keyed by its path relative to that
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gramps-connect/story",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Read, write, validate and present .story.zip files: portable, versioned family-history stories.",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "type": "module",
@@ -68,7 +68,7 @@
68
68
  "test:python": "${PYTHON:-python3} -m unittest discover -s python && tsx scripts/test-python.ts"
69
69
  },
70
70
  "dependencies": {
71
- "@gramps-connect/gramps-date": "^0.1.0",
71
+ "@gramps-connect/gramps-date": "^0.1.1",
72
72
  "@openhistoricalmap/maplibre-gl-dates": "^1.4.0",
73
73
  "@tmcw/togeojson": "^7.1.2",
74
74
  "fflate": "^0.8.3"
@@ -2,11 +2,11 @@
2
2
  // follows the text as it's typed until someone changes it by hand.
3
3
  import { useEffect, useRef, useState } from "react";
4
4
  import { Anchor, Group, Stack, Text, TextInput } from "@mantine/core";
5
- import type { StoryDate } from "../types";
6
- import { edtfYearRange } from "../player/dates";
7
- import type { DateTextParser } from "./dates";
8
- import { slideDate } from "./model";
9
- import type { EditorStrings } from "./strings";
5
+ import type { StoryDate } from "../types.js";
6
+ import { edtfYearRange } from "../player/dates.js";
7
+ import type { DateTextParser } from "./dates.js";
8
+ import { slideDate } from "./model.js";
9
+ import type { EditorStrings } from "./strings.js";
10
10
 
11
11
  export interface DateFieldProps {
12
12
  value: StoryDate | undefined;
@@ -32,11 +32,11 @@ import {
32
32
  import {
33
33
  addToSession, assembleForSaving, lockPart, mercatorBearing, mercatorDistance, prepareForEditing, rotatePoint, scalePoint,
34
34
  type EditableGeometry, type EditablePart, type EditSession, type OverlayCorners, type SavedPart,
35
- } from "../mapEdit";
36
- import { mapStyleUrl } from "../player/mapStyles";
37
- import { defaultColors } from "../player/theme";
38
- import { mapEditorStringsFor, type MapEditorStrings } from "./mapEditorStrings";
39
- import { browserLanguages } from "./strings";
35
+ } from "../mapEdit/index.js";
36
+ import { mapStyleUrl } from "../player/mapStyles.js";
37
+ import { defaultColors } from "../player/theme.js";
38
+ import { mapEditorStringsFor, type MapEditorStrings } from "./mapEditorStrings.js";
39
+ import { browserLanguages } from "./strings.js";
40
40
 
41
41
  type DrawMode = "point" | "linestring" | "polygon" | "rectangle" | "select";
42
42
 
@@ -95,9 +95,10 @@ export interface MapEditorHandle {
95
95
  * north], or null with nothing there yet. */
96
96
  drawnBounds: () => [number, number, number, number] | null;
97
97
  /** Places an image in the middle of the current view, at its own aspect
98
- * ratio, and selects it. False if that image is already one of the
98
+ * ratio, and selects it, starting with `name` (e.g. the image's own
99
+ * description) if given. False if that image is already one of the
99
100
  * overlays. Throws if it can't be loaded. */
100
- addImage: (image: string) => Promise<boolean>;
101
+ addImage: (image: string, name?: string) => Promise<boolean>;
101
102
  /** Adds shapes (an imported map file's, see parseMapFile) after what's
102
103
  * there, and frames them. */
103
104
  addFeatures: (features: Feature[]) => void;
@@ -1267,7 +1268,7 @@ export const MapEditor = forwardRef<MapEditorHandle, MapEditorProps>(function Ma
1267
1268
  for (const overlay of overlaysRef.current) for (const corner of overlay.corners) bounds.extend(corner);
1268
1269
  return bounds.isEmpty() ? null : (bounds.toArray().flat() as [number, number, number, number]);
1269
1270
  },
1270
- async addImage(image: string) {
1271
+ async addImage(image: string, name?: string) {
1271
1272
  // The same image placed twice has no use: in Gramps Connect an
1272
1273
  // overlay's dates are its place's, so a second copy couldn't even be
1273
1274
  // given a different era -- it would just always show (or not) in
@@ -1288,6 +1289,7 @@ export const MapEditor = forwardRef<MapEditorHandle, MapEditorProps>(function Ma
1288
1289
  const draft: ImageOverlayDraft = {
1289
1290
  id: crypto.randomUUID(),
1290
1291
  image,
1292
+ ...(name?.trim() ? { name: name.trim() } : {}),
1291
1293
  corners: [
1292
1294
  [topLeft.lng, topLeft.lat], [bottomRight.lng, topLeft.lat],
1293
1295
  [bottomRight.lng, bottomRight.lat], [topLeft.lng, bottomRight.lat],
@@ -4,8 +4,8 @@
4
4
  // store; this only says what was chosen.
5
5
  import { useEffect, useRef, useState, type DragEvent } from "react";
6
6
  import { ActionIcon, Box, Button, Group, Loader, Stack, Text, TextInput, Tooltip } from "@mantine/core";
7
- import type { MediaItem, SlideMedia } from "../types";
8
- import type { EditorStrings } from "./strings";
7
+ import type { MediaItem, SlideMedia } from "../types.js";
8
+ import type { EditorStrings } from "./strings.js";
9
9
 
10
10
  export interface PhotosFieldProps {
11
11
  photos: SlideMedia[];
@@ -6,12 +6,12 @@
6
6
  // always kept.
7
7
  import { useEffect, useMemo, useRef, useState } from "react";
8
8
  import { Autocomplete, Button, Group, Loader, Stack, Text, TextInput, Tooltip, UnstyledButton } from "@mantine/core";
9
- import type { Place } from "../types";
10
- import type { Bounds } from "../player/geo";
11
- import { formatLatLon, parseLatLon, patchPlace, roundDegrees } from "./model";
12
- import { PlaceMap } from "./PlaceMap";
13
- import type { PlaceSearch, PlaceSearchResult } from "./placeSearch";
14
- import type { EditorStrings } from "./strings";
9
+ import type { Place } from "../types.js";
10
+ import type { Bounds } from "../player/geo.js";
11
+ import { formatLatLon, parseLatLon, patchPlace, roundDegrees } from "./model.js";
12
+ import { PlaceMap } from "./PlaceMap.js";
13
+ import type { PlaceSearch, PlaceSearchResult } from "./placeSearch.js";
14
+ import type { EditorStrings } from "./strings.js";
15
15
 
16
16
  export type PlaceUpdate = (place: Place | undefined) => Place | undefined;
17
17
 
@@ -5,11 +5,11 @@ import { useEffect, useRef } from "react";
5
5
  import * as maplibregl from "maplibre-gl";
6
6
  import "maplibre-gl/dist/maplibre-gl.css";
7
7
  import type { Map as MapLibreMap, Marker as MapLibreMarker } from "maplibre-gl";
8
- import type { LonLat } from "../types";
9
- import type { Bounds } from "../player/geo";
10
- import { mapStyleUrl } from "../player/mapStyles";
11
- import { defaultColors, PIN_PATH_D } from "../player/theme";
12
- import { roundDegrees } from "./model";
8
+ import type { LonLat } from "../types.js";
9
+ import type { Bounds } from "../player/geo.js";
10
+ import { mapStyleUrl } from "../player/mapStyles.js";
11
+ import { defaultColors, PIN_PATH_D } from "../player/theme.js";
12
+ import { roundDegrees } from "./model.js";
13
13
 
14
14
  export interface PlaceMapProps {
15
15
  point: LonLat | null;
@@ -4,17 +4,17 @@
4
4
  // place and any images added, as one change; Cancel drops them.
5
5
  import { useMemo, useRef, useState } from "react";
6
6
  import { ActionIcon, Box, Button, Group, Modal, Stack, Text, TextInput, Tooltip } from "@mantine/core";
7
- import type { MediaItem, Place, StoryDate, StoryDoc } from "../types";
8
- import { optimizeImage } from "../image";
9
- import { parseMapFile } from "../mapEdit";
10
- import { storyPlaces } from "../player/geo";
11
- import { edtfYearRange } from "../player/dates";
12
- import type { DateTextParser } from "./dates";
13
- import { MapEditor, MapEditorHelp, type MapEditorHandle } from "./MapEditor";
14
- import type { MapEditorStrings } from "./mapEditorStrings";
15
- import { addImage, slideDate, type NewImage } from "./model";
16
- import { editorToPlace, placeToEditor } from "./placeShapes";
17
- import type { EditorStrings } from "./strings";
7
+ import type { MediaItem, Place, StoryDate, StoryDoc } from "../types.js";
8
+ import { optimizeImage } from "../image.js";
9
+ import { parseMapFile } from "../mapEdit/index.js";
10
+ import { storyPlaces } from "../player/geo.js";
11
+ import { edtfYearRange } from "../player/dates.js";
12
+ import type { DateTextParser } from "./dates.js";
13
+ import { MapEditor, MapEditorHelp, type MapEditorHandle } from "./MapEditor.js";
14
+ import type { MapEditorStrings } from "./mapEditorStrings.js";
15
+ import { addImage, slideDate, type NewImage } from "./model.js";
16
+ import { editorToPlace, placeToEditor } from "./placeShapes.js";
17
+ import type { EditorStrings } from "./strings.js";
18
18
 
19
19
  const BAR_HEIGHT = 56;
20
20
 
@@ -11,27 +11,27 @@ import {
11
11
  ActionIcon, Badge, Box, Button, Divider, Group, Modal, Popover, Select, Stack, Text, TextInput, Tooltip, UnstyledButton,
12
12
  } from "@mantine/core";
13
13
  import { useMediaQuery } from "@mantine/hooks";
14
- import type { MediaItem, Slide, SlideMedia, StoryDoc } from "../types";
15
- import { optimizeImage } from "../image";
16
- import { validate, type StoryIssue } from "../validate";
17
- import { storyPlaces } from "../player/geo";
18
- import { StoryPlayer } from "../player/StoryPlayer";
19
- import type { PlayerStrings } from "../player/strings";
20
- import { suggestEdtf, type DateTextParser } from "./dates";
21
- import { DateField } from "./DateField";
14
+ import type { MediaItem, Slide, SlideMedia, StoryDoc } from "../types.js";
15
+ import { optimizeImage } from "../image.js";
16
+ import { validate, type StoryIssue } from "../validate.js";
17
+ import { storyPlaces } from "../player/geo.js";
18
+ import { StoryPlayer } from "../player/StoryPlayer.js";
19
+ import type { PlayerStrings } from "../player/strings.js";
20
+ import { suggestEdtf, type DateTextParser } from "./dates.js";
21
+ import { DateField } from "./DateField.js";
22
22
  import {
23
23
  addImage, addSlide, deleteSlide, findMedia, duplicateSlide, moveSlide, record, redo, setSlidePhotos, startHistory, storyPlaceChoices,
24
24
  undo, updateMedia, updateSlide, updateStory, type History, type NewImage,
25
- } from "./model";
26
- import { PhotosField } from "./PhotosField";
27
- import { PlaceField, type PlaceUpdate } from "./PlaceField";
28
- import { PlaceMapDialog } from "./PlaceMapDialog";
29
- import type { MapEditorStrings } from "./mapEditorStrings";
30
- import { WIKIDATA_PLACE_SEARCH, type PlaceSearch } from "./placeSearch";
31
- import { SlideList } from "./SlideList";
32
- import { StoryTextField } from "./StoryTextField";
33
- import { browserLanguages, editorStringsFor, type EditorStrings } from "./strings";
34
- import { mapEditorStringsFor } from "./mapEditorStrings";
25
+ } from "./model.js";
26
+ import { PhotosField } from "./PhotosField.js";
27
+ import { PlaceField, type PlaceUpdate } from "./PlaceField.js";
28
+ import { PlaceMapDialog } from "./PlaceMapDialog.js";
29
+ import type { MapEditorStrings } from "./mapEditorStrings.js";
30
+ import { WIKIDATA_PLACE_SEARCH, type PlaceSearch } from "./placeSearch.js";
31
+ import { SlideList } from "./SlideList.js";
32
+ import { StoryTextField } from "./StoryTextField.js";
33
+ import { browserLanguages, editorStringsFor, type EditorStrings } from "./strings.js";
34
+ import { mapEditorStringsFor } from "./mapEditorStrings.js";
35
35
 
36
36
  const BAR_HEIGHT = 56;
37
37
  /** The story's own settings, in place of a slide index. */
@@ -1,21 +1,21 @@
1
- export { prepareImage, StoryEditor, type StoryEditorProps } from "./StoryEditor";
1
+ export { prepareImage, StoryEditor, type StoryEditorProps } from "./StoryEditor.js";
2
2
  export {
3
3
  MapEditor, MapEditorHelp, type MapEditorHandle, type MapEditorOverlay, type MapEditorProps, type MapEditorResult, type MapEditorStatus,
4
- } from "./MapEditor";
5
- export { MAP_EDITOR_ENGLISH, mapEditorStringsFor, type MapEditorStrings } from "./mapEditorStrings";
6
- export { PhotosField, type PhotosFieldProps } from "./PhotosField";
7
- export { PlaceField, type PlaceFieldProps, type PlaceUpdate } from "./PlaceField";
8
- export { PlaceMapDialog, type PlaceMapDialogProps } from "./PlaceMapDialog";
9
- export { editorToPlace, placeFeatures, placeToEditor } from "./placeShapes";
10
- export { searchWikidataPlaces, wikidataPoint, WIKIDATA_PLACE_SEARCH, type PlaceSearch, type PlaceSearchResult } from "./placeSearch";
11
- export { StoryTextField, type StoryTextFieldProps } from "./StoryTextField";
12
- export { SlideList, type SlideListProps } from "./SlideList";
13
- export { DateField, type DateFieldProps } from "./DateField";
14
- export { suggestEdtf, type DateTextParser } from "./dates";
15
- export { browserLanguages, EDITOR_ENGLISH, EDITOR_LANGUAGES, editorLanguage, editorStringsFor, type EditorStrings } from "./strings";
4
+ } from "./MapEditor.js";
5
+ export { MAP_EDITOR_ENGLISH, mapEditorStringsFor, type MapEditorStrings } from "./mapEditorStrings.js";
6
+ export { PhotosField, type PhotosFieldProps } from "./PhotosField.js";
7
+ export { PlaceField, type PlaceFieldProps, type PlaceUpdate } from "./PlaceField.js";
8
+ export { PlaceMapDialog, type PlaceMapDialogProps } from "./PlaceMapDialog.js";
9
+ export { editorToPlace, placeFeatures, placeToEditor } from "./placeShapes.js";
10
+ export { searchWikidataPlaces, wikidataPoint, WIKIDATA_PLACE_SEARCH, type PlaceSearch, type PlaceSearchResult } from "./placeSearch.js";
11
+ export { StoryTextField, type StoryTextFieldProps } from "./StoryTextField.js";
12
+ export { SlideList, type SlideListProps } from "./SlideList.js";
13
+ export { DateField, type DateFieldProps } from "./DateField.js";
14
+ export { suggestEdtf, type DateTextParser } from "./dates.js";
15
+ export { browserLanguages, EDITOR_ENGLISH, EDITOR_LANGUAGES, editorLanguage, editorStringsFor, type EditorStrings } from "./strings.js";
16
16
  export {
17
17
  addImage, addSlide, blankStory, COALESCE_MS, deleteSlide, duplicateSlide, findMedia, formatLatLon, moveSlide, nextSlideId, parseLatLon,
18
18
  patchPlace, pruneMedia, record, redo, roundDegrees, setSlidePhotos, slideDate, startHistory, storyFileName, storyPlaceChoices, undo,
19
19
  updateMedia, updateSlide, updateStory, usedMedia,
20
20
  type History, type NewImage,
21
- } from "./model";
21
+ } from "./model.js";
@@ -1,7 +1,7 @@
1
1
  // The map editor's words, in English and the story editor's other
2
2
  // languages (translations/). Gramps Connect passes its own where it has
3
3
  // them (its t() is keyed by these same English texts).
4
- import { translationFor } from "./strings";
4
+ import { translationFor } from "./strings.js";
5
5
 
6
6
  export interface MapEditorStrings {
7
7
  point: string;
@@ -3,8 +3,8 @@
3
3
  // change spreads the object it touches, so fields this version doesn't
4
4
  // know (a newer minor version's, an extension's) ride along untouched:
5
5
  // opening and saving a story must never lose anything.
6
- import { FORMAT_ID, FORMAT_VERSION } from "../version";
7
- import type { MediaItem, Place, Slide, SlideMedia, StoryDate, StoryDoc } from "../types";
6
+ import { FORMAT_ID, FORMAT_VERSION } from "../version.js";
7
+ import type { MediaItem, Place, Slide, SlideMedia, StoryDate, StoryDoc } from "../types.js";
8
8
 
9
9
  /** A story with one empty slide: the smallest valid one. */
10
10
  export function blankStory(title: string, language?: string): StoryDoc {
@@ -5,9 +5,9 @@
5
5
  // doesn't know, a FeatureCollection's own members -- is carried over from
6
6
  // the place as it was.
7
7
  import type { Feature, FeatureCollection, Geometry } from "geojson";
8
- import type { Overlay, Place, StoryDate } from "../types";
9
- import type { MapEditorOverlay, MapEditorResult } from "./MapEditor";
10
- import { patchPlace } from "./model";
8
+ import type { Overlay, Place, StoryDate } from "../types.js";
9
+ import type { MapEditorOverlay, MapEditorResult } from "./MapEditor.js";
10
+ import { patchPlace } from "./model.js";
11
11
 
12
12
  /** The features in a place's `geometry`, whichever form it takes. */
13
13
  export function placeFeatures(place: Place | undefined): Feature[] {
@@ -2,7 +2,7 @@
2
2
  // (translations/). The editor picks by the browser's languages; a host
3
3
  // with its own translations (Gramps Connect) passes StoryEditor's
4
4
  // `strings` instead.
5
- import { TRANSLATIONS } from "./translations";
5
+ import { TRANSLATIONS } from "./translations/index.js";
6
6
 
7
7
  export interface EditorStrings {
8
8
  story: string;
@@ -1,5 +1,5 @@
1
- import type { EditorStrings } from "../strings";
2
- import type { MapEditorStrings } from "../mapEditorStrings";
1
+ import type { EditorStrings } from "../strings.js";
2
+ import type { MapEditorStrings } from "../mapEditorStrings.js";
3
3
 
4
4
  export const editor: EditorStrings = {
5
5
  story: "Geschichte",
@@ -1,5 +1,5 @@
1
- import type { EditorStrings } from "../strings";
2
- import type { MapEditorStrings } from "../mapEditorStrings";
1
+ import type { EditorStrings } from "../strings.js";
2
+ import type { MapEditorStrings } from "../mapEditorStrings.js";
3
3
 
4
4
  export const editor: EditorStrings = {
5
5
  story: "Historia",
@@ -1,5 +1,5 @@
1
- import type { EditorStrings } from "../strings";
2
- import type { MapEditorStrings } from "../mapEditorStrings";
1
+ import type { EditorStrings } from "../strings.js";
2
+ import type { MapEditorStrings } from "../mapEditorStrings.js";
3
3
 
4
4
  export const editor: EditorStrings = {
5
5
  story: "Histoire",
@@ -1,11 +1,11 @@
1
1
  // The editors' words in the player's other languages (player/strings.ts),
2
2
  // one file each: the story editor's, and its map editor's.
3
- import type { EditorStrings } from "../strings";
4
- import type { MapEditorStrings } from "../mapEditorStrings";
5
- import * as de from "./de";
6
- import * as es from "./es";
7
- import * as fr from "./fr";
8
- import * as nl from "./nl";
3
+ import type { EditorStrings } from "../strings.js";
4
+ import type { MapEditorStrings } from "../mapEditorStrings.js";
5
+ import * as de from "./de.js";
6
+ import * as es from "./es.js";
7
+ import * as fr from "./fr.js";
8
+ import * as nl from "./nl.js";
9
9
 
10
10
  export interface EditorTranslation {
11
11
  editor: EditorStrings;
@@ -1,5 +1,5 @@
1
- import type { EditorStrings } from "../strings";
2
- import type { MapEditorStrings } from "../mapEditorStrings";
1
+ import type { EditorStrings } from "../strings.js";
2
+ import type { MapEditorStrings } from "../mapEditorStrings.js";
3
3
 
4
4
  export const editor: EditorStrings = {
5
5
  story: "Verhaal",