@flecblog/core-nuxt 0.1.1 → 0.1.2

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.
Files changed (69) hide show
  1. package/{app.vue → app/app.vue} +5 -5
  2. package/{composables → app/composables}/api/article.ts +2 -2
  3. package/{composables → app/composables}/api/category.ts +1 -1
  4. package/{composables → app/composables}/api/comment.ts +2 -2
  5. package/{composables → app/composables}/api/createApi.ts +1 -1
  6. package/{composables → app/composables}/api/feedback.ts +1 -1
  7. package/{composables → app/composables}/api/friend.ts +1 -1
  8. package/{composables → app/composables}/api/moment.ts +2 -2
  9. package/{composables → app/composables}/api/music.ts +1 -1
  10. package/{composables → app/composables}/api/notification.ts +1 -1
  11. package/{composables → app/composables}/api/stats.ts +1 -1
  12. package/{composables → app/composables}/api/sysconfig.ts +1 -1
  13. package/{composables → app/composables}/api/tag.ts +1 -1
  14. package/{composables → app/composables}/api/theme.ts +1 -1
  15. package/{composables → app/composables}/api/user.ts +1 -1
  16. package/{composables → app/composables}/useArticle.ts +7 -7
  17. package/{composables → app/composables}/useAuth.ts +2 -2
  18. package/{composables → app/composables}/useComment.ts +1 -1
  19. package/{composables → app/composables}/useEmoji.ts +2 -2
  20. package/{composables → app/composables}/useFeedback.ts +2 -2
  21. package/{composables → app/composables}/useFriendList.ts +2 -2
  22. package/{composables → app/composables}/useMoment.ts +2 -2
  23. package/{composables → app/composables}/useMusic.ts +2 -2
  24. package/{composables → app/composables}/useSearchState.ts +2 -2
  25. package/{composables → app/composables}/useStores.ts +13 -13
  26. package/{composables → app/composables}/useTheme.ts +2 -2
  27. package/{composables → app/composables}/useUser.ts +2 -2
  28. package/{utils → app/utils}/avatar.ts +1 -1
  29. package/{utils → app/utils}/emoji.ts +1 -1
  30. package/{utils → app/utils}/markdown.ts +2 -2
  31. package/{utils → app/utils}/upload.ts +2 -2
  32. package/nuxt.config.ts +3 -13
  33. package/package.json +3 -11
  34. package/composables/useBindEmail.ts +0 -49
  35. package/composables/useLoginModal.ts +0 -20
  36. /package/{assets → app/assets}/css/base.scss +0 -0
  37. /package/{composables → app/composables}/api/subscribe.ts +0 -0
  38. /package/{composables → app/composables}/api/upload.ts +0 -0
  39. /package/{composables → app/composables}/useDarkMode.ts +0 -0
  40. /package/{composables → app/composables}/useMermaid.ts +0 -0
  41. /package/{composables → app/composables}/useSubscribe.ts +0 -0
  42. /package/{composables → app/composables}/useToast.ts +0 -0
  43. /package/{layouts → app/layouts}/default.vue +0 -0
  44. /package/{pages → app/pages}/index.vue +0 -0
  45. /package/{plugins → app/plugins}/console-banner.client.ts +0 -0
  46. /package/{plugins → app/plugins}/custom-code.ts +0 -0
  47. /package/{plugins → app/plugins}/syncThemeMeta.ts +0 -0
  48. /package/{plugins → app/plugins}/tracker.client.ts +0 -0
  49. /package/{types → app/types}/article.ts +0 -0
  50. /package/{types → app/types}/auth.ts +0 -0
  51. /package/{types → app/types}/category.ts +0 -0
  52. /package/{types → app/types}/comment.ts +0 -0
  53. /package/{types → app/types}/emoji.ts +0 -0
  54. /package/{types → app/types}/feedback.ts +0 -0
  55. /package/{types → app/types}/friend.ts +0 -0
  56. /package/{types → app/types}/markdown.ts +0 -0
  57. /package/{types → app/types}/moment.ts +0 -0
  58. /package/{types → app/types}/notification.ts +0 -0
  59. /package/{types → app/types}/request.ts +0 -0
  60. /package/{types → app/types}/stats.ts +0 -0
  61. /package/{types → app/types}/sysconfig.ts +0 -0
  62. /package/{types → app/types}/tag.ts +0 -0
  63. /package/{types → app/types}/theme.ts +0 -0
  64. /package/{types → app/types}/upload.ts +0 -0
  65. /package/{types → app/types}/user.ts +0 -0
  66. /package/{utils → app/utils}/date.ts +0 -0
  67. /package/{utils → app/utils}/download.ts +0 -0
  68. /package/{utils → app/utils}/format.ts +0 -0
  69. /package/{utils → app/utils}/scroll.ts +0 -0
@@ -1,9 +1,9 @@
1
1
  <script setup lang="ts">
2
- import { getCategories } from '@/composables/api/category';
3
- import { getTags } from '@/composables/api/tag';
4
- import { getSiteStats } from '@/composables/api/stats';
5
- import { getSettingGroup } from '@/composables/api/sysconfig';
6
- import { getActiveThemeSchema } from '@/composables/api/theme';
2
+ import { getCategories } from './composables/api/category';
3
+ import { getTags } from './composables/api/tag';
4
+ import { getSiteStats } from './composables/api/stats';
5
+ import { getSettingGroup } from './composables/api/sysconfig';
6
+ import { getActiveThemeSchema } from './composables/api/theme';
7
7
 
8
8
  // 全局数据
9
9
  const { basicConfig, oauthConfig, uploadConfig } = useSysConfig();
@@ -1,5 +1,5 @@
1
- import type { Article, ArticleQuery } from '@@/types/article';
2
- import type { PaginationData } from '@@/types/request';
1
+ import type { Article, ArticleQuery } from '../../types/article';
2
+ import type { PaginationData } from '../../types/request';
3
3
  import { createApi } from './createApi';
4
4
 
5
5
  const articleApi = createApi<Article>('/articles');
@@ -1,4 +1,4 @@
1
- import type { Category } from '@@/types/category';
1
+ import type { Category } from '../../types/category';
2
2
  import { createApi } from './createApi';
3
3
 
4
4
  const categoryApi = createApi<Category>('/categories');
@@ -1,5 +1,5 @@
1
- import type { Comment, CommentTargetType, CreateCommentParams } from '@@/types/comment';
2
- import type { PaginationQuery } from '@@/types/request';
1
+ import type { Comment, CommentTargetType, CreateCommentParams } from '../../types/comment';
2
+ import type { PaginationQuery } from '../../types/request';
3
3
  import { createApi } from './createApi';
4
4
 
5
5
  interface GetCommentsParams extends PaginationQuery {
@@ -1,7 +1,7 @@
1
1
  import { $fetch } from 'ofetch';
2
2
  import type { FetchOptions } from 'ofetch';
3
3
  import { accessToken, setAccessToken, logout } from '../useAuth';
4
- import type { ApiResponse, PaginationData, PaginationQuery } from '@@/types/request';
4
+ import type { ApiResponse, PaginationData, PaginationQuery } from '../../types/request';
5
5
 
6
6
  // ========== HTTP 请求基础设施 ==========
7
7
 
@@ -1,4 +1,4 @@
1
- import type { Feedback, SubmitFeedbackParams } from '@@/types/feedback';
1
+ import type { Feedback, SubmitFeedbackParams } from '../../types/feedback';
2
2
  import { createApi } from './createApi';
3
3
 
4
4
  const feedbackApi = createApi<Feedback>('');
@@ -1,4 +1,4 @@
1
- import type { FriendGroupedResponse, FriendQueryParams, FriendApplyRequest } from '@@/types/friend';
1
+ import type { FriendGroupedResponse, FriendQueryParams, FriendApplyRequest } from '../../types/friend';
2
2
  import { createApi } from './createApi';
3
3
 
4
4
  const friendApi = createApi<FriendGroupedResponse>('');
@@ -1,5 +1,5 @@
1
- import type { Moment } from '@@/types/moment';
2
- import type { PaginationQuery } from '@@/types/request';
1
+ import type { Moment } from '../../types/moment';
2
+ import type { PaginationQuery } from '../../types/request';
3
3
  import { createApi } from './createApi';
4
4
 
5
5
  const momentApi = createApi<Moment>('/moments');
@@ -1,4 +1,4 @@
1
- import type { MusicTrack } from '@@/types/moment';
1
+ import type { MusicTrack } from '../../types/moment';
2
2
 
3
3
  interface MusicApiResponse {
4
4
  name?: string;
@@ -1,4 +1,4 @@
1
- import type { NotificationListResponse, GetNotificationsParams } from '@@/types/notification';
1
+ import type { NotificationListResponse, GetNotificationsParams } from '../../types/notification';
2
2
  import { createApi } from './createApi';
3
3
 
4
4
  const notificationApi = createApi<NotificationListResponse>('');
@@ -1,4 +1,4 @@
1
- import type { SiteStats, ArchiveStats } from '@@/types/stats';
1
+ import type { SiteStats, ArchiveStats } from '../../types/stats';
2
2
  import { createApi } from './createApi';
3
3
 
4
4
  const statsApi = createApi<SiteStats>('');
@@ -1,4 +1,4 @@
1
- import type { SettingGroupType } from '@@/types/sysconfig';
1
+ import type { SettingGroupType } from '../../types/sysconfig';
2
2
  import { createApi } from './createApi';
3
3
 
4
4
  const settingApi = createApi<Record<string, string>>('');
@@ -1,4 +1,4 @@
1
- import type { Tag } from '@@/types/tag';
1
+ import type { Tag } from '../../types/tag';
2
2
  import { createApi } from './createApi';
3
3
 
4
4
  const tagApi = createApi<Tag>('/tags');
@@ -1,4 +1,4 @@
1
- import type { ThemeSchemaResponse } from '@@/types/theme';
1
+ import type { ThemeSchemaResponse } from '../../types/theme';
2
2
  import { createApi } from './createApi';
3
3
 
4
4
  const themeApi = createApi<ThemeSchemaResponse>('/themes');
@@ -10,7 +10,7 @@ import type {
10
10
  ChangePasswordParams,
11
11
  DeactivateAccountParams,
12
12
  RefreshTokenResponse,
13
- } from '@@/types/user';
13
+ } from '../../types/user';
14
14
  import { createApi } from './createApi';
15
15
 
16
16
  const authApi = createApi<LoginResponse>('/auth');
@@ -2,13 +2,13 @@ import {
2
2
  getArticlesForWeb,
3
3
  getArticleBySlug,
4
4
  getRandomArticleSlug as getRandomSlugApi,
5
- } from '@/composables/api/article';
6
- import { getCategoryBySlug } from '@/composables/api/category';
7
- import { getTagBySlug } from '@/composables/api/tag';
8
- import { countWords, estimateReadingTime } from '@/utils/markdown';
9
- import type { Article, ArticleQuery } from '@@/types/article';
10
- import type { Category } from '@@/types/category';
11
- import type { Tag } from '@@/types/tag';
5
+ } from './api/article';
6
+ import { getCategoryBySlug } from './api/category';
7
+ import { getTagBySlug } from './api/tag';
8
+ import { countWords, estimateReadingTime } from '../utils/markdown';
9
+ import type { Article, ArticleQuery } from '../types/article';
10
+ import type { Category } from '../types/category';
11
+ import type { Tag } from '../types/tag';
12
12
 
13
13
  export function useArticles() {
14
14
  const articles = useState<Article[]>('articles', () => []);
@@ -1,5 +1,5 @@
1
- import type { ApiResponse } from '@@/types/request';
2
- import type { WechatQRState } from '@@/types/auth';
1
+ import type { ApiResponse } from '../types/request';
2
+ import type { WechatQRState } from '../types/auth';
3
3
 
4
4
  const ACCESS_TOKEN_KEY = 'access_token';
5
5
 
@@ -1,4 +1,4 @@
1
- import type { Comment, CommentTargetType, FlatComment, GuestInfo } from '@@/types/comment';
1
+ import type { Comment, CommentTargetType, FlatComment, GuestInfo } from '../types/comment';
2
2
 
3
3
  export function flattenComments(commentList: Comment[], depth = 0): FlatComment[] {
4
4
  const result: FlatComment[] = [];
@@ -1,5 +1,5 @@
1
- import type { EmojiGroup } from '@@/types/emoji';
2
- import { loadAllEmojiGroups, getAllEmojiGroupsSync } from '@/utils/emoji';
1
+ import type { EmojiGroup } from '../types/emoji';
2
+ import { loadAllEmojiGroups, getAllEmojiGroupsSync } from '../utils/emoji';
3
3
 
4
4
  export function useEmoji() {
5
5
  const { basicConfig } = useSysConfig();
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  submitFeedback as submitFeedbackApi,
3
3
  getFeedbackByTicketNo as getFeedbackApi,
4
- } from '@/composables/api/feedback';
5
- import type { SubmitFeedbackParams, Feedback } from '@@/types/feedback';
4
+ } from './api/feedback';
5
+ import type { SubmitFeedbackParams, Feedback } from '../types/feedback';
6
6
 
7
7
  export function useFeedback() {
8
8
  const loading = ref(false);
@@ -1,5 +1,5 @@
1
- import { getFriends, applyFriend as applyFriendApi } from '@/composables/api/friend';
2
- import type { Friend, FriendGroup, FriendApplyRequest } from '@@/types/friend';
1
+ import { getFriends, applyFriend as applyFriendApi } from './api/friend';
2
+ import type { Friend, FriendGroup, FriendApplyRequest } from '../types/friend';
3
3
 
4
4
  export function useFriendList() {
5
5
  const friends = useState<Friend[]>('friends', () => []);
@@ -1,5 +1,5 @@
1
- import { getMoments } from '@/composables/api/moment';
2
- import type { Moment } from '@@/types/moment';
1
+ import { getMoments } from './api/moment';
2
+ import type { Moment } from '../types/moment';
3
3
 
4
4
  export function useMoments() {
5
5
  const moments = useState<Moment[]>('moments', () => []);
@@ -1,5 +1,5 @@
1
- import type { MusicTrack, LyricLine } from '@@/types/moment';
2
- import { fetchMetingMusic, fetchLyricsText } from '@/composables/api/music';
1
+ import type { MusicTrack, LyricLine } from '../types/moment';
2
+ import { fetchMetingMusic, fetchLyricsText } from './api/music';
3
3
 
4
4
  export function useMusic() {
5
5
  const fetchTracks = async (
@@ -1,5 +1,5 @@
1
- import { searchArticles } from '@/composables/api/article';
2
- import type { Article } from '@@/types/article';
1
+ import { searchArticles } from './api/article';
2
+ import type { Article } from '../types/article';
3
3
 
4
4
  export function useSearchState() {
5
5
  const keyword = ref('');
@@ -1,16 +1,16 @@
1
- import { getComments, createComment, deleteComment } from '@/composables/api/comment';
2
- import { getNotifications, markAsRead, markAllAsRead } from '@/composables/api/notification';
3
- import { getCategories } from '@/composables/api/category';
4
- import { getTags } from '@/composables/api/tag';
5
- import { getArticlesForWeb } from '@/composables/api/article';
6
- import { getSiteStats, getArchiveStats } from '@/composables/api/stats';
7
- import type { Article } from '@@/types/article';
8
- import type { Category } from '@@/types/category';
9
- import type { Comment, CreateCommentParams, CommentTargetType } from '@@/types/comment';
10
- import type { Menu } from '@@/types/theme';
11
- import type { Notification, GetNotificationsParams } from '@@/types/notification';
12
- import type { ArchiveItem, SiteStats } from '@@/types/stats';
13
- import type { Tag } from '@@/types/tag';
1
+ import { getComments, createComment, deleteComment } from './api/comment';
2
+ import { getNotifications, markAsRead, markAllAsRead } from './api/notification';
3
+ import { getCategories } from './api/category';
4
+ import { getTags } from './api/tag';
5
+ import { getArticlesForWeb } from './api/article';
6
+ import { getSiteStats, getArchiveStats } from './api/stats';
7
+ import type { Article } from '../types/article';
8
+ import type { Category } from '../types/category';
9
+ import type { Comment, CreateCommentParams, CommentTargetType } from '../types/comment';
10
+ import type { Menu } from '../types/theme';
11
+ import type { Notification, GetNotificationsParams } from '../types/notification';
12
+ import type { ArchiveItem, SiteStats } from '../types/stats';
13
+ import type { Tag } from '../types/tag';
14
14
 
15
15
  // ============================================================
16
16
  // 文章状态
@@ -1,5 +1,5 @@
1
- import type { ThemeState } from '@@/types/theme';
2
- import { getActiveThemeSchema } from '@/composables/api/theme';
1
+ import type { ThemeState } from '../types/theme';
2
+ import { getActiveThemeSchema } from './api/theme';
3
3
 
4
4
  export function useTheme() {
5
5
  const theme = useState<ThemeState>('active-theme', () => ({
@@ -9,7 +9,7 @@ import type {
9
9
  UpdateProfileParams,
10
10
  LoginResponse,
11
11
  RegisterResponse,
12
- } from '@@/types/user';
12
+ } from '../types/user';
13
13
  import {
14
14
  getUserProfile,
15
15
  updateUserProfile as updateProfileApi,
@@ -22,7 +22,7 @@ import {
22
22
  deactivateAccount as deactivateAccountApi,
23
23
  unbindOAuth as unbindOAuthApi,
24
24
  pollWechatLoginStatus as pollWechatApi,
25
- } from '@/composables/api/user';
25
+ } from './api/user';
26
26
 
27
27
  const userInfo = ref<UserInfo | null>(null);
28
28
 
@@ -1,4 +1,4 @@
1
- import { useSysConfig } from '@/composables/useStores';
1
+ import { useSysConfig } from '../composables/useStores';
2
2
 
3
3
  const DEFAULT_CRAVATAR_URL = 'https://cravatar.cn/avatar/%s?s=200&d=robohash';
4
4
 
@@ -1,4 +1,4 @@
1
- import type { EmojiGroup } from '@@/types/emoji';
1
+ import type { EmojiGroup } from '../types/emoji';
2
2
 
3
3
  let emojiMapCache: Map<string, string> | null = null;
4
4
  let emojiLoadPromise: Promise<Map<string, string>> | null = null;
@@ -1,5 +1,5 @@
1
1
  import MarkdownIt from 'markdown-it';
2
- import type { TocItem } from '@@/types/markdown';
2
+ import type { TocItem } from '../types/markdown';
3
3
  import anchor from 'markdown-it-anchor';
4
4
  // @ts-expect-error 该第三方库缺少 TypeScript 类型定义文件
5
5
  import taskLists from 'markdown-it-task-lists';
@@ -22,7 +22,7 @@ import {
22
22
  loadAllEmojiGroups,
23
23
  getEmojiMapSync,
24
24
  replaceEmojisInText,
25
- } from '@/utils/emoji';
25
+ } from './emoji';
26
26
 
27
27
  // highlight.js 按需加载
28
28
  import hljs from 'highlight.js/lib/core';
@@ -1,5 +1,5 @@
1
- import { uploadFileApi } from '@/composables/api/upload';
2
- import type { UploadResponse } from '@@/types/upload';
1
+ import { uploadFileApi } from '../composables/api/upload';
2
+ import type { UploadResponse } from '../types/upload';
3
3
 
4
4
  export function getMaxFileSizeMB(): number {
5
5
  try {
package/nuxt.config.ts CHANGED
@@ -2,27 +2,17 @@ import { dirname, resolve } from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
3
 
4
4
  const __dirname = dirname(fileURLToPath(import.meta.url));
5
- const layerRoot = resolve(__dirname);
5
+ const layerRoot = resolve(__dirname, 'app');
6
6
 
7
7
  export default defineNuxtConfig({
8
8
  compatibilityDate: '2025-07-15',
9
9
  ssr: true,
10
10
  features: { inlineStyles: true },
11
11
 
12
- alias: {
13
- '@@': layerRoot,
14
- '@': layerRoot,
15
- },
16
-
17
12
  typescript: {
18
13
  tsConfig: {
19
14
  compilerOptions: {
20
- paths: {
21
- '@@': [layerRoot],
22
- '@@/*': [resolve(layerRoot, './*')],
23
- '@': [layerRoot],
24
- '@/*': [resolve(layerRoot, './*')],
25
- },
15
+ paths: {},
26
16
  },
27
17
  },
28
18
  },
@@ -63,7 +53,7 @@ export default defineNuxtConfig({
63
53
  ],
64
54
  ],
65
55
 
66
- css: ['@/assets/css/base.scss', 'remixicon/fonts/remixicon.css'],
56
+ css: [resolve(layerRoot, 'assets/css/base.scss'), 'remixicon/fonts/remixicon.css'],
67
57
 
68
58
  site: {
69
59
  url: '',
package/package.json CHANGED
@@ -1,21 +1,13 @@
1
1
  {
2
2
  "name": "@flecblog/core-nuxt",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "FlecBlog Nuxt Layer(共享核心)",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
7
7
  "files": [
8
8
  "nuxt.config.ts",
9
- "app.vue",
10
- "composables",
11
- "plugins",
12
- "components",
13
- "layouts",
14
- "pages",
15
- "server",
16
- "assets",
17
- "utils",
18
- "types"
9
+ "app/",
10
+ "server/"
19
11
  ],
20
12
  "dependencies": {
21
13
  "@traptitech/markdown-it-katex": "^3.6.0",
@@ -1,49 +0,0 @@
1
- /**
2
- * 邮箱绑定弹窗状态管理
3
- */
4
- export function useBindEmail() {
5
- const showBindEmailModal = useState<boolean>('showBindEmailModal', () => false)
6
- const hasTriggeredGlobal = useState<boolean>('hasTriggeredGlobalBindEmail', () => false)
7
-
8
- const openBindEmailModal = () => {
9
- showBindEmailModal.value = true
10
- }
11
-
12
- const closeBindEmailModal = () => {
13
- showBindEmailModal.value = false
14
- }
15
-
16
- /**
17
- * 全局触发邮箱绑定提示(路由切换时调用,但只触发一次)
18
- */
19
- const triggerGlobal = () => {
20
- // 如果已经触发过全局提示,不再重复触发
21
- if (hasTriggeredGlobal.value) return
22
-
23
- const { isLoggedIn, user } = useAuth()
24
-
25
- // 仅在用户已登录但未绑定邮箱时触发
26
- if (isLoggedIn.value && user.value && !user.value.email) {
27
- openBindEmailModal()
28
- hasTriggeredGlobal.value = true
29
- }
30
- }
31
-
32
- /**
33
- * 绑定成功后的回调
34
- */
35
- const onBindSuccess = () => {
36
- closeBindEmailModal()
37
- // 刷新用户信息
38
- const { refreshUser } = useAuth()
39
- refreshUser()
40
- }
41
-
42
- return {
43
- showBindEmailModal,
44
- openBindEmailModal,
45
- closeBindEmailModal,
46
- triggerGlobal,
47
- onBindSuccess,
48
- }
49
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * 登录弹窗状态管理
3
- */
4
- export function useLoginModal() {
5
- const showLoginModal = useState<boolean>('showLoginModal', () => false)
6
-
7
- const openLoginModal = () => {
8
- showLoginModal.value = true
9
- }
10
-
11
- const closeLoginModal = () => {
12
- showLoginModal.value = false
13
- }
14
-
15
- return {
16
- showLoginModal,
17
- openLoginModal,
18
- closeLoginModal,
19
- }
20
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes