@lark-apaas/coding-template-nestjs-react-fullstack 0.1.36-alpha.20260903095202 → 0.1.36-alpha.20260903185731

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 (112) hide show
  1. package/package.json +1 -1
  2. package/template/client/src/components/ui/markdown.tsx +43 -0
  3. package/template/client/src/index.css +0 -1
  4. package/template/package-lock.json +5783 -13022
  5. package/template/package.json +5 -68
  6. package/template/client/src/components/business-ui/README.md +0 -519
  7. package/template/client/src/components/business-ui/api/chats/queries.ts +0 -39
  8. package/template/client/src/components/business-ui/api/chats/service.ts +0 -29
  9. package/template/client/src/components/business-ui/api/departments/queries.ts +0 -42
  10. package/template/client/src/components/business-ui/api/departments/service.ts +0 -18
  11. package/template/client/src/components/business-ui/api/files/service.ts +0 -28
  12. package/template/client/src/components/business-ui/api/user-profiles/queries.ts +0 -42
  13. package/template/client/src/components/business-ui/api/user-profiles/service.ts +0 -23
  14. package/template/client/src/components/business-ui/api/users/queries.ts +0 -34
  15. package/template/client/src/components/business-ui/api/users/service.ts +0 -40
  16. package/template/client/src/components/business-ui/chat-select/README.md +0 -128
  17. package/template/client/src/components/business-ui/chat-select/chat-item.tsx +0 -85
  18. package/template/client/src/components/business-ui/chat-select/chat-select-tag.tsx +0 -83
  19. package/template/client/src/components/business-ui/chat-select/chat-select.tsx +0 -197
  20. package/template/client/src/components/business-ui/chat-select/index.tsx +0 -12
  21. package/template/client/src/components/business-ui/chat-select/types.ts +0 -102
  22. package/template/client/src/components/business-ui/chat-select/use-chat-value.ts +0 -180
  23. package/template/client/src/components/business-ui/chat-select/utils.ts +0 -81
  24. package/template/client/src/components/business-ui/department-select/department-item.tsx +0 -55
  25. package/template/client/src/components/business-ui/department-select/department-select-field.tsx +0 -86
  26. package/template/client/src/components/business-ui/department-select/department-select-tag.tsx +0 -56
  27. package/template/client/src/components/business-ui/department-select/department-select.tsx +0 -168
  28. package/template/client/src/components/business-ui/department-select/icon-department.tsx +0 -22
  29. package/template/client/src/components/business-ui/department-select/index.tsx +0 -7
  30. package/template/client/src/components/business-ui/department-select/types.ts +0 -15
  31. package/template/client/src/components/business-ui/department-select/utils.ts +0 -17
  32. package/template/client/src/components/business-ui/entity-combobox/base-combobox-content.tsx +0 -35
  33. package/template/client/src/components/business-ui/entity-combobox/base-combobox-empty.tsx +0 -28
  34. package/template/client/src/components/business-ui/entity-combobox/base-combobox-error.tsx +0 -35
  35. package/template/client/src/components/business-ui/entity-combobox/base-combobox-item.tsx +0 -55
  36. package/template/client/src/components/business-ui/entity-combobox/base-combobox-list.tsx +0 -174
  37. package/template/client/src/components/business-ui/entity-combobox/base-combobox-loading.tsx +0 -19
  38. package/template/client/src/components/business-ui/entity-combobox/base-combobox-search.tsx +0 -31
  39. package/template/client/src/components/business-ui/entity-combobox/base-combobox-trigger.tsx +0 -281
  40. package/template/client/src/components/business-ui/entity-combobox/base-combobox.tsx +0 -132
  41. package/template/client/src/components/business-ui/entity-combobox/context.tsx +0 -19
  42. package/template/client/src/components/business-ui/entity-combobox/entity-combobox.tsx +0 -145
  43. package/template/client/src/components/business-ui/entity-combobox/highlight-text.tsx +0 -52
  44. package/template/client/src/components/business-ui/entity-combobox/hooks.tsx +0 -21
  45. package/template/client/src/components/business-ui/entity-combobox/index.tsx +0 -31
  46. package/template/client/src/components/business-ui/entity-combobox/item-pill.tsx +0 -179
  47. package/template/client/src/components/business-ui/entity-combobox/popover-wrapper.tsx +0 -149
  48. package/template/client/src/components/business-ui/entity-combobox/search-trigger.tsx +0 -262
  49. package/template/client/src/components/business-ui/entity-combobox/shared-types.ts +0 -296
  50. package/template/client/src/components/business-ui/entity-combobox/size-variants.tsx +0 -322
  51. package/template/client/src/components/business-ui/entity-combobox/types.ts +0 -246
  52. package/template/client/src/components/business-ui/entity-combobox/use-fetch-data.tsx +0 -81
  53. package/template/client/src/components/business-ui/entity-combobox/use-infinite-scroll.tsx +0 -99
  54. package/template/client/src/components/business-ui/entity-combobox/use-popover-outside-click.tsx +0 -32
  55. package/template/client/src/components/business-ui/form/checkbox-field.tsx +0 -83
  56. package/template/client/src/components/business-ui/form/context.tsx +0 -38
  57. package/template/client/src/components/business-ui/form/field-layout.tsx +0 -91
  58. package/template/client/src/components/business-ui/form/form.tsx +0 -54
  59. package/template/client/src/components/business-ui/form/hooks/form-context.tsx +0 -4
  60. package/template/client/src/components/business-ui/form/hooks/form-utils.ts +0 -23
  61. package/template/client/src/components/business-ui/form/hooks/form.tsx +0 -40
  62. package/template/client/src/components/business-ui/form/index.tsx +0 -4
  63. package/template/client/src/components/business-ui/form/input-field.tsx +0 -74
  64. package/template/client/src/components/business-ui/form/radio-group-field.tsx +0 -138
  65. package/template/client/src/components/business-ui/form/select-field.tsx +0 -155
  66. package/template/client/src/components/business-ui/form/switch-field.tsx +0 -66
  67. package/template/client/src/components/business-ui/form/textarea-field.tsx +0 -72
  68. package/template/client/src/components/business-ui/form/types.ts +0 -32
  69. package/template/client/src/components/business-ui/tiptap-editor/README.md +0 -324
  70. package/template/client/src/components/business-ui/tiptap-editor/components/attachment-toolbar-button.tsx +0 -74
  71. package/template/client/src/components/business-ui/tiptap-editor/components/blockquote-toolbar-button.tsx +0 -41
  72. package/template/client/src/components/business-ui/tiptap-editor/components/code-block-toolbar-button.tsx +0 -41
  73. package/template/client/src/components/business-ui/tiptap-editor/components/color-highlight-toolbar-button.tsx +0 -141
  74. package/template/client/src/components/business-ui/tiptap-editor/components/heading-toolbar-button.tsx +0 -99
  75. package/template/client/src/components/business-ui/tiptap-editor/components/horizontal-rule-toolbar-button.tsx +0 -39
  76. package/template/client/src/components/business-ui/tiptap-editor/components/image-upload-toolbar-button.tsx +0 -65
  77. package/template/client/src/components/business-ui/tiptap-editor/components/link-edit-form.tsx +0 -127
  78. package/template/client/src/components/business-ui/tiptap-editor/components/link-hover-toolbar.tsx +0 -380
  79. package/template/client/src/components/business-ui/tiptap-editor/components/link-toolbar-button.tsx +0 -96
  80. package/template/client/src/components/business-ui/tiptap-editor/components/list-toolbar-button.tsx +0 -75
  81. package/template/client/src/components/business-ui/tiptap-editor/components/mark-toolbar-button.tsx +0 -118
  82. package/template/client/src/components/business-ui/tiptap-editor/components/text-align-toolbar-button.tsx +0 -84
  83. package/template/client/src/components/business-ui/tiptap-editor/components/undo-redo-toolbar-button.tsx +0 -54
  84. package/template/client/src/components/business-ui/tiptap-editor/extensions/attachment.tsx +0 -539
  85. package/template/client/src/components/business-ui/tiptap-editor/extensions/code-block-shiki.tsx +0 -236
  86. package/template/client/src/components/business-ui/tiptap-editor/extensions/complete-kit.ts +0 -260
  87. package/template/client/src/components/business-ui/tiptap-editor/extensions/image.tsx +0 -456
  88. package/template/client/src/components/business-ui/tiptap-editor/hooks/use-tiptap-editor.ts +0 -47
  89. package/template/client/src/components/business-ui/tiptap-editor/index.ts +0 -38
  90. package/template/client/src/components/business-ui/tiptap-editor/tiptap-editor-complete.tsx +0 -112
  91. package/template/client/src/components/business-ui/tiptap-editor/tiptap-editor.tsx +0 -169
  92. package/template/client/src/components/business-ui/types/user.ts +0 -74
  93. package/template/client/src/components/business-ui/user-display/index.tsx +0 -2
  94. package/template/client/src/components/business-ui/user-display/overflow-tooltip-text.tsx +0 -90
  95. package/template/client/src/components/business-ui/user-display/type.ts +0 -27
  96. package/template/client/src/components/business-ui/user-display/user-display.tsx +0 -99
  97. package/template/client/src/components/business-ui/user-display/user-with-avatar.tsx +0 -158
  98. package/template/client/src/components/business-ui/user-display/utils.ts +0 -37
  99. package/template/client/src/components/business-ui/user-profile/error-image.tsx +0 -302
  100. package/template/client/src/components/business-ui/user-profile/user-external-script.ts +0 -73
  101. package/template/client/src/components/business-ui/user-profile/user-profile.tsx +0 -370
  102. package/template/client/src/components/business-ui/user-select/index.tsx +0 -28
  103. package/template/client/src/components/business-ui/user-select/types.ts +0 -109
  104. package/template/client/src/components/business-ui/user-select/use-user-value.ts +0 -160
  105. package/template/client/src/components/business-ui/user-select/user-item.tsx +0 -98
  106. package/template/client/src/components/business-ui/user-select/user-pill.tsx +0 -140
  107. package/template/client/src/components/business-ui/user-select/user-select-tag.tsx +0 -82
  108. package/template/client/src/components/business-ui/user-select/user-select.tsx +0 -359
  109. package/template/client/src/components/business-ui/user-select/utils.tsx +0 -188
  110. package/template/client/src/components/business-ui/utils/user.ts +0 -72
  111. package/template/client/src/components/ui/streamdown.tsx +0 -186
  112. package/template/client/src/lib/shiki.ts +0 -92
@@ -1,188 +0,0 @@
1
- import type { UserInfo, SearchAvatar } from '@lark-apaas/client-toolkit/tools/services';
2
-
3
- import type { AccountType } from '@client/src/components/business-ui/api/users/service';
4
- import type {
5
- UserSelectItemValue,
6
- UserSelectValue,
7
- } from '@client/src/components/business-ui/user-select/types';
8
- import { getI18nText } from '@client/src/components/business-ui/utils/user';
9
- import type { User } from '@client/src/components/business-ui/types/user';
10
-
11
- export function getUserDisplayName(name: UserInfo['name']): string {
12
- return name.zh_cn || name.en_us || '';
13
- }
14
-
15
- export function getUserId(
16
- user: Pick<UserInfo, 'userID' | 'larkUserID'>,
17
- accountType: AccountType,
18
- ): string {
19
- if (accountType === 'lark') {
20
- return user.larkUserID || `_unknown_${Math.random().toString(36).slice(2)}`;
21
- }
22
- // 未注册外部联系人没有 userID,暂用 larkUserID 作为临时标识
23
- return user.userID || user.larkUserID || `_unknown_${Math.random().toString(36).slice(2)}`;
24
- }
25
-
26
- /**
27
- * 判断用户是否为未注册的外部联系人
28
- */
29
- export function isUnregisteredExternalContact(user: UserSelectItemValue): boolean {
30
- const raw = user.raw;
31
- return !!raw && !raw.user_id && !!raw.larkUserId;
32
- }
33
-
34
- export function createUnknownUser(id: string): UserSelectItemValue {
35
- return {
36
- id,
37
- name: '未知用户',
38
- avatar: undefined,
39
- raw: undefined,
40
- };
41
- }
42
-
43
- export function userInfoToUser(
44
- userInfo: UserInfo & SearchAvatar,
45
- accountType: AccountType,
46
- ): UserSelectItemValue {
47
- // 构建统一的 User 类型作为 raw 数据
48
- const rawUser: User = {
49
- user_id: userInfo.userID || undefined,
50
- larkUserId: userInfo.larkUserID || undefined,
51
- name: userInfo.name,
52
- avatar: userInfo.avatar?.image?.large,
53
- user_type: userInfo.userType,
54
- department: userInfo.department as any,
55
- };
56
-
57
- return {
58
- id: getUserId(userInfo, accountType),
59
- name: getI18nText(userInfo.name),
60
- avatar: userInfo.avatar?.image?.large,
61
- raw: rawUser,
62
- };
63
- }
64
-
65
- export function searchUserInfoToUser(
66
- userInfo: UserInfo & { avatar?: string; tenantName?: string },
67
- accountType: AccountType,
68
- ): UserSelectItemValue {
69
- // 构建统一的 User 类型作为 raw 数据
70
- const rawUser: User = {
71
- user_id: userInfo.userID || undefined,
72
- larkUserId: userInfo.larkUserID || undefined,
73
- name: userInfo.name,
74
- avatar: userInfo.avatar,
75
- user_type: userInfo.userType,
76
- department: userInfo.department as any,
77
- tenantName: userInfo.tenantName,
78
- };
79
-
80
- return {
81
- id: getUserId(userInfo, accountType),
82
- name: getI18nText(userInfo.name),
83
- avatar: userInfo.avatar,
84
- raw: rawUser,
85
- };
86
- }
87
-
88
- declare global {
89
- interface Window {
90
- MIAODA_APP_ID?: string;
91
- __platform__?: {
92
- appId?: string;
93
- };
94
- appId?: string;
95
- }
96
- }
97
-
98
- export function getAppId(path: string): string | null | undefined {
99
- if (window?.__platform__?.appId) {
100
- return window.__platform__.appId;
101
- }
102
-
103
- if (window.MIAODA_APP_ID) {
104
- return window.MIAODA_APP_ID;
105
- }
106
-
107
- let prefix: string;
108
-
109
- /**
110
- * 从路径中提取 appId
111
- * @example "/app/my-app/settings" → "my-app"
112
- */
113
- const appMatch = path.match(/\/app\/([^/]+)/);
114
- if (appMatch) {
115
- return appMatch[1];
116
- }
117
-
118
- // 检查路径是否以固定前缀开头
119
- if (path.includes('/ai/feida/runtime/')) {
120
- prefix = '/ai/feida/runtime/';
121
- } else if (path.includes('/spark/r/')) {
122
- prefix = '/spark/r/';
123
- } else {
124
- prefix = '/ai/miaoda/';
125
- }
126
-
127
- // 兼容全栈appId挂载在window上,作为兜底
128
- const windowAppId = window.appId || null;
129
-
130
- if (!path.startsWith(prefix)) {
131
- return windowAppId;
132
- }
133
-
134
- // 截取前缀后的部分
135
- const remainder = path.substring(prefix.length);
136
-
137
- // 找到下一个斜杠的位置
138
- const nextSlashIndex = remainder.indexOf('/');
139
-
140
- // 如果没有斜杠,返回整个remainder;否则返回斜杠前的部分
141
- if (nextSlashIndex === -1) {
142
- return remainder || windowAppId;
143
- }
144
- return remainder.substring(0, nextSlashIndex) || windowAppId;
145
- }
146
-
147
- /**
148
- * 从 value 中提取 ID 列表
149
- * 支持 User 类型(user_id)和 UserSelectItemValue 类型(id)
150
- */
151
- export function extractIdsFromValue(value: UserSelectValue): string[] {
152
- if (value === null || value === undefined) {
153
- return [];
154
- }
155
- if (typeof value === 'string') {
156
- return [value];
157
- }
158
- if (Array.isArray(value)) {
159
- if (value.length === 0) {
160
- return [];
161
- }
162
- // 检查第一个元素判断类型
163
- if (typeof value[0] === 'string') {
164
- return value as string[];
165
- }
166
- // 对象数组:可能是 User[] 或 UserSelectItemValue[]
167
- return value.map((item: any) => {
168
- // UserSelectItemValue 有 id 字段(内部类型)
169
- if ('id' in item && item.id) {
170
- return item.id;
171
- }
172
- // User 有 user_id 字段(外部类型)
173
- if ('user_id' in item && item.user_id) {
174
- return item.user_id;
175
- }
176
- return '';
177
- }).filter(Boolean);
178
- }
179
- // 单个对象:可能是 User 或 UserSelectItemValue
180
- const item = value as any;
181
- if ('id' in item && item.id) {
182
- return [item.id];
183
- }
184
- if ('user_id' in item && item.user_id) {
185
- return [item.user_id];
186
- }
187
- return [];
188
- }
@@ -1,72 +0,0 @@
1
- // client/src/utils/user.ts
2
-
3
- import type { I18nText, User, UserInput } from '../types/user';
4
-
5
- /**
6
- * 获取国际化文本的显示值
7
- * @param text 国际化文本或普通字符串
8
- * @param locale 语言,默认 zh_cn
9
- */
10
- export function getI18nText(
11
- text: I18nText | string | undefined,
12
- locale: 'zh_cn' | 'en_us' | 'ja_jp' = 'zh_cn',
13
- ): string {
14
- if (!text) return '';
15
- if (typeof text === 'string') return text;
16
- // 添加更完整的 fallback 逻辑
17
- return text[locale] || text.zh_cn || text.en_us || text.ja_jp || '';
18
- }
19
-
20
- /**
21
- * 将任意格式的用户数据转换为标准 User 类型(下划线命名)
22
- */
23
- export function normalizeUser(input: UserInput): User {
24
- const data = input as any;
25
-
26
- // 提取 user_id(兼容驼峰和下划线)
27
- const user_id = data.user_id || data.userId || '';
28
-
29
- // 提取其他字段
30
- const larkUserId = data.larkUserId; // larkUserId 保持驼峰
31
- const name = data.name;
32
- const avatar = data.avatar;
33
- const email = data.email;
34
-
35
- // 提取 user_type(兼容驼峰和下划线)
36
- const user_type = data.user_type || data.userType;
37
-
38
- const department = data.department;
39
-
40
- return {
41
- user_id,
42
- larkUserId,
43
- name,
44
- avatar,
45
- email,
46
- user_type,
47
- department,
48
- };
49
- }
50
-
51
- /**
52
- * 验证 user_id 是否有效
53
- */
54
- export function isValidUserId(user_id: string | undefined): boolean {
55
- if (!user_id) return false;
56
- const trimmed = user_id.trim();
57
- if (!trimmed) return false;
58
- if (trimmed === '""') return false; // 过滤 AI 可能生成的 ""
59
- return true;
60
- }
61
-
62
- /**
63
- * 获取用户显示名称
64
- * 自动处理 I18nText 类型
65
- */
66
- export function getUserDisplayName(
67
- user: User | undefined,
68
- locale: 'zh_cn' | 'en_us' | 'ja_jp' = 'zh_cn',
69
- ): string {
70
- if (!user) return '';
71
- return getI18nText(user.name, locale) || '无效人员';
72
- }
@@ -1,186 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { Streamdown as StreamdownPrimitive } from 'streamdown';
5
-
6
- import { cn } from '@/lib/utils';
7
- import { omit } from 'es-toolkit';
8
-
9
- const defaultComponents: NonNullable<
10
- React.ComponentProps<typeof StreamdownPrimitive>['components']
11
- > = {
12
- ol: ({ className, ...props }) => (
13
- <ol
14
- className={cn(className)}
15
- data-streamdown="ordered-list"
16
- {...omit(props, ['node'])}
17
- />
18
- ),
19
- li: ({ className, ...props }) => (
20
- <li
21
- className={cn(className)}
22
- data-streamdown="list-item"
23
- {...omit(props, ['node'])}
24
- />
25
- ),
26
- ul: ({ className, ...props }) => (
27
- <ul
28
- className={cn(className)}
29
- data-streamdown="unordered-list"
30
- {...omit(props, ['node'])}
31
- />
32
- ),
33
- hr: ({ className, ...props }) => (
34
- <hr
35
- className={cn(className)}
36
- data-streamdown="horizontal-rule"
37
- {...omit(props, ['node'])}
38
- />
39
- ),
40
- strong: ({ className, ...props }) => (
41
- <strong
42
- className={cn(className)}
43
- data-streamdown="strong"
44
- {...omit(props, ['node'])}
45
- />
46
- ),
47
- a: ({ className, href, ...props }) => {
48
- const isIncomplete = href === 'streamdown:incomplete-link';
49
-
50
- return (
51
- <a
52
- className={cn(className)}
53
- data-incomplete={isIncomplete}
54
- data-streamdown="link"
55
- href={href}
56
- rel={props.rel ?? 'noreferrer'}
57
- target={props.target ?? '_blank'}
58
- {...omit(props, ['node'])}
59
- />
60
- );
61
- },
62
- h1: ({ className, ...props }) => (
63
- <h1
64
- className={cn(className)}
65
- data-streamdown="heading-1"
66
- {...omit(props, ['node'])}
67
- />
68
- ),
69
- h2: ({ className, ...props }) => (
70
- <h2
71
- className={cn(className)}
72
- data-streamdown="heading-2"
73
- {...omit(props, ['node'])}
74
- />
75
- ),
76
- h3: ({ className, ...props }) => (
77
- <h3
78
- className={cn(className)}
79
- data-streamdown="heading-3"
80
- {...omit(props, ['node'])}
81
- />
82
- ),
83
- h4: ({ className, ...props }) => (
84
- <h4
85
- className={cn(className)}
86
- data-streamdown="heading-4"
87
- {...omit(props, ['node'])}
88
- />
89
- ),
90
- h5: ({ className, ...props }) => (
91
- <h5
92
- className={cn(className)}
93
- data-streamdown="heading-5"
94
- {...omit(props, ['node'])}
95
- />
96
- ),
97
- h6: ({ className, ...props }) => (
98
- <h6
99
- className={cn(className)}
100
- data-streamdown="heading-6"
101
- {...omit(props, ['node'])}
102
- />
103
- ),
104
- table: ({ className, ...props }) => (
105
- <table
106
- className={cn(className)}
107
- data-streamdown="table-wrapper"
108
- {...omit(props, ['node'])}
109
- />
110
- ),
111
- thead: ({ className, ...props }) => (
112
- <thead
113
- className={cn(className)}
114
- data-streamdown="table-header"
115
- {...omit(props, ['node'])}
116
- />
117
- ),
118
- tbody: ({ className, ...props }) => (
119
- <tbody
120
- className={cn(className)}
121
- data-streamdown="table-body"
122
- {...omit(props, ['node'])}
123
- />
124
- ),
125
- tr: ({ className, ...props }) => (
126
- <tr
127
- className={cn(className)}
128
- data-streamdown="table-row"
129
- {...omit(props, ['node'])}
130
- />
131
- ),
132
- th: ({ className, ...props }) => (
133
- <th
134
- className={cn(className)}
135
- data-streamdown="table-header-cell"
136
- {...omit(props, ['node'])}
137
- />
138
- ),
139
- td: ({ className, ...props }) => (
140
- <td
141
- className={cn(className)}
142
- data-streamdown="table-cell"
143
- {...omit(props, ['node'])}
144
- />
145
- ),
146
- blockquote: ({ className, ...props }) => (
147
- <blockquote
148
- className={cn(className)}
149
- data-streamdown="blockquote"
150
- {...omit(props, ['node'])}
151
- />
152
- ),
153
- sup: ({ className, ...props }) => (
154
- <sup className={cn(className)} {...omit(props, ['node'])} />
155
- ),
156
- sub: ({ className, ...props }) => (
157
- <sub className={cn(className)} {...omit(props, ['node'])} />
158
- ),
159
- p: ({ className, ...props }) => (
160
- <p className={cn(className)} {...omit(props, ['node'])} />
161
- ),
162
- section: ({ className, ...props }) => (
163
- <section className={cn(className)} {...omit(props, ['node'])} />
164
- ),
165
- img: ({ className, alt, ...props }) => (
166
- <img className={cn(className)} alt={alt ?? ''} {...omit(props, ['node'])} />
167
- ),
168
- pre: ({ children }) => <div className="not-prose">{children}</div>,
169
- };
170
-
171
- export function Streamdown({
172
- className,
173
- components,
174
- ...props
175
- }: React.ComponentProps<typeof StreamdownPrimitive>) {
176
- return (
177
- <StreamdownPrimitive
178
- className={cn(
179
- 'prose max-w-none dark:prose-invert',
180
- className,
181
- )}
182
- components={{ ...defaultComponents, ...components }}
183
- {...props}
184
- />
185
- );
186
- }
@@ -1,92 +0,0 @@
1
- import {
2
- createBundledHighlighter,
3
- createSingletonShorthands,
4
- } from 'shiki/core';
5
- import { createJavaScriptRegexEngine } from 'shiki/engine/javascript';
6
- import type {
7
- DynamicImportLanguageRegistration,
8
- DynamicImportThemeRegistration,
9
- HighlighterGeneric,
10
- } from 'shiki/types';
11
-
12
- type BundledLanguage =
13
- | 'typescript'
14
- | 'ts'
15
- | 'cts'
16
- | 'mts'
17
- | 'javascript'
18
- | 'js'
19
- | 'cjs'
20
- | 'mjs'
21
- | 'jsx'
22
- | 'tsx'
23
- | 'html'
24
- | 'css'
25
- | 'json'
26
- | 'jsonc'
27
- | 'json5'
28
- | 'markdown'
29
- | 'md';
30
- type BundledTheme = 'github-light' | 'github-dark';
31
- type Highlighter = HighlighterGeneric<BundledLanguage, BundledTheme>;
32
-
33
- const bundledLanguages = {
34
- typescript: () => import('@shikijs/langs/typescript'),
35
- ts: () => import('@shikijs/langs/typescript'),
36
- cts: () => import('@shikijs/langs/typescript'),
37
- mts: () => import('@shikijs/langs/typescript'),
38
- javascript: () => import('@shikijs/langs/javascript'),
39
- js: () => import('@shikijs/langs/javascript'),
40
- cjs: () => import('@shikijs/langs/javascript'),
41
- mjs: () => import('@shikijs/langs/javascript'),
42
- jsx: () => import('@shikijs/langs/jsx'),
43
- tsx: () => import('@shikijs/langs/tsx'),
44
- html: () => import('@shikijs/langs/html'),
45
- css: () => import('@shikijs/langs/css'),
46
- json: () => import('@shikijs/langs/json'),
47
- jsonc: () => import('@shikijs/langs/jsonc'),
48
- json5: () => import('@shikijs/langs/json5'),
49
- markdown: () => import('@shikijs/langs/markdown'),
50
- md: () => import('@shikijs/langs/markdown'),
51
- } as Record<BundledLanguage, DynamicImportLanguageRegistration>;
52
-
53
- const bundledThemes = {
54
- 'github-light': () => import('@shikijs/themes/github-light'),
55
- 'github-dark': () => import('@shikijs/themes/github-dark'),
56
- } as Record<BundledTheme, DynamicImportThemeRegistration>;
57
-
58
- const createHighlighter = /* @__PURE__ */ createBundledHighlighter<
59
- BundledLanguage,
60
- BundledTheme
61
- >({
62
- langs: bundledLanguages,
63
- themes: bundledThemes,
64
- engine: () => createJavaScriptRegexEngine(),
65
- });
66
-
67
- const {
68
- codeToHtml,
69
- codeToHast,
70
- codeToTokensBase,
71
- codeToTokens,
72
- codeToTokensWithThemes,
73
- getSingletonHighlighter,
74
- getLastGrammarState,
75
- } = /* @__PURE__ */ createSingletonShorthands<BundledLanguage, BundledTheme>(
76
- createHighlighter,
77
- );
78
-
79
- export {
80
- bundledLanguages,
81
- bundledThemes,
82
- codeToHast,
83
- codeToHtml,
84
- codeToTokens,
85
- codeToTokensBase,
86
- codeToTokensWithThemes,
87
- createHighlighter,
88
- getLastGrammarState,
89
- getSingletonHighlighter,
90
- };
91
-
92
- export type { BundledLanguage, BundledTheme, Highlighter };