react-native-lich-am 1.0.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/LICENSE +21 -0
- package/README.md +248 -0
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/core/package.json +5 -0
- package/dataset/2024.d.ts +1 -0
- package/dataset/2024.js +1 -0
- package/dataset/2025.d.ts +1 -0
- package/dataset/2025.js +1 -0
- package/dataset/2026.d.ts +1 -0
- package/dataset/2026.js +1 -0
- package/dataset/2027.d.ts +1 -0
- package/dataset/2027.js +1 -0
- package/dataset/2028.d.ts +1 -0
- package/dataset/2028.js +1 -0
- package/dataset/index.d.ts +1 -0
- package/dataset/index.js +1 -0
- package/dataset/package.json +5 -0
- package/lib/core/astro.d.ts +43 -0
- package/lib/core/astro.js +203 -0
- package/lib/core/canchi.d.ts +47 -0
- package/lib/core/canchi.js +78 -0
- package/lib/core/constants.d.ts +54 -0
- package/lib/core/constants.js +141 -0
- package/lib/core/day.d.ts +30 -0
- package/lib/core/day.js +103 -0
- package/lib/core/format.d.ts +26 -0
- package/lib/core/format.js +60 -0
- package/lib/core/huong.d.ts +26 -0
- package/lib/core/huong.js +44 -0
- package/lib/core/index.d.ts +16 -0
- package/lib/core/index.js +32 -0
- package/lib/core/lunar.d.ts +39 -0
- package/lib/core/lunar.js +130 -0
- package/lib/core/tietkhi.d.ts +40 -0
- package/lib/core/tietkhi.js +115 -0
- package/lib/core/truc.d.ts +47 -0
- package/lib/core/truc.js +70 -0
- package/lib/core/types.d.ts +66 -0
- package/lib/core/types.js +3 -0
- package/lib/dataset/2024.d.ts +30 -0
- package/lib/dataset/2024.js +69 -0
- package/lib/dataset/2025.d.ts +30 -0
- package/lib/dataset/2025.js +69 -0
- package/lib/dataset/2026.d.ts +30 -0
- package/lib/dataset/2026.js +69 -0
- package/lib/dataset/2027.d.ts +30 -0
- package/lib/dataset/2027.js +69 -0
- package/lib/dataset/2028.d.ts +30 -0
- package/lib/dataset/2028.js +69 -0
- package/lib/dataset/data/days-2024.json +1 -0
- package/lib/dataset/data/days-2025.json +1 -0
- package/lib/dataset/data/days-2026.json +1 -0
- package/lib/dataset/data/days-2027.json +1 -0
- package/lib/dataset/data/days-2028.json +1 -0
- package/lib/dataset/data/dict.json +1 -0
- package/lib/dataset/data/gio-table.json +1 -0
- package/lib/dataset/decode.d.ts +225 -0
- package/lib/dataset/decode.js +285 -0
- package/lib/dataset/index.d.ts +37 -0
- package/lib/dataset/index.js +87 -0
- package/lib/index.d.ts +21 -0
- package/lib/index.js +37 -0
- package/lib/ui/LunarCalendar.d.ts +58 -0
- package/lib/ui/LunarCalendar.js +311 -0
- package/lib/ui/LunarDayDetail.d.ts +32 -0
- package/lib/ui/LunarDayDetail.js +221 -0
- package/lib/ui/index.d.ts +9 -0
- package/lib/ui/index.js +18 -0
- package/lib/ui/theme.d.ts +46 -0
- package/lib/ui/theme.js +60 -0
- package/package.json +431 -0
- package/ui/index.d.ts +1 -0
- package/ui/index.js +1 -0
- package/ui/package.json +5 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.LunarDayDetail = void 0;
|
|
27
|
+
const React = __importStar(require("react"));
|
|
28
|
+
const react_native_1 = require("react-native");
|
|
29
|
+
const format_1 = require("../core/format");
|
|
30
|
+
const theme_1 = require("./theme");
|
|
31
|
+
function Row({ label, value, theme, accent, }) {
|
|
32
|
+
return (React.createElement(react_native_1.View, { style: styles.row },
|
|
33
|
+
React.createElement(react_native_1.Text, { style: [styles.rowLabel, { color: theme.subtext }] }, label),
|
|
34
|
+
React.createElement(react_native_1.Text, { style: [styles.rowValue, { color: accent ? theme.primary : theme.text }], numberOfLines: 3 }, value)));
|
|
35
|
+
}
|
|
36
|
+
function Section({ title, children, theme, }) {
|
|
37
|
+
return (React.createElement(react_native_1.View, { style: [styles.section, { borderTopColor: theme.border }] },
|
|
38
|
+
React.createElement(react_native_1.Text, { style: [styles.sectionTitle, { color: theme.primary }] }, title),
|
|
39
|
+
children));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Thẻ chi tiết một ngày: can chi, tiết khí, trực, giờ hoàng đạo,
|
|
43
|
+
* sao tốt/xấu, việc nên làm, hướng tốt, tuổi xung.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* import { LunarDayDetail } from 'react-native-lich-am/ui';
|
|
47
|
+
* import { getDayData } from 'react-native-lich-am/dataset';
|
|
48
|
+
*
|
|
49
|
+
* <LunarDayDetail day={getLunarDayInfo(new Date())} data={getDayData('2024-02-10')} />
|
|
50
|
+
*/
|
|
51
|
+
function LunarDayDetail(props) {
|
|
52
|
+
const { day, data, sections, theme: themeOverride, colorScheme = 'light', locale = 'vi', style, scrollable = true, } = props;
|
|
53
|
+
const theme = React.useMemo(() => (0, theme_1.createTheme)(colorScheme === 'dark' ? theme_1.darkTheme : theme_1.lightTheme, themeOverride), [colorScheme, themeOverride]);
|
|
54
|
+
const want = (s) => !sections || sections.indexOf(s) >= 0;
|
|
55
|
+
const vi = locale === 'vi';
|
|
56
|
+
const body = (React.createElement(React.Fragment, null,
|
|
57
|
+
React.createElement(react_native_1.View, { style: styles.head },
|
|
58
|
+
React.createElement(react_native_1.Text, { style: [styles.headSolar, { color: theme.text }] }, (0, format_1.describeDay)(day)),
|
|
59
|
+
React.createElement(react_native_1.Text, { style: [styles.headLunar, { color: theme.primary }] },
|
|
60
|
+
day.canChi.day.name,
|
|
61
|
+
data ? ` · ${data.truc} · ${data.diem}/100` : ` · ${day.truc.name}`)),
|
|
62
|
+
want('canchi') ? (React.createElement(Section, { title: vi ? 'Can chi & tiết khí' : 'Stems & terms', theme: theme },
|
|
63
|
+
React.createElement(Row, { label: vi ? 'Năm' : 'Year', value: `${day.canChi.year.name} (${day.conGiap})`, theme: theme }),
|
|
64
|
+
React.createElement(Row, { label: vi ? 'Tháng' : 'Month', value: day.canChi.month.name, theme: theme }),
|
|
65
|
+
React.createElement(Row, { label: vi ? 'Ngày' : 'Day', value: day.canChi.day.name, theme: theme }),
|
|
66
|
+
React.createElement(Row, { label: vi ? 'Tiết khí' : 'Solar term', value: day.tietKhi.name, theme: theme }),
|
|
67
|
+
React.createElement(Row, { label: vi ? 'Trực' : 'Officer', value: day.truc.name, theme: theme, accent: true }),
|
|
68
|
+
React.createElement(Row, { label: vi ? 'Nạp âm' : 'Nap am', value: `${day.napAm.day.name} (${day.napAm.day.element})`, theme: theme }),
|
|
69
|
+
React.createElement(Row, { label: vi ? 'Tháng âm' : 'Lunar month', value: day.lunar.monthNameFull, theme: theme }))) : null,
|
|
70
|
+
want('gio') ? (React.createElement(Section, { title: vi ? 'Giờ hoàng đạo' : 'Auspicious hours', theme: theme },
|
|
71
|
+
React.createElement(react_native_1.View, { style: styles.chipRow }, day.gioHoangDao.map((g) => (React.createElement(react_native_1.View, { key: g.index, style: [styles.chip, { borderColor: theme.quality.dep }] },
|
|
72
|
+
React.createElement(react_native_1.Text, { style: [styles.chipTitle, { color: theme.quality.dep }] }, g.chi),
|
|
73
|
+
React.createElement(react_native_1.Text, { style: [styles.chipSub, { color: theme.subtext }] }, g.range))))),
|
|
74
|
+
data ? (React.createElement(react_native_1.View, { style: styles.gioList }, data.gio
|
|
75
|
+
.slice()
|
|
76
|
+
.sort((a, b) => b.diem - a.diem)
|
|
77
|
+
.slice(0, 5)
|
|
78
|
+
.map((g) => (React.createElement(react_native_1.View, { key: g.index, style: styles.gioRow },
|
|
79
|
+
React.createElement(react_native_1.Text, { style: [styles.gioChi, { color: theme.text }] }, g.chi),
|
|
80
|
+
React.createElement(react_native_1.View, { style: [styles.gioBar, { backgroundColor: theme.border }] },
|
|
81
|
+
React.createElement(react_native_1.View, { style: [
|
|
82
|
+
styles.gioBarFill,
|
|
83
|
+
{
|
|
84
|
+
width: `${Math.max(4, Math.min(100, ((g.diem + 6) / 16) * 100))}%`,
|
|
85
|
+
backgroundColor: g.diem > 0 ? theme.quality.dep : theme.quality.ratxau,
|
|
86
|
+
},
|
|
87
|
+
] })),
|
|
88
|
+
React.createElement(react_native_1.Text, { style: [styles.gioDiem, { color: theme.subtext }] }, g.diem)))))) : null)) : null,
|
|
89
|
+
data && want('sao') ? (React.createElement(Section, { title: vi ? 'Sao tốt / Sao xấu' : 'Stars', theme: theme },
|
|
90
|
+
React.createElement(react_native_1.View, { style: styles.chipRow },
|
|
91
|
+
data.saoTot.map((s) => (React.createElement(react_native_1.View, { key: `t-${s}`, style: [styles.tag, { borderColor: theme.quality.dep }] },
|
|
92
|
+
React.createElement(react_native_1.Text, { style: [styles.tagTxt, { color: theme.quality.dep }] }, s)))),
|
|
93
|
+
data.saoXau.map((s) => (React.createElement(react_native_1.View, { key: `x-${s}`, style: [styles.tag, { borderColor: theme.quality.ratxau }] },
|
|
94
|
+
React.createElement(react_native_1.Text, { style: [styles.tagTxt, { color: theme.quality.ratxau }] }, s))))))) : null,
|
|
95
|
+
data && want('viec') ? (React.createElement(Section, { title: vi ? 'Việc nên làm' : 'Good for', theme: theme },
|
|
96
|
+
React.createElement(react_native_1.View, { style: styles.chipRow }, data.nenLam.map((a) => (React.createElement(react_native_1.View, { key: a, style: [styles.tag, { borderColor: theme.quality.dep, backgroundColor: 'transparent' }] },
|
|
97
|
+
React.createElement(react_native_1.Text, { style: [styles.tagTxt, { color: theme.quality.dep }] }, a))))),
|
|
98
|
+
React.createElement(react_native_1.Text, { style: [styles.sectionTitle, { color: theme.quality.ratxau, marginTop: 10 }] }, vi ? 'Việc không nên làm' : 'Avoid'),
|
|
99
|
+
React.createElement(react_native_1.View, { style: styles.chipRow }, data.khongNenLam.map((a) => (React.createElement(react_native_1.View, { key: a, style: [styles.tag, { borderColor: theme.border }] },
|
|
100
|
+
React.createElement(react_native_1.Text, { style: [styles.tagTxt, { color: theme.subtext }] }, a))))))) : null,
|
|
101
|
+
want('huong') ? (React.createElement(Section, { title: vi ? 'Hướng xuất hành' : 'Directions', theme: theme },
|
|
102
|
+
React.createElement(Row, { label: vi ? 'Hỷ thần' : 'Joy', value: day.huongXuatHanh.hyThan, theme: theme }),
|
|
103
|
+
React.createElement(Row, { label: vi ? 'Tài thần' : 'Wealth', value: day.huongXuatHanh.taiThan, theme: theme }),
|
|
104
|
+
React.createElement(Row, { label: vi ? 'Hạc thần (kỵ)' : 'Avoid', value: day.huongXuatHanh.hacThan, theme: theme }),
|
|
105
|
+
data && data.huong.ngay.length ? (React.createElement(react_native_1.View, { style: styles.chipRow }, data.huong.ngay.slice(0, 5).map((h) => (React.createElement(react_native_1.View, { key: `${h.son}-${h.huong}`, style: [styles.tag, { borderColor: theme.border }] },
|
|
106
|
+
React.createElement(react_native_1.Text, { style: [styles.tagTxt, { color: theme.subtext }] },
|
|
107
|
+
h.son,
|
|
108
|
+
" \u00B7 ",
|
|
109
|
+
h.huong,
|
|
110
|
+
" (",
|
|
111
|
+
h.soSao,
|
|
112
|
+
"\u2605)")))))) : null)) : null,
|
|
113
|
+
data && want('tuoixung') && data.tuoiXung.length ? (React.createElement(Section, { title: vi ? 'Tuổi xung với ngày' : 'Clashing ages', theme: theme },
|
|
114
|
+
React.createElement(react_native_1.View, { style: styles.chipRow }, data.tuoiXung.map((t) => (React.createElement(react_native_1.View, { key: t, style: [styles.tag, { borderColor: theme.quality.xau }] },
|
|
115
|
+
React.createElement(react_native_1.Text, { style: [styles.tagTxt, { color: theme.quality.xau }] }, t))))))) : null));
|
|
116
|
+
return (React.createElement(react_native_1.View, { style: [styles.root, { backgroundColor: theme.card, borderRadius: theme.radius }, style] }, scrollable ? (React.createElement(react_native_1.ScrollView, { showsVerticalScrollIndicator: false }, body)) : (body)));
|
|
117
|
+
}
|
|
118
|
+
exports.LunarDayDetail = LunarDayDetail;
|
|
119
|
+
const styles = react_native_1.StyleSheet.create({
|
|
120
|
+
root: {
|
|
121
|
+
padding: 12,
|
|
122
|
+
},
|
|
123
|
+
head: {
|
|
124
|
+
marginBottom: 4,
|
|
125
|
+
},
|
|
126
|
+
headSolar: {
|
|
127
|
+
fontSize: 15,
|
|
128
|
+
fontWeight: '700',
|
|
129
|
+
},
|
|
130
|
+
headLunar: {
|
|
131
|
+
fontSize: 12,
|
|
132
|
+
marginTop: 2,
|
|
133
|
+
},
|
|
134
|
+
section: {
|
|
135
|
+
marginTop: 12,
|
|
136
|
+
paddingTop: 10,
|
|
137
|
+
borderTopWidth: react_native_1.StyleSheet.hairlineWidth,
|
|
138
|
+
},
|
|
139
|
+
sectionTitle: {
|
|
140
|
+
fontSize: 12,
|
|
141
|
+
fontWeight: '700',
|
|
142
|
+
textTransform: 'uppercase',
|
|
143
|
+
letterSpacing: 0.4,
|
|
144
|
+
marginBottom: 6,
|
|
145
|
+
},
|
|
146
|
+
row: {
|
|
147
|
+
flexDirection: 'row',
|
|
148
|
+
justifyContent: 'space-between',
|
|
149
|
+
alignItems: 'flex-start',
|
|
150
|
+
paddingVertical: 3,
|
|
151
|
+
},
|
|
152
|
+
rowLabel: {
|
|
153
|
+
fontSize: 13,
|
|
154
|
+
flexShrink: 0,
|
|
155
|
+
marginRight: 12,
|
|
156
|
+
},
|
|
157
|
+
rowValue: {
|
|
158
|
+
fontSize: 13,
|
|
159
|
+
fontWeight: '600',
|
|
160
|
+
flexShrink: 1,
|
|
161
|
+
textAlign: 'right',
|
|
162
|
+
},
|
|
163
|
+
chipRow: {
|
|
164
|
+
flexDirection: 'row',
|
|
165
|
+
flexWrap: 'wrap',
|
|
166
|
+
gap: 6,
|
|
167
|
+
},
|
|
168
|
+
chip: {
|
|
169
|
+
borderWidth: 1,
|
|
170
|
+
borderRadius: 8,
|
|
171
|
+
paddingHorizontal: 8,
|
|
172
|
+
paddingVertical: 5,
|
|
173
|
+
alignItems: 'center',
|
|
174
|
+
},
|
|
175
|
+
chipTitle: {
|
|
176
|
+
fontSize: 13,
|
|
177
|
+
fontWeight: '700',
|
|
178
|
+
},
|
|
179
|
+
chipSub: {
|
|
180
|
+
fontSize: 10,
|
|
181
|
+
},
|
|
182
|
+
tag: {
|
|
183
|
+
borderWidth: 1,
|
|
184
|
+
borderRadius: 999,
|
|
185
|
+
paddingHorizontal: 9,
|
|
186
|
+
paddingVertical: 4,
|
|
187
|
+
},
|
|
188
|
+
tagTxt: {
|
|
189
|
+
fontSize: 11.5,
|
|
190
|
+
},
|
|
191
|
+
gioList: {
|
|
192
|
+
marginTop: 10,
|
|
193
|
+
gap: 6,
|
|
194
|
+
},
|
|
195
|
+
gioRow: {
|
|
196
|
+
flexDirection: 'row',
|
|
197
|
+
alignItems: 'center',
|
|
198
|
+
gap: 8,
|
|
199
|
+
},
|
|
200
|
+
gioChi: {
|
|
201
|
+
width: 38,
|
|
202
|
+
fontSize: 12,
|
|
203
|
+
fontWeight: '600',
|
|
204
|
+
},
|
|
205
|
+
gioBar: {
|
|
206
|
+
flex: 1,
|
|
207
|
+
height: 6,
|
|
208
|
+
borderRadius: 3,
|
|
209
|
+
overflow: 'hidden',
|
|
210
|
+
},
|
|
211
|
+
gioBarFill: {
|
|
212
|
+
height: 6,
|
|
213
|
+
borderRadius: 3,
|
|
214
|
+
},
|
|
215
|
+
gioDiem: {
|
|
216
|
+
width: 32,
|
|
217
|
+
fontSize: 11,
|
|
218
|
+
textAlign: 'right',
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
exports.default = LunarDayDetail;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-native-lich-am / ui
|
|
3
|
+
*
|
|
4
|
+
* Component giao diện sẵn dùng, chỉ dựa trên primitive của React Native.
|
|
5
|
+
* `react-native` và `react` là peer dependency.
|
|
6
|
+
*/
|
|
7
|
+
export { LunarCalendar, type LunarCalendarProps } from './LunarCalendar';
|
|
8
|
+
export { LunarDayDetail, type LunarDayDetailProps, type DetailSection } from './LunarDayDetail';
|
|
9
|
+
export { lightTheme, darkTheme, createTheme, defaultTheme, type LunarTheme, } from './theme';
|
package/lib/ui/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* react-native-lich-am / ui
|
|
4
|
+
*
|
|
5
|
+
* Component giao diện sẵn dùng, chỉ dựa trên primitive của React Native.
|
|
6
|
+
* `react-native` và `react` là peer dependency.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.defaultTheme = exports.createTheme = exports.darkTheme = exports.lightTheme = exports.LunarDayDetail = exports.LunarCalendar = void 0;
|
|
10
|
+
var LunarCalendar_1 = require("./LunarCalendar");
|
|
11
|
+
Object.defineProperty(exports, "LunarCalendar", { enumerable: true, get: function () { return LunarCalendar_1.LunarCalendar; } });
|
|
12
|
+
var LunarDayDetail_1 = require("./LunarDayDetail");
|
|
13
|
+
Object.defineProperty(exports, "LunarDayDetail", { enumerable: true, get: function () { return LunarDayDetail_1.LunarDayDetail; } });
|
|
14
|
+
var theme_1 = require("./theme");
|
|
15
|
+
Object.defineProperty(exports, "lightTheme", { enumerable: true, get: function () { return theme_1.lightTheme; } });
|
|
16
|
+
Object.defineProperty(exports, "darkTheme", { enumerable: true, get: function () { return theme_1.darkTheme; } });
|
|
17
|
+
Object.defineProperty(exports, "createTheme", { enumerable: true, get: function () { return theme_1.createTheme; } });
|
|
18
|
+
Object.defineProperty(exports, "defaultTheme", { enumerable: true, get: function () { return theme_1.defaultTheme; } });
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** Bảng màu & kích thước cho các component lịch */
|
|
2
|
+
export interface LunarTheme {
|
|
3
|
+
/** Nền tổng thể */
|
|
4
|
+
bg: string;
|
|
5
|
+
/** Nền thẻ */
|
|
6
|
+
card: string;
|
|
7
|
+
/** Màu chữ chính */
|
|
8
|
+
text: string;
|
|
9
|
+
/** Màu chữ phụ */
|
|
10
|
+
subtext: string;
|
|
11
|
+
/** Màu chữ mờ */
|
|
12
|
+
muted: string;
|
|
13
|
+
/** Viền */
|
|
14
|
+
border: string;
|
|
15
|
+
/** Màu nhấn (đỏ lễ hội) */
|
|
16
|
+
primary: string;
|
|
17
|
+
/** Chữ trên nền nhấn */
|
|
18
|
+
primaryText: string;
|
|
19
|
+
/** Ngày cuối tuần */
|
|
20
|
+
weekend: string;
|
|
21
|
+
/** Ngày âm mùng 1 */
|
|
22
|
+
firstDayOfMonth: string;
|
|
23
|
+
/** Nền ô đang chọn */
|
|
24
|
+
selectedBg: string;
|
|
25
|
+
/** Viền ô hôm nay */
|
|
26
|
+
todayBorder: string;
|
|
27
|
+
/** Màu chất lượng ngày */
|
|
28
|
+
quality: {
|
|
29
|
+
dep: string;
|
|
30
|
+
tot: string;
|
|
31
|
+
bt: string;
|
|
32
|
+
xau: string;
|
|
33
|
+
ratxau: string;
|
|
34
|
+
};
|
|
35
|
+
/** Bo góc */
|
|
36
|
+
radius: number;
|
|
37
|
+
/** Cỡ chữ ngày dương */
|
|
38
|
+
solarFontSize: number;
|
|
39
|
+
/** Cỡ chữ ngày âm */
|
|
40
|
+
lunarFontSize: number;
|
|
41
|
+
}
|
|
42
|
+
export declare const lightTheme: LunarTheme;
|
|
43
|
+
export declare const darkTheme: LunarTheme;
|
|
44
|
+
/** Gộp theme nền với các ghi đè của người dùng */
|
|
45
|
+
export declare function createTheme(base: LunarTheme, overrides?: Partial<LunarTheme>): LunarTheme;
|
|
46
|
+
export declare const defaultTheme: LunarTheme;
|
package/lib/ui/theme.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Bảng màu & kích thước cho các component lịch */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.defaultTheme = exports.createTheme = exports.darkTheme = exports.lightTheme = void 0;
|
|
5
|
+
exports.lightTheme = {
|
|
6
|
+
bg: '#FFFFFF',
|
|
7
|
+
card: '#FFFFFF',
|
|
8
|
+
text: '#111827',
|
|
9
|
+
subtext: '#6B7280',
|
|
10
|
+
muted: '#9CA3AF',
|
|
11
|
+
border: '#E5E7EB',
|
|
12
|
+
primary: '#DC2626',
|
|
13
|
+
primaryText: '#FFFFFF',
|
|
14
|
+
weekend: '#DC2626',
|
|
15
|
+
firstDayOfMonth: '#DC2626',
|
|
16
|
+
selectedBg: '#FEE2E2',
|
|
17
|
+
todayBorder: '#DC2626',
|
|
18
|
+
quality: {
|
|
19
|
+
dep: '#16A34A',
|
|
20
|
+
tot: '#4ADE80',
|
|
21
|
+
bt: '#D1D5DB',
|
|
22
|
+
xau: '#FB923C',
|
|
23
|
+
ratxau: '#EF4444',
|
|
24
|
+
},
|
|
25
|
+
radius: 12,
|
|
26
|
+
solarFontSize: 16,
|
|
27
|
+
lunarFontSize: 10,
|
|
28
|
+
};
|
|
29
|
+
exports.darkTheme = {
|
|
30
|
+
bg: '#0B0B0F',
|
|
31
|
+
card: '#16161D',
|
|
32
|
+
text: '#F9FAFB',
|
|
33
|
+
subtext: '#9CA3AF',
|
|
34
|
+
muted: '#6B7280',
|
|
35
|
+
border: '#27272A',
|
|
36
|
+
primary: '#EF4444',
|
|
37
|
+
primaryText: '#FFFFFF',
|
|
38
|
+
weekend: '#F87171',
|
|
39
|
+
firstDayOfMonth: '#F87171',
|
|
40
|
+
selectedBg: '#3F1D1D',
|
|
41
|
+
todayBorder: '#EF4444',
|
|
42
|
+
quality: {
|
|
43
|
+
dep: '#22C55E',
|
|
44
|
+
tot: '#4ADE80',
|
|
45
|
+
bt: '#3F3F46',
|
|
46
|
+
xau: '#FB923C',
|
|
47
|
+
ratxau: '#EF4444',
|
|
48
|
+
},
|
|
49
|
+
radius: 12,
|
|
50
|
+
solarFontSize: 16,
|
|
51
|
+
lunarFontSize: 10,
|
|
52
|
+
};
|
|
53
|
+
/** Gộp theme nền với các ghi đè của người dùng */
|
|
54
|
+
function createTheme(base, overrides) {
|
|
55
|
+
if (!overrides)
|
|
56
|
+
return base;
|
|
57
|
+
return Object.assign(Object.assign(Object.assign({}, base), overrides), { quality: Object.assign(Object.assign({}, base.quality), (overrides.quality || {})) });
|
|
58
|
+
}
|
|
59
|
+
exports.createTheme = createTheme;
|
|
60
|
+
exports.defaultTheme = exports.lightTheme;
|