@mrck-labs/vanaheim-shared 0.2.1 → 0.3.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/dist/constants/index.d.mts +53 -1
- package/dist/constants/index.d.ts +53 -1
- package/dist/constants/index.js +102 -0
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/index.mjs +96 -0
- package/dist/constants/index.mjs.map +1 -1
- package/dist/{database-BKc0Oj26.d.mts → database-3Vv5PNDa.d.mts} +90 -6
- package/dist/{database-BKc0Oj26.d.ts → database-3Vv5PNDa.d.ts} +90 -6
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +177 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +165 -0
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/index.d.mts +41 -2
- package/dist/utils/index.d.ts +41 -2
- package/dist/utils/index.js +75 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +69 -0
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -110,7 +110,7 @@ interface NewFocusCategory {
|
|
|
110
110
|
sortOrder?: number;
|
|
111
111
|
isDefault?: boolean;
|
|
112
112
|
}
|
|
113
|
-
type FocusSessionStatus =
|
|
113
|
+
type FocusSessionStatus = "active" | "completed" | "abandoned";
|
|
114
114
|
interface FocusSession {
|
|
115
115
|
id: string;
|
|
116
116
|
userId: string;
|
|
@@ -140,7 +140,7 @@ interface FocusSessionFilters {
|
|
|
140
140
|
startedAfter?: string;
|
|
141
141
|
startedBefore?: string;
|
|
142
142
|
}
|
|
143
|
-
type ChatMessageRole =
|
|
143
|
+
type ChatMessageRole = "user" | "assistant" | "system";
|
|
144
144
|
interface ChatConversation {
|
|
145
145
|
id: string;
|
|
146
146
|
userId: string;
|
|
@@ -181,7 +181,7 @@ interface NewEFLink {
|
|
|
181
181
|
icon?: string | null;
|
|
182
182
|
sortOrder?: number;
|
|
183
183
|
}
|
|
184
|
-
type LieuDayType =
|
|
184
|
+
type LieuDayType = "earned" | "used";
|
|
185
185
|
interface LieuDay {
|
|
186
186
|
id: string;
|
|
187
187
|
userId: string;
|
|
@@ -196,8 +196,8 @@ interface NewLieuDay {
|
|
|
196
196
|
date: string;
|
|
197
197
|
reason?: string | null;
|
|
198
198
|
}
|
|
199
|
-
type BankConnectionStatus =
|
|
200
|
-
type TransactionType =
|
|
199
|
+
type BankConnectionStatus = "pending" | "linked" | "expired" | "error";
|
|
200
|
+
type TransactionType = "debit" | "credit";
|
|
201
201
|
interface BankConnection {
|
|
202
202
|
id: string;
|
|
203
203
|
userId: string;
|
|
@@ -224,6 +224,90 @@ interface BankTransaction {
|
|
|
224
224
|
transactionType: TransactionType | null;
|
|
225
225
|
createdAt: string;
|
|
226
226
|
}
|
|
227
|
+
interface HealthCategory {
|
|
228
|
+
id: string;
|
|
229
|
+
userId: string;
|
|
230
|
+
name: string;
|
|
231
|
+
icon: string;
|
|
232
|
+
color: string;
|
|
233
|
+
sortOrder: number;
|
|
234
|
+
isDefault: boolean;
|
|
235
|
+
createdAt: string;
|
|
236
|
+
updatedAt: string;
|
|
237
|
+
}
|
|
238
|
+
interface NewHealthCategory {
|
|
239
|
+
name: string;
|
|
240
|
+
icon: string;
|
|
241
|
+
color: string;
|
|
242
|
+
sortOrder?: number;
|
|
243
|
+
isDefault?: boolean;
|
|
244
|
+
}
|
|
245
|
+
type HealthFrequencyType = "daily" | "specific_days" | "times_per_week" | "times_per_month";
|
|
246
|
+
interface HealthFrequencyConfig {
|
|
247
|
+
days?: number[];
|
|
248
|
+
target?: number;
|
|
249
|
+
}
|
|
250
|
+
interface HealthHabit {
|
|
251
|
+
id: string;
|
|
252
|
+
userId: string;
|
|
253
|
+
categoryId: string;
|
|
254
|
+
name: string;
|
|
255
|
+
description: string | null;
|
|
256
|
+
frequencyType: HealthFrequencyType;
|
|
257
|
+
frequencyConfig: string | null;
|
|
258
|
+
targetAmount: number | null;
|
|
259
|
+
targetUnit: string | null;
|
|
260
|
+
streakCurrent: number;
|
|
261
|
+
streakBest: number;
|
|
262
|
+
isActive: boolean;
|
|
263
|
+
createdAt: string;
|
|
264
|
+
updatedAt: string;
|
|
265
|
+
category?: HealthCategory;
|
|
266
|
+
}
|
|
267
|
+
interface NewHealthHabit {
|
|
268
|
+
categoryId: string;
|
|
269
|
+
name: string;
|
|
270
|
+
description?: string | null;
|
|
271
|
+
frequencyType: HealthFrequencyType;
|
|
272
|
+
frequencyConfig?: HealthFrequencyConfig | null;
|
|
273
|
+
targetAmount?: number | null;
|
|
274
|
+
targetUnit?: string | null;
|
|
275
|
+
isActive?: boolean;
|
|
276
|
+
}
|
|
277
|
+
interface HealthCompletion {
|
|
278
|
+
id: string;
|
|
279
|
+
habitId: string;
|
|
280
|
+
userId: string;
|
|
281
|
+
date: string;
|
|
282
|
+
completedAt: string;
|
|
283
|
+
notes: string | null;
|
|
284
|
+
}
|
|
285
|
+
interface NewHealthCompletion {
|
|
286
|
+
habitId: string;
|
|
287
|
+
date?: string;
|
|
288
|
+
notes?: string | null;
|
|
289
|
+
}
|
|
290
|
+
interface HealthHabitFilters {
|
|
291
|
+
categoryId?: string;
|
|
292
|
+
isActive?: boolean;
|
|
293
|
+
frequencyType?: HealthFrequencyType;
|
|
294
|
+
}
|
|
295
|
+
interface HealthCompletionFilters {
|
|
296
|
+
habitId?: string;
|
|
297
|
+
dateFrom?: string;
|
|
298
|
+
dateTo?: string;
|
|
299
|
+
}
|
|
300
|
+
interface HealthStats {
|
|
301
|
+
totalHabits: number;
|
|
302
|
+
dailyHabits: number;
|
|
303
|
+
weeklyHabits: number;
|
|
304
|
+
completedToday: number;
|
|
305
|
+
pendingToday: number;
|
|
306
|
+
completionRate: number;
|
|
307
|
+
totalStreak: number;
|
|
308
|
+
bestStreak: number;
|
|
309
|
+
weeklyCompletions: number;
|
|
310
|
+
}
|
|
227
311
|
interface Setting {
|
|
228
312
|
id: string;
|
|
229
313
|
userId: string;
|
|
@@ -237,4 +321,4 @@ interface ExchangeRate {
|
|
|
237
321
|
updatedAt: string;
|
|
238
322
|
}
|
|
239
323
|
|
|
240
|
-
export type { BankConnectionStatus as B, ChatMessageRole as C, ExpenseCategory as E, FocusCategory as F, IncomeCategory as I, LieuDayType as L, NewExpenseCategory as N, Setting as S, TransactionType as T, Expense as a, NewExpense as b, NewIncomeCategory as c, Income as d, NewIncome as e, NewFocusCategory as f, FocusSessionStatus as g, FocusSession as h, NewFocusSession as i, FocusSessionFilters as j, ChatConversation as k, NewChatConversation as l, ChatMessage as m, NewChatMessage as n, EFLink as o, NewEFLink as p, LieuDay as q, NewLieuDay as r, BankConnection as s, BankTransaction as t,
|
|
324
|
+
export type { NewHealthCompletion as A, BankConnectionStatus as B, ChatMessageRole as C, HealthHabitFilters as D, ExpenseCategory as E, FocusCategory as F, HealthCompletionFilters as G, HealthCategory as H, IncomeCategory as I, HealthStats as J, ExchangeRate as K, LieuDayType as L, NewExpenseCategory as N, Setting as S, TransactionType as T, Expense as a, NewExpense as b, NewIncomeCategory as c, Income as d, NewIncome as e, NewFocusCategory as f, FocusSessionStatus as g, FocusSession as h, NewFocusSession as i, FocusSessionFilters as j, ChatConversation as k, NewChatConversation as l, ChatMessage as m, NewChatMessage as n, EFLink as o, NewEFLink as p, LieuDay as q, NewLieuDay as r, BankConnection as s, BankTransaction as t, NewHealthCategory as u, HealthFrequencyType as v, HealthFrequencyConfig as w, HealthHabit as x, NewHealthHabit as y, HealthCompletion as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { s as BankConnection, B as BankConnectionStatus, t as BankTransaction, k as ChatConversation, m as ChatMessage, C as ChatMessageRole, o as EFLink,
|
|
1
|
+
export { s as BankConnection, B as BankConnectionStatus, t as BankTransaction, k as ChatConversation, m as ChatMessage, C as ChatMessageRole, o as EFLink, K as ExchangeRate, a as Expense, E as ExpenseCategory, F as FocusCategory, h as FocusSession, j as FocusSessionFilters, g as FocusSessionStatus, H as HealthCategory, z as HealthCompletion, G as HealthCompletionFilters, w as HealthFrequencyConfig, v as HealthFrequencyType, x as HealthHabit, D as HealthHabitFilters, J as HealthStats, d as Income, I as IncomeCategory, q as LieuDay, L as LieuDayType, l as NewChatConversation, n as NewChatMessage, p as NewEFLink, b as NewExpense, N as NewExpenseCategory, f as NewFocusCategory, i as NewFocusSession, u as NewHealthCategory, A as NewHealthCompletion, y as NewHealthHabit, e as NewIncome, c as NewIncomeCategory, r as NewLieuDay, S as Setting, T as TransactionType } from './database-3Vv5PNDa.mjs';
|
|
2
2
|
export { ApiKeyInfo, CloudAgent, CloudAgentConversation, CloudAgentMessage, CloudAgentMessageType, CloudAgentModel, CloudAgentPrompt, CloudAgentSource, CloudAgentStatus, CloudAgentTarget, IssueQueryOptions, LINEAR_PRIORITY_LABELS, LaunchAgentRequest, LinearIssue, LinearPriority, LinearProject, LinearState, LinearStateType, LinearUser, ListAgentsResponse, ModelsResponse, PaginatedIssues } from './types/index.mjs';
|
|
3
|
-
export { API_URLS, CLOUD_AGENT_STATUSES, CLOUD_AGENT_STATUS_COLORS, CLOUD_AGENT_STATUS_EMOJI, CURRENCIES, CURRENCY_NAMES, CURRENCY_SYMBOLS, Currency, DEFAULT_FOCUS_DURATIONS, FOCUS_STATUS, FREQUENCIES, FREQUENCY_LABELS, FREQUENCY_MULTIPLIERS, FocusDuration, FocusStatus, Frequency, LINEAR_PRIORITIES, LINEAR_PRIORITY_COLORS, LinearPriorityValue, SETTING_KEYS, SettingKey } from './constants/index.mjs';
|
|
4
|
-
export { calculateFocusStats, calculateLieuBalance, calculateMonthlyExpenses, calculateMonthlyIncome, calculateMonthlySavings, calculateSavingsRate, formatCurrency, formatDate, formatDueDate, formatDuration, formatRelativeTime, formatTime, formatTotalTime, generateId, generateRandomColor, generateShortId, getRepoName, isNonEmptyString, isPositiveNumber, isValidCurrency, isValidEmail, isValidFrequency, isValidISODate, isValidUrl, toMonthlyAmount, toYearlyAmount, truncate } from './utils/index.mjs';
|
|
3
|
+
export { API_URLS, CLOUD_AGENT_STATUSES, CLOUD_AGENT_STATUS_COLORS, CLOUD_AGENT_STATUS_EMOJI, CURRENCIES, CURRENCY_NAMES, CURRENCY_SYMBOLS, Currency, DAY_OPTIONS, DEFAULT_FOCUS_DURATIONS, FOCUS_STATUS, FREQUENCIES, FREQUENCY_LABELS, FREQUENCY_MULTIPLIERS, FREQUENCY_OPTIONS, FocusDuration, FocusStatus, Frequency, HEALTH_FREQUENCY_LABELS, HEALTH_FREQUENCY_TYPES, LINEAR_PRIORITIES, LINEAR_PRIORITY_COLORS, LinearPriorityValue, PRESET_COLORS, PRESET_ICONS, SETTING_KEYS, SettingKey } from './constants/index.mjs';
|
|
4
|
+
export { WeeklyProgressItem, calculateFocusStats, calculateLieuBalance, calculateMonthlyExpenses, calculateMonthlyIncome, calculateMonthlySavings, calculateSavingsRate, calculateWeeklyProgress, formatCurrency, formatDate, formatDueDate, formatDuration, formatRelativeTime, formatTime, formatTotalTime, generateId, generateRandomColor, generateShortId, getFrequencyDescription, getRepoName, isNonEmptyString, isPositiveNumber, isValidCurrency, isValidEmail, isValidFrequency, isValidISODate, isValidUrl, parseFrequencyConfig, shouldDoOnDate, shouldDoToday, stringifyFrequencyConfig, toMonthlyAmount, toYearlyAmount, truncate } from './utils/index.mjs';
|
|
5
5
|
export { QueryKeys, queryKeys } from './query/index.mjs';
|
|
6
6
|
export { ActiveSession, TimerStatus, activeSessionAtom, elapsedSecondsAtom, formattedElapsedAtom, formattedRemainingAtom, progressAtom, progressPercentAtom, remainingSecondsAtom, targetSecondsAtom, timerStatusAtom } from './atoms/index.mjs';
|
|
7
7
|
export { DateFormat, TimeFormat, addDays, formatDateHeader, formatDateLocalized, formatDateLong, formatDateString, formatDueDateString, formatFullDate, formatMonthYear, formatRelativeDueDate, formatRelativePayDate, formatRelativeTimeExtended, formatTimeHHMM, formatTimeLocalized, formatTimeWithSeconds, formatWeekRange, getEndOfDayISO, getNextWeek, getPreviousWeek, getStartOfDayISO, getTodayMidnight, getTodayString, getTomorrowString, getWeekEnd, getWeekEndString, getWeekStart, getWeekStartString, getYesterdayString, isDueSoon, isOverdue, isToday, normalizeToMidnight, parseLocalDate, subtractDays } from './date/index.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { s as BankConnection, B as BankConnectionStatus, t as BankTransaction, k as ChatConversation, m as ChatMessage, C as ChatMessageRole, o as EFLink,
|
|
1
|
+
export { s as BankConnection, B as BankConnectionStatus, t as BankTransaction, k as ChatConversation, m as ChatMessage, C as ChatMessageRole, o as EFLink, K as ExchangeRate, a as Expense, E as ExpenseCategory, F as FocusCategory, h as FocusSession, j as FocusSessionFilters, g as FocusSessionStatus, H as HealthCategory, z as HealthCompletion, G as HealthCompletionFilters, w as HealthFrequencyConfig, v as HealthFrequencyType, x as HealthHabit, D as HealthHabitFilters, J as HealthStats, d as Income, I as IncomeCategory, q as LieuDay, L as LieuDayType, l as NewChatConversation, n as NewChatMessage, p as NewEFLink, b as NewExpense, N as NewExpenseCategory, f as NewFocusCategory, i as NewFocusSession, u as NewHealthCategory, A as NewHealthCompletion, y as NewHealthHabit, e as NewIncome, c as NewIncomeCategory, r as NewLieuDay, S as Setting, T as TransactionType } from './database-3Vv5PNDa.js';
|
|
2
2
|
export { ApiKeyInfo, CloudAgent, CloudAgentConversation, CloudAgentMessage, CloudAgentMessageType, CloudAgentModel, CloudAgentPrompt, CloudAgentSource, CloudAgentStatus, CloudAgentTarget, IssueQueryOptions, LINEAR_PRIORITY_LABELS, LaunchAgentRequest, LinearIssue, LinearPriority, LinearProject, LinearState, LinearStateType, LinearUser, ListAgentsResponse, ModelsResponse, PaginatedIssues } from './types/index.js';
|
|
3
|
-
export { API_URLS, CLOUD_AGENT_STATUSES, CLOUD_AGENT_STATUS_COLORS, CLOUD_AGENT_STATUS_EMOJI, CURRENCIES, CURRENCY_NAMES, CURRENCY_SYMBOLS, Currency, DEFAULT_FOCUS_DURATIONS, FOCUS_STATUS, FREQUENCIES, FREQUENCY_LABELS, FREQUENCY_MULTIPLIERS, FocusDuration, FocusStatus, Frequency, LINEAR_PRIORITIES, LINEAR_PRIORITY_COLORS, LinearPriorityValue, SETTING_KEYS, SettingKey } from './constants/index.js';
|
|
4
|
-
export { calculateFocusStats, calculateLieuBalance, calculateMonthlyExpenses, calculateMonthlyIncome, calculateMonthlySavings, calculateSavingsRate, formatCurrency, formatDate, formatDueDate, formatDuration, formatRelativeTime, formatTime, formatTotalTime, generateId, generateRandomColor, generateShortId, getRepoName, isNonEmptyString, isPositiveNumber, isValidCurrency, isValidEmail, isValidFrequency, isValidISODate, isValidUrl, toMonthlyAmount, toYearlyAmount, truncate } from './utils/index.js';
|
|
3
|
+
export { API_URLS, CLOUD_AGENT_STATUSES, CLOUD_AGENT_STATUS_COLORS, CLOUD_AGENT_STATUS_EMOJI, CURRENCIES, CURRENCY_NAMES, CURRENCY_SYMBOLS, Currency, DAY_OPTIONS, DEFAULT_FOCUS_DURATIONS, FOCUS_STATUS, FREQUENCIES, FREQUENCY_LABELS, FREQUENCY_MULTIPLIERS, FREQUENCY_OPTIONS, FocusDuration, FocusStatus, Frequency, HEALTH_FREQUENCY_LABELS, HEALTH_FREQUENCY_TYPES, LINEAR_PRIORITIES, LINEAR_PRIORITY_COLORS, LinearPriorityValue, PRESET_COLORS, PRESET_ICONS, SETTING_KEYS, SettingKey } from './constants/index.js';
|
|
4
|
+
export { WeeklyProgressItem, calculateFocusStats, calculateLieuBalance, calculateMonthlyExpenses, calculateMonthlyIncome, calculateMonthlySavings, calculateSavingsRate, calculateWeeklyProgress, formatCurrency, formatDate, formatDueDate, formatDuration, formatRelativeTime, formatTime, formatTotalTime, generateId, generateRandomColor, generateShortId, getFrequencyDescription, getRepoName, isNonEmptyString, isPositiveNumber, isValidCurrency, isValidEmail, isValidFrequency, isValidISODate, isValidUrl, parseFrequencyConfig, shouldDoOnDate, shouldDoToday, stringifyFrequencyConfig, toMonthlyAmount, toYearlyAmount, truncate } from './utils/index.js';
|
|
5
5
|
export { QueryKeys, queryKeys } from './query/index.js';
|
|
6
6
|
export { ActiveSession, TimerStatus, activeSessionAtom, elapsedSecondsAtom, formattedElapsedAtom, formattedRemainingAtom, progressAtom, progressPercentAtom, remainingSecondsAtom, targetSecondsAtom, timerStatusAtom } from './atoms/index.js';
|
|
7
7
|
export { DateFormat, TimeFormat, addDays, formatDateHeader, formatDateLocalized, formatDateLong, formatDateString, formatDueDateString, formatFullDate, formatMonthYear, formatRelativeDueDate, formatRelativePayDate, formatRelativeTimeExtended, formatTimeHHMM, formatTimeLocalized, formatTimeWithSeconds, formatWeekRange, getEndOfDayISO, getNextWeek, getPreviousWeek, getStartOfDayISO, getTodayMidnight, getTodayString, getTomorrowString, getWeekEnd, getWeekEndString, getWeekStart, getWeekStartString, getYesterdayString, isDueSoon, isOverdue, isToday, normalizeToMidnight, parseLocalDate, subtractDays } from './date/index.js';
|
package/dist/index.js
CHANGED
|
@@ -27,14 +27,20 @@ __export(src_exports, {
|
|
|
27
27
|
CURRENCIES: () => CURRENCIES,
|
|
28
28
|
CURRENCY_NAMES: () => CURRENCY_NAMES,
|
|
29
29
|
CURRENCY_SYMBOLS: () => CURRENCY_SYMBOLS,
|
|
30
|
+
DAY_OPTIONS: () => DAY_OPTIONS,
|
|
30
31
|
DEFAULT_FOCUS_DURATIONS: () => DEFAULT_FOCUS_DURATIONS,
|
|
31
32
|
FOCUS_STATUS: () => FOCUS_STATUS,
|
|
32
33
|
FREQUENCIES: () => FREQUENCIES,
|
|
33
34
|
FREQUENCY_LABELS: () => FREQUENCY_LABELS,
|
|
34
35
|
FREQUENCY_MULTIPLIERS: () => FREQUENCY_MULTIPLIERS,
|
|
36
|
+
FREQUENCY_OPTIONS: () => FREQUENCY_OPTIONS,
|
|
37
|
+
HEALTH_FREQUENCY_LABELS: () => HEALTH_FREQUENCY_LABELS,
|
|
38
|
+
HEALTH_FREQUENCY_TYPES: () => HEALTH_FREQUENCY_TYPES,
|
|
35
39
|
LINEAR_PRIORITIES: () => LINEAR_PRIORITIES,
|
|
36
40
|
LINEAR_PRIORITY_COLORS: () => LINEAR_PRIORITY_COLORS,
|
|
37
41
|
LINEAR_PRIORITY_LABELS: () => LINEAR_PRIORITY_LABELS,
|
|
42
|
+
PRESET_COLORS: () => PRESET_COLORS,
|
|
43
|
+
PRESET_ICONS: () => PRESET_ICONS,
|
|
38
44
|
SETTING_KEYS: () => SETTING_KEYS,
|
|
39
45
|
activeSessionAtom: () => activeSessionAtom,
|
|
40
46
|
addDays: () => addDays,
|
|
@@ -44,6 +50,7 @@ __export(src_exports, {
|
|
|
44
50
|
calculateMonthlyIncome: () => calculateMonthlyIncome,
|
|
45
51
|
calculateMonthlySavings: () => calculateMonthlySavings,
|
|
46
52
|
calculateSavingsRate: () => calculateSavingsRate,
|
|
53
|
+
calculateWeeklyProgress: () => calculateWeeklyProgress,
|
|
47
54
|
elapsedSecondsAtom: () => elapsedSecondsAtom,
|
|
48
55
|
formatCurrency: () => formatCurrency,
|
|
49
56
|
formatDate: () => formatDate,
|
|
@@ -72,6 +79,7 @@ __export(src_exports, {
|
|
|
72
79
|
generateRandomColor: () => generateRandomColor,
|
|
73
80
|
generateShortId: () => generateShortId,
|
|
74
81
|
getEndOfDayISO: () => getEndOfDayISO,
|
|
82
|
+
getFrequencyDescription: () => getFrequencyDescription,
|
|
75
83
|
getNextWeek: () => getNextWeek,
|
|
76
84
|
getPreviousWeek: () => getPreviousWeek,
|
|
77
85
|
getRepoName: () => getRepoName,
|
|
@@ -95,11 +103,15 @@ __export(src_exports, {
|
|
|
95
103
|
isValidISODate: () => isValidISODate,
|
|
96
104
|
isValidUrl: () => isValidUrl,
|
|
97
105
|
normalizeToMidnight: () => normalizeToMidnight,
|
|
106
|
+
parseFrequencyConfig: () => parseFrequencyConfig,
|
|
98
107
|
parseLocalDate: () => parseLocalDate,
|
|
99
108
|
progressAtom: () => progressAtom,
|
|
100
109
|
progressPercentAtom: () => progressPercentAtom,
|
|
101
110
|
queryKeys: () => queryKeys,
|
|
102
111
|
remainingSecondsAtom: () => remainingSecondsAtom,
|
|
112
|
+
shouldDoOnDate: () => shouldDoOnDate,
|
|
113
|
+
shouldDoToday: () => shouldDoToday,
|
|
114
|
+
stringifyFrequencyConfig: () => stringifyFrequencyConfig,
|
|
103
115
|
subtractDays: () => subtractDays,
|
|
104
116
|
targetSecondsAtom: () => targetSecondsAtom,
|
|
105
117
|
timerStatusAtom: () => timerStatusAtom,
|
|
@@ -153,8 +165,98 @@ var FREQUENCY_MULTIPLIERS = {
|
|
|
153
165
|
weekly: 52,
|
|
154
166
|
"one-time": 1
|
|
155
167
|
};
|
|
168
|
+
var FREQUENCY_OPTIONS = [
|
|
169
|
+
{ value: "monthly", label: "Monthly" },
|
|
170
|
+
{ value: "yearly", label: "Yearly" },
|
|
171
|
+
{ value: "6-monthly", label: "Every 6 Months" },
|
|
172
|
+
{ value: "weekly", label: "Weekly" },
|
|
173
|
+
{ value: "one-time", label: "One Time" }
|
|
174
|
+
];
|
|
156
175
|
var DEFAULT_FOCUS_DURATIONS = [15, 25, 30, 45, 60, 90];
|
|
157
176
|
var FOCUS_STATUS = ["active", "completed", "abandoned"];
|
|
177
|
+
var HEALTH_FREQUENCY_TYPES = [
|
|
178
|
+
"daily",
|
|
179
|
+
"specific_days",
|
|
180
|
+
"times_per_week",
|
|
181
|
+
"times_per_month"
|
|
182
|
+
];
|
|
183
|
+
var HEALTH_FREQUENCY_LABELS = {
|
|
184
|
+
daily: "Daily",
|
|
185
|
+
specific_days: "Specific Days",
|
|
186
|
+
times_per_week: "Times per Week",
|
|
187
|
+
times_per_month: "Times per Month"
|
|
188
|
+
};
|
|
189
|
+
var DAY_OPTIONS = [
|
|
190
|
+
{ value: 0, label: "Sun" },
|
|
191
|
+
{ value: 1, label: "Mon" },
|
|
192
|
+
{ value: 2, label: "Tue" },
|
|
193
|
+
{ value: 3, label: "Wed" },
|
|
194
|
+
{ value: 4, label: "Thu" },
|
|
195
|
+
{ value: 5, label: "Fri" },
|
|
196
|
+
{ value: 6, label: "Sat" }
|
|
197
|
+
];
|
|
198
|
+
var PRESET_COLORS = [
|
|
199
|
+
"#10B981",
|
|
200
|
+
// Emerald
|
|
201
|
+
"#3B82F6",
|
|
202
|
+
// Blue
|
|
203
|
+
"#F59E0B",
|
|
204
|
+
// Amber
|
|
205
|
+
"#EF4444",
|
|
206
|
+
// Red
|
|
207
|
+
"#8B5CF6",
|
|
208
|
+
// Purple
|
|
209
|
+
"#EC4899",
|
|
210
|
+
// Pink
|
|
211
|
+
"#14B8A6",
|
|
212
|
+
// Teal
|
|
213
|
+
"#F97316",
|
|
214
|
+
// Orange
|
|
215
|
+
"#6366F1",
|
|
216
|
+
// Indigo
|
|
217
|
+
"#84CC16"
|
|
218
|
+
// Lime
|
|
219
|
+
];
|
|
220
|
+
var PRESET_ICONS = [
|
|
221
|
+
"\u{1F4DD}",
|
|
222
|
+
// Writing/Notes
|
|
223
|
+
"\u{1F4BB}",
|
|
224
|
+
// Coding/Tech
|
|
225
|
+
"\u{1F3A8}",
|
|
226
|
+
// Design/Art
|
|
227
|
+
"\u{1F4CA}",
|
|
228
|
+
// Analytics/Data
|
|
229
|
+
"\u{1F527}",
|
|
230
|
+
// Tools/Settings
|
|
231
|
+
"\u{1F4DA}",
|
|
232
|
+
// Learning/Docs
|
|
233
|
+
"\u{1F4A1}",
|
|
234
|
+
// Ideas/Lightbulb
|
|
235
|
+
"\u{1F680}",
|
|
236
|
+
// Launch/Start
|
|
237
|
+
"\u26A1",
|
|
238
|
+
// Fast/Energy
|
|
239
|
+
"\u{1F3AF}",
|
|
240
|
+
// Target/Goal
|
|
241
|
+
"\u{1F48A}",
|
|
242
|
+
// Health/Medicine
|
|
243
|
+
"\u{1F957}",
|
|
244
|
+
// Food/Diet
|
|
245
|
+
"\u{1F4A7}",
|
|
246
|
+
// Water/Hydration
|
|
247
|
+
"\u{1F3C3}",
|
|
248
|
+
// Exercise/Running
|
|
249
|
+
"\u{1F634}",
|
|
250
|
+
// Sleep/Rest
|
|
251
|
+
"\u{1F9D8}",
|
|
252
|
+
// Meditation/Mindfulness
|
|
253
|
+
"\u{1F4AA}",
|
|
254
|
+
// Strength/Fitness
|
|
255
|
+
"\u{1F34E}",
|
|
256
|
+
// Health/Food
|
|
257
|
+
"\u{1F517}"
|
|
258
|
+
// Links/Connections
|
|
259
|
+
];
|
|
158
260
|
var LINEAR_PRIORITIES = [0, 1, 2, 3, 4];
|
|
159
261
|
var LINEAR_PRIORITY_COLORS = {
|
|
160
262
|
0: "#6b7280",
|
|
@@ -420,6 +522,69 @@ function calculateFocusStats(sessions) {
|
|
|
420
522
|
};
|
|
421
523
|
}
|
|
422
524
|
|
|
525
|
+
// src/utils/health.ts
|
|
526
|
+
function parseFrequencyConfig(config) {
|
|
527
|
+
if (!config) return null;
|
|
528
|
+
try {
|
|
529
|
+
return JSON.parse(config);
|
|
530
|
+
} catch {
|
|
531
|
+
return null;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
function stringifyFrequencyConfig(config) {
|
|
535
|
+
if (!config) return null;
|
|
536
|
+
return JSON.stringify(config);
|
|
537
|
+
}
|
|
538
|
+
function getFrequencyDescription(habit) {
|
|
539
|
+
const config = parseFrequencyConfig(habit.frequencyConfig);
|
|
540
|
+
switch (habit.frequencyType) {
|
|
541
|
+
case "daily":
|
|
542
|
+
return "Every day";
|
|
543
|
+
case "specific_days": {
|
|
544
|
+
if (!config?.days) return "Specific days";
|
|
545
|
+
const dayNames = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
546
|
+
return config.days.map((d) => dayNames[d]).join(", ");
|
|
547
|
+
}
|
|
548
|
+
case "times_per_week":
|
|
549
|
+
return `${config?.target || 1}x per week`;
|
|
550
|
+
case "times_per_month":
|
|
551
|
+
return `${config?.target || 1}x per month`;
|
|
552
|
+
default:
|
|
553
|
+
return "Unknown";
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
function shouldDoOnDate(habit, date) {
|
|
557
|
+
const dayOfWeek = date.getDay();
|
|
558
|
+
switch (habit.frequencyType) {
|
|
559
|
+
case "daily":
|
|
560
|
+
return true;
|
|
561
|
+
case "specific_days": {
|
|
562
|
+
const config = parseFrequencyConfig(habit.frequencyConfig);
|
|
563
|
+
return config?.days?.includes(dayOfWeek) ?? false;
|
|
564
|
+
}
|
|
565
|
+
case "times_per_week":
|
|
566
|
+
case "times_per_month":
|
|
567
|
+
return true;
|
|
568
|
+
default:
|
|
569
|
+
return true;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
function shouldDoToday(habit) {
|
|
573
|
+
return shouldDoOnDate(habit, /* @__PURE__ */ new Date());
|
|
574
|
+
}
|
|
575
|
+
function calculateWeeklyProgress(habit, weekCompletionCount) {
|
|
576
|
+
const config = parseFrequencyConfig(habit.frequencyConfig);
|
|
577
|
+
const target = config?.target ?? 1;
|
|
578
|
+
const completed = weekCompletionCount;
|
|
579
|
+
return {
|
|
580
|
+
habit,
|
|
581
|
+
target,
|
|
582
|
+
completed,
|
|
583
|
+
remaining: Math.max(0, target - completed),
|
|
584
|
+
isComplete: completed >= target
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
|
|
423
588
|
// src/query/index.ts
|
|
424
589
|
var queryKeys = {
|
|
425
590
|
// -------------------------------------------------------------------------
|
|
@@ -939,14 +1104,20 @@ function formatTimeLocalized(date, format = "short") {
|
|
|
939
1104
|
CURRENCIES,
|
|
940
1105
|
CURRENCY_NAMES,
|
|
941
1106
|
CURRENCY_SYMBOLS,
|
|
1107
|
+
DAY_OPTIONS,
|
|
942
1108
|
DEFAULT_FOCUS_DURATIONS,
|
|
943
1109
|
FOCUS_STATUS,
|
|
944
1110
|
FREQUENCIES,
|
|
945
1111
|
FREQUENCY_LABELS,
|
|
946
1112
|
FREQUENCY_MULTIPLIERS,
|
|
1113
|
+
FREQUENCY_OPTIONS,
|
|
1114
|
+
HEALTH_FREQUENCY_LABELS,
|
|
1115
|
+
HEALTH_FREQUENCY_TYPES,
|
|
947
1116
|
LINEAR_PRIORITIES,
|
|
948
1117
|
LINEAR_PRIORITY_COLORS,
|
|
949
1118
|
LINEAR_PRIORITY_LABELS,
|
|
1119
|
+
PRESET_COLORS,
|
|
1120
|
+
PRESET_ICONS,
|
|
950
1121
|
SETTING_KEYS,
|
|
951
1122
|
activeSessionAtom,
|
|
952
1123
|
addDays,
|
|
@@ -956,6 +1127,7 @@ function formatTimeLocalized(date, format = "short") {
|
|
|
956
1127
|
calculateMonthlyIncome,
|
|
957
1128
|
calculateMonthlySavings,
|
|
958
1129
|
calculateSavingsRate,
|
|
1130
|
+
calculateWeeklyProgress,
|
|
959
1131
|
elapsedSecondsAtom,
|
|
960
1132
|
formatCurrency,
|
|
961
1133
|
formatDate,
|
|
@@ -984,6 +1156,7 @@ function formatTimeLocalized(date, format = "short") {
|
|
|
984
1156
|
generateRandomColor,
|
|
985
1157
|
generateShortId,
|
|
986
1158
|
getEndOfDayISO,
|
|
1159
|
+
getFrequencyDescription,
|
|
987
1160
|
getNextWeek,
|
|
988
1161
|
getPreviousWeek,
|
|
989
1162
|
getRepoName,
|
|
@@ -1007,11 +1180,15 @@ function formatTimeLocalized(date, format = "short") {
|
|
|
1007
1180
|
isValidISODate,
|
|
1008
1181
|
isValidUrl,
|
|
1009
1182
|
normalizeToMidnight,
|
|
1183
|
+
parseFrequencyConfig,
|
|
1010
1184
|
parseLocalDate,
|
|
1011
1185
|
progressAtom,
|
|
1012
1186
|
progressPercentAtom,
|
|
1013
1187
|
queryKeys,
|
|
1014
1188
|
remainingSecondsAtom,
|
|
1189
|
+
shouldDoOnDate,
|
|
1190
|
+
shouldDoToday,
|
|
1191
|
+
stringifyFrequencyConfig,
|
|
1015
1192
|
subtractDays,
|
|
1016
1193
|
targetSecondsAtom,
|
|
1017
1194
|
timerStatusAtom,
|