@prosekit/basic 0.7.3 → 0.8.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,246 +1 @@
1
- :root {
2
- --prosekit-node-selection-color: rgba(57, 136, 255, 0.2);
3
- --prosekit-autocomplete-color: rgba(209, 213, 219, 0.15); /* tailwind bg-gray-300/15 */
4
- }
5
-
6
- .ProseMirror {
7
- & {
8
- /* Disable margin collapsing */
9
- display: flex;
10
- flex-direction: column;
11
- }
12
-
13
- & {
14
- /* Set the default line height as same as block handle's height */
15
- line-height: 1.5;
16
- }
17
-
18
- & p:first-child,
19
- & h1:first-child,
20
- & h2:first-child,
21
- & h3:first-child,
22
- & h4:first-child,
23
- & h5:first-child,
24
- & h6:first-child {
25
- margin-top: 0;
26
- }
27
-
28
- & p:last-child,
29
- & h1:last-child,
30
- & h2:last-child,
31
- & h3:last-child,
32
- & h4:last-child,
33
- & h5:last-child,
34
- & h6:last-child {
35
- margin-bottom: 0;
36
- }
37
-
38
- & h1,
39
- & h2,
40
- & h3,
41
- & h4,
42
- & h5,
43
- & h6 {
44
- padding-top: 0;
45
- padding-bottom: 0;
46
- border-style: none;
47
- font-weight: 600;
48
- line-height: 1.25;
49
- }
50
-
51
- & a {
52
- font-weight: 500;
53
- text-decoration: underline;
54
- }
55
-
56
- & p,
57
- & ul,
58
- & ol,
59
- & pre {
60
- margin: 0;
61
- padding: 0.5rem 0;
62
- line-height: 1.5;
63
- }
64
-
65
- & blockquote {
66
- padding-inline-start: 1em;
67
- border-inline-start: 0.25em solid hsl(0 0% 60% / 0.4);
68
- }
69
-
70
- & h1 {
71
- margin: 1rem 0;
72
- font-size: 2.25em;
73
- }
74
-
75
- & h2 {
76
- margin: 1.75em 0 0.5em;
77
- font-size: 1.75em;
78
- }
79
-
80
- & h3 {
81
- margin: 1.5em 0 0.5em;
82
- font-size: 1.375em;
83
- }
84
-
85
- & h4 {
86
- margin: 1em 0;
87
- font-size: 1.125em;
88
- }
89
-
90
- & h5 {
91
- margin: 0.5em 0;
92
- }
93
-
94
- & h6 {
95
- opacity: 0.8;
96
- }
97
-
98
- & img,
99
- & video {
100
- width: min-content;
101
- max-width: 100%;
102
- margin: 0.5em 0;
103
- }
104
-
105
- & code {
106
- font-weight: 600;
107
- font-size: 0.875em;
108
- }
109
-
110
- & pre {
111
- margin: 0.5rem 0;
112
- padding: 2rem 2rem;
113
- overflow-x: auto;
114
- border: 1px solid hsl(0 0% 50% / 0.2);
115
- border-radius: 0.375rem;
116
- /* CSS variables `prosemirror-highlight` and `prosemirror-highlight-bg` are set by package `prosemirror-highlight` */
117
- background-color: var(--prosemirror-highlight-bg, inherit);
118
- color: var(--prosemirror-highlight, inherit);
119
- }
120
-
121
- & pre,
122
- & code {
123
- white-space: pre;
124
- word-break: normal;
125
- word-spacing: normal;
126
- word-wrap: normal;
127
- hyphens: none;
128
- tab-size: 4;
129
- }
130
-
131
- & pre code {
132
- font-weight: inherit;
133
- }
134
-
135
- & pre:has(code) {
136
- /* Force the code block to be left-to-right */
137
- direction: ltr;
138
- }
139
-
140
- & hr {
141
- margin: 2em 0;
142
- border-width: 1px;
143
- }
144
-
145
- & .prosekit-horizontal-rule {
146
- margin: 1em 0;
147
- padding: 1em 0;
148
- /* Set a small line-height so that the block handle can align to the middle
149
- of the horizontal rule */
150
- line-height: 1px;
151
-
152
- & hr {
153
- margin: 0;
154
- }
155
- }
156
-
157
- & .tableWrapper {
158
- margin-top: 0.5em;
159
- margin-bottom: 1em;
160
- }
161
-
162
- & .prosemirror-flat-list {
163
- /* Use the same line-height as <p> */
164
- line-height: 1.5;
165
-
166
- &::before,
167
- & > .list-marker {
168
- /* Use the same padding as <p> */
169
- top: 0.5rem;
170
- }
171
-
172
- &:has(> div.list-content > h1) {
173
- &::before,
174
- & > .list-marker {
175
- top: 0.75em;
176
- }
177
- }
178
- &:has(> div.list-content > h2) {
179
- &::before,
180
- & > .list-marker {
181
- top: 0.5em;
182
- }
183
- }
184
- &:has(> div.list-content > h3) {
185
- &::before,
186
- & > .list-marker {
187
- top: 0.25em;
188
- }
189
- }
190
- &:has(> div.list-content > h4) {
191
- &::before,
192
- & > .list-marker {
193
- top: 0;
194
- }
195
- }
196
- &:has(> div.list-content > h5) {
197
- &::before,
198
- & > .list-marker {
199
- top: -0.2em;
200
- }
201
- }
202
- &:has(> div.list-content > h6) {
203
- &::before,
204
- & > .list-marker {
205
- top: -0.3em;
206
- }
207
- }
208
- }
209
-
210
- /*
211
- Don't generate box for node view wrapper. This make it easier to style
212
- the node views.
213
- */
214
- div[data-node-view-root="true"] {
215
- display: contents;
216
- }
217
-
218
- & .ProseMirror-selectednode {
219
- border-radius: 0.2rem;
220
- outline-color: var(--prosekit-node-selection-color);
221
- outline-style: solid;
222
- outline-width: 0.3rem;
223
- background-color: var(--prosekit-node-selection-color);
224
- }
225
-
226
- & .prosekit-autocomplete-match {
227
- border-radius: 0.1em;
228
- background-color: var(--prosekit-autocomplete-color);
229
- box-shadow: 0 0 0 0.3em var(--prosekit-autocomplete-color);
230
- }
231
-
232
- &.prosekit-dragging {
233
- --prosekit-node-selection-color: transparent;
234
- }
235
-
236
- .prosemirror-math-inline.prosemirror-math-head-inside .prosemirror-math-source {
237
- &::before {
238
- content: "$";
239
- opacity: 0.5;
240
- }
241
- &::after {
242
- content: "$";
243
- opacity: 0.5;
244
- }
245
- }
246
- }
1
+ @import "./typography.gen.css";
@@ -0,0 +1,248 @@
1
+ .ProseMirror {
2
+ --prosekit-hue: 250;
3
+ --prosekit-outline-color: hsl(var(--prosekit-hue) 100% 60%);
4
+ --prosekit-node-selection-color: hsl(var(--prosekit-hue) 100% 60% / 0.22);
5
+ --prosekit-border-color: hsl(0 0% 60% / 0.2);
6
+ --prosekit-blockquote-color: hsl(0 0% 60% / 0.4);
7
+ --prosekit-autocomplete-color: hsl(0 0% 50% / 0.1);
8
+ }
9
+ @supports (color: oklch(70% 0.2 240deg)) {
10
+ .ProseMirror {
11
+ --prosekit-outline-color: oklch(0.66 0.20 var(--prosekit-hue));
12
+ --prosekit-node-selection-color: oklch(0.66 0.20 var(--prosekit-hue) / 0.1);
13
+ }
14
+ }
15
+ @supports (color: color-mix(in srgb, CanvasText 15%, Canvas)) {
16
+ .ProseMirror {
17
+ --prosekit-border-color: color-mix(in srgb, CanvasText 15%, Canvas);
18
+ --prosekit-blockquote-color: color-mix(in srgb, CanvasText 40%, Canvas);
19
+ --prosekit-autocomplete-color: color-mix(in srgb, CanvasText 5%, Canvas);
20
+ }
21
+ }
22
+ .ProseMirror {
23
+ display: flex;
24
+ flex-direction: column;
25
+ line-height: 1.5;
26
+ }
27
+ .ProseMirror h1 {
28
+ margin: 36px 0 4px;
29
+ padding: 3px 2px;
30
+ font-weight: 700;
31
+ font-size: 40px;
32
+ line-height: 44px;
33
+ }
34
+ .ProseMirror h2 {
35
+ margin: 32px 0 4px;
36
+ padding: 3px 2px;
37
+ font-weight: 600;
38
+ font-size: 30px;
39
+ line-height: 39px;
40
+ }
41
+ .ProseMirror h3 {
42
+ margin: 22px 0 1px;
43
+ padding: 3px 2px;
44
+ font-weight: 600;
45
+ font-size: 24px;
46
+ line-height: 32px;
47
+ }
48
+ .ProseMirror h4 {
49
+ margin: 16px 0 1px;
50
+ padding: 3px 2px;
51
+ font-weight: 600;
52
+ font-size: 20px;
53
+ line-height: 26px;
54
+ }
55
+ .ProseMirror h5 {
56
+ margin: 14px 0 1px;
57
+ padding: 3px 2px;
58
+ font-weight: 600;
59
+ font-size: 18px;
60
+ line-height: 22px;
61
+ }
62
+ .ProseMirror h6 {
63
+ margin: 12px 0 1px;
64
+ padding: 3px 2px;
65
+ font-weight: 600;
66
+ font-size: 16px;
67
+ line-height: 20px;
68
+ }
69
+ .ProseMirror p {
70
+ margin: 1px 0 0;
71
+ padding: 3px 2px;
72
+ font-size: 16px;
73
+ line-height: 24px;
74
+ }
75
+ .ProseMirror code {
76
+ font-weight: 500;
77
+ font-size: 0.875em;
78
+ }
79
+ .ProseMirror pre {
80
+ margin: 0.5rem 0;
81
+ padding: 2rem 2rem;
82
+ overflow-x: auto;
83
+ border: 1px solid var(--prosekit-border-color);
84
+ border-radius: 0.375rem;
85
+ /* CSS variables --prosemirror-highlight and --prosemirror-highlight-bg are set by package `prosemirror-highlight` */
86
+ background-color: var(--prosemirror-highlight-bg, inherit);
87
+ color: var(--prosemirror-highlight, inherit);
88
+ }
89
+ .ProseMirror pre, .ProseMirror code {
90
+ hyphens: none;
91
+ white-space: pre;
92
+ word-break: normal;
93
+ word-spacing: normal;
94
+ overflow-wrap: normal;
95
+ tab-size: 4;
96
+ }
97
+ .ProseMirror pre code {
98
+ font-weight: inherit;
99
+ }
100
+ .ProseMirror pre:has(code) {
101
+ /* Force the code block to be left-to-right */
102
+ direction: ltr;
103
+ }
104
+ .ProseMirror img, .ProseMirror video {
105
+ width: min-content;
106
+ max-width: 100%;
107
+ margin: 0.5em 0;
108
+ }
109
+ .ProseMirror blockquote {
110
+ position: relative;
111
+ margin: 4px 0;
112
+ padding-top: 3px;
113
+ padding-bottom: 3px;
114
+ padding-inline-start: 1em;
115
+ padding-inline-end: 2px;
116
+ }
117
+ .ProseMirror blockquote:before {
118
+ display: block;
119
+ position: absolute;
120
+ top: 2px;
121
+ bottom: 2px;
122
+ inset-inline-start: 2px;
123
+ border-inline-start: 0.25em solid var(--prosekit-blockquote-color);
124
+ content: "";
125
+ }
126
+ .ProseMirror hr {
127
+ margin: 13px 0 13px;
128
+ border-width: 1px 0 0 0;
129
+ color: var(--prosekit-border-color);
130
+ }
131
+ .ProseMirror .prosekit-horizontal-rule {
132
+ margin: 1px 0;
133
+ padding: 12px 2px 12px;
134
+ border-width: 0;
135
+ line-height: 1px;
136
+ }
137
+ .ProseMirror .prosekit-horizontal-rule hr {
138
+ margin: 0;
139
+ }
140
+ .ProseMirror .prosekit-horizontal-rule.prosekit-page-break {
141
+ position: relative;
142
+ }
143
+ .ProseMirror .prosekit-horizontal-rule.prosekit-page-break hr {
144
+ border-style: dashed;
145
+ font-size: 12px;
146
+ mask-image: linear-gradient(to right, black, black calc(50% - 6ch), transparent calc(50% - 6ch), transparent calc(50% + 6ch), black calc(50% + 6ch), black);
147
+ }
148
+ .ProseMirror .prosekit-horizontal-rule.prosekit-page-break::after {
149
+ position: absolute;
150
+ top: 50%;
151
+ left: 50%;
152
+ transform: translate(-50%, -50%);
153
+ content: "Page break";
154
+ color: var(--prosekit-border-color);
155
+ font-size: 12px;
156
+ pointer-events: none;
157
+ }
158
+ .ProseMirror .prosekit-horizontal-rule.prosekit-page-break.ProseMirror-selectednode hr {
159
+ border-color: var(--prosekit-outline-color);
160
+ }
161
+ .ProseMirror .prosekit-horizontal-rule.prosekit-page-break.ProseMirror-selectednode::after {
162
+ color: var(--prosekit-outline-color);
163
+ }
164
+ @media print {
165
+ .ProseMirror .prosekit-horizontal-rule.prosekit-page-break {
166
+ opacity: 0;
167
+ }
168
+ }
169
+ .ProseMirror .tableWrapper {
170
+ margin-top: 0.5em;
171
+ margin-bottom: 1em;
172
+ }
173
+ .ProseMirror .tableWrapper table, .ProseMirror .tableWrapper tr, .ProseMirror .tableWrapper th, .ProseMirror .tableWrapper td {
174
+ border: 1px solid var(--prosekit-border-color);
175
+ border-collapse: collapse;
176
+ border-spacing: 0;
177
+ }
178
+ .ProseMirror .tableWrapper .selectedCell {
179
+ --color: 210, 100%, 56%;
180
+ border: 1px solid var(--prosekit-outline-color);
181
+ border-style: double;
182
+ background-color: var(--prosekit-node-selection-color);
183
+ }
184
+ .ProseMirror .tableWrapper .column-resize-handle {
185
+ outline-color: var(--prosekit-outline-color);
186
+ outline-style: solid;
187
+ outline-width: 1px;
188
+ background-color: var(--prosekit-outline-color);
189
+ }
190
+ .ProseMirror a {
191
+ text-decoration: underline;
192
+ }
193
+ .ProseMirror .prosemirror-flat-list:has(> div.list-content > h1)::before, .ProseMirror .prosemirror-flat-list:has(> div.list-content > h1) > .list-marker {
194
+ top: 49px;
195
+ }
196
+ .ProseMirror .prosemirror-flat-list:has(> div.list-content > h2)::before, .ProseMirror .prosemirror-flat-list:has(> div.list-content > h2) > .list-marker {
197
+ top: 42.5px;
198
+ }
199
+ .ProseMirror .prosemirror-flat-list:has(> div.list-content > h3)::before, .ProseMirror .prosemirror-flat-list:has(> div.list-content > h3) > .list-marker {
200
+ top: 29px;
201
+ }
202
+ .ProseMirror .prosemirror-flat-list:has(> div.list-content > h4)::before, .ProseMirror .prosemirror-flat-list:has(> div.list-content > h4) > .list-marker {
203
+ top: 20px;
204
+ }
205
+ .ProseMirror .prosemirror-flat-list:has(> div.list-content > h5)::before, .ProseMirror .prosemirror-flat-list:has(> div.list-content > h5) > .list-marker {
206
+ top: 16px;
207
+ }
208
+ .ProseMirror .prosemirror-flat-list:has(> div.list-content > h6)::before, .ProseMirror .prosemirror-flat-list:has(> div.list-content > h6) > .list-marker {
209
+ top: 13px;
210
+ }
211
+ .ProseMirror .prosemirror-flat-list:has(> div.list-content > p)::before, .ProseMirror .prosemirror-flat-list:has(> div.list-content > p) > .list-marker {
212
+ top: 4px;
213
+ }
214
+ .ProseMirror div[data-node-view-root=true] {
215
+ display: contents;
216
+ }
217
+ .ProseMirror .ProseMirror-selectednode {
218
+ border-radius: 2px;
219
+ outline-color: var(--prosekit-outline-color);
220
+ outline-style: solid;
221
+ outline-width: 1px;
222
+ background-color: var(--prosekit-node-selection-color);
223
+ }
224
+ .ProseMirror pre.ProseMirror-selectednode {
225
+ border-radius: 0.375rem;
226
+ }
227
+ .ProseMirror .prosekit-autocomplete-match {
228
+ border-radius: 0.1em;
229
+ background-color: var(--prosekit-autocomplete-color);
230
+ box-shadow: 0 0 0 0.3em var(--prosekit-autocomplete-color);
231
+ }
232
+ .ProseMirror.prosekit-dragging {
233
+ --prosekit-node-selection-color: transparent;
234
+ }
235
+ .ProseMirror .prosemirror-math-inline.prosemirror-math-head-inside .prosemirror-math-source::before {
236
+ content: "$";
237
+ opacity: 0.5;
238
+ }
239
+ .ProseMirror .prosemirror-math-inline.prosemirror-math-head-inside .prosemirror-math-source::after {
240
+ content: "$";
241
+ opacity: 0.5;
242
+ }
243
+ .ProseMirror .prosemirror-math-block:not(.prosemirror-math-head-inside) {
244
+ margin: 0.5rem 0;
245
+ }
246
+ .ProseMirror .prosemirror-math-block .prosemirror-math-display {
247
+ padding: 0.5rem;
248
+ }