@burdenoff/microfe-labsofscience 2026.820.5 → 2026.827.1

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.
Files changed (60) hide show
  1. package/dist/labsofscience/hooks/index.d.ts +1 -1
  2. package/dist/labsofscience/hooks/index.d.ts.map +1 -1
  3. package/dist/labsofscience/hooks/useLabsOfScienceApi.d.ts +11 -2
  4. package/dist/labsofscience/hooks/useLabsOfScienceApi.d.ts.map +1 -1
  5. package/dist/labsofscience/hooks/useLabsOfScienceApi.js +84 -54
  6. package/dist/labsofscience/hooks/useLabsOfScienceApi.js.map +1 -1
  7. package/dist/labsofscience/pages/ai/aiReaders.d.ts +28 -0
  8. package/dist/labsofscience/pages/ai/aiReaders.d.ts.map +1 -1
  9. package/dist/labsofscience/pages/ai/aiReaders.js +14 -1
  10. package/dist/labsofscience/pages/ai/aiReaders.js.map +1 -1
  11. package/dist/labsofscience/pages/analytics/AnalyticsPage.d.ts.map +1 -1
  12. package/dist/labsofscience/pages/analytics/AnalyticsPage.js +168 -106
  13. package/dist/labsofscience/pages/analytics/AnalyticsPage.js.map +1 -1
  14. package/dist/labsofscience/pages/datasets/DatasetDetailPage.d.ts.map +1 -1
  15. package/dist/labsofscience/pages/datasets/DatasetDetailPage.js +98 -78
  16. package/dist/labsofscience/pages/datasets/DatasetDetailPage.js.map +1 -1
  17. package/dist/labsofscience/pages/experiments/AcceptRecommendationDialog.d.ts +25 -0
  18. package/dist/labsofscience/pages/experiments/AcceptRecommendationDialog.d.ts.map +1 -0
  19. package/dist/labsofscience/pages/experiments/AcceptRecommendationDialog.js +104 -0
  20. package/dist/labsofscience/pages/experiments/AcceptRecommendationDialog.js.map +1 -0
  21. package/dist/labsofscience/pages/experiments/ExperimentAiPanel.d.ts +30 -0
  22. package/dist/labsofscience/pages/experiments/ExperimentAiPanel.d.ts.map +1 -0
  23. package/dist/labsofscience/pages/experiments/ExperimentAiPanel.js +151 -0
  24. package/dist/labsofscience/pages/experiments/ExperimentAiPanel.js.map +1 -0
  25. package/dist/labsofscience/pages/experiments/ExperimentDetailPage.d.ts.map +1 -1
  26. package/dist/labsofscience/pages/experiments/ExperimentDetailPage.js +25 -17
  27. package/dist/labsofscience/pages/experiments/ExperimentDetailPage.js.map +1 -1
  28. package/dist/labsofscience/pages/experiments/ExperimentsListPage.d.ts.map +1 -1
  29. package/dist/labsofscience/pages/experiments/ExperimentsListPage.js +118 -82
  30. package/dist/labsofscience/pages/experiments/ExperimentsListPage.js.map +1 -1
  31. package/dist/labsofscience/pages/instruments/BookInstrumentDialog.d.ts +10 -2
  32. package/dist/labsofscience/pages/instruments/BookInstrumentDialog.d.ts.map +1 -1
  33. package/dist/labsofscience/pages/instruments/BookInstrumentDialog.js +165 -53
  34. package/dist/labsofscience/pages/instruments/BookInstrumentDialog.js.map +1 -1
  35. package/dist/labsofscience/pages/instruments/InstrumentsListPage.d.ts.map +1 -1
  36. package/dist/labsofscience/pages/instruments/InstrumentsListPage.js +158 -122
  37. package/dist/labsofscience/pages/instruments/InstrumentsListPage.js.map +1 -1
  38. package/dist/labsofscience/pages/inventory/AdjustInventoryDialog.d.ts.map +1 -1
  39. package/dist/labsofscience/pages/inventory/AdjustInventoryDialog.js +171 -54
  40. package/dist/labsofscience/pages/inventory/AdjustInventoryDialog.js.map +1 -1
  41. package/dist/labsofscience/pages/inventory/InventoryListPage.d.ts.map +1 -1
  42. package/dist/labsofscience/pages/inventory/InventoryListPage.js +21 -0
  43. package/dist/labsofscience/pages/inventory/InventoryListPage.js.map +1 -1
  44. package/dist/labsofscience/pages/notebook/NotebookEntryDetailPage.js +4 -4
  45. package/dist/labsofscience/pages/pipelines/PipelinesPage.d.ts.map +1 -1
  46. package/dist/labsofscience/pages/pipelines/PipelinesPage.js +172 -123
  47. package/dist/labsofscience/pages/pipelines/PipelinesPage.js.map +1 -1
  48. package/dist/labsofscience/pages/projects/ProjectsListPage.d.ts.map +1 -1
  49. package/dist/labsofscience/pages/projects/ProjectsListPage.js +9 -0
  50. package/dist/labsofscience/pages/projects/ProjectsListPage.js.map +1 -1
  51. package/dist/labsofscience/pages/protocols/ProtocolDetailPage.d.ts.map +1 -1
  52. package/dist/labsofscience/pages/protocols/ProtocolDetailPage.js +186 -124
  53. package/dist/labsofscience/pages/protocols/ProtocolDetailPage.js.map +1 -1
  54. package/dist/labsofscience/types/index.d.ts +20 -0
  55. package/dist/labsofscience/types/index.d.ts.map +1 -1
  56. package/dist/labsofscience/utils/formatters.d.ts +13 -0
  57. package/dist/labsofscience/utils/formatters.d.ts.map +1 -1
  58. package/dist/labsofscience/utils/formatters.js +28 -7
  59. package/dist/labsofscience/utils/formatters.js.map +1 -1
  60. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../../src/labsofscience/utils/formatters.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAC1C,MAAM,CAQR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,GAC5C,MAAM,CAWR;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAoB9D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,MAAM,CAE/F;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAS9E;AAED;;;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AgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAU7E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAqBtD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,EAC3C,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,GAC3C,MAAM,CAgBR"}
@@ -1,5 +1,14 @@
1
1
  //#region src/labsofscience/utils/formatters.ts
2
2
  function e(e, t) {
3
+ return new Intl.NumberFormat("en-IN", {
4
+ style: "currency",
5
+ currency: "INR",
6
+ minimumFractionDigits: 2,
7
+ maximumFractionDigits: 2,
8
+ ...t
9
+ }).format(e);
10
+ }
11
+ function t(e, t) {
3
12
  let n = typeof e == "string" ? new Date(e) : e;
4
13
  return new Intl.DateTimeFormat("en-IN", {
5
14
  day: "numeric",
@@ -11,7 +20,7 @@ function e(e, t) {
11
20
  ...t
12
21
  }).format(n);
13
22
  }
14
- function t(e) {
23
+ function n(e) {
15
24
  let t = typeof e == "string" ? new Date(e) : e, n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 1e3), i = Math.floor(r / 60), a = Math.floor(i / 60), o = Math.floor(a / 24), s = Math.floor(o / 7), c = Math.floor(o / 30);
16
25
  if (r < 60) return "just now";
17
26
  if (i < 60) return `${i} min${i === 1 ? "" : "s"} ago`;
@@ -22,10 +31,10 @@ function t(e) {
22
31
  let l = Math.floor(o / 365);
23
32
  return `${l} year${l === 1 ? "" : "s"} ago`;
24
33
  }
25
- function n(e, t) {
34
+ function r(e, t) {
26
35
  return new Intl.NumberFormat("en-IN", t).format(e);
27
36
  }
28
- function r(e) {
37
+ function i(e) {
29
38
  if (!e) return "—";
30
39
  let t = typeof e == "string" ? new Date(e) : e;
31
40
  return Number.isNaN(t.getTime()) ? "—" : new Intl.DateTimeFormat("en-IN", {
@@ -34,10 +43,10 @@ function r(e) {
34
43
  year: "numeric"
35
44
  }).format(t);
36
45
  }
37
- function i(e) {
46
+ function a(e) {
38
47
  return e.toLowerCase().split(/[_\s]+/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
39
48
  }
40
- function a(e) {
49
+ function o(e) {
41
50
  if (e == null) return "—";
42
51
  let t = typeof e == "string" ? Number(e) : e;
43
52
  if (!Number.isFinite(t) || t < 0) return "—";
@@ -52,7 +61,7 @@ function a(e) {
52
61
  ], r = Math.min(Math.floor(Math.log(t) / Math.log(1024)), n.length - 1), i = t / 1024 ** r;
53
62
  return `${r === 0 ? i : Math.round(i * 10) / 10} ${n[r]}`;
54
63
  }
55
- function o(e) {
64
+ function s(e) {
56
65
  if (e < 1) return "instant";
57
66
  if (e < 60) return `${e} min`;
58
67
  let t = Math.floor(e / 60), n = e % 60;
@@ -60,7 +69,19 @@ function o(e) {
60
69
  let r = Math.floor(t / 24), i = t % 24;
61
70
  return i === 0 ? `${r} day${r === 1 ? "" : "s"}` : `${r} day${r === 1 ? "" : "s"} ${i}h`;
62
71
  }
72
+ function c(e, t) {
73
+ if (!e || !t) return "—";
74
+ let n = typeof e == "string" ? new Date(e) : e, r = typeof t == "string" ? new Date(t) : t;
75
+ if (Number.isNaN(n.getTime()) || Number.isNaN(r.getTime())) return "—";
76
+ let i = Math.floor((r.getTime() - n.getTime()) / 1e3);
77
+ if (i < 0) return "—";
78
+ if (i < 60) return `${i}s`;
79
+ let a = Math.floor(i / 60);
80
+ if (a < 60) return `${a}m`;
81
+ let o = Math.floor(a / 60), s = a % 60;
82
+ return s === 0 ? `${o}h` : `${o}h ${s}m`;
83
+ }
63
84
  //#endregion
64
- export { a as formatBytes, e as formatDate, r as formatDateShort, o as formatDuration, n as formatNumber, t as formatRelativeTime, i as titleCase };
85
+ export { o as formatBytes, e as formatCurrency, t as formatDate, i as formatDateShort, s as formatDuration, c as formatElapsed, r as formatNumber, n as formatRelativeTime, a as titleCase };
65
86
 
66
87
  //# sourceMappingURL=formatters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"formatters.js","names":[],"sources":["../../../src/labsofscience/utils/formatters.ts"],"sourcesContent":["/**\n * Formatting utilities for the LabsOfScience microfrontend\n * @module labsofscience/utils/formatters\n */\n\n/**\n * Format a number as Indian Rupees (INR) currency\n *\n * @param amount - The numeric amount to format\n * @param options - Optional Intl.NumberFormat options to override defaults\n * @returns Formatted currency string (e.g., \"₹1,200.00\")\n *\n * @example\n * formatCurrency(1200) // => \"₹1,200.00\"\n * formatCurrency(0) // => \"₹0.00\"\n * formatCurrency(1200, { minimumFractionDigits: 0 }) // => \"₹1,200\"\n */\nexport function formatCurrency(\n amount: number,\n options?: Partial<Intl.NumberFormatOptions>\n): string {\n return new Intl.NumberFormat('en-IN', {\n style: 'currency',\n currency: 'INR',\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n ...options,\n }).format(amount);\n}\n\n/**\n * Format a date string or Date object into a human-readable format\n *\n * @param date - ISO date string or Date object\n * @param options - Optional Intl.DateTimeFormat options\n * @returns Formatted date string (e.g., \"15 Jan 2024, 4:00 PM\")\n *\n * @example\n * formatDate('2024-01-15T10:30:00Z')\n * // => \"15 Jan 2024, 4:00 PM\" (in IST)\n */\nexport function formatDate(\n date: string | Date,\n options?: Partial<Intl.DateTimeFormatOptions>\n): string {\n const d = typeof date === 'string' ? new Date(date) : date;\n return new Intl.DateTimeFormat('en-IN', {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n hour12: true,\n ...options,\n }).format(d);\n}\n\n/**\n * Format a date into a relative time string (e.g., \"2 hours ago\")\n *\n * @param date - ISO date string or Date object\n * @returns Human-readable relative time string\n *\n * @example\n * formatRelativeTime('2024-01-15T10:30:00Z') // => \"3 days ago\"\n * formatRelativeTime(new Date()) // => \"just now\"\n */\nexport function formatRelativeTime(date: string | Date): string {\n const d = typeof date === 'string' ? new Date(date) : date;\n const now = new Date();\n const diffMs = now.getTime() - d.getTime();\n const diffSeconds = Math.floor(diffMs / 1000);\n const diffMinutes = Math.floor(diffSeconds / 60);\n const diffHours = Math.floor(diffMinutes / 60);\n const diffDays = Math.floor(diffHours / 24);\n const diffWeeks = Math.floor(diffDays / 7);\n const diffMonths = Math.floor(diffDays / 30);\n\n if (diffSeconds < 60) return 'just now';\n if (diffMinutes < 60) return `${diffMinutes} min${diffMinutes !== 1 ? 's' : ''} ago`;\n if (diffHours < 24) return `${diffHours} hour${diffHours !== 1 ? 's' : ''} ago`;\n if (diffDays < 7) return `${diffDays} day${diffDays !== 1 ? 's' : ''} ago`;\n if (diffWeeks < 4) return `${diffWeeks} week${diffWeeks !== 1 ? 's' : ''} ago`;\n if (diffMonths < 12) return `${diffMonths} month${diffMonths !== 1 ? 's' : ''} ago`;\n\n const diffYears = Math.floor(diffDays / 365);\n return `${diffYears} year${diffYears !== 1 ? 's' : ''} ago`;\n}\n\n/**\n * Format a number with Indian locale grouping (lakhs, crores)\n *\n * @param value - The number to format\n * @param options - Optional Intl.NumberFormat options\n * @returns Formatted number string (e.g., \"12,345\" or \"1,24,500\")\n *\n * @example\n * formatNumber(1245) // => \"1,245\"\n * formatNumber(124500) // => \"1,24,500\"\n */\nexport function formatNumber(value: number, options?: Partial<Intl.NumberFormatOptions>): string {\n return new Intl.NumberFormat('en-IN', options).format(value);\n}\n\n/**\n * Format a date as a compact day-month-year string (no time component).\n *\n * @param date - ISO date string or Date object (null/undefined renders \"—\")\n * @returns Formatted date string (e.g., \"15 Jan 2026\") or \"—\"\n */\nexport function formatDateShort(date: string | Date | null | undefined): string {\n if (!date) return '—';\n const d = typeof date === 'string' ? new Date(date) : date;\n if (Number.isNaN(d.getTime())) return '—';\n return new Intl.DateTimeFormat('en-IN', {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n }).format(d);\n}\n\n/**\n * Convert an UPPER_SNAKE_CASE enum value into a Title Case label.\n *\n * @example\n * titleCase('IN_PROGRESS') // => \"In Progress\"\n * titleCase('REAGENT') // => \"Reagent\"\n */\nexport function titleCase(value: string): string {\n return value\n .toLowerCase()\n .split(/[_\\s]+/)\n .filter(Boolean)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n}\n\n/**\n * Format a byte count (accepts a string because `sizeBytes` is a String on the\n * wire to avoid 53-bit precision loss) into a human-readable size.\n *\n * @example\n * formatBytes('2048') // => \"2 KB\"\n * formatBytes('1572864') // => \"1.5 MB\"\n */\nexport function formatBytes(bytes: string | number | null | undefined): string {\n if (bytes === null || bytes === undefined) return '—';\n const value = typeof bytes === 'string' ? Number(bytes) : bytes;\n if (!Number.isFinite(value) || value < 0) return '—';\n if (value === 0) return '0 B';\n const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];\n const exponent = Math.min(Math.floor(Math.log(value) / Math.log(1024)), units.length - 1);\n const scaled = value / 1024 ** exponent;\n const rounded = exponent === 0 ? scaled : Math.round(scaled * 10) / 10;\n return `${rounded} ${units[exponent]}`;\n}\n\n/**\n * Format a distance value in kilometers\n *\n * @param km - Distance in kilometers\n * @returns Formatted distance string\n *\n * @example\n * formatDistance(0.5) // => \"500 m\"\n * formatDistance(1.2) // => \"1.2 km\"\n * formatDistance(15) // => \"15 km\"\n */\nexport function formatDistance(km: number): string {\n if (km < 1) {\n return `${Math.round(km * 1000)} m`;\n }\n if (km < 10) {\n return `${km.toFixed(1)} km`;\n }\n return `${Math.round(km)} km`;\n}\n\n/**\n * Format a duration in minutes into a human-readable string\n *\n * @param minutes - Duration in minutes\n * @returns Formatted duration string\n *\n * @example\n * formatDuration(5) // => \"5 min\"\n * formatDuration(90) // => \"1h 30min\"\n * formatDuration(1440) // => \"1 day\"\n * formatDuration(4320) // => \"3 days\"\n */\nexport function formatDuration(minutes: number): string {\n if (minutes < 1) return 'instant';\n if (minutes < 60) return `${minutes} min`;\n\n const hours = Math.floor(minutes / 60);\n const remainingMinutes = minutes % 60;\n\n if (hours < 24) {\n if (remainingMinutes === 0) {\n return `${hours}h`;\n }\n return `${hours}h ${remainingMinutes}min`;\n }\n\n const days = Math.floor(hours / 24);\n const remainingHours = hours % 24;\n\n if (remainingHours === 0) {\n return `${days} day${days !== 1 ? 's' : ''}`;\n }\n return `${days} day${days !== 1 ? 's' : ''} ${remainingHours}h`;\n}\n"],"mappings":";AAyCA,SAAgB,EACd,GACA,GACQ;CACR,IAAM,IAAI,OAAO,KAAS,WAAW,IAAI,KAAK,CAAI,IAAI;CACtD,OAAO,IAAI,KAAK,eAAe,SAAS;EACtC,KAAK;EACL,OAAO;EACP,MAAM;EACN,MAAM;EACN,QAAQ;EACR,QAAQ;EACR,GAAG;CACL,CAAC,CAAC,CAAC,OAAO,CAAC;AACb;AAYA,SAAgB,EAAmB,GAA6B;CAC9D,IAAM,IAAI,OAAO,KAAS,WAAW,IAAI,KAAK,CAAI,IAAI,GAEhD,qBAAS,IADC,KACD,EAAA,CAAI,QAAQ,IAAI,EAAE,QAAQ,GACnC,IAAc,KAAK,MAAM,IAAS,GAAI,GACtC,IAAc,KAAK,MAAM,IAAc,EAAE,GACzC,IAAY,KAAK,MAAM,IAAc,EAAE,GACvC,IAAW,KAAK,MAAM,IAAY,EAAE,GACpC,IAAY,KAAK,MAAM,IAAW,CAAC,GACnC,IAAa,KAAK,MAAM,IAAW,EAAE;CAE3C,IAAI,IAAc,IAAI,OAAO;CAC7B,IAAI,IAAc,IAAI,OAAO,GAAG,EAAY,MAAM,MAAgB,IAAU,KAAN,IAAS;CAC/E,IAAI,IAAY,IAAI,OAAO,GAAG,EAAU,OAAO,MAAc,IAAU,KAAN,IAAS;CAC1E,IAAI,IAAW,GAAG,OAAO,GAAG,EAAS,MAAM,MAAa,IAAU,KAAN,IAAS;CACrE,IAAI,IAA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Q;CAE/B,OAAO,GADS,MAAa,IAAI,IAAS,KAAK,MAAM,IAAS,EAAE,IAAI,GAClD,GAAG,EAAM;AAC7B;AAmCA,SAAgB,EAAe,GAAyB;CACtD,IAAI,IAAU,GAAG,OAAO;CACxB,IAAI,IAAU,IAAI,OAAO,GAAG,EAAQ;CAEpC,IAAM,IAAQ,KAAK,MAAM,IAAU,EAAE,GAC/B,IAAmB,IAAU;CAEnC,IAAI,IAAQ,IAIV,OAHI,MAAqB,IAChB,GAAG,EAAM,KAEX,GAAG,EAAM,IAAI,EAAiB;CAGvC,IAAM,IAAO,KAAK,MAAM,IAAQ,EAAE,GAC5B,IAAiB,IAAQ;CAK/B,OAHI,MAAmB,IACd,GAAG,EAAK,MAAM,MAAS,IAAU,KAAN,QAE7B,GAAG,EAAK,MAAM,MAAS,IAAU,KAAN,IAAS,GAAG,EAAe;AAC/D"}
1
+ {"version":3,"file":"formatters.js","names":[],"sources":["../../../src/labsofscience/utils/formatters.ts"],"sourcesContent":["/**\n * Formatting utilities for the LabsOfScience microfrontend\n * @module labsofscience/utils/formatters\n */\n\n/**\n * Format a number as Indian Rupees (INR) currency\n *\n * @param amount - The numeric amount to format\n * @param options - Optional Intl.NumberFormat options to override defaults\n * @returns Formatted currency string (e.g., \"₹1,200.00\")\n *\n * @example\n * formatCurrency(1200) // => \"₹1,200.00\"\n * formatCurrency(0) // => \"₹0.00\"\n * formatCurrency(1200, { minimumFractionDigits: 0 }) // => \"₹1,200\"\n */\nexport function formatCurrency(\n amount: number,\n options?: Partial<Intl.NumberFormatOptions>\n): string {\n return new Intl.NumberFormat('en-IN', {\n style: 'currency',\n currency: 'INR',\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n ...options,\n }).format(amount);\n}\n\n/**\n * Format a date string or Date object into a human-readable format\n *\n * @param date - ISO date string or Date object\n * @param options - Optional Intl.DateTimeFormat options\n * @returns Formatted date string (e.g., \"15 Jan 2024, 4:00 PM\")\n *\n * @example\n * formatDate('2024-01-15T10:30:00Z')\n * // => \"15 Jan 2024, 4:00 PM\" (in IST)\n */\nexport function formatDate(\n date: string | Date,\n options?: Partial<Intl.DateTimeFormatOptions>\n): string {\n const d = typeof date === 'string' ? new Date(date) : date;\n return new Intl.DateTimeFormat('en-IN', {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n hour12: true,\n ...options,\n }).format(d);\n}\n\n/**\n * Format a date into a relative time string (e.g., \"2 hours ago\")\n *\n * @param date - ISO date string or Date object\n * @returns Human-readable relative time string\n *\n * @example\n * formatRelativeTime('2024-01-15T10:30:00Z') // => \"3 days ago\"\n * formatRelativeTime(new Date()) // => \"just now\"\n */\nexport function formatRelativeTime(date: string | Date): string {\n const d = typeof date === 'string' ? new Date(date) : date;\n const now = new Date();\n const diffMs = now.getTime() - d.getTime();\n const diffSeconds = Math.floor(diffMs / 1000);\n const diffMinutes = Math.floor(diffSeconds / 60);\n const diffHours = Math.floor(diffMinutes / 60);\n const diffDays = Math.floor(diffHours / 24);\n const diffWeeks = Math.floor(diffDays / 7);\n const diffMonths = Math.floor(diffDays / 30);\n\n if (diffSeconds < 60) return 'just now';\n if (diffMinutes < 60) return `${diffMinutes} min${diffMinutes !== 1 ? 's' : ''} ago`;\n if (diffHours < 24) return `${diffHours} hour${diffHours !== 1 ? 's' : ''} ago`;\n if (diffDays < 7) return `${diffDays} day${diffDays !== 1 ? 's' : ''} ago`;\n if (diffWeeks < 4) return `${diffWeeks} week${diffWeeks !== 1 ? 's' : ''} ago`;\n if (diffMonths < 12) return `${diffMonths} month${diffMonths !== 1 ? 's' : ''} ago`;\n\n const diffYears = Math.floor(diffDays / 365);\n return `${diffYears} year${diffYears !== 1 ? 's' : ''} ago`;\n}\n\n/**\n * Format a number with Indian locale grouping (lakhs, crores)\n *\n * @param value - The number to format\n * @param options - Optional Intl.NumberFormat options\n * @returns Formatted number string (e.g., \"12,345\" or \"1,24,500\")\n *\n * @example\n * formatNumber(1245) // => \"1,245\"\n * formatNumber(124500) // => \"1,24,500\"\n */\nexport function formatNumber(value: number, options?: Partial<Intl.NumberFormatOptions>): string {\n return new Intl.NumberFormat('en-IN', options).format(value);\n}\n\n/**\n * Format a date as a compact day-month-year string (no time component).\n *\n * @param date - ISO date string or Date object (null/undefined renders \"—\")\n * @returns Formatted date string (e.g., \"15 Jan 2026\") or \"—\"\n */\nexport function formatDateShort(date: string | Date | null | undefined): string {\n if (!date) return '—';\n const d = typeof date === 'string' ? new Date(date) : date;\n if (Number.isNaN(d.getTime())) return '—';\n return new Intl.DateTimeFormat('en-IN', {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n }).format(d);\n}\n\n/**\n * Convert an UPPER_SNAKE_CASE enum value into a Title Case label.\n *\n * @example\n * titleCase('IN_PROGRESS') // => \"In Progress\"\n * titleCase('REAGENT') // => \"Reagent\"\n */\nexport function titleCase(value: string): string {\n return value\n .toLowerCase()\n .split(/[_\\s]+/)\n .filter(Boolean)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n}\n\n/**\n * Format a byte count (accepts a string because `sizeBytes` is a String on the\n * wire to avoid 53-bit precision loss) into a human-readable size.\n *\n * @example\n * formatBytes('2048') // => \"2 KB\"\n * formatBytes('1572864') // => \"1.5 MB\"\n */\nexport function formatBytes(bytes: string | number | null | undefined): string {\n if (bytes === null || bytes === undefined) return '—';\n const value = typeof bytes === 'string' ? Number(bytes) : bytes;\n if (!Number.isFinite(value) || value < 0) return '—';\n if (value === 0) return '0 B';\n const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];\n const exponent = Math.min(Math.floor(Math.log(value) / Math.log(1024)), units.length - 1);\n const scaled = value / 1024 ** exponent;\n const rounded = exponent === 0 ? scaled : Math.round(scaled * 10) / 10;\n return `${rounded} ${units[exponent]}`;\n}\n\n/**\n * Format a distance value in kilometers\n *\n * @param km - Distance in kilometers\n * @returns Formatted distance string\n *\n * @example\n * formatDistance(0.5) // => \"500 m\"\n * formatDistance(1.2) // => \"1.2 km\"\n * formatDistance(15) // => \"15 km\"\n */\nexport function formatDistance(km: number): string {\n if (km < 1) {\n return `${Math.round(km * 1000)} m`;\n }\n if (km < 10) {\n return `${km.toFixed(1)} km`;\n }\n return `${Math.round(km)} km`;\n}\n\n/**\n * Format a duration in minutes into a human-readable string\n *\n * @param minutes - Duration in minutes\n * @returns Formatted duration string\n *\n * @example\n * formatDuration(5) // => \"5 min\"\n * formatDuration(90) // => \"1h 30min\"\n * formatDuration(1440) // => \"1 day\"\n * formatDuration(4320) // => \"3 days\"\n */\nexport function formatDuration(minutes: number): string {\n if (minutes < 1) return 'instant';\n if (minutes < 60) return `${minutes} min`;\n\n const hours = Math.floor(minutes / 60);\n const remainingMinutes = minutes % 60;\n\n if (hours < 24) {\n if (remainingMinutes === 0) {\n return `${hours}h`;\n }\n return `${hours}h ${remainingMinutes}min`;\n }\n\n const days = Math.floor(hours / 24);\n const remainingHours = hours % 24;\n\n if (remainingHours === 0) {\n return `${days} day${days !== 1 ? 's' : ''}`;\n }\n return `${days} day${days !== 1 ? 's' : ''} ${remainingHours}h`;\n}\n\n/**\n * Format the wall-clock time between two timestamps.\n *\n * Used for pipeline/experiment run durations, where both ends come straight off\n * the record (`startedAt` / `finishedAt`) and either may be null on a run that\n * has not started or not finished. Returns \"—\" whenever a real elapsed time\n * cannot be computed, rather than inventing a zero.\n *\n * @example\n * formatElapsed('2026-08-27T09:12:00Z', '2026-08-27T09:58:00Z') // => \"46m\"\n * formatElapsed('2026-08-27T09:12:00Z', null) // => \"—\"\n */\nexport function formatElapsed(\n startedAt: string | Date | null | undefined,\n finishedAt: string | Date | null | undefined\n): string {\n if (!startedAt || !finishedAt) return '—';\n const start = typeof startedAt === 'string' ? new Date(startedAt) : startedAt;\n const end = typeof finishedAt === 'string' ? new Date(finishedAt) : finishedAt;\n if (Number.isNaN(start.getTime()) || Number.isNaN(end.getTime())) return '—';\n\n const totalSeconds = Math.floor((end.getTime() - start.getTime()) / 1000);\n if (totalSeconds < 0) return '—';\n if (totalSeconds < 60) return `${totalSeconds}s`;\n\n const totalMinutes = Math.floor(totalSeconds / 60);\n if (totalMinutes < 60) return `${totalMinutes}m`;\n\n const hours = Math.floor(totalMinutes / 60);\n const minutes = totalMinutes % 60;\n return minutes === 0 ? `${hours}h` : `${hours}h ${minutes}m`;\n}\n"],"mappings":";AAiBA,SAAgB,EACd,GACA,GACQ;CACR,OAAO,IAAI,KAAK,aAAa,SAAS;EACpC,OAAO;EACP,UAAU;EACV,uBAAuB;EACvB,uBAAuB;EACvB,GAAG;CACL,CAAC,CAAC,CAAC,OAAO,CAAM;AAClB;AAaA,SAAgB,EACd,GACA,GACQ;CACR,IAAM,IAAI,OAAO,KAAS,WAAW,IAAI,KAAK,CAAI,IAAI;CACtD,OAAO,IAAI,KAAK,eAAe,SAAS;EACtC,KAAK;EACL,OAAO;EACP,MAAM;EACN,MAAM;EACN,QAAQ;EACR,QAAQ;EACR,GAAG;CACL,CAAC,CAAC,CAAC,OAAO,CAAC;AACb;AAYA,SAAgB,EAAmB,GAA6B;CAC9D,IAAM,IAAI,OAAO,KAAS,WAAW,IAAI,KAAK,CAAI,IAAI,GAEhD,qBAAS,IADC,KACD,EAAA,CAAI,QAAQ,IAAI,EAAE,QAAQ,GACnC,IAAc,KAAK,MAAM,IAAS,GAAI,GACtC,IAAc,KAAK,MAAM,IAAc,EAAE,GACzC,IAAY,KAAK,MAAM,IAAc,EAAE,GACvC,IAAW,KAAK,MAAM,IAAY,EAAE,GACpC,IAAY,KAAK,MAAM,IAAW,CAAC,GACnC,IAAa,KAAK,MAAM,IAAW,EAAE;CAE3C,IAAI,IAAc,IAAI,OAAO;CAC7B,IAAI,IAAc,IAAI,OAAO,GAAG,EAAY,MAAM,MAAgB,IAAU,KAAN,IAAS;CAC/E,IAAI,IAAY,IAAI,OAAO,GAAG,EAAU,OAAO,MAAc,IAAU,KAAN,IAAS;CAC1E,IAAI,IAAW,GAAG,OAAO,GAAG,EAAS,MAAM,M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C5D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-labsofscience",
3
- "version": "2026.820.5",
3
+ "version": "2026.827.1",
4
4
  "description": "Burdenoff LabsOfScience Microfrontend",
5
5
  "type": "module",
6
6
  "files": [