@37signals/lexxy 0.1.24-beta → 0.1.26-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.
@@ -195,6 +195,42 @@
195
195
  .token.punctuation {
196
196
  color: var(--lexxy-color-code-token-punctuation);
197
197
  }
198
+
199
+ /* Tables */
200
+ :where(.lexxy-content__table-wrapper) {
201
+ margin-block: 1ch;
202
+ overflow-x: auto;
203
+ }
204
+
205
+ table {
206
+ border-collapse: collapse;
207
+ border-spacing: 0;
208
+ inline-size: calc(100% - 0.5ch);
209
+ margin: 0.25ch;
210
+
211
+ th,
212
+ td {
213
+ border: 1px solid var(--lexxy-color-ink-lighter);
214
+ padding: 1ch;
215
+ text-align: start;
216
+ word-break: normal;
217
+
218
+ *:last-child {
219
+ margin-block-end: 0;
220
+ }
221
+
222
+ &.lexxy-content__table-cell--header {
223
+ background-color: var(--lexxy-color-ink-lightest);
224
+ font-weight: bold;
225
+ }
226
+
227
+ *:is(code, pre) {
228
+ hyphens: auto;
229
+ text-wrap: wrap;
230
+ white-space: pre-wrap;
231
+ }
232
+ }
233
+ }
198
234
  }
199
235
 
200
236
  :where([data-lexical-cursor]) {
@@ -36,6 +36,7 @@
36
36
  cursor: pointer;
37
37
  font-size: inherit;
38
38
  inline-size: auto;
39
+ padding: 0;
39
40
 
40
41
  @media(any-hover: hover) {
41
42
  &:hover:not([aria-disabled="true"]) {
@@ -52,6 +53,23 @@
52
53
  }
53
54
  }
54
55
 
56
+ table {
57
+ .table-cell--selected {
58
+ background-color: var(--lexxy-color-table-cell-selected-bg) !important;
59
+ }
60
+
61
+ .lexxy-content__table-cell--selected {
62
+ background-color: var(--lexxy-color-table-cell-selected-bg) !important;
63
+ border-color: var(--lexxy-color-table-cell-selected-border) !important;
64
+ }
65
+
66
+ &.lexxy-content__table--selection {
67
+ ::selection {
68
+ background: transparent;
69
+ }
70
+ }
71
+ }
72
+
55
73
  action-text-attachment {
56
74
  cursor: pointer;
57
75
  }
@@ -189,7 +207,7 @@
189
207
  user-select: none;
190
208
  -webkit-user-select: none;
191
209
 
192
- .lexxy-editor__toolbar-dropdown-content {
210
+ :where(.lexxy-editor__toolbar-dropdown-content) {
193
211
  --dropdown-padding: 1ch;
194
212
  --dropdown-gap: calc(var(--dropdown-padding) / 2);
195
213
 
@@ -358,6 +376,211 @@
358
376
  }
359
377
  }
360
378
 
379
+ /* Table dropdown
380
+ /* -------------------------------------------------------------------------- */
381
+
382
+ :where(lexxy-table-dropdown) {
383
+ display: flex;
384
+ flex-direction: column;
385
+ gap: 1ch;
386
+
387
+ .lexxy-editor__table-create {
388
+ display: flex;
389
+ flex-direction: column;
390
+ flex-wrap: wrap;
391
+ gap: 0;
392
+
393
+ .lexxy-editor__table-buttons {
394
+ background-color: var(--lexxy-color-ink-lighter);
395
+ display: flex;
396
+ flex-direction: column;
397
+ gap: 1px;
398
+ padding: 1px;
399
+
400
+ div {
401
+ display: flex;
402
+ flex-direction: row;
403
+ gap: 1px;
404
+ }
405
+
406
+ button {
407
+ aspect-ratio: 1.5 / 1;
408
+ border: 0;
409
+ border-radius: 0;
410
+ color: var(--lexxy-color-ink);
411
+ font-family: var(--lexxy-font-base);
412
+ font-size: var(--lexxy-text-small);
413
+ font-weight: normal;
414
+ inline-size: 4ch;
415
+ margin: 0;
416
+
417
+ &.active {
418
+ background-color: var(--lexxy-color-ink-lightest);
419
+ }
420
+ }
421
+ }
422
+
423
+ label {
424
+ align-items: center;
425
+ display: flex;
426
+ gap: 0.5ch;
427
+ padding: 0.5ch 0;
428
+ margin-block-start: 1ch;
429
+ }
430
+
431
+ &:has(input[type="checkbox"]:checked) {
432
+ .lexxy-editor__table-buttons {
433
+ div:first-child button,
434
+ button:first-child {
435
+ filter: brightness(0.95);
436
+ }
437
+ }
438
+ }
439
+ }
440
+ }
441
+
442
+ /* Table handle buttons
443
+ /* -------------------------------------------------------------------------- */
444
+
445
+ :where(.lexxy-table-handle-buttons) {
446
+ --button-size: 2.5lh;
447
+
448
+ color: var(--lexxy-color-ink-inverted);
449
+ display: none;
450
+ flex-direction: row;
451
+ font-size: var(--lexxy-text-small);
452
+ gap: 0.25ch;
453
+ line-height: 1;
454
+ position: absolute;
455
+ transform: translate(-50%, -120%);
456
+ z-index: 10;
457
+
458
+ .lexxy-table-control {
459
+ align-items: center;
460
+ background-color: var(--lexxy-color-ink);
461
+ border-radius: 0.75ch;
462
+ display: flex;
463
+ flex-direction: row;
464
+ gap: 1ch;
465
+ padding: 2px;
466
+ white-space: nowrap;
467
+
468
+ button {
469
+ aspect-ratio: 1 / 1;
470
+ align-items: center;
471
+ background-color: transparent;
472
+ border-radius: var(--lexxy-radius);
473
+ border: 0;
474
+ color: var(--lexxy-color-ink-inverted);
475
+ cursor: pointer;
476
+ display: flex;
477
+ font-weight: bold;
478
+ justify-content: center;
479
+ line-height: 1;
480
+ min-block-size: var(--button-size);
481
+ min-inline-size: var(--button-size);
482
+ padding: 0;
483
+
484
+ &:hover {
485
+ background-color: var(--lexxy-color-ink-medium);
486
+ }
487
+
488
+ svg {
489
+ block-size: 1em;
490
+ inline-size: 1em;
491
+ fill: currentColor;
492
+ }
493
+
494
+ span {
495
+ display: none;
496
+ }
497
+ }
498
+
499
+ button,
500
+ summary {
501
+ &:focus,
502
+ &:focus-visible {
503
+ background-color: var(--lexxy-color-ink-medium);
504
+ outline: var(--lexxy-focus-ring-size) solid var(--lexxy-focus-ring-color);
505
+ outline-offset: var(--lexxy-focus-ring-offset);
506
+ }
507
+ }
508
+ }
509
+
510
+ .lexxy-table-control__more-menu {
511
+ gap: 0;
512
+ padding: 2px;
513
+ position: relative;
514
+
515
+ summary {
516
+ aspect-ratio: 1 / 1;
517
+ align-items: center;
518
+ background: transparent;
519
+ border-radius: var(--lexxy-radius);
520
+ border: 0;
521
+ box-sizing: border-box;
522
+ display: flex;
523
+ font-size: inherit;
524
+ justify-content: center;
525
+ list-style: none;
526
+ min-block-size: var(--button-size);
527
+ min-inline-size: var(--button-size);
528
+ padding: 0;
529
+ user-select: none;
530
+ -webkit-user-select: none;
531
+
532
+ &::-webkit-details-marker {
533
+ display: none;
534
+ }
535
+
536
+ &:hover {
537
+ background: var(--lexxy-color-ink-medium);
538
+ }
539
+ }
540
+
541
+ .lexxy-table-control__more-menu-details {
542
+ display: flex;
543
+ flex-direction: column;
544
+ gap: 0.25ch;
545
+ inset-block-start: 105%;
546
+ inset-inline-start: 0;
547
+ padding: 0;
548
+ position: absolute;
549
+
550
+ .lexxy-table-control__more-menu-section {
551
+ background: var(--lexxy-color-ink);
552
+ border-radius: 0.75ch;
553
+ display: flex;
554
+ flex-direction: column;
555
+ padding: 2px;
556
+ }
557
+
558
+ button {
559
+ aspect-ratio: unset;
560
+ align-items: center;
561
+ display: flex;
562
+ flex-direction: row;
563
+ font-weight: normal;
564
+ gap: 1ch;
565
+ justify-content: flex-start;
566
+ padding: 0.5ch 2ch;
567
+ padding-inline-start: 1ch;
568
+ white-space: nowrap;
569
+
570
+ span {
571
+ display: inline-block;
572
+ }
573
+
574
+ svg {
575
+ block-size: 1.3lh;
576
+ inline-size: 1.3lh;
577
+ fill: currentColor;
578
+ }
579
+ }
580
+ }
581
+ }
582
+ }
583
+
361
584
 
362
585
  /* Language picker
363
586
  /* -------------------------------------------------------------------------- */
@@ -35,6 +35,7 @@
35
35
  --lexxy-color-selected-dark: var(--lexxy-color-blue);
36
36
  --lexxy-color-code-bg: var(--lexxy-color-ink-lightest);
37
37
 
38
+ /* Text color highlights */
38
39
  --highlight-1: rgb(136, 118, 38);
39
40
  --highlight-2: rgb(185, 94, 6);
40
41
  --highlight-3: rgb(207, 0, 0);
@@ -55,6 +56,13 @@
55
56
  --highlight-bg-8: rgba(221, 170, 123, 0.3);
56
57
  --highlight-bg-9: rgba(200, 200, 200, 0.3);
57
58
 
59
+ /* Tables */
60
+ --lexxy-color-table-header-bg: var(--lexxy-color-ink-lightest);
61
+ --lexxy-color-table-cell-border: var(--lexxy-color-ink-lighter);
62
+ --lexxy-color-table-cell-selected: var(--lexxy-color-selected);
63
+ --lexxy-color-table-cell-selected-border: highlight;
64
+ --lexxy-color-table-cell-selected-bg: highlight;
65
+
58
66
  /* Typography */
59
67
  --lexxy-font-base: system-ui, sans-serif;
60
68
  --lexxy-font-mono: ui-monospace, "Menlo", "Monaco", Consolas, monospace;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@37signals/lexxy",
3
- "version": "0.1.24-beta",
3
+ "version": "0.1.26-beta",
4
4
  "description": "Lexxy - A modern rich text editor for Rails.",
5
5
  "module": "dist/lexxy.esm.js",
6
6
  "type": "module",
@@ -25,7 +25,7 @@
25
25
  "scripts": {
26
26
  "build": "rollup -c",
27
27
  "build:npm": "rollup -c rollup.config.npm.mjs",
28
- "watch": "NODE_ENV=development rollup -wc --watch.onEnd=\"rails restart\"",
28
+ "watch": "rollup -wc --watch.onEnd=\"rails restart\"",
29
29
  "lint": "eslint",
30
30
  "prerelease": "yarn build:npm",
31
31
  "release": "yarn build:npm && yarn publish"