@nbtca/prompt 1.5.14 → 1.5.16
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/app/app.js +10 -5
- package/dist/app/chrome.js +16 -13
- package/dist/app/fields/list-field.js +7 -7
- package/dist/app/frame.js +11 -4
- package/dist/app/views/docs-render.js +7 -4
- package/dist/app/views/docs.js +35 -17
- package/dist/app/views/events-render.js +23 -9
- package/dist/app/views/events.js +52 -43
- package/dist/app/views/home.js +38 -43
- package/dist/app/views/schedule-render.js +63 -21
- package/dist/app/views/schedule.js +49 -6
- package/dist/app/views/settings.js +7 -4
- package/dist/auth/cookie-jar.js +206 -0
- package/dist/auth/cookie-transport.js +53 -29
- package/dist/auth/nbt-auth.js +10 -9
- package/dist/cli.js +1 -1
- package/dist/core/components/menu.js +44 -9
- package/dist/core/logo.js +37 -18
- package/dist/core/motion.js +23 -5
- package/dist/core/text.js +2 -2
- package/dist/core/theme.js +26 -11
- package/dist/features/calendar-query.js +39 -9
- package/dist/features/calendar-store.js +36 -4
- package/dist/features/calendar.js +47 -31
- package/dist/features/docs-client.js +12 -1
- package/dist/features/docs.js +25 -3
- package/dist/features/links.js +16 -2
- package/dist/features/schedule-render.js +152 -69
- package/dist/features/schedule-view.js +19 -33
- package/dist/i18n/locales/en.json +35 -15
- package/dist/i18n/locales/zh.json +33 -13
- package/package.json +3 -7
|
@@ -27,44 +27,38 @@ function loadCachedTimetable() {
|
|
|
27
27
|
weekOneMonday: pointer.weekOneMonday,
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
export function
|
|
30
|
+
export function peekSchedule() {
|
|
31
31
|
try {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
return loadCachedTimetable();
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function scheduleOf(cached) {
|
|
39
|
+
return createTimetableSchedule(cached.timetable, { weekOneMonday: cached.weekOneMonday });
|
|
40
|
+
}
|
|
41
|
+
export function nextClassLine(cached, now = new Date(), cols = Number.POSITIVE_INFINITY) {
|
|
42
|
+
try {
|
|
43
|
+
return renderNextClassBanner(scheduleOf(cached).next(now), now, cols, false);
|
|
39
44
|
}
|
|
40
45
|
catch {
|
|
41
46
|
return '';
|
|
42
47
|
}
|
|
43
48
|
}
|
|
44
|
-
export function
|
|
49
|
+
export function todayLines(cached, now = new Date(), cols = Number.POSITIVE_INFINITY) {
|
|
45
50
|
try {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const schedule = createTimetableSchedule(cached.timetable, {
|
|
50
|
-
weekOneMonday: cached.weekOneMonday,
|
|
51
|
-
});
|
|
52
|
-
const week = schedule.weekAt(now);
|
|
53
|
-
const today = schedule.meetingsOnDay(week, schedule.weekdayAt(now));
|
|
54
|
-
return renderTodayTimeline(today, cached.timetable.periods, now).split('\n');
|
|
51
|
+
const schedule = scheduleOf(cached);
|
|
52
|
+
const today = schedule.meetingsOnDay(schedule.weekAt(now), schedule.weekdayAt(now));
|
|
53
|
+
return renderTodayTimeline(today, cached.timetable.periods, now, cols).split('\n');
|
|
55
54
|
}
|
|
56
55
|
catch {
|
|
57
56
|
return [];
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
|
-
export function
|
|
59
|
+
export function weekAheadInfo(cached, now = new Date()) {
|
|
61
60
|
try {
|
|
62
|
-
const
|
|
63
|
-
if (!cached)
|
|
64
|
-
return null;
|
|
65
|
-
const schedule = createTimetableSchedule(cached.timetable, {
|
|
66
|
-
weekOneMonday: cached.weekOneMonday,
|
|
67
|
-
});
|
|
61
|
+
const schedule = scheduleOf(cached);
|
|
68
62
|
const week = schedule.weekAt(now);
|
|
69
63
|
if (week < 1)
|
|
70
64
|
return null;
|
|
@@ -76,11 +70,3 @@ export function peekWeekAheadInfo(now = new Date()) {
|
|
|
76
70
|
return null;
|
|
77
71
|
}
|
|
78
72
|
}
|
|
79
|
-
export function peekUnresolvedCount() {
|
|
80
|
-
try {
|
|
81
|
-
return loadCachedTimetable()?.timetable.unresolvedItems.length ?? 0;
|
|
82
|
-
}
|
|
83
|
-
catch {
|
|
84
|
-
return 0;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"goodbye": "Goodbye!",
|
|
11
11
|
"current": "current",
|
|
12
12
|
"moreAbove": "{count} more above",
|
|
13
|
-
"moreBelow": "{count} more below"
|
|
13
|
+
"moreBelow": "{count} more below",
|
|
14
|
+
"offline": "Offline, showing last fetched data"
|
|
14
15
|
},
|
|
15
16
|
"help": {
|
|
16
17
|
"title": "Keys",
|
|
@@ -43,6 +44,8 @@
|
|
|
43
44
|
"settingsDesc": "language · theme · about",
|
|
44
45
|
"chooseAction": "nbtca",
|
|
45
46
|
"hintMove": "move",
|
|
47
|
+
"hintTabs": "switch",
|
|
48
|
+
"hintBack": "back",
|
|
46
49
|
"hintOpen": "open",
|
|
47
50
|
"hintQuit": "quit"
|
|
48
51
|
},
|
|
@@ -62,7 +65,6 @@
|
|
|
62
65
|
"loading": "Loading event calendar...",
|
|
63
66
|
"noEvents": "No upcoming events",
|
|
64
67
|
"error": "Failed to load event calendar",
|
|
65
|
-
"stale": "offline, showing last known",
|
|
66
68
|
"errorHint": "Please try again later or visit https://nbtca.space",
|
|
67
69
|
"eventsFound": "events found",
|
|
68
70
|
"dateTime": "Date & Time",
|
|
@@ -81,7 +83,7 @@
|
|
|
81
83
|
"pastLoading": "Loading past events...",
|
|
82
84
|
"pastEvents": "Past Events",
|
|
83
85
|
"pastEventsDesc": "Recent activity history",
|
|
84
|
-
"noPastEvents": "No past events in the last
|
|
86
|
+
"noPastEvents": "No past events in the last year",
|
|
85
87
|
"viewPastDetail": "Select an event for details:",
|
|
86
88
|
"next": "Next",
|
|
87
89
|
"recentActivity": "Coming up",
|
|
@@ -98,7 +100,15 @@
|
|
|
98
100
|
"exportIcs": "Export .ics",
|
|
99
101
|
"exportSuccess": "Saved",
|
|
100
102
|
"exportError": "Could not write the .ics file",
|
|
101
|
-
"recurringLabel": "recurring"
|
|
103
|
+
"recurringLabel": "recurring",
|
|
104
|
+
"searchNoResultsFor": "No events match “{query}”",
|
|
105
|
+
"noEventsInRange": "No events in this period",
|
|
106
|
+
"endedLabel": "ended",
|
|
107
|
+
"duration": {
|
|
108
|
+
"days": "{days}d {hours}h",
|
|
109
|
+
"hours": "{hours}h {minutes}m",
|
|
110
|
+
"minutes": "{minutes}m"
|
|
111
|
+
}
|
|
102
112
|
},
|
|
103
113
|
"docs": {
|
|
104
114
|
"loading": "Loading documentation list...",
|
|
@@ -115,9 +125,8 @@
|
|
|
115
125
|
"chooseCategory": "Docs",
|
|
116
126
|
"refreshCache": "Refresh cache",
|
|
117
127
|
"cacheCleared": "Documentation cache cleared",
|
|
118
|
-
"stale": "offline, showing last known docs",
|
|
119
128
|
"currentDir": "Current directory",
|
|
120
|
-
"chooseDoc": "Choose a document or directory
|
|
129
|
+
"chooseDoc": "Choose a document or directory",
|
|
121
130
|
"emptyDir": "This directory is empty",
|
|
122
131
|
"upToParent": "Up to parent directory",
|
|
123
132
|
"returnToMenu": "Return to main menu",
|
|
@@ -128,7 +137,7 @@
|
|
|
128
137
|
"errorHint": "Error",
|
|
129
138
|
"openBrowserPrompt": "Open in browser?",
|
|
130
139
|
"docCompleted": "Document loaded successfully",
|
|
131
|
-
"chooseAction": "Choose an action
|
|
140
|
+
"chooseAction": "Choose an action",
|
|
132
141
|
"opening": "Opening browser...",
|
|
133
142
|
"browserOpened": "Knowledge base opened in browser",
|
|
134
143
|
"browserError": "Failed to open browser",
|
|
@@ -142,7 +151,7 @@
|
|
|
142
151
|
"githubTokenHint": "Tip: set GITHUB_TOKEN for a higher rate limit.",
|
|
143
152
|
"fetchDirFailed": "Failed to fetch directory: {error}",
|
|
144
153
|
"fetchFileFailed": "Failed to fetch file: {error}",
|
|
145
|
-
"searchPrompt": "Search documents
|
|
154
|
+
"searchPrompt": "Search documents",
|
|
146
155
|
"searchPlaceholder": "Enter keyword...",
|
|
147
156
|
"searching": "Searching documents...",
|
|
148
157
|
"searchResults": "results found",
|
|
@@ -288,7 +297,7 @@
|
|
|
288
297
|
"todayHeading": "Today · {weekday} · Week {week}",
|
|
289
298
|
"classDone": "Done",
|
|
290
299
|
"classLive": "In progress",
|
|
291
|
-
"minutesRemaining": "{minutes}
|
|
300
|
+
"minutesRemaining": "{minutes} min left",
|
|
292
301
|
"timelineEnd": "End of day",
|
|
293
302
|
"termNotStarted": "Term hasn't started yet",
|
|
294
303
|
"termStartsIn": "Classes begin {date} · {days} days to go",
|
|
@@ -298,21 +307,32 @@
|
|
|
298
307
|
"weekOverviewTitle": "Week overview",
|
|
299
308
|
"weekAheadClasses": "Classes",
|
|
300
309
|
"weekAheadBusy": "Busy",
|
|
301
|
-
"weekAheadFree": "
|
|
302
|
-
"weekAheadNone": "
|
|
310
|
+
"weekAheadFree": "Light",
|
|
311
|
+
"weekAheadNone": "None",
|
|
303
312
|
"termPreviewWeek": "Week 1 preview",
|
|
304
313
|
"hubFullGrid": "Full grid",
|
|
305
314
|
"detailTime": "Time",
|
|
306
315
|
"detailLocation": "Location",
|
|
307
316
|
"detailTeacher": "Teacher",
|
|
308
317
|
"detailWeeks": "Weeks",
|
|
309
|
-
"teacherSeparator": ", "
|
|
318
|
+
"teacherSeparator": ", ",
|
|
319
|
+
"noClassOnDay": "No classes on {weekday}",
|
|
320
|
+
"countdownDays": "in {days}d {hours}h",
|
|
321
|
+
"countdownHours": "in {hours}h {minutes}m",
|
|
322
|
+
"countdownMinutes": "in {minutes}m",
|
|
323
|
+
"weekTooSmall": "Too small for the whole week; showing one day",
|
|
324
|
+
"termPickerNeedsLogin": "Log in to the school system to switch terms.",
|
|
325
|
+
"termPickerLoginAction": "Log in",
|
|
326
|
+
"homeLoginCta": "Open {tab} and choose “{action}” to see your classes here.",
|
|
327
|
+
"helpSwitchDay": "Switch day",
|
|
328
|
+
"helpPickClass": "Pick a class",
|
|
329
|
+
"helpOpenClass": "Class details",
|
|
330
|
+
"footerDay": "day",
|
|
331
|
+
"footerClass": "class",
|
|
332
|
+
"footerDetail": "details"
|
|
310
333
|
},
|
|
311
334
|
"theme": {
|
|
312
335
|
"current": "Current theme settings",
|
|
313
|
-
"chooseAction": "Settings",
|
|
314
|
-
"chooseIconMode": "Choose icon mode:",
|
|
315
|
-
"chooseColorMode": "Choose color mode:",
|
|
316
336
|
"modeAuto": "Auto",
|
|
317
337
|
"modeAscii": "ASCII",
|
|
318
338
|
"modeUnicode": "Unicode",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"goodbye": "再见!",
|
|
11
11
|
"current": "当前",
|
|
12
12
|
"moreAbove": "上方还有 {count} 项",
|
|
13
|
-
"moreBelow": "下方还有 {count} 项"
|
|
13
|
+
"moreBelow": "下方还有 {count} 项",
|
|
14
|
+
"offline": "当前离线,显示的是上次获取的内容"
|
|
14
15
|
},
|
|
15
16
|
"help": {
|
|
16
17
|
"title": "快捷键",
|
|
@@ -43,6 +44,8 @@
|
|
|
43
44
|
"settingsDesc": "语言 · 主题 · 关于",
|
|
44
45
|
"chooseAction": "nbtca",
|
|
45
46
|
"hintMove": "移动",
|
|
47
|
+
"hintTabs": "切换",
|
|
48
|
+
"hintBack": "返回",
|
|
46
49
|
"hintOpen": "打开",
|
|
47
50
|
"hintQuit": "退出"
|
|
48
51
|
},
|
|
@@ -62,7 +65,6 @@
|
|
|
62
65
|
"loading": "正在获取活动日历...",
|
|
63
66
|
"noEvents": "近期暂无活动安排",
|
|
64
67
|
"error": "无法获取活动日历",
|
|
65
|
-
"stale": "离线,显示上次获取的数据",
|
|
66
68
|
"errorHint": "请稍后重试或访问 https://nbtca.space",
|
|
67
69
|
"eventsFound": "个活动",
|
|
68
70
|
"dateTime": "日期时间",
|
|
@@ -81,7 +83,7 @@
|
|
|
81
83
|
"pastLoading": "正在加载历史活动...",
|
|
82
84
|
"pastEvents": "历史活动",
|
|
83
85
|
"pastEventsDesc": "近期活动记录",
|
|
84
|
-
"noPastEvents": "
|
|
86
|
+
"noPastEvents": "近一年没有已结束的活动",
|
|
85
87
|
"viewPastDetail": "选择活动查看详情:",
|
|
86
88
|
"next": "下一场",
|
|
87
89
|
"recentActivity": "近期安排",
|
|
@@ -98,7 +100,15 @@
|
|
|
98
100
|
"exportIcs": "导出 .ics",
|
|
99
101
|
"exportSuccess": "已保存",
|
|
100
102
|
"exportError": "无法写入 .ics 文件",
|
|
101
|
-
"recurringLabel": "循环"
|
|
103
|
+
"recurringLabel": "循环",
|
|
104
|
+
"searchNoResultsFor": "没有找到与“{query}”相关的活动",
|
|
105
|
+
"noEventsInRange": "这段时间没有活动安排",
|
|
106
|
+
"endedLabel": "已结束",
|
|
107
|
+
"duration": {
|
|
108
|
+
"days": "{days} 天 {hours} 小时",
|
|
109
|
+
"hours": "{hours} 小时 {minutes} 分钟",
|
|
110
|
+
"minutes": "{minutes} 分钟"
|
|
111
|
+
}
|
|
102
112
|
},
|
|
103
113
|
"docs": {
|
|
104
114
|
"loading": "正在加载文档列表...",
|
|
@@ -115,9 +125,8 @@
|
|
|
115
125
|
"chooseCategory": "文档",
|
|
116
126
|
"refreshCache": "刷新缓存",
|
|
117
127
|
"cacheCleared": "文档缓存已清除",
|
|
118
|
-
"stale": "离线,显示上次获取的文档",
|
|
119
128
|
"currentDir": "当前目录",
|
|
120
|
-
"chooseDoc": "
|
|
129
|
+
"chooseDoc": "选择文档或目录",
|
|
121
130
|
"emptyDir": "该目录为空",
|
|
122
131
|
"upToParent": "返回上级目录",
|
|
123
132
|
"returnToMenu": "返回主菜单",
|
|
@@ -128,7 +137,7 @@
|
|
|
128
137
|
"errorHint": "错误",
|
|
129
138
|
"openBrowserPrompt": "是否在浏览器中打开?",
|
|
130
139
|
"docCompleted": "文档加载完成",
|
|
131
|
-
"chooseAction": "
|
|
140
|
+
"chooseAction": "选择操作",
|
|
132
141
|
"opening": "正在打开浏览器...",
|
|
133
142
|
"browserOpened": "已在浏览器中打开知识库",
|
|
134
143
|
"browserError": "无法打开浏览器",
|
|
@@ -142,7 +151,7 @@
|
|
|
142
151
|
"githubTokenHint": "提示: 设置 GITHUB_TOKEN 环境变量可获得更高的速率限制。",
|
|
143
152
|
"fetchDirFailed": "无法获取目录内容: {error}",
|
|
144
153
|
"fetchFileFailed": "无法获取文件内容: {error}",
|
|
145
|
-
"searchPrompt": "
|
|
154
|
+
"searchPrompt": "搜索文档",
|
|
146
155
|
"searchPlaceholder": "输入关键词...",
|
|
147
156
|
"searching": "正在搜索文档...",
|
|
148
157
|
"searchResults": "个结果",
|
|
@@ -299,20 +308,31 @@
|
|
|
299
308
|
"weekAheadClasses": "课程",
|
|
300
309
|
"weekAheadBusy": "较满",
|
|
301
310
|
"weekAheadFree": "较空",
|
|
302
|
-
"weekAheadNone": "
|
|
311
|
+
"weekAheadNone": "无安排",
|
|
303
312
|
"termPreviewWeek": "第一周预览",
|
|
304
313
|
"hubFullGrid": "完整课表",
|
|
305
314
|
"detailTime": "时间",
|
|
306
315
|
"detailLocation": "地点",
|
|
307
316
|
"detailTeacher": "教师",
|
|
308
317
|
"detailWeeks": "周次",
|
|
309
|
-
"teacherSeparator": "、"
|
|
318
|
+
"teacherSeparator": "、",
|
|
319
|
+
"noClassOnDay": "{weekday}没有课",
|
|
320
|
+
"countdownDays": "{days} 天 {hours} 小时后",
|
|
321
|
+
"countdownHours": "{hours} 小时 {minutes} 分钟后",
|
|
322
|
+
"countdownMinutes": "{minutes} 分钟后",
|
|
323
|
+
"weekTooSmall": "窗口太小,放不下整周课表,先按天显示",
|
|
324
|
+
"termPickerNeedsLogin": "切换学期需要先登录教务系统。",
|
|
325
|
+
"termPickerLoginAction": "登录教务系统",
|
|
326
|
+
"homeLoginCta": "到{tab}页选择“{action}”,这里就会显示你的课程。",
|
|
327
|
+
"helpSwitchDay": "切换星期",
|
|
328
|
+
"helpPickClass": "选择课程",
|
|
329
|
+
"helpOpenClass": "查看课程详情",
|
|
330
|
+
"footerDay": "星期",
|
|
331
|
+
"footerClass": "课程",
|
|
332
|
+
"footerDetail": "详情"
|
|
310
333
|
},
|
|
311
334
|
"theme": {
|
|
312
335
|
"current": "当前主题设置",
|
|
313
|
-
"chooseAction": "设置",
|
|
314
|
-
"chooseIconMode": "选择图标模式:",
|
|
315
|
-
"chooseColorMode": "选择颜色模式:",
|
|
316
336
|
"modeAuto": "自动",
|
|
317
337
|
"modeAscii": "ASCII",
|
|
318
338
|
"modeUnicode": "Unicode",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nbtca/prompt",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -47,13 +47,9 @@
|
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@nbtca/docs": "^0.3.2",
|
|
50
|
-
"@nbtca/nbtcal": "^0.4.
|
|
50
|
+
"@nbtca/nbtcal": "^0.4.3",
|
|
51
51
|
"chalk": "^5.6.2",
|
|
52
|
-
"
|
|
53
|
-
"gradient-string": "^3.0.0",
|
|
54
|
-
"marked": "^15.0.12",
|
|
55
|
-
"open": "^11.0.0",
|
|
56
|
-
"tough-cookie": "^6.0.2"
|
|
52
|
+
"marked": "^15.0.12"
|
|
57
53
|
},
|
|
58
54
|
"devDependencies": {
|
|
59
55
|
"@eslint/js": "^9.39.5",
|