@ai-matrx/associations 0.7.5 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/dist/core/index.cjs +5 -7
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +1 -3
- package/dist/core/index.d.ts +1 -3
- package/dist/core/index.js +5 -7
- package/dist/core/index.js.map +1 -1
- package/dist/react/index.cjs +5 -28
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -8
- package/dist/react/index.d.ts +1 -8
- package/dist/react/index.js +5 -28
- package/dist/react/index.js.map +1 -1
- package/package.json +5 -4
package/dist/react/index.cjs
CHANGED
|
@@ -46,7 +46,6 @@ __export(react_exports, {
|
|
|
46
46
|
UnresolvedRef: () => UnresolvedRef,
|
|
47
47
|
attachedKey: () => attachedKey,
|
|
48
48
|
buildCommentTree: () => buildCommentTree,
|
|
49
|
-
formatRelativeTime: () => formatRelativeTime,
|
|
50
49
|
getContentRoleMeta: () => getContentRoleMeta,
|
|
51
50
|
lazyPickerOverride: () => lazyPickerOverride,
|
|
52
51
|
lazyWindowShell: () => lazyWindowShell,
|
|
@@ -4753,32 +4752,7 @@ function CategoryTagPicker({
|
|
|
4753
4752
|
// src/react/components/CommentThread.tsx
|
|
4754
4753
|
var import_react24 = require("react");
|
|
4755
4754
|
var import_design_system13 = require("@ai-matrx/design-system");
|
|
4756
|
-
|
|
4757
|
-
// src/react/relativeTime.ts
|
|
4758
|
-
var UNITS = [
|
|
4759
|
-
{ unit: "year", ms: 365 * 24 * 60 * 60 * 1e3 },
|
|
4760
|
-
{ unit: "month", ms: 30 * 24 * 60 * 60 * 1e3 },
|
|
4761
|
-
{ unit: "week", ms: 7 * 24 * 60 * 60 * 1e3 },
|
|
4762
|
-
{ unit: "day", ms: 24 * 60 * 60 * 1e3 },
|
|
4763
|
-
{ unit: "hour", ms: 60 * 60 * 1e3 },
|
|
4764
|
-
{ unit: "minute", ms: 60 * 1e3 }
|
|
4765
|
-
];
|
|
4766
|
-
function formatRelativeTime(iso, now = Date.now()) {
|
|
4767
|
-
const t = Date.parse(iso);
|
|
4768
|
-
if (Number.isNaN(t)) return iso;
|
|
4769
|
-
const delta = t - now;
|
|
4770
|
-
const magnitude = Math.abs(delta);
|
|
4771
|
-
if (magnitude < 60 * 1e3) return "just now";
|
|
4772
|
-
const rtf = new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
|
|
4773
|
-
for (const { unit, ms } of UNITS) {
|
|
4774
|
-
if (magnitude >= ms) {
|
|
4775
|
-
return rtf.format(Math.trunc(delta / ms), unit);
|
|
4776
|
-
}
|
|
4777
|
-
}
|
|
4778
|
-
return "just now";
|
|
4779
|
-
}
|
|
4780
|
-
|
|
4781
|
-
// src/react/components/CommentThread.tsx
|
|
4755
|
+
var import_format = require("@ai-matrx/kit/format");
|
|
4782
4756
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
4783
4757
|
var AUTHOR_DOOR_TOKEN = "user";
|
|
4784
4758
|
function resolveAuthor(comment, authorDisplay) {
|
|
@@ -4932,7 +4906,10 @@ function CommentItem({
|
|
|
4932
4906
|
{
|
|
4933
4907
|
className: "text-xs text-muted-foreground",
|
|
4934
4908
|
title: comment.createdAt,
|
|
4935
|
-
children: formatRelativeTime(comment.createdAt
|
|
4909
|
+
children: (0, import_format.formatRelativeTime)(comment.createdAt, {
|
|
4910
|
+
style: "intl",
|
|
4911
|
+
fallbackToInput: true
|
|
4912
|
+
})
|
|
4936
4913
|
}
|
|
4937
4914
|
),
|
|
4938
4915
|
edited && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|