@jvs-milkdown/components 1.1.2 → 1.1.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jvs-milkdown/components",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "keywords": [
5
5
  "milkdown",
6
6
  "milkdown plugin"
@@ -17,101 +17,48 @@
17
17
  ],
18
18
  "type": "module",
19
19
  "sideEffects": false,
20
- "main": "./src/index.ts",
20
+ "main": "./lib/index.js",
21
21
  "exports": {
22
22
  ".": {
23
- "import": "./src/index.ts"
23
+ "types": "./lib/index.d.ts",
24
+ "import": "./lib/index.js"
24
25
  },
25
26
  "./image-block": {
26
- "import": "./src/image-block/index.ts"
27
+ "types": "./lib/image-block/index.d.ts",
28
+ "import": "./lib/image-block/index.js"
27
29
  },
28
30
  "./code-block": {
29
- "import": "./src/code-block/index.ts"
31
+ "types": "./lib/code-block/index.d.ts",
32
+ "import": "./lib/code-block/index.js"
30
33
  },
31
34
  "./list-item-block": {
32
- "import": "./src/list-item-block/index.ts"
35
+ "types": "./lib/list-item-block/index.d.ts",
36
+ "import": "./lib/list-item-block/index.js"
33
37
  },
34
38
  "./link-tooltip": {
35
- "import": "./src/link-tooltip/index.ts"
39
+ "types": "./lib/link-tooltip/index.d.ts",
40
+ "import": "./lib/link-tooltip/index.js"
36
41
  },
37
42
  "./image-inline": {
38
- "import": "./src/image-inline/index.ts"
43
+ "types": "./lib/image-inline/index.d.ts",
44
+ "import": "./lib/image-inline/index.js"
39
45
  },
40
46
  "./table-block": {
41
- "import": "./src/table-block/index.ts"
47
+ "types": "./lib/table-block/index.d.ts",
48
+ "import": "./lib/table-block/index.js"
42
49
  }
43
50
  },
44
- "publishConfig": {
45
- "exports": {
46
- ".": {
47
- "types": "./lib/index.d.ts",
48
- "import": "./lib/index.js"
49
- },
50
- "./image-block": {
51
- "types": "./lib/image-block/index.d.ts",
52
- "import": "./lib/image-block/index.js"
53
- },
54
- "./code-block": {
55
- "types": "./lib/code-block/index.d.ts",
56
- "import": "./lib/code-block/index.js"
57
- },
58
- "./list-item-block": {
59
- "types": "./lib/list-item-block/index.d.ts",
60
- "import": "./lib/list-item-block/index.js"
61
- },
62
- "./link-tooltip": {
63
- "types": "./lib/link-tooltip/index.d.ts",
64
- "import": "./lib/link-tooltip/index.js"
65
- },
66
- "./image-inline": {
67
- "types": "./lib/image-inline/index.d.ts",
68
- "import": "./lib/image-inline/index.js"
69
- },
70
- "./table-block": {
71
- "types": "./lib/table-block/index.d.ts",
72
- "import": "./lib/table-block/index.js"
73
- }
74
- },
75
- "main": "./lib/index.js",
76
- "types": "./lib/index.d.ts",
77
- "typesVersions": {
78
- "*": {
79
- "image-block": [
80
- "./lib/image-block/index.d.ts"
81
- ],
82
- "code-block": [
83
- "./lib/code-block/index.d.ts"
84
- ],
85
- "list-item-block": [
86
- "./lib/list-item-block/index.d.ts"
87
- ],
88
- "link-tooltip": [
89
- "./lib/link-tooltip/index.d.ts"
90
- ],
91
- "image-inline": [
92
- "./lib/image-inline/index.d.ts"
93
- ],
94
- "table-block": [
95
- "./lib/table-block/index.d.ts"
96
- ]
97
- }
98
- }
99
- },
100
- "scripts": {
101
- "build": "rollup -c",
102
- "test": "vitest run"
103
- },
104
51
  "dependencies": {
105
52
  "@floating-ui/dom": "^1.5.1",
106
- "@jvs-milkdown/core": "^1.1.2",
107
- "@jvs-milkdown/ctx": "^1.1.2",
108
- "@jvs-milkdown/exception": "^1.1.2",
109
- "@jvs-milkdown/plugin-tooltip": "^1.1.2",
110
- "@jvs-milkdown/preset-commonmark": "^1.1.2",
111
- "@jvs-milkdown/preset-gfm": "^1.1.2",
112
- "@jvs-milkdown/prose": "^1.1.2",
113
- "@jvs-milkdown/transformer": "^1.1.2",
114
- "@jvs-milkdown/utils": "^1.1.2",
53
+ "@jvs-milkdown/core": "^1.1.3",
54
+ "@jvs-milkdown/ctx": "^1.1.3",
55
+ "@jvs-milkdown/exception": "^1.1.3",
56
+ "@jvs-milkdown/plugin-tooltip": "^1.1.3",
57
+ "@jvs-milkdown/preset-commonmark": "^1.1.3",
58
+ "@jvs-milkdown/preset-gfm": "^1.1.3",
59
+ "@jvs-milkdown/prose": "^1.1.3",
60
+ "@jvs-milkdown/transformer": "^1.1.3",
61
+ "@jvs-milkdown/utils": "^1.1.3",
115
62
  "@types/lodash-es": "^4.17.12",
116
63
  "clsx": "^2.0.0",
117
64
  "dompurify": "^3.2.5",
@@ -132,5 +79,32 @@
132
79
  "@codemirror/language": "^6",
133
80
  "@codemirror/state": "^6",
134
81
  "@codemirror/view": "^6"
82
+ },
83
+ "scripts": {
84
+ "build": "rollup -c",
85
+ "test": "vitest run"
86
+ },
87
+ "types": "./lib/index.d.ts",
88
+ "typesVersions": {
89
+ "*": {
90
+ "image-block": [
91
+ "./lib/image-block/index.d.ts"
92
+ ],
93
+ "code-block": [
94
+ "./lib/code-block/index.d.ts"
95
+ ],
96
+ "list-item-block": [
97
+ "./lib/list-item-block/index.d.ts"
98
+ ],
99
+ "link-tooltip": [
100
+ "./lib/link-tooltip/index.d.ts"
101
+ ],
102
+ "image-inline": [
103
+ "./lib/image-inline/index.d.ts"
104
+ ],
105
+ "table-block": [
106
+ "./lib/table-block/index.d.ts"
107
+ ]
108
+ }
135
109
  }
136
- }
110
+ }
@@ -82,6 +82,8 @@ export const TableBlock = defineComponent<TableBlockProps>({
82
82
  const hoverIndex = ref<CellIndex>([0, 0])
83
83
  const lineHoverIndex = ref<CellIndex>([-1, -1])
84
84
  const dragInfo = ref<DragInfo>()
85
+ const yLineHandleRef = ref<HTMLDivElement>()
86
+ const xLineHandleRef = ref<HTMLDivElement>()
85
87
 
86
88
  // --- Column resize state ---
87
89
  const resizingCol = ref(-1)
@@ -112,6 +114,8 @@ export const TableBlock = defineComponent<TableBlockProps>({
112
114
  dragPreviewRef,
113
115
  tableWrapperRef,
114
116
  contentWrapperRef,
117
+ yLineHandleRef,
118
+ xLineHandleRef,
115
119
  hoverIndex,
116
120
  lineHoverIndex,
117
121
  dragInfo,
@@ -120,8 +124,6 @@ export const TableBlock = defineComponent<TableBlockProps>({
120
124
  const { pointerLeave, pointerMove } = usePointerHandlers(refs, view)
121
125
  const { dragRow, dragCol } = useDragHandlers(refs, ctx, getPos)
122
126
  const {
123
- onAddRow,
124
- onAddCol,
125
127
  addRowByIndex,
126
128
  addColByIndex,
127
129
  selectCol,
@@ -437,9 +439,9 @@ export const TableBlock = defineComponent<TableBlockProps>({
437
439
  hoverIndex.value = [0, i]
438
440
  dragCol(e)
439
441
  }}
440
- onClick={(e) => {
442
+ onClick={() => {
441
443
  hoverIndex.value = [0, i]
442
- selectCol(e)
444
+ selectCol()
443
445
  activeColIndex.value = i
444
446
  activeRowIndex.value = -1
445
447
  }}
@@ -497,8 +499,8 @@ export const TableBlock = defineComponent<TableBlockProps>({
497
499
  {[
498
500
  ...colBounds.value.map((b) => b.left),
499
501
  colBounds.value.length
500
- ? colBounds.value[colBounds.value.length - 1].left +
501
- colBounds.value[colBounds.value.length - 1].width
502
+ ? colBounds.value[colBounds.value.length - 1]!.left +
503
+ colBounds.value[colBounds.value.length - 1]!.width
502
504
  : 0,
503
505
  ].map((left, i) => (
504
506
  <div
@@ -543,9 +545,9 @@ export const TableBlock = defineComponent<TableBlockProps>({
543
545
  hoverIndex.value = [i, 0]
544
546
  dragRow(e)
545
547
  }}
546
- onClick={(e) => {
548
+ onClick={() => {
547
549
  hoverIndex.value = [i, 0]
548
- selectRow(e)
550
+ selectRow()
549
551
  activeRowIndex.value = i
550
552
  activeColIndex.value = -1
551
553
  }}
@@ -575,8 +577,8 @@ export const TableBlock = defineComponent<TableBlockProps>({
575
577
  {[
576
578
  ...rowBounds.value.map((b) => b.top),
577
579
  rowBounds.value.length
578
- ? rowBounds.value[rowBounds.value.length - 1].top +
579
- rowBounds.value[rowBounds.value.length - 1].height
580
+ ? rowBounds.value[rowBounds.value.length - 1]!.top +
581
+ rowBounds.value[rowBounds.value.length - 1]!.height
580
582
  : 0,
581
583
  ].map((top, i) => (
582
584
  <div
@@ -23,6 +23,8 @@ export interface Refs {
23
23
  dragPreviewRef: Ref<HTMLDivElement | undefined>
24
24
  tableWrapperRef: Ref<HTMLDivElement | undefined>
25
25
  contentWrapperRef: Ref<HTMLElement | undefined>
26
+ yLineHandleRef: Ref<HTMLDivElement | undefined>
27
+ xLineHandleRef: Ref<HTMLDivElement | undefined>
26
28
  hoverIndex: Ref<CellIndex>
27
29
  lineHoverIndex: Ref<CellIndex>
28
30
  dragInfo: Ref<DragInfo | undefined>