@prosekit/basic 0.0.0-next-20231120040948 → 0.0.0-next-20240427133255

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,41 +1,46 @@
1
1
  import { Attrs } from 'prosemirror-model';
2
- import { Config } from 'tailwindcss';
3
2
  import { DedentListOptions } from 'prosemirror-flat-list';
4
- import { default as default_2 } from '.pnpm/postcss@8.4.31/node_modules/postcss/lib/processor';
5
3
  import { Extension } from '@prosekit/core';
6
4
  import { HeadingAttrs } from '@prosekit/extensions/heading';
7
5
  import { ImageAttrs } from '@prosekit/extensions/image';
8
6
  import { IndentListOptions } from 'prosemirror-flat-list';
7
+ import { LinkAttrs } from '@prosekit/extensions/link';
9
8
  import { ListAttributes } from 'prosemirror-flat-list';
10
9
  import { MarkType } from 'prosemirror-model';
11
10
  import { Node as Node_2 } from 'prosemirror-model';
12
11
  import { NodeRange } from 'prosemirror-model';
13
12
  import { NodeType } from 'prosemirror-model';
14
13
  import { Options } from 'tsup';
15
- import { Plugin as Plugin_2 } from '.pnpm/postcss@8.4.31/node_modules/postcss';
16
14
  import { ToggleCollapsedOptions } from 'prosemirror-flat-list';
17
15
  import { UnwrapListOptions } from 'prosemirror-flat-list';
18
- import { UserProjectConfigExport } from 'vitest/dist/config.js';
19
16
 
17
+ /**
18
+ * @public
19
+ */
20
20
  export declare type BasicExtension = ReturnType<typeof defineBasicExtension>;
21
21
 
22
22
  export declare namespace default_alias {
23
- let plugins: (default_2 | Plugin_2)[];
23
+ let plugins: {
24
+ 'postcss-nesting': {};
25
+ };
24
26
  }
25
27
 
26
- /** @type {import('tailwindcss').Config} */
27
- export declare const default_alias_1: Config;
28
+ export declare const default_alias_1: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
28
29
 
29
- export declare const default_alias_2: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
30
-
31
- export declare const default_alias_3: UserProjectConfigExport;
30
+ export declare const default_alias_2: {
31
+ test: {
32
+ environment: "jsdom";
33
+ };
34
+ };
32
35
 
33
36
  /**
37
+ * A basic extension that includes some common functionality. You can copy this
38
+ * function and customize it to your needs.
34
39
  * @public
35
40
  */
36
41
  export declare function defineBasicExtension(): Extension< {
37
- NODES: "text" | "doc" | "paragraph" | "heading" | "image" | "list";
38
- MARKS: "code" | "bold" | "italic" | "strike" | "underline";
42
+ NODES: "blockquote" | "table" | "text" | "doc" | "paragraph" | "heading" | "image" | "list" | "tableRow" | "tableCell" | "tableHeaderCell";
43
+ MARKS: "code" | "link" | "bold" | "strike" | "italic" | "underline";
39
44
  COMMAND_ARGS: {
40
45
  setHeading: [attrs?: HeadingAttrs | undefined];
41
46
  insertHeading: [attrs?: HeadingAttrs | undefined];
@@ -56,7 +61,17 @@ toggleBold: [];
56
61
  toggleUnderline: [];
57
62
  toggleStrike: [];
58
63
  toggleCode: [];
64
+ addLink: [attrs: LinkAttrs];
65
+ removeLink: [];
66
+ toggleLink: [attrs: LinkAttrs];
67
+ expandLink: [];
59
68
  insertImage: [attrs?: ImageAttrs | undefined];
69
+ insertTable: [{
70
+ row: number;
71
+ col: number;
72
+ header: boolean;
73
+ }];
74
+ exitTable: [];
60
75
  insertText: [{
61
76
  text: string;
62
77
  from?: number | undefined;
@@ -83,6 +98,11 @@ attrs?: Attrs | null | undefined;
83
98
  from?: number | undefined;
84
99
  to?: number | undefined;
85
100
  }];
101
+ setNodeAttrs: [options: {
102
+ type: string | NodeType;
103
+ attrs: Attrs;
104
+ pos?: number | undefined;
105
+ }];
86
106
  selectAll: [];
87
107
  addMark: [options: {
88
108
  type: string | MarkType;
@@ -8,14 +8,19 @@ import {
8
8
  defineText,
9
9
  union
10
10
  } from "@prosekit/core";
11
+ import { defineBlockquote } from "@prosekit/extensions/blockquote";
11
12
  import { defineBold } from "@prosekit/extensions/bold";
12
13
  import { defineCode } from "@prosekit/extensions/code";
14
+ import { defineDropCursor } from "@prosekit/extensions/drop-cursor";
13
15
  import { defineHeading } from "@prosekit/extensions/heading";
14
16
  import { defineImage } from "@prosekit/extensions/image";
15
17
  import { defineItalic } from "@prosekit/extensions/italic";
18
+ import { defineLink } from "@prosekit/extensions/link";
16
19
  import { defineList } from "@prosekit/extensions/list";
17
20
  import { defineStrike } from "@prosekit/extensions/strike";
21
+ import { defineTable } from "@prosekit/extensions/table";
18
22
  import { defineUnderline } from "@prosekit/extensions/underline";
23
+ import { defineVirtualSelection } from "@prosekit/extensions/virtual-selection";
19
24
  function defineBasicExtension() {
20
25
  return union([
21
26
  defineDoc(),
@@ -23,6 +28,7 @@ function defineBasicExtension() {
23
28
  defineHeading(),
24
29
  defineHistory(),
25
30
  defineList(),
31
+ defineBlockquote(),
26
32
  defineBaseKeymap(),
27
33
  defineBaseCommands(),
28
34
  defineItalic(),
@@ -30,8 +36,12 @@ function defineBasicExtension() {
30
36
  defineUnderline(),
31
37
  defineStrike(),
32
38
  defineCode(),
39
+ defineLink(),
33
40
  defineImage(),
34
- defineParagraph()
41
+ defineParagraph(),
42
+ defineDropCursor(),
43
+ defineVirtualSelection(),
44
+ defineTable()
35
45
  ]);
36
46
  }
37
47
  export {
package/dist/style.css CHANGED
@@ -1,6 +1,8 @@
1
- /* ../../node_modules/.pnpm/prosemirror-view@1.32.4/node_modules/prosemirror-view/style/prosemirror.css */
1
+ /* ../../node_modules/.pnpm/prosemirror-view@1.33.5/node_modules/prosemirror-view/style/prosemirror.css */
2
2
  .ProseMirror {
3
3
  position: relative;
4
+ }
5
+ .ProseMirror {
4
6
  word-wrap: break-word;
5
7
  white-space: pre-wrap;
6
8
  white-space: break-spaces;
@@ -50,12 +52,11 @@ img.ProseMirror-separator {
50
52
 
51
53
  /* ../pm/src/view/style/prosemirror.css */
52
54
 
53
- /* ../core/src/style.css */
54
-
55
- /* ../../node_modules/.pnpm/prosemirror-flat-list@0.4.3/node_modules/prosemirror-flat-list/dist/style.css */
55
+ /* ../../node_modules/.pnpm/prosemirror-flat-list@0.5.0/node_modules/prosemirror-flat-list/dist/style.css */
56
56
  .prosemirror-flat-list {
57
57
  padding: 0;
58
58
  margin-top: 0;
59
+ margin-bottom: 0;
59
60
  margin-left: 32px;
60
61
  margin-bottom: 0;
61
62
  position: relative;
@@ -78,25 +79,30 @@ img.ProseMirror-separator {
78
79
  .prosemirror-flat-list[data-list-kind=bullet] {
79
80
  list-style: disc;
80
81
  }
82
+ .prosemirror-flat-list[data-list-kind=ordered] {
83
+ counter-increment: prosemirror-flat-list-counter;
84
+ }
85
+ .prosemirror-flat-list[data-list-kind=ordered] > * {
86
+ contain: style;
87
+ }
81
88
  .prosemirror-flat-list[data-list-kind=ordered]::before {
82
89
  position: absolute;
83
90
  right: 100%;
84
91
  font-variant-numeric: tabular-nums;
85
92
  content: counter(prosemirror-flat-list-counter, decimal) ". ";
86
93
  }
87
- @supports (-moz-appearance: none) {
88
- .prosemirror-flat-list[data-list-kind=ordered] {
89
- contain: style;
90
- counter-increment: prosemirror-flat-list-counter;
91
- }
94
+ .prosemirror-flat-list[data-list-kind=ordered]:first-child,
95
+ :not(.prosemirror-flat-list[data-list-kind=ordered]) + .prosemirror-flat-list[data-list-kind=ordered] {
96
+ counter-reset: prosemirror-flat-list-counter;
92
97
  }
93
- @supports not (-moz-appearance: none) {
94
- .prosemirror-flat-list[data-list-kind=ordered] {
95
- counter-reset: prosemirror-flat-list-counter;
96
- counter-increment: prosemirror-flat-list-counter;
98
+ @supports (counter-set: prosemirror-flat-list-counter 1) {
99
+ [data-list-order]:is(.prosemirror-flat-list[data-list-kind=ordered]:first-child, :not(.prosemirror-flat-list[data-list-kind=ordered]) + .prosemirror-flat-list[data-list-kind=ordered]) {
100
+ counter-set: prosemirror-flat-list-counter var(--prosemirror-flat-list-order);
97
101
  }
98
- .prosemirror-flat-list[data-list-kind=ordered] + .prosemirror-flat-list[data-list-kind=ordered] {
99
- counter-reset: none;
102
+ }
103
+ @supports not (counter-set: prosemirror-flat-list-counter 1) {
104
+ [data-list-order]:is(.prosemirror-flat-list[data-list-kind=ordered]:first-child, :not(.prosemirror-flat-list[data-list-kind=ordered]) + .prosemirror-flat-list[data-list-kind=ordered]) {
105
+ counter-increment: prosemirror-flat-list-counter var(--prosemirror-flat-list-order);
100
106
  }
101
107
  }
102
108
  .prosemirror-flat-list[data-list-kind=task] > .list-marker {
@@ -136,4 +142,55 @@ img.ProseMirror-separator {
136
142
 
137
143
  /* ../extensions/src/list/style.css */
138
144
 
145
+ /* ../extensions/src/table/style.css */
146
+ .ProseMirror .tableWrapper {
147
+ overflow-x: auto;
148
+ }
149
+ .ProseMirror table {
150
+ border-collapse: collapse;
151
+ table-layout: fixed;
152
+ width: 100%;
153
+ overflow: hidden;
154
+ }
155
+ .ProseMirror td,
156
+ .ProseMirror th {
157
+ vertical-align: top;
158
+ box-sizing: border-box;
159
+ position: relative;
160
+ border-width: 1px;
161
+ }
162
+ .ProseMirror .column-resize-handle {
163
+ position: absolute;
164
+ right: -2px;
165
+ top: 0;
166
+ bottom: 0;
167
+ width: 4px;
168
+ z-index: 20;
169
+ background-color: HighlightText;
170
+ pointer-events: none;
171
+ }
172
+ .ProseMirror.resize-cursor {
173
+ cursor: ew-resize;
174
+ cursor: col-resize;
175
+ }
176
+ .ProseMirror .selectedCell {
177
+ background-color: Highlight;
178
+ }
179
+
180
+ /* ../extensions/src/placeholder/style.css */
181
+ .prosekit-placeholder::before {
182
+ position: absolute;
183
+ opacity: 30%;
184
+ pointer-events: none;
185
+ height: 0;
186
+ content: attr(data-placeholder);
187
+ }
188
+
189
+ /* ../extensions/src/virtual-selection/style.css */
190
+ .prosekit-virtual-selection {
191
+ background-color: Highlight;
192
+ box-shadow: 0 0 0 3px Highlight;
193
+ border-radius: 2px;
194
+ }
195
+
139
196
  /* src/style.css */
@@ -0,0 +1,137 @@
1
+ /* src/typography.css */
2
+ div.ProseMirror {
3
+ display: flex;
4
+ flex-direction: column;
5
+ }
6
+ div.ProseMirror p:first-child,
7
+ div.ProseMirror h1:first-child,
8
+ div.ProseMirror h2:first-child,
9
+ div.ProseMirror h3:first-child,
10
+ div.ProseMirror h4:first-child,
11
+ div.ProseMirror h5:first-child,
12
+ div.ProseMirror h6:first-child {
13
+ margin-top: 0;
14
+ }
15
+ div.ProseMirror p:last-child,
16
+ div.ProseMirror h1:last-child,
17
+ div.ProseMirror h2:last-child,
18
+ div.ProseMirror h3:last-child,
19
+ div.ProseMirror h4:last-child,
20
+ div.ProseMirror h5:last-child,
21
+ div.ProseMirror h6:last-child {
22
+ margin-bottom: 0;
23
+ }
24
+ div.ProseMirror h1,
25
+ div.ProseMirror h2,
26
+ div.ProseMirror h3,
27
+ div.ProseMirror h4,
28
+ div.ProseMirror h5,
29
+ div.ProseMirror h6 {
30
+ font-weight: 600;
31
+ line-height: 1.25;
32
+ padding-top: 0;
33
+ padding-bottom: 0;
34
+ border-style: none;
35
+ }
36
+ div.ProseMirror a {
37
+ text-decoration: underline;
38
+ font-weight: 500;
39
+ }
40
+ div.ProseMirror p,
41
+ div.ProseMirror ul,
42
+ div.ProseMirror ol,
43
+ div.ProseMirror pre {
44
+ padding: 0.5rem 0;
45
+ line-height: 1.5;
46
+ }
47
+ div.ProseMirror blockquote {
48
+ padding-left: 1em;
49
+ border-left: 0.25em solid hsla(0, 0%, 60%, 0.4);
50
+ }
51
+ div.ProseMirror h1 {
52
+ margin: 1rem 0;
53
+ font-size: 2.25em;
54
+ }
55
+ div.ProseMirror h2 {
56
+ margin: 1.75em 0 0.5em;
57
+ font-size: 1.75em;
58
+ }
59
+ div.ProseMirror h3 {
60
+ margin: 1.5em 0 0.5em;
61
+ font-size: 1.375em;
62
+ }
63
+ div.ProseMirror h4 {
64
+ margin: 1em 0;
65
+ font-size: 1.125em;
66
+ }
67
+ div.ProseMirror h5 {
68
+ margin: 0.5em 0;
69
+ }
70
+ div.ProseMirror h6 {
71
+ opacity: 0.8;
72
+ }
73
+ div.ProseMirror img,
74
+ div.ProseMirror video {
75
+ margin: 0.4em 0;
76
+ width: min-content;
77
+ max-width: 100%;
78
+ }
79
+ div.ProseMirror code {
80
+ font-size: 0.875em;
81
+ font-weight: 600;
82
+ }
83
+ div.ProseMirror pre {
84
+ margin: 0.5rem 0;
85
+ padding: 2rem 2rem;
86
+ overflow-x: auto;
87
+ border-radius: 0.375rem;
88
+ }
89
+ div.ProseMirror pre,
90
+ div.ProseMirror code {
91
+ white-space: pre;
92
+ word-spacing: normal;
93
+ word-break: normal;
94
+ word-wrap: normal;
95
+ tab-size: 4;
96
+ hyphens: none;
97
+ }
98
+ div.ProseMirror pre code {
99
+ font-weight: inherit;
100
+ }
101
+ div.ProseMirror hr {
102
+ margin: 2em 0;
103
+ }
104
+ div.ProseMirror .prosemirror-flat-list {
105
+ line-height: 1.5;
106
+ }
107
+ div.ProseMirror .prosemirror-flat-list::before,
108
+ div.ProseMirror .prosemirror-flat-list > .list-marker {
109
+ top: 0.5rem;
110
+ }
111
+ div.ProseMirror .prosemirror-flat-list:has(> div.list-content > h1)::before,
112
+ div.ProseMirror .prosemirror-flat-list:has(> div.list-content > h1) > .list-marker {
113
+ top: 1em;
114
+ }
115
+ div.ProseMirror .prosemirror-flat-list:has(> div.list-content > h2)::before,
116
+ div.ProseMirror .prosemirror-flat-list:has(> div.list-content > h2) > .list-marker {
117
+ top: 0.6em;
118
+ }
119
+ div.ProseMirror .prosemirror-flat-list:has(> div.list-content > h3)::before,
120
+ div.ProseMirror .prosemirror-flat-list:has(> div.list-content > h3) > .list-marker {
121
+ top: 0.25em;
122
+ }
123
+ div.ProseMirror .prosemirror-flat-list:has(> div.list-content > h4)::before,
124
+ div.ProseMirror .prosemirror-flat-list:has(> div.list-content > h4) > .list-marker {
125
+ top: 0;
126
+ }
127
+ div.ProseMirror .prosemirror-flat-list:has(> div.list-content > h5)::before,
128
+ div.ProseMirror .prosemirror-flat-list:has(> div.list-content > h5) > .list-marker {
129
+ top: -0.1em;
130
+ }
131
+ div.ProseMirror .prosemirror-flat-list:has(> div.list-content > h6)::before,
132
+ div.ProseMirror .prosemirror-flat-list:has(> div.list-content > h6) > .list-marker {
133
+ top: -0.1em;
134
+ }
135
+ div.ProseMirror .ProseMirror-selectednode {
136
+ z-index: calc(infinity);
137
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/basic",
3
3
  "type": "module",
4
- "version": "0.0.0-next-20231120040948",
4
+ "version": "0.0.0-next-20240427133255",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -30,27 +30,28 @@
30
30
  "import": "./dist/prosekit-basic.js",
31
31
  "default": "./dist/prosekit-basic.js"
32
32
  },
33
- "./internal/preflight.css": {
34
- "default": "./dist/internal/preflight.css"
35
- },
36
33
  "./style.css": {
37
34
  "default": "./dist/style.css"
35
+ },
36
+ "./typography.css": {
37
+ "default": "./dist/typography.css"
38
38
  }
39
39
  },
40
40
  "files": [
41
41
  "dist"
42
42
  ],
43
43
  "dependencies": {
44
- "@prosekit/core": "0.0.0-next-20231120040948",
45
- "@prosekit/extensions": "0.0.0-next-20231120040948"
44
+ "@prosekit/core": "0.0.0-next-20240427133255",
45
+ "@prosekit/extensions": "0.0.0-next-20240427133255",
46
+ "@prosekit/pm": "0.0.0-next-20240427133255"
46
47
  },
47
48
  "devDependencies": {
48
49
  "@prosekit/dev": "*",
49
- "postcss": "^8.4.31",
50
- "tailwindcss": "^3.3.5",
51
- "tsup": "^8.0.0",
52
- "typescript": "^5.2.2",
53
- "vitest": "^0.34.6"
50
+ "postcss": "^8.4.38",
51
+ "postcss-nesting": "^12.1.2",
52
+ "tsup": "^8.0.2",
53
+ "typescript": "^5.4.5",
54
+ "vitest": "^1.5.2"
54
55
  },
55
56
  "scripts": {
56
57
  "build:tsup": "tsup",
@@ -1,116 +0,0 @@
1
- /* src/internal/preflight.css */
2
- *,
3
- ::before,
4
- ::after {
5
- border-width: 0;
6
- border-style: solid;
7
- }
8
- *:has(> div.ProseMirror) {
9
- box-sizing: border-box;
10
- font-family:
11
- ui-sans-serif,
12
- sans-serif,
13
- "Apple Color Emoji",
14
- "Segoe UI Emoji",
15
- "Segoe UI Symbol",
16
- "Noto Color Emoji",
17
- system-ui;
18
- }
19
- *:has(> div.ProseMirror) * {
20
- box-sizing: border-box;
21
- }
22
- div.ProseMirror {
23
- & p:first-child,
24
- & h1:first-child,
25
- & h2:first-child,
26
- & h3:first-child,
27
- & h4:first-child,
28
- & h5:first-child,
29
- & h6:first-child {
30
- margin-top: 0;
31
- }
32
- & p:last-child,
33
- & h1:last-child,
34
- & h2:last-child,
35
- & h3:last-child,
36
- & h4:last-child,
37
- & h5:last-child,
38
- & h6:last-child {
39
- margin-bottom: 0;
40
- }
41
- & h1,
42
- & h2,
43
- & h3,
44
- & h4,
45
- & h5,
46
- & h6 {
47
- font-weight: 600;
48
- line-height: 1.25;
49
- padding-top: 0;
50
- padding-bottom: 0;
51
- border-style: none;
52
- }
53
- & a {
54
- text-decoration: underline;
55
- font-weight: 500;
56
- }
57
- & p,
58
- & ul,
59
- & ol,
60
- & pre {
61
- padding: 0.25rem;
62
- line-height: 1.5;
63
- }
64
- & blockquote {
65
- padding: 0.25rem;
66
- padding-left: 1em;
67
- font-style: italic;
68
- }
69
- & h1 {
70
- margin: 1rem 0;
71
- font-size: 2.25em;
72
- }
73
- & h2 {
74
- margin: 1.75em 0 0.5em;
75
- font-size: 1.75em;
76
- }
77
- & h3 {
78
- margin: 1.5em 0 0.5em;
79
- font-size: 1.375em;
80
- }
81
- & h4 {
82
- margin: 1em 0;
83
- font-size: 1.125em;
84
- }
85
- & img,
86
- & video {
87
- max-width: 100%;
88
- }
89
- & code {
90
- font-size: 0.875em;
91
- font-weight: 600;
92
- }
93
- & pre {
94
- padding: 2rem 2rem;
95
- overflow-x: auto;
96
- border-radius: 0.375rem;
97
- }
98
- & pre,
99
- & code {
100
- white-space: pre;
101
- word-spacing: normal;
102
- word-break: normal;
103
- word-wrap: normal;
104
- tab-size: 4;
105
- hyphens: none;
106
- }
107
- & pre code {
108
- font-weight: inherit;
109
- }
110
- & hr {
111
- margin: 2em 0;
112
- }
113
- & .prosemirror-flat-list {
114
- line-height: 1.5;
115
- }
116
- }
package/src/index.ts DELETED
@@ -1,41 +0,0 @@
1
- import {
2
- defineBaseCommands,
3
- defineBaseKeymap,
4
- defineDoc,
5
- defineHistory,
6
- defineParagraph,
7
- defineText,
8
- union,
9
- } from '@prosekit/core'
10
- import { defineBold } from '@prosekit/extensions/bold'
11
- import { defineCode } from '@prosekit/extensions/code'
12
- import { defineHeading } from '@prosekit/extensions/heading'
13
- import { defineImage } from '@prosekit/extensions/image'
14
- import { defineItalic } from '@prosekit/extensions/italic'
15
- import { defineList } from '@prosekit/extensions/list'
16
- import { defineStrike } from '@prosekit/extensions/strike'
17
- import { defineUnderline } from '@prosekit/extensions/underline'
18
-
19
- /**
20
- * @public
21
- */
22
- export function defineBasicExtension() {
23
- return union([
24
- defineDoc(),
25
- defineText(),
26
- defineHeading(),
27
- defineHistory(),
28
- defineList(),
29
- defineBaseKeymap(),
30
- defineBaseCommands(),
31
- defineItalic(),
32
- defineBold(),
33
- defineUnderline(),
34
- defineStrike(),
35
- defineCode(),
36
- defineImage(),
37
- defineParagraph(),
38
- ])
39
- }
40
-
41
- export type BasicExtension = ReturnType<typeof defineBasicExtension>