qstd 0.3.75 → 0.3.77
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/block/drawer.d.ts.map +1 -1
- package/dist/client/index.cjs +32 -2
- package/dist/client/index.js +33 -3
- package/dist/react/index.cjs +148 -142
- package/dist/react/index.css +12 -18
- package/dist/react/index.js +148 -142
- package/dist/server/index.cjs +32 -2
- package/dist/server/index.js +33 -3
- package/dist/shared/time.d.ts +44 -1
- package/dist/shared/time.d.ts.map +1 -1
- package/package.json +1 -1
- package/styled-system/styles.css +16 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/block/drawer.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/block/drawer.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AA+a9B,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,2CAMxD;AAID,wBAAgB,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,mBAAmB,2CAYrD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,mBAAmB,uDAkDrD"}
|
package/dist/client/index.cjs
CHANGED
|
@@ -265,6 +265,7 @@ __export(time_exports, {
|
|
|
265
265
|
formatDateRange: () => formatDateRange,
|
|
266
266
|
formatDuration: () => formatDuration,
|
|
267
267
|
formatThreadDateRange: () => formatThreadDateRange,
|
|
268
|
+
formatTimeAgo: () => formatTimeAgo,
|
|
268
269
|
now: () => now,
|
|
269
270
|
sleep: () => sleep,
|
|
270
271
|
startTimer: () => startTimer,
|
|
@@ -389,14 +390,43 @@ var formatDate = (input, options = {}) => {
|
|
|
389
390
|
return includeTime ? dateFns.format(date2, "MMM d, yyyy h:mm a") : dateFns.format(date2, "MMM d, yyyy");
|
|
390
391
|
case "long":
|
|
391
392
|
return includeTime ? dateFns.format(date2, "MMMM d, yyyy 'at' h:mm a") : dateFns.format(date2, "MMMM d, yyyy");
|
|
392
|
-
case "relative":
|
|
393
|
-
return dateFns.formatDistanceToNow(date2, { addSuffix: true });
|
|
394
393
|
case "year":
|
|
395
394
|
return dateFns.format(date2, "yyyy");
|
|
396
395
|
default:
|
|
397
396
|
return includeTime ? dateFns.format(date2, "MMM d, yyyy h:mm a") : dateFns.format(date2, "MMM d, yyyy");
|
|
398
397
|
}
|
|
399
398
|
};
|
|
399
|
+
var formatTimeAgo = (input, options = {}) => {
|
|
400
|
+
const { verbose = false } = options;
|
|
401
|
+
let date2;
|
|
402
|
+
if (typeof input === "string") {
|
|
403
|
+
date2 = new Date(input);
|
|
404
|
+
} else if (typeof input === "number") {
|
|
405
|
+
date2 = new Date(input);
|
|
406
|
+
} else {
|
|
407
|
+
date2 = input;
|
|
408
|
+
}
|
|
409
|
+
if (isNaN(date2.getTime())) {
|
|
410
|
+
return "Invalid Date";
|
|
411
|
+
}
|
|
412
|
+
if (verbose) {
|
|
413
|
+
return dateFns.formatDistanceToNow(date2, { addSuffix: true });
|
|
414
|
+
}
|
|
415
|
+
const diffMs = Date.now() - date2.getTime();
|
|
416
|
+
const diffSeconds = Math.floor(diffMs / 1e3);
|
|
417
|
+
const diffMinutes = Math.floor(diffSeconds / 60);
|
|
418
|
+
const diffHours = Math.floor(diffMinutes / 60);
|
|
419
|
+
const diffDays = Math.floor(diffHours / 24);
|
|
420
|
+
const diffWeeks = Math.floor(diffDays / 7);
|
|
421
|
+
const diffMonths = Math.floor(diffDays / 30);
|
|
422
|
+
const diffYears = Math.floor(diffDays / 365);
|
|
423
|
+
if (diffYears > 0) return `${diffYears}y ago`;
|
|
424
|
+
if (diffMonths > 0) return `${diffMonths}mo ago`;
|
|
425
|
+
if (diffWeeks > 0) return `${diffWeeks}w ago`;
|
|
426
|
+
if (diffDays > 0) return `${diffDays}d ago`;
|
|
427
|
+
if (diffHours > 0) return `${diffHours}h ago`;
|
|
428
|
+
return "just now";
|
|
429
|
+
};
|
|
400
430
|
var toDate = (input) => typeof input === "string" || typeof input === "number" ? new Date(input) : input;
|
|
401
431
|
var formatDateRange = (startInput, endInput, options = {}) => {
|
|
402
432
|
const now2 = options.now ?? /* @__PURE__ */ new Date();
|
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { format,
|
|
1
|
+
import { format, formatISO, formatDistanceToNow, isSameYear, isSameMonth, isSameDay, addSeconds, addMinutes, addHours, addDays, addWeeks, addBusinessDays, addMonths, addYears } from 'date-fns';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -258,6 +258,7 @@ __export(time_exports, {
|
|
|
258
258
|
formatDateRange: () => formatDateRange,
|
|
259
259
|
formatDuration: () => formatDuration,
|
|
260
260
|
formatThreadDateRange: () => formatThreadDateRange,
|
|
261
|
+
formatTimeAgo: () => formatTimeAgo,
|
|
261
262
|
now: () => now,
|
|
262
263
|
sleep: () => sleep,
|
|
263
264
|
startTimer: () => startTimer,
|
|
@@ -382,14 +383,43 @@ var formatDate = (input, options = {}) => {
|
|
|
382
383
|
return includeTime ? format(date2, "MMM d, yyyy h:mm a") : format(date2, "MMM d, yyyy");
|
|
383
384
|
case "long":
|
|
384
385
|
return includeTime ? format(date2, "MMMM d, yyyy 'at' h:mm a") : format(date2, "MMMM d, yyyy");
|
|
385
|
-
case "relative":
|
|
386
|
-
return formatDistanceToNow(date2, { addSuffix: true });
|
|
387
386
|
case "year":
|
|
388
387
|
return format(date2, "yyyy");
|
|
389
388
|
default:
|
|
390
389
|
return includeTime ? format(date2, "MMM d, yyyy h:mm a") : format(date2, "MMM d, yyyy");
|
|
391
390
|
}
|
|
392
391
|
};
|
|
392
|
+
var formatTimeAgo = (input, options = {}) => {
|
|
393
|
+
const { verbose = false } = options;
|
|
394
|
+
let date2;
|
|
395
|
+
if (typeof input === "string") {
|
|
396
|
+
date2 = new Date(input);
|
|
397
|
+
} else if (typeof input === "number") {
|
|
398
|
+
date2 = new Date(input);
|
|
399
|
+
} else {
|
|
400
|
+
date2 = input;
|
|
401
|
+
}
|
|
402
|
+
if (isNaN(date2.getTime())) {
|
|
403
|
+
return "Invalid Date";
|
|
404
|
+
}
|
|
405
|
+
if (verbose) {
|
|
406
|
+
return formatDistanceToNow(date2, { addSuffix: true });
|
|
407
|
+
}
|
|
408
|
+
const diffMs = Date.now() - date2.getTime();
|
|
409
|
+
const diffSeconds = Math.floor(diffMs / 1e3);
|
|
410
|
+
const diffMinutes = Math.floor(diffSeconds / 60);
|
|
411
|
+
const diffHours = Math.floor(diffMinutes / 60);
|
|
412
|
+
const diffDays = Math.floor(diffHours / 24);
|
|
413
|
+
const diffWeeks = Math.floor(diffDays / 7);
|
|
414
|
+
const diffMonths = Math.floor(diffDays / 30);
|
|
415
|
+
const diffYears = Math.floor(diffDays / 365);
|
|
416
|
+
if (diffYears > 0) return `${diffYears}y ago`;
|
|
417
|
+
if (diffMonths > 0) return `${diffMonths}mo ago`;
|
|
418
|
+
if (diffWeeks > 0) return `${diffWeeks}w ago`;
|
|
419
|
+
if (diffDays > 0) return `${diffDays}d ago`;
|
|
420
|
+
if (diffHours > 0) return `${diffHours}h ago`;
|
|
421
|
+
return "just now";
|
|
422
|
+
};
|
|
393
423
|
var toDate = (input) => typeof input === "string" || typeof input === "number" ? new Date(input) : input;
|
|
394
424
|
var formatDateRange = (startInput, endInput, options = {}) => {
|
|
395
425
|
const now2 = options.now ?? /* @__PURE__ */ new Date();
|
package/dist/react/index.cjs
CHANGED
|
@@ -2670,7 +2670,6 @@ var accordion_default = Accordion;
|
|
|
2670
2670
|
var MotionDiv4 = motionTags.div;
|
|
2671
2671
|
var MotionBtn2 = motionTags.button;
|
|
2672
2672
|
var breakpoint = ["(min-width: 600px)"];
|
|
2673
|
-
var mobileOvershootCoverPx = 96;
|
|
2674
2673
|
function requirePortalRootForDrawer() {
|
|
2675
2674
|
if (typeof document === "undefined") {
|
|
2676
2675
|
throw new Error(
|
|
@@ -2709,6 +2708,52 @@ function DrawerComponent(props) {
|
|
|
2709
2708
|
const { open, setOpen } = useDrawer();
|
|
2710
2709
|
const { onClose, onExitComplete, ...rest } = props;
|
|
2711
2710
|
const drawerBg = rest.bg ?? { base: "neutral.100", _dark: "neutral.900" };
|
|
2711
|
+
const hasMobileHeight = props.height !== void 0;
|
|
2712
|
+
const mobileVariants = hasMobileHeight ? {
|
|
2713
|
+
initial: { height: 0, opacity: 0.5 },
|
|
2714
|
+
animate: {
|
|
2715
|
+
height: props.height,
|
|
2716
|
+
opacity: 1,
|
|
2717
|
+
transition: {
|
|
2718
|
+
type: "spring",
|
|
2719
|
+
damping: 22,
|
|
2720
|
+
stiffness: 400,
|
|
2721
|
+
mass: 0.7
|
|
2722
|
+
}
|
|
2723
|
+
},
|
|
2724
|
+
exit: {
|
|
2725
|
+
height: 0,
|
|
2726
|
+
opacity: 0,
|
|
2727
|
+
transition: {
|
|
2728
|
+
type: "tween",
|
|
2729
|
+
duration: 0.2,
|
|
2730
|
+
ease: [0.4, 0, 1, 1]
|
|
2731
|
+
// ease-in for quick exit
|
|
2732
|
+
}
|
|
2733
|
+
}
|
|
2734
|
+
} : {
|
|
2735
|
+
initial: { transform: "translateY(100%)", opacity: 0.5 },
|
|
2736
|
+
animate: {
|
|
2737
|
+
transform: "translateY(0%)",
|
|
2738
|
+
opacity: 1,
|
|
2739
|
+
transition: {
|
|
2740
|
+
type: "spring",
|
|
2741
|
+
damping: 22,
|
|
2742
|
+
stiffness: 400,
|
|
2743
|
+
mass: 0.7
|
|
2744
|
+
}
|
|
2745
|
+
},
|
|
2746
|
+
exit: {
|
|
2747
|
+
transform: "translateY(100%)",
|
|
2748
|
+
opacity: 0,
|
|
2749
|
+
transition: {
|
|
2750
|
+
type: "tween",
|
|
2751
|
+
duration: 0.2,
|
|
2752
|
+
ease: [0.4, 0, 1, 1]
|
|
2753
|
+
// ease-in for quick exit
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
};
|
|
2712
2757
|
const [mounted, setMounted] = React3__namespace.default.useState(false);
|
|
2713
2758
|
React3__namespace.default.useEffect(() => {
|
|
2714
2759
|
setMounted(true);
|
|
@@ -2803,155 +2848,116 @@ function DrawerComponent(props) {
|
|
|
2803
2848
|
initial: false,
|
|
2804
2849
|
mode: "wait",
|
|
2805
2850
|
onExitComplete,
|
|
2806
|
-
children: open && /* @__PURE__ */ jsxRuntime.
|
|
2851
|
+
children: open && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2807
2852
|
Backdrop,
|
|
2808
2853
|
{
|
|
2809
2854
|
onClick: () => onBackdropClick(),
|
|
2810
|
-
children:
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
// px: 4,
|
|
2844
|
-
margin: "auto",
|
|
2845
|
-
borderRadius: 12,
|
|
2846
|
-
zIndex: 1,
|
|
2847
|
-
variants: {
|
|
2848
|
-
initial: { opacity: 0, scale: 0.5 },
|
|
2849
|
-
animate: {
|
|
2850
|
-
opacity: 1,
|
|
2851
|
-
scale: 1,
|
|
2852
|
-
transition: {
|
|
2853
|
-
type: "spring",
|
|
2854
|
-
damping: 20,
|
|
2855
|
-
stiffness: 300
|
|
2856
|
-
}
|
|
2857
|
-
},
|
|
2858
|
-
exit: {
|
|
2859
|
-
opacity: 0,
|
|
2860
|
-
scale: 0.3,
|
|
2861
|
-
transition: { type: "spring", duration: 0.45 }
|
|
2862
|
-
}
|
|
2863
|
-
}
|
|
2864
|
-
} : {
|
|
2865
|
-
w: "100vw",
|
|
2866
|
-
left: 0,
|
|
2867
|
-
right: 0,
|
|
2868
|
-
bottom: 0,
|
|
2869
|
-
borderTopLeftRadius: 12,
|
|
2870
|
-
borderTopRightRadius: 12,
|
|
2871
|
-
overflow: "hidden",
|
|
2872
|
-
// Note: Can't use framer-motion's `y` prop because it conflicts
|
|
2873
|
-
// with the drag motion value. Use CSS transform instead.
|
|
2874
|
-
variants: {
|
|
2875
|
-
initial: {
|
|
2876
|
-
transform: "translateY(100%)",
|
|
2877
|
-
opacity: 0.5
|
|
2878
|
-
},
|
|
2879
|
-
animate: {
|
|
2880
|
-
transform: "translateY(0%)",
|
|
2881
|
-
opacity: 1,
|
|
2882
|
-
transition: {
|
|
2883
|
-
type: "spring",
|
|
2884
|
-
damping: 22,
|
|
2885
|
-
stiffness: 400,
|
|
2886
|
-
mass: 0.7
|
|
2887
|
-
}
|
|
2888
|
-
},
|
|
2889
|
-
exit: {
|
|
2890
|
-
transform: "translateY(100%)",
|
|
2891
|
-
opacity: 0,
|
|
2892
|
-
transition: {
|
|
2893
|
-
type: "tween",
|
|
2894
|
-
duration: 0.2,
|
|
2895
|
-
ease: [0.4, 0, 1, 1]
|
|
2896
|
-
// ease-in for quick exit
|
|
2897
|
-
}
|
|
2855
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2856
|
+
MotionDiv4,
|
|
2857
|
+
{
|
|
2858
|
+
grid: true,
|
|
2859
|
+
onClick: (e) => e.stopPropagation(),
|
|
2860
|
+
position: "fixed",
|
|
2861
|
+
initial: "initial",
|
|
2862
|
+
animate: "animate",
|
|
2863
|
+
exit: "exit",
|
|
2864
|
+
...isDesktop ? {
|
|
2865
|
+
drag: false,
|
|
2866
|
+
style: void 0,
|
|
2867
|
+
dragControls: null,
|
|
2868
|
+
dragConstraints: void 0,
|
|
2869
|
+
// style: null,
|
|
2870
|
+
// dragConstraints: null,
|
|
2871
|
+
height: props.height ?? "max-content!",
|
|
2872
|
+
// "min(50%, 300px)",
|
|
2873
|
+
width: props.width ?? "clamp(50%, 700px, 90%)",
|
|
2874
|
+
pt: 6,
|
|
2875
|
+
// px: 4,
|
|
2876
|
+
margin: "auto",
|
|
2877
|
+
borderRadius: 12,
|
|
2878
|
+
zIndex: 1,
|
|
2879
|
+
variants: {
|
|
2880
|
+
initial: { opacity: 0, scale: 0.5 },
|
|
2881
|
+
animate: {
|
|
2882
|
+
opacity: 1,
|
|
2883
|
+
scale: 1,
|
|
2884
|
+
transition: {
|
|
2885
|
+
type: "spring",
|
|
2886
|
+
damping: 20,
|
|
2887
|
+
stiffness: 300
|
|
2898
2888
|
}
|
|
2899
2889
|
},
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
// drag={hasBackdrop ? "y" : false}
|
|
2905
|
-
dragElastic: 0,
|
|
2906
|
-
// prevent drawer from being dragged higher than what its opened to
|
|
2907
|
-
dragConstraints: { top: 0 },
|
|
2908
|
-
onDragEnd: (_, drag) => {
|
|
2909
|
-
if (props.drag === false) return;
|
|
2910
|
-
const pageHeight = document.documentElement.scrollHeight;
|
|
2911
|
-
const yCoord = drag.point.y;
|
|
2912
|
-
const velocity = drag.velocity.y;
|
|
2913
|
-
const releaseThreshold = 0.8;
|
|
2914
|
-
const releasePct = yCoord / pageHeight;
|
|
2915
|
-
if (velocity > 25 && releasePct >= releaseThreshold || velocity > 750) {
|
|
2916
|
-
props.onClose?.();
|
|
2917
|
-
}
|
|
2890
|
+
exit: {
|
|
2891
|
+
opacity: 0,
|
|
2892
|
+
scale: 0.3,
|
|
2893
|
+
transition: { type: "spring", duration: 0.45 }
|
|
2918
2894
|
}
|
|
2919
|
-
}
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
]
|
|
2895
|
+
}
|
|
2896
|
+
} : {
|
|
2897
|
+
w: "100vw",
|
|
2898
|
+
left: 0,
|
|
2899
|
+
right: 0,
|
|
2900
|
+
bottom: 0,
|
|
2901
|
+
borderTopLeftRadius: 12,
|
|
2902
|
+
borderTopRightRadius: 12,
|
|
2903
|
+
overflow: "hidden",
|
|
2904
|
+
// Note: Can't use framer-motion's `y` prop because it conflicts
|
|
2905
|
+
// with the drag motion value. Use CSS transform instead.
|
|
2906
|
+
drag: "y",
|
|
2907
|
+
style: { y },
|
|
2908
|
+
dragControls,
|
|
2909
|
+
variants: mobileVariants,
|
|
2910
|
+
onPointerDown: (e) => onDragStart(e),
|
|
2911
|
+
// drag={hasBackdrop ? "y" : false}
|
|
2912
|
+
dragElastic: 0,
|
|
2913
|
+
// prevent drawer from being dragged higher than what its opened to
|
|
2914
|
+
dragConstraints: { top: 0 },
|
|
2915
|
+
onDragEnd: (_, drag) => {
|
|
2916
|
+
if (props.drag === false) return;
|
|
2917
|
+
const pageHeight = document.documentElement.scrollHeight;
|
|
2918
|
+
const yCoord = drag.point.y;
|
|
2919
|
+
const velocity = drag.velocity.y;
|
|
2920
|
+
const releaseThreshold = 0.8;
|
|
2921
|
+
const releasePct = yCoord / pageHeight;
|
|
2922
|
+
if (velocity > 25 && releasePct >= releaseThreshold || velocity > 750) {
|
|
2923
|
+
props.onClose?.();
|
|
2949
2924
|
}
|
|
2950
|
-
|
|
2925
|
+
}
|
|
2951
2926
|
},
|
|
2952
|
-
"
|
|
2953
|
-
|
|
2954
|
-
|
|
2927
|
+
boxSizing: "border-box",
|
|
2928
|
+
boxShadow: "hsl(0deg 0% 0% / 60%) 0px -4px 20px",
|
|
2929
|
+
color: "text-primary",
|
|
2930
|
+
bg: drawerBg,
|
|
2931
|
+
ref,
|
|
2932
|
+
...rest,
|
|
2933
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2934
|
+
MotionDiv4,
|
|
2935
|
+
{
|
|
2936
|
+
grid: true,
|
|
2937
|
+
...isDesktop ? { position: "relative" } : { rows: "max-content 1fr" },
|
|
2938
|
+
children: [
|
|
2939
|
+
!isDesktop && props.hideHandle !== false && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2940
|
+
MotionDiv4,
|
|
2941
|
+
{
|
|
2942
|
+
grid: true,
|
|
2943
|
+
justifySelf: "center",
|
|
2944
|
+
h: 6,
|
|
2945
|
+
w: 34,
|
|
2946
|
+
mt: "16px",
|
|
2947
|
+
mb: 4,
|
|
2948
|
+
br: 20,
|
|
2949
|
+
bg: { base: "neutral.400", _dark: "neutral.600" },
|
|
2950
|
+
cursor: props.drag ? "row-resize" : "default",
|
|
2951
|
+
ref: dragHandleRef
|
|
2952
|
+
}
|
|
2953
|
+
),
|
|
2954
|
+
props.children
|
|
2955
|
+
]
|
|
2956
|
+
}
|
|
2957
|
+
)
|
|
2958
|
+
},
|
|
2959
|
+
"drawer"
|
|
2960
|
+
)
|
|
2955
2961
|
}
|
|
2956
2962
|
)
|
|
2957
2963
|
}
|
package/dist/react/index.css
CHANGED
|
@@ -996,12 +996,6 @@
|
|
|
996
996
|
.stk-w_4 path {
|
|
997
997
|
stroke-width: 4;
|
|
998
998
|
}
|
|
999
|
-
.fixed_true {
|
|
1000
|
-
position: fixed;
|
|
1001
|
-
}
|
|
1002
|
-
.pointer-events_none {
|
|
1003
|
-
pointer-events: none;
|
|
1004
|
-
}
|
|
1005
999
|
.pos_fixed {
|
|
1006
1000
|
position: fixed;
|
|
1007
1001
|
}
|
|
@@ -1115,6 +1109,9 @@
|
|
|
1115
1109
|
.grid-af_column {
|
|
1116
1110
|
grid-auto-flow: column;
|
|
1117
1111
|
}
|
|
1112
|
+
.pointer-events_none {
|
|
1113
|
+
pointer-events: none;
|
|
1114
|
+
}
|
|
1118
1115
|
.trf-o_top_left {
|
|
1119
1116
|
transform-origin: top left;
|
|
1120
1117
|
}
|
|
@@ -1239,18 +1236,6 @@
|
|
|
1239
1236
|
.w_100\% {
|
|
1240
1237
|
width: 100%;
|
|
1241
1238
|
}
|
|
1242
|
-
.left_0 {
|
|
1243
|
-
left: var(--spacing-0);
|
|
1244
|
-
}
|
|
1245
|
-
.right_0 {
|
|
1246
|
-
right: var(--spacing-0);
|
|
1247
|
-
}
|
|
1248
|
-
.bottom_0 {
|
|
1249
|
-
bottom: var(--spacing-0);
|
|
1250
|
-
}
|
|
1251
|
-
.h_96 {
|
|
1252
|
-
height: 96px;
|
|
1253
|
-
}
|
|
1254
1239
|
.h_max-content\! {
|
|
1255
1240
|
height: max-content !important;
|
|
1256
1241
|
}
|
|
@@ -1263,6 +1248,15 @@
|
|
|
1263
1248
|
.w_100vw {
|
|
1264
1249
|
width: 100vw;
|
|
1265
1250
|
}
|
|
1251
|
+
.left_0 {
|
|
1252
|
+
left: var(--spacing-0);
|
|
1253
|
+
}
|
|
1254
|
+
.right_0 {
|
|
1255
|
+
right: var(--spacing-0);
|
|
1256
|
+
}
|
|
1257
|
+
.bottom_0 {
|
|
1258
|
+
bottom: var(--spacing-0);
|
|
1259
|
+
}
|
|
1266
1260
|
.bdr-tl_12 {
|
|
1267
1261
|
border-top-left-radius: 12px;
|
|
1268
1262
|
}
|
package/dist/react/index.js
CHANGED
|
@@ -2647,7 +2647,6 @@ var accordion_default = Accordion;
|
|
|
2647
2647
|
var MotionDiv4 = motionTags.div;
|
|
2648
2648
|
var MotionBtn2 = motionTags.button;
|
|
2649
2649
|
var breakpoint = ["(min-width: 600px)"];
|
|
2650
|
-
var mobileOvershootCoverPx = 96;
|
|
2651
2650
|
function requirePortalRootForDrawer() {
|
|
2652
2651
|
if (typeof document === "undefined") {
|
|
2653
2652
|
throw new Error(
|
|
@@ -2686,6 +2685,52 @@ function DrawerComponent(props) {
|
|
|
2686
2685
|
const { open, setOpen } = useDrawer();
|
|
2687
2686
|
const { onClose, onExitComplete, ...rest } = props;
|
|
2688
2687
|
const drawerBg = rest.bg ?? { base: "neutral.100", _dark: "neutral.900" };
|
|
2688
|
+
const hasMobileHeight = props.height !== void 0;
|
|
2689
|
+
const mobileVariants = hasMobileHeight ? {
|
|
2690
|
+
initial: { height: 0, opacity: 0.5 },
|
|
2691
|
+
animate: {
|
|
2692
|
+
height: props.height,
|
|
2693
|
+
opacity: 1,
|
|
2694
|
+
transition: {
|
|
2695
|
+
type: "spring",
|
|
2696
|
+
damping: 22,
|
|
2697
|
+
stiffness: 400,
|
|
2698
|
+
mass: 0.7
|
|
2699
|
+
}
|
|
2700
|
+
},
|
|
2701
|
+
exit: {
|
|
2702
|
+
height: 0,
|
|
2703
|
+
opacity: 0,
|
|
2704
|
+
transition: {
|
|
2705
|
+
type: "tween",
|
|
2706
|
+
duration: 0.2,
|
|
2707
|
+
ease: [0.4, 0, 1, 1]
|
|
2708
|
+
// ease-in for quick exit
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
2711
|
+
} : {
|
|
2712
|
+
initial: { transform: "translateY(100%)", opacity: 0.5 },
|
|
2713
|
+
animate: {
|
|
2714
|
+
transform: "translateY(0%)",
|
|
2715
|
+
opacity: 1,
|
|
2716
|
+
transition: {
|
|
2717
|
+
type: "spring",
|
|
2718
|
+
damping: 22,
|
|
2719
|
+
stiffness: 400,
|
|
2720
|
+
mass: 0.7
|
|
2721
|
+
}
|
|
2722
|
+
},
|
|
2723
|
+
exit: {
|
|
2724
|
+
transform: "translateY(100%)",
|
|
2725
|
+
opacity: 0,
|
|
2726
|
+
transition: {
|
|
2727
|
+
type: "tween",
|
|
2728
|
+
duration: 0.2,
|
|
2729
|
+
ease: [0.4, 0, 1, 1]
|
|
2730
|
+
// ease-in for quick exit
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2733
|
+
};
|
|
2689
2734
|
const [mounted, setMounted] = React3__default.useState(false);
|
|
2690
2735
|
React3__default.useEffect(() => {
|
|
2691
2736
|
setMounted(true);
|
|
@@ -2780,155 +2825,116 @@ function DrawerComponent(props) {
|
|
|
2780
2825
|
initial: false,
|
|
2781
2826
|
mode: "wait",
|
|
2782
2827
|
onExitComplete,
|
|
2783
|
-
children: open && /* @__PURE__ */
|
|
2828
|
+
children: open && /* @__PURE__ */ jsx(
|
|
2784
2829
|
Backdrop,
|
|
2785
2830
|
{
|
|
2786
2831
|
onClick: () => onBackdropClick(),
|
|
2787
|
-
children:
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
// px: 4,
|
|
2821
|
-
margin: "auto",
|
|
2822
|
-
borderRadius: 12,
|
|
2823
|
-
zIndex: 1,
|
|
2824
|
-
variants: {
|
|
2825
|
-
initial: { opacity: 0, scale: 0.5 },
|
|
2826
|
-
animate: {
|
|
2827
|
-
opacity: 1,
|
|
2828
|
-
scale: 1,
|
|
2829
|
-
transition: {
|
|
2830
|
-
type: "spring",
|
|
2831
|
-
damping: 20,
|
|
2832
|
-
stiffness: 300
|
|
2833
|
-
}
|
|
2834
|
-
},
|
|
2835
|
-
exit: {
|
|
2836
|
-
opacity: 0,
|
|
2837
|
-
scale: 0.3,
|
|
2838
|
-
transition: { type: "spring", duration: 0.45 }
|
|
2839
|
-
}
|
|
2840
|
-
}
|
|
2841
|
-
} : {
|
|
2842
|
-
w: "100vw",
|
|
2843
|
-
left: 0,
|
|
2844
|
-
right: 0,
|
|
2845
|
-
bottom: 0,
|
|
2846
|
-
borderTopLeftRadius: 12,
|
|
2847
|
-
borderTopRightRadius: 12,
|
|
2848
|
-
overflow: "hidden",
|
|
2849
|
-
// Note: Can't use framer-motion's `y` prop because it conflicts
|
|
2850
|
-
// with the drag motion value. Use CSS transform instead.
|
|
2851
|
-
variants: {
|
|
2852
|
-
initial: {
|
|
2853
|
-
transform: "translateY(100%)",
|
|
2854
|
-
opacity: 0.5
|
|
2855
|
-
},
|
|
2856
|
-
animate: {
|
|
2857
|
-
transform: "translateY(0%)",
|
|
2858
|
-
opacity: 1,
|
|
2859
|
-
transition: {
|
|
2860
|
-
type: "spring",
|
|
2861
|
-
damping: 22,
|
|
2862
|
-
stiffness: 400,
|
|
2863
|
-
mass: 0.7
|
|
2864
|
-
}
|
|
2865
|
-
},
|
|
2866
|
-
exit: {
|
|
2867
|
-
transform: "translateY(100%)",
|
|
2868
|
-
opacity: 0,
|
|
2869
|
-
transition: {
|
|
2870
|
-
type: "tween",
|
|
2871
|
-
duration: 0.2,
|
|
2872
|
-
ease: [0.4, 0, 1, 1]
|
|
2873
|
-
// ease-in for quick exit
|
|
2874
|
-
}
|
|
2832
|
+
children: /* @__PURE__ */ jsx(
|
|
2833
|
+
MotionDiv4,
|
|
2834
|
+
{
|
|
2835
|
+
grid: true,
|
|
2836
|
+
onClick: (e) => e.stopPropagation(),
|
|
2837
|
+
position: "fixed",
|
|
2838
|
+
initial: "initial",
|
|
2839
|
+
animate: "animate",
|
|
2840
|
+
exit: "exit",
|
|
2841
|
+
...isDesktop ? {
|
|
2842
|
+
drag: false,
|
|
2843
|
+
style: void 0,
|
|
2844
|
+
dragControls: null,
|
|
2845
|
+
dragConstraints: void 0,
|
|
2846
|
+
// style: null,
|
|
2847
|
+
// dragConstraints: null,
|
|
2848
|
+
height: props.height ?? "max-content!",
|
|
2849
|
+
// "min(50%, 300px)",
|
|
2850
|
+
width: props.width ?? "clamp(50%, 700px, 90%)",
|
|
2851
|
+
pt: 6,
|
|
2852
|
+
// px: 4,
|
|
2853
|
+
margin: "auto",
|
|
2854
|
+
borderRadius: 12,
|
|
2855
|
+
zIndex: 1,
|
|
2856
|
+
variants: {
|
|
2857
|
+
initial: { opacity: 0, scale: 0.5 },
|
|
2858
|
+
animate: {
|
|
2859
|
+
opacity: 1,
|
|
2860
|
+
scale: 1,
|
|
2861
|
+
transition: {
|
|
2862
|
+
type: "spring",
|
|
2863
|
+
damping: 20,
|
|
2864
|
+
stiffness: 300
|
|
2875
2865
|
}
|
|
2876
2866
|
},
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
// drag={hasBackdrop ? "y" : false}
|
|
2882
|
-
dragElastic: 0,
|
|
2883
|
-
// prevent drawer from being dragged higher than what its opened to
|
|
2884
|
-
dragConstraints: { top: 0 },
|
|
2885
|
-
onDragEnd: (_, drag) => {
|
|
2886
|
-
if (props.drag === false) return;
|
|
2887
|
-
const pageHeight = document.documentElement.scrollHeight;
|
|
2888
|
-
const yCoord = drag.point.y;
|
|
2889
|
-
const velocity = drag.velocity.y;
|
|
2890
|
-
const releaseThreshold = 0.8;
|
|
2891
|
-
const releasePct = yCoord / pageHeight;
|
|
2892
|
-
if (velocity > 25 && releasePct >= releaseThreshold || velocity > 750) {
|
|
2893
|
-
props.onClose?.();
|
|
2894
|
-
}
|
|
2867
|
+
exit: {
|
|
2868
|
+
opacity: 0,
|
|
2869
|
+
scale: 0.3,
|
|
2870
|
+
transition: { type: "spring", duration: 0.45 }
|
|
2895
2871
|
}
|
|
2896
|
-
}
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
]
|
|
2872
|
+
}
|
|
2873
|
+
} : {
|
|
2874
|
+
w: "100vw",
|
|
2875
|
+
left: 0,
|
|
2876
|
+
right: 0,
|
|
2877
|
+
bottom: 0,
|
|
2878
|
+
borderTopLeftRadius: 12,
|
|
2879
|
+
borderTopRightRadius: 12,
|
|
2880
|
+
overflow: "hidden",
|
|
2881
|
+
// Note: Can't use framer-motion's `y` prop because it conflicts
|
|
2882
|
+
// with the drag motion value. Use CSS transform instead.
|
|
2883
|
+
drag: "y",
|
|
2884
|
+
style: { y },
|
|
2885
|
+
dragControls,
|
|
2886
|
+
variants: mobileVariants,
|
|
2887
|
+
onPointerDown: (e) => onDragStart(e),
|
|
2888
|
+
// drag={hasBackdrop ? "y" : false}
|
|
2889
|
+
dragElastic: 0,
|
|
2890
|
+
// prevent drawer from being dragged higher than what its opened to
|
|
2891
|
+
dragConstraints: { top: 0 },
|
|
2892
|
+
onDragEnd: (_, drag) => {
|
|
2893
|
+
if (props.drag === false) return;
|
|
2894
|
+
const pageHeight = document.documentElement.scrollHeight;
|
|
2895
|
+
const yCoord = drag.point.y;
|
|
2896
|
+
const velocity = drag.velocity.y;
|
|
2897
|
+
const releaseThreshold = 0.8;
|
|
2898
|
+
const releasePct = yCoord / pageHeight;
|
|
2899
|
+
if (velocity > 25 && releasePct >= releaseThreshold || velocity > 750) {
|
|
2900
|
+
props.onClose?.();
|
|
2926
2901
|
}
|
|
2927
|
-
|
|
2902
|
+
}
|
|
2928
2903
|
},
|
|
2929
|
-
"
|
|
2930
|
-
|
|
2931
|
-
|
|
2904
|
+
boxSizing: "border-box",
|
|
2905
|
+
boxShadow: "hsl(0deg 0% 0% / 60%) 0px -4px 20px",
|
|
2906
|
+
color: "text-primary",
|
|
2907
|
+
bg: drawerBg,
|
|
2908
|
+
ref,
|
|
2909
|
+
...rest,
|
|
2910
|
+
children: /* @__PURE__ */ jsxs(
|
|
2911
|
+
MotionDiv4,
|
|
2912
|
+
{
|
|
2913
|
+
grid: true,
|
|
2914
|
+
...isDesktop ? { position: "relative" } : { rows: "max-content 1fr" },
|
|
2915
|
+
children: [
|
|
2916
|
+
!isDesktop && props.hideHandle !== false && /* @__PURE__ */ jsx(
|
|
2917
|
+
MotionDiv4,
|
|
2918
|
+
{
|
|
2919
|
+
grid: true,
|
|
2920
|
+
justifySelf: "center",
|
|
2921
|
+
h: 6,
|
|
2922
|
+
w: 34,
|
|
2923
|
+
mt: "16px",
|
|
2924
|
+
mb: 4,
|
|
2925
|
+
br: 20,
|
|
2926
|
+
bg: { base: "neutral.400", _dark: "neutral.600" },
|
|
2927
|
+
cursor: props.drag ? "row-resize" : "default",
|
|
2928
|
+
ref: dragHandleRef
|
|
2929
|
+
}
|
|
2930
|
+
),
|
|
2931
|
+
props.children
|
|
2932
|
+
]
|
|
2933
|
+
}
|
|
2934
|
+
)
|
|
2935
|
+
},
|
|
2936
|
+
"drawer"
|
|
2937
|
+
)
|
|
2932
2938
|
}
|
|
2933
2939
|
)
|
|
2934
2940
|
}
|
package/dist/server/index.cjs
CHANGED
|
@@ -277,6 +277,7 @@ __export(time_exports, {
|
|
|
277
277
|
formatDateRange: () => formatDateRange,
|
|
278
278
|
formatDuration: () => formatDuration,
|
|
279
279
|
formatThreadDateRange: () => formatThreadDateRange,
|
|
280
|
+
formatTimeAgo: () => formatTimeAgo,
|
|
280
281
|
now: () => now,
|
|
281
282
|
sleep: () => sleep,
|
|
282
283
|
startTimer: () => startTimer,
|
|
@@ -401,14 +402,43 @@ var formatDate = (input, options = {}) => {
|
|
|
401
402
|
return includeTime ? dateFns.format(date2, "MMM d, yyyy h:mm a") : dateFns.format(date2, "MMM d, yyyy");
|
|
402
403
|
case "long":
|
|
403
404
|
return includeTime ? dateFns.format(date2, "MMMM d, yyyy 'at' h:mm a") : dateFns.format(date2, "MMMM d, yyyy");
|
|
404
|
-
case "relative":
|
|
405
|
-
return dateFns.formatDistanceToNow(date2, { addSuffix: true });
|
|
406
405
|
case "year":
|
|
407
406
|
return dateFns.format(date2, "yyyy");
|
|
408
407
|
default:
|
|
409
408
|
return includeTime ? dateFns.format(date2, "MMM d, yyyy h:mm a") : dateFns.format(date2, "MMM d, yyyy");
|
|
410
409
|
}
|
|
411
410
|
};
|
|
411
|
+
var formatTimeAgo = (input, options = {}) => {
|
|
412
|
+
const { verbose = false } = options;
|
|
413
|
+
let date2;
|
|
414
|
+
if (typeof input === "string") {
|
|
415
|
+
date2 = new Date(input);
|
|
416
|
+
} else if (typeof input === "number") {
|
|
417
|
+
date2 = new Date(input);
|
|
418
|
+
} else {
|
|
419
|
+
date2 = input;
|
|
420
|
+
}
|
|
421
|
+
if (isNaN(date2.getTime())) {
|
|
422
|
+
return "Invalid Date";
|
|
423
|
+
}
|
|
424
|
+
if (verbose) {
|
|
425
|
+
return dateFns.formatDistanceToNow(date2, { addSuffix: true });
|
|
426
|
+
}
|
|
427
|
+
const diffMs = Date.now() - date2.getTime();
|
|
428
|
+
const diffSeconds = Math.floor(diffMs / 1e3);
|
|
429
|
+
const diffMinutes = Math.floor(diffSeconds / 60);
|
|
430
|
+
const diffHours = Math.floor(diffMinutes / 60);
|
|
431
|
+
const diffDays = Math.floor(diffHours / 24);
|
|
432
|
+
const diffWeeks = Math.floor(diffDays / 7);
|
|
433
|
+
const diffMonths = Math.floor(diffDays / 30);
|
|
434
|
+
const diffYears = Math.floor(diffDays / 365);
|
|
435
|
+
if (diffYears > 0) return `${diffYears}y ago`;
|
|
436
|
+
if (diffMonths > 0) return `${diffMonths}mo ago`;
|
|
437
|
+
if (diffWeeks > 0) return `${diffWeeks}w ago`;
|
|
438
|
+
if (diffDays > 0) return `${diffDays}d ago`;
|
|
439
|
+
if (diffHours > 0) return `${diffHours}h ago`;
|
|
440
|
+
return "just now";
|
|
441
|
+
};
|
|
412
442
|
var toDate = (input) => typeof input === "string" || typeof input === "number" ? new Date(input) : input;
|
|
413
443
|
var formatDateRange = (startInput, endInput, options = {}) => {
|
|
414
444
|
const now2 = options.now ?? /* @__PURE__ */ new Date();
|
package/dist/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { format,
|
|
1
|
+
import { format, formatISO, formatDistanceToNow, isSameYear, isSameMonth, isSameDay, addSeconds, addMinutes, addHours, addDays, addWeeks, addBusinessDays, addMonths, addYears } from 'date-fns';
|
|
2
2
|
import awaitSpawn from 'await-spawn';
|
|
3
3
|
import { promises } from 'fs';
|
|
4
4
|
import { ArkErrors } from 'arktype';
|
|
@@ -269,6 +269,7 @@ __export(time_exports, {
|
|
|
269
269
|
formatDateRange: () => formatDateRange,
|
|
270
270
|
formatDuration: () => formatDuration,
|
|
271
271
|
formatThreadDateRange: () => formatThreadDateRange,
|
|
272
|
+
formatTimeAgo: () => formatTimeAgo,
|
|
272
273
|
now: () => now,
|
|
273
274
|
sleep: () => sleep,
|
|
274
275
|
startTimer: () => startTimer,
|
|
@@ -393,14 +394,43 @@ var formatDate = (input, options = {}) => {
|
|
|
393
394
|
return includeTime ? format(date2, "MMM d, yyyy h:mm a") : format(date2, "MMM d, yyyy");
|
|
394
395
|
case "long":
|
|
395
396
|
return includeTime ? format(date2, "MMMM d, yyyy 'at' h:mm a") : format(date2, "MMMM d, yyyy");
|
|
396
|
-
case "relative":
|
|
397
|
-
return formatDistanceToNow(date2, { addSuffix: true });
|
|
398
397
|
case "year":
|
|
399
398
|
return format(date2, "yyyy");
|
|
400
399
|
default:
|
|
401
400
|
return includeTime ? format(date2, "MMM d, yyyy h:mm a") : format(date2, "MMM d, yyyy");
|
|
402
401
|
}
|
|
403
402
|
};
|
|
403
|
+
var formatTimeAgo = (input, options = {}) => {
|
|
404
|
+
const { verbose = false } = options;
|
|
405
|
+
let date2;
|
|
406
|
+
if (typeof input === "string") {
|
|
407
|
+
date2 = new Date(input);
|
|
408
|
+
} else if (typeof input === "number") {
|
|
409
|
+
date2 = new Date(input);
|
|
410
|
+
} else {
|
|
411
|
+
date2 = input;
|
|
412
|
+
}
|
|
413
|
+
if (isNaN(date2.getTime())) {
|
|
414
|
+
return "Invalid Date";
|
|
415
|
+
}
|
|
416
|
+
if (verbose) {
|
|
417
|
+
return formatDistanceToNow(date2, { addSuffix: true });
|
|
418
|
+
}
|
|
419
|
+
const diffMs = Date.now() - date2.getTime();
|
|
420
|
+
const diffSeconds = Math.floor(diffMs / 1e3);
|
|
421
|
+
const diffMinutes = Math.floor(diffSeconds / 60);
|
|
422
|
+
const diffHours = Math.floor(diffMinutes / 60);
|
|
423
|
+
const diffDays = Math.floor(diffHours / 24);
|
|
424
|
+
const diffWeeks = Math.floor(diffDays / 7);
|
|
425
|
+
const diffMonths = Math.floor(diffDays / 30);
|
|
426
|
+
const diffYears = Math.floor(diffDays / 365);
|
|
427
|
+
if (diffYears > 0) return `${diffYears}y ago`;
|
|
428
|
+
if (diffMonths > 0) return `${diffMonths}mo ago`;
|
|
429
|
+
if (diffWeeks > 0) return `${diffWeeks}w ago`;
|
|
430
|
+
if (diffDays > 0) return `${diffDays}d ago`;
|
|
431
|
+
if (diffHours > 0) return `${diffHours}h ago`;
|
|
432
|
+
return "just now";
|
|
433
|
+
};
|
|
404
434
|
var toDate = (input) => typeof input === "string" || typeof input === "number" ? new Date(input) : input;
|
|
405
435
|
var formatDateRange = (startInput, endInput, options = {}) => {
|
|
406
436
|
const now2 = options.now ?? /* @__PURE__ */ new Date();
|
package/dist/shared/time.d.ts
CHANGED
|
@@ -98,7 +98,7 @@ type DurationOptions = {
|
|
|
98
98
|
*/
|
|
99
99
|
export declare const formatDuration: (value: number | null | undefined, options?: DurationOptions) => string;
|
|
100
100
|
type DateInput = Date | string | number;
|
|
101
|
-
type DateFormatStyle = "iso" | "short" | "medium" | "long" | "
|
|
101
|
+
type DateFormatStyle = "iso" | "short" | "medium" | "long" | "year";
|
|
102
102
|
type DateOptions = {
|
|
103
103
|
/** Predefined format style */
|
|
104
104
|
style?: DateFormatStyle;
|
|
@@ -121,6 +121,49 @@ type DateOptions = {
|
|
|
121
121
|
* formatDate(date, { pattern: "yyyy-MM-dd" }) // Custom format
|
|
122
122
|
*/
|
|
123
123
|
export declare const formatDate: (input: DateInput, options?: DateOptions) => string;
|
|
124
|
+
type TimeAgoInput = Date | string | number;
|
|
125
|
+
type TimeAgoOptions = {
|
|
126
|
+
/** Use verbose format ("about 3 hours ago") instead of compact ("3h ago"). Default: false */
|
|
127
|
+
verbose?: boolean;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Formats a past date as relative elapsed time ("3h ago", "1d ago", "just now").
|
|
131
|
+
*
|
|
132
|
+
* Compact by default for UI badges, sync indicators, and timestamps.
|
|
133
|
+
* Use `verbose: true` for accessibility or screen readers.
|
|
134
|
+
*
|
|
135
|
+
* @param input - Date to format (Date object, ISO string, or Unix timestamp)
|
|
136
|
+
* @param options - Configuration options
|
|
137
|
+
* @param options.verbose - Use verbose format ("about 3 hours ago") instead of compact ("3h ago")
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* // COMPACT FORMAT (default) - Best for UI badges, sync indicators
|
|
142
|
+
*
|
|
143
|
+
* formatTimeAgo(new Date()) // "just now"
|
|
144
|
+
* formatTimeAgo(Date.now() - 1000 * 60 * 30) // "just now" (< 1 hour)
|
|
145
|
+
* formatTimeAgo(Date.now() - 1000 * 60 * 60 * 3) // "3h ago"
|
|
146
|
+
* formatTimeAgo(Date.now() - 1000 * 60 * 60 * 24) // "1d ago"
|
|
147
|
+
* formatTimeAgo(Date.now() - 1000 * 60 * 60 * 24 * 5) // "5d ago"
|
|
148
|
+
*
|
|
149
|
+
* // VERBOSE FORMAT - Best for accessibility, screen readers
|
|
150
|
+
*
|
|
151
|
+
* formatTimeAgo(date, { verbose: true }) // "about 3 hours ago"
|
|
152
|
+
* formatTimeAgo(date, { verbose: true }) // "5 days ago"
|
|
153
|
+
*
|
|
154
|
+
* // COMMON USE CASES
|
|
155
|
+
*
|
|
156
|
+
* // Search index freshness indicator
|
|
157
|
+
* `${count} songs indexed · ${formatTimeAgo(buildTime)}` // "1,234 songs indexed · 3h ago"
|
|
158
|
+
*
|
|
159
|
+
* // Last sync timestamp
|
|
160
|
+
* `Last synced ${formatTimeAgo(lastSync)}` // "Last synced 5d ago"
|
|
161
|
+
*
|
|
162
|
+
* // Comment timestamps
|
|
163
|
+
* `Posted ${formatTimeAgo(createdAt)}` // "Posted just now"
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
export declare const formatTimeAgo: (input: TimeAgoInput, options?: TimeAgoOptions) => string;
|
|
124
167
|
type DateRangeInput = Date | string | number;
|
|
125
168
|
type DateRangeOptions = {
|
|
126
169
|
/** Reference date for today checks (defaults to new Date()) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/shared/time.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/shared/time.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
package/styled-system/styles.css
CHANGED
|
@@ -1017,14 +1017,6 @@
|
|
|
1017
1017
|
stroke-width: 4;
|
|
1018
1018
|
}
|
|
1019
1019
|
|
|
1020
|
-
.fixed_true {
|
|
1021
|
-
position: fixed;
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
.pointer-events_none {
|
|
1025
|
-
pointer-events: none;
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
1020
|
.pos_fixed {
|
|
1029
1021
|
position: fixed;
|
|
1030
1022
|
}
|
|
@@ -1167,6 +1159,10 @@
|
|
|
1167
1159
|
grid-auto-flow: column;
|
|
1168
1160
|
}
|
|
1169
1161
|
|
|
1162
|
+
.pointer-events_none {
|
|
1163
|
+
pointer-events: none;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1170
1166
|
.trf-o_top_left {
|
|
1171
1167
|
transform-origin: top left;
|
|
1172
1168
|
}
|
|
@@ -1331,22 +1327,6 @@
|
|
|
1331
1327
|
width: 100%;
|
|
1332
1328
|
}
|
|
1333
1329
|
|
|
1334
|
-
.left_0 {
|
|
1335
|
-
left: var(--spacing-0);
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
.right_0 {
|
|
1339
|
-
right: var(--spacing-0);
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
.bottom_0 {
|
|
1343
|
-
bottom: var(--spacing-0);
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
.h_96 {
|
|
1347
|
-
height: 96px;
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
1330
|
.h_max-content\! {
|
|
1351
1331
|
height: max-content !important;
|
|
1352
1332
|
}
|
|
@@ -1363,6 +1343,18 @@
|
|
|
1363
1343
|
width: 100vw;
|
|
1364
1344
|
}
|
|
1365
1345
|
|
|
1346
|
+
.left_0 {
|
|
1347
|
+
left: var(--spacing-0);
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
.right_0 {
|
|
1351
|
+
right: var(--spacing-0);
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
.bottom_0 {
|
|
1355
|
+
bottom: var(--spacing-0);
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1366
1358
|
.bdr-tl_12 {
|
|
1367
1359
|
border-top-left-radius: 12px;
|
|
1368
1360
|
}
|