@37signals/lexxy 0.7.5-beta → 0.8.0-beta
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/lexxy.esm.js +2296 -1678
- package/dist/lexxy_helpers.esm.js +10 -1
- package/dist/stylesheets/lexxy-content.css +172 -141
- package/dist/stylesheets/lexxy-editor.css +340 -195
- package/package.json +2 -2
|
@@ -36,6 +36,15 @@ function dispatch(element, eventName, detail = null, cancelable = false) {
|
|
|
36
36
|
return element.dispatchEvent(new CustomEvent(eventName, { bubbles: true, detail, cancelable }))
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
function addBlockSpacing(doc) {
|
|
40
|
+
const blocks = doc.querySelectorAll("body > :not(h1, h2, h3, h4, h5, h6) + *");
|
|
41
|
+
for (const block of blocks) {
|
|
42
|
+
const spacer = doc.createElement("p");
|
|
43
|
+
spacer.appendChild(doc.createElement("br"));
|
|
44
|
+
block.before(spacer);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
39
48
|
function generateDomId(prefix) {
|
|
40
49
|
const randomPart = Math.random().toString(36).slice(2, 10);
|
|
41
50
|
return `${prefix}-${randomPart}`
|
|
@@ -64,4 +73,4 @@ function highlightElement(preElement) {
|
|
|
64
73
|
preElement.replaceWith(codeElement);
|
|
65
74
|
}
|
|
66
75
|
|
|
67
|
-
export { createAttachmentFigure, createElement, dispatch, generateDomId, highlightCode, isPreviewableImage, parseHtml };
|
|
76
|
+
export { addBlockSpacing, createAttachmentFigure, createElement, dispatch, generateDomId, highlightCode, isPreviewableImage, parseHtml };
|
|
@@ -28,8 +28,10 @@
|
|
|
28
28
|
dl,
|
|
29
29
|
blockquote,
|
|
30
30
|
figure,
|
|
31
|
-
.attachment
|
|
31
|
+
.attachment,
|
|
32
|
+
.attachment-gallery {
|
|
32
33
|
margin-block: 0 var(--lexxy-content-margin);
|
|
34
|
+
position: relative;
|
|
33
35
|
|
|
34
36
|
&:not(lexxy-editor &) {
|
|
35
37
|
overflow-wrap: break-word;
|
|
@@ -85,6 +87,7 @@
|
|
|
85
87
|
object {
|
|
86
88
|
inline-size: auto;
|
|
87
89
|
margin-inline: auto;
|
|
90
|
+
min-block-size: 3em;
|
|
88
91
|
max-block-size: 32rem;
|
|
89
92
|
object-fit: contain;
|
|
90
93
|
|
|
@@ -137,6 +140,26 @@
|
|
|
137
140
|
}
|
|
138
141
|
}
|
|
139
142
|
|
|
143
|
+
hr {
|
|
144
|
+
border: 0;
|
|
145
|
+
border-block-end: 1px solid currentColor;
|
|
146
|
+
inline-size: 20%;
|
|
147
|
+
margin: calc(0.5em + var(--lexxy-content-margin)) 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.horizontal-divider {
|
|
151
|
+
margin: 0;
|
|
152
|
+
padding: calc(0.5em + var(--lexxy-content-margin)) 0;
|
|
153
|
+
|
|
154
|
+
hr {
|
|
155
|
+
margin: 0;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
*:has(+ .horizontal-divider) {
|
|
160
|
+
margin-block-end: 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
140
163
|
> :last-child {
|
|
141
164
|
margin-block-end: 0;
|
|
142
165
|
}
|
|
@@ -254,111 +277,97 @@
|
|
|
254
277
|
}
|
|
255
278
|
}
|
|
256
279
|
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/* Attachments
|
|
260
|
-
/* ------------------------------------------------------------------------ */
|
|
261
|
-
|
|
262
|
-
:where(.attachment) {
|
|
263
|
-
block-size: auto;
|
|
264
|
-
display: block;
|
|
265
|
-
inline-size: fit-content;
|
|
266
|
-
position: relative;
|
|
267
|
-
margin-inline: auto;
|
|
268
|
-
max-inline-size: 100%;
|
|
269
|
-
text-align: center;
|
|
270
280
|
|
|
271
|
-
:where(progress) {
|
|
272
|
-
inline-size: 100%;
|
|
273
|
-
margin: auto;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
281
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
font-size: var(--lexxy-text-small);
|
|
282
|
+
/* Attachments
|
|
283
|
+
/* ------------------------------------------------------------------------ */
|
|
280
284
|
|
|
281
|
-
|
|
282
|
-
background: var(--lexxy-color-canvas);
|
|
283
|
-
border: none;
|
|
284
|
-
color: inherit;
|
|
285
|
-
font-family: inherit;
|
|
286
|
-
inline-size: 100%;
|
|
287
|
-
max-inline-size: 100%;
|
|
288
|
-
resize: none;
|
|
285
|
+
p:has(.attachment) {
|
|
289
286
|
text-align: center;
|
|
290
|
-
|
|
291
|
-
&:focus {
|
|
292
|
-
outline: none;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
@supports (field-sizing: content) {
|
|
296
|
-
field-sizing: content;
|
|
297
|
-
inline-size: auto;
|
|
298
|
-
min-inline-size: 20ch;
|
|
299
|
-
}
|
|
300
287
|
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
:where(.attachment__icon) {
|
|
304
|
-
aspect-ratio: 4/5;
|
|
305
|
-
background-color: color-mix(var(--lexxy-attachment-icon-color), transparent 90%);
|
|
306
|
-
block-size: 3lh;
|
|
307
|
-
border: 2px solid var(--lexxy-attachment-icon-color);
|
|
308
|
-
border-block-start-width: 1ch;
|
|
309
|
-
border-radius: var(--lexxy-radius);
|
|
310
|
-
box-sizing: border-box;
|
|
311
|
-
color: var(--lexxy-attachment-icon-color);
|
|
312
|
-
display: grid;
|
|
313
|
-
font-size: var(--lexxy-text-small);
|
|
314
|
-
font-weight: bold;
|
|
315
|
-
inline-size: auto;
|
|
316
|
-
place-content: center;
|
|
317
|
-
text-transform: uppercase;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
:where(.attachment--preview) {
|
|
321
|
-
border-radius: var(--lexxy-radius);
|
|
322
288
|
|
|
323
|
-
|
|
289
|
+
.attachment {
|
|
290
|
+
--lexxy-attachment-gap: 0.75ch;
|
|
291
|
+
|
|
324
292
|
block-size: auto;
|
|
325
|
-
|
|
293
|
+
box-sizing: border-box;
|
|
294
|
+
border-radius: var(--lexxy-radius);
|
|
295
|
+
display: table; /* Using table to wrap the caption to fit the attachment's width */
|
|
296
|
+
inline-size: fit-content;
|
|
326
297
|
margin-inline: auto;
|
|
327
298
|
max-inline-size: 100%;
|
|
328
|
-
|
|
329
|
-
|
|
299
|
+
min-inline-size: 10ch;
|
|
300
|
+
padding: var(--lexxy-attachment-gap);
|
|
301
|
+
position: relative;
|
|
302
|
+
text-align: center;
|
|
330
303
|
|
|
331
|
-
|
|
332
|
-
|
|
304
|
+
:where(progress) {
|
|
305
|
+
inline-size: 100%;
|
|
306
|
+
margin: auto;
|
|
307
|
+
}
|
|
333
308
|
}
|
|
334
309
|
|
|
335
310
|
.attachment__caption {
|
|
336
|
-
|
|
311
|
+
caption-side: bottom;
|
|
312
|
+
color: var(--lexxy-color-text-subtle);
|
|
313
|
+
display: table-caption;
|
|
314
|
+
font-size: var(--lexxy-text-small);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.attachment__icon {
|
|
318
|
+
aspect-ratio: 4/5;
|
|
319
|
+
background-color: color-mix(var(--lexxy-attachment-icon-color), transparent 90%);
|
|
320
|
+
block-size: 3lh;
|
|
321
|
+
border: 2px solid var(--lexxy-attachment-icon-color);
|
|
322
|
+
border-block-start-width: 1ch;
|
|
323
|
+
border-radius: var(--lexxy-radius);
|
|
324
|
+
box-sizing: border-box;
|
|
325
|
+
color: var(--lexxy-attachment-icon-color);
|
|
326
|
+
display: grid;
|
|
327
|
+
font-size: var(--lexxy-text-small);
|
|
328
|
+
font-weight: bold;
|
|
329
|
+
inline-size: auto;
|
|
330
|
+
place-content: center;
|
|
331
|
+
text-transform: uppercase;
|
|
337
332
|
}
|
|
338
|
-
}
|
|
339
333
|
|
|
340
|
-
|
|
341
|
-
--lexxy-attachment-icon-color: var(--lexxy-color-text-subtle);
|
|
334
|
+
.attachment--preview {
|
|
342
335
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
336
|
+
img, video {
|
|
337
|
+
border-radius: var(--lexxy-radius);
|
|
338
|
+
block-size: auto;
|
|
339
|
+
display: block;
|
|
340
|
+
margin-inline: auto;
|
|
341
|
+
max-inline-size: 100%;
|
|
342
|
+
user-select: none;
|
|
343
|
+
}
|
|
348
344
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
text-align: start;
|
|
345
|
+
> a {
|
|
346
|
+
display: block;
|
|
347
|
+
}
|
|
353
348
|
}
|
|
354
349
|
|
|
355
|
-
.
|
|
356
|
-
color: var(--lexxy-color-
|
|
357
|
-
|
|
350
|
+
.attachment--file {
|
|
351
|
+
--lexxy-attachment-icon-color: var(--lexxy-color-text-subtle);
|
|
352
|
+
|
|
353
|
+
align-items: center;
|
|
354
|
+
display: flex;
|
|
355
|
+
flex-wrap: wrap;
|
|
356
|
+
gap: 0;
|
|
357
|
+
inline-size: auto;
|
|
358
|
+
|
|
359
|
+
.attachment__caption {
|
|
360
|
+
display: grid;
|
|
361
|
+
flex: 1;
|
|
362
|
+
text-align: start;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.attachment__name {
|
|
366
|
+
color: var(--lexxy-color-ink);
|
|
367
|
+
font-weight: bold;
|
|
368
|
+
}
|
|
358
369
|
}
|
|
359
|
-
}
|
|
360
370
|
|
|
361
|
-
:where(
|
|
362
371
|
.attachment--psd,
|
|
363
372
|
.attachment--key,
|
|
364
373
|
.attachment--sketch,
|
|
@@ -367,12 +376,10 @@
|
|
|
367
376
|
.attachment--indd,
|
|
368
377
|
.attachment--svg,
|
|
369
378
|
.attachment--ppt,
|
|
370
|
-
.attachment--pptx
|
|
371
|
-
)
|
|
372
|
-
|
|
373
|
-
}
|
|
379
|
+
.attachment--pptx {
|
|
380
|
+
--lexxy-attachment-icon-color: var(--lexxy-color-red);
|
|
381
|
+
}
|
|
374
382
|
|
|
375
|
-
:where(
|
|
376
383
|
.attachment--css,
|
|
377
384
|
.attachment--php,
|
|
378
385
|
.attachment--json,
|
|
@@ -381,71 +388,95 @@
|
|
|
381
388
|
.attachment--rb,
|
|
382
389
|
.attachment--erb,
|
|
383
390
|
.attachment--ts,
|
|
384
|
-
.attachment--js
|
|
385
|
-
)
|
|
386
|
-
|
|
387
|
-
}
|
|
391
|
+
.attachment--js {
|
|
392
|
+
--lexxy-attachment-icon-color: var(--lexxy-color-purple);
|
|
393
|
+
}
|
|
388
394
|
|
|
389
|
-
:where(
|
|
390
395
|
.attachment--txt,
|
|
391
396
|
.attachment--pages,
|
|
392
397
|
.attachment--rtf,
|
|
393
398
|
.attachment--md,
|
|
394
399
|
.attachment--doc,
|
|
395
|
-
.attachment--docx
|
|
396
|
-
)
|
|
397
|
-
|
|
398
|
-
}
|
|
400
|
+
.attachment--docx {
|
|
401
|
+
--lexxy-attachment-icon-color: var(--lexxy-color-blue);
|
|
402
|
+
}
|
|
399
403
|
|
|
400
|
-
:where(
|
|
401
404
|
.attachment--csv,
|
|
402
405
|
.attachment--numbers,
|
|
403
406
|
.attachment--xls,
|
|
404
|
-
.attachment--xlsx
|
|
405
|
-
)
|
|
406
|
-
|
|
407
|
-
}
|
|
407
|
+
.attachment--xlsx {
|
|
408
|
+
--lexxy-attachment-icon-color: var(--lexxy-color-green);
|
|
409
|
+
}
|
|
408
410
|
|
|
409
|
-
/* Horizontal divider */
|
|
410
|
-
:where(.horizontal-divider) {
|
|
411
|
-
margin: 0;
|
|
412
|
-
margin-block-end: .5em;
|
|
413
|
-
padding: 1.5em 0 .5em;
|
|
414
411
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
412
|
+
/* Image galleries */
|
|
413
|
+
/* ------------------------------------------------------------------------ */
|
|
414
|
+
|
|
415
|
+
.attachment-gallery {
|
|
416
|
+
display: grid;
|
|
417
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
418
|
+
|
|
419
|
+
.attachment {
|
|
420
|
+
display: flex;
|
|
421
|
+
flex-direction: column;
|
|
422
|
+
gap: 1ch;
|
|
423
|
+
inline-size: 100%;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
&:has(> :nth-child(2):last-child),
|
|
427
|
+
&:has(> :nth-child(4):last-child) {
|
|
428
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
/* Custom attachments such as mentions, etc. */
|
|
434
|
+
/* ------------------------------------------------------------------------ */
|
|
435
|
+
|
|
436
|
+
action-text-attachment[content-type^="application/vnd.actiontext"] {
|
|
437
|
+
--lexxy-attachment-bg-color: transparent;
|
|
438
|
+
--lexxy-attachment-image-size: 1em;
|
|
439
|
+
--lexxy-attachment-text-color: currentColor;
|
|
440
|
+
|
|
441
|
+
align-items: center;
|
|
442
|
+
background: var(--lexxy-attachment-bg-color);
|
|
443
|
+
border-radius: var(--lexxy-radius);
|
|
444
|
+
box-shadow: -0.25ch 0 0 var(--lexxy-attachment-bg-color), 0.5ch 0 0 var(--lexxy-attachment-bg-color);
|
|
445
|
+
color: var(--lexxy-attachment-text-color);
|
|
446
|
+
display: inline-flex;
|
|
447
|
+
gap: 0.25ch;
|
|
419
448
|
margin: 0;
|
|
449
|
+
padding: 0;
|
|
450
|
+
position: relative;
|
|
451
|
+
white-space: normal;
|
|
452
|
+
|
|
453
|
+
img {
|
|
454
|
+
block-size: var(--lexxy-attachment-image-size);
|
|
455
|
+
border-radius: 50%;
|
|
456
|
+
inline-size: var(--lexxy-attachment-image-size);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
&.node--selected {
|
|
460
|
+
--lexxy-attachment-bg-color: var(--lexxy-color-accent-dark);
|
|
461
|
+
--lexxy-attachment-text-color: var(--lexxy-color-ink-inverted);
|
|
462
|
+
}
|
|
420
463
|
}
|
|
421
|
-
}
|
|
422
464
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
position: relative;
|
|
439
|
-
white-space: normal;
|
|
440
|
-
|
|
441
|
-
img {
|
|
442
|
-
block-size: var(--lexxy-attachment-image-size);
|
|
443
|
-
border-radius: 50%;
|
|
444
|
-
inline-size: var(--lexxy-attachment-image-size);
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
&.node--selected {
|
|
448
|
-
--lexxy-attachment-bg-color: var(--lexxy-color-accent-dark);
|
|
449
|
-
--lexxy-attachment-text-color: var(--lexxy-color-ink-inverted);
|
|
465
|
+
|
|
466
|
+
/* Horizontal divider */
|
|
467
|
+
/* ------------------------------------------------------------------------ */
|
|
468
|
+
|
|
469
|
+
.horizontal-divider {
|
|
470
|
+
margin: 0;
|
|
471
|
+
margin-block-end: .5em;
|
|
472
|
+
padding: 1.5em 0 .5em;
|
|
473
|
+
|
|
474
|
+
hr {
|
|
475
|
+
border: 0;
|
|
476
|
+
border-block-end: 1px solid currentColor;
|
|
477
|
+
inline-size: 20%;
|
|
478
|
+
margin: 0;
|
|
479
|
+
}
|
|
450
480
|
}
|
|
481
|
+
|
|
451
482
|
}
|