leepi 0.0.2 → 0.0.3

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.
Files changed (53) hide show
  1. package/dist/core/active-marks.d.ts +15 -0
  2. package/dist/core/active-marks.js +57 -0
  3. package/dist/core/commands.d.ts +39 -0
  4. package/dist/core/commands.js +415 -0
  5. package/dist/core/editor.d.ts +25 -0
  6. package/dist/core/editor.js +102 -0
  7. package/dist/core/field-notifier.d.ts +21 -0
  8. package/dist/core/field-notifier.js +56 -0
  9. package/dist/core/highlight-style.js +60 -0
  10. package/dist/core/highlight.d.ts +8 -0
  11. package/dist/core/highlight.js +34 -0
  12. package/dist/core/plugins/blockquote.d.ts +11 -0
  13. package/dist/core/plugins/blockquote.js +78 -0
  14. package/dist/core/plugins/bracket.d.ts +6 -0
  15. package/dist/core/plugins/bracket.js +38 -0
  16. package/dist/core/plugins/code-block.d.ts +27 -0
  17. package/dist/core/plugins/code-block.js +207 -0
  18. package/dist/core/plugins/heading.d.ts +13 -0
  19. package/dist/core/plugins/heading.js +111 -0
  20. package/dist/core/plugins/inline.d.ts +14 -0
  21. package/dist/core/plugins/inline.js +103 -0
  22. package/dist/core/plugins/link.d.ts +25 -0
  23. package/dist/core/plugins/link.js +104 -0
  24. package/dist/core/plugins/list.d.ts +14 -0
  25. package/dist/core/plugins/list.js +91 -0
  26. package/dist/core/plugins/table.d.ts +12 -0
  27. package/dist/core/plugins/table.js +161 -0
  28. package/dist/core/plugins.d.ts +9 -0
  29. package/dist/core/plugins.js +9 -0
  30. package/dist/core/popover.d.ts +9 -0
  31. package/dist/core/popover.js +16 -0
  32. package/dist/core/registry.d.ts +10 -0
  33. package/dist/core/registry.js +8 -0
  34. package/dist/core/types.d.ts +25 -0
  35. package/dist/core/types.js +0 -0
  36. package/dist/core/utils.d.ts +13 -0
  37. package/dist/core/utils.js +32 -0
  38. package/dist/leepi.css +461 -0
  39. package/dist/react/code-block-popover.d.ts +76 -0
  40. package/dist/react/code-block-popover.js +223 -0
  41. package/dist/react/context.d.ts +42 -0
  42. package/dist/react/context.js +88 -0
  43. package/dist/react/editor.d.ts +30 -0
  44. package/dist/react/editor.js +60 -0
  45. package/dist/react/floating-toolbar.d.ts +30 -0
  46. package/dist/react/floating-toolbar.js +87 -0
  47. package/dist/react/link-popover.d.ts +70 -0
  48. package/dist/react/link-popover.js +222 -0
  49. package/dist/react/preview.d.ts +13 -0
  50. package/dist/react/preview.js +56 -0
  51. package/dist/react/toolbar.d.ts +51 -0
  52. package/dist/react/toolbar.js +161 -0
  53. package/package.json +1 -1
package/dist/leepi.css ADDED
@@ -0,0 +1,461 @@
1
+ @layer base {
2
+ :root {
3
+ --lp-font-body: system-ui, -apple-system, sans-serif;
4
+ --lp-font-display: system-ui, -apple-system, sans-serif;
5
+ --lp-font-mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
6
+ --lp-font-size: 0.875rem;
7
+ --lp-line-height: 1.6;
8
+ --lp-font-weight-bold: 700;
9
+ --lp-font-weight-semibold: 600;
10
+
11
+ --lp-color-bg: #ffffff;
12
+ --lp-color-text: #1a1a1a;
13
+ --lp-color-text-secondary: rgba(0, 0, 0, 0.6);
14
+ --lp-color-text-faded: rgba(0, 0, 0, 0.36);
15
+ --lp-color-accent: #0078d4;
16
+ --lp-color-selection: rgba(0, 120, 212, 0.15);
17
+ --lp-color-border: rgba(0, 0, 0, 0.12);
18
+ --lp-color-surface: #f5f5f5;
19
+ --lp-color-caret: currentColor;
20
+ --lp-radius: 6px;
21
+
22
+ --lp-syntax-keyword: #8839ef;
23
+ --lp-syntax-string: #40a02b;
24
+ --lp-syntax-number: #e64553;
25
+ --lp-syntax-function: #1e66f5;
26
+ --lp-syntax-comment: #8c8fa1;
27
+ --lp-syntax-variable: #d20f39;
28
+ --lp-syntax-type: #df8e1d;
29
+ --lp-syntax-operator: #0d7680;
30
+ --lp-syntax-property: #d20f39;
31
+ --lp-syntax-tag: #d20f39;
32
+ --lp-syntax-attribute: #df8e1d;
33
+ --lp-syntax-escape: #0d7680;
34
+ --lp-syntax-punctuation: #4c4f69;
35
+ }
36
+
37
+ @media (prefers-color-scheme: dark) {
38
+ :root {
39
+ --lp-color-bg: #1e1e2e;
40
+ --lp-color-text: #cdd6f4;
41
+ --lp-color-text-secondary: rgba(205, 214, 244, 0.6);
42
+ --lp-color-text-faded: rgba(205, 214, 244, 0.36);
43
+ --lp-color-accent: #89b4fa;
44
+ --lp-color-selection: rgba(137, 180, 250, 0.2);
45
+ --lp-color-border: rgba(205, 214, 244, 0.12);
46
+ --lp-color-surface: #313244;
47
+
48
+ --lp-syntax-keyword: #cba6f7;
49
+ --lp-syntax-string: #a6e3a1;
50
+ --lp-syntax-number: #fab387;
51
+ --lp-syntax-function: #89b4fa;
52
+ --lp-syntax-comment: #6c7086;
53
+ --lp-syntax-variable: #f38ba8;
54
+ --lp-syntax-type: #f9e2af;
55
+ --lp-syntax-operator: #94e2d5;
56
+ --lp-syntax-property: #f38ba8;
57
+ --lp-syntax-tag: #f38ba8;
58
+ --lp-syntax-attribute: #f9e2af;
59
+ --lp-syntax-escape: #94e2d5;
60
+ --lp-syntax-punctuation: #a6adc8;
61
+ }
62
+ }
63
+ }
64
+
65
+ @layer components {
66
+ }
67
+
68
+ @layer components {
69
+ .lp-popover-positioner {
70
+ z-index: 50;
71
+ }
72
+
73
+ .lp-popover {
74
+ border: 1px solid var(--lp-color-border, rgba(0, 0, 0, 0.12));
75
+ border-radius: calc(var(--lp-radius, 6px) + 2px);
76
+ }
77
+
78
+ .lp-popover-form {
79
+ display: flex;
80
+ flex-direction: column;
81
+ gap: 1rem;
82
+ padding: 1.25rem;
83
+ width: 22rem;
84
+ }
85
+
86
+ .lp-popover-field {
87
+ display: flex;
88
+ flex-direction: column;
89
+ gap: 0.4rem;
90
+ }
91
+
92
+ .lp-popover-label {
93
+ font-size: 0.75rem;
94
+ text-transform: uppercase;
95
+ letter-spacing: 0.03em;
96
+ }
97
+
98
+ .lp-popover-input {
99
+ height: 2.25rem;
100
+ padding: 0 0.75rem;
101
+ border-radius: var(--lp-radius, 6px);
102
+ font: inherit;
103
+ font-size: 0.85rem;
104
+ border: 1px solid var(--lp-color-border, rgba(0, 0, 0, 0.12));
105
+ outline: none;
106
+ }
107
+
108
+ .lp-popover-input:focus {
109
+ border-color: var(--lp-color-accent, #0078d4);
110
+ }
111
+
112
+ .lp-popover-actions {
113
+ display: flex;
114
+ justify-content: space-between;
115
+ align-items: center;
116
+ padding-top: 0.375rem;
117
+ }
118
+
119
+ .lp-popover-actions-end {
120
+ display: flex;
121
+ gap: 0.5rem;
122
+ }
123
+
124
+ .lp-popover-btn {
125
+ height: 2rem;
126
+ padding: 0 0.875rem;
127
+ border-radius: var(--lp-radius, 6px);
128
+ font: inherit;
129
+ font-size: 0.8rem;
130
+ font-weight: 500;
131
+ cursor: pointer;
132
+ border: 1px solid transparent;
133
+ }
134
+
135
+ .lp-popover-btn:disabled {
136
+ opacity: 0.5;
137
+ cursor: not-allowed;
138
+ }
139
+
140
+ .lp-popover-select {
141
+ appearance: none;
142
+ height: 2.25rem;
143
+ padding: 0 2rem 0 0.75rem;
144
+ border-radius: var(--lp-radius, 6px);
145
+ font: inherit;
146
+ font-size: 0.85rem;
147
+ border: 1px solid var(--lp-color-border, rgba(0, 0, 0, 0.12));
148
+ background: transparent;
149
+ color: inherit;
150
+ cursor: pointer;
151
+ outline: none;
152
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
153
+ background-repeat: no-repeat;
154
+ background-position: right 0.75rem center;
155
+ }
156
+
157
+ .lp-popover-select:focus {
158
+ border-color: var(--lp-color-accent, #0078d4);
159
+ }
160
+ }
161
+
162
+ @layer components {
163
+ .lp-toolbar {
164
+ display: flex;
165
+ align-items: center;
166
+ gap: 2px;
167
+ padding: 0.25rem 0.5rem;
168
+ border-bottom: 1px solid var(--lp-color-border, rgba(0, 0, 0, 0.12));
169
+ flex-shrink: 0;
170
+ }
171
+
172
+ .lp-toolbar > span {
173
+ display: contents;
174
+ }
175
+
176
+ .lp-toolbar-group {
177
+ display: flex;
178
+ align-items: center;
179
+ gap: 1px;
180
+ }
181
+
182
+ .lp-toolbar-btn {
183
+ display: inline-flex;
184
+ align-items: center;
185
+ justify-content: center;
186
+ width: 1.75rem;
187
+ height: 1.75rem;
188
+ padding: 0;
189
+ border: none;
190
+ background: transparent;
191
+ color: inherit;
192
+ border-radius: 4px;
193
+ cursor: pointer;
194
+ font: inherit;
195
+ font-size: 0.75rem;
196
+ font-weight: 600;
197
+ }
198
+
199
+ .lp-toolbar-btn--active {
200
+ color: var(--lp-color-accent, #0078d4);
201
+ background: var(--lp-color-selection, rgba(0, 120, 212, 0.15));
202
+ }
203
+
204
+ .lp-toolbar-btn svg {
205
+ display: block;
206
+ width: 16px;
207
+ height: 16px;
208
+ }
209
+
210
+ .lp-toolbar-separator {
211
+ width: 1px;
212
+ height: 1rem;
213
+ background: var(--lp-color-border, rgba(0, 0, 0, 0.12));
214
+ margin: 0 0.25rem;
215
+ }
216
+ }
217
+
218
+ @layer components {
219
+ .lp-floating-toolbar {
220
+ display: flex;
221
+ align-items: center;
222
+ gap: 2px;
223
+ padding: 0.25rem;
224
+ border-radius: 6px;
225
+ z-index: 100;
226
+ pointer-events: auto;
227
+ }
228
+
229
+ .lp-floating-toolbar-btn {
230
+ display: inline-flex;
231
+ align-items: center;
232
+ justify-content: center;
233
+ width: 1.75rem;
234
+ height: 1.75rem;
235
+ padding: 0;
236
+ border: none;
237
+ background: transparent;
238
+ color: inherit;
239
+ border-radius: 4px;
240
+ cursor: pointer;
241
+ font: inherit;
242
+ font-size: 0.75rem;
243
+ font-weight: 600;
244
+ }
245
+
246
+ .lp-floating-toolbar-btn--active {
247
+ color: var(--lp-color-accent, #0078d4);
248
+ background: var(--lp-color-selection, rgba(0, 120, 212, 0.15));
249
+ }
250
+
251
+ .lp-floating-toolbar-btn svg {
252
+ display: block;
253
+ width: 14px;
254
+ height: 14px;
255
+ }
256
+
257
+ .lp-floating-toolbar-separator {
258
+ width: 1px;
259
+ height: 1rem;
260
+ margin: 0 0.25rem;
261
+ background: var(--lp-color-border, #e0e0e0);
262
+ }
263
+
264
+ .lp-floating-toolbar-group {
265
+ display: flex;
266
+ align-items: center;
267
+ gap: 1px;
268
+ }
269
+ }
270
+
271
+ @layer components {
272
+ .lp-preview h1,
273
+ .lp-preview h2,
274
+ .lp-preview h3,
275
+ .lp-preview h4,
276
+ .lp-preview h5,
277
+ .lp-preview h6 {
278
+ margin-top: 1.5em;
279
+ margin-bottom: 0.5em;
280
+ line-height: 1.3;
281
+ font-family: var(--lp-font-display);
282
+ }
283
+ .lp-preview h1 {
284
+ font-size: 2em;
285
+ font-weight: 700;
286
+ }
287
+ .lp-preview h2 {
288
+ font-size: 1.6em;
289
+ font-weight: 700;
290
+ }
291
+ .lp-preview h3 {
292
+ font-size: 1.3em;
293
+ font-weight: 600;
294
+ }
295
+ .lp-preview h4 {
296
+ font-size: 1.1em;
297
+ font-weight: 600;
298
+ }
299
+ .lp-preview p {
300
+ margin-top: 0.75em;
301
+ margin-bottom: 0.75em;
302
+ }
303
+ .lp-preview a {
304
+ text-decoration: underline;
305
+ }
306
+ .lp-preview del {
307
+ text-decoration: line-through;
308
+ }
309
+ .lp-preview code {
310
+ font-family: var(--lp-font-mono, ui-monospace, monospace);
311
+ font-size: 0.875em;
312
+ }
313
+ .lp-preview .lp-code-block {
314
+ border-radius: 8px;
315
+ margin: 1em 0;
316
+ overflow: hidden;
317
+ border: 1px solid var(--lp-color-border, rgba(0, 0, 0, 0.12));
318
+ }
319
+ .lp-preview .lp-code-header {
320
+ display: flex;
321
+ justify-content: space-between;
322
+ padding: 0.4em 1em;
323
+ font-family: var(--lp-font-mono, ui-monospace, monospace);
324
+ font-size: 0.75rem;
325
+ border-bottom: 1px solid var(--lp-color-border, rgba(0, 0, 0, 0.12));
326
+ letter-spacing: 0.05em;
327
+ }
328
+ .lp-preview .lp-code-header-lang {
329
+ text-transform: uppercase;
330
+ }
331
+ .lp-preview .lp-code-block pre {
332
+ margin: 0;
333
+ border-radius: 0;
334
+ background: none;
335
+ }
336
+ .lp-preview .lp-code-block code {
337
+ display: table;
338
+ }
339
+ .lp-preview .lp-code-row {
340
+ display: table-row;
341
+ line-height: 1.5;
342
+ }
343
+ .lp-preview .lp-code-line-number {
344
+ display: table-cell;
345
+ text-align: right;
346
+ padding-right: 1em;
347
+ user-select: none;
348
+ opacity: 0.5;
349
+ white-space: nowrap;
350
+ vertical-align: top;
351
+ }
352
+ .lp-preview .lp-code-line {
353
+ display: table-cell;
354
+ white-space: pre;
355
+ }
356
+ .lp-preview pre {
357
+ border-radius: 8px;
358
+ padding: 1em;
359
+ overflow-x: auto;
360
+ margin: 1em 0;
361
+ }
362
+ .lp-preview pre code {
363
+ background: none;
364
+ padding: 0;
365
+ font-size: 0.875em;
366
+ }
367
+ .lp-preview blockquote {
368
+ border-left: 3px solid var(--lp-color-border, rgba(0, 0, 0, 0.12));
369
+ padding-left: 1em;
370
+ font-style: italic;
371
+ margin: 1em 0;
372
+ }
373
+ .lp-preview ul,
374
+ .lp-preview ol {
375
+ padding-left: 1.5em;
376
+ margin: 0.75em 0;
377
+ }
378
+ .lp-preview ul {
379
+ list-style-type: disc;
380
+ }
381
+ .lp-preview ol {
382
+ list-style-type: decimal;
383
+ }
384
+ .lp-preview li {
385
+ margin: 0.25em 0;
386
+ }
387
+ .lp-preview hr {
388
+ border: none;
389
+ border-top: 1px solid var(--lp-color-border, rgba(0, 0, 0, 0.12));
390
+ margin: 1.5em 0;
391
+ }
392
+ .lp-preview table {
393
+ width: 100%;
394
+ border-collapse: collapse;
395
+ margin: 1em 0;
396
+ }
397
+ .lp-preview th,
398
+ .lp-preview td {
399
+ border: 1px solid var(--lp-color-border, rgba(0, 0, 0, 0.12));
400
+ padding: 0.5em 0.75em;
401
+ text-align: left;
402
+ }
403
+ .lp-preview img {
404
+ max-width: 100%;
405
+ }
406
+ .lp-preview input[type="checkbox"] {
407
+ margin-right: 0.5em;
408
+ }
409
+
410
+ /* Syntax token classes from Lezer classHighlighter */
411
+ .tok-keyword {
412
+ color: var(--lp-syntax-keyword);
413
+ }
414
+ .tok-operator {
415
+ color: var(--lp-syntax-operator);
416
+ }
417
+ .tok-variableName {
418
+ color: var(--lp-syntax-variable);
419
+ }
420
+ .tok-typeName,
421
+ .tok-className,
422
+ .tok-definition,
423
+ .tok-namespace {
424
+ color: var(--lp-syntax-type);
425
+ }
426
+ .tok-propertyName {
427
+ color: var(--lp-syntax-property);
428
+ }
429
+ .tok-comment {
430
+ color: var(--lp-syntax-comment);
431
+ font-style: italic;
432
+ }
433
+ .tok-string,
434
+ .tok-string2,
435
+ .tok-attributeValue,
436
+ .tok-regexp {
437
+ color: var(--lp-syntax-string);
438
+ }
439
+ .tok-number,
440
+ .tok-bool,
441
+ .tok-null,
442
+ .tok-atom {
443
+ color: var(--lp-syntax-number);
444
+ }
445
+ .tok-function {
446
+ color: var(--lp-syntax-function);
447
+ }
448
+ .tok-tagName {
449
+ color: var(--lp-syntax-tag);
450
+ }
451
+ .tok-attributeName {
452
+ color: var(--lp-syntax-attribute);
453
+ }
454
+ .tok-escape,
455
+ .tok-link {
456
+ color: var(--lp-syntax-escape);
457
+ }
458
+ .tok-punctuation {
459
+ color: var(--lp-syntax-punctuation);
460
+ }
461
+ }
@@ -0,0 +1,76 @@
1
+ import { JSX, ReactNode } from "react";
2
+ import { useRender } from "@base-ui/react/use-render";
3
+
4
+ //#region src/react/code-block-popover.d.ts
5
+ interface LanguageSelectProps extends useRender.ComponentProps<"select"> {
6
+ autoFocus?: boolean;
7
+ label?: ReactNode;
8
+ children?: ReactNode;
9
+ }
10
+ declare function LanguageSelect({
11
+ autoFocus,
12
+ render,
13
+ label,
14
+ children,
15
+ ...restProps
16
+ }: LanguageSelectProps): JSX.Element;
17
+ interface LanguageInputProps extends useRender.ComponentProps<"input"> {
18
+ autoFocus?: boolean;
19
+ placeholder?: string;
20
+ children?: ReactNode;
21
+ }
22
+ declare function LanguageInput({
23
+ autoFocus,
24
+ placeholder,
25
+ render,
26
+ children,
27
+ ...restProps
28
+ }: LanguageInputProps): JSX.Element;
29
+ interface FilenameInputProps extends useRender.ComponentProps<"input"> {
30
+ placeholder?: string;
31
+ children?: ReactNode;
32
+ }
33
+ declare function FilenameInput({
34
+ placeholder,
35
+ render,
36
+ children,
37
+ ...restProps
38
+ }: FilenameInputProps): JSX.Element;
39
+ declare function Actions({
40
+ cancelLabel,
41
+ submitLabel
42
+ }: {
43
+ cancelLabel?: ReactNode;
44
+ submitLabel?: ReactNode;
45
+ }): JSX.Element;
46
+ interface CodeBlockPopoverContentProps {
47
+ initialLang?: string;
48
+ initialFilename?: string;
49
+ onSubmit: (lang: string, filename: string) => void;
50
+ onClose: () => void;
51
+ children: ReactNode;
52
+ }
53
+ declare function CodeBlockPopoverContent({
54
+ initialLang,
55
+ initialFilename,
56
+ onSubmit,
57
+ onClose,
58
+ children
59
+ }: CodeBlockPopoverContentProps): JSX.Element;
60
+ interface CodeBlockPopoverProps extends CodeBlockPopoverContentProps {
61
+ x: number;
62
+ y: number;
63
+ }
64
+ declare function CodeBlockPopoverRoot({
65
+ x,
66
+ y,
67
+ onClose,
68
+ ...contentProps
69
+ }: CodeBlockPopoverProps): JSX.Element;
70
+ declare function CodeBlockPopoverConnected({
71
+ children
72
+ }: {
73
+ children: ReactNode;
74
+ }): JSX.Element;
75
+ //#endregion
76
+ export { Actions, CodeBlockPopoverConnected, CodeBlockPopoverContentProps, CodeBlockPopoverProps, CodeBlockPopoverContent as Content, FilenameInput, LanguageInput, LanguageSelect, CodeBlockPopoverRoot as Root };