@prosekit/basic 0.0.24 → 0.2.0

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,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,21 @@ 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
- export declare namespace default_alias {
23
- let plugins: (default_2 | Plugin_2)[];
24
- }
25
-
26
- /** @type {import('tailwindcss').Config} */
27
- export declare const default_alias_1: Config;
21
+ export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
28
22
 
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;
23
+ export declare const default_alias_1: {
24
+ test: {
25
+ environment: "jsdom";
26
+ };
27
+ };
32
28
 
33
29
  /**
34
30
  * @public
@@ -50,6 +46,7 @@ toggleCollapsed: [(ToggleCollapsedOptions | undefined)?];
50
46
  toggleList: [attrs: ListAttributes];
51
47
  unwrapList: [options?: UnwrapListOptions | undefined];
52
48
  wrapInList: [getAttrs: ListAttributes | ((range: NodeRange) => ListAttributes | null)];
49
+ insertList: [attrs?: ListAttributes | undefined];
53
50
  toggleItalic: [];
54
51
  toggleBold: [];
55
52
  toggleUnderline: [];
@@ -61,9 +58,16 @@ text: string;
61
58
  from?: number | undefined;
62
59
  to?: number | undefined;
63
60
  }];
64
- insertNode: [{
61
+ insertNode: [options: {
65
62
  node: Node_2;
66
63
  pos?: number | undefined;
64
+ type?: undefined;
65
+ attrs?: undefined;
66
+ } | {
67
+ node?: undefined;
68
+ pos?: number | undefined;
69
+ type: string;
70
+ attrs?: Attrs | undefined;
67
71
  }];
68
72
  wrap: [{
69
73
  nodeType: NodeType;
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.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
- /* ../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.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
- @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,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,101 @@
1
+ /* src/typography.css */
2
+ div.ProseMirror {
3
+ & {
4
+ display: flex;
5
+ flex-direction: column;
6
+ }
7
+ & p:first-child,
8
+ & h1:first-child,
9
+ & h2:first-child,
10
+ & h3:first-child,
11
+ & h4:first-child,
12
+ & h5:first-child,
13
+ & h6:first-child {
14
+ margin-top: 0;
15
+ }
16
+ & p:last-child,
17
+ & h1:last-child,
18
+ & h2:last-child,
19
+ & h3:last-child,
20
+ & h4:last-child,
21
+ & h5:last-child,
22
+ & h6:last-child {
23
+ margin-bottom: 0;
24
+ }
25
+ & h1,
26
+ & h2,
27
+ & h3,
28
+ & h4,
29
+ & h5,
30
+ & h6 {
31
+ font-weight: 600;
32
+ line-height: 1.25;
33
+ padding-top: 0;
34
+ padding-bottom: 0;
35
+ border-style: none;
36
+ }
37
+ & a {
38
+ text-decoration: underline;
39
+ font-weight: 500;
40
+ }
41
+ & p,
42
+ & ul,
43
+ & ol,
44
+ & pre {
45
+ padding: 0.25rem;
46
+ line-height: 1.5;
47
+ }
48
+ & blockquote {
49
+ padding: 0.25rem;
50
+ padding-left: 1em;
51
+ font-style: italic;
52
+ }
53
+ & h1 {
54
+ margin: 1rem 0;
55
+ font-size: 2.25em;
56
+ }
57
+ & h2 {
58
+ margin: 1.75em 0 0.5em;
59
+ font-size: 1.75em;
60
+ }
61
+ & h3 {
62
+ margin: 1.5em 0 0.5em;
63
+ font-size: 1.375em;
64
+ }
65
+ & h4 {
66
+ margin: 1em 0;
67
+ font-size: 1.125em;
68
+ }
69
+ & img,
70
+ & video {
71
+ max-width: 100%;
72
+ }
73
+ & code {
74
+ font-size: 0.875em;
75
+ font-weight: 600;
76
+ }
77
+ & pre {
78
+ margin: 0.5rem 0;
79
+ padding: 2rem 2rem;
80
+ overflow-x: auto;
81
+ border-radius: 0.375rem;
82
+ }
83
+ & pre,
84
+ & code {
85
+ white-space: pre;
86
+ word-spacing: normal;
87
+ word-break: normal;
88
+ word-wrap: normal;
89
+ tab-size: 4;
90
+ hyphens: none;
91
+ }
92
+ & pre code {
93
+ font-weight: inherit;
94
+ }
95
+ & hr {
96
+ margin: 2em 0;
97
+ }
98
+ & .prosemirror-flat-list {
99
+ line-height: 1.5;
100
+ }
101
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/basic",
3
3
  "type": "module",
4
- "version": "0.0.24",
4
+ "version": "0.2.0",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -30,27 +30,27 @@
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.20",
45
- "@prosekit/extensions": "^0.0.22"
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.31",
50
- "tailwindcss": "^3.3.5",
51
- "tsup": "^7.2.0",
52
- "typescript": "^5.2.2",
53
- "vitest": "^0.34.6"
50
+ "postcss": "^8.4.32",
51
+ "tsup": "^8.0.1",
52
+ "typescript": "^5.3.3",
53
+ "vitest": "^1.1.0"
54
54
  },
55
55
  "scripts": {
56
56
  "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
- }