@ai-matrx/associations 0.7.6 → 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.
@@ -289,13 +289,6 @@ interface AssociationPickerBridge {
289
289
  }
290
290
  declare function useAssociationPickerBridge(props: Pick<AssociationPickerProps, "attachedIds" | "onAttach" | "onDetach" | "token">, options?: AssociationPickerBridgeOptions): AssociationPickerBridge;
291
291
 
292
- /**
293
- * "just now" under a minute, then the largest whole unit ("5 minutes ago",
294
- * "2 days ago"). An unparseable timestamp returns the raw string rather than
295
- * "Invalid Date" chrome — degraded, never broken.
296
- */
297
- declare function formatRelativeTime(iso: string, now?: number): string;
298
-
299
292
  interface ContentRoleMeta {
300
293
  id: ContentRole;
301
294
  /** Section heading. */
@@ -311,4 +304,4 @@ interface ContentRoleMeta {
311
304
  declare const CONTENT_ROLES: ContentRoleMeta[];
312
305
  declare function getContentRoleMeta(role: ContentRole): ContentRoleMeta;
313
306
 
314
- export { AssociationCandidateBody, type AssociationCandidateBodyProps, AssociationPicker, type AssociationPickerBridge, type AssociationPickerBridgeOptions, AssociationPickerProps, AssociationsProvider, type AssociationsProviderProps, type AssociationsUiPorts, CONTENT_ROLES, CandidateRecord, type CategoryCreateResult, CategoryMutationResult, type ContentRoleMeta, DefaultWindowShell, type DefaultWindowShellProps, DoorControlsSlot, DoorRef, type EntityTitleRef, type PickerBridgeItem, UniversalCandidate, UnresolvedRef, type UseAssociationCandidatesArgs, type UseAssociationCandidatesReturn, type UseCategoriesArgs, type UseCategoriesReturn, type UseCommentsArgs, type UseCommentsReturn, type UseEntityTitlesReturn, type UseUniversalEntitySearchArgs, type UseUniversalEntitySearchReturn, type WindowShellComponentProps, formatRelativeTime, getContentRoleMeta, lazyPickerOverride, lazyWindowShell, useAssociationCandidates, useAssociationPickerBridge, useAssociationsStore, useAssociationsUiPorts, useCategories, useComments, useEntityTitles, useNotifier, useUniversalEntitySearch };
307
+ export { AssociationCandidateBody, type AssociationCandidateBodyProps, AssociationPicker, type AssociationPickerBridge, type AssociationPickerBridgeOptions, AssociationPickerProps, AssociationsProvider, type AssociationsProviderProps, type AssociationsUiPorts, CONTENT_ROLES, CandidateRecord, type CategoryCreateResult, CategoryMutationResult, type ContentRoleMeta, DefaultWindowShell, type DefaultWindowShellProps, DoorControlsSlot, DoorRef, type EntityTitleRef, type PickerBridgeItem, UniversalCandidate, UnresolvedRef, type UseAssociationCandidatesArgs, type UseAssociationCandidatesReturn, type UseCategoriesArgs, type UseCategoriesReturn, type UseCommentsArgs, type UseCommentsReturn, type UseEntityTitlesReturn, type UseUniversalEntitySearchArgs, type UseUniversalEntitySearchReturn, type WindowShellComponentProps, getContentRoleMeta, lazyPickerOverride, lazyWindowShell, useAssociationCandidates, useAssociationPickerBridge, useAssociationsStore, useAssociationsUiPorts, useCategories, useComments, useEntityTitles, useNotifier, useUniversalEntitySearch };
@@ -289,13 +289,6 @@ interface AssociationPickerBridge {
289
289
  }
290
290
  declare function useAssociationPickerBridge(props: Pick<AssociationPickerProps, "attachedIds" | "onAttach" | "onDetach" | "token">, options?: AssociationPickerBridgeOptions): AssociationPickerBridge;
291
291
 
292
- /**
293
- * "just now" under a minute, then the largest whole unit ("5 minutes ago",
294
- * "2 days ago"). An unparseable timestamp returns the raw string rather than
295
- * "Invalid Date" chrome — degraded, never broken.
296
- */
297
- declare function formatRelativeTime(iso: string, now?: number): string;
298
-
299
292
  interface ContentRoleMeta {
300
293
  id: ContentRole;
301
294
  /** Section heading. */
@@ -311,4 +304,4 @@ interface ContentRoleMeta {
311
304
  declare const CONTENT_ROLES: ContentRoleMeta[];
312
305
  declare function getContentRoleMeta(role: ContentRole): ContentRoleMeta;
313
306
 
314
- export { AssociationCandidateBody, type AssociationCandidateBodyProps, AssociationPicker, type AssociationPickerBridge, type AssociationPickerBridgeOptions, AssociationPickerProps, AssociationsProvider, type AssociationsProviderProps, type AssociationsUiPorts, CONTENT_ROLES, CandidateRecord, type CategoryCreateResult, CategoryMutationResult, type ContentRoleMeta, DefaultWindowShell, type DefaultWindowShellProps, DoorControlsSlot, DoorRef, type EntityTitleRef, type PickerBridgeItem, UniversalCandidate, UnresolvedRef, type UseAssociationCandidatesArgs, type UseAssociationCandidatesReturn, type UseCategoriesArgs, type UseCategoriesReturn, type UseCommentsArgs, type UseCommentsReturn, type UseEntityTitlesReturn, type UseUniversalEntitySearchArgs, type UseUniversalEntitySearchReturn, type WindowShellComponentProps, formatRelativeTime, getContentRoleMeta, lazyPickerOverride, lazyWindowShell, useAssociationCandidates, useAssociationPickerBridge, useAssociationsStore, useAssociationsUiPorts, useCategories, useComments, useEntityTitles, useNotifier, useUniversalEntitySearch };
307
+ export { AssociationCandidateBody, type AssociationCandidateBodyProps, AssociationPicker, type AssociationPickerBridge, type AssociationPickerBridgeOptions, AssociationPickerProps, AssociationsProvider, type AssociationsProviderProps, type AssociationsUiPorts, CONTENT_ROLES, CandidateRecord, type CategoryCreateResult, CategoryMutationResult, type ContentRoleMeta, DefaultWindowShell, type DefaultWindowShellProps, DoorControlsSlot, DoorRef, type EntityTitleRef, type PickerBridgeItem, UniversalCandidate, UnresolvedRef, type UseAssociationCandidatesArgs, type UseAssociationCandidatesReturn, type UseCategoriesArgs, type UseCategoriesReturn, type UseCommentsArgs, type UseCommentsReturn, type UseEntityTitlesReturn, type UseUniversalEntitySearchArgs, type UseUniversalEntitySearchReturn, type WindowShellComponentProps, getContentRoleMeta, lazyPickerOverride, lazyWindowShell, useAssociationCandidates, useAssociationPickerBridge, useAssociationsStore, useAssociationsUiPorts, useCategories, useComments, useEntityTitles, useNotifier, useUniversalEntitySearch };
@@ -4739,32 +4739,7 @@ function CategoryTagPicker({
4739
4739
  // src/react/components/CommentThread.tsx
4740
4740
  import { useState as useState17 } from "react";
4741
4741
  import { Button as Button3, Skeleton as Skeleton2, cn as cn12 } from "@ai-matrx/design-system";
4742
-
4743
- // src/react/relativeTime.ts
4744
- var UNITS = [
4745
- { unit: "year", ms: 365 * 24 * 60 * 60 * 1e3 },
4746
- { unit: "month", ms: 30 * 24 * 60 * 60 * 1e3 },
4747
- { unit: "week", ms: 7 * 24 * 60 * 60 * 1e3 },
4748
- { unit: "day", ms: 24 * 60 * 60 * 1e3 },
4749
- { unit: "hour", ms: 60 * 60 * 1e3 },
4750
- { unit: "minute", ms: 60 * 1e3 }
4751
- ];
4752
- function formatRelativeTime(iso, now = Date.now()) {
4753
- const t = Date.parse(iso);
4754
- if (Number.isNaN(t)) return iso;
4755
- const delta = t - now;
4756
- const magnitude = Math.abs(delta);
4757
- if (magnitude < 60 * 1e3) return "just now";
4758
- const rtf = new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
4759
- for (const { unit, ms } of UNITS) {
4760
- if (magnitude >= ms) {
4761
- return rtf.format(Math.trunc(delta / ms), unit);
4762
- }
4763
- }
4764
- return "just now";
4765
- }
4766
-
4767
- // src/react/components/CommentThread.tsx
4742
+ import { formatRelativeTime } from "@ai-matrx/kit/format";
4768
4743
  import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
4769
4744
  var AUTHOR_DOOR_TOKEN = "user";
4770
4745
  function resolveAuthor(comment, authorDisplay) {
@@ -4918,7 +4893,10 @@ function CommentItem({
4918
4893
  {
4919
4894
  className: "text-xs text-muted-foreground",
4920
4895
  title: comment.createdAt,
4921
- children: formatRelativeTime(comment.createdAt)
4896
+ children: formatRelativeTime(comment.createdAt, {
4897
+ style: "intl",
4898
+ fallbackToInput: true
4899
+ })
4922
4900
  }
4923
4901
  ),
4924
4902
  edited && /* @__PURE__ */ jsx18(
@@ -5166,7 +5144,6 @@ export {
5166
5144
  UnresolvedRef,
5167
5145
  attachedKey,
5168
5146
  buildCommentTree,
5169
- formatRelativeTime,
5170
5147
  getContentRoleMeta,
5171
5148
  lazyPickerOverride,
5172
5149
  lazyWindowShell,