@prosekit/basic 0.1.0 → 0.2.1
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/dist/_tsup-dts-rollup.d.ts +21 -11
- package/dist/style.css +30 -15
- package/dist/typography.css +99 -0
- package/package.json +12 -11
- package/src/index.ts +44 -0
- package/dist/internal/preflight.css +0 -117
@@ -1,7 +1,5 @@
|
|
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';
|
@@ -12,23 +10,27 @@ import { Node as Node_2 } from 'prosemirror-model';
|
|
12
10
|
import { NodeRange } from 'prosemirror-model';
|
13
11
|
import { NodeType } from 'prosemirror-model';
|
14
12
|
import { Options } from 'tsup';
|
15
|
-
import { Plugin as Plugin_2 } from '.pnpm/postcss@8.4.31/node_modules/postcss';
|
16
13
|
import { ToggleCollapsedOptions } from 'prosemirror-flat-list';
|
17
14
|
import { UnwrapListOptions } from 'prosemirror-flat-list';
|
18
|
-
import { UserProjectConfigExport } from 'vitest/dist/config.js';
|
19
15
|
|
16
|
+
/**
|
17
|
+
* @public
|
18
|
+
*/
|
20
19
|
export declare type BasicExtension = ReturnType<typeof defineBasicExtension>;
|
21
20
|
|
22
21
|
export declare namespace default_alias {
|
23
|
-
let plugins:
|
22
|
+
let plugins: {
|
23
|
+
'postcss-nesting': {};
|
24
|
+
};
|
24
25
|
}
|
25
26
|
|
26
|
-
|
27
|
-
export declare const default_alias_1: Config;
|
27
|
+
export declare const default_alias_1: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
|
28
28
|
|
29
|
-
export declare const default_alias_2:
|
30
|
-
|
31
|
-
|
29
|
+
export declare const default_alias_2: {
|
30
|
+
test: {
|
31
|
+
environment: "jsdom";
|
32
|
+
};
|
33
|
+
};
|
32
34
|
|
33
35
|
/**
|
34
36
|
* @public
|
@@ -50,6 +52,7 @@ toggleCollapsed: [(ToggleCollapsedOptions | undefined)?];
|
|
50
52
|
toggleList: [attrs: ListAttributes];
|
51
53
|
unwrapList: [options?: UnwrapListOptions | undefined];
|
52
54
|
wrapInList: [getAttrs: ListAttributes | ((range: NodeRange) => ListAttributes | null)];
|
55
|
+
insertList: [attrs?: ListAttributes | undefined];
|
53
56
|
toggleItalic: [];
|
54
57
|
toggleBold: [];
|
55
58
|
toggleUnderline: [];
|
@@ -61,9 +64,16 @@ text: string;
|
|
61
64
|
from?: number | undefined;
|
62
65
|
to?: number | undefined;
|
63
66
|
}];
|
64
|
-
insertNode: [{
|
67
|
+
insertNode: [options: {
|
65
68
|
node: Node_2;
|
66
69
|
pos?: number | undefined;
|
70
|
+
type?: undefined;
|
71
|
+
attrs?: undefined;
|
72
|
+
} | {
|
73
|
+
node?: undefined;
|
74
|
+
pos?: number | undefined;
|
75
|
+
type: string;
|
76
|
+
attrs?: Attrs | undefined;
|
67
77
|
}];
|
68
78
|
wrap: [{
|
69
79
|
nodeType: NodeType;
|
package/dist/style.css
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
/* ../../node_modules/.pnpm/prosemirror-view@1.32.
|
1
|
+
/* ../../node_modules/.pnpm/prosemirror-view@1.32.7/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
|
-
/*
|
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.4.5/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
|
-
|
88
|
-
|
89
|
-
|
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
|
94
|
-
.prosemirror-flat-list[data-list-kind=ordered] {
|
95
|
-
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
|
-
|
99
|
-
|
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,13 @@ img.ProseMirror-separator {
|
|
136
142
|
|
137
143
|
/* ../extensions/src/list/style.css */
|
138
144
|
|
145
|
+
/* ../extensions/src/placeholder/style.css */
|
146
|
+
.prosekit-placeholder::before {
|
147
|
+
position: absolute;
|
148
|
+
opacity: 30%;
|
149
|
+
pointer-events: none;
|
150
|
+
height: 0;
|
151
|
+
content: attr(data-placeholder);
|
152
|
+
}
|
153
|
+
|
139
154
|
/* src/style.css */
|
@@ -0,0 +1,99 @@
|
|
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.25rem;
|
45
|
+
line-height: 1.5;
|
46
|
+
}
|
47
|
+
div.ProseMirror blockquote {
|
48
|
+
padding: 0.25rem;
|
49
|
+
padding-left: 1em;
|
50
|
+
font-style: italic;
|
51
|
+
}
|
52
|
+
div.ProseMirror h1 {
|
53
|
+
margin: 1rem 0;
|
54
|
+
font-size: 2.25em;
|
55
|
+
}
|
56
|
+
div.ProseMirror h2 {
|
57
|
+
margin: 1.75em 0 0.5em;
|
58
|
+
font-size: 1.75em;
|
59
|
+
}
|
60
|
+
div.ProseMirror h3 {
|
61
|
+
margin: 1.5em 0 0.5em;
|
62
|
+
font-size: 1.375em;
|
63
|
+
}
|
64
|
+
div.ProseMirror h4 {
|
65
|
+
margin: 1em 0;
|
66
|
+
font-size: 1.125em;
|
67
|
+
}
|
68
|
+
div.ProseMirror img,
|
69
|
+
div.ProseMirror video {
|
70
|
+
max-width: 100%;
|
71
|
+
}
|
72
|
+
div.ProseMirror code {
|
73
|
+
font-size: 0.875em;
|
74
|
+
font-weight: 600;
|
75
|
+
}
|
76
|
+
div.ProseMirror pre {
|
77
|
+
margin: 0.5rem 0;
|
78
|
+
padding: 2rem 2rem;
|
79
|
+
overflow-x: auto;
|
80
|
+
border-radius: 0.375rem;
|
81
|
+
}
|
82
|
+
div.ProseMirror pre,
|
83
|
+
div.ProseMirror code {
|
84
|
+
white-space: pre;
|
85
|
+
word-spacing: normal;
|
86
|
+
word-break: normal;
|
87
|
+
word-wrap: normal;
|
88
|
+
tab-size: 4;
|
89
|
+
hyphens: none;
|
90
|
+
}
|
91
|
+
div.ProseMirror pre code {
|
92
|
+
font-weight: inherit;
|
93
|
+
}
|
94
|
+
div.ProseMirror hr {
|
95
|
+
margin: 2em 0;
|
96
|
+
}
|
97
|
+
div.ProseMirror .prosemirror-flat-list {
|
98
|
+
line-height: 1.5;
|
99
|
+
}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/basic",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.1
|
4
|
+
"version": "0.2.1",
|
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.
|
45
|
-
"@prosekit/extensions": "^0.
|
44
|
+
"@prosekit/core": "^0.2.0",
|
45
|
+
"@prosekit/extensions": "^0.2.0",
|
46
|
+
"@prosekit/pm": "^0.1.1"
|
46
47
|
},
|
47
48
|
"devDependencies": {
|
48
49
|
"@prosekit/dev": "*",
|
49
|
-
"postcss": "^8.4.
|
50
|
-
"
|
51
|
-
"tsup": "^
|
52
|
-
"typescript": "^5.
|
53
|
-
"vitest": "^
|
50
|
+
"postcss": "^8.4.32",
|
51
|
+
"postcss-nesting": "^12.0.2",
|
52
|
+
"tsup": "^8.0.1",
|
53
|
+
"typescript": "^5.3.3",
|
54
|
+
"vitest": "^1.1.0"
|
54
55
|
},
|
55
56
|
"scripts": {
|
56
57
|
"build:tsup": "tsup",
|
package/src/index.ts
ADDED
@@ -0,0 +1,44 @@
|
|
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
|
+
/**
|
42
|
+
* @public
|
43
|
+
*/
|
44
|
+
export type BasicExtension = ReturnType<typeof defineBasicExtension>
|
@@ -1,117 +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
|
-
display: flex;
|
10
|
-
flex-direction: column;
|
11
|
-
width: 100%;
|
12
|
-
box-sizing: border-box;
|
13
|
-
padding: 8px;
|
14
|
-
font-family:
|
15
|
-
ui-sans-serif,
|
16
|
-
sans-serif,
|
17
|
-
"Apple Color Emoji",
|
18
|
-
"Segoe UI Emoji",
|
19
|
-
"Segoe UI Symbol",
|
20
|
-
"Noto Color Emoji",
|
21
|
-
system-ui;
|
22
|
-
}
|
23
|
-
*:has(> div.ProseMirror) * {
|
24
|
-
box-sizing: border-box;
|
25
|
-
}
|
26
|
-
.ProseMirror p:first-of-type {
|
27
|
-
margin-top: 0;
|
28
|
-
}
|
29
|
-
.ProseMirror p:last-of-type {
|
30
|
-
margin-bottom: 0;
|
31
|
-
}
|
32
|
-
.ProseMirror h1,
|
33
|
-
.ProseMirror h2,
|
34
|
-
.ProseMirror h3,
|
35
|
-
.ProseMirror h4,
|
36
|
-
.ProseMirror h5,
|
37
|
-
.ProseMirror h6 {
|
38
|
-
font-weight: 600;
|
39
|
-
line-height: 1.25;
|
40
|
-
}
|
41
|
-
.ProseMirror a {
|
42
|
-
text-decoration: underline;
|
43
|
-
font-weight: 500;
|
44
|
-
}
|
45
|
-
.ProseMirror p,
|
46
|
-
.ProseMirror ul,
|
47
|
-
.ProseMirror ol,
|
48
|
-
.ProseMirror pre {
|
49
|
-
margin: 1em 0;
|
50
|
-
line-height: 1.5;
|
51
|
-
}
|
52
|
-
.ProseMirror blockquote {
|
53
|
-
margin: 1em 0;
|
54
|
-
padding-left: 1em;
|
55
|
-
font-style: italic;
|
56
|
-
}
|
57
|
-
.ProseMirror h1 {
|
58
|
-
margin: 1rem 0;
|
59
|
-
font-size: 2.25em;
|
60
|
-
}
|
61
|
-
.ProseMirror h2 {
|
62
|
-
margin: 1.75em 0 0.5em;
|
63
|
-
font-size: 1.75em;
|
64
|
-
}
|
65
|
-
.ProseMirror h3 {
|
66
|
-
margin: 1.5em 0 0.5em;
|
67
|
-
font-size: 1.375em;
|
68
|
-
}
|
69
|
-
.ProseMirror h4 {
|
70
|
-
margin: 1em 0;
|
71
|
-
font-size: 1.125em;
|
72
|
-
}
|
73
|
-
.ProseMirror img,
|
74
|
-
.ProseMirror video {
|
75
|
-
max-width: 100%;
|
76
|
-
}
|
77
|
-
.ProseMirror code {
|
78
|
-
font-size: 0.875em;
|
79
|
-
font-weight: 600;
|
80
|
-
}
|
81
|
-
.ProseMirror pre {
|
82
|
-
padding: 2rem 2rem;
|
83
|
-
overflow-x: auto;
|
84
|
-
border-radius: 0.375rem;
|
85
|
-
}
|
86
|
-
.ProseMirror pre,
|
87
|
-
.ProseMirror code {
|
88
|
-
white-space: pre;
|
89
|
-
word-spacing: normal;
|
90
|
-
word-break: normal;
|
91
|
-
word-wrap: normal;
|
92
|
-
tab-size: 4;
|
93
|
-
hyphens: none;
|
94
|
-
}
|
95
|
-
.ProseMirror pre code {
|
96
|
-
font-weight: inherit;
|
97
|
-
}
|
98
|
-
.ProseMirror hr {
|
99
|
-
margin: 2em 0;
|
100
|
-
}
|
101
|
-
.ProseMirror .prosemirror-flat-list {
|
102
|
-
line-height: 1.5;
|
103
|
-
}
|
104
|
-
.ProseMirror span[data-mention=user] {
|
105
|
-
border-radius: 0.5rem;
|
106
|
-
color: rgb(59 130 246);
|
107
|
-
}
|
108
|
-
.ProseMirror span[data-mention=tag] {
|
109
|
-
border-radius: 0.5rem;
|
110
|
-
padding: 0.125rem 0.25rem;
|
111
|
-
background-color: rgb(229 231 235);
|
112
|
-
}
|
113
|
-
@media (prefers-color-scheme: dark) {
|
114
|
-
.ProseMirror span[data-mention=tag] {
|
115
|
-
background-color: rgb(75 85 99);
|
116
|
-
}
|
117
|
-
}
|