@alphakits/ui 2.0.3 → 2.0.4
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Small date helpers (local timezone), replacing date-fns for bundle size. */
|
|
2
|
-
export declare function startOfMonth(d: Date): Date;
|
|
3
|
-
export declare function startOfYear(d: Date): Date;
|
|
4
|
-
export declare function endOfYear(d: Date): Date;
|
|
5
|
-
export declare function lastDayOfMonth(d: Date): Date;
|
|
2
|
+
export declare function startOfMonth(d: Date | number): Date;
|
|
3
|
+
export declare function startOfYear(d: Date | number): Date;
|
|
4
|
+
export declare function endOfYear(d: Date | number): Date;
|
|
5
|
+
export declare function lastDayOfMonth(d: Date | number): Date;
|
|
6
6
|
export declare function startOfDay(d: Date | number): Date;
|
|
7
7
|
export declare function endOfDay(d: Date | number): Date;
|
|
8
8
|
/** Monday 00:00 of the ISO week containing `d`. */
|
|
@@ -62,8 +62,8 @@ type FormatOptions = {
|
|
|
62
62
|
locale?: string;
|
|
63
63
|
};
|
|
64
64
|
/**
|
|
65
|
-
* Subset of date-fns `format` tokens: yyyy, yy, MM, dd, HH, mm, MMM, MMMM.
|
|
66
|
-
* Longer tokens first
|
|
65
|
+
* Subset of date-fns `format` tokens: yyyy, yy, MM, dd, HH, mm, MMM, MMMM, LLL, LLLL.
|
|
66
|
+
* Longer tokens first (`LLLL` before `LLL`, `MMMM` before `MM`).
|
|
67
67
|
*/
|
|
68
68
|
export declare function format(d: Date, pattern: string, options?: FormatOptions): string;
|
|
69
69
|
/**
|
package/dist/utils/date/index.js
CHANGED
|
@@ -1,169 +1,180 @@
|
|
|
1
1
|
const i = (t) => String(t).padStart(2, "0");
|
|
2
|
-
function l(t) {
|
|
3
|
-
return new Date(t.getFullYear(), t.getMonth(), 1, 0, 0, 0, 0);
|
|
4
|
-
}
|
|
5
2
|
function D(t) {
|
|
6
|
-
|
|
3
|
+
const e = new Date(t);
|
|
4
|
+
return new Date(e.getFullYear(), e.getMonth(), 1, 0, 0, 0, 0);
|
|
5
|
+
}
|
|
6
|
+
function l(t) {
|
|
7
|
+
const e = new Date(t);
|
|
8
|
+
return new Date(e.getFullYear(), 0, 1, 0, 0, 0, 0);
|
|
7
9
|
}
|
|
8
10
|
function W(t) {
|
|
9
|
-
|
|
11
|
+
const e = new Date(t);
|
|
12
|
+
return new Date(e.getFullYear(), 11, 31, 23, 59, 59, 999);
|
|
10
13
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
14
|
+
function N(t) {
|
|
15
|
+
const e = new Date(t);
|
|
16
|
+
return new Date(e.getFullYear(), e.getMonth() + 1, 0, 0, 0, 0, 0);
|
|
13
17
|
}
|
|
14
18
|
function y(t) {
|
|
15
19
|
const e = new Date(t);
|
|
16
20
|
return new Date(e.getFullYear(), e.getMonth(), e.getDate(), 0, 0, 0, 0);
|
|
17
21
|
}
|
|
18
|
-
function
|
|
22
|
+
function w(t) {
|
|
19
23
|
const e = new Date(t);
|
|
20
24
|
return new Date(e.getFullYear(), e.getMonth(), e.getDate(), 23, 59, 59, 999);
|
|
21
25
|
}
|
|
22
|
-
function
|
|
26
|
+
function b(t) {
|
|
23
27
|
const e = new Date(t.getFullYear(), t.getMonth(), t.getDate()), n = e.getDay(), r = n === 0 ? -6 : 1 - n;
|
|
24
28
|
return e.setDate(e.getDate() + r), new Date(e.getFullYear(), e.getMonth(), e.getDate(), 0, 0, 0, 0);
|
|
25
29
|
}
|
|
26
|
-
function
|
|
27
|
-
return
|
|
30
|
+
function P(t) {
|
|
31
|
+
return w(c(b(t), 6));
|
|
28
32
|
}
|
|
29
|
-
function
|
|
33
|
+
function x(t, e) {
|
|
30
34
|
var u;
|
|
31
35
|
const n = (u = e == null ? void 0 : e.weekStartsOn) != null ? u : 0, r = new Date(t.getFullYear(), t.getMonth(), t.getDate()), o = (r.getDay() - n + 7) % 7;
|
|
32
36
|
return r.setDate(r.getDate() - o), new Date(r.getFullYear(), r.getMonth(), r.getDate(), 0, 0, 0, 0);
|
|
33
37
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
38
|
+
function A(t, e) {
|
|
39
|
+
return w(c(x(t, e), 6));
|
|
36
40
|
}
|
|
37
41
|
function c(t, e) {
|
|
38
42
|
const n = new Date(t);
|
|
39
43
|
return n.setDate(n.getDate() + e), n;
|
|
40
44
|
}
|
|
41
|
-
function
|
|
45
|
+
function B(t, e) {
|
|
42
46
|
return c(t, -e);
|
|
43
47
|
}
|
|
44
|
-
function
|
|
48
|
+
function S(t, e) {
|
|
45
49
|
return new Date(t, e + 1, 0).getDate();
|
|
46
50
|
}
|
|
47
51
|
function f(t, e) {
|
|
48
|
-
const n = t.getDate(), r = t.getFullYear(), a = t.getMonth() + e, o = Math.min(n,
|
|
52
|
+
const n = t.getDate(), r = t.getFullYear(), a = t.getMonth() + e, o = Math.min(n, S(r, a));
|
|
49
53
|
return new Date(r, a, o, t.getHours(), t.getMinutes(), t.getSeconds(), t.getMilliseconds());
|
|
50
54
|
}
|
|
51
|
-
function
|
|
55
|
+
function E(t, e) {
|
|
52
56
|
return f(t, -e);
|
|
53
57
|
}
|
|
54
|
-
function
|
|
58
|
+
function Y(t, e) {
|
|
55
59
|
return f(t, e * 12);
|
|
56
60
|
}
|
|
57
61
|
function _(t, e) {
|
|
58
|
-
return
|
|
62
|
+
return Y(t, -e);
|
|
59
63
|
}
|
|
60
64
|
function q(t, e) {
|
|
61
65
|
let n = t;
|
|
62
|
-
return e.years && (n =
|
|
66
|
+
return e.years && (n = Y(n, e.years)), e.months && (n = f(n, e.months)), e.weeks && (n = c(n, 7 * e.weeks)), e.days && (n = c(n, e.days)), n;
|
|
63
67
|
}
|
|
64
68
|
function G(t, e) {
|
|
65
69
|
return c(t, -7 * e);
|
|
66
70
|
}
|
|
67
|
-
function
|
|
71
|
+
function R(t) {
|
|
68
72
|
const e = y(t.start).getTime(), n = y(t.end).getTime(), [r, a] = e <= n ? [e, n] : [n, e], o = [];
|
|
69
73
|
for (let u = r; u <= a; u += 864e5)
|
|
70
74
|
o.push(new Date(u));
|
|
71
75
|
return o;
|
|
72
76
|
}
|
|
73
|
-
function
|
|
74
|
-
let e =
|
|
75
|
-
const n =
|
|
77
|
+
function $(t) {
|
|
78
|
+
let e = D(t.start);
|
|
79
|
+
const n = D(t.end);
|
|
76
80
|
if (e > n) return [];
|
|
77
81
|
const r = [];
|
|
78
82
|
for (; e <= n; )
|
|
79
83
|
r.push(new Date(e)), e = f(e, 1);
|
|
80
84
|
return r;
|
|
81
85
|
}
|
|
82
|
-
function
|
|
83
|
-
const e =
|
|
86
|
+
function j(t) {
|
|
87
|
+
const e = l(t.start).getFullYear(), n = l(t.end).getFullYear(), r = Math.min(e, n), a = Math.max(e, n), o = [];
|
|
84
88
|
for (let u = r; u <= a; u += 1)
|
|
85
89
|
o.push(new Date(u, 0, 1));
|
|
86
90
|
return o;
|
|
87
91
|
}
|
|
88
|
-
function
|
|
92
|
+
function k(t, e) {
|
|
89
93
|
return t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth() && t.getDate() === e.getDate();
|
|
90
94
|
}
|
|
91
|
-
function
|
|
95
|
+
function I(t, e) {
|
|
92
96
|
return t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth();
|
|
93
97
|
}
|
|
94
|
-
function
|
|
98
|
+
function p(t, e) {
|
|
95
99
|
return t.getFullYear() === e.getFullYear();
|
|
96
100
|
}
|
|
97
|
-
function
|
|
101
|
+
function z(t, e) {
|
|
98
102
|
return t.getTime() < e.getTime();
|
|
99
103
|
}
|
|
100
|
-
function
|
|
104
|
+
function C(t, e) {
|
|
101
105
|
return t.getTime() > e.getTime();
|
|
102
106
|
}
|
|
103
|
-
function
|
|
107
|
+
function J(t) {
|
|
104
108
|
return new Date(Math.max(...t.map((e) => new Date(e).getTime())));
|
|
105
109
|
}
|
|
106
|
-
function
|
|
110
|
+
function K(t) {
|
|
107
111
|
return new Date(Math.min(...t.map((e) => new Date(e).getTime())));
|
|
108
112
|
}
|
|
109
|
-
function
|
|
113
|
+
function Q(t, e) {
|
|
110
114
|
return new Date(t).getTime() === new Date(e).getTime();
|
|
111
115
|
}
|
|
112
|
-
function
|
|
113
|
-
return t.getDate() ===
|
|
116
|
+
function U(t) {
|
|
117
|
+
return t.getDate() === N(t).getDate();
|
|
114
118
|
}
|
|
115
|
-
function
|
|
119
|
+
function V(t, e) {
|
|
116
120
|
const n = t.getTime();
|
|
117
121
|
return n >= e.start.getTime() && n <= e.end.getTime();
|
|
118
122
|
}
|
|
119
|
-
function V(t) {
|
|
120
|
-
return S(t, /* @__PURE__ */ new Date());
|
|
121
|
-
}
|
|
122
123
|
function X(t) {
|
|
123
|
-
return
|
|
124
|
+
return k(t, /* @__PURE__ */ new Date());
|
|
124
125
|
}
|
|
125
126
|
function Z(t) {
|
|
126
|
-
return
|
|
127
|
+
return I(t, /* @__PURE__ */ new Date());
|
|
127
128
|
}
|
|
128
129
|
function v(t) {
|
|
129
|
-
return new Date(
|
|
130
|
+
return p(t, /* @__PURE__ */ new Date());
|
|
130
131
|
}
|
|
131
132
|
function tt(t) {
|
|
133
|
+
return new Date(t);
|
|
134
|
+
}
|
|
135
|
+
function et(t) {
|
|
132
136
|
const e = new Date(2021, 5, 7, 12, 0, 0, 0);
|
|
133
137
|
return Array.from(
|
|
134
138
|
{ length: 7 },
|
|
135
139
|
(n, r) => new Intl.DateTimeFormat(t, { weekday: "short" }).format(c(e, r))
|
|
136
140
|
);
|
|
137
141
|
}
|
|
142
|
+
function h(t, e, n) {
|
|
143
|
+
var o;
|
|
144
|
+
const a = (o = new Intl.DateTimeFormat(e, { day: "numeric", month: n }).formatToParts(t).find((u) => u.type === "month")) == null ? void 0 : o.value;
|
|
145
|
+
return a != null ? a : new Intl.DateTimeFormat(e, { month: n }).format(t);
|
|
146
|
+
}
|
|
138
147
|
function M(t, e, n) {
|
|
139
148
|
return new Intl.DateTimeFormat(e, { month: n }).format(t);
|
|
140
149
|
}
|
|
141
|
-
function
|
|
150
|
+
function nt(t, e, n) {
|
|
142
151
|
var m;
|
|
143
|
-
const r = (m = n == null ? void 0 : n.locale) != null ? m : "en-GB", a = t.getFullYear(), o = t.getMonth(), u = t.getDate(), s = t.getHours(),
|
|
152
|
+
const r = (m = n == null ? void 0 : n.locale) != null ? m : "en-GB", a = t.getFullYear(), o = t.getMonth(), u = t.getDate(), s = t.getHours(), d = t.getMinutes(), F = [
|
|
144
153
|
[/yyyy/g, () => String(a)],
|
|
145
|
-
[/
|
|
146
|
-
[/
|
|
154
|
+
[/LLLL/g, () => M(t, r, "long")],
|
|
155
|
+
[/MMMM/g, () => h(t, r, "long")],
|
|
156
|
+
[/LLL/g, () => M(t, r, "short")],
|
|
157
|
+
[/MMM/g, () => h(t, r, "short")],
|
|
147
158
|
[/MM/g, () => i(o + 1)],
|
|
148
159
|
[/dd/g, () => i(u)],
|
|
149
160
|
[/HH/g, () => i(s)],
|
|
150
|
-
[/mm/g, () => i(
|
|
161
|
+
[/mm/g, () => i(d)],
|
|
151
162
|
[/yy/g, () => i(a % 100)]
|
|
152
163
|
];
|
|
153
164
|
let g = e;
|
|
154
|
-
return
|
|
155
|
-
g = g.replace(
|
|
165
|
+
return F.forEach(([T, O]) => {
|
|
166
|
+
g = g.replace(T, O);
|
|
156
167
|
}), g;
|
|
157
168
|
}
|
|
158
|
-
function
|
|
169
|
+
function H(t, e) {
|
|
159
170
|
if (!e) return;
|
|
160
171
|
const [n, r] = e.split(":").map((a) => Number(a));
|
|
161
172
|
t.setHours(Number.isFinite(n) ? n : 0, Number.isFinite(r) ? r : 0, 0, 0);
|
|
162
173
|
}
|
|
163
|
-
function
|
|
174
|
+
function L(t, e, n) {
|
|
164
175
|
if (e === "yyyy-MM-dd HH:mm" || e === "dd.MM.yyyy HH:mm") {
|
|
165
|
-
const [a, o] = t.trim().split(/\s+/), u = e.replace(/\s+HH:mm$/, ""), s =
|
|
166
|
-
return
|
|
176
|
+
const [a, o] = t.trim().split(/\s+/), u = e.replace(/\s+HH:mm$/, ""), s = L(a, u);
|
|
177
|
+
return H(s, o), s;
|
|
167
178
|
}
|
|
168
179
|
if (e === "yyyy-MM-dd") {
|
|
169
180
|
const [a, o, u] = t.split("-");
|
|
@@ -185,40 +196,40 @@ export {
|
|
|
185
196
|
q as add,
|
|
186
197
|
c as addDays,
|
|
187
198
|
f as addMonths,
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
199
|
+
Y as addYears,
|
|
200
|
+
R as eachDayOfInterval,
|
|
201
|
+
$ as eachMonthOfInterval,
|
|
202
|
+
j as eachYearOfInterval,
|
|
203
|
+
w as endOfDay,
|
|
204
|
+
P as endOfISOWeek,
|
|
205
|
+
A as endOfWeek,
|
|
195
206
|
W as endOfYear,
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
207
|
+
nt as format,
|
|
208
|
+
C as isAfter,
|
|
209
|
+
z as isBefore,
|
|
210
|
+
Q as isEqual,
|
|
211
|
+
U as isLastDayOfMonth,
|
|
212
|
+
k as isSameDay,
|
|
213
|
+
I as isSameMonth,
|
|
214
|
+
p as isSameYear,
|
|
215
|
+
Z as isThisMonth,
|
|
216
|
+
v as isThisYear,
|
|
217
|
+
X as isToday,
|
|
218
|
+
V as isWithinInterval,
|
|
219
|
+
N as lastDayOfMonth,
|
|
220
|
+
J as max,
|
|
221
|
+
K as min,
|
|
222
|
+
L as parse,
|
|
223
|
+
tt as parseISO,
|
|
213
224
|
y as startOfDay,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
225
|
+
b as startOfISOWeek,
|
|
226
|
+
D as startOfMonth,
|
|
227
|
+
x as startOfWeek,
|
|
228
|
+
l as startOfYear,
|
|
229
|
+
B as subDays,
|
|
230
|
+
E as subMonths,
|
|
220
231
|
G as subWeeks,
|
|
221
232
|
_ as subYears,
|
|
222
|
-
|
|
233
|
+
et as weekDaysShort
|
|
223
234
|
};
|
|
224
235
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/utils/date/index.ts"],"sourcesContent":["/** Small date helpers (local timezone), replacing date-fns for bundle size. */\n\nconst pad2 = (n: number) => String(n).padStart(2, '0');\n\nexport function startOfMonth(d: Date): Date {\n return new Date(d.getFullYear(), d.getMonth(), 1, 0, 0, 0, 0);\n}\n\nexport function startOfYear(d: Date): Date {\n return new Date(d.getFullYear(), 0, 1, 0, 0, 0, 0);\n}\n\nexport function endOfYear(d: Date): Date {\n return new Date(d.getFullYear(), 11, 31, 23, 59, 59, 999);\n}\n\nexport function lastDayOfMonth(d: Date): Date {\n return new Date(d.getFullYear(), d.getMonth() + 1, 0, 0, 0, 0, 0);\n}\n\nexport function startOfDay(d: Date | number): Date {\n const x = new Date(d);\n\n return new Date(x.getFullYear(), x.getMonth(), x.getDate(), 0, 0, 0, 0);\n}\n\nexport function endOfDay(d: Date | number): Date {\n const x = new Date(d);\n\n return new Date(x.getFullYear(), x.getMonth(), x.getDate(), 23, 59, 59, 999);\n}\n\n/** Monday 00:00 of the ISO week containing `d`. */\nexport function startOfISOWeek(d: Date): Date {\n const x = new Date(d.getFullYear(), d.getMonth(), d.getDate());\n const day = x.getDay();\n const diffToMonday = day === 0 ? -6 : 1 - day;\n\n x.setDate(x.getDate() + diffToMonday);\n\n return new Date(x.getFullYear(), x.getMonth(), x.getDate(), 0, 0, 0, 0);\n}\n\nexport function endOfISOWeek(d: Date): Date {\n return endOfDay(addDays(startOfISOWeek(d), 6));\n}\n\nexport function startOfWeek(d: Date, options?: { weekStartsOn?: number }): Date {\n const weekStartsOn = options?.weekStartsOn ?? 0;\n const x = new Date(d.getFullYear(), d.getMonth(), d.getDate());\n const day = x.getDay();\n const diff = (day - weekStartsOn + 7) % 7;\n\n x.setDate(x.getDate() - diff);\n\n return new Date(x.getFullYear(), x.getMonth(), x.getDate(), 0, 0, 0, 0);\n}\n\nexport function endOfWeek(d: Date, options?: { weekStartsOn?: number }): Date {\n return endOfDay(addDays(startOfWeek(d, options), 6));\n}\n\nexport function addDays(d: Date, amount: number): Date {\n const x = new Date(d);\n\n x.setDate(x.getDate() + amount);\n\n return x;\n}\n\nexport function subDays(d: Date, amount: number): Date {\n return addDays(d, -amount);\n}\n\nfunction daysInMonth(year: number, month0: number): number {\n return new Date(year, month0 + 1, 0).getDate();\n}\n\nexport function addMonths(d: Date, amount: number): Date {\n const day = d.getDate();\n const y = d.getFullYear();\n const m = d.getMonth() + amount;\n const safeDay = Math.min(day, daysInMonth(y, m));\n\n return new Date(y, m, safeDay, d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds());\n}\n\nexport function subMonths(d: Date, amount: number): Date {\n return addMonths(d, -amount);\n}\n\nexport function addYears(d: Date, amount: number): Date {\n return addMonths(d, amount * 12);\n}\n\nexport function subYears(d: Date, amount: number): Date {\n return addYears(d, -amount);\n}\n\nexport function add(\n d: Date,\n duration: { years?: number; months?: number; weeks?: number; days?: number },\n): Date {\n let x = d;\n\n if (duration.years) x = addYears(x, duration.years);\n if (duration.months) x = addMonths(x, duration.months);\n if (duration.weeks) x = addDays(x, 7 * duration.weeks);\n if (duration.days) x = addDays(x, duration.days);\n\n return x;\n}\n\nexport function subWeeks(d: Date, amount: number): Date {\n return addDays(d, -7 * amount);\n}\n\nexport function eachDayOfInterval(interval: { start: Date; end: Date }): Date[] {\n const a = startOfDay(interval.start).getTime();\n const b = startOfDay(interval.end).getTime();\n const [from, to] = a <= b ? [a, b] : [b, a];\n const out: Date[] = [];\n\n for (let t = from; t <= to; t += 86400000) {\n out.push(new Date(t));\n }\n\n return out;\n}\n\nexport function eachMonthOfInterval(interval: { start: Date; end: Date }): Date[] {\n let cur = startOfMonth(interval.start);\n const last = startOfMonth(interval.end);\n\n if (cur > last) return [];\n\n const out: Date[] = [];\n\n while (cur <= last) {\n out.push(new Date(cur));\n cur = addMonths(cur, 1);\n }\n\n return out;\n}\n\nexport function eachYearOfInterval(interval: { start: Date; end: Date }): Date[] {\n const y1 = startOfYear(interval.start).getFullYear();\n const y2 = startOfYear(interval.end).getFullYear();\n const fromY = Math.min(y1, y2);\n const toY = Math.max(y1, y2);\n const out: Date[] = [];\n\n for (let yy = fromY; yy <= toY; yy += 1) {\n out.push(new Date(yy, 0, 1));\n }\n\n return out;\n}\n\nexport function isSameDay(a: Date, b: Date): boolean {\n return (\n a.getFullYear() === b.getFullYear()\n && a.getMonth() === b.getMonth()\n && a.getDate() === b.getDate()\n );\n}\n\nexport function isSameMonth(a: Date, b: Date): boolean {\n return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();\n}\n\nexport function isSameYear(a: Date, b: Date): boolean {\n return a.getFullYear() === b.getFullYear();\n}\n\nexport function isBefore(a: Date, b: Date): boolean {\n return a.getTime() < b.getTime();\n}\n\nexport function isAfter(a: Date, b: Date): boolean {\n return a.getTime() > b.getTime();\n}\n\nexport function max(dates: Array<Date | number>): Date {\n return new Date(Math.max(...dates.map((d) => new Date(d).getTime())));\n}\n\nexport function min(dates: Array<Date | number>): Date {\n return new Date(Math.min(...dates.map((d) => new Date(d).getTime())));\n}\n\nexport function isEqual(a: Date | number, b: Date | number): boolean {\n return new Date(a).getTime() === new Date(b).getTime();\n}\n\nexport function isLastDayOfMonth(d: Date): boolean {\n return d.getDate() === lastDayOfMonth(d).getDate();\n}\n\nexport function isWithinInterval(date: Date, interval: { start: Date; end: Date }): boolean {\n const t = date.getTime();\n\n return t >= interval.start.getTime() && t <= interval.end.getTime();\n}\n\nexport function isToday(d: Date): boolean {\n return isSameDay(d, new Date());\n}\n\nexport function isThisMonth(d: Date): boolean {\n return isSameMonth(d, new Date());\n}\n\nexport function isThisYear(d: Date): boolean {\n return isSameYear(d, new Date());\n}\n\nexport function parseISO(s: string): Date {\n return new Date(s);\n}\n\n/** Monday-first short weekday labels (aligned with previous date-fns `localize.day` order). */\nexport function weekDaysShort(localeTag: string): string[] {\n const refMonday = new Date(2021, 5, 7, 12, 0, 0, 0);\n\n return Array.from({ length: 7 }, (_, i) =>\n new Intl.DateTimeFormat(localeTag, { weekday: 'short' }).format(addDays(refMonday, i)),\n );\n}\n\ntype FormatOptions = { locale?: string };\n\nfunction intlMonth(d: Date, locale: string, style: 'long' | 'short'): string {\n return new Intl.DateTimeFormat(locale, { month: style }).format(d);\n}\n\n/**\n * Subset of date-fns `format` tokens: yyyy, yy, MM, dd, HH, mm, MMM, MMMM.\n * Longer tokens first so `MMMM` is not broken by `MM`.\n */\nexport function format(d: Date, pattern: string, options?: FormatOptions): string {\n const locale = options?.locale ?? 'en-GB';\n const y = d.getFullYear();\n const m = d.getMonth();\n const day = d.getDate();\n const h = d.getHours();\n const minu = d.getMinutes();\n\n const tokenReplacements: Array<[RegExp, () => string]> = [\n [/yyyy/g, () => String(y)],\n [/MMMM/g, () => intlMonth(d, locale, 'long')],\n [/MMM/g, () => intlMonth(d, locale, 'short')],\n [/MM/g, () => pad2(m + 1)],\n [/dd/g, () => pad2(day)],\n [/HH/g, () => pad2(h)],\n [/mm/g, () => pad2(minu)],\n [/yy/g, () => pad2(y % 100)],\n ];\n\n let out = pattern;\n\n tokenReplacements.forEach(([re, fn]) => {\n out = out.replace(re, fn);\n });\n\n return out;\n}\n\nfunction applyTime(d: Date, timePart: string | undefined): void {\n if (!timePart) return;\n const [hh, mm] = timePart.split(':').map((x) => Number(x));\n\n d.setHours(Number.isFinite(hh) ? hh : 0, Number.isFinite(mm) ? mm : 0, 0, 0);\n}\n\n/**\n * Parse fixed-width patterns used in the UI (local date).\n */\nexport function parse(value: string, pattern: string, _referenceDate?: Date): Date {\n if (pattern === 'yyyy-MM-dd HH:mm' || pattern === 'dd.MM.yyyy HH:mm') {\n const [datePart, timePart] = value.trim().split(/\\s+/);\n const dateOnlyPattern = pattern.replace(/\\s+HH:mm$/, '') as 'yyyy-MM-dd' | 'dd.MM.yyyy';\n const d = parse(datePart, dateOnlyPattern, _referenceDate);\n\n applyTime(d, timePart);\n\n return d;\n }\n\n if (pattern === 'yyyy-MM-dd') {\n const [ys, ms, ds] = value.split('-');\n\n return new Date(Number(ys), Number(ms) - 1, Number(ds), 0, 0, 0, 0);\n }\n\n if (pattern === 'dd.MM.yyyy') {\n const [ds, ms, ys] = value.split('.');\n\n return new Date(Number(ys), Number(ms) - 1, Number(ds), 0, 0, 0, 0);\n }\n\n if (pattern === 'dd.MM.yy') {\n const [ds, ms, ys] = value.split('.');\n let year = Number(ys);\n\n if (year < 100) {\n year += year >= 70 ? 1900 : 2000;\n }\n\n return new Date(year, Number(ms) - 1, Number(ds), 0, 0, 0, 0);\n }\n\n const fallback = new Date(value);\n\n if (!Number.isNaN(fallback.getTime())) return fallback;\n\n return new Date(NaN);\n}\n"],"names":["pad2","n","startOfMonth","d","startOfYear","endOfYear","lastDayOfMonth","startOfDay","x","endOfDay","startOfISOWeek","day","diffToMonday","endOfISOWeek","addDays","startOfWeek","options","_a","weekStartsOn","diff","endOfWeek","amount","subDays","daysInMonth","year","month0","addMonths","y","m","safeDay","subMonths","addYears","subYears","add","duration","subWeeks","eachDayOfInterval","interval","a","b","from","to","out","t","eachMonthOfInterval","cur","last","eachYearOfInterval","y1","y2","fromY","toY","yy","isSameDay","isSameMonth","isSameYear","isBefore","isAfter","max","dates","min","isEqual","isLastDayOfMonth","isWithinInterval","date","isToday","isThisMonth","isThisYear","parseISO","s","weekDaysShort","localeTag","refMonday","_","i","intlMonth","locale","style","format","pattern","h","minu","tokenReplacements","re","fn","applyTime","timePart","hh","mm","parse","value","_referenceDate","datePart","dateOnlyPattern","ys","ms","ds","fallback"],"mappings":"AAEA,MAAMA,IAAO,CAACC,MAAc,OAAOA,CAA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AAK,GAC/CG,IAAkBd,EAAQ,QAAQ,aAAa,EAAE,GACjD5E,IAAIsF,EAAMG,GAAUC,CAA+B;AAEzD,WAAAR,EAAUlF,GAAGmF,CAAQ,GAEdnF;AAAA,EACX;AAEA,MAAI4E,MAAY,cAAc;AAC1B,UAAM,CAACe,GAAIC,GAAIC,CAAE,IAAIN,EAAM,MAAM,GAAG;AAEpC,WAAO,IAAI,KAAK,OAAOI,CAAE,GAAG,OAAOC,CAAE,IAAI,GAAG,OAAOC,CAAE,GAAG,GAAG,GAAG,GAAG,CAAC;AAAA,EACtE;AAEA,MAAIjB,MAAY,cAAc;AAC1B,UAAM,CAACiB,GAAID,GAAID,CAAE,IAAIJ,EAAM,MAAM,GAAG;AAEpC,WAAO,IAAI,KAAK,OAAOI,CAAE,GAAG,OAAOC,CAAE,IAAI,GAAG,OAAOC,CAAE,GAAG,GAAG,GAAG,GAAG,CAAC;AAAA,EACtE;AAEA,MAAIjB,MAAY,YAAY;AACxB,UAAM,CAACiB,GAAID,GAAID,CAAE,IAAIJ,EAAM,MAAM,GAAG;AACpC,QAAIlE,IAAO,OAAOsE,CAAE;AAEpB,WAAItE,IAAO,QACPA,KAAQA,KAAQ,KAAK,OAAO,MAGzB,IAAI,KAAKA,GAAM,OAAOuE,CAAE,IAAI,GAAG,OAAOC,CAAE,GAAG,GAAG,GAAG,GAAG,CAAC;AAAA,EAChE;AAEA,QAAMC,IAAW,IAAI,KAAKP,CAAK;AAE/B,SAAK,OAAO,MAAMO,EAAS,QAAA,CAAS,IAE7B,oBAAI,KAAK,GAAG,IAF2BA;AAGlD;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/utils/date/index.ts"],"sourcesContent":["/** Small date helpers (local timezone), replacing date-fns for bundle size. */\n\nconst pad2 = (n: number) => String(n).padStart(2, '0');\n\nexport function startOfMonth(d: Date | number): Date {\n const x = new Date(d);\n\n return new Date(x.getFullYear(), x.getMonth(), 1, 0, 0, 0, 0);\n}\n\nexport function startOfYear(d: Date | number): Date {\n const x = new Date(d);\n\n return new Date(x.getFullYear(), 0, 1, 0, 0, 0, 0);\n}\n\nexport function endOfYear(d: Date | number): Date {\n const x = new Date(d);\n\n return new Date(x.getFullYear(), 11, 31, 23, 59, 59, 999);\n}\n\nexport function lastDayOfMonth(d: Date | number): Date {\n const x = new Date(d);\n\n return new Date(x.getFullYear(), x.getMonth() + 1, 0, 0, 0, 0, 0);\n}\n\nexport function startOfDay(d: Date | number): Date {\n const x = new Date(d);\n\n return new Date(x.getFullYear(), x.getMonth(), x.getDate(), 0, 0, 0, 0);\n}\n\nexport function endOfDay(d: Date | number): Date {\n const x = new Date(d);\n\n return new Date(x.getFullYear(), x.getMonth(), x.getDate(), 23, 59, 59, 999);\n}\n\n/** Monday 00:00 of the ISO week containing `d`. */\nexport function startOfISOWeek(d: Date): Date {\n const x = new Date(d.getFullYear(), d.getMonth(), d.getDate());\n const day = x.getDay();\n const diffToMonday = day === 0 ? -6 : 1 - day;\n\n x.setDate(x.getDate() + diffToMonday);\n\n return new Date(x.getFullYear(), x.getMonth(), x.getDate(), 0, 0, 0, 0);\n}\n\nexport function endOfISOWeek(d: Date): Date {\n return endOfDay(addDays(startOfISOWeek(d), 6));\n}\n\nexport function startOfWeek(d: Date, options?: { weekStartsOn?: number }): Date {\n const weekStartsOn = options?.weekStartsOn ?? 0;\n const x = new Date(d.getFullYear(), d.getMonth(), d.getDate());\n const day = x.getDay();\n const diff = (day - weekStartsOn + 7) % 7;\n\n x.setDate(x.getDate() - diff);\n\n return new Date(x.getFullYear(), x.getMonth(), x.getDate(), 0, 0, 0, 0);\n}\n\nexport function endOfWeek(d: Date, options?: { weekStartsOn?: number }): Date {\n return endOfDay(addDays(startOfWeek(d, options), 6));\n}\n\nexport function addDays(d: Date, amount: number): Date {\n const x = new Date(d);\n\n x.setDate(x.getDate() + amount);\n\n return x;\n}\n\nexport function subDays(d: Date, amount: number): Date {\n return addDays(d, -amount);\n}\n\nfunction daysInMonth(year: number, month0: number): number {\n return new Date(year, month0 + 1, 0).getDate();\n}\n\nexport function addMonths(d: Date, amount: number): Date {\n const day = d.getDate();\n const y = d.getFullYear();\n const m = d.getMonth() + amount;\n const safeDay = Math.min(day, daysInMonth(y, m));\n\n return new Date(y, m, safeDay, d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds());\n}\n\nexport function subMonths(d: Date, amount: number): Date {\n return addMonths(d, -amount);\n}\n\nexport function addYears(d: Date, amount: number): Date {\n return addMonths(d, amount * 12);\n}\n\nexport function subYears(d: Date, amount: number): Date {\n return addYears(d, -amount);\n}\n\nexport function add(\n d: Date,\n duration: { years?: number; months?: number; weeks?: number; days?: number },\n): Date {\n let x = d;\n\n if (duration.years) x = addYears(x, duration.years);\n if (duration.months) x = addMonths(x, duration.months);\n if (duration.weeks) x = addDays(x, 7 * duration.weeks);\n if (duration.days) x = addDays(x, duration.days);\n\n return x;\n}\n\nexport function subWeeks(d: Date, amount: number): Date {\n return addDays(d, -7 * amount);\n}\n\nexport function eachDayOfInterval(interval: { start: Date; end: Date }): Date[] {\n const a = startOfDay(interval.start).getTime();\n const b = startOfDay(interval.end).getTime();\n const [from, to] = a <= b ? [a, b] : [b, a];\n const out: Date[] = [];\n\n for (let t = from; t <= to; t += 86400000) {\n out.push(new Date(t));\n }\n\n return out;\n}\n\nexport function eachMonthOfInterval(interval: { start: Date; end: Date }): Date[] {\n let cur = startOfMonth(interval.start);\n const last = startOfMonth(interval.end);\n\n if (cur > last) return [];\n\n const out: Date[] = [];\n\n while (cur <= last) {\n out.push(new Date(cur));\n cur = addMonths(cur, 1);\n }\n\n return out;\n}\n\nexport function eachYearOfInterval(interval: { start: Date; end: Date }): Date[] {\n const y1 = startOfYear(interval.start).getFullYear();\n const y2 = startOfYear(interval.end).getFullYear();\n const fromY = Math.min(y1, y2);\n const toY = Math.max(y1, y2);\n const out: Date[] = [];\n\n for (let yy = fromY; yy <= toY; yy += 1) {\n out.push(new Date(yy, 0, 1));\n }\n\n return out;\n}\n\nexport function isSameDay(a: Date, b: Date): boolean {\n return (\n a.getFullYear() === b.getFullYear()\n && a.getMonth() === b.getMonth()\n && a.getDate() === b.getDate()\n );\n}\n\nexport function isSameMonth(a: Date, b: Date): boolean {\n return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();\n}\n\nexport function isSameYear(a: Date, b: Date): boolean {\n return a.getFullYear() === b.getFullYear();\n}\n\nexport function isBefore(a: Date, b: Date): boolean {\n return a.getTime() < b.getTime();\n}\n\nexport function isAfter(a: Date, b: Date): boolean {\n return a.getTime() > b.getTime();\n}\n\nexport function max(dates: Array<Date | number>): Date {\n return new Date(Math.max(...dates.map((d) => new Date(d).getTime())));\n}\n\nexport function min(dates: Array<Date | number>): Date {\n return new Date(Math.min(...dates.map((d) => new Date(d).getTime())));\n}\n\nexport function isEqual(a: Date | number, b: Date | number): boolean {\n return new Date(a).getTime() === new Date(b).getTime();\n}\n\nexport function isLastDayOfMonth(d: Date): boolean {\n return d.getDate() === lastDayOfMonth(d).getDate();\n}\n\nexport function isWithinInterval(date: Date, interval: { start: Date; end: Date }): boolean {\n const t = date.getTime();\n\n return t >= interval.start.getTime() && t <= interval.end.getTime();\n}\n\nexport function isToday(d: Date): boolean {\n return isSameDay(d, new Date());\n}\n\nexport function isThisMonth(d: Date): boolean {\n return isSameMonth(d, new Date());\n}\n\nexport function isThisYear(d: Date): boolean {\n return isSameYear(d, new Date());\n}\n\nexport function parseISO(s: string): Date {\n return new Date(s);\n}\n\n/** Monday-first short weekday labels (aligned with previous date-fns `localize.day` order). */\nexport function weekDaysShort(localeTag: string): string[] {\n const refMonday = new Date(2021, 5, 7, 12, 0, 0, 0);\n\n return Array.from({ length: 7 }, (_, i) =>\n new Intl.DateTimeFormat(localeTag, { weekday: 'short' }).format(addDays(refMonday, i)),\n );\n}\n\ntype FormatOptions = { locale?: string };\n\n/**\n * Month label in *date* context (e.g. ru «ноября» after day, not standalone «ноябрь»).\n * `Intl` with `month` only uses the stand-alone form for some locales; including `day`\n * fixes inflection when tokens like `dd` and `MMMM` are applied separately.\n */\nfunction intlMonth(d: Date, locale: string, style: 'long' | 'short'): string {\n const parts = new Intl.DateTimeFormat(locale, { day: 'numeric', month: style }).formatToParts(d);\n const month = parts.find((p) => p.type === 'month')?.value;\n\n return month ?? new Intl.DateTimeFormat(locale, { month: style }).format(d);\n}\n\n/** Stand-alone month (Unicode `L`; date-fns-style), e.g. month picker title «ноябрь». */\nfunction intlStandaloneMonth(d: Date, locale: string, style: 'long' | 'short'): string {\n return new Intl.DateTimeFormat(locale, { month: style }).format(d);\n}\n\n/**\n * Subset of date-fns `format` tokens: yyyy, yy, MM, dd, HH, mm, MMM, MMMM, LLL, LLLL.\n * Longer tokens first (`LLLL` before `LLL`, `MMMM` before `MM`).\n */\nexport function format(d: Date, pattern: string, options?: FormatOptions): string {\n const locale = options?.locale ?? 'en-GB';\n const y = d.getFullYear();\n const m = d.getMonth();\n const day = d.getDate();\n const h = d.getHours();\n const minu = d.getMinutes();\n\n const tokenReplacements: Array<[RegExp, () => string]> = [\n [/yyyy/g, () => String(y)],\n [/LLLL/g, () => intlStandaloneMonth(d, locale, 'long')],\n [/MMMM/g, () => intlMonth(d, locale, 'long')],\n [/LLL/g, () => intlStandaloneMonth(d, locale, 'short')],\n [/MMM/g, () => intlMonth(d, locale, 'short')],\n [/MM/g, () => pad2(m + 1)],\n [/dd/g, () => pad2(day)],\n [/HH/g, () => pad2(h)],\n [/mm/g, () => pad2(minu)],\n [/yy/g, () => pad2(y % 100)],\n ];\n\n let out = pattern;\n\n tokenReplacements.forEach(([re, fn]) => {\n out = out.replace(re, fn);\n });\n\n return out;\n}\n\nfunction applyTime(d: Date, timePart: string | undefined): void {\n if (!timePart) return;\n const [hh, mm] = timePart.split(':').map((x) => Number(x));\n\n d.setHours(Number.isFinite(hh) ? hh : 0, Number.isFinite(mm) ? mm : 0, 0, 0);\n}\n\n/**\n * Parse fixed-width patterns used in the UI (local date).\n */\nexport function parse(value: string, pattern: string, _referenceDate?: Date): Date {\n if (pattern === 'yyyy-MM-dd HH:mm' || pattern === 'dd.MM.yyyy HH:mm') {\n const [datePart, timePart] = value.trim().split(/\\s+/);\n const dateOnlyPattern = pattern.replace(/\\s+HH:mm$/, '') as 'yyyy-MM-dd' | 'dd.MM.yyyy';\n const d = parse(datePart, dateOnlyPattern, _referenceDate);\n\n applyTime(d, timePart);\n\n return d;\n }\n\n if (pattern === 'yyyy-MM-dd') {\n const [ys, ms, ds] = value.split('-');\n\n return new Date(Number(ys), Number(ms) - 1, Number(ds), 0, 0, 0, 0);\n }\n\n if (pattern === 'dd.MM.yyyy') {\n const [ds, ms, ys] = value.split('.');\n\n return new Date(Number(ys), Number(ms) - 1, Number(ds), 0, 0, 0, 0);\n }\n\n if (pattern === 'dd.MM.yy') {\n const [ds, ms, ys] = value.split('.');\n let year = Number(ys);\n\n if (year < 100) {\n year += year >= 70 ? 1900 : 2000;\n }\n\n return new Date(year, Number(ms) - 1, Number(ds), 0, 0, 0, 0);\n }\n\n const fallback = new Date(value);\n\n if (!Number.isNaN(fallback.getTime())) return fallback;\n\n return new Date(NaN);\n}\n"],"names":["pad2","n","startOfMonth","d","x","startOfYear","endOfYear","lastDayOfMonth","startOfDay","endOfDay","startOfISOWeek","day","diffToMonday","endOfISOWeek","addDays","startOfWeek","options","_a","weekStartsOn","diff","endOfWeek","amount","subDays","daysInMonth","year","month0","addMonths","y","m","safeDay","subMonths","addYears","subYears","add","duration","subWeeks","eachDayOfInterval","interval","a","b","from","to","out","t","eachMonthOfInterval","cur","last","eachYearOfInterval","y1","y2","fromY","toY","yy","isSameDay","isSameMonth","isSameYear","isBefore","isAfter","max","dates","min","isEqual","isLastDayOfMonth","isWithinInterval","date","isToday","isThisMonth","isThisYear","parseISO","s","weekDaysShort","localeTag","refMonday","_","i","intlMonth","locale","style","month","p","intlStandaloneMonth","format","pattern","h","minu","tokenReplacements","re","fn","applyTime","timePart","hh","mm","parse","value","_referenceDate","datePart","dateOnlyPattern","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AAOC,CAAE,IAAI,GAAG,OAAOC,CAAE,GAAG,GAAG,GAAG,GAAG,CAAC;AAAA,EACtE;AAEA,MAAIjB,MAAY,YAAY;AACxB,UAAM,CAACiB,GAAID,GAAID,CAAE,IAAIJ,EAAM,MAAM,GAAG;AACpC,QAAIrE,IAAO,OAAOyE,CAAE;AAEpB,WAAIzE,IAAO,QACPA,KAAQA,KAAQ,KAAK,OAAO,MAGzB,IAAI,KAAKA,GAAM,OAAO0E,CAAE,IAAI,GAAG,OAAOC,CAAE,GAAG,GAAG,GAAG,GAAG,CAAC;AAAA,EAChE;AAEA,QAAMC,IAAW,IAAI,KAAKP,CAAK;AAE/B,SAAK,OAAO,MAAMO,EAAS,QAAA,CAAS,IAE7B,oBAAI,KAAK,GAAG,IAF2BA;AAGlD;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alphakits/ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
"build": "yarn build:clean && yarn build:index && yarn build:js && yarn build:vars",
|
|
24
24
|
"test": "echo \"no tests\"",
|
|
25
25
|
"start": "vite",
|
|
26
|
+
"storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6006 --ci",
|
|
27
|
+
"build-storybook": "NODE_OPTIONS=--openssl-legacy-provider build-storybook -o storybook-static",
|
|
26
28
|
"lint:css": "stylelint ./src/**/*.css",
|
|
27
29
|
"lint:scripts": "eslint \"**/*.{js,jsx,ts,tsx}\" --ext .js,.jsx,.ts,.tsx",
|
|
28
30
|
"lint": "yarn lint:css && yarn lint:scripts",
|
|
@@ -62,6 +64,12 @@
|
|
|
62
64
|
},
|
|
63
65
|
"devDependencies": {
|
|
64
66
|
"@alphakits/icons": "1.25.0",
|
|
67
|
+
"@babel/core": "^7.29.0",
|
|
68
|
+
"@babel/plugin-transform-nullish-coalescing-operator": "^7.28.6",
|
|
69
|
+
"@babel/plugin-transform-optional-chaining": "^7.28.6",
|
|
70
|
+
"@babel/preset-env": "^7.29.3",
|
|
71
|
+
"@babel/preset-react": "^7.28.5",
|
|
72
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
65
73
|
"@commitlint/cli": "8.3.5",
|
|
66
74
|
"@commitlint/config-conventional": "8.3.4",
|
|
67
75
|
"@semantic-release/git": "^10.0.0",
|
|
@@ -75,7 +83,6 @@
|
|
|
75
83
|
"@storybook/addon-links": "6.1.16",
|
|
76
84
|
"@storybook/addon-storysource": "6.1.16",
|
|
77
85
|
"@storybook/addons": "6.1.16",
|
|
78
|
-
"@storybook/preset-create-react-app": "3.1.5",
|
|
79
86
|
"@storybook/react": "6.1.16",
|
|
80
87
|
"@storybook/source-loader": "^6.1.21",
|
|
81
88
|
"@testing-library/jest-dom": "^5.1.1",
|
|
@@ -83,10 +90,13 @@
|
|
|
83
90
|
"@testing-library/react-hooks": "3.2.1",
|
|
84
91
|
"@testing-library/user-event": "^10.0.0",
|
|
85
92
|
"@types/autosize": "3.0.7",
|
|
93
|
+
"@types/babel__core": "^7",
|
|
94
|
+
"@types/babel__preset-env": "^7",
|
|
86
95
|
"@types/classnames": "^2.2.10",
|
|
87
96
|
"@types/element-closest": "^3.0.0",
|
|
88
97
|
"@types/jest": "^25.1.4",
|
|
89
98
|
"@types/node": "^20.17.0",
|
|
99
|
+
"@types/optimize-css-assets-webpack-plugin": "^5",
|
|
90
100
|
"@types/react": "16.9.23",
|
|
91
101
|
"@types/react-dom": "16.9.5",
|
|
92
102
|
"@types/react-node-resolver": "^2.0.0",
|
|
@@ -97,7 +107,9 @@
|
|
|
97
107
|
"@typescript-eslint/parser": "^4.4.0",
|
|
98
108
|
"@vitejs/plugin-react-swc": "^3.7.2",
|
|
99
109
|
"alphakit-presets-lint": "1.0.0",
|
|
110
|
+
"babel-loader": "8.4.1",
|
|
100
111
|
"conventional-changelog-cli": "2.0.31",
|
|
112
|
+
"cssnano": "4.1.11",
|
|
101
113
|
"cz-conventional-changelog": "3.1.0",
|
|
102
114
|
"eslint": "^7.7.0",
|
|
103
115
|
"eslint-config-airbnb": "^18.2.0",
|
|
@@ -116,11 +128,14 @@
|
|
|
116
128
|
"glob": "^10.4.5",
|
|
117
129
|
"husky": "^4.2.5",
|
|
118
130
|
"lint-staged": "^10.2.13",
|
|
131
|
+
"mini-css-extract-plugin": "1.6.2",
|
|
132
|
+
"optimize-css-assets-webpack-plugin": "5.0.8",
|
|
119
133
|
"postcss": "^8.4.47",
|
|
120
134
|
"postcss-custom-media": "^10.0.0",
|
|
121
135
|
"postcss-each": "^1.1.0",
|
|
122
136
|
"postcss-for": "^2.1.1",
|
|
123
137
|
"postcss-import": "^16.1.0",
|
|
138
|
+
"postcss-loader": "4.3.0",
|
|
124
139
|
"postcss-mixins": "^11.0.3",
|
|
125
140
|
"postcss-preset-env": "^10.0.0",
|
|
126
141
|
"prettier": "^2.1.1",
|