@mt-gloss/utils 0.0.19 → 0.0.20

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { isStatusModeEnabled, v1_1_status_mode, V1_1_STATUS_MODE_ENV } from './lib/featureFlags';
1
+ export { isStatusModeEnabled, v1_1_status_mode, V1_1_STATUS_MODE_ENV, isEdgeHoverResizeEnabled, v1_1_edge_hover_resize, V1_1_EDGE_HOVER_RESIZE_ENV } from './lib/featureFlags';
2
2
  export type { PresetDefinition, MarketPreset, DateRange, MarketEvent } from './lib/types';
3
3
  export { formatValue, getValueFontSize } from './lib/formatValue';
4
4
  export type { FormatValueOptions, FormattedValue } from './lib/formatValue';
package/index.js CHANGED
@@ -1,99 +1,109 @@
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;
1
+ import { D as v, y as F, P as I, n as O, o as U, R as V, T as b, d as A, t as N, f as Y, b as G, k as z, l as k, c as H, h as Z, x, g as B, q as C, j as K, m as X, u as j, i as q, v as W, p as J, a as Q, r as w, s as ee, e as te, w as ne } from "./formatting-dHqp6ksD.js";
2
+ const l = "NEXT_PUBLIC_V1_1_STATUS_MODE";
3
+ function _() {
4
+ return typeof globalThis < "u" && globalThis.__GLOSS_FLAGS__?.v1_1_status_mode === !0 ? !0 : typeof process < "u" && process.env ? process.env[l] === "true" : !1;
5
5
  }
6
- const D = {
7
- env: c,
8
- check: g
6
+ const $ = {
7
+ env: l,
8
+ check: _
9
+ }, f = "NEXT_PUBLIC_V1_1_EDGE_HOVER_RESIZE";
10
+ function D() {
11
+ return typeof globalThis < "u" && globalThis.__GLOSS_FLAGS__?.v1_1_edge_hover_resize === !0 ? !0 : typeof process < "u" && process.env ? process.env[f] === "true" : !1;
12
+ }
13
+ const S = {
14
+ env: f,
15
+ check: D
9
16
  };
10
- function $(t, { prefix: e = "", suffix: n = "", abbreviated: r = !0, kThreshold: s = 1e3 } = {}) {
11
- if (t == null) {
12
- const u = e ? `${e} —${n}` : `—${n}`;
13
- return { display: u.trim(), full: u.trim(), length: u.trim().length };
17
+ function m(e, { prefix: t = "", suffix: n = "", abbreviated: a = !0, kThreshold: s = 1e3 } = {}) {
18
+ if (e == null) {
19
+ const c = t ? `${t} —${n}` : `—${n}`;
20
+ return { display: c.trim(), full: c.trim(), length: c.trim().length };
14
21
  }
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 };
22
+ const r = typeof e == "number" ? e : parseFloat(String(e).replace(/,/g, ""));
23
+ if (isNaN(r)) {
24
+ const u = `${t}${e}${n}`;
25
+ return { display: u, full: u, length: u.length };
19
26
  }
20
27
  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 };
28
+ a !== !1 && Math.abs(r) >= 1e6 ? o = (r / 1e6).toFixed(1).replace(/\.0$/, "") + "M" : a !== !1 && Math.abs(r) >= s ? o = (r / 1e3).toFixed(1).replace(/\.0$/, "") + "K" : o = r.toLocaleString("en-US");
29
+ const i = `${t}${o}${n}`, g = `${t}${r.toLocaleString("en-US")}${n}`;
30
+ return { display: i, full: g, length: i.length };
24
31
  }
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;
32
+ function h(e, t) {
33
+ return (t ?? 1) >= 2 ? e <= 4 || e <= 6 ? 30 : e <= 8 ? 24 : 20 : e <= 5 ? 28 : e <= 8 ? 20 : 17;
27
34
  }
28
- function S(t) {
29
- if (t == null || t === 0)
35
+ function E(e) {
36
+ if (e == null || e === 0)
30
37
  return { text: "0%", direction: "flat" };
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 };
38
+ const t = e > 0 ? "up" : e < 0 ? "down" : "flat", n = Math.abs(e);
39
+ return { text: n >= 3 ? `${Math.round(n)}%` : `${n.toFixed(1)}%`, direction: t };
33
40
  }
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}`;
41
+ function d(e, t) {
42
+ if (!e || !t) return "";
43
+ const n = e.toLocaleDateString("en-US", { month: "short" }), a = t.toLocaleDateString("en-US", { month: "short" }), s = e.getDate(), r = t.getDate(), o = e.getFullYear(), i = t.getFullYear();
44
+ return e.getTime() === t.getTime() || n === a && s === r && o === i ? `${n} ${s}, ${o}` : n === a && o === i ? `${n} ${s}–${r}` : o === i ? `${n} ${s} – ${a} ${r}` : `${n} ${s}, ${o} – ${a} ${r}, ${i}`;
38
45
  }
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}`;
46
+ function p(e, t) {
47
+ const n = e.toLocaleDateString("en-US", { month: "short" }), a = t.toLocaleDateString("en-US", { month: "short" }), s = e.getDate(), r = t.getDate();
48
+ return n === a ? `${n} ${s}–${r}` : `${n} ${s} – ${a} ${r}`;
42
49
  }
43
- function d(t, e = /* @__PURE__ */ new Date()) {
44
- return !t?.startDate || !t?.endDate ? !1 : e >= t.startDate && e <= t.endDate;
50
+ function T(e, t = /* @__PURE__ */ new Date()) {
51
+ return !e?.startDate || !e?.endDate ? !1 : t >= e.startDate && t <= e.endDate;
45
52
  }
46
- function T(t, e) {
47
- return !t || !e ? !1 : t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth() && t.getDate() === e.getDate();
53
+ function P(e, t) {
54
+ return !e || !t ? !1 : e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
48
55
  }
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);
56
+ function R(e, t, n) {
57
+ if (!e || !t || !n) return !1;
58
+ const a = e.getTime(), s = t.getTime(), r = n.getTime();
59
+ return a >= Math.min(s, r) && a <= Math.max(s, r);
53
60
  }
54
- function P() {
61
+ function M() {
55
62
  return `custom-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
56
63
  }
57
64
  export {
58
- R as DEFAULT_MARKET_PRESETS,
59
- y as DEFAULT_PINNED,
60
- F as PERIOD_OPTIONS,
61
- L as PRESET_ID_MAP,
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,
65
+ v as DEFAULT_MARKET_PRESETS,
66
+ F as DEFAULT_PINNED,
67
+ I as PERIOD_OPTIONS,
68
+ O as PRESET_ID_MAP,
69
+ U as PRESET_ID_REVERSE_MAP,
70
+ V as ROLLING_OPTIONS,
71
+ b as TODAY_PRESET,
72
+ f as V1_1_EDGE_HOVER_RESIZE_ENV,
73
+ l as V1_1_STATUS_MODE_ENV,
74
+ A as detectPreset,
75
+ N as findPreset,
76
+ d as formatDateRange,
77
+ Y as formatDateRangeSmart,
78
+ G as formatDateRangeWithPreset,
79
+ z as formatDuration,
80
+ p as formatMarketDates,
81
+ k as formatPreset,
82
+ H as formatShortYear,
83
+ Z as formatSingleDate,
84
+ E as formatTrend,
85
+ m as formatValue,
86
+ M as generateMarketId,
79
87
  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,
88
+ B as getDateRangeDisplayInfo,
89
+ C as getDateRangeForPreset,
90
+ K as getDurationDays,
91
+ X as getPresetDateRange,
92
+ j as getPresetLabel,
93
+ h as getValueFontSize,
94
+ D as isEdgeHoverResizeEnabled,
95
+ R as isInRange,
96
+ T as isMarketActive,
97
+ P as isSameDay,
98
+ _ as isStatusModeEnabled,
99
+ q as isValidDateRangeFormat,
91
100
  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
101
+ J as parseDateRange,
102
+ Q as resolveEvent,
103
+ w as resolvePreset,
104
+ ee as smartDateFormat,
105
+ te as stripLeadingZeros,
106
+ ne as toUppercasePresetId,
107
+ S as v1_1_edge_hover_resize,
108
+ $ as v1_1_status_mode
99
109
  };
@@ -1,2 +1,2 @@
1
- export { isStatusModeEnabled, v1_1_status_mode, V1_1_STATUS_MODE_ENV } from './v1_1_flags';
1
+ export { isStatusModeEnabled, v1_1_status_mode, V1_1_STATUS_MODE_ENV, isEdgeHoverResizeEnabled, v1_1_edge_hover_resize, V1_1_EDGE_HOVER_RESIZE_ENV } from './v1_1_flags';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -18,4 +18,28 @@ export declare const v1_1_status_mode: {
18
18
  env: string;
19
19
  check: typeof isStatusModeEnabled;
20
20
  };
21
+ /**
22
+ * Phase 10.5 WR-01 — edge-hover resize decoupling.
23
+ *
24
+ * Independent feature flag for edge-hover resize. Previously the consumer
25
+ * gated `enableEdgeHover` on `isStatusModeEnabled()`, which coupled two
26
+ * independent features behind a single flag. This helper lets consumers
27
+ * toggle edge-hover-resize on its own.
28
+ *
29
+ * Flag is OFF by default in production bundles.
30
+ */
31
+ export declare const V1_1_EDGE_HOVER_RESIZE_ENV = "NEXT_PUBLIC_V1_1_EDGE_HOVER_RESIZE";
32
+ /**
33
+ * Returns true when edge-hover resize is enabled.
34
+ *
35
+ * Priority order (mirrors isStatusModeEnabled):
36
+ * 1. globalThis.__GLOSS_FLAGS__.v1_1_edge_hover_resize === true (runtime override / tests)
37
+ * 2. process.env.NEXT_PUBLIC_V1_1_EDGE_HOVER_RESIZE === 'true' (build-time env var)
38
+ * 3. false (default — flag OFF)
39
+ */
40
+ export declare function isEdgeHoverResizeEnabled(): boolean;
41
+ export declare const v1_1_edge_hover_resize: {
42
+ env: string;
43
+ check: typeof isEdgeHoverResizeEnabled;
44
+ };
21
45
  //# 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.19",
3
+ "version": "0.0.20",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "restricted"