@gramps-connect/story 0.7.0 → 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.
- package/dist/editor.js +41 -9
- package/dist/editor.js.map +2 -2
- package/dist/embed.js +41 -41
- package/dist/index.js.map +1 -1
- package/dist/map-edit.js.map +1 -1
- package/dist/player.js +39 -8
- package/dist/player.js.map +2 -2
- package/dist/types/editor/DateField.d.ts +3 -3
- package/dist/types/editor/MapEditor.d.ts +5 -4
- package/dist/types/editor/PhotosField.d.ts +2 -2
- package/dist/types/editor/PlaceField.d.ts +4 -4
- package/dist/types/editor/PlaceMap.d.ts +2 -2
- package/dist/types/editor/PlaceMapDialog.d.ts +4 -4
- package/dist/types/editor/StoryEditor.d.ts +7 -7
- package/dist/types/editor/index.d.ts +14 -14
- package/dist/types/editor/model.d.ts +1 -1
- package/dist/types/editor/placeShapes.d.ts +2 -2
- package/dist/types/editor/strings.d.ts +1 -1
- package/dist/types/editor/translations/de.d.ts +2 -2
- package/dist/types/editor/translations/es.d.ts +2 -2
- package/dist/types/editor/translations/fr.d.ts +2 -2
- package/dist/types/editor/translations/index.d.ts +2 -2
- package/dist/types/editor/translations/nl.d.ts +2 -2
- package/dist/types/index.d.ts +5 -5
- package/dist/types/mapEdit/index.d.ts +3 -3
- package/dist/types/mapEdit/mapFile.d.ts +1 -1
- package/dist/types/player/MapBackground.d.ts +3 -3
- package/dist/types/player/MapModeControl.d.ts +2 -2
- package/dist/types/player/StoryPlayer.d.ts +4 -4
- package/dist/types/player/TimelineStrip.d.ts +1 -1
- package/dist/types/player/dates.d.ts +1 -1
- package/dist/types/player/geo.d.ts +1 -1
- package/dist/types/player/index.d.ts +10 -10
- package/dist/types/version.d.ts +1 -1
- package/dist/types/zip.d.ts +3 -3
- package/package.json +2 -2
- package/src/editor/DateField.tsx +5 -5
- package/src/editor/MapEditor.tsx +10 -8
- package/src/editor/PhotosField.tsx +2 -2
- package/src/editor/PlaceField.tsx +6 -6
- package/src/editor/PlaceMap.tsx +5 -5
- package/src/editor/PlaceMapDialog.tsx +11 -11
- package/src/editor/StoryEditor.tsx +18 -18
- package/src/editor/index.ts +14 -14
- package/src/editor/mapEditorStrings.ts +1 -1
- package/src/editor/model.ts +2 -2
- package/src/editor/placeShapes.ts +3 -3
- package/src/editor/strings.ts +1 -1
- package/src/editor/translations/de.ts +2 -2
- package/src/editor/translations/es.ts +2 -2
- package/src/editor/translations/fr.ts +2 -2
- package/src/editor/translations/index.ts +6 -6
- package/src/editor/translations/nl.ts +2 -2
- package/src/embed/index.tsx +2 -2
- package/src/index.ts +5 -5
- package/src/mapEdit/index.ts +3 -3
- package/src/mapEdit/mapFile.ts +1 -1
- package/src/player/MapBackground.tsx +20 -10
- package/src/player/MapModeControl.tsx +2 -2
- package/src/player/StoryPlayer.tsx +50 -13
- package/src/player/TimelineStrip.tsx +2 -2
- package/src/player/dates.ts +1 -1
- package/src/player/geo.ts +1 -1
- package/src/player/index.ts +10 -10
- package/src/validate.ts +2 -2
- package/src/version.ts +1 -1
- package/src/zip.ts +3 -3
package/dist/editor.js
CHANGED
|
@@ -1960,6 +1960,10 @@ var OVERLAY_PREFIX = "story-overlay-";
|
|
|
1960
1960
|
var PLACES_SOURCE = "story-places";
|
|
1961
1961
|
var PLACES_LAYER = "story-places-dots";
|
|
1962
1962
|
var OVERVIEW_PADDING = 60;
|
|
1963
|
+
var POINT_ZOOM = 6;
|
|
1964
|
+
var SHAPE_MAX_ZOOM = 13;
|
|
1965
|
+
var SHAPE_PADDING = 40;
|
|
1966
|
+
var MIN_SHAPE_DEGREES = 1e-5;
|
|
1963
1967
|
var EMPTY = { type: "FeatureCollection", features: [] };
|
|
1964
1968
|
function moveCamera(map, slide, duration) {
|
|
1965
1969
|
if (slide.overview) {
|
|
@@ -1969,12 +1973,12 @@ function moveCamera(map, slide, duration) {
|
|
|
1969
1973
|
}
|
|
1970
1974
|
const place = slide.place;
|
|
1971
1975
|
const bounds = placeBounds(place);
|
|
1972
|
-
if (bounds) {
|
|
1973
|
-
map.fitBounds([[bounds[0], bounds[1]], [bounds[2], bounds[3]]], { maxZoom:
|
|
1976
|
+
if (bounds && Math.max(bounds[2] - bounds[0], bounds[3] - bounds[1]) >= MIN_SHAPE_DEGREES) {
|
|
1977
|
+
map.fitBounds([[bounds[0], bounds[1]], [bounds[2], bounds[3]]], { maxZoom: SHAPE_MAX_ZOOM, padding: SHAPE_PADDING, duration });
|
|
1974
1978
|
return;
|
|
1975
1979
|
}
|
|
1976
1980
|
const center = placeCenter(place);
|
|
1977
|
-
if (center) map.flyTo({ center, zoom:
|
|
1981
|
+
if (center) map.flyTo({ center, zoom: POINT_ZOOM, essential: true, duration });
|
|
1978
1982
|
}
|
|
1979
1983
|
function placeMarker(marker, slide) {
|
|
1980
1984
|
if (!marker) return;
|
|
@@ -2437,6 +2441,8 @@ function TimelineStrip({ points, currentIndex, onSelect, colors }) {
|
|
|
2437
2441
|
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2438
2442
|
var PANEL_FRACTION = 0.62;
|
|
2439
2443
|
var BAR_HEIGHT = 56;
|
|
2444
|
+
var BAR_GAP = 8;
|
|
2445
|
+
var MODE_ROW_HEIGHT = 40;
|
|
2440
2446
|
function initialMapMode(story) {
|
|
2441
2447
|
return story.presentation?.basemap === "historical" ? "auto" : "standard";
|
|
2442
2448
|
}
|
|
@@ -2475,7 +2481,7 @@ function SlidePhoto({ mediaKey, item, caption, credit, resolveMedia, colors }) {
|
|
|
2475
2481
|
style: { maxHeight: "42vh", maxWidth: "100%", width: "auto", height: "auto", objectFit: "contain", borderRadius: 4 }
|
|
2476
2482
|
}
|
|
2477
2483
|
),
|
|
2478
|
-
(caption || credit) && /* @__PURE__ */ jsx4("figcaption", { style: { fontSize: 13, color: colors.muted }, children: [caption, credit
|
|
2484
|
+
(caption || credit) && /* @__PURE__ */ jsx4("figcaption", { style: { fontSize: 13, color: colors.muted }, children: [caption, credit].filter(Boolean).join(" \xB7 ") })
|
|
2479
2485
|
] });
|
|
2480
2486
|
}
|
|
2481
2487
|
function PhotoThumb({ mediaKey, item, label, selected, onSelect, resolveMedia, colors }) {
|
|
@@ -2621,6 +2627,28 @@ function StoryPlayer({
|
|
|
2621
2627
|
[story.language, stringOverrides]
|
|
2622
2628
|
);
|
|
2623
2629
|
const rootRef = useRef3(null);
|
|
2630
|
+
const titleRef = useRef3(null);
|
|
2631
|
+
const modeRef = useRef3(null);
|
|
2632
|
+
const actionsRef = useRef3(null);
|
|
2633
|
+
const [modeBelowBar, setModeBelowBar] = useState3(false);
|
|
2634
|
+
useEffect3(() => {
|
|
2635
|
+
const root = rootRef.current;
|
|
2636
|
+
if (!root || typeof ResizeObserver === "undefined") return;
|
|
2637
|
+
const check = () => {
|
|
2638
|
+
const mode = modeRef.current;
|
|
2639
|
+
if (!mode) return;
|
|
2640
|
+
const rootBox = root.getBoundingClientRect();
|
|
2641
|
+
const half = mode.offsetWidth / 2;
|
|
2642
|
+
const center = rootBox.width / 2;
|
|
2643
|
+
const titleRight = titleRef.current ? titleRef.current.getBoundingClientRect().right - rootBox.left : 0;
|
|
2644
|
+
const actionsLeft = actionsRef.current ? actionsRef.current.getBoundingClientRect().left - rootBox.left : rootBox.width - 60;
|
|
2645
|
+
setModeBelowBar(center - half < titleRight + BAR_GAP || center + half > actionsLeft - BAR_GAP);
|
|
2646
|
+
};
|
|
2647
|
+
const observer = new ResizeObserver(check);
|
|
2648
|
+
for (const el of [root, titleRef.current, modeRef.current, actionsRef.current]) if (el) observer.observe(el);
|
|
2649
|
+
check();
|
|
2650
|
+
return () => observer.disconnect();
|
|
2651
|
+
}, [story, Boolean(actions), Boolean(onClose)]);
|
|
2624
2652
|
const slides = story.slides;
|
|
2625
2653
|
const [index, setIndex] = useState3(initialSlide);
|
|
2626
2654
|
const slide = slides[index];
|
|
@@ -2754,6 +2782,7 @@ function StoryPlayer({
|
|
|
2754
2782
|
/* @__PURE__ */ jsxs3(
|
|
2755
2783
|
"div",
|
|
2756
2784
|
{
|
|
2785
|
+
ref: titleRef,
|
|
2757
2786
|
dir: "auto",
|
|
2758
2787
|
style: {
|
|
2759
2788
|
position: "absolute",
|
|
@@ -2778,22 +2807,23 @@ function StoryPlayer({
|
|
|
2778
2807
|
{
|
|
2779
2808
|
style: {
|
|
2780
2809
|
position: "absolute",
|
|
2781
|
-
top: 0,
|
|
2810
|
+
top: modeBelowBar ? BAR_HEIGHT : 0,
|
|
2782
2811
|
left: 0,
|
|
2783
2812
|
right: 0,
|
|
2784
|
-
height: BAR_HEIGHT,
|
|
2813
|
+
height: modeBelowBar ? MODE_ROW_HEIGHT : BAR_HEIGHT,
|
|
2785
2814
|
zIndex: 3,
|
|
2786
2815
|
display: "flex",
|
|
2787
2816
|
alignItems: "center",
|
|
2788
2817
|
justifyContent: "center",
|
|
2789
2818
|
pointerEvents: "none"
|
|
2790
2819
|
},
|
|
2791
|
-
children: /* @__PURE__ */ jsx4("div", { style: { pointerEvents: "auto" }, children: renderMapModeControl ? renderMapModeControl(modeControlProps) : /* @__PURE__ */ jsx4(MapModeControl, { ...modeControlProps, strings, colors }) })
|
|
2820
|
+
children: /* @__PURE__ */ jsx4("div", { ref: modeRef, style: { pointerEvents: "auto" }, children: renderMapModeControl ? renderMapModeControl(modeControlProps) : /* @__PURE__ */ jsx4(MapModeControl, { ...modeControlProps, strings, colors }) })
|
|
2792
2821
|
}
|
|
2793
2822
|
),
|
|
2794
2823
|
actions && /* @__PURE__ */ jsx4(
|
|
2795
2824
|
"div",
|
|
2796
2825
|
{
|
|
2826
|
+
ref: actionsRef,
|
|
2797
2827
|
style: {
|
|
2798
2828
|
position: "absolute",
|
|
2799
2829
|
top: 0,
|
|
@@ -2840,7 +2870,8 @@ function StoryPlayer({
|
|
|
2840
2870
|
right: 0,
|
|
2841
2871
|
width: `${PANEL_FRACTION * 100}%`,
|
|
2842
2872
|
zIndex: 1,
|
|
2843
|
-
|
|
2873
|
+
// Below the map-mode switch too, when it has a row of its own.
|
|
2874
|
+
padding: `${BAR_HEIGHT + (modeBelowBar ? MODE_ROW_HEIGHT : 0)}px 32px ${showTimeline ? TIMELINE_HEIGHT : 32}px`,
|
|
2844
2875
|
boxSizing: "border-box",
|
|
2845
2876
|
display: "flex",
|
|
2846
2877
|
flexDirection: "column",
|
|
@@ -5162,7 +5193,7 @@ var MapEditor = forwardRef(function MapEditor2({
|
|
|
5162
5193
|
for (const overlay of overlaysRef.current) for (const corner of overlay.corners) bounds.extend(corner);
|
|
5163
5194
|
return bounds.isEmpty() ? null : bounds.toArray().flat();
|
|
5164
5195
|
},
|
|
5165
|
-
async addImage(image) {
|
|
5196
|
+
async addImage(image, name) {
|
|
5166
5197
|
if (overlaysRef.current.some((o) => o.image === image)) return false;
|
|
5167
5198
|
const map = mapRef.current;
|
|
5168
5199
|
if (!map) return false;
|
|
@@ -5177,6 +5208,7 @@ var MapEditor = forwardRef(function MapEditor2({
|
|
|
5177
5208
|
const draft = {
|
|
5178
5209
|
id: crypto.randomUUID(),
|
|
5179
5210
|
image,
|
|
5211
|
+
...name?.trim() ? { name: name.trim() } : {},
|
|
5180
5212
|
corners: [
|
|
5181
5213
|
[topLeft.lng, topLeft.lat],
|
|
5182
5214
|
[bottomRight.lng, topLeft.lat],
|