vue-devui 1.6.28 → 1.6.29

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.
@@ -8,11 +8,14 @@ export interface IToolbarItemConfig {
8
8
  template?: any;
9
9
  component?: any;
10
10
  shortKey?: string;
11
+ shortKeyWithCode?: string;
11
12
  params?: {
12
13
  [key: string]: any;
13
14
  };
14
15
  handler?(editor?: any, params?: any): void;
15
16
  }
17
+ export declare const GET_CTRL_KEY: () => "⌘" | "Ctrl" | undefined;
18
+ export declare const GET_ALT_KEY: () => "Alt" | "⌥" | undefined;
16
19
  export declare const DEFAULT_TOOLBARS: Record<string, IToolbarItemConfig>;
17
20
  export declare const DEFAULT_TOOLBAR_CONFIG: (string | string[])[];
18
21
  export declare const FONT_COLORS: string[];
@@ -1,2 +1,3 @@
1
+ import './git-graph.scss';
1
2
  declare const _default: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
2
3
  export default _default;
package/vue-devui.es.js CHANGED
@@ -17542,7 +17542,8 @@ function parseCodeToSingle(container, code, options) {
17542
17542
  diff2HtmlUi.draw();
17543
17543
  }
17544
17544
  function generateNumberTdObj(tdNodes) {
17545
- const lineNumber = parseInt(tdNodes[0].innerText) || -1;
17545
+ var _a;
17546
+ const lineNumber = ((_a = tdNodes[0]) == null ? void 0 : _a.innerText) ? parseInt(tdNodes[0].innerText) : -1;
17546
17547
  if (lineNumber !== -1) {
17547
17548
  return { [lineNumber]: tdNodes };
17548
17549
  }
@@ -35516,13 +35517,26 @@ ToolBarHandler.fullscreen = (editor) => {
35516
35517
  };
35517
35518
  ToolBarHandler.color = () => {
35518
35519
  };
35520
+ const GET_CTRL_KEY = () => {
35521
+ var _a;
35522
+ if (typeof window !== "undefined") {
35523
+ return ((_a = navigator == null ? void 0 : navigator.platform) == null ? void 0 : _a.indexOf("Mac")) !== -1 ? "\u2318" : "Ctrl";
35524
+ }
35525
+ };
35526
+ const GET_ALT_KEY = () => {
35527
+ var _a;
35528
+ if (typeof window !== "undefined") {
35529
+ return ((_a = navigator == null ? void 0 : navigator.platform) == null ? void 0 : _a.indexOf("Mac")) !== -1 ? "\u2325" : "Alt";
35530
+ }
35531
+ };
35519
35532
  const DEFAULT_TOOLBARS = {
35520
35533
  undo: {
35521
35534
  id: "undo",
35522
35535
  name: "undo",
35523
35536
  type: "button",
35524
35537
  icon: UNDO_ICON,
35525
- shortKey: "Ctrl+Z",
35538
+ shortKey: `${GET_CTRL_KEY()}+Z`,
35539
+ shortKeyWithCode: `${GET_CTRL_KEY()}+90`,
35526
35540
  handler: ToolBarHandler.undo
35527
35541
  },
35528
35542
  redo: {
@@ -35530,7 +35544,8 @@ const DEFAULT_TOOLBARS = {
35530
35544
  name: "redo",
35531
35545
  type: "button",
35532
35546
  icon: REDO_ICON,
35533
- shortKey: "Ctrl+Y",
35547
+ shortKey: `${GET_CTRL_KEY()}+Y`,
35548
+ shortKeyWithCode: `${GET_CTRL_KEY()}+89`,
35534
35549
  handler: ToolBarHandler.redo
35535
35550
  },
35536
35551
  bold: {
@@ -35538,7 +35553,8 @@ const DEFAULT_TOOLBARS = {
35538
35553
  name: "bold",
35539
35554
  type: "button",
35540
35555
  icon: BOLD_ICON,
35541
- shortKey: "Ctrl+B",
35556
+ shortKey: `${GET_CTRL_KEY()}+B`,
35557
+ shortKeyWithCode: `${GET_CTRL_KEY()}+66`,
35542
35558
  handler: ToolBarHandler.bold
35543
35559
  },
35544
35560
  italic: {
@@ -35546,7 +35562,8 @@ const DEFAULT_TOOLBARS = {
35546
35562
  name: "italic",
35547
35563
  type: "button",
35548
35564
  icon: ITALIC_ICON,
35549
- shortKey: "Ctrl+I",
35565
+ shortKey: `${GET_CTRL_KEY()}+I`,
35566
+ shortKeyWithCode: `${GET_CTRL_KEY()}+73`,
35550
35567
  handler: ToolBarHandler.italic
35551
35568
  },
35552
35569
  strike: {
@@ -35554,7 +35571,8 @@ const DEFAULT_TOOLBARS = {
35554
35571
  name: "strike",
35555
35572
  type: "button",
35556
35573
  icon: STRIKE_ICON,
35557
- shortKey: "Ctrl+D",
35574
+ shortKey: `${GET_CTRL_KEY()}+D`,
35575
+ shortKeyWithCode: `${GET_CTRL_KEY()}+68`,
35558
35576
  handler: ToolBarHandler.strike
35559
35577
  },
35560
35578
  h1: {
@@ -35562,7 +35580,8 @@ const DEFAULT_TOOLBARS = {
35562
35580
  name: "h1",
35563
35581
  type: "button",
35564
35582
  icon: H1_ICON,
35565
- shortKey: "Ctrl+1",
35583
+ shortKey: `${GET_CTRL_KEY()}+1`,
35584
+ shortKeyWithCode: `${GET_CTRL_KEY()}+49`,
35566
35585
  handler: ToolBarHandler.h1
35567
35586
  },
35568
35587
  h2: {
@@ -35570,7 +35589,8 @@ const DEFAULT_TOOLBARS = {
35570
35589
  name: "h2",
35571
35590
  type: "button",
35572
35591
  icon: H2_ICON,
35573
- shortKey: "Ctrl+2",
35592
+ shortKey: `${GET_CTRL_KEY()}+2`,
35593
+ shortKeyWithCode: `${GET_CTRL_KEY()}+50`,
35574
35594
  handler: ToolBarHandler.h2
35575
35595
  },
35576
35596
  ul: {
@@ -35578,7 +35598,8 @@ const DEFAULT_TOOLBARS = {
35578
35598
  name: "unorderedlist",
35579
35599
  type: "button",
35580
35600
  icon: LIST_UNORDERED_ICON,
35581
- shortKey: "Ctrl+U",
35601
+ shortKey: `${GET_CTRL_KEY()}+U`,
35602
+ shortKeyWithCode: `${GET_CTRL_KEY()}+85`,
35582
35603
  handler: ToolBarHandler.ul
35583
35604
  },
35584
35605
  ol: {
@@ -35586,7 +35607,8 @@ const DEFAULT_TOOLBARS = {
35586
35607
  name: "orderedlist",
35587
35608
  type: "button",
35588
35609
  icon: LIST_ORDERED_ICON,
35589
- shortKey: "Ctrl+O",
35610
+ shortKey: `${GET_CTRL_KEY()}+O`,
35611
+ shortKeyWithCode: `${GET_CTRL_KEY()}+79`,
35590
35612
  handler: ToolBarHandler.ol
35591
35613
  },
35592
35614
  checklist: {
@@ -35594,7 +35616,8 @@ const DEFAULT_TOOLBARS = {
35594
35616
  name: "checklist",
35595
35617
  type: "button",
35596
35618
  icon: LIST_CHECK_ICON,
35597
- shortKey: "Ctrl+Alt+C",
35619
+ shortKey: `${GET_CTRL_KEY()}+${GET_ALT_KEY()}+C`,
35620
+ shortKeyWithCode: `${GET_CTRL_KEY()}+${GET_ALT_KEY()}+67`,
35598
35621
  handler: ToolBarHandler.checkList
35599
35622
  },
35600
35623
  underline: {
@@ -35602,7 +35625,8 @@ const DEFAULT_TOOLBARS = {
35602
35625
  name: "underline",
35603
35626
  type: "button",
35604
35627
  icon: UNDERLINE_ICON,
35605
- shortKey: "Ctrl+R",
35628
+ shortKey: `${GET_CTRL_KEY()}+R`,
35629
+ shortKeyWithCode: `${GET_CTRL_KEY()}+82`,
35606
35630
  handler: ToolBarHandler.underline
35607
35631
  },
35608
35632
  font: {
@@ -35618,7 +35642,8 @@ const DEFAULT_TOOLBARS = {
35618
35642
  name: "link",
35619
35643
  type: "button",
35620
35644
  icon: LINK_ICON,
35621
- shortKey: "Ctrl+L",
35645
+ shortKey: `${GET_CTRL_KEY()}+L`,
35646
+ shortKeyWithCode: `${GET_CTRL_KEY()}+76`,
35622
35647
  handler: ToolBarHandler.link
35623
35648
  },
35624
35649
  image: {
@@ -35626,7 +35651,8 @@ const DEFAULT_TOOLBARS = {
35626
35651
  name: "image",
35627
35652
  type: "button",
35628
35653
  icon: IMAGE_ICON,
35629
- shortKey: "Ctrl+G",
35654
+ shortKey: `${GET_CTRL_KEY()}+G`,
35655
+ shortKeyWithCode: `${GET_CTRL_KEY()}+71`,
35630
35656
  params: { imageUploadToServer: false },
35631
35657
  handler: ToolBarHandler.image
35632
35658
  },
@@ -35636,7 +35662,8 @@ const DEFAULT_TOOLBARS = {
35636
35662
  type: "button",
35637
35663
  icon: FILE_ICON,
35638
35664
  params: {},
35639
- shortKey: "Ctrl+F",
35665
+ shortKey: `${GET_CTRL_KEY()}+F`,
35666
+ shortKeyWithCode: `${GET_CTRL_KEY()}+70`,
35640
35667
  handler: ToolBarHandler.file
35641
35668
  },
35642
35669
  code: {
@@ -35644,7 +35671,8 @@ const DEFAULT_TOOLBARS = {
35644
35671
  name: "code",
35645
35672
  type: "button",
35646
35673
  icon: CODE_ICON,
35647
- shortKey: "Ctrl+K",
35674
+ shortKey: `${GET_CTRL_KEY()}+K`,
35675
+ shortKeyWithCode: `${GET_CTRL_KEY()}+75`,
35648
35676
  handler: ToolBarHandler.code
35649
35677
  },
35650
35678
  table: {
@@ -35652,7 +35680,8 @@ const DEFAULT_TOOLBARS = {
35652
35680
  name: "table",
35653
35681
  type: "button",
35654
35682
  icon: TABLE_ICON,
35655
- shortKey: "Ctrl+Alt+T",
35683
+ shortKey: `${GET_CTRL_KEY()}+${GET_ALT_KEY()}+T`,
35684
+ shortKeyWithCode: `${GET_CTRL_KEY()}+${GET_ALT_KEY()}+84`,
35656
35685
  handler: ToolBarHandler.table
35657
35686
  },
35658
35687
  fullscreen: {
@@ -36046,8 +36075,8 @@ function useEditorMd(props, ctx2) {
36046
36075
  const tempToolbars = { ...toolbars, ...customToolbars == null ? void 0 : customToolbars.value };
36047
36076
  for (const key of Object.keys(tempToolbars)) {
36048
36077
  const toolbarItem = tempToolbars[key];
36049
- if (toolbarItem.shortKey && flatToolbarConfig.includes(toolbarItem.id)) {
36050
- shortKeys[toolbarItem.shortKey.replace(/\+/g, "-")] = (_a = toolbarItem.handler) == null ? void 0 : _a.bind(null, editorIns, toolbarItem.params);
36078
+ if (toolbarItem.shortKeyWithCode && flatToolbarConfig.includes(toolbarItem.id)) {
36079
+ shortKeys[toolbarItem.shortKeyWithCode.replace(/\+/g, "-")] = (_a = toolbarItem.handler) == null ? void 0 : _a.bind(null, editorIns, toolbarItem.params);
36051
36080
  }
36052
36081
  }
36053
36082
  editorIns.setOption(
@@ -36074,13 +36103,16 @@ function useEditorMd(props, ctx2) {
36074
36103
  if (e.ctrlKey) {
36075
36104
  keyCombination += "Ctrl-";
36076
36105
  }
36106
+ if (e.metaKey) {
36107
+ keyCombination += "\u2318-";
36108
+ }
36077
36109
  if (e.altKey) {
36078
- keyCombination += "Alt-";
36110
+ keyCombination += `${GET_ALT_KEY()}-`;
36079
36111
  }
36080
36112
  if (e.shiftKey) {
36081
36113
  keyCombination += "Shift-";
36082
36114
  }
36083
- keyCombination += e.key.toUpperCase();
36115
+ keyCombination += e.keyCode;
36084
36116
  if (shortKeys[keyCombination] && typeof shortKeys[keyCombination] === "function") {
36085
36117
  e.preventDefault();
36086
36118
  shortKeys[keyCombination]();
@@ -37922,10 +37954,10 @@ class GitGraph$1 {
37922
37954
  this.graphHeight = this.element.getBoundingClientRect().height;
37923
37955
  this.graphWidth = this.element.getBoundingClientRect().width;
37924
37956
  const ch = Math.max(this.graphHeight, this.offsetY + this.unitTime * this.mtime + 150);
37925
- Math.max(this.graphWidth, this.offsetX + this.unitSpace * this.mspace + 300);
37957
+ const cw = Math.max(this.graphWidth, this.offsetX + this.unitSpace * this.mspace + 500);
37926
37958
  this.svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
37927
37959
  this.svg.setAttribute("height", ch + "");
37928
- this.svg.setAttribute("width", "100%");
37960
+ this.svg.setAttribute("width", cw + "");
37929
37961
  (_a = this.element) == null ? void 0 : _a.appendChild(this.svg);
37930
37962
  this.barHeight = Math.max(this.graphHeight, this.unitTime * this.commits.length + 320);
37931
37963
  const _ref = this.commits;
@@ -38061,7 +38093,7 @@ class GitGraph$1 {
38061
38093
  }
38062
38094
  drawDot(x, y, commit) {
38063
38095
  const options = this.options;
38064
- const isdark = this.isDark;
38096
+ this.isDark;
38065
38097
  const circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
38066
38098
  const attrs = {
38067
38099
  cx: x,
@@ -38069,7 +38101,7 @@ class GitGraph$1 {
38069
38101
  r: 4,
38070
38102
  fill: "#fff",
38071
38103
  strokeWidth: 1,
38072
- stroke: this.colors[commit.space],
38104
+ stroke: this.colors[commit.space % 20],
38073
38105
  style: "cursor: pointer;"
38074
38106
  };
38075
38107
  this.setNodeAttr(circle, attrs);
@@ -38092,7 +38124,7 @@ class GitGraph$1 {
38092
38124
  img.appendChild(authorText);
38093
38125
  this.svg.appendChild(img);
38094
38126
  if (!this.messageBoxWidth) {
38095
- this.messageBoxWidth = this.svg.getBoundingClientRect.width - (avatar_box_x + 40);
38127
+ this.messageBoxWidth = this.svg.getBoundingClientRect().width - (avatar_box_x + 40);
38096
38128
  }
38097
38129
  let route = ["M", avatar_box_x + 15, avatar_box_y - 20, "L", avatar_box_x + 15, avatar_box_y];
38098
38130
  const line1 = document.createElementNS("http://www.w3.org/2000/svg", "path");
@@ -38116,16 +38148,25 @@ class GitGraph$1 {
38116
38148
  if (commit.author.name.length > this.maxNameLength) {
38117
38149
  commit.author.name = commit.author.name.substr(0, this.maxNameLength) + "...";
38118
38150
  }
38119
- const commitText = document.createElementNS("http://www.w3.org/2000/svg", "text");
38151
+ const commitText = document.createElementNS("http://www.w3.org/2000/svg", "foreignObject");
38120
38152
  const commitAttrs = {
38121
38153
  x: avatar_box_x + 40,
38122
- y: y + 4,
38154
+ y: y - 8,
38123
38155
  "text-anchor": "start",
38124
38156
  style: "cursor: pointer;text-anchor: start;",
38125
- fill: isdark ? "#e8e8e8" : "#2e2e2e",
38126
- "font-size": 14
38157
+ width: this.messageBoxWidth,
38158
+ height: 20
38127
38159
  };
38128
38160
  this.setNodeAttr(commitText, commitAttrs);
38161
+ const textArr = {
38162
+ style: "width: 100%; height: 20px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;",
38163
+ title: commit.message
38164
+ };
38165
+ const text = document.createElement("div");
38166
+ this.setNodeAttr(text, textArr);
38167
+ text.innerText = commit.message.replace(/\n/g, " ");
38168
+ commitText.appendChild(text);
38169
+ this.svg.appendChild(commitText);
38129
38170
  const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
38130
38171
  tspan.appendChild(document.createTextNode(commit.message.replace(/\n/g, " ")));
38131
38172
  commitText.appendChild(tspan);
@@ -38159,9 +38200,9 @@ class GitGraph$1 {
38159
38200
  parentX1 = this.offsetX + this.unitSpace * (this.mspace - parentCommit.space);
38160
38201
  parentX2 = this.offsetX + this.unitSpace * (this.mspace - parent[1]);
38161
38202
  if (parentCommit.space <= commit.space) {
38162
- color2 = this.colors[commit.space];
38203
+ color2 = this.colors[commit.space % 20];
38163
38204
  } else {
38164
- color2 = this.colors[parentCommit.space];
38205
+ color2 = this.colors[parentCommit.space % 20];
38165
38206
  }
38166
38207
  if (parent[1] === commit.space) {
38167
38208
  offset2 = [0, 5];
@@ -38251,14 +38292,14 @@ class GitGraph$1 {
38251
38292
  ];
38252
38293
  const rectAttrs = {
38253
38294
  fill: this.isDark ? "#4C4C4C" : "#fff",
38254
- stroke: this.colors[commit.space],
38295
+ stroke: this.colors[commit.space % 20],
38255
38296
  "stroke-width": "1px",
38256
38297
  d: path.join(" "),
38257
38298
  transform: `matrix(1,0,0,1,-${textbox.width + 26},0)`
38258
38299
  };
38259
38300
  const newAttrs = {
38260
38301
  transform: `matrix(1,0,0,1,-${textbox.width + 26},0)`,
38261
- fill: this.colors[commit.space]
38302
+ fill: this.colors[commit.space % 20]
38262
38303
  };
38263
38304
  this.setNodeAttr(text, newAttrs);
38264
38305
  this.setNodeAttr(rect, rectAttrs);
@@ -38449,6 +38490,7 @@ function useGitGraph(props, ctx2, isDark) {
38449
38490
  initGraph
38450
38491
  };
38451
38492
  }
38493
+ var gitGraph = "";
38452
38494
  var GitGraph = defineComponent({
38453
38495
  name: "DGitGraph",
38454
38496
  props: gitGraphProps,
@@ -54406,7 +54448,7 @@ const installs = [
54406
54448
  VirtualListInstall
54407
54449
  ];
54408
54450
  var vueDevui = {
54409
- version: "1.6.28",
54451
+ version: "1.6.29",
54410
54452
  install(app) {
54411
54453
  installs.forEach((p) => app.use(p));
54412
54454
  }