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

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.
@@ -0,0 +1,102 @@
1
+ import { Attrs } from 'prosemirror-model';
2
+ import { Config } from 'tailwindcss';
3
+ import { DedentListOptions } from 'prosemirror-flat-list';
4
+ import { default as default_2 } from '.pnpm/postcss@8.4.31/node_modules/postcss/lib/processor';
5
+ import { Extension } from '@prosekit/core';
6
+ import { HeadingAttrs } from '@prosekit/extensions/heading';
7
+ import { ImageAttrs } from '@prosekit/extensions/image';
8
+ import { IndentListOptions } from 'prosemirror-flat-list';
9
+ import { ListAttributes } from 'prosemirror-flat-list';
10
+ import { MarkType } from 'prosemirror-model';
11
+ import { Node as Node_2 } from 'prosemirror-model';
12
+ import { NodeRange } from 'prosemirror-model';
13
+ import { NodeType } from 'prosemirror-model';
14
+ import { Options } from 'tsup';
15
+ import { Plugin as Plugin_2 } from '.pnpm/postcss@8.4.31/node_modules/postcss';
16
+ import { ToggleCollapsedOptions } from 'prosemirror-flat-list';
17
+ import { UnwrapListOptions } from 'prosemirror-flat-list';
18
+ import { UserProjectConfigExport } from 'vitest/dist/config.js';
19
+
20
+ export declare type BasicExtension = ReturnType<typeof defineBasicExtension>;
21
+
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;
28
+
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;
32
+
33
+ /**
34
+ * @public
35
+ */
36
+ export declare function defineBasicExtension(): Extension< {
37
+ NODES: "text" | "doc" | "paragraph" | "heading" | "image" | "list";
38
+ MARKS: "code" | "bold" | "italic" | "strike" | "underline";
39
+ COMMAND_ARGS: {
40
+ setHeading: [attrs?: HeadingAttrs | undefined];
41
+ insertHeading: [attrs?: HeadingAttrs | undefined];
42
+ toggleHeading: [attrs?: HeadingAttrs | undefined];
43
+ undo: [];
44
+ redo: [];
45
+ dedentList: [options?: DedentListOptions | undefined];
46
+ indentList: [options?: IndentListOptions | undefined];
47
+ moveList: [direction: "up" | "down"];
48
+ splitList: [];
49
+ toggleCollapsed: [(ToggleCollapsedOptions | undefined)?];
50
+ toggleList: [attrs: ListAttributes];
51
+ unwrapList: [options?: UnwrapListOptions | undefined];
52
+ wrapInList: [getAttrs: ListAttributes | ((range: NodeRange) => ListAttributes | null)];
53
+ insertList: [attrs?: ListAttributes | undefined];
54
+ toggleItalic: [];
55
+ toggleBold: [];
56
+ toggleUnderline: [];
57
+ toggleStrike: [];
58
+ toggleCode: [];
59
+ insertImage: [attrs?: ImageAttrs | undefined];
60
+ insertText: [{
61
+ text: string;
62
+ from?: number | undefined;
63
+ to?: number | undefined;
64
+ }];
65
+ insertNode: [options: {
66
+ node: Node_2;
67
+ pos?: number | undefined;
68
+ type?: undefined;
69
+ attrs?: undefined;
70
+ } | {
71
+ node?: undefined;
72
+ pos?: number | undefined;
73
+ type: string;
74
+ attrs?: Attrs | undefined;
75
+ }];
76
+ wrap: [{
77
+ nodeType: NodeType;
78
+ attrs?: Attrs | null | undefined;
79
+ }];
80
+ setBlockType: [options: {
81
+ type: string | NodeType;
82
+ attrs?: Attrs | null | undefined;
83
+ from?: number | undefined;
84
+ to?: number | undefined;
85
+ }];
86
+ selectAll: [];
87
+ addMark: [options: {
88
+ type: string | MarkType;
89
+ attrs?: Attrs | null | undefined;
90
+ from?: number | undefined;
91
+ to?: number | undefined;
92
+ }];
93
+ removeMark: [options: {
94
+ type: string | MarkType;
95
+ attrs?: Attrs | null | undefined;
96
+ from?: number | undefined;
97
+ to?: number | undefined;
98
+ }];
99
+ };
100
+ }>;
101
+
102
+ export { }
@@ -0,0 +1,116 @@
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
+ }
@@ -1,34 +1,2 @@
1
- import * as _prosekit_core from '@prosekit/core';
2
- import * as prosemirror_model from 'prosemirror-model';
3
-
4
- /** @public */
5
- declare function addBasicExtension(): _prosekit_core.Extension<{
6
- NODES: "doc" | "text" | "heading" | "list" | "paragraph";
7
- MARKS: "italic";
8
- COMMAND_ARGS: {
9
- toggleItalic: [];
10
- insertText: [{
11
- text: string;
12
- from?: number | undefined;
13
- to?: number | undefined;
14
- }];
15
- insertNode: [{
16
- node: prosemirror_model.Node;
17
- pos?: number | undefined;
18
- }];
19
- wrap: [{
20
- nodeType: prosemirror_model.NodeType;
21
- attrs?: prosemirror_model.Attrs | null | undefined;
22
- }];
23
- setBlockType: [{
24
- nodeType: prosemirror_model.NodeType;
25
- attrs?: prosemirror_model.Attrs | null | undefined;
26
- from?: number | undefined;
27
- to?: number | undefined;
28
- }];
29
- selectAll: [];
30
- };
31
- }>;
32
- type BasicExtension = ReturnType<typeof addBasicExtension>;
33
-
34
- export { BasicExtension, addBasicExtension };
1
+ export { defineBasicExtension } from './_tsup-dts-rollup';
2
+ export { BasicExtension } from './_tsup-dts-rollup';
@@ -1,29 +1,39 @@
1
1
  // src/index.ts
2
2
  import {
3
- addBaseKeymap,
4
- addBaseCommands,
5
- addDoc,
6
- addParagraph,
7
- addText,
8
- defineExtension,
9
- Priority,
10
- withPriority
3
+ defineBaseCommands,
4
+ defineBaseKeymap,
5
+ defineDoc,
6
+ defineHistory,
7
+ defineParagraph,
8
+ defineText,
9
+ union
11
10
  } from "@prosekit/core";
12
- import { addHeading } from "@prosekit/extensions/heading";
13
- import { addItalic } from "@prosekit/extensions/italic";
14
- import { addList } from "@prosekit/extensions/list";
15
- function addBasicExtension() {
16
- return defineExtension([
17
- addDoc(),
18
- addText(),
19
- addHeading(),
20
- addList(),
21
- addBaseKeymap(),
22
- addBaseCommands(),
23
- addItalic(),
24
- withPriority(addParagraph(), Priority.high)
11
+ import { defineBold } from "@prosekit/extensions/bold";
12
+ import { defineCode } from "@prosekit/extensions/code";
13
+ import { defineHeading } from "@prosekit/extensions/heading";
14
+ import { defineImage } from "@prosekit/extensions/image";
15
+ import { defineItalic } from "@prosekit/extensions/italic";
16
+ import { defineList } from "@prosekit/extensions/list";
17
+ import { defineStrike } from "@prosekit/extensions/strike";
18
+ import { defineUnderline } from "@prosekit/extensions/underline";
19
+ function defineBasicExtension() {
20
+ return union([
21
+ defineDoc(),
22
+ defineText(),
23
+ defineHeading(),
24
+ defineHistory(),
25
+ defineList(),
26
+ defineBaseKeymap(),
27
+ defineBaseCommands(),
28
+ defineItalic(),
29
+ defineBold(),
30
+ defineUnderline(),
31
+ defineStrike(),
32
+ defineCode(),
33
+ defineImage(),
34
+ defineParagraph()
25
35
  ]);
26
36
  }
27
37
  export {
28
- addBasicExtension
38
+ defineBasicExtension
29
39
  };
package/dist/style.css CHANGED
@@ -1,8 +1,6 @@
1
- /* ../../node_modules/.pnpm/prosemirror-view@1.31.5/node_modules/prosemirror-view/style/prosemirror.css */
1
+ /* ../../node_modules/.pnpm/prosemirror-view@1.32.4/node_modules/prosemirror-view/style/prosemirror.css */
2
2
  .ProseMirror {
3
3
  position: relative;
4
- }
5
- .ProseMirror {
6
4
  word-wrap: break-word;
7
5
  white-space: pre-wrap;
8
6
  white-space: break-spaces;
@@ -25,6 +23,9 @@
25
23
  .ProseMirror-hideselection {
26
24
  caret-color: transparent;
27
25
  }
26
+ .ProseMirror [draggable][contenteditable=false] {
27
+ user-select: text;
28
+ }
28
29
  .ProseMirror-selectednode {
29
30
  outline: 2px solid #8cf;
30
31
  }
@@ -51,11 +52,10 @@ img.ProseMirror-separator {
51
52
 
52
53
  /* ../core/src/style.css */
53
54
 
54
- /* ../../node_modules/.pnpm/prosemirror-flat-list@0.3.15/node_modules/prosemirror-flat-list/dist/style.css */
55
+ /* ../../node_modules/.pnpm/prosemirror-flat-list@0.4.3/node_modules/prosemirror-flat-list/dist/style.css */
55
56
  .prosemirror-flat-list {
56
57
  padding: 0;
57
58
  margin-top: 0;
58
- margin-bottom: 0;
59
59
  margin-left: 32px;
60
60
  margin-bottom: 0;
61
61
  position: relative;
@@ -130,7 +130,7 @@ img.ProseMirror-separator {
130
130
  opacity: 40%;
131
131
  pointer-events: none;
132
132
  }
133
- .prosemirror-flat-list[data-list-kind=toggle][data-list-collapsable][data-list-collapsed] > .list-content > *:nth-child(n + 2) {
133
+ .prosemirror-flat-list[data-list-kind=toggle][data-list-collapsable][data-list-collapsed] > .list-content > *:nth-child(n+2) {
134
134
  display: none;
135
135
  }
136
136
 
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-20230709090937",
4
+ "version": "0.0.0-next-20231120040948",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -30,6 +30,9 @@
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
+ },
33
36
  "./style.css": {
34
37
  "default": "./dist/style.css"
35
38
  }
@@ -38,14 +41,16 @@
38
41
  "dist"
39
42
  ],
40
43
  "dependencies": {
41
- "@prosekit/core": "0.0.0-next-20230709090937",
42
- "@prosekit/extensions": "0.0.0-next-20230709090937"
44
+ "@prosekit/core": "0.0.0-next-20231120040948",
45
+ "@prosekit/extensions": "0.0.0-next-20231120040948"
43
46
  },
44
47
  "devDependencies": {
45
48
  "@prosekit/dev": "*",
46
- "tsup": "^7.1.0",
47
- "typescript": "^5.1.6",
48
- "vitest": "^0.33.0"
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"
49
54
  },
50
55
  "scripts": {
51
56
  "build:tsup": "tsup",
package/src/index.ts CHANGED
@@ -1,29 +1,41 @@
1
1
  import {
2
- addBaseKeymap,
3
- addBaseCommands,
4
- addDoc,
5
- addParagraph,
6
- addText,
7
- defineExtension,
8
- Priority,
9
- withPriority,
2
+ defineBaseCommands,
3
+ defineBaseKeymap,
4
+ defineDoc,
5
+ defineHistory,
6
+ defineParagraph,
7
+ defineText,
8
+ union,
10
9
  } from '@prosekit/core'
11
- import { addHeading } from '@prosekit/extensions/heading'
12
- import { addItalic } from '@prosekit/extensions/italic'
13
- import { addList } from '@prosekit/extensions/list'
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'
14
18
 
15
- /** @public */
16
- export function addBasicExtension() {
17
- return defineExtension([
18
- addDoc(),
19
- addText(),
20
- addHeading(),
21
- addList(),
22
- addBaseKeymap(),
23
- addBaseCommands(),
24
- addItalic(),
25
- withPriority(addParagraph(), Priority.high),
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(),
26
38
  ])
27
39
  }
28
40
 
29
- export type BasicExtension = ReturnType<typeof addBasicExtension>
41
+ export type BasicExtension = ReturnType<typeof defineBasicExtension>