@krizaka/ui 3.33.1 → 3.35.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/dist/{chunk-2AJ4NJUF.js → chunk-IANSFIVC.js} +5 -1
- package/dist/chunk-IANSFIVC.js.map +1 -0
- package/dist/date-picker.js +17 -2
- package/dist/date-picker.js.map +1 -1
- package/dist/map.d.ts +5 -1
- package/dist/map.js +13 -7
- package/dist/map.js.map +1 -1
- package/dist/motion.css +1 -1
- package/dist/nav-bar.d.ts +1 -1
- package/dist/nav-bar.js +1 -1
- package/dist/number-ticker.d.ts +7 -3
- package/dist/number-ticker.js +24 -11
- package/dist/number-ticker.js.map +1 -1
- package/dist/site-footer.d.ts +1 -1
- package/dist/site-footer.js +1 -1
- package/dist/{sites-B4prB793.d.ts → sites-B4sYlfPQ.d.ts} +1 -1
- package/dist/sites.d.ts +1 -1
- package/dist/sites.js +4 -0
- package/dist/sites.js.map +1 -1
- package/dist/terminal-replay.d.ts +6 -1
- package/dist/terminal-replay.js +6 -3
- package/dist/terminal-replay.js.map +1 -1
- package/package.json +4 -4
- package/registry/date-picker.json +1 -1
- package/registry/index.json +5 -5
- package/registry/map.json +30 -2
- package/registry/nav-bar.json +1 -1
- package/registry/number-ticker.json +19 -5
- package/registry/rail-nav.json +1 -1
- package/registry/site-footer.json +1 -1
- package/registry/sites.json +1 -1
- package/registry/terminal-replay.json +15 -1
- package/dist/chunk-2AJ4NJUF.js.map +0 -1
package/dist/map.d.ts
CHANGED
|
@@ -321,9 +321,13 @@ type RouteProps = {
|
|
|
321
321
|
replayKey?: string | number;
|
|
322
322
|
/** `accent` or `soft`. Default `accent`. */
|
|
323
323
|
tone?: "accent" | "soft";
|
|
324
|
+
/** The timing function of the drawing and of the trips: `ease-out`, `linear`, `ease-in-out`. Default: out for the drawing, in-out for a trip. */
|
|
325
|
+
easing?: "ease-out" | "linear" | "ease-in-out";
|
|
326
|
+
/** Holds the drawing and the trips where they are (a controlled pause, on top of the off-screen one). */
|
|
327
|
+
paused?: boolean;
|
|
324
328
|
};
|
|
325
329
|
/** A route on the map: a line that draws itself, and a courier that travels it. Under reduced motion the line is whole and the courier rests at the end. */
|
|
326
|
-
declare function Route({ path, label, draw, duration, courier, tripDuration, repeatAfter, replayKey, tone }: RouteProps): null;
|
|
330
|
+
declare function Route({ path, label, draw, duration, courier, tripDuration, repeatAfter, replayKey, tone, easing, paused }: RouteProps): null;
|
|
327
331
|
type RadiusCircleProps = {
|
|
328
332
|
/** Its centre. */
|
|
329
333
|
center: LngLat;
|
package/dist/map.js
CHANGED
|
@@ -891,7 +891,12 @@ function Pulse({ position, label, size = 56, tone = "accent" }) {
|
|
|
891
891
|
}, [m, lib, tone, size, position[0], position[1]]);
|
|
892
892
|
return null;
|
|
893
893
|
}
|
|
894
|
-
|
|
894
|
+
var ROUTE_CURVES = {
|
|
895
|
+
linear: (t) => t,
|
|
896
|
+
"ease-out": (t) => 1 - (1 - t) ** 3,
|
|
897
|
+
"ease-in-out": (t) => t < 0.5 ? 2 * t * t : 1 - (-2 * t + 2) ** 2 / 2
|
|
898
|
+
};
|
|
899
|
+
function Route({ path, label, draw = true, duration = 1400, courier, tripDuration = 3200, repeatAfter, replayKey, tone = "accent", easing, paused = false }) {
|
|
895
900
|
const { map: m, lib, ready, reduce, places } = useMap();
|
|
896
901
|
const id = `kz-route-${React2.useId().replace(/[^a-zA-Z0-9]/g, "")}`;
|
|
897
902
|
const animated = draw && !reduce;
|
|
@@ -908,11 +913,12 @@ function Route({ path, label, draw = true, duration = 1400, courier, tripDuratio
|
|
|
908
913
|
{ id: `${id}-casing`, type: "line", source: id, layout: { "line-cap": "round", "line-join": "round" }, paint: { "line-color": c.accent, "line-width": 9, "line-opacity": tone === "soft" ? 0.08 : 0.16, "line-blur": 3 } },
|
|
909
914
|
{ id: `${id}-line`, type: "line", source: id, layout: { "line-cap": "round", "line-join": "round" }, paint: { "line-color": c.accent, "line-width": tone === "soft" ? 2 : 3.5, "line-opacity": tone === "soft" ? 0.6 : 1 } }
|
|
910
915
|
]);
|
|
911
|
-
const [
|
|
916
|
+
const [seen, setSeen] = React2.useState(() => typeof IntersectionObserver === "undefined");
|
|
917
|
+
const visible = seen && !paused;
|
|
912
918
|
React2.useEffect(() => {
|
|
913
919
|
const el = m?.getContainer?.();
|
|
914
920
|
if (!el || typeof IntersectionObserver === "undefined") return;
|
|
915
|
-
const io = new IntersectionObserver(([entry]) =>
|
|
921
|
+
const io = new IntersectionObserver(([entry]) => setSeen(!!entry?.isIntersecting), { threshold: 0.25 });
|
|
916
922
|
io.observe(el);
|
|
917
923
|
return () => io.disconnect();
|
|
918
924
|
}, [m]);
|
|
@@ -923,13 +929,13 @@ function Route({ path, label, draw = true, duration = 1400, courier, tripDuratio
|
|
|
923
929
|
const began = performance.now();
|
|
924
930
|
const step = (now) => {
|
|
925
931
|
const t = Math.min(1, (now - began) / Math.max(1, duration));
|
|
926
|
-
source?.setData?.(sliceLine(path,
|
|
932
|
+
source?.setData?.(sliceLine(path, ROUTE_CURVES[easing ?? "ease-out"](t)));
|
|
927
933
|
if (t < 1) frame = requestAnimationFrame(step);
|
|
928
934
|
else setDoneFor(token);
|
|
929
935
|
};
|
|
930
936
|
frame = requestAnimationFrame(step);
|
|
931
937
|
return () => cancelAnimationFrame(frame);
|
|
932
|
-
}, [m, ready, animated, drawn, visible, id, path, duration, token]);
|
|
938
|
+
}, [m, ready, animated, drawn, visible, id, path, duration, token, easing]);
|
|
933
939
|
const [trip, setTrip] = React2.useState(0);
|
|
934
940
|
React2.useEffect(() => {
|
|
935
941
|
if (!courier || !m || !lib || !ready || !drawn) return;
|
|
@@ -943,7 +949,7 @@ function Route({ path, label, draw = true, duration = 1400, courier, tripDuratio
|
|
|
943
949
|
const began = performance.now();
|
|
944
950
|
const step = (now) => {
|
|
945
951
|
const t = Math.min(1, (now - began) / Math.max(1, tripDuration));
|
|
946
|
-
const eased =
|
|
952
|
+
const eased = ROUTE_CURVES[easing ?? "ease-in-out"](t);
|
|
947
953
|
marker.setLngLat([...pointAlong(path, eased).position]);
|
|
948
954
|
if (t < 1) frame = requestAnimationFrame(step);
|
|
949
955
|
else if (repeatAfter !== void 0) timer = setTimeout(() => setTrip((n) => n + 1), repeatAfter);
|
|
@@ -955,7 +961,7 @@ function Route({ path, label, draw = true, duration = 1400, courier, tripDuratio
|
|
|
955
961
|
clearTimeout(timer);
|
|
956
962
|
marker.remove();
|
|
957
963
|
};
|
|
958
|
-
}, [courier, m, lib, ready, drawn, visible, reduce, path, tripDuration, repeatAfter, trip, token]);
|
|
964
|
+
}, [courier, m, lib, ready, drawn, visible, reduce, path, tripDuration, repeatAfter, trip, token, easing]);
|
|
959
965
|
return null;
|
|
960
966
|
}
|
|
961
967
|
function useGeoLayer(id, data, layers2, source = {}) {
|