bridgerte 0.9.4 → 0.9.6

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,4 +1,4 @@
1
- import { b as y, a as v } from "./index-CuNKUHed.js";
1
+ import { b as v, a as g } from "./index-CuNKUHed.js";
2
2
  const h = {
3
3
  id: "code-block-language",
4
4
  title: "代码语言",
@@ -48,7 +48,7 @@ const h = {
48
48
  label: "颜色"
49
49
  }
50
50
  ]
51
- }, k = {
51
+ }, P = {
52
52
  id: "background-color",
53
53
  title: "背景色",
54
54
  fields: [
@@ -58,7 +58,7 @@ const h = {
58
58
  label: "背景"
59
59
  }
60
60
  ]
61
- }, x = {
61
+ }, k = {
62
62
  id: "font-size",
63
63
  title: "字号",
64
64
  fields: [
@@ -76,7 +76,7 @@ const h = {
76
76
  ]
77
77
  }
78
78
  ]
79
- }, P = {
79
+ }, x = {
80
80
  id: "font-family",
81
81
  title: "字体",
82
82
  fields: [
@@ -119,7 +119,7 @@ const h = {
119
119
  label: "行数",
120
120
  defaultValue: "3",
121
121
  min: 1,
122
- max: y,
122
+ max: v,
123
123
  step: 1
124
124
  },
125
125
  {
@@ -128,7 +128,7 @@ const h = {
128
128
  label: "列数",
129
129
  defaultValue: "3",
130
130
  min: 1,
131
- max: v,
131
+ max: g,
132
132
  step: 1
133
133
  }
134
134
  ]
@@ -137,100 +137,86 @@ const h = {
137
137
  id: "table-insert-row-after",
138
138
  command: { type: "table.insertRow", direction: "after" },
139
139
  label: "插入行",
140
- icon: "rows-plus",
141
- group: "table"
140
+ icon: "rows-plus"
142
141
  },
143
142
  {
144
143
  id: "table-delete-row",
145
144
  command: { type: "table.deleteRow" },
146
145
  label: "删除行",
147
- icon: "rows-minus",
148
- group: "table"
146
+ icon: "rows-minus"
149
147
  },
150
148
  {
151
149
  id: "table-insert-column-after",
152
150
  command: { type: "table.insertColumn", direction: "after" },
153
151
  label: "插入列",
154
- icon: "columns-plus",
155
- group: "table"
152
+ icon: "columns-plus"
156
153
  },
157
154
  {
158
155
  id: "table-delete-column",
159
156
  command: { type: "table.deleteColumn" },
160
157
  label: "删除列",
161
- icon: "columns-minus",
162
- group: "table"
158
+ icon: "columns-minus"
163
159
  },
164
160
  {
165
161
  id: "table-delete",
166
162
  command: { type: "table.delete" },
167
163
  label: "删除表格",
168
- icon: "table-delete",
169
- group: "table"
164
+ icon: "table-delete"
170
165
  }
171
- ], p = [
166
+ ], m = [
172
167
  {
173
168
  id: "bold",
174
169
  command: { type: "format.bold" },
175
170
  label: "加粗",
176
- icon: "bold",
177
- group: "text"
171
+ icon: "bold"
178
172
  },
179
173
  {
180
174
  id: "italic",
181
175
  command: { type: "format.italic" },
182
176
  label: "斜体",
183
- icon: "italic",
184
- group: "text"
177
+ icon: "italic"
185
178
  },
186
179
  {
187
180
  id: "underline",
188
181
  command: { type: "format.underline" },
189
182
  label: "下划线",
190
- icon: "underline",
191
- group: "text"
183
+ icon: "underline"
192
184
  },
193
185
  {
194
186
  id: "strike",
195
187
  command: { type: "format.strike" },
196
188
  label: "删除线",
197
- icon: "strikethrough",
198
- group: "text"
189
+ icon: "strikethrough"
199
190
  },
200
191
  {
201
192
  id: "inline-code",
202
193
  command: { type: "format.inlineCode" },
203
194
  label: "行内代码",
204
- icon: "code",
205
- group: "text"
195
+ icon: "code"
206
196
  },
207
197
  {
208
198
  id: "superscript",
209
199
  command: { type: "format.superscript" },
210
200
  label: "上标",
211
- icon: "superscript",
212
- group: "text"
201
+ icon: "superscript"
213
202
  },
214
203
  {
215
204
  id: "subscript",
216
205
  command: { type: "format.subscript" },
217
206
  label: "下标",
218
- icon: "subscript",
219
- group: "text"
207
+ icon: "subscript"
220
208
  },
221
209
  {
222
210
  id: "clear-style",
223
211
  command: { type: "format.clear" },
224
212
  label: "清除样式",
225
- icon: "remove-formatting",
226
- group: "text"
213
+ icon: "remove-formatting"
227
214
  },
228
215
  {
229
216
  id: "color",
230
217
  command: { type: "format.color", value: "" },
231
218
  label: "文字颜色",
232
219
  icon: "palette",
233
- group: "style",
234
220
  requiresPayload: !0,
235
221
  payloadPanel: f
236
222
  },
@@ -239,34 +225,30 @@ const h = {
239
225
  command: { type: "format.backgroundColor", value: "" },
240
226
  label: "背景色",
241
227
  icon: "paint-bucket",
242
- group: "style",
243
228
  requiresPayload: !0,
244
- payloadPanel: k
229
+ payloadPanel: P
245
230
  },
246
231
  {
247
232
  id: "font-size",
248
233
  command: { type: "format.fontSize", value: "" },
249
234
  label: "字号",
250
235
  icon: "case-sensitive",
251
- group: "style",
252
236
  requiresPayload: !0,
253
- payloadPanel: x
237
+ payloadPanel: k
254
238
  },
255
239
  {
256
240
  id: "font-family",
257
241
  command: { type: "format.fontFamily", value: "" },
258
242
  label: "字体",
259
243
  icon: "type",
260
- group: "style",
261
244
  requiresPayload: !0,
262
- payloadPanel: P
245
+ payloadPanel: x
263
246
  },
264
247
  {
265
248
  id: "line-height",
266
249
  command: { type: "format.lineHeight", value: "" },
267
250
  label: "行高",
268
251
  icon: "wrap-text",
269
- group: "style",
270
252
  requiresPayload: !0,
271
253
  payloadPanel: S
272
254
  },
@@ -274,163 +256,140 @@ const h = {
274
256
  id: "paragraph",
275
257
  command: { type: "block.paragraph" },
276
258
  label: "正文",
277
- icon: "pilcrow",
278
- group: "block"
259
+ icon: "pilcrow"
279
260
  },
280
261
  {
281
262
  id: "heading-1",
282
263
  command: { type: "block.heading", level: 1 },
283
264
  label: "一级标题",
284
- icon: "heading-1",
285
- group: "block"
265
+ icon: "heading-1"
286
266
  },
287
267
  {
288
268
  id: "heading-2",
289
269
  command: { type: "block.heading", level: 2 },
290
270
  label: "二级标题",
291
- icon: "heading-2",
292
- group: "block"
271
+ icon: "heading-2"
293
272
  },
294
273
  {
295
274
  id: "heading-3",
296
275
  command: { type: "block.heading", level: 3 },
297
276
  label: "三级标题",
298
- icon: "heading-3",
299
- group: "block"
277
+ icon: "heading-3"
300
278
  },
301
279
  {
302
280
  id: "heading-4",
303
281
  command: { type: "block.heading", level: 4 },
304
282
  label: "四级标题",
305
- icon: "heading-4",
306
- group: "block"
283
+ icon: "heading-4"
307
284
  },
308
285
  {
309
286
  id: "heading-5",
310
287
  command: { type: "block.heading", level: 5 },
311
288
  label: "五级标题",
312
- icon: "heading-5",
313
- group: "block"
289
+ icon: "heading-5"
314
290
  },
315
291
  {
316
292
  id: "heading-6",
317
293
  command: { type: "block.heading", level: 6 },
318
294
  label: "六级标题",
319
- icon: "heading-6",
320
- group: "block"
295
+ icon: "heading-6"
321
296
  },
322
297
  {
323
298
  id: "quote",
324
299
  command: { type: "block.quote" },
325
300
  label: "引用",
326
- icon: "quote",
327
- group: "block"
301
+ icon: "quote"
328
302
  },
329
303
  {
330
304
  id: "divider",
331
305
  command: { type: "block.divider" },
332
306
  label: "分割线",
333
- icon: "minus",
334
- group: "block"
307
+ icon: "minus"
335
308
  },
336
309
  {
337
310
  id: "code-block",
338
311
  command: { type: "block.code" },
339
312
  label: "代码块",
340
- icon: "square-code",
341
- group: "block"
313
+ icon: "square-code"
342
314
  },
343
315
  {
344
316
  id: "ordered-list",
345
317
  command: { type: "list.ordered" },
346
318
  label: "有序列表",
347
- icon: "list-ordered",
348
- group: "list"
319
+ icon: "list-ordered"
349
320
  },
350
321
  {
351
322
  id: "unordered-list",
352
323
  command: { type: "list.unordered" },
353
324
  label: "无序列表",
354
- icon: "list",
355
- group: "list"
325
+ icon: "list"
356
326
  },
357
327
  {
358
328
  id: "todo-list",
359
329
  command: { type: "list.todo" },
360
330
  label: "待办列表",
361
- icon: "list-todo",
362
- group: "list"
331
+ icon: "list-todo"
363
332
  },
364
333
  {
365
334
  id: "align-left",
366
335
  command: { type: "align", value: "left" },
367
336
  label: "左对齐",
368
- icon: "align-left",
369
- group: "align"
337
+ icon: "align-left"
370
338
  },
371
339
  {
372
340
  id: "align-center",
373
341
  command: { type: "align", value: "center" },
374
342
  label: "居中",
375
- icon: "align-center",
376
- group: "align"
343
+ icon: "align-center"
377
344
  },
378
345
  {
379
346
  id: "align-right",
380
347
  command: { type: "align", value: "right" },
381
348
  label: "右对齐",
382
- icon: "align-right",
383
- group: "align"
349
+ icon: "align-right"
384
350
  },
385
351
  {
386
352
  id: "align-justify",
387
353
  command: { type: "align", value: "justify" },
388
354
  label: "两端对齐",
389
- icon: "align-justify",
390
- group: "align"
355
+ icon: "align-justify"
391
356
  },
392
357
  {
393
358
  id: "indent-increase",
394
359
  command: { type: "indent.increase" },
395
360
  label: "增加缩进",
396
- icon: "indent-increase",
397
- group: "align"
361
+ icon: "indent-increase"
398
362
  },
399
363
  {
400
364
  id: "indent-decrease",
401
365
  command: { type: "indent.decrease" },
402
366
  label: "减少缩进",
403
- icon: "indent-decrease",
404
- group: "align"
367
+ icon: "indent-decrease"
405
368
  },
406
369
  {
407
370
  id: "mention",
408
371
  command: { type: "mention.insert", item: { id: "", label: "", value: "" } },
409
372
  label: "@ 提及",
410
373
  icon: "at-sign",
411
- group: "insert",
412
374
  requiresPayload: !0
413
375
  },
414
376
  {
415
377
  id: "upload-image",
416
378
  command: { type: "media.pickImage" },
417
379
  label: "上传图片",
418
- icon: "upload-image",
419
- group: "media"
380
+ icon: "upload-image"
420
381
  },
421
382
  {
422
383
  id: "upload-video",
423
384
  command: { type: "media.pickVideo" },
424
385
  label: "上传视频",
425
- icon: "upload-video",
426
- group: "media"
386
+ icon: "upload-video"
427
387
  },
428
388
  {
429
389
  id: "table",
430
390
  command: { type: "table.insert", rows: 3, cols: 3 },
431
391
  label: "表格",
432
392
  icon: "table",
433
- group: "table",
434
393
  requiresPayload: !0,
435
394
  payloadPanel: w
436
395
  },
@@ -439,57 +398,52 @@ const h = {
439
398
  id: "slash-command",
440
399
  command: { type: "slash.open" },
441
400
  label: "/ 命令",
442
- icon: "list-plus",
443
- group: "insert"
401
+ icon: "list-plus"
444
402
  },
445
403
  {
446
404
  id: "undo",
447
405
  command: { type: "history.undo" },
448
406
  label: "撤销",
449
- icon: "undo",
450
- group: "history"
407
+ icon: "undo"
451
408
  },
452
409
  {
453
410
  id: "redo",
454
411
  command: { type: "history.redo" },
455
412
  label: "重做",
456
- icon: "redo",
457
- group: "history"
413
+ icon: "redo"
458
414
  },
459
415
  {
460
416
  id: "clear",
461
417
  command: { type: "content.clear" },
462
418
  label: "清空",
463
- icon: "trash-2",
464
- group: "history"
419
+ icon: "trash-2"
465
420
  },
466
421
  {
467
422
  id: "fullscreen",
468
423
  command: { type: "fullscreen.toggle" },
469
424
  label: "全屏",
470
- icon: "maximize",
471
- group: "view"
425
+ icon: "maximize"
472
426
  }
473
- ], r = {
427
+ ], d = {
474
428
  align: (e) => e.type === "align" ? e.value : void 0,
475
429
  "block.heading": (e) => e.type === "block.heading" ? e.level : void 0,
476
430
  "block.setCodeLanguage": (e) => e.type === "block.setCodeLanguage" ? e.language : void 0
477
- }, m = (e) => {
431
+ }, p = (e) => {
478
432
  var l;
479
- return (l = r[e.type]) == null ? void 0 : l.call(r, e);
433
+ return (l = d[e.type]) == null ? void 0 : l.call(d, e);
480
434
  }, K = (e, l) => {
481
- const a = m(e);
435
+ const a = p(e);
482
436
  return l.command === e.type && (a === void 0 || l.value === a);
483
437
  }, _ = (e, l) => K(e.command, l);
484
- function A(e = p) {
438
+ function A(e = m) {
485
439
  return e.map((l) => ({
486
440
  command: l.command.type,
487
441
  active: !1,
488
442
  disabled: !0,
489
- value: m(l.command)
443
+ value: p(l.command)
490
444
  }));
491
445
  }
492
- const s = {
446
+ const u = {
493
447
  toolbarKeys: [
494
448
  "undo",
495
449
  "redo",
@@ -541,23 +495,23 @@ const s = {
541
495
  }, M = (e) => typeof e == "object" && Array.isArray(e.menuKeys), q = (e) => new Map(
542
496
  e.map((l) => [l.id, l])
543
497
  ), I = (e, l) => typeof e == "string" ? e !== "|" && l.has(e) : l.has(e.key) || e.menuKeys.every((a) => l.has(a)), L = (e, l) => {
544
- const a = new Set((l == null ? void 0 : l.excludeKeys) ?? []), n = e.filter((o) => !I(o, a));
545
- if (!(l != null && l.insertKeys)) return n;
546
- const t = Math.max(0, Math.min(l.insertKeys.index, n.length));
498
+ const a = new Set((l == null ? void 0 : l.excludeKeys) ?? []), o = e.filter((n) => !I(n, a));
499
+ if (!(l != null && l.insertKeys)) return o;
500
+ const t = Math.max(0, Math.min(l.insertKeys.index, o.length));
547
501
  return [
548
- ...n.slice(0, t),
502
+ ...o.slice(0, t),
549
503
  ...l.insertKeys.keys,
550
- ...n.slice(t)
504
+ ...o.slice(t)
551
505
  ];
552
- }, R = (e, l, a, n) => {
506
+ }, R = (e, l, a, o) => {
553
507
  if (e === "|")
554
- return [{ type: "separator", key: `separator-${n}` }];
508
+ return [{ type: "separator", key: `separator-${o}` }];
555
509
  if (typeof e == "string") {
556
510
  const t = l.get(e);
557
511
  return !t || t.requiresPayload && !t.payloadPanel || a.has(t.id) ? [] : [{ type: "button", item: t }];
558
512
  }
559
513
  if (M(e)) {
560
- const t = e.menuKeys.filter((o) => !a.has(o)).map((o) => l.get(o)).filter((o) => o !== void 0 && (!o.requiresPayload || o.payloadPanel !== void 0));
514
+ const t = e.menuKeys.filter((n) => !a.has(n)).map((n) => l.get(n)).filter((n) => n !== void 0 && (!n.requiresPayload || n.payloadPanel !== void 0));
561
515
  return t.length > 0 ? [{
562
516
  type: "group",
563
517
  key: e.key,
@@ -576,13 +530,13 @@ const s = {
576
530
  for (; ((l = e.at(-1)) == null ? void 0 : l.type) === "separator"; )
577
531
  e.pop();
578
532
  return e;
579
- }, z = (e = s, l = p) => {
580
- const a = q(l), n = e.toolbarKeys ?? s.toolbarKeys ?? [], t = L(n, e), o = new Set(e.excludeKeys ?? []);
581
- let d = 0;
533
+ }, z = (e = u, l = m) => {
534
+ const a = q(l), o = e.toolbarKeys ?? u.toolbarKeys ?? [], t = L(o, e), n = new Set(e.excludeKeys ?? []);
535
+ let r = 0;
582
536
  const b = t.reduce((i, c) => {
583
- const g = R(c, a, o, d);
584
- return c === "|" && (d += 1), g.forEach((u) => {
585
- E(u, i) && i.push(u);
537
+ const y = R(c, a, n, r);
538
+ return c === "|" && (r += 1), y.forEach((s) => {
539
+ E(s, i) && i.push(s);
586
540
  }), i;
587
541
  }, []);
588
542
  return V(b);
@@ -591,9 +545,9 @@ export {
591
545
  h as codeBlockLanguagePanel,
592
546
  C as codeBlockLanguagePayloadPanel,
593
547
  A as createDisabledCommandStates,
594
- p as defaultMenuSchema,
595
- s as defaultToolbarConfig,
596
- m as getCommandStateMatchValue,
548
+ m as defaultMenuSchema,
549
+ u as defaultToolbarConfig,
550
+ p as getCommandStateMatchValue,
597
551
  K as isCommandStateForCommand,
598
552
  _ as isMenuItemCommandState,
599
553
  z as resolveToolbarMenu,