@blocklet/editor 2.4.87 → 2.4.89

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.
@@ -1,6 +1,9 @@
1
1
  import { type EditorThemeClasses } from 'lexical';
2
2
  export declare const LANGUAGE_ALIAS: Record<string, string>;
3
- export declare const LANGUAGE_ICON: Record<string, string>;
3
+ export declare const LANGUAGE_ICON: Record<string, string | {
4
+ light: string;
5
+ dark: string;
6
+ }>;
4
7
  export declare const XCODE_TRANSLATIONS: {
5
8
  en: {
6
9
  seeAllLines: string;
@@ -12,9 +12,11 @@ export const LANGUAGE_ALIAS = {
12
12
  be: 'berry',
13
13
  cdc: 'cadence',
14
14
  clj: 'clojure',
15
+ coffee: 'coffeescript',
15
16
  ql: 'codeql',
16
17
  lisp: 'common-lisp',
17
18
  cql: 'cypher',
19
+ erl: 'erlang',
18
20
  f: 'fortran-fixed-form',
19
21
  for: 'fortran-fixed-form',
20
22
  f77: 'fortran-fixed-form',
@@ -31,23 +33,29 @@ export const LANGUAGE_ALIAS = {
31
33
  golang: 'go',
32
34
  gis: 'glimmer-js',
33
35
  gts: 'glimmer-ts',
36
+ js: 'javascript',
37
+ jl: 'julia',
34
38
  kt: 'kotlin',
35
39
  kts: 'kotlin',
36
40
  kql: 'kusto',
37
41
  hbs: 'handlebars',
38
42
  hs: 'haskell',
39
43
  make: 'makefile',
44
+ md: 'markdown',
45
+ mdc: 'markdown',
40
46
  mediawiki: 'wikitext',
41
47
  nf: 'nextflow',
42
48
  nu: 'nushell',
43
49
  objectivec: 'objective-c',
44
50
  objc: 'objective-c',
45
51
  proto: 'protobuf',
52
+ perl6: 'perl',
46
53
  ps: 'powershell',
47
54
  ps1: 'powershell',
48
55
  rb: 'ruby',
49
56
  rs: 'rust',
50
57
  shader: 'shaderlab',
58
+ styl: 'stylus',
51
59
  vbnet: 'vb',
52
60
  vy: 'vyper',
53
61
  wiki: 'wikitext',
@@ -68,15 +76,18 @@ export const LANGUAGE_ICON = {
68
76
  applescript: 'logos:apple',
69
77
  ara: '',
70
78
  asm: '',
71
- astro: 'logos:astro-icon',
79
+ astro: {
80
+ light: 'vscode-icons:file-type-light-astro',
81
+ dark: 'vscode-icons:file-type-astro',
82
+ },
72
83
  awk: 'vscode-icons:file-type-awk',
73
84
  ballerina: 'material-icon-theme:ballerina',
74
- bash: 'vscode-icons:file-type-shell',
85
+ bash: 'material-icon-theme:console',
75
86
  bat: 'catppuccin:batch',
76
87
  batch: 'catppuccin:batch',
77
88
  beancount: '',
78
89
  berry: '',
79
- bibtex: 'file-icons:bibtex',
90
+ bibtex: '',
80
91
  bicep: 'logos:microsoft',
81
92
  blade: 'logos:laravel',
82
93
  c: 'logos:c',
@@ -91,13 +102,15 @@ export const LANGUAGE_ICON = {
91
102
  cobol: 'vscode-icons:file-type-cobol',
92
103
  codeowners: 'vscode-icons:file-type-codeowners',
93
104
  codeql: 'vscode-icons:file-type-codeql',
94
- coffee: 'logos:coffeescript',
95
- coffeescript: 'logos:coffeescript',
105
+ coffeescript: 'catppuccin:coffeescript',
96
106
  'common-lisp': 'vscode-icons:file-type-lisp',
97
107
  console: '',
98
108
  coq: 'file-icons:coq',
99
109
  cpp: 'logos:c-plusplus',
100
- crystal: 'logos:crystal',
110
+ crystal: {
111
+ light: 'vscode-icons:file-type-light-crystal',
112
+ dark: 'vscode-icons:file-type-crystal',
113
+ },
101
114
  cs: 'logos:c-sharp',
102
115
  csharp: 'logos:c-sharp',
103
116
  css: 'logos:css-3',
@@ -119,11 +132,13 @@ export const LANGUAGE_ICON = {
119
132
  elm: 'vscode-icons:file-type-elm',
120
133
  'emacs-lisp': 'logos:emacs',
121
134
  erb: 'logos:ruby',
122
- erl: 'logos:erlang',
123
- erlang: 'logos:erlang',
135
+ erlang: {
136
+ dark: 'vscode-icons:file-type-erlang2',
137
+ light: 'vscode-icons:file-type-erlang',
138
+ },
124
139
  'fortran-fixed-form': 'vscode-icons:file-type-fortran',
125
140
  'fortran-free-form': 'vscode-icons:file-type-fortran',
126
- fennel: 'l',
141
+ fennel: '',
127
142
  fish: '',
128
143
  fluent: '',
129
144
  fsharp: 'vscode-icons:file-type-fsharp2',
@@ -143,9 +158,9 @@ export const LANGUAGE_ICON = {
143
158
  go: 'vscode-icons:file-type-go',
144
159
  gql: 'logos:graphql',
145
160
  graphql: 'logos:graphql',
146
- groovy: 'vscode-icons:file-type-groovy',
161
+ groovy: 'material-icon-theme:groovy',
147
162
  hack: 'logos:hack',
148
- haml: 'logos:haml',
163
+ haml: 'catppuccin:haml',
149
164
  handlebars: 'vscode-icons:file-type-handlebars',
150
165
  haskell: 'vscode-icons:file-type-haskell',
151
166
  haxe: 'logos:haxe',
@@ -156,42 +171,44 @@ export const LANGUAGE_ICON = {
156
171
  'html-derivative': 'logos:html-5',
157
172
  http: 'vscode-icons:file-type-http',
158
173
  hxml: '',
159
- hy: 'vscode-icons:file-type-hy',
174
+ hy: 'file-icons:hy',
160
175
  imba: 'vscode-icons:file-type-imba',
161
176
  ini: 'vscode-icons:file-type-ini',
162
177
  jade: 'logos:pug',
163
178
  java: 'logos:java',
164
- javascript: 'logos:javascript',
179
+ javascript: 'devicon:javascript',
165
180
  jinja: 'vscode-icons:file-type-jinja',
166
181
  jison: '',
167
- jl: 'logos:julia',
168
- js: 'logos:javascript',
169
182
  json: 'vscode-icons:file-type-json',
170
- json5: 'vscode-icons:file-type-json5',
183
+ json5: {
184
+ light: 'vscode-icons:file-type-light-json5',
185
+ dark: 'vscode-icons:file-type-json5',
186
+ },
171
187
  jsonc: 'vscode-icons:file-type-json',
172
188
  jsonl: 'vscode-icons:file-type-json',
173
189
  jsonnet: 'vscode-icons:file-type-jsonnet',
174
190
  jssm: '',
175
191
  jsx: 'logos:react',
176
- julia: 'logos:julia',
192
+ julia: 'vscode-icons:file-type-julia',
177
193
  kotlin: 'vscode-icons:file-type-kotlin',
178
194
  kusto: 'vscode-icons:file-type-kusto',
179
195
  latex: '',
180
196
  lean: 'vscode-icons:file-type-lean',
181
197
  lean4: 'vscode-icons:file-type-lean',
182
- less: 'logos:less',
198
+ less: 'catppuccin:less',
183
199
  liquid: 'logos:shopify',
184
200
  lit: 'logos:lit',
185
- log: 'vscode-icons:file-type-shell',
201
+ log: 'material-icon-theme:console',
186
202
  logo: '',
187
203
  lua: 'logos:lua',
188
204
  luau: 'vscode-icons:file-type-luau',
189
205
  makefile: 'vscode-icons:file-type-makefile',
190
- markdown: 'logos:markdown',
206
+ markdown: {
207
+ light: 'catppuccin:markdown-mdx',
208
+ dark: 'catppuccin:markdown',
209
+ },
191
210
  marko: 'logos:marko',
192
211
  matlab: 'vscode-icons:file-type-matlab',
193
- md: 'logos:markdown',
194
- mdc: 'logos:markdown',
195
212
  mdx: 'logos:mdx',
196
213
  mermaid: '',
197
214
  mojo: 'vscode-icons:file-type-mojo',
@@ -200,16 +217,16 @@ export const LANGUAGE_ICON = {
200
217
  narrat: '',
201
218
  nextflow: 'vscode-icons:file-type-nextflow',
202
219
  nginx: 'logos:nginx',
203
- nim: 'vscode-icons:file-type-nim',
220
+ nim: 'catppuccin:nim',
204
221
  nix: 'vscode-icons:file-type-nix',
205
222
  nushell: '',
206
- 'objective-c': 'vscode-icons:file-type-objectivec',
207
- 'objective-cpp': 'vscode-icons:file-type-objectivecpp',
223
+ 'objective-c': 'material-icon-theme:objective-c',
224
+ 'objective-cpp': 'material-icon-theme:objective-cpp',
208
225
  ocaml: 'vscode-icons:file-type-ocaml',
209
226
  pascal: '',
210
- perl: 'logos:perl',
227
+ perl: 'catppuccin:perl',
211
228
  perl6: '',
212
- php: 'logos:php',
229
+ php: 'catppuccin:php',
213
230
  plsql: 'vscode-icons:file-type-plsql',
214
231
  po: '',
215
232
  postcss: 'logos:postcss',
@@ -217,13 +234,13 @@ export const LANGUAGE_ICON = {
217
234
  potx: '',
218
235
  powerquery: '',
219
236
  powershell: 'vscode-icons:file-type-powershell',
220
- prisma: 'logos:prisma',
237
+ prisma: 'material-icon-theme:prisma',
221
238
  prolog: 'vscode-icons:file-type-prolog',
222
239
  properties: '',
223
240
  protobuf: 'vscode-icons:file-type-protobuf',
224
241
  pug: 'logos:pug',
225
242
  puppet: 'logos:puppet',
226
- purescript: 'logos:purescript',
243
+ purescript: 'material-icon-theme:purescript',
227
244
  py: 'logos:python',
228
245
  python: 'logos:python',
229
246
  qml: 'logos:qt',
@@ -240,19 +257,22 @@ export const LANGUAGE_ICON = {
240
257
  riscv: '',
241
258
  rst: '',
242
259
  ruby: 'logos:ruby',
243
- rust: 'logos:rust',
260
+ rust: 'catppuccin:rust-alt',
244
261
  sas: 'vscode-icons:file-type-sas',
245
262
  sass: 'logos:sass',
246
263
  scala: 'logos:scala',
247
264
  scheme: '',
248
265
  scss: 'logos:sass',
249
- sh: 'vscode-icons:file-type-shell',
250
- shaderlab: 'vscode-icons:file-type-shaderlab',
251
- shell: 'vscode-icons:file-type-shell',
252
- shellscript: 'vscode-icons:file-type-shell',
253
- shellsession: 'vscode-icons:file-type-shell',
266
+ sh: 'material-icon-theme:console',
267
+ shaderlab: 'catppuccin:shader',
268
+ shell: 'material-icon-theme:console',
269
+ shellscript: 'material-icon-theme:console',
270
+ shellsession: 'material-icon-theme:console',
254
271
  smalltalk: '',
255
- solidity: 'logos:solidity',
272
+ solidity: {
273
+ light: 'vscode-icons:file-type-light-solidity',
274
+ dark: 'vscode-icons:file-type-solidity',
275
+ },
256
276
  soy: '',
257
277
  sparql: 'vscode-icons:file-type-sparql',
258
278
  spl: '',
@@ -260,17 +280,19 @@ export const LANGUAGE_ICON = {
260
280
  sql: 'vscode-icons:file-type-sql',
261
281
  'ssh-config': '',
262
282
  stata: 'vscode-icons:file-type-stata',
263
- styl: 'logos:stylus',
264
- stylus: 'logos:stylus',
283
+ stylus: 'file-icons:stylus-s',
265
284
  svelte: 'logos:svelte-icon',
266
285
  swift: 'logos:swift',
267
286
  'system-verilog': 'vscode-icons:file-type-systemverilog',
268
- systemd: 'vscode-icons:file-type-systemd',
287
+ systemd: {
288
+ light: 'material-icon-theme:systemd-light',
289
+ dark: 'material-icon-theme:systemd',
290
+ },
269
291
  tasl: '',
270
292
  tcl: 'vscode-icons:file-type-tcl',
271
293
  templ: '',
272
294
  terraform: 'logos:terraform',
273
- tex: 'vscode-icons:file-type-light-tex',
295
+ tex: 'material-icon-theme:tex',
274
296
  tf: 'logos:terraform',
275
297
  tfvars: 'logos:terraform',
276
298
  toml: 'logos:toml',
@@ -286,7 +308,7 @@ export const LANGUAGE_ICON = {
286
308
  typespec: 'vscode-icons:file-type-typescript-official',
287
309
  typst: '',
288
310
  v: '',
289
- vala: 'vscode-icons:file-type-vala',
311
+ vala: 'catppuccin:vala',
290
312
  vb: 'vscode-icons:file-type-vb',
291
313
  verilog: 'vscode-icons:file-type-systemverilog',
292
314
  vhdl: 'vscode-icons:file-type-vhdl',
@@ -303,10 +325,16 @@ export const LANGUAGE_ICON = {
303
325
  wolfram: 'vscode-icons:file-type-wolfram',
304
326
  xml: 'vscode-icons:file-type-xml',
305
327
  xsl: 'vscode-icons:file-type-xsl',
306
- yaml: 'vscode-icons:file-type-yaml',
328
+ yaml: {
329
+ light: 'vscode-icons:file-type-light-yaml-official',
330
+ dark: 'vscode-icons:file-type-yaml-official',
331
+ },
307
332
  zenscript: '',
308
333
  zig: 'vscode-icons:file-type-zig',
309
- zsh: 'logos:zsh',
334
+ zsh: {
335
+ light: 'devicon:zsh',
336
+ dark: 'devicon-plain:zsh',
337
+ },
310
338
  };
311
339
  // 多语言翻译
312
340
  export const XCODE_TRANSLATIONS = {
@@ -332,7 +360,13 @@ function CodeHeader({ title, icon, actions }) {
332
360
  borderColor: 'divider',
333
361
  bgcolor: 'background.paper',
334
362
  borderRadius: '8px 8px 0 0',
335
- }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1, flex: 1 }, children: [icon && (_jsx(Box, { component: Icon, icon: icon, sx: { fontSize: '22px', height: '22px', lineHeight: '22px', color: 'text.secondary' } })), title && (_jsx(Typography, { variant: "body2", sx: { color: 'text.secondary', fontWeight: 500 }, children: title }))] }), actions && _jsx(Box, { sx: { display: 'flex', alignItems: 'center', gap: 0.5 }, children: actions })] }));
363
+ }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1, flex: 1 }, children: [icon && (_jsx(Box, { component: Icon, icon: icon, sx: {
364
+ fontSize: '24px',
365
+ height: '24px',
366
+ lineHeight: '24px',
367
+ color: 'text.secondary',
368
+ fill: ({ palette }) => palette.text.secondary,
369
+ } })), title && (_jsx(Typography, { variant: "body2", sx: { color: 'text.secondary', fontWeight: 500 }, children: title }))] }), actions && _jsx(Box, { sx: { display: 'flex', alignItems: 'center', gap: 0.5 }, children: actions })] }));
336
370
  }
337
371
  /** 通用操作按钮 */
338
372
  function ActionButton({ className, icon, onClick, sx = {}, }) {
@@ -419,8 +453,13 @@ export default function Code({ editorTheme, language, title, body = '', foldable
419
453
  if (Number.isNaN(foldThreshold)) {
420
454
  foldThreshold = 25;
421
455
  }
456
+ const { mode } = muiTheme.palette;
422
457
  const _lang = LANGUAGE_ALIAS[language] || language;
423
- const languageIcon = LANGUAGE_ICON[_lang] || 'heroicons:code-bracket-solid';
458
+ // support for light/dark icon
459
+ const languageIcon =
460
+ // @ts-ignore
461
+ (typeof LANGUAGE_ICON[_lang] === 'object' ? LANGUAGE_ICON[_lang][mode] : LANGUAGE_ICON[_lang]) ||
462
+ 'heroicons:code-bracket-solid';
424
463
  const lineCount = body ? body.split('\n').length : 0;
425
464
  const showFoldButton = foldable && lineCount > foldThreshold;
426
465
  // 初始折叠状态:启用折叠且超过阈值就折叠
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/editor",
3
- "version": "2.4.87",
3
+ "version": "2.4.89",
4
4
  "main": "lib/index.js",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -71,7 +71,7 @@
71
71
  "ufo": "^1.5.4",
72
72
  "url-join": "^4.0.1",
73
73
  "zustand": "^4.5.5",
74
- "@blocklet/pdf": "2.4.87"
74
+ "@blocklet/pdf": "2.4.89"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@babel/core": "^7.25.2",