@campus-admin/core 2.0.9 → 2.1.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.
@@ -0,0 +1,143 @@
1
+ import { nextTick as e, watch as t } from "vue";
2
+ import { frameworkMessages as n } from "@campus-admin/locale";
3
+ import { createI18n as r, useI18n as i } from "vue-i18n";
4
+ import { ElLoading as a, ElMessage as o, ElMessageBox as s, ElNotification as c } from "element-plus";
5
+ import "element-plus/es/components/loading/style/css";
6
+ import "element-plus/es/components/notification/style/css";
7
+ import "element-plus/es/components/message/style/css";
8
+ import "element-plus/es/components/message-box/style/css";
9
+ // packages/core/src/storage.ts
10
+ var l = "ca:";
11
+ function u(e, t = "local") {
12
+ try {
13
+ return (t === "local" ? localStorage : sessionStorage).getItem(l + e);
14
+ } catch {
15
+ return null;
16
+ }
17
+ }
18
+ function d(e, t, n = "local") {
19
+ try {
20
+ let r = n === "local" ? localStorage : sessionStorage;
21
+ t === null ? r.removeItem(l + e) : r.setItem(l + e, t);
22
+ } catch {}
23
+ }
24
+ function f(e, t = "local") {
25
+ let n = u(e, t);
26
+ if (n) try {
27
+ return JSON.parse(n);
28
+ } catch {
29
+ return;
30
+ }
31
+ }
32
+ function p(e, t, n = "local") {
33
+ d(e, JSON.stringify(t), n);
34
+ }
35
+ // packages/core/src/i18n.ts
36
+ var m = (e) => typeof e == "object" && !!e && !Array.isArray(e);
37
+ function h(e, t) {
38
+ let n = { ...e };
39
+ for (let [e, r] of Object.entries(t)) {
40
+ let t = n[e];
41
+ n[e] = m(t) && m(r) ? h(t, r) : r;
42
+ }
43
+ return n;
44
+ }
45
+ var g = "locale";
46
+ function _(e) {
47
+ return e === "zh-CN" || e === "en-US";
48
+ }
49
+ function v(e) {
50
+ let i = u(g), a = _(i) ? i : e.defaultLocale ?? "zh-CN", o = Object.fromEntries(["zh-CN", "en-US"].map((t) => [t, h(n[t], e.messages?.[t] ?? {})])), s = r({
51
+ legacy: !1,
52
+ locale: a,
53
+ fallbackLocale: "zh-CN",
54
+ messages: o
55
+ });
56
+ return typeof document < "u" && t(() => s.global.locale.value, (e) => {
57
+ document.documentElement.lang = e;
58
+ }, { immediate: !0 }), y = s, s;
59
+ }
60
+ var y;
61
+ function b(e, t) {
62
+ return y ? y.global.t(e, t ?? {}) : e;
63
+ }
64
+ function x(e) {
65
+ d(g, e);
66
+ }
67
+ function S() {
68
+ let { t: e, te: t, locale: n } = i();
69
+ return {
70
+ t: e,
71
+ te: t,
72
+ label: (n) => t(n) ? e(n) : n,
73
+ locale: n
74
+ };
75
+ }
76
+ // \0plugin-vue:export-helper
77
+ var C = (e, t) => {
78
+ let n = e.__vccOpts || e;
79
+ for (let [e, r] of t) n[e] = r;
80
+ return n;
81
+ }, w = (e) => e;
82
+ function T(e) {
83
+ w = e;
84
+ }
85
+ async function E(e, t = {}) {
86
+ await s.alert(e, t.title ?? w("campus.common.tip"), {
87
+ type: t.type ?? "info",
88
+ confirmButtonText: t.confirmText ?? w("campus.common.ok")
89
+ });
90
+ }
91
+ async function D(e, t = {}) {
92
+ try {
93
+ return await s.confirm(e, t.title ?? w("campus.common.tip"), {
94
+ type: t.type ?? "warning",
95
+ confirmButtonText: t.confirmText ?? w("campus.common.confirm"),
96
+ cancelButtonText: t.cancelText ?? w("campus.common.cancel")
97
+ }), !0;
98
+ } catch (e) {
99
+ if (e === "cancel" || e === "close") return !1;
100
+ throw e;
101
+ }
102
+ }
103
+ var O = {
104
+ info: (e) => void o({
105
+ message: e,
106
+ type: "info"
107
+ }),
108
+ success: (e) => void o({
109
+ message: e,
110
+ type: "success"
111
+ }),
112
+ warning: (e) => void o({
113
+ message: e,
114
+ type: "warning"
115
+ }),
116
+ error: (e) => void o({
117
+ message: e,
118
+ type: "error"
119
+ })
120
+ }, k = a.service;
121
+ function A(t, n, r = {}) {
122
+ let i = c({
123
+ ...r,
124
+ title: r.title ?? w(`campus.notify.${t}`),
125
+ message: n,
126
+ type: t
127
+ });
128
+ return e(() => c.updateOffsets(r.position)), i;
129
+ }
130
+ // packages/core/src/services/ca.ts
131
+ var j = {
132
+ alert: E,
133
+ confirm: D,
134
+ toast: O,
135
+ loading: k,
136
+ notify: {
137
+ success: (e, t) => A("success", e, t),
138
+ info: (e, t) => A("info", e, t),
139
+ warning: (e, t) => A("warning", e, t),
140
+ error: (e, t) => A("error", e, t)
141
+ }
142
+ };
143
+ export { x as a, f as c, d, v as i, u as l, T as n, b as o, C as r, S as s, j as t, p as u };
package/dist/i18n.d.ts CHANGED
@@ -8,6 +8,89 @@ import type { CampusOptions } from './types.js';
8
8
  export declare function createCampusI18n(options: CampusOptions): import("vue-i18n").I18n<{
9
9
  'zh-CN': {
10
10
  campus: {
11
+ quickChat: {
12
+ title: string;
13
+ select: string;
14
+ loadFailed: string;
15
+ sendFailed: string;
16
+ retry: string;
17
+ you: string;
18
+ assistant: string;
19
+ message: string;
20
+ placeholder: string;
21
+ send: string;
22
+ };
23
+ personalTools: {
24
+ notes: string;
25
+ closeNotes: string;
26
+ notesList: string;
27
+ dock: string;
28
+ blank: string;
29
+ noteTitle: string;
30
+ noteBody: string;
31
+ notePlaceholder: string;
32
+ colors: string;
33
+ currentColor: string;
34
+ colorName: string;
35
+ expand: string;
36
+ dragNote: string;
37
+ collapse: string;
38
+ returnNote: string;
39
+ pin: string;
40
+ newNote: string;
41
+ emptyNotes: string;
42
+ hideNotes: string;
43
+ showNotes: string;
44
+ hiddenNotes: string;
45
+ shownNotes: string;
46
+ markLine: string;
47
+ noteTooLong: string;
48
+ notesDisabled: string;
49
+ removeNote: string;
50
+ retry: string;
51
+ remove: string;
52
+ unsaved: string;
53
+ saveError: string;
54
+ saveDetail: string;
55
+ failure: string;
56
+ todo: string;
57
+ closeTodo: string;
58
+ todoPanel: string;
59
+ todoTitle: string;
60
+ todoColor: string;
61
+ changeColor: string;
62
+ activeColor: string;
63
+ drag: string;
64
+ reorder: string;
65
+ search: string;
66
+ searchTodo: string;
67
+ hideDone: string;
68
+ showDone: string;
69
+ close: string;
70
+ newTodo: string;
71
+ maxTodos: string;
72
+ add: string;
73
+ complete: string;
74
+ undoComplete: string;
75
+ editTodo: string;
76
+ editDue: string;
77
+ setDue: string;
78
+ dueDate: string;
79
+ dueTime: string;
80
+ clearDue: string;
81
+ doneDue: string;
82
+ noMatch: string;
83
+ allDone: string;
84
+ emptyTodo: string;
85
+ todoSave: string;
86
+ todoSaveDetail: string;
87
+ yellow: string;
88
+ pink: string;
89
+ green: string;
90
+ blue: string;
91
+ purple: string;
92
+ gray: string;
93
+ };
11
94
  doc: {
12
95
  sheetjsDependency: string;
13
96
  title: string;
@@ -217,6 +300,89 @@ export declare function createCampusI18n(options: CampusOptions): import("vue-i1
217
300
  };
218
301
  'en-US': {
219
302
  campus: {
303
+ quickChat: {
304
+ title: string;
305
+ select: string;
306
+ loadFailed: string;
307
+ sendFailed: string;
308
+ retry: string;
309
+ you: string;
310
+ assistant: string;
311
+ message: string;
312
+ placeholder: string;
313
+ send: string;
314
+ };
315
+ personalTools: {
316
+ notes: string;
317
+ closeNotes: string;
318
+ notesList: string;
319
+ dock: string;
320
+ blank: string;
321
+ noteTitle: string;
322
+ noteBody: string;
323
+ notePlaceholder: string;
324
+ colors: string;
325
+ currentColor: string;
326
+ colorName: string;
327
+ expand: string;
328
+ dragNote: string;
329
+ collapse: string;
330
+ returnNote: string;
331
+ pin: string;
332
+ newNote: string;
333
+ emptyNotes: string;
334
+ hideNotes: string;
335
+ showNotes: string;
336
+ hiddenNotes: string;
337
+ shownNotes: string;
338
+ markLine: string;
339
+ noteTooLong: string;
340
+ notesDisabled: string;
341
+ removeNote: string;
342
+ retry: string;
343
+ remove: string;
344
+ unsaved: string;
345
+ saveError: string;
346
+ saveDetail: string;
347
+ failure: string;
348
+ todo: string;
349
+ closeTodo: string;
350
+ todoPanel: string;
351
+ todoTitle: string;
352
+ todoColor: string;
353
+ changeColor: string;
354
+ activeColor: string;
355
+ drag: string;
356
+ reorder: string;
357
+ search: string;
358
+ searchTodo: string;
359
+ hideDone: string;
360
+ showDone: string;
361
+ close: string;
362
+ newTodo: string;
363
+ maxTodos: string;
364
+ add: string;
365
+ complete: string;
366
+ undoComplete: string;
367
+ editTodo: string;
368
+ editDue: string;
369
+ setDue: string;
370
+ dueDate: string;
371
+ dueTime: string;
372
+ clearDue: string;
373
+ doneDue: string;
374
+ noMatch: string;
375
+ allDone: string;
376
+ emptyTodo: string;
377
+ todoSave: string;
378
+ todoSaveDetail: string;
379
+ yellow: string;
380
+ pink: string;
381
+ green: string;
382
+ blue: string;
383
+ purple: string;
384
+ gray: string;
385
+ };
220
386
  doc: {
221
387
  sheetjsDependency: string;
222
388
  title: string;
package/dist/index.d.ts CHANGED
@@ -20,6 +20,11 @@ export { useLayoutStore } from './stores/layout.js';
20
20
  export { useTabsStore } from './stores/tabs.js';
21
21
  export { useThemeStore } from './stores/theme.js';
22
22
  export type * from './types.js';
23
+ export type { HeaderAppearance, HeaderBrandProps, HeaderTool, HeaderToolItem } from './layout/header-tools.js';
24
+ export type * from './layout/quick-chat/types.js';
25
+ export { default as CaHeaderBrand } from './layout/CaHeaderBrand.vue';
26
+ export { default as CaQuickChat } from './layout/quick-chat/CaQuickChat.vue';
27
+ export type { PersonalNote, PersonalNotePatch, PersonalNoteSettings, PersonalNotesPlacement, PersonalTodoItem, PersonalTodos, PersonalToolAction, PersonalToolShortcut, PersonalToolsOptions } from './layout/personal-tools/types.js';
23
28
  export * from '@campus-admin/ui';
24
29
  export type { LocaleCode } from '@campus-admin/locale';
25
30
  export type { LoginBackground, ThemeField, ThemeInput, ThemeLayer, ThemeLayers, ThemeMode } from '@campus-admin/theme';