@37signals/lexxy 0.9.11-beta → 0.9.13-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.
@@ -12,7 +12,10 @@
12
12
  hyphens: auto;
13
13
  margin-block: 0 var(--lexxy-content-margin);
14
14
  overflow-wrap: break-word;
15
- text-wrap: balance;
15
+
16
+ @supports (text-wrap: balance) {
17
+ text-wrap: balance;
18
+ }
16
19
  }
17
20
 
18
21
  h1 { font-size: 2rem; }
@@ -35,7 +38,10 @@
35
38
 
36
39
  &:not(lexxy-editor &) {
37
40
  overflow-wrap: break-word;
38
- text-wrap: pretty;
41
+
42
+ @supports (text-wrap: pretty) {
43
+ text-wrap: pretty;
44
+ }
39
45
  }
40
46
  }
41
47
 
@@ -114,11 +120,14 @@
114
120
  hyphens: none;
115
121
  margin-block: 0 var(--lexxy-content-margin);
116
122
  overflow-x: auto;
123
+ overflow-wrap: break-word;
117
124
  padding: 1ch;
118
125
  tab-size: 2;
119
- text-wrap: nowrap;
120
126
  white-space: pre;
121
- word-break: break-word;
127
+
128
+ @supports (text-wrap: nowrap) {
129
+ text-wrap: nowrap;
130
+ }
122
131
  }
123
132
  }
124
133
 
@@ -275,8 +284,11 @@
275
284
 
276
285
  *:is(code, pre) {
277
286
  hyphens: auto;
278
- text-wrap: wrap;
279
287
  white-space: pre-wrap;
288
+
289
+ @supports (text-wrap: wrap) {
290
+ text-wrap: wrap;
291
+ }
280
292
  }
281
293
  }
282
294
  }
@@ -338,7 +350,11 @@
338
350
  display: block;
339
351
  margin-inline: auto;
340
352
  max-inline-size: 100%;
341
- user-select: none;
353
+ -webkit-user-select: none;
354
+
355
+ @supports (user-select: none) {
356
+ user-select: none;
357
+ }
342
358
  }
343
359
 
344
360
  > a {
@@ -3,6 +3,7 @@
3
3
  :where(lexxy-editor) {
4
4
  --lexxy-editor-padding: 1ch;
5
5
  --lexxy-editor-rows: 8lh;
6
+ /* eslint-disable-next-line css/no-invalid-properties */
6
7
  @supports (min-block-size: attr(rows lh)) {
7
8
  --lexxy-editor-rows: attr(rows lh, 8lh);
8
9
  }
@@ -12,6 +13,7 @@
12
13
  border: 1px solid var(--lexxy-color-ink-lighter);
13
14
  border-radius: calc(var(--lexxy-radius) + var(--lexxy-toolbar-gap));
14
15
  background-color: var(--lexxy-color-canvas);
16
+ container-type: inline-size;
15
17
  display: block;
16
18
  overflow: visible;
17
19
  position: relative;
@@ -164,6 +166,7 @@
164
166
  }
165
167
 
166
168
  &.lexxy-content__table--selection {
169
+ /* eslint-disable-next-line css/use-baseline */
167
170
  ::selection {
168
171
  background: transparent;
169
172
  }
@@ -364,9 +367,12 @@
364
367
  inline-size: 100%;
365
368
  max-inline-size: 100%;
366
369
  padding: 0;
367
- resize: none;
368
370
  text-align: center;
369
371
 
372
+ @supports (resize: none) {
373
+ resize: none;
374
+ }
375
+
370
376
  &:focus {
371
377
  background: var(--lexxy-color-canvas);
372
378
  outline: 0;
@@ -400,6 +406,7 @@
400
406
  }
401
407
 
402
408
  :where(.lexxy-editor__content) {
409
+ /* eslint-disable-next-line css/no-invalid-properties */
403
410
  min-block-size: var(--lexxy-editor-rows);
404
411
  outline: 0;
405
412
  padding: var(--lexxy-editor-padding);
@@ -447,6 +454,10 @@
447
454
  padding: 2px;
448
455
  position: relative;
449
456
 
457
+ @container (width < 300px) {
458
+ font-size: 0.8em;
459
+ }
460
+
450
461
  &[data-attachments="false"] button[name="image"],
451
462
  &[data-attachments="false"] button[name="file"] {
452
463
  display: none;
@@ -490,7 +501,11 @@
490
501
  fill: currentColor;
491
502
  grid-area: 1/1;
492
503
  inline-size: var(--lexxy-toolbar-icon-size);
493
- user-select: none;
504
+ -webkit-user-select: none;
505
+
506
+ @supports (user-select: none) {
507
+ user-select: none;
508
+ }
494
509
  }
495
510
 
496
511
  &.lexxy-editor__toolbar-group-end {
@@ -512,8 +527,8 @@
512
527
  }
513
528
  }
514
529
 
515
- .lexxy-editor__toolbar-spacer {
516
- flex: 1;
530
+ .lexxy-editor__toolbar-button--push-right {
531
+ margin-inline-start: auto;
517
532
  }
518
533
  }
519
534
 
@@ -521,20 +536,30 @@
521
536
  /* Dropdowns */
522
537
 
523
538
  :where(.lexxy-editor__toolbar-dropdown) {
524
- user-select: none;
525
539
  -webkit-user-select: none;
526
540
 
527
- &.lexxy-editor__toolbar-dropdown--chevron {
528
- summary {
541
+ @supports (user-select: none) {
542
+ user-select: none;
543
+ }
544
+
545
+ .lexxy-editor__toolbar-button {
546
+ color: currentColor;
547
+
548
+ &:hover {
549
+ opacity: 0.8;
550
+ }
551
+
552
+ &.lexxy-editor__toolbar-button--chevron {
529
553
  aspect-ratio: unset;
530
554
  gap: 0.5ch;
531
555
  grid-template-columns: 2fr 1fr;
556
+ min-inline-size: calc(var(--lexxy-toolbar-button-size) + 1.2ch);
532
557
  padding-inline: 0.75ch;
533
558
 
534
559
  &:after {
535
560
  block-size: 0.3ch;
536
- border-block-end: 2px solid currentcolor;
537
- border-inline-end: 2px solid currentcolor;
561
+ border-block-end: 2px solid currentColor;
562
+ border-inline-end: 2px solid currentColor;
538
563
  content: "";
539
564
  display: inline-block;
540
565
  inline-size: 0.3ch;
@@ -543,36 +568,33 @@
543
568
  }
544
569
  }
545
570
 
546
- summary ~ * {
571
+ > .lexxy-editor__toolbar-button[aria-expanded="true"] {
572
+ background-color: var(--lexxy-color-selected-hover);
573
+ border-end-end-radius: 0;
574
+ border-end-start-radius: 0;
575
+
576
+ &:hover {
577
+ background-color: var(--lexxy-color-selected-hover);
578
+ }
579
+ }
580
+
581
+ [data-dropdown-panel] {
547
582
  background-color: var(--lexxy-color-canvas);
548
583
  border: 2px solid var(--lexxy-color-selected-hover);
549
584
  border-radius: calc(var(--lexxy-radius) + var(--lexxy-toolbar-gap));
550
585
  box-sizing: border-box;
551
586
  box-shadow: var(--lexxy-shadow);
552
- color: var(--lexxy-color-ink);
587
+ color: var(--lexxy-color-text);
553
588
  display: flex;
554
589
  gap: var(--lexxy-toolbar-gap);
555
590
  margin: 0;
556
591
  padding: var(--lexxy-toolbar-spacing);
557
592
  position: absolute;
558
593
  z-index: 3;
559
- }
560
594
 
561
- &:is([open]) > .lexxy-editor__toolbar-button {
562
- background-color: var(--lexxy-color-selected-hover);
563
- border-end-end-radius: 0;
564
- border-end-start-radius: 0;
565
-
566
- &:hover {
567
- background-color: var(--lexxy-color-selected-hover);
568
- }
569
- }
570
-
571
- button {
572
- color: var(--lexxy-color-text);
573
-
574
- &:hover {
575
- opacity: 0.8;
595
+ &[hidden],
596
+ [overflowing] &[hidden] {
597
+ display: none;
576
598
  }
577
599
  }
578
600
 
@@ -583,6 +605,7 @@
583
605
 
584
606
  button {
585
607
  align-items: center;
608
+ color: var(--lexxy-color-text);
586
609
  display: flex;
587
610
  flex-direction: row;
588
611
  gap: 1ch;
@@ -603,6 +626,7 @@
603
626
 
604
627
  svg {
605
628
  block-size: 1lh;
629
+ fill: currentColor;
606
630
  inline-size: 1lh;
607
631
  }
608
632
  }
@@ -634,7 +658,7 @@
634
658
  justify-self: flex-end;
635
659
  z-index: 1;
636
660
 
637
- summary ~ * {
661
+ [data-dropdown-panel] {
638
662
  border-start-end-radius: 0;
639
663
  display: grid;
640
664
  grid-template-columns: repeat(4, 1fr);
@@ -646,127 +670,125 @@
646
670
  /* --------------------------------------------------------------------------
647
671
  /* Link dropdown */
648
672
 
649
- lexxy-link-dropdown {
650
- font-size: var(--lexxy-text-small);
651
- gap: var(--lexxy-toolbar-spacing);
652
- inset-inline-start: var(--lexxy-toolbar-spacing);
653
- inset-inline-end: var(--lexxy-toolbar-spacing);
673
+ &.lexxy-editor__toolbar-dropdown--link {
674
+ [data-dropdown-panel] {
675
+ font-size: var(--lexxy-text-small);
676
+ gap: var(--lexxy-toolbar-spacing);
677
+ inset-inline-start: var(--lexxy-toolbar-spacing);
678
+ inset-inline-end: var(--lexxy-toolbar-spacing);
654
679
 
655
- [overflowing] [open] & {
656
- display: block;
680
+ [overflowing] & {
681
+ flex-wrap: wrap;
682
+ }
657
683
 
658
684
  .lexxy-editor__toolbar-dropdown-actions {
659
- margin-block-start: var(--lexxy-toolbar-spacing);
685
+ display: flex;
686
+ flex: 1;
687
+ gap: var(--lexxy-toolbar-spacing);
660
688
  }
661
- }
662
-
663
689
 
664
- .lexxy-editor__toolbar-dropdown-actions {
665
- display: flex;
666
- flex: 1;
667
- gap: var(--lexxy-toolbar-spacing);
668
- }
690
+ input[type="url"] {
691
+ background-color: var(--lexxy-color-canvas);
692
+ border: 1px solid var(--lexxy-color-ink-lighter);
693
+ border-radius: var(--lexxy-radius);
694
+ color: var(--lexxy-color-text);
695
+ block-size: var(--lexxy-toolbar-button-size);
696
+ box-sizing: border-box;
697
+ font-size: var(--lexxy-text-small);
698
+ flex: 2;
699
+ inline-size: 100%;
700
+ line-height: inherit;
701
+ padding-block: 0;
702
+ padding-inline: 1ch;
669
703
 
670
- input[type="url"] {
671
- background-color: var(--lexxy-color-canvas);
672
- border: 1px solid var(--lexxy-color-ink-lighter);
673
- border-radius: var(--lexxy-radius);
674
- color: var(--lexxy-color-text);
675
- block-size: var(--lexxy-toolbar-button-size);
676
- box-sizing: border-box;
677
- font-size: var(--lexxy-text-small);
678
- flex: 2;
679
- inline-size: 100%;
680
- line-height: normal;
681
- padding-block: 0;
682
- padding-inline: 1ch;
683
- }
704
+ [overflowing] & {
705
+ min-inline-size: 100%;
706
+ }
707
+ }
684
708
 
685
- button {
686
- background-color: var(--lexxy-color-ink-lightest);
687
- inline-size: 100%;
688
- padding-inline: 2ch;
689
- }
709
+ button {
710
+ background-color: var(--lexxy-color-ink-lightest);
711
+ inline-size: 100%;
712
+ padding-inline: 2ch;
713
+ }
690
714
 
691
- button[value="link"] {
692
- background-color: var(--lexxy-color-accent-dark);
693
- color: var(--lexxy-color-ink-inverted);
715
+ button[value="link"] {
716
+ background-color: var(--lexxy-color-accent-dark);
717
+ color: var(--lexxy-color-ink-inverted);
694
718
 
695
- &:hover {
696
- background-color: var(--lexxy-color-accent-medium);
719
+ &:hover {
720
+ background-color: var(--lexxy-color-accent-medium);
721
+ }
697
722
  }
698
723
  }
699
724
  }
700
725
 
701
-
702
726
  /* --------------------------------------------------------------------------
703
727
  /* Color dropdown */
704
728
 
705
- &:has(lexxy-highlight-dropdown) {
729
+ &.lexxy-editor__toolbar-dropdown--highlight {
706
730
  position: relative;
707
731
 
708
732
  [overflowing] & {
709
733
  position: static;
710
734
  }
711
- }
712
-
713
- lexxy-highlight-dropdown {
714
- --max-inline-size: calc(var(--max-colors) * (var(--lexxy-toolbar-button-size) + var(--lexxy-toolbar-spacing)));
715
- border-start-start-radius: 0;
716
- display: flex;
717
- gap: var(--lexxy-toolbar-spacing);
718
- flex-direction: column;
719
- font-size: var(--lexxy-text-small);
720
- inset-inline-start: 0;
721
- max-inline-size: var(--max-inline-size);
722
-
723
- [overflowing] & {
724
- inset-inline-end: var(--lexxy-toolbar-spacing);
725
- inset-inline-start: var(--lexxy-toolbar-spacing);
726
- }
727
-
728
- button {
729
- position: relative;
730
- }
731
735
 
732
- .lexxy-highlight-colors {
733
- display: grid;
734
- gap: var(--lexxy-toolbar-gap);
735
- grid-template-columns: repeat(auto-fill, minmax(var(--lexxy-toolbar-button-size), 1fr));
736
+ [data-dropdown-panel] {
737
+ --max-inline-size: calc(var(--max-colors) * (var(--lexxy-toolbar-button-size) + var(--lexxy-toolbar-spacing)));
738
+ border-start-start-radius: 0;
739
+ gap: var(--lexxy-toolbar-spacing);
740
+ flex-direction: column;
741
+ font-size: var(--lexxy-text-small);
742
+ inset-inline-start: 0;
736
743
  max-inline-size: var(--max-inline-size);
737
744
 
745
+ [overflowing] & {
746
+ border-start-start-radius: calc(var(--lexxy-radius) + var(--lexxy-toolbar-gap));
747
+ inset-inline-end: var(--lexxy-toolbar-spacing);
748
+ inset-inline-start: var(--lexxy-toolbar-spacing);
749
+ }
750
+
738
751
  button {
739
- block-size: unset;
740
- inline-size: 100%;
752
+ position: relative;
753
+ }
741
754
 
742
- &:after {
743
- align-self: center;
744
- content: "Aa";
745
- display: inline-block;
746
- font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
747
- position: absolute;
748
- inset-block-start: 0;
749
- inset-block-end: 0;
750
- inset-inline-end: 0;
751
- inset-inline-start: 0;
752
- }
755
+ .lexxy-highlight-colors {
756
+ display: grid;
757
+ gap: var(--lexxy-toolbar-gap);
758
+ grid-template-columns: repeat(auto-fill, minmax(var(--lexxy-toolbar-button-size), 1fr));
759
+ max-inline-size: var(--max-inline-size);
753
760
 
754
- &[aria-pressed="true"] {
755
- background-color: transparent;
756
- box-shadow: 0 0 0 2px currentColor inset;
761
+ button {
762
+ block-size: unset;
763
+ inline-size: 100%;
757
764
 
758
765
  &:after {
759
- content: "✓";
766
+ align-items: center;
767
+ content: "Aa";
768
+ display: flex;
769
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
770
+ inset: 0;
771
+ justify-content: center;
772
+ position: absolute;
773
+ }
774
+
775
+ &[aria-pressed="true"] {
776
+ background-color: transparent;
777
+ box-shadow: 0 0 0 2px currentColor inset;
778
+
779
+ &:after {
780
+ content: "✓";
781
+ }
760
782
  }
761
783
  }
762
784
  }
763
- }
764
785
 
765
- .lexxy-editor__toolbar-dropdown-reset {
766
- background-color: var(--lexxy-color-ink-lightest);
786
+ .lexxy-editor__toolbar-dropdown-reset {
787
+ background-color: var(--lexxy-color-ink-lightest);
767
788
 
768
- &:is([disabled]) {
769
- display: none;
789
+ &:is([disabled]) {
790
+ display: none;
791
+ }
770
792
  }
771
793
  }
772
794
  }
@@ -795,9 +817,12 @@
795
817
  line-height: inherit;
796
818
  min-block-size: var(--button-size);
797
819
  min-inline-size: var(--button-size);
798
- user-select: none;
799
820
  -webkit-user-select: none;
800
821
 
822
+ @supports (user-select: none) {
823
+ user-select: none;
824
+ }
825
+
801
826
  @media(any-hover: hover) {
802
827
  &:hover:not([aria-disabled="true"]),
803
828
  [open] &:is(summary) {
@@ -1102,4 +1127,4 @@ action-text-attachment[content-type^="application/vnd.actiontext"] {
1102
1127
  }
1103
1128
  }
1104
1129
  }
1105
- }
1130
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@37signals/lexxy",
3
- "version": "0.9.11-beta",
3
+ "version": "0.9.13-beta",
4
4
  "description": "Lexxy - A modern rich text editor for Rails.",
5
5
  "module": "dist/lexxy.esm.js",
6
6
  "type": "module",
@@ -14,15 +14,22 @@
14
14
  "repository": "https://github.com/basecamp/lexxy.git",
15
15
  "author": "Jorge Manrubia <jorge@37signals.com>",
16
16
  "license": "MIT",
17
+ "browserslist": [
18
+ "baseline 2023",
19
+ "not dead"
20
+ ],
17
21
  "devDependencies": {
18
- "@eslint/js": "^9.15.0",
22
+ "@eslint/css": "^1.2.0",
23
+ "@eslint/js": "^10.0.1",
19
24
  "@playwright/test": "^1.52.0",
20
25
  "@rails/activestorage": "^8.1.200",
21
26
  "@rollup/plugin-commonjs": "^29.0.0",
22
27
  "@rollup/plugin-inject": "^5.0.5",
23
28
  "@rollup/plugin-node-resolve": "^16.0.1",
24
29
  "@rollup/plugin-terser": "^0.4.4",
25
- "eslint": "^9.15.0",
30
+ "eslint": "^10.3.0",
31
+ "globals": "^17.6.0",
32
+ "eslint-plugin-compat": "^7.0.2",
26
33
  "jsdom": "^27.3.0",
27
34
  "rollup": "^4.44.1",
28
35
  "rollup-plugin-copy": "^3.5.0",
@@ -48,21 +55,21 @@
48
55
  "release": "yarn build:npm && yarn publish"
49
56
  },
50
57
  "dependencies": {
51
- "@lexical/clipboard": "^0.43.0",
52
- "@lexical/code": "^0.43.0",
53
- "@lexical/extension": "^0.43.0",
54
- "@lexical/history": "^0.43.0",
55
- "@lexical/html": "^0.43.0",
56
- "@lexical/link": "^0.43.0",
57
- "@lexical/list": "^0.43.0",
58
- "@lexical/markdown": "^0.43.0",
59
- "@lexical/plain-text": "^0.43.0",
60
- "@lexical/rich-text": "^0.43.0",
61
- "@lexical/selection": "^0.43.0",
62
- "@lexical/table": "^0.43.0",
63
- "@lexical/utils": "^0.43.0",
58
+ "@lexical/clipboard": "^0.44.0",
59
+ "@lexical/code": "^0.44.0",
60
+ "@lexical/extension": "^0.44.0",
61
+ "@lexical/history": "^0.44.0",
62
+ "@lexical/html": "^0.44.0",
63
+ "@lexical/link": "^0.44.0",
64
+ "@lexical/list": "^0.44.0",
65
+ "@lexical/markdown": "^0.44.0",
66
+ "@lexical/plain-text": "^0.44.0",
67
+ "@lexical/rich-text": "^0.44.0",
68
+ "@lexical/selection": "^0.44.0",
69
+ "@lexical/table": "^0.44.0",
70
+ "@lexical/utils": "^0.44.0",
64
71
  "dompurify": "^3.3.0",
65
- "lexical": "^0.43.0",
72
+ "lexical": "^0.44.0",
66
73
  "marked": "^16.4.1",
67
74
  "prismjs": "^1.30.0"
68
75
  },