@nbtca/prompt 1.5.13 → 1.5.15
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/chrome.js +7 -6
- package/dist/app/fields/list-field.js +7 -7
- package/dist/app/tabs.js +1 -1
- package/dist/app/views/docs-render.js +8 -6
- package/dist/app/views/docs.js +26 -9
- package/dist/app/views/events-render.js +21 -8
- package/dist/app/views/events.js +53 -44
- package/dist/app/views/home.js +42 -56
- package/dist/app/views/schedule-grid-cursor.js +7 -2
- package/dist/app/views/schedule-render.js +63 -21
- package/dist/app/views/schedule.js +55 -12
- package/dist/app/views/settings.js +28 -40
- package/dist/auth/cookie-jar.js +206 -0
- package/dist/auth/cookie-transport.js +53 -29
- package/dist/auth/login-page.js +141 -0
- package/dist/auth/nbt-auth.js +17 -21
- 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 +16 -14
- package/dist/core/theme.js +27 -9
- package/dist/features/calendar-query.js +39 -9
- package/dist/features/calendar.js +26 -22
- package/dist/features/docs-client.js +7 -2
- package/dist/features/docs-markdown.js +265 -0
- package/dist/features/docs-store.js +37 -27
- package/dist/features/docs.js +32 -133
- package/dist/features/links.js +16 -2
- package/dist/features/schedule-render.js +156 -71
- package/dist/features/schedule-view.js +19 -33
- package/dist/i18n/locales/en.json +40 -16
- package/dist/i18n/locales/zh.json +38 -14
- package/package.json +3 -9
|
@@ -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
|
-
}
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"hint": "? keys"
|
|
29
29
|
},
|
|
30
30
|
"menu": {
|
|
31
|
+
"home": "Home",
|
|
31
32
|
"events": "Events",
|
|
32
33
|
"eventsDesc": "Upcoming activities",
|
|
33
34
|
"docs": "Docs",
|
|
@@ -42,6 +43,8 @@
|
|
|
42
43
|
"settingsDesc": "language · theme · about",
|
|
43
44
|
"chooseAction": "nbtca",
|
|
44
45
|
"hintMove": "move",
|
|
46
|
+
"hintTabs": "switch",
|
|
47
|
+
"hintBack": "back",
|
|
45
48
|
"hintOpen": "open",
|
|
46
49
|
"hintQuit": "quit"
|
|
47
50
|
},
|
|
@@ -80,10 +83,12 @@
|
|
|
80
83
|
"pastLoading": "Loading past events...",
|
|
81
84
|
"pastEvents": "Past Events",
|
|
82
85
|
"pastEventsDesc": "Recent activity history",
|
|
83
|
-
"noPastEvents": "No past events in the last
|
|
86
|
+
"noPastEvents": "No past events in the last year",
|
|
84
87
|
"viewPastDetail": "Select an event for details:",
|
|
85
88
|
"next": "Next",
|
|
86
|
-
"recentActivity": "
|
|
89
|
+
"recentActivity": "Coming up",
|
|
90
|
+
"browse": "Browse",
|
|
91
|
+
"next30Days": "Next 30 Days",
|
|
87
92
|
"inPrefix": "in",
|
|
88
93
|
"startingNow": "starting now",
|
|
89
94
|
"thisWeek": "This Week",
|
|
@@ -95,7 +100,15 @@
|
|
|
95
100
|
"exportIcs": "Export .ics",
|
|
96
101
|
"exportSuccess": "Saved",
|
|
97
102
|
"exportError": "Could not write the .ics file",
|
|
98
|
-
"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
|
+
}
|
|
99
112
|
},
|
|
100
113
|
"docs": {
|
|
101
114
|
"loading": "Loading documentation list...",
|
|
@@ -112,9 +125,9 @@
|
|
|
112
125
|
"chooseCategory": "Docs",
|
|
113
126
|
"refreshCache": "Refresh cache",
|
|
114
127
|
"cacheCleared": "Documentation cache cleared",
|
|
115
|
-
"
|
|
128
|
+
"stale": "offline, showing last known docs",
|
|
116
129
|
"currentDir": "Current directory",
|
|
117
|
-
"chooseDoc": "Choose a document or directory
|
|
130
|
+
"chooseDoc": "Choose a document or directory",
|
|
118
131
|
"emptyDir": "This directory is empty",
|
|
119
132
|
"upToParent": "Up to parent directory",
|
|
120
133
|
"returnToMenu": "Return to main menu",
|
|
@@ -125,7 +138,7 @@
|
|
|
125
138
|
"errorHint": "Error",
|
|
126
139
|
"openBrowserPrompt": "Open in browser?",
|
|
127
140
|
"docCompleted": "Document loaded successfully",
|
|
128
|
-
"chooseAction": "Choose an action
|
|
141
|
+
"chooseAction": "Choose an action",
|
|
129
142
|
"opening": "Opening browser...",
|
|
130
143
|
"browserOpened": "Knowledge base opened in browser",
|
|
131
144
|
"browserError": "Failed to open browser",
|
|
@@ -139,7 +152,7 @@
|
|
|
139
152
|
"githubTokenHint": "Tip: set GITHUB_TOKEN for a higher rate limit.",
|
|
140
153
|
"fetchDirFailed": "Failed to fetch directory: {error}",
|
|
141
154
|
"fetchFileFailed": "Failed to fetch file: {error}",
|
|
142
|
-
"searchPrompt": "Search documents
|
|
155
|
+
"searchPrompt": "Search documents",
|
|
143
156
|
"searchPlaceholder": "Enter keyword...",
|
|
144
157
|
"searching": "Searching documents...",
|
|
145
158
|
"searchResults": "results found",
|
|
@@ -285,8 +298,8 @@
|
|
|
285
298
|
"todayHeading": "Today · {weekday} · Week {week}",
|
|
286
299
|
"classDone": "Done",
|
|
287
300
|
"classLive": "In progress",
|
|
288
|
-
"minutesRemaining": "{minutes}
|
|
289
|
-
"timelineEnd": "
|
|
301
|
+
"minutesRemaining": "{minutes} min left",
|
|
302
|
+
"timelineEnd": "End of day",
|
|
290
303
|
"termNotStarted": "Term hasn't started yet",
|
|
291
304
|
"termStartsIn": "Classes begin {date} · {days} days to go",
|
|
292
305
|
"hubTermDensity": "Term density",
|
|
@@ -295,21 +308,32 @@
|
|
|
295
308
|
"weekOverviewTitle": "Week overview",
|
|
296
309
|
"weekAheadClasses": "Classes",
|
|
297
310
|
"weekAheadBusy": "Busy",
|
|
298
|
-
"weekAheadFree": "
|
|
299
|
-
"weekAheadNone": "
|
|
311
|
+
"weekAheadFree": "Light",
|
|
312
|
+
"weekAheadNone": "None",
|
|
300
313
|
"termPreviewWeek": "Week 1 preview",
|
|
301
314
|
"hubFullGrid": "Full grid",
|
|
302
315
|
"detailTime": "Time",
|
|
303
316
|
"detailLocation": "Location",
|
|
304
317
|
"detailTeacher": "Teacher",
|
|
305
318
|
"detailWeeks": "Weeks",
|
|
306
|
-
"teacherSeparator": ", "
|
|
319
|
+
"teacherSeparator": ", ",
|
|
320
|
+
"noClassOnDay": "No classes on {weekday}",
|
|
321
|
+
"countdownDays": "in {days}d {hours}h",
|
|
322
|
+
"countdownHours": "in {hours}h {minutes}m",
|
|
323
|
+
"countdownMinutes": "in {minutes}m",
|
|
324
|
+
"weekTooSmall": "Too small for the whole week; showing one day",
|
|
325
|
+
"termPickerNeedsLogin": "Log in to the school system to switch terms.",
|
|
326
|
+
"termPickerLoginAction": "Log in",
|
|
327
|
+
"homeLoginCta": "Open {tab} and choose “{action}” to see your classes here.",
|
|
328
|
+
"helpSwitchDay": "Switch day",
|
|
329
|
+
"helpPickClass": "Pick a class",
|
|
330
|
+
"helpOpenClass": "Class details",
|
|
331
|
+
"footerDay": "day",
|
|
332
|
+
"footerClass": "class",
|
|
333
|
+
"footerDetail": "details"
|
|
307
334
|
},
|
|
308
335
|
"theme": {
|
|
309
336
|
"current": "Current theme settings",
|
|
310
|
-
"chooseAction": "Settings",
|
|
311
|
-
"chooseIconMode": "Choose icon mode:",
|
|
312
|
-
"chooseColorMode": "Choose color mode:",
|
|
313
337
|
"modeAuto": "Auto",
|
|
314
338
|
"modeAscii": "ASCII",
|
|
315
339
|
"modeUnicode": "Unicode",
|
|
@@ -321,7 +345,7 @@
|
|
|
321
345
|
"updated": "Theme setting updated",
|
|
322
346
|
"updatedSessionOnly": "Theme setting updated for this session only (failed to save config)",
|
|
323
347
|
"reset": "Theme settings reset",
|
|
324
|
-
"resetLabel": "Reset",
|
|
348
|
+
"resetLabel": "Reset to defaults",
|
|
325
349
|
"resetSessionOnly": "Theme settings reset for this session only (failed to save config)",
|
|
326
350
|
"usage": "Usage: nbtca theme | nbtca theme icon <auto|ascii|unicode> | nbtca theme color <auto|on|off> | nbtca theme reset",
|
|
327
351
|
"invalidValue": "Invalid value. Use one of:"
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"hint": "? 快捷键"
|
|
29
29
|
},
|
|
30
30
|
"menu": {
|
|
31
|
+
"home": "首页",
|
|
31
32
|
"events": "活动",
|
|
32
33
|
"eventsDesc": "近期活动安排",
|
|
33
34
|
"docs": "文档",
|
|
@@ -42,6 +43,8 @@
|
|
|
42
43
|
"settingsDesc": "语言 · 主题 · 关于",
|
|
43
44
|
"chooseAction": "nbtca",
|
|
44
45
|
"hintMove": "移动",
|
|
46
|
+
"hintTabs": "切换",
|
|
47
|
+
"hintBack": "返回",
|
|
45
48
|
"hintOpen": "打开",
|
|
46
49
|
"hintQuit": "退出"
|
|
47
50
|
},
|
|
@@ -80,10 +83,12 @@
|
|
|
80
83
|
"pastLoading": "正在加载历史活动...",
|
|
81
84
|
"pastEvents": "历史活动",
|
|
82
85
|
"pastEventsDesc": "近期活动记录",
|
|
83
|
-
"noPastEvents": "
|
|
86
|
+
"noPastEvents": "近一年没有已结束的活动",
|
|
84
87
|
"viewPastDetail": "选择活动查看详情:",
|
|
85
88
|
"next": "下一场",
|
|
86
|
-
"recentActivity": "
|
|
89
|
+
"recentActivity": "近期安排",
|
|
90
|
+
"browse": "浏览",
|
|
91
|
+
"next30Days": "近 30 天",
|
|
87
92
|
"inPrefix": "还有",
|
|
88
93
|
"startingNow": "即将开始",
|
|
89
94
|
"thisWeek": "本周",
|
|
@@ -95,7 +100,15 @@
|
|
|
95
100
|
"exportIcs": "导出 .ics",
|
|
96
101
|
"exportSuccess": "已保存",
|
|
97
102
|
"exportError": "无法写入 .ics 文件",
|
|
98
|
-
"recurringLabel": "循环"
|
|
103
|
+
"recurringLabel": "循环",
|
|
104
|
+
"searchNoResultsFor": "没有找到与“{query}”相关的活动",
|
|
105
|
+
"noEventsInRange": "这段时间没有活动安排",
|
|
106
|
+
"endedLabel": "已结束",
|
|
107
|
+
"duration": {
|
|
108
|
+
"days": "{days} 天 {hours} 小时",
|
|
109
|
+
"hours": "{hours} 小时 {minutes} 分钟",
|
|
110
|
+
"minutes": "{minutes} 分钟"
|
|
111
|
+
}
|
|
99
112
|
},
|
|
100
113
|
"docs": {
|
|
101
114
|
"loading": "正在加载文档列表...",
|
|
@@ -112,9 +125,9 @@
|
|
|
112
125
|
"chooseCategory": "文档",
|
|
113
126
|
"refreshCache": "刷新缓存",
|
|
114
127
|
"cacheCleared": "文档缓存已清除",
|
|
115
|
-
"
|
|
128
|
+
"stale": "离线,显示上次获取的文档",
|
|
116
129
|
"currentDir": "当前目录",
|
|
117
|
-
"chooseDoc": "
|
|
130
|
+
"chooseDoc": "选择文档或目录",
|
|
118
131
|
"emptyDir": "该目录为空",
|
|
119
132
|
"upToParent": "返回上级目录",
|
|
120
133
|
"returnToMenu": "返回主菜单",
|
|
@@ -125,7 +138,7 @@
|
|
|
125
138
|
"errorHint": "错误",
|
|
126
139
|
"openBrowserPrompt": "是否在浏览器中打开?",
|
|
127
140
|
"docCompleted": "文档加载完成",
|
|
128
|
-
"chooseAction": "
|
|
141
|
+
"chooseAction": "选择操作",
|
|
129
142
|
"opening": "正在打开浏览器...",
|
|
130
143
|
"browserOpened": "已在浏览器中打开知识库",
|
|
131
144
|
"browserError": "无法打开浏览器",
|
|
@@ -139,7 +152,7 @@
|
|
|
139
152
|
"githubTokenHint": "提示: 设置 GITHUB_TOKEN 环境变量可获得更高的速率限制。",
|
|
140
153
|
"fetchDirFailed": "无法获取目录内容: {error}",
|
|
141
154
|
"fetchFileFailed": "无法获取文件内容: {error}",
|
|
142
|
-
"searchPrompt": "
|
|
155
|
+
"searchPrompt": "搜索文档",
|
|
143
156
|
"searchPlaceholder": "输入关键词...",
|
|
144
157
|
"searching": "正在搜索文档...",
|
|
145
158
|
"searchResults": "个结果",
|
|
@@ -286,7 +299,7 @@
|
|
|
286
299
|
"classDone": "已结束",
|
|
287
300
|
"classLive": "进行中",
|
|
288
301
|
"minutesRemaining": "还剩 {minutes} 分钟",
|
|
289
|
-
"timelineEnd": "
|
|
302
|
+
"timelineEnd": "放学",
|
|
290
303
|
"termNotStarted": "本学期尚未开始",
|
|
291
304
|
"termStartsIn": "{date} 开学 · 还有 {days} 天",
|
|
292
305
|
"hubTermDensity": "学期活跃度",
|
|
@@ -296,20 +309,31 @@
|
|
|
296
309
|
"weekAheadClasses": "课程",
|
|
297
310
|
"weekAheadBusy": "较满",
|
|
298
311
|
"weekAheadFree": "较空",
|
|
299
|
-
"weekAheadNone": "
|
|
312
|
+
"weekAheadNone": "无安排",
|
|
300
313
|
"termPreviewWeek": "第一周预览",
|
|
301
314
|
"hubFullGrid": "完整课表",
|
|
302
315
|
"detailTime": "时间",
|
|
303
316
|
"detailLocation": "地点",
|
|
304
317
|
"detailTeacher": "教师",
|
|
305
318
|
"detailWeeks": "周次",
|
|
306
|
-
"teacherSeparator": "、"
|
|
319
|
+
"teacherSeparator": "、",
|
|
320
|
+
"noClassOnDay": "{weekday}没有课",
|
|
321
|
+
"countdownDays": "{days} 天 {hours} 小时后",
|
|
322
|
+
"countdownHours": "{hours} 小时 {minutes} 分钟后",
|
|
323
|
+
"countdownMinutes": "{minutes} 分钟后",
|
|
324
|
+
"weekTooSmall": "窗口太小,放不下整周课表,先按天显示",
|
|
325
|
+
"termPickerNeedsLogin": "切换学期需要先登录教务系统。",
|
|
326
|
+
"termPickerLoginAction": "登录教务系统",
|
|
327
|
+
"homeLoginCta": "到{tab}页选择“{action}”,这里就会显示你的课程。",
|
|
328
|
+
"helpSwitchDay": "切换星期",
|
|
329
|
+
"helpPickClass": "选择课程",
|
|
330
|
+
"helpOpenClass": "查看课程详情",
|
|
331
|
+
"footerDay": "星期",
|
|
332
|
+
"footerClass": "课程",
|
|
333
|
+
"footerDetail": "详情"
|
|
307
334
|
},
|
|
308
335
|
"theme": {
|
|
309
336
|
"current": "当前主题设置",
|
|
310
|
-
"chooseAction": "设置",
|
|
311
|
-
"chooseIconMode": "选择图标模式:",
|
|
312
|
-
"chooseColorMode": "选择颜色模式:",
|
|
313
337
|
"modeAuto": "自动",
|
|
314
338
|
"modeAscii": "ASCII",
|
|
315
339
|
"modeUnicode": "Unicode",
|
|
@@ -321,7 +345,7 @@
|
|
|
321
345
|
"updated": "主题设置已更新",
|
|
322
346
|
"updatedSessionOnly": "主题设置仅在当前会话生效(无法写入配置文件)",
|
|
323
347
|
"reset": "主题设置已重置",
|
|
324
|
-
"resetLabel": "
|
|
348
|
+
"resetLabel": "恢复默认",
|
|
325
349
|
"resetSessionOnly": "主题设置仅在当前会话重置(无法写入配置文件)",
|
|
326
350
|
"usage": "用法: nbtca theme | nbtca theme icon <auto|ascii|unicode> | nbtca theme color <auto|on|off> | nbtca theme reset",
|
|
327
351
|
"invalidValue": "无效取值,可选:"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nbtca/prompt",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -46,16 +46,10 @@
|
|
|
46
46
|
"interactive"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@nbtca/docs": "^0.3.
|
|
49
|
+
"@nbtca/docs": "^0.3.2",
|
|
50
50
|
"@nbtca/nbtcal": "^0.4.2",
|
|
51
51
|
"chalk": "^5.6.2",
|
|
52
|
-
"
|
|
53
|
-
"fetch-cookie": "^3.2.0",
|
|
54
|
-
"gradient-string": "^3.0.0",
|
|
55
|
-
"marked": "^15.0.12",
|
|
56
|
-
"marked-terminal": "^7.0.0",
|
|
57
|
-
"open": "^11.0.0",
|
|
58
|
-
"tough-cookie": "^6.0.2"
|
|
52
|
+
"marked": "^15.0.12"
|
|
59
53
|
},
|
|
60
54
|
"devDependencies": {
|
|
61
55
|
"@eslint/js": "^9.39.5",
|