@mt-gloss/utils 0.0.9 → 0.0.11

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.
@@ -0,0 +1,436 @@
1
+ import { startOfMonth as Y, startOfYear as p, subYears as k, endOfYear as q, startOfQuarter as V, subDays as u, startOfDay as Q, endOfDay as H } from "date-fns";
2
+ const j = [
3
+ // Rolling periods (most specific first)
4
+ { id: "today", label: "Today", priority: 100 },
5
+ { id: "7d", label: "7D", priority: 90 },
6
+ { id: "30d", label: "30D", priority: 89 },
7
+ { id: "60d", label: "60D", priority: 88 },
8
+ { id: "90d", label: "90D", priority: 87 },
9
+ // To-date periods
10
+ { id: "mtd", label: "MTD", priority: 80 },
11
+ { id: "qtd", label: "QTD", priority: 79 },
12
+ { id: "ytd", label: "YTD", priority: 78 },
13
+ { id: "lytd", label: "LYTD", priority: 77 },
14
+ // Calendar periods (full periods)
15
+ { id: "this-week", label: "This Week", priority: 70 },
16
+ { id: "last-week", label: "Last Week", priority: 69 },
17
+ { id: "this-month", label: "This Month", priority: 68 },
18
+ { id: "last-month", label: "Last Month", priority: 67 },
19
+ { id: "this-quarter", label: "This Quarter", priority: 66 },
20
+ { id: "last-quarter", label: "Last Quarter", priority: 65 },
21
+ { id: "this-year", label: "This Year", priority: 64 },
22
+ { id: "last-year", label: "Last Year", priority: 63 }
23
+ ];
24
+ function g(e, r) {
25
+ return e.getFullYear() === r.getFullYear() && e.getMonth() === r.getMonth() && e.getDate() === r.getDate();
26
+ }
27
+ function M(e, r, t = /* @__PURE__ */ new Date(), a = []) {
28
+ const s = new Date(t);
29
+ s.setHours(0, 0, 0, 0);
30
+ const n = new Date(e);
31
+ n.setHours(0, 0, 0, 0);
32
+ const i = new Date(r);
33
+ i.setHours(0, 0, 0, 0);
34
+ const l = [
35
+ ...j,
36
+ ...a.map((o) => ({ ...o, priority: o.priority ?? 50 }))
37
+ ].sort((o, c) => c.priority - o.priority);
38
+ for (const o of l) {
39
+ if (o.startDate && o.endDate) {
40
+ const d = new Date(o.startDate);
41
+ d.setHours(0, 0, 0, 0);
42
+ const D = new Date(o.endDate);
43
+ if (D.setHours(0, 0, 0, 0), g(n, d) && g(i, D))
44
+ return { id: o.id, label: o.label };
45
+ continue;
46
+ }
47
+ const c = F(o.id, s);
48
+ if (c && g(n, c.start) && g(i, c.end))
49
+ return { id: o.id, label: o.label };
50
+ }
51
+ return null;
52
+ }
53
+ function K(e, r, t = /* @__PURE__ */ new Date(), a = {}) {
54
+ const {
55
+ preferPresetLabel: s = !0,
56
+ showPresetDates: n = !1,
57
+ customPresets: i = []
58
+ } = a, l = y(e, r, t);
59
+ if (!s)
60
+ return l;
61
+ const o = M(e, r, t, i);
62
+ return o ? n ? `${o.label} (${l})` : o.label : l;
63
+ }
64
+ function Z(e, r, t = /* @__PURE__ */ new Date(), a = []) {
65
+ const s = y(e, r, t), n = M(e, r, t, a);
66
+ return {
67
+ display: n ? n.label : s,
68
+ formatted: s,
69
+ preset: n
70
+ };
71
+ }
72
+ const $ = "’";
73
+ function B(e) {
74
+ const r = e.getFullYear(), t = String(r).slice(-2);
75
+ return `${$}${t}`;
76
+ }
77
+ function J(e) {
78
+ if (e == null || e === "") return e;
79
+ if (/^\d+$/.test(e)) {
80
+ const r = e.replace(/^0+/, "");
81
+ return r === "" ? "0" : r;
82
+ }
83
+ return e;
84
+ }
85
+ function y(e, r, t = /* @__PURE__ */ new Date(), a = {}) {
86
+ const { shortYear: s = !1 } = a, n = t.getFullYear(), i = e.getMonth() + 1, l = e.getDate(), o = e.getFullYear(), c = r.getMonth() + 1, d = r.getDate(), D = r.getFullYear(), I = e.getTime() === r.getTime(), N = i === c && o === D, R = o === D, C = o === n, O = D === n, m = (A, _) => {
87
+ if (_) return "";
88
+ const b = String(A).slice(-2);
89
+ return s ? ` ${$}${b}` : `/${b}`;
90
+ }, h = m(o, C), f = m(D, O);
91
+ return I ? `${i}/${l}${h}` : N ? `${i}/${l}–${d}${f}` : R ? `${i}/${l} – ${c}/${d}${f}` : `${i}/${l}${h} – ${c}/${d}${f}`;
92
+ }
93
+ function T(e, r = /* @__PURE__ */ new Date()) {
94
+ const t = r.getFullYear(), a = e.getMonth() + 1, s = e.getDate(), n = e.getFullYear(), i = n !== t ? `/${String(n).slice(-2)}` : "";
95
+ return `${a}/${s}${i}`;
96
+ }
97
+ function x(e, r = /* @__PURE__ */ new Date()) {
98
+ const t = r.getFullYear(), a = Math.floor(t / 100) * 100, s = e.replace(/[\u2013\u2014]/g, "-").trim(), n = s.split(/\s+-\s+/);
99
+ if (n.length === 2) {
100
+ const o = w(n[0].trim(), t, a), c = w(n[1].trim(), t, a);
101
+ return { start: o, end: c };
102
+ }
103
+ const i = s.match(/^(\d{1,2})\/(\d{1,2})-(\d{1,2})(?:\/(\d{2}))?$/);
104
+ if (i) {
105
+ const o = parseInt(i[1], 10) - 1, c = parseInt(i[2], 10), d = parseInt(i[3], 10), D = i[4] ? a + parseInt(i[4], 10) : t;
106
+ return {
107
+ start: new Date(D, o, c),
108
+ end: new Date(D, o, d)
109
+ };
110
+ }
111
+ const l = w(s, t, a);
112
+ return { start: l, end: l };
113
+ }
114
+ function w(e, r, t) {
115
+ const a = e.match(/^(\d{1,2})\/(\d{1,2})(?:\/(\d{2}))?$/);
116
+ if (!a)
117
+ throw new Error(`Invalid date format: "${e}"`);
118
+ const s = parseInt(a[1], 10) - 1, n = parseInt(a[2], 10), i = a[3] ? t + parseInt(a[3], 10) : r;
119
+ return new Date(i, s, n);
120
+ }
121
+ function tt(e) {
122
+ try {
123
+ const r = x(e);
124
+ return r.start instanceof Date && !isNaN(r.start.getTime()) && r.end instanceof Date && !isNaN(r.end.getTime());
125
+ } catch {
126
+ return !1;
127
+ }
128
+ }
129
+ function U(e, r) {
130
+ return Math.round((r.getTime() - e.getTime()) / 864e5) + 1;
131
+ }
132
+ function et(e, r) {
133
+ const t = U(e, r);
134
+ return t === 1 ? "1 day" : t < 14 ? `${t} days` : t < 60 ? `${Math.round(t / 7)} weeks` : t < 365 ? `${Math.round(t / 30)} months` : `${(t / 365).toFixed(1)} years`;
135
+ }
136
+ function at(e, r = /* @__PURE__ */ new Date()) {
137
+ const { start: t, end: a } = F(e, r);
138
+ return { formatted: y(t, a, r), start: t, end: a };
139
+ }
140
+ function F(e, r = /* @__PURE__ */ new Date()) {
141
+ const t = new Date(r);
142
+ t.setHours(0, 0, 0, 0);
143
+ let a = new Date(t), s = new Date(t);
144
+ switch (e.toLowerCase()) {
145
+ case "today":
146
+ break;
147
+ case "7d":
148
+ a.setDate(a.getDate() - 6);
149
+ break;
150
+ case "30d":
151
+ a.setDate(a.getDate() - 29);
152
+ break;
153
+ case "60d":
154
+ a.setDate(a.getDate() - 59);
155
+ break;
156
+ case "90d":
157
+ a.setDate(a.getDate() - 89);
158
+ break;
159
+ case "mtd": {
160
+ a = new Date(t.getFullYear(), t.getMonth(), 1);
161
+ break;
162
+ }
163
+ case "qtd": {
164
+ const n = Math.floor(t.getMonth() / 3);
165
+ a = new Date(t.getFullYear(), n * 3, 1);
166
+ break;
167
+ }
168
+ case "ytd":
169
+ a = new Date(t.getFullYear(), 0, 1);
170
+ break;
171
+ case "lytd":
172
+ a = new Date(t.getFullYear() - 1, 0, 1), s = new Date(t.getFullYear() - 1, t.getMonth(), t.getDate());
173
+ break;
174
+ case "this-week": {
175
+ const n = t.getDay();
176
+ a.setDate(t.getDate() - n);
177
+ break;
178
+ }
179
+ case "last-week": {
180
+ const n = t.getDay();
181
+ s.setDate(t.getDate() - n - 1), a = new Date(s), a.setDate(a.getDate() - 6);
182
+ break;
183
+ }
184
+ case "this-month":
185
+ a = new Date(t.getFullYear(), t.getMonth(), 1), s = new Date(t.getFullYear(), t.getMonth() + 1, 0);
186
+ break;
187
+ case "last-month":
188
+ a = new Date(t.getFullYear(), t.getMonth() - 1, 1), s = new Date(t.getFullYear(), t.getMonth(), 0);
189
+ break;
190
+ case "this-quarter": {
191
+ const n = Math.floor(t.getMonth() / 3);
192
+ a = new Date(t.getFullYear(), n * 3, 1), s = new Date(t.getFullYear(), n * 3 + 3, 0);
193
+ break;
194
+ }
195
+ case "last-quarter": {
196
+ const n = Math.floor(t.getMonth() / 3) - 1, i = n < 0 ? t.getFullYear() - 1 : t.getFullYear(), l = n < 0 ? 3 : n;
197
+ a = new Date(i, l * 3, 1), s = new Date(i, l * 3 + 3, 0);
198
+ break;
199
+ }
200
+ case "this-year":
201
+ a = new Date(t.getFullYear(), 0, 1), s = new Date(t.getFullYear(), 11, 31);
202
+ break;
203
+ case "last-year":
204
+ a = new Date(t.getFullYear() - 1, 0, 1), s = new Date(t.getFullYear() - 1, 11, 31);
205
+ break;
206
+ }
207
+ return { start: a, end: s };
208
+ }
209
+ const P = [
210
+ { id: "7d", label: "7D" },
211
+ { id: "30d", label: "30D" },
212
+ { id: "60d", label: "60D" },
213
+ { id: "90d", label: "90D" }
214
+ ], L = [
215
+ { id: "mtd", label: "MTD" },
216
+ { id: "qtd", label: "QTD" },
217
+ { id: "ytd", label: "YTD" },
218
+ { id: "lytd", label: "LYTD" }
219
+ ], S = {
220
+ id: "today",
221
+ label: "Today"
222
+ }, rt = [
223
+ // Past events
224
+ {
225
+ id: "atlanta-jan",
226
+ label: "Atlanta Market",
227
+ startDate: new Date(2026, 0, 7),
228
+ endDate: new Date(2026, 0, 14),
229
+ location: "Atlanta, GA"
230
+ },
231
+ {
232
+ id: "dallas-jan",
233
+ label: "Dallas Total Home",
234
+ startDate: new Date(2026, 0, 17),
235
+ endDate: new Date(2026, 0, 22),
236
+ location: "Dallas, TX"
237
+ },
238
+ // Current event (overlaps with today -- Feb 20, 2026)
239
+ {
240
+ id: "vegas-feb",
241
+ label: "Las Vegas Market",
242
+ startDate: new Date(2026, 1, 15),
243
+ endDate: new Date(2026, 1, 24),
244
+ location: "Las Vegas, NV"
245
+ },
246
+ // Future events
247
+ {
248
+ id: "ny-mar",
249
+ label: "NY Now Spring",
250
+ startDate: new Date(2026, 2, 8),
251
+ endDate: new Date(2026, 2, 12),
252
+ location: "New York, NY"
253
+ },
254
+ {
255
+ id: "chicago-apr",
256
+ label: "Chicago Gift Show",
257
+ startDate: new Date(2026, 3, 18),
258
+ endDate: new Date(2026, 3, 22),
259
+ location: "Chicago, IL"
260
+ }
261
+ ], E = {
262
+ TODAY: "today",
263
+ MTD: "mtd",
264
+ QTD: "qtd",
265
+ YTD: "ytd",
266
+ LYTD: "lytd",
267
+ "30D": "30d",
268
+ "60D": "60d",
269
+ "90D": "90d",
270
+ "7D": "7d"
271
+ }, z = Object.fromEntries(
272
+ Object.entries(E).map(([e, r]) => [r, e])
273
+ );
274
+ function G(e, r = /* @__PURE__ */ new Date()) {
275
+ const t = e?.toLowerCase(), a = r;
276
+ let s, n = a;
277
+ switch (t) {
278
+ case "today":
279
+ s = Q(a), n = H(a);
280
+ break;
281
+ case "7d":
282
+ s = u(a, 6), n = a;
283
+ break;
284
+ case "30d":
285
+ s = u(a, 29), n = a;
286
+ break;
287
+ case "60d":
288
+ s = u(a, 59), n = a;
289
+ break;
290
+ case "90d":
291
+ s = u(a, 89), n = a;
292
+ break;
293
+ case "mtd":
294
+ s = Y(a), n = a;
295
+ break;
296
+ case "qtd":
297
+ s = V(a), n = a;
298
+ break;
299
+ case "ytd":
300
+ s = p(a), n = a;
301
+ break;
302
+ case "lytd":
303
+ s = p(k(a, 1)), n = q(k(a, 1));
304
+ break;
305
+ default:
306
+ s = Y(a), n = a;
307
+ }
308
+ return { start: s, end: n };
309
+ }
310
+ function W(e) {
311
+ const r = e?.toLowerCase();
312
+ if (r === "today")
313
+ return S;
314
+ const t = P.find((s) => s.id === r);
315
+ if (t) return t;
316
+ const a = L.find((s) => s.id === r);
317
+ return a || null;
318
+ }
319
+ function nt(e) {
320
+ if (!e) return "Select...";
321
+ if (e.toLowerCase() === "custom") return "Custom";
322
+ const r = W(e);
323
+ return r ? r.label : e;
324
+ }
325
+ function st(e) {
326
+ return e ? E[e.toUpperCase()] || e.toLowerCase() : null;
327
+ }
328
+ function ot(e) {
329
+ return e ? z[e.toLowerCase()] || e.toUpperCase() : null;
330
+ }
331
+ function it() {
332
+ return [S, ...P, ...L];
333
+ }
334
+ const lt = "mtd";
335
+ function ct(e, r) {
336
+ const t = e.toLowerCase();
337
+ return G(t, r ?? /* @__PURE__ */ new Date());
338
+ }
339
+ const v = [
340
+ {
341
+ id: "lv-market-26",
342
+ name: "Las Vegas Market '26",
343
+ start: new Date(2026, 1, 15),
344
+ // Feb 15 2026
345
+ end: new Date(2026, 1, 24),
346
+ // Feb 24 2026
347
+ location: "Las Vegas, NV"
348
+ },
349
+ {
350
+ id: "asd-show-26",
351
+ name: "ASD Show '26",
352
+ start: new Date(2026, 2, 2),
353
+ // Mar 2 2026
354
+ end: new Date(2026, 2, 5),
355
+ // Mar 5 2026
356
+ location: "Las Vegas, NV"
357
+ },
358
+ // Additional 2026 season events from DEFAULT_MARKET_PRESETS coverage
359
+ {
360
+ id: "atlanta-jan-26",
361
+ name: "Atlanta Market '26",
362
+ start: new Date(2026, 0, 7),
363
+ // Jan 7 2026
364
+ end: new Date(2026, 0, 14),
365
+ // Jan 14 2026
366
+ location: "Atlanta, GA"
367
+ },
368
+ {
369
+ id: "dallas-jan-26",
370
+ name: "Dallas Total Home '26",
371
+ start: new Date(2026, 0, 17),
372
+ // Jan 17 2026
373
+ end: new Date(2026, 0, 22),
374
+ // Jan 22 2026
375
+ location: "Dallas, TX"
376
+ },
377
+ {
378
+ id: "ny-now-spring-26",
379
+ name: "NY Now Spring '26",
380
+ start: new Date(2026, 2, 8),
381
+ // Mar 8 2026
382
+ end: new Date(2026, 2, 12),
383
+ // Mar 12 2026
384
+ location: "New York, NY"
385
+ },
386
+ {
387
+ id: "chicago-gift-26",
388
+ name: "Chicago Gift Show '26",
389
+ start: new Date(2026, 3, 18),
390
+ // Apr 18 2026
391
+ end: new Date(2026, 3, 22),
392
+ // Apr 22 2026
393
+ location: "Chicago, IL"
394
+ }
395
+ ];
396
+ function Dt(e) {
397
+ const r = e.toLowerCase().trim(), t = v.find((a) => a.name.toLowerCase() === r);
398
+ if (!t)
399
+ throw new Error(`Unknown event: "${e}"`);
400
+ return { start: t.start, end: t.end };
401
+ }
402
+ function dt(e, r = "medium") {
403
+ return r === "short" ? `${e.getMonth() + 1}/${e.getDate()}` : T(e);
404
+ }
405
+ export {
406
+ rt as D,
407
+ v as E,
408
+ L as P,
409
+ P as R,
410
+ S as T,
411
+ Dt as a,
412
+ K as b,
413
+ B as c,
414
+ M as d,
415
+ J as e,
416
+ y as f,
417
+ Z as g,
418
+ T as h,
419
+ tt as i,
420
+ U as j,
421
+ et as k,
422
+ at as l,
423
+ F as m,
424
+ E as n,
425
+ z as o,
426
+ x as p,
427
+ G as q,
428
+ ct as r,
429
+ dt as s,
430
+ W as t,
431
+ nt as u,
432
+ st as v,
433
+ ot as w,
434
+ it as x,
435
+ lt as y
436
+ };
package/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { isStatusModeEnabled, v1_1_status_mode, V1_1_STATUS_MODE_ENV } from './lib/featureFlags';
1
2
  export type { PresetDefinition, MarketPreset, DateRange, MarketEvent } from './lib/types';
2
3
  export { formatValue, getValueFontSize } from './lib/formatValue';
3
4
  export type { FormatValueOptions, FormattedValue } from './lib/formatValue';
@@ -6,4 +7,6 @@ export type { TrendDirection, FormattedTrend } from './lib/formatTrend';
6
7
  export { formatDateRange, formatMarketDates, isMarketActive, isSameDay, isInRange, generateMarketId } from './lib/dateHelpers';
7
8
  export { detectPreset, formatDateRangeWithPreset, getDateRangeDisplayInfo, formatShortYear, stripLeadingZeros, formatSingleDate, parseDateRange, isValidDateRangeFormat, getDurationDays, formatDuration, formatPreset, getPresetDateRange, formatDateRange as formatDateRangeSmart } from './lib/smartDateFormat';
8
9
  export { ROLLING_OPTIONS, PERIOD_OPTIONS, TODAY_PRESET, DEFAULT_MARKET_PRESETS, PRESET_ID_MAP, PRESET_ID_REVERSE_MAP, getDateRangeForPreset, findPreset, getPresetLabel, normalizePresetId, toUppercasePresetId, getAllPresets, DEFAULT_PINNED } from './lib/presets';
10
+ export { resolvePreset, resolveEvent, smartDateFormat } from './lib/dateInterpretation';
11
+ export type { PresetId, EventRegistryEntry } from './lib/dateInterpretation';
9
12
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1,418 +1,99 @@
1
- import { startOfMonth as w, startOfYear as p, subYears as Y, endOfYear as _, startOfQuarter as U, subDays as d, startOfDay as q, endOfDay as Q } from "date-fns";
2
- function G(t, { prefix: r = "", suffix: e = "", abbreviated: a = !0, kThreshold: o = 1e3 } = {}) {
1
+ import { D as R, y, P as F, n as L, o as I, R as U, T as A, d as O, t as b, f as N, b as v, k as V, l as Y, c as G, h as k, x, g as z, q as K, j, m as q, u as B, i as C, v as W, p as X, a as Z, r as H, s as J, e as Q, w } from "./formatting-dHqp6ksD.js";
2
+ const c = "NEXT_PUBLIC_V1_1_STATUS_MODE";
3
+ function g() {
4
+ return typeof globalThis < "u" && globalThis.__GLOSS_FLAGS__?.v1_1_status_mode === !0 ? !0 : typeof process < "u" && process.env ? process.env[c] === "true" : !1;
5
+ }
6
+ const D = {
7
+ env: c,
8
+ check: g
9
+ };
10
+ function $(t, { prefix: e = "", suffix: n = "", abbreviated: r = !0, kThreshold: s = 1e3 } = {}) {
3
11
  if (t == null) {
4
- const u = r ? `${r} —${e}` : `—${e}`;
12
+ const u = e ? `${e} —${n}` : `—${n}`;
5
13
  return { display: u.trim(), full: u.trim(), length: u.trim().length };
6
14
  }
7
- const n = typeof t == "number" ? t : parseFloat(String(t).replace(/,/g, ""));
8
- if (isNaN(n)) {
9
- const c = `${r}${t}${e}`;
10
- return { display: c, full: c, length: c.length };
15
+ const a = typeof t == "number" ? t : parseFloat(String(t).replace(/,/g, ""));
16
+ if (isNaN(a)) {
17
+ const l = `${e}${t}${n}`;
18
+ return { display: l, full: l, length: l.length };
11
19
  }
12
- let s;
13
- a !== !1 && Math.abs(n) >= 1e6 ? s = (n / 1e6).toFixed(1).replace(/\.0$/, "") + "M" : a !== !1 && Math.abs(n) >= o ? s = (n / 1e3).toFixed(1).replace(/\.0$/, "") + "K" : s = n.toLocaleString("en-US");
14
- const l = `${r}${s}${e}`, i = `${r}${n.toLocaleString("en-US")}${e}`;
15
- return { display: l, full: i, length: l.length };
20
+ let o;
21
+ r !== !1 && Math.abs(a) >= 1e6 ? o = (a / 1e6).toFixed(1).replace(/\.0$/, "") + "M" : r !== !1 && Math.abs(a) >= s ? o = (a / 1e3).toFixed(1).replace(/\.0$/, "") + "K" : o = a.toLocaleString("en-US");
22
+ const i = `${e}${o}${n}`, f = `${e}${a.toLocaleString("en-US")}${n}`;
23
+ return { display: i, full: f, length: i.length };
16
24
  }
17
- function K(t, r) {
18
- return (r ?? 1) >= 2 ? t <= 4 || t <= 6 ? 30 : t <= 8 ? 24 : 20 : t <= 5 ? 28 : t <= 8 ? 20 : 17;
25
+ function m(t, e) {
26
+ return (e ?? 1) >= 2 ? t <= 4 || t <= 6 ? 30 : t <= 8 ? 24 : 20 : t <= 5 ? 28 : t <= 8 ? 20 : 17;
19
27
  }
20
- function X(t) {
28
+ function S(t) {
21
29
  if (t == null || t === 0)
22
30
  return { text: "0%", direction: "flat" };
23
- const r = t > 0 ? "up" : t < 0 ? "down" : "flat", e = Math.abs(t);
24
- return { text: e >= 3 ? `${Math.round(e)}%` : `${e.toFixed(1)}%`, direction: r };
31
+ const e = t > 0 ? "up" : t < 0 ? "down" : "flat", n = Math.abs(t);
32
+ return { text: n >= 3 ? `${Math.round(n)}%` : `${n.toFixed(1)}%`, direction: e };
25
33
  }
26
- function Z(t, r) {
27
- if (!t || !r) return "";
28
- const e = t.toLocaleDateString("en-US", { month: "short" }), a = r.toLocaleDateString("en-US", { month: "short" }), o = t.getDate(), n = r.getDate(), s = t.getFullYear(), l = r.getFullYear();
29
- return t.getTime() === r.getTime() || e === a && o === n && s === l ? `${e} ${o}, ${s}` : e === a && s === l ? `${e} ${o}–${n}` : s === l ? `${e} ${o} – ${a} ${n}` : `${e} ${o}, ${s} – ${a} ${n}, ${l}`;
34
+ function h(t, e) {
35
+ if (!t || !e) return "";
36
+ const n = t.toLocaleDateString("en-US", { month: "short" }), r = e.toLocaleDateString("en-US", { month: "short" }), s = t.getDate(), a = e.getDate(), o = t.getFullYear(), i = e.getFullYear();
37
+ return t.getTime() === e.getTime() || n === r && s === a && o === i ? `${n} ${s}, ${o}` : n === r && o === i ? `${n} ${s}–${a}` : o === i ? `${n} ${s} – ${r} ${a}` : `${n} ${s}, ${o} – ${r} ${a}, ${i}`;
30
38
  }
31
- function B(t, r) {
32
- const e = t.toLocaleDateString("en-US", { month: "short" }), a = r.toLocaleDateString("en-US", { month: "short" }), o = t.getDate(), n = r.getDate();
33
- return e === a ? `${e} ${o}–${n}` : `${e} ${o} – ${a} ${n}`;
39
+ function _(t, e) {
40
+ const n = t.toLocaleDateString("en-US", { month: "short" }), r = e.toLocaleDateString("en-US", { month: "short" }), s = t.getDate(), a = e.getDate();
41
+ return n === r ? `${n} ${s}–${a}` : `${n} ${s} – ${r} ${a}`;
34
42
  }
35
- function J(t, r = /* @__PURE__ */ new Date()) {
36
- return !t?.startDate || !t?.endDate ? !1 : r >= t.startDate && r <= t.endDate;
43
+ function d(t, e = /* @__PURE__ */ new Date()) {
44
+ return !t?.startDate || !t?.endDate ? !1 : e >= t.startDate && e <= t.endDate;
37
45
  }
38
- function v(t, r) {
39
- return !t || !r ? !1 : t.getFullYear() === r.getFullYear() && t.getMonth() === r.getMonth() && t.getDate() === r.getDate();
46
+ function T(t, e) {
47
+ return !t || !e ? !1 : t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth() && t.getDate() === e.getDate();
40
48
  }
41
- function tt(t, r, e) {
42
- if (!t || !r || !e) return !1;
43
- const a = t.getTime(), o = r.getTime(), n = e.getTime();
44
- return a >= Math.min(o, n) && a <= Math.max(o, n);
49
+ function M(t, e, n) {
50
+ if (!t || !e || !n) return !1;
51
+ const r = t.getTime(), s = e.getTime(), a = n.getTime();
52
+ return r >= Math.min(s, a) && r <= Math.max(s, a);
45
53
  }
46
- function et() {
54
+ function P() {
47
55
  return `custom-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
48
56
  }
49
- const H = [
50
- // Rolling periods (most specific first)
51
- { id: "today", label: "Today", priority: 100 },
52
- { id: "7d", label: "7D", priority: 90 },
53
- { id: "30d", label: "30D", priority: 89 },
54
- { id: "60d", label: "60D", priority: 88 },
55
- { id: "90d", label: "90D", priority: 87 },
56
- // To-date periods
57
- { id: "mtd", label: "MTD", priority: 80 },
58
- { id: "qtd", label: "QTD", priority: 79 },
59
- { id: "ytd", label: "YTD", priority: 78 },
60
- { id: "lytd", label: "LYTD", priority: 77 },
61
- // Calendar periods (full periods)
62
- { id: "this-week", label: "This Week", priority: 70 },
63
- { id: "last-week", label: "Last Week", priority: 69 },
64
- { id: "this-month", label: "This Month", priority: 68 },
65
- { id: "last-month", label: "Last Month", priority: 67 },
66
- { id: "this-quarter", label: "This Quarter", priority: 66 },
67
- { id: "last-quarter", label: "Last Quarter", priority: 65 },
68
- { id: "this-year", label: "This Year", priority: 64 },
69
- { id: "last-year", label: "Last Year", priority: 63 }
70
- ];
71
- function f(t, r) {
72
- return t.getFullYear() === r.getFullYear() && t.getMonth() === r.getMonth() && t.getDate() === r.getDate();
73
- }
74
- function M(t, r, e = /* @__PURE__ */ new Date(), a = []) {
75
- const o = new Date(e);
76
- o.setHours(0, 0, 0, 0);
77
- const n = new Date(t);
78
- n.setHours(0, 0, 0, 0);
79
- const s = new Date(r);
80
- s.setHours(0, 0, 0, 0);
81
- const l = [
82
- ...H,
83
- ...a.map((i) => ({ ...i, priority: i.priority ?? 50 }))
84
- ].sort((i, c) => c.priority - i.priority);
85
- for (const i of l) {
86
- if (i.startDate && i.endDate) {
87
- const u = new Date(i.startDate);
88
- u.setHours(0, 0, 0, 0);
89
- const D = new Date(i.endDate);
90
- if (D.setHours(0, 0, 0, 0), f(n, u) && f(s, D))
91
- return { id: i.id, label: i.label };
92
- continue;
93
- }
94
- const c = T(i.id, o);
95
- if (c && f(n, c.start) && f(s, c.end))
96
- return { id: i.id, label: i.label };
97
- }
98
- return null;
99
- }
100
- function at(t, r, e = /* @__PURE__ */ new Date(), a = {}) {
101
- const {
102
- preferPresetLabel: o = !0,
103
- showPresetDates: n = !1,
104
- customPresets: s = []
105
- } = a, l = m(t, r, e);
106
- if (!o)
107
- return l;
108
- const i = M(t, r, e, s);
109
- return i ? n ? `${i.label} (${l})` : i.label : l;
110
- }
111
- function rt(t, r, e = /* @__PURE__ */ new Date(), a = []) {
112
- const o = m(t, r, e), n = M(t, r, e, a);
113
- return {
114
- display: n ? n.label : o,
115
- formatted: o,
116
- preset: n
117
- };
118
- }
119
- const S = "’";
120
- function nt(t) {
121
- const r = t.getFullYear(), e = String(r).slice(-2);
122
- return `${S}${e}`;
123
- }
124
- function ot(t) {
125
- if (t == null || t === "") return t;
126
- if (/^\d+$/.test(t)) {
127
- const r = t.replace(/^0+/, "");
128
- return r === "" ? "0" : r;
129
- }
130
- return t;
131
- }
132
- function m(t, r, e = /* @__PURE__ */ new Date(), a = {}) {
133
- const { shortYear: o = !1 } = a, n = e.getFullYear(), s = t.getMonth() + 1, l = t.getDate(), i = t.getFullYear(), c = r.getMonth() + 1, u = r.getDate(), D = r.getFullYear(), I = t.getTime() === r.getTime(), R = s === c && i === D, E = i === D, N = i === n, O = D === n, y = (C, A) => {
134
- if (A) return "";
135
- const b = String(C).slice(-2);
136
- return o ? ` ${S}${b}` : `/${b}`;
137
- }, $ = y(i, N), g = y(D, O);
138
- return I ? `${s}/${l}${$}` : R ? `${s}/${l}–${u}${g}` : E ? `${s}/${l} – ${c}/${u}${g}` : `${s}/${l}${$} – ${c}/${u}${g}`;
139
- }
140
- function st(t, r = /* @__PURE__ */ new Date()) {
141
- const e = r.getFullYear(), a = t.getMonth() + 1, o = t.getDate(), n = t.getFullYear(), s = n !== e ? `/${String(n).slice(-2)}` : "";
142
- return `${a}/${o}${s}`;
143
- }
144
- function V(t, r = /* @__PURE__ */ new Date()) {
145
- const e = r.getFullYear(), a = Math.floor(e / 100) * 100, o = t.replace(/[\u2013\u2014]/g, "-").trim(), n = o.split(/\s+-\s+/);
146
- if (n.length === 2) {
147
- const i = h(n[0].trim(), e, a), c = h(n[1].trim(), e, a);
148
- return { start: i, end: c };
149
- }
150
- const s = o.match(/^(\d{1,2})\/(\d{1,2})-(\d{1,2})(?:\/(\d{2}))?$/);
151
- if (s) {
152
- const i = parseInt(s[1], 10) - 1, c = parseInt(s[2], 10), u = parseInt(s[3], 10), D = s[4] ? a + parseInt(s[4], 10) : e;
153
- return {
154
- start: new Date(D, i, c),
155
- end: new Date(D, i, u)
156
- };
157
- }
158
- const l = h(o, e, a);
159
- return { start: l, end: l };
160
- }
161
- function h(t, r, e) {
162
- const a = t.match(/^(\d{1,2})\/(\d{1,2})(?:\/(\d{2}))?$/);
163
- if (!a)
164
- throw new Error(`Invalid date format: "${t}"`);
165
- const o = parseInt(a[1], 10) - 1, n = parseInt(a[2], 10), s = a[3] ? e + parseInt(a[3], 10) : r;
166
- return new Date(s, o, n);
167
- }
168
- function it(t) {
169
- try {
170
- const r = V(t);
171
- return r.start instanceof Date && !isNaN(r.start.getTime()) && r.end instanceof Date && !isNaN(r.end.getTime());
172
- } catch {
173
- return !1;
174
- }
175
- }
176
- function x(t, r) {
177
- return Math.round((r.getTime() - t.getTime()) / 864e5) + 1;
178
- }
179
- function lt(t, r) {
180
- const e = x(t, r);
181
- return e === 1 ? "1 day" : e < 14 ? `${e} days` : e < 60 ? `${Math.round(e / 7)} weeks` : e < 365 ? `${Math.round(e / 30)} months` : `${(e / 365).toFixed(1)} years`;
182
- }
183
- function ct(t, r = /* @__PURE__ */ new Date()) {
184
- const { start: e, end: a } = T(t, r);
185
- return { formatted: m(e, a, r), start: e, end: a };
186
- }
187
- function T(t, r = /* @__PURE__ */ new Date()) {
188
- const e = new Date(r);
189
- e.setHours(0, 0, 0, 0);
190
- let a = new Date(e), o = new Date(e);
191
- switch (t.toLowerCase()) {
192
- case "today":
193
- break;
194
- case "7d":
195
- a.setDate(a.getDate() - 6);
196
- break;
197
- case "30d":
198
- a.setDate(a.getDate() - 29);
199
- break;
200
- case "60d":
201
- a.setDate(a.getDate() - 59);
202
- break;
203
- case "90d":
204
- a.setDate(a.getDate() - 89);
205
- break;
206
- case "mtd": {
207
- a = new Date(e.getFullYear(), e.getMonth(), 1);
208
- break;
209
- }
210
- case "qtd": {
211
- const n = Math.floor(e.getMonth() / 3);
212
- a = new Date(e.getFullYear(), n * 3, 1);
213
- break;
214
- }
215
- case "ytd":
216
- a = new Date(e.getFullYear(), 0, 1);
217
- break;
218
- case "lytd":
219
- a = new Date(e.getFullYear() - 1, 0, 1), o = new Date(e.getFullYear() - 1, e.getMonth(), e.getDate());
220
- break;
221
- case "this-week": {
222
- const n = e.getDay();
223
- a.setDate(e.getDate() - n);
224
- break;
225
- }
226
- case "last-week": {
227
- const n = e.getDay();
228
- o.setDate(e.getDate() - n - 1), a = new Date(o), a.setDate(a.getDate() - 6);
229
- break;
230
- }
231
- case "this-month":
232
- a = new Date(e.getFullYear(), e.getMonth(), 1), o = new Date(e.getFullYear(), e.getMonth() + 1, 0);
233
- break;
234
- case "last-month":
235
- a = new Date(e.getFullYear(), e.getMonth() - 1, 1), o = new Date(e.getFullYear(), e.getMonth(), 0);
236
- break;
237
- case "this-quarter": {
238
- const n = Math.floor(e.getMonth() / 3);
239
- a = new Date(e.getFullYear(), n * 3, 1), o = new Date(e.getFullYear(), n * 3 + 3, 0);
240
- break;
241
- }
242
- case "last-quarter": {
243
- const n = Math.floor(e.getMonth() / 3) - 1, s = n < 0 ? e.getFullYear() - 1 : e.getFullYear(), l = n < 0 ? 3 : n;
244
- a = new Date(s, l * 3, 1), o = new Date(s, l * 3 + 3, 0);
245
- break;
246
- }
247
- case "this-year":
248
- a = new Date(e.getFullYear(), 0, 1), o = new Date(e.getFullYear(), 11, 31);
249
- break;
250
- case "last-year":
251
- a = new Date(e.getFullYear() - 1, 0, 1), o = new Date(e.getFullYear() - 1, 11, 31);
252
- break;
253
- }
254
- return { start: a, end: o };
255
- }
256
- const F = [
257
- { id: "7d", label: "7D" },
258
- { id: "30d", label: "30D" },
259
- { id: "60d", label: "60D" },
260
- { id: "90d", label: "90D" }
261
- ], k = [
262
- { id: "mtd", label: "MTD" },
263
- { id: "qtd", label: "QTD" },
264
- { id: "ytd", label: "YTD" },
265
- { id: "lytd", label: "LYTD" }
266
- ], P = {
267
- id: "today",
268
- label: "Today"
269
- }, ut = [
270
- // Past events
271
- {
272
- id: "atlanta-jan",
273
- label: "Atlanta Market",
274
- startDate: new Date(2026, 0, 7),
275
- endDate: new Date(2026, 0, 14),
276
- location: "Atlanta, GA"
277
- },
278
- {
279
- id: "dallas-jan",
280
- label: "Dallas Total Home",
281
- startDate: new Date(2026, 0, 17),
282
- endDate: new Date(2026, 0, 22),
283
- location: "Dallas, TX"
284
- },
285
- // Current event (overlaps with today -- Feb 20, 2026)
286
- {
287
- id: "vegas-feb",
288
- label: "Las Vegas Market",
289
- startDate: new Date(2026, 1, 15),
290
- endDate: new Date(2026, 1, 24),
291
- location: "Las Vegas, NV"
292
- },
293
- // Future events
294
- {
295
- id: "ny-mar",
296
- label: "NY Now Spring",
297
- startDate: new Date(2026, 2, 8),
298
- endDate: new Date(2026, 2, 12),
299
- location: "New York, NY"
300
- },
301
- {
302
- id: "chicago-apr",
303
- label: "Chicago Gift Show",
304
- startDate: new Date(2026, 3, 18),
305
- endDate: new Date(2026, 3, 22),
306
- location: "Chicago, IL"
307
- }
308
- ], L = {
309
- TODAY: "today",
310
- MTD: "mtd",
311
- QTD: "qtd",
312
- YTD: "ytd",
313
- LYTD: "lytd",
314
- "30D": "30d",
315
- "60D": "60d",
316
- "90D": "90d",
317
- "7D": "7d"
318
- }, j = Object.fromEntries(
319
- Object.entries(L).map(([t, r]) => [r, t])
320
- );
321
- function Dt(t, r = /* @__PURE__ */ new Date()) {
322
- const e = t?.toLowerCase(), a = r;
323
- let o, n = a;
324
- switch (e) {
325
- case "today":
326
- o = q(a), n = Q(a);
327
- break;
328
- case "7d":
329
- o = d(a, 6), n = a;
330
- break;
331
- case "30d":
332
- o = d(a, 29), n = a;
333
- break;
334
- case "60d":
335
- o = d(a, 59), n = a;
336
- break;
337
- case "90d":
338
- o = d(a, 89), n = a;
339
- break;
340
- case "mtd":
341
- o = w(a), n = a;
342
- break;
343
- case "qtd":
344
- o = U(a), n = a;
345
- break;
346
- case "ytd":
347
- o = p(a), n = a;
348
- break;
349
- case "lytd":
350
- o = p(Y(a, 1)), n = _(Y(a, 1));
351
- break;
352
- default:
353
- o = w(a), n = a;
354
- }
355
- return { start: o, end: n };
356
- }
357
- function z(t) {
358
- const r = t?.toLowerCase();
359
- if (r === "today")
360
- return P;
361
- const e = F.find((o) => o.id === r);
362
- if (e) return e;
363
- const a = k.find((o) => o.id === r);
364
- return a || null;
365
- }
366
- function dt(t) {
367
- if (!t) return "Select...";
368
- if (t.toLowerCase() === "custom") return "Custom";
369
- const r = z(t);
370
- return r ? r.label : t;
371
- }
372
- function ft(t) {
373
- return t ? L[t.toUpperCase()] || t.toLowerCase() : null;
374
- }
375
- function gt(t) {
376
- return t ? j[t.toLowerCase()] || t.toUpperCase() : null;
377
- }
378
- function ht() {
379
- return [P, ...F, ...k];
380
- }
381
- const mt = "mtd";
382
57
  export {
383
- ut as DEFAULT_MARKET_PRESETS,
384
- mt as DEFAULT_PINNED,
385
- k as PERIOD_OPTIONS,
58
+ R as DEFAULT_MARKET_PRESETS,
59
+ y as DEFAULT_PINNED,
60
+ F as PERIOD_OPTIONS,
386
61
  L as PRESET_ID_MAP,
387
- j as PRESET_ID_REVERSE_MAP,
388
- F as ROLLING_OPTIONS,
389
- P as TODAY_PRESET,
390
- M as detectPreset,
391
- z as findPreset,
392
- Z as formatDateRange,
393
- m as formatDateRangeSmart,
394
- at as formatDateRangeWithPreset,
395
- lt as formatDuration,
396
- B as formatMarketDates,
397
- ct as formatPreset,
398
- nt as formatShortYear,
399
- st as formatSingleDate,
400
- X as formatTrend,
401
- G as formatValue,
402
- et as generateMarketId,
403
- ht as getAllPresets,
404
- rt as getDateRangeDisplayInfo,
405
- Dt as getDateRangeForPreset,
406
- x as getDurationDays,
407
- T as getPresetDateRange,
408
- dt as getPresetLabel,
409
- K as getValueFontSize,
410
- tt as isInRange,
411
- J as isMarketActive,
412
- v as isSameDay,
413
- it as isValidDateRangeFormat,
414
- ft as normalizePresetId,
415
- V as parseDateRange,
416
- ot as stripLeadingZeros,
417
- gt as toUppercasePresetId
62
+ I as PRESET_ID_REVERSE_MAP,
63
+ U as ROLLING_OPTIONS,
64
+ A as TODAY_PRESET,
65
+ c as V1_1_STATUS_MODE_ENV,
66
+ O as detectPreset,
67
+ b as findPreset,
68
+ h as formatDateRange,
69
+ N as formatDateRangeSmart,
70
+ v as formatDateRangeWithPreset,
71
+ V as formatDuration,
72
+ _ as formatMarketDates,
73
+ Y as formatPreset,
74
+ G as formatShortYear,
75
+ k as formatSingleDate,
76
+ S as formatTrend,
77
+ $ as formatValue,
78
+ P as generateMarketId,
79
+ x as getAllPresets,
80
+ z as getDateRangeDisplayInfo,
81
+ K as getDateRangeForPreset,
82
+ j as getDurationDays,
83
+ q as getPresetDateRange,
84
+ B as getPresetLabel,
85
+ m as getValueFontSize,
86
+ M as isInRange,
87
+ d as isMarketActive,
88
+ T as isSameDay,
89
+ g as isStatusModeEnabled,
90
+ C as isValidDateRangeFormat,
91
+ W as normalizePresetId,
92
+ X as parseDateRange,
93
+ Z as resolveEvent,
94
+ H as resolvePreset,
95
+ J as smartDateFormat,
96
+ Q as stripLeadingZeros,
97
+ w as toUppercasePresetId,
98
+ D as v1_1_status_mode
418
99
  };
@@ -0,0 +1,9 @@
1
+ import { EventRegistryEntry, DateRange } from './types';
2
+ export declare const EVENT_REGISTRY: EventRegistryEntry[];
3
+ /**
4
+ * Resolve an event name to its date range.
5
+ * Case-insensitive lookup against EVENT_REGISTRY entries by name.
6
+ * @throws {Error} if no matching event is found
7
+ */
8
+ export declare function resolveEvent(name: string): DateRange;
9
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1,18 @@
1
+ import { formatDateRange as _formatDateRange } from '../smartDateFormat';
2
+ import { FormatContext } from './types';
3
+ /**
4
+ * Re-export formatDateRange from canonical smartDateFormat.
5
+ * @param start - Start date
6
+ * @param end - End date
7
+ * @param referenceDate - Optional reference date (defaults to now)
8
+ * @returns Human-readable date range string (e.g., "Jan 1 – Jan 31")
9
+ */
10
+ export { _formatDateRange as formatDateRange };
11
+ /**
12
+ * Format a single Date to a human-readable string.
13
+ * @param date - Date to format
14
+ * @param context - Verbosity context: 'short' | 'medium' | 'long'
15
+ * @returns Human-readable date string (e.g., "Jan 15", "Jan 15, 2026")
16
+ */
17
+ export declare function smartDateFormat(date: Date, context?: FormatContext): string;
18
+ //# sourceMappingURL=formatting.d.ts.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @mt-gloss/utils/dateInterpretation
3
+ *
4
+ * Canonical module for date interpretation: preset math, event resolution,
5
+ * and smart formatting. Tree-shakable via subpath import.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { resolvePreset, resolveEvent, smartDateFormat, formatDateRange } from '@mt-gloss/utils/dateInterpretation';
10
+ *
11
+ * const mtd = resolvePreset('MTD'); // { start: Date, end: Date }
12
+ * const event = resolveEvent("Las Vegas Market '26");
13
+ * const label = smartDateFormat(new Date()); // "Apr 16"
14
+ * ```
15
+ */
16
+ export { resolvePreset } from './presets';
17
+ export { resolveEvent, EVENT_REGISTRY } from './events';
18
+ export { smartDateFormat, formatDateRange } from './formatting';
19
+ export type { PresetId, DateRange, FormatContext, FormatOpts, EventRegistryEntry } from './types';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { E as s, f as r, a as t, r as o, s as E } from "../../formatting-dHqp6ksD.js";
2
+ export {
3
+ s as EVENT_REGISTRY,
4
+ r as formatDateRange,
5
+ t as resolveEvent,
6
+ o as resolvePreset,
7
+ E as smartDateFormat
8
+ };
@@ -0,0 +1,11 @@
1
+ import { PresetId, DateRange } from './types';
2
+ /**
3
+ * Resolve a preset ID to its { start, end } date range.
4
+ * @param preset - Preset ID (case-insensitive, e.g., 'MTD', 'mtd', '30D')
5
+ * @param referenceDate - Reference date (defaults to now)
6
+ * @returns DateRange with start and end as Date instances
7
+ *
8
+ * Unknown preset IDs fall back to MTD (month-to-date) per T-11-03 mitigation.
9
+ */
10
+ export declare function resolvePreset(preset: PresetId | string, referenceDate?: Date): DateRange;
11
+ //# sourceMappingURL=presets.d.ts.map
@@ -0,0 +1,41 @@
1
+ /**
2
+ * dateInterpretation module types
3
+ *
4
+ * Local types for the @mt-gloss/utils/dateInterpretation subpath module.
5
+ * These extend/complement the global types in libs/utils/src/lib/types.ts.
6
+ */
7
+ /**
8
+ * Preset union type — canonical IDs (uppercase for API surface, case-insensitive at runtime).
9
+ * Falls back to MTD for unknown preset IDs (T-11-03 mitigation: document fallback behavior).
10
+ */
11
+ export type PresetId = 'MTD' | '30D' | '60D' | '90D' | 'QTD' | 'YTD' | 'LYTD' | 'TODAY' | '7D';
12
+ /**
13
+ * Date range returned by resolver functions.
14
+ * Both start and end are guaranteed to be valid Date instances.
15
+ */
16
+ export type DateRange = {
17
+ start: Date;
18
+ end: Date;
19
+ };
20
+ /**
21
+ * Context hint for smartDateFormat — controls verbosity of output string.
22
+ */
23
+ export type FormatContext = 'short' | 'medium' | 'long';
24
+ /**
25
+ * Options for formatting functions.
26
+ */
27
+ export type FormatOpts = {
28
+ shortYear?: boolean;
29
+ separator?: string;
30
+ };
31
+ /**
32
+ * An entry in the hand-authored event registry.
33
+ */
34
+ export interface EventRegistryEntry {
35
+ id: string;
36
+ name: string;
37
+ start: Date;
38
+ end: Date;
39
+ location?: string;
40
+ }
41
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { isStatusModeEnabled, v1_1_status_mode, V1_1_STATUS_MODE_ENV } from './v1_1_flags';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Phase 10: v1.1 feature flags for Status Mode.
3
+ *
4
+ * Flag is OFF by default in production bundles.
5
+ * Enable via env var (server/build-time) or globalThis override (runtime/test).
6
+ */
7
+ export declare const V1_1_STATUS_MODE_ENV = "NEXT_PUBLIC_V1_1_STATUS_MODE";
8
+ /**
9
+ * Returns true when Status Mode rendering is enabled.
10
+ *
11
+ * Priority order:
12
+ * 1. globalThis.__GLOSS_FLAGS__.v1_1_status_mode === true (runtime override / tests)
13
+ * 2. process.env.NEXT_PUBLIC_V1_1_STATUS_MODE === 'true' (build-time env var)
14
+ * 3. false (default — flag OFF)
15
+ */
16
+ export declare function isStatusModeEnabled(): boolean;
17
+ export declare const v1_1_status_mode: {
18
+ env: string;
19
+ check: typeof isStatusModeEnabled;
20
+ };
21
+ //# sourceMappingURL=v1_1_flags.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mt-gloss/utils",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
@@ -19,11 +19,23 @@
19
19
  "default": "./index.js"
20
20
  },
21
21
  "default": "./index.js"
22
+ },
23
+ "./dateInterpretation": {
24
+ "import": {
25
+ "types": "./lib/dateInterpretation/index.d.ts",
26
+ "default": "./lib/dateInterpretation/index.js"
27
+ },
28
+ "require": {
29
+ "types": "./lib/dateInterpretation/index.d.ts",
30
+ "default": "./lib/dateInterpretation/index.js"
31
+ },
32
+ "default": "./lib/dateInterpretation/index.js"
22
33
  }
23
34
  },
24
35
  "files": [
25
- "index.js",
26
- "index.d.ts",
36
+ "*.js",
37
+ "*.d.ts",
38
+ "lib/**/*.js",
27
39
  "lib/**/*.d.ts",
28
40
  "README.md"
29
41
  ],