@mrck-labs/vanaheim-shared 0.3.0 → 0.4.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.
- package/dist/{database-3Vv5PNDa.d.mts → database-koVAareN.d.mts} +150 -1
- package/dist/{database-3Vv5PNDa.d.ts → database-koVAareN.d.ts} +150 -1
- package/dist/date/index.d.mts +26 -3
- package/dist/date/index.d.ts +26 -3
- package/dist/date/index.js +63 -6
- package/dist/date/index.js.map +1 -1
- package/dist/date/index.mjs +59 -6
- package/dist/date/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +151 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +147 -6
- package/dist/index.mjs.map +1 -1
- package/dist/query/index.d.mts +95 -0
- package/dist/query/index.d.ts +95 -0
- package/dist/query/index.js +88 -0
- package/dist/query/index.js.map +1 -1
- package/dist/query/index.mjs +88 -0
- package/dist/query/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 +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -54,6 +54,7 @@ __export(src_exports, {
|
|
|
54
54
|
elapsedSecondsAtom: () => elapsedSecondsAtom,
|
|
55
55
|
formatCurrency: () => formatCurrency,
|
|
56
56
|
formatDate: () => formatDate,
|
|
57
|
+
formatDateDisplay: () => formatDateDisplay,
|
|
57
58
|
formatDateHeader: () => formatDateHeader,
|
|
58
59
|
formatDateLocalized: () => formatDateLocalized,
|
|
59
60
|
formatDateLong: () => formatDateLong,
|
|
@@ -70,6 +71,7 @@ __export(src_exports, {
|
|
|
70
71
|
formatTime: () => formatTime,
|
|
71
72
|
formatTimeHHMM: () => formatTimeHHMM,
|
|
72
73
|
formatTimeLocalized: () => formatTimeLocalized,
|
|
74
|
+
formatTimeShort: () => formatTimeShort,
|
|
73
75
|
formatTimeWithSeconds: () => formatTimeWithSeconds,
|
|
74
76
|
formatTotalTime: () => formatTotalTime,
|
|
75
77
|
formatWeekRange: () => formatWeekRange,
|
|
@@ -87,6 +89,8 @@ __export(src_exports, {
|
|
|
87
89
|
getTodayMidnight: () => getTodayMidnight,
|
|
88
90
|
getTodayString: () => getTodayString,
|
|
89
91
|
getTomorrowString: () => getTomorrowString,
|
|
92
|
+
getWeekDates: () => getWeekDates,
|
|
93
|
+
getWeekDatesAsObjects: () => getWeekDatesAsObjects,
|
|
90
94
|
getWeekEnd: () => getWeekEnd,
|
|
91
95
|
getWeekEndString: () => getWeekEndString,
|
|
92
96
|
getWeekStart: () => getWeekStart,
|
|
@@ -811,6 +815,94 @@ var queryKeys = {
|
|
|
811
815
|
all: ["linear"],
|
|
812
816
|
issues: (filters) => [...queryKeys.linear.all, "issues", filters],
|
|
813
817
|
projects: () => [...queryKeys.linear.all, "projects"]
|
|
818
|
+
},
|
|
819
|
+
// -------------------------------------------------------------------------
|
|
820
|
+
// Nutrition Module
|
|
821
|
+
// -------------------------------------------------------------------------
|
|
822
|
+
ingredients: {
|
|
823
|
+
all: ["ingredients"],
|
|
824
|
+
lists: () => [...queryKeys.ingredients.all, "list"],
|
|
825
|
+
list: (filters) => [...queryKeys.ingredients.lists(), filters],
|
|
826
|
+
detail: (id) => [...queryKeys.ingredients.all, "detail", id]
|
|
827
|
+
},
|
|
828
|
+
recipes: {
|
|
829
|
+
all: ["recipes"],
|
|
830
|
+
lists: () => [...queryKeys.recipes.all, "list"],
|
|
831
|
+
list: (filters) => [...queryKeys.recipes.lists(), filters],
|
|
832
|
+
detail: (id) => [...queryKeys.recipes.all, "detail", id]
|
|
833
|
+
},
|
|
834
|
+
foodLogs: {
|
|
835
|
+
all: ["foodLogs"],
|
|
836
|
+
lists: () => [...queryKeys.foodLogs.all, "list"],
|
|
837
|
+
list: (filters) => [...queryKeys.foodLogs.lists(), filters],
|
|
838
|
+
forDate: (date) => [...queryKeys.foodLogs.all, "date", date]
|
|
839
|
+
},
|
|
840
|
+
nutritionGoals: {
|
|
841
|
+
all: ["nutritionGoals"],
|
|
842
|
+
active: () => [...queryKeys.nutritionGoals.all, "active"]
|
|
843
|
+
},
|
|
844
|
+
nutritionStats: {
|
|
845
|
+
all: ["nutritionStats"],
|
|
846
|
+
forDate: (date) => [...queryKeys.nutritionStats.all, date]
|
|
847
|
+
},
|
|
848
|
+
// -------------------------------------------------------------------------
|
|
849
|
+
// Planning Module - Daily Plans
|
|
850
|
+
// -------------------------------------------------------------------------
|
|
851
|
+
dailyPlans: {
|
|
852
|
+
all: ["dailyPlans"],
|
|
853
|
+
forDate: (date) => [...queryKeys.dailyPlans.all, date],
|
|
854
|
+
forRange: (startDate, endDate) => [...queryKeys.dailyPlans.all, "range", startDate, endDate]
|
|
855
|
+
},
|
|
856
|
+
// -------------------------------------------------------------------------
|
|
857
|
+
// Planning Module - Meal Plans
|
|
858
|
+
// -------------------------------------------------------------------------
|
|
859
|
+
mealPlans: {
|
|
860
|
+
all: ["mealPlans"],
|
|
861
|
+
lists: () => [...queryKeys.mealPlans.all, "list"],
|
|
862
|
+
forDate: (date) => [...queryKeys.mealPlans.all, "date", date],
|
|
863
|
+
forRange: (startDate, endDate) => [...queryKeys.mealPlans.all, "range", startDate, endDate],
|
|
864
|
+
detail: (id) => [...queryKeys.mealPlans.all, "detail", id]
|
|
865
|
+
},
|
|
866
|
+
// -------------------------------------------------------------------------
|
|
867
|
+
// Planning Module - Prep Sessions
|
|
868
|
+
// -------------------------------------------------------------------------
|
|
869
|
+
prepSessions: {
|
|
870
|
+
all: ["prepSessions"],
|
|
871
|
+
lists: () => [...queryKeys.prepSessions.all, "list"],
|
|
872
|
+
forDate: (date) => [...queryKeys.prepSessions.all, "date", date],
|
|
873
|
+
forRange: (startDate, endDate) => [...queryKeys.prepSessions.all, "range", startDate, endDate],
|
|
874
|
+
detail: (id) => [...queryKeys.prepSessions.all, "detail", id]
|
|
875
|
+
},
|
|
876
|
+
// -------------------------------------------------------------------------
|
|
877
|
+
// Planning Module - Grocery List
|
|
878
|
+
// -------------------------------------------------------------------------
|
|
879
|
+
groceryList: {
|
|
880
|
+
all: ["groceryList"],
|
|
881
|
+
forWeek: (weekStart, weekEnd) => [...queryKeys.groceryList.all, weekStart, weekEnd]
|
|
882
|
+
},
|
|
883
|
+
// -------------------------------------------------------------------------
|
|
884
|
+
// Planning Module - Weekly Plans
|
|
885
|
+
// -------------------------------------------------------------------------
|
|
886
|
+
weeklyPlans: {
|
|
887
|
+
all: ["weeklyPlans"],
|
|
888
|
+
forWeek: (weekStart) => [...queryKeys.weeklyPlans.all, weekStart],
|
|
889
|
+
forRange: (startWeek, endWeek) => [...queryKeys.weeklyPlans.all, "range", startWeek, endWeek]
|
|
890
|
+
},
|
|
891
|
+
// -------------------------------------------------------------------------
|
|
892
|
+
// Planning Module - Notes
|
|
893
|
+
// -------------------------------------------------------------------------
|
|
894
|
+
noteFolders: {
|
|
895
|
+
all: ["noteFolders"],
|
|
896
|
+
list: () => [...queryKeys.noteFolders.all, "list"],
|
|
897
|
+
detail: (id) => [...queryKeys.noteFolders.all, "detail", id]
|
|
898
|
+
},
|
|
899
|
+
notes: {
|
|
900
|
+
all: ["notes"],
|
|
901
|
+
lists: () => [...queryKeys.notes.all, "list"],
|
|
902
|
+
list: (filters) => [...queryKeys.notes.lists(), filters],
|
|
903
|
+
detail: (id) => [...queryKeys.notes.all, "detail", id],
|
|
904
|
+
pinned: () => [...queryKeys.notes.all, "pinned"],
|
|
905
|
+
recent: () => [...queryKeys.notes.all, "recent"]
|
|
814
906
|
}
|
|
815
907
|
};
|
|
816
908
|
|
|
@@ -851,7 +943,10 @@ function getTodayMidnight() {
|
|
|
851
943
|
return normalizeToMidnight(/* @__PURE__ */ new Date());
|
|
852
944
|
}
|
|
853
945
|
function formatDateString(date) {
|
|
854
|
-
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(
|
|
946
|
+
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(
|
|
947
|
+
2,
|
|
948
|
+
"0"
|
|
949
|
+
)}-${String(date.getDate()).padStart(2, "0")}`;
|
|
855
950
|
}
|
|
856
951
|
function getTodayString() {
|
|
857
952
|
return formatDateString(/* @__PURE__ */ new Date());
|
|
@@ -892,7 +987,11 @@ function getTomorrowString() {
|
|
|
892
987
|
}
|
|
893
988
|
function getStartOfDayISO(dateStr) {
|
|
894
989
|
const date = parseLocalDate(dateStr);
|
|
895
|
-
return new Date(
|
|
990
|
+
return new Date(
|
|
991
|
+
date.getFullYear(),
|
|
992
|
+
date.getMonth(),
|
|
993
|
+
date.getDate()
|
|
994
|
+
).toISOString();
|
|
896
995
|
}
|
|
897
996
|
function getEndOfDayISO(dateStr) {
|
|
898
997
|
const date = parseLocalDate(dateStr);
|
|
@@ -935,6 +1034,22 @@ function getWeekStartString(baseDate = /* @__PURE__ */ new Date()) {
|
|
|
935
1034
|
function getWeekEndString(baseDate = /* @__PURE__ */ new Date()) {
|
|
936
1035
|
return formatDateString(getWeekEnd(getWeekStart(baseDate)));
|
|
937
1036
|
}
|
|
1037
|
+
function getWeekDates(weekStart) {
|
|
1038
|
+
const dates = [];
|
|
1039
|
+
for (let i = 0; i < 7; i++) {
|
|
1040
|
+
dates.push(addDays(weekStart, i));
|
|
1041
|
+
}
|
|
1042
|
+
return dates;
|
|
1043
|
+
}
|
|
1044
|
+
function getWeekDatesAsObjects(weekStart) {
|
|
1045
|
+
const dates = [];
|
|
1046
|
+
for (let i = 0; i < 7; i++) {
|
|
1047
|
+
const day = new Date(weekStart);
|
|
1048
|
+
day.setDate(day.getDate() + i);
|
|
1049
|
+
dates.push(day);
|
|
1050
|
+
}
|
|
1051
|
+
return dates;
|
|
1052
|
+
}
|
|
938
1053
|
function formatWeekRange(weekStart) {
|
|
939
1054
|
const weekEnd = getWeekEnd(weekStart);
|
|
940
1055
|
const startMonth = weekStart.toLocaleDateString("en-US", { month: "short" });
|
|
@@ -971,9 +1086,24 @@ function formatTimeHHMM(date) {
|
|
|
971
1086
|
const d = typeof date === "string" ? new Date(date) : date;
|
|
972
1087
|
return d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
973
1088
|
}
|
|
1089
|
+
function formatTimeShort(date) {
|
|
1090
|
+
const d = typeof date === "string" ? new Date(date) : date;
|
|
1091
|
+
return d.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
|
|
1092
|
+
}
|
|
1093
|
+
function formatDateDisplay(date) {
|
|
1094
|
+
return date.toLocaleDateString("en-US", {
|
|
1095
|
+
weekday: "long",
|
|
1096
|
+
month: "short",
|
|
1097
|
+
day: "numeric"
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
974
1100
|
function formatTimeWithSeconds(date) {
|
|
975
1101
|
const d = typeof date === "string" ? new Date(date) : date;
|
|
976
|
-
return d.toLocaleTimeString([], {
|
|
1102
|
+
return d.toLocaleTimeString([], {
|
|
1103
|
+
hour: "2-digit",
|
|
1104
|
+
minute: "2-digit",
|
|
1105
|
+
second: "2-digit"
|
|
1106
|
+
});
|
|
977
1107
|
}
|
|
978
1108
|
function formatDateHeader(dateStr) {
|
|
979
1109
|
const today = getTodayString();
|
|
@@ -1000,7 +1130,10 @@ function formatDueDateString(dateStr) {
|
|
|
1000
1130
|
const tomorrowStr = getTomorrowString();
|
|
1001
1131
|
if (dateStr < today) {
|
|
1002
1132
|
const date2 = parseLocalDate(dateStr);
|
|
1003
|
-
return `Overdue \u2022 ${date2.toLocaleDateString("en-US", {
|
|
1133
|
+
return `Overdue \u2022 ${date2.toLocaleDateString("en-US", {
|
|
1134
|
+
month: "short",
|
|
1135
|
+
day: "numeric"
|
|
1136
|
+
})}`;
|
|
1004
1137
|
}
|
|
1005
1138
|
if (dateStr === today) {
|
|
1006
1139
|
return "Today";
|
|
@@ -1065,7 +1198,11 @@ function formatDateLocalized(date, format = "medium") {
|
|
|
1065
1198
|
case "short":
|
|
1066
1199
|
return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
1067
1200
|
case "medium":
|
|
1068
|
-
return d.toLocaleDateString("en-US", {
|
|
1201
|
+
return d.toLocaleDateString("en-US", {
|
|
1202
|
+
month: "short",
|
|
1203
|
+
day: "numeric",
|
|
1204
|
+
year: "numeric"
|
|
1205
|
+
});
|
|
1069
1206
|
case "long":
|
|
1070
1207
|
return d.toLocaleDateString("en-US", {
|
|
1071
1208
|
weekday: "long",
|
|
@@ -1083,7 +1220,11 @@ function formatTimeLocalized(date, format = "short") {
|
|
|
1083
1220
|
const d = typeof date === "string" ? new Date(date) : date;
|
|
1084
1221
|
switch (format) {
|
|
1085
1222
|
case "short":
|
|
1086
|
-
return d.toLocaleTimeString("en-US", {
|
|
1223
|
+
return d.toLocaleTimeString("en-US", {
|
|
1224
|
+
hour: "2-digit",
|
|
1225
|
+
minute: "2-digit",
|
|
1226
|
+
hour12: true
|
|
1227
|
+
});
|
|
1087
1228
|
case "withSeconds":
|
|
1088
1229
|
return d.toLocaleTimeString("en-US", {
|
|
1089
1230
|
hour: "2-digit",
|
|
@@ -1131,6 +1272,7 @@ function formatTimeLocalized(date, format = "short") {
|
|
|
1131
1272
|
elapsedSecondsAtom,
|
|
1132
1273
|
formatCurrency,
|
|
1133
1274
|
formatDate,
|
|
1275
|
+
formatDateDisplay,
|
|
1134
1276
|
formatDateHeader,
|
|
1135
1277
|
formatDateLocalized,
|
|
1136
1278
|
formatDateLong,
|
|
@@ -1147,6 +1289,7 @@ function formatTimeLocalized(date, format = "short") {
|
|
|
1147
1289
|
formatTime,
|
|
1148
1290
|
formatTimeHHMM,
|
|
1149
1291
|
formatTimeLocalized,
|
|
1292
|
+
formatTimeShort,
|
|
1150
1293
|
formatTimeWithSeconds,
|
|
1151
1294
|
formatTotalTime,
|
|
1152
1295
|
formatWeekRange,
|
|
@@ -1164,6 +1307,8 @@ function formatTimeLocalized(date, format = "short") {
|
|
|
1164
1307
|
getTodayMidnight,
|
|
1165
1308
|
getTodayString,
|
|
1166
1309
|
getTomorrowString,
|
|
1310
|
+
getWeekDates,
|
|
1311
|
+
getWeekDatesAsObjects,
|
|
1167
1312
|
getWeekEnd,
|
|
1168
1313
|
getWeekEndString,
|
|
1169
1314
|
getWeekStart,
|