stilo-editor 0.1.0 → 0.2.1

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 (57) hide show
  1. package/README.md +76 -129
  2. package/dist/content.css +238 -1
  3. package/dist/core/editor.d.ts +15 -3
  4. package/dist/core/extension-manager.d.ts +3 -3
  5. package/dist/core/extension.d.ts +6 -1
  6. package/dist/core/helpers/block-style.d.ts +25 -0
  7. package/dist/core/helpers/input-rules.d.ts +8 -1
  8. package/dist/core/helpers/lists.d.ts +10 -2
  9. package/dist/core/helpers/marks.d.ts +14 -0
  10. package/dist/core/helpers/nodes.d.ts +12 -0
  11. package/dist/core/helpers/word-count.d.ts +14 -0
  12. package/dist/core/html/css.d.ts +16 -1
  13. package/dist/core/html/paste/base-styles.d.ts +7 -0
  14. package/dist/core/html/paste/google-docs.d.ts +7 -0
  15. package/dist/core/html/paste/index.d.ts +9 -0
  16. package/dist/core/html/paste/table-widths.d.ts +7 -0
  17. package/dist/core/html/paste/word.d.ts +8 -0
  18. package/dist/core/html/serialize.d.ts +2 -2
  19. package/dist/extensions/code-block/index.d.ts +24 -0
  20. package/dist/extensions/default-extensions/index.d.ts +11 -0
  21. package/dist/extensions/heading/index.d.ts +2 -1
  22. package/dist/extensions/image/image-view.d.ts +27 -0
  23. package/dist/extensions/image/index.d.ts +29 -0
  24. package/dist/extensions/index.d.ts +10 -1
  25. package/dist/extensions/line-height/index.d.ts +18 -0
  26. package/dist/extensions/list-item/index.d.ts +1 -1
  27. package/dist/extensions/paragraph/index.d.ts +4 -4
  28. package/dist/extensions/search/index.d.ts +55 -0
  29. package/dist/extensions/table/index.d.ts +70 -0
  30. package/dist/extensions/task-item/index.d.ts +24 -0
  31. package/dist/extensions/task-item/task-item-view.d.ts +24 -0
  32. package/dist/extensions/task-list/index.d.ts +11 -0
  33. package/dist/extensions/text-align/index.d.ts +18 -0
  34. package/dist/extensions/text-case/index.d.ts +14 -0
  35. package/dist/extensions/text-style/font-size.d.ts +21 -0
  36. package/dist/extensions/text-style/index.d.ts +18 -2
  37. package/dist/index.d.ts +1 -0
  38. package/dist/index.js +1 -1
  39. package/dist/src-CV6pgfTS.js +2662 -0
  40. package/dist/style.css +599 -1
  41. package/dist/ui/components/dropdown.d.ts +9 -0
  42. package/dist/ui/components/find-bar.d.ts +24 -0
  43. package/dist/ui/components/font-size-input.d.ts +21 -0
  44. package/dist/ui/components/icon-menu.d.ts +20 -0
  45. package/dist/ui/components/status-bar.d.ts +19 -0
  46. package/dist/ui/components/table-actions.d.ts +25 -0
  47. package/dist/ui/components/table-handles.d.ts +16 -0
  48. package/dist/ui/components/table-menu.d.ts +21 -0
  49. package/dist/ui/i18n/types.d.ts +1 -1
  50. package/dist/ui/index.d.ts +6 -2
  51. package/dist/ui/toolbar/fonts.d.ts +8 -0
  52. package/dist/ui/toolbar/items.d.ts +23 -2
  53. package/dist/ui/toolbar/types.d.ts +67 -4
  54. package/dist/ui.css +361 -0
  55. package/dist/ui.js +1361 -303
  56. package/package.json +19 -9
  57. package/dist/src-3tAxKI0c.js +0 -1316
package/dist/ui.css CHANGED
@@ -140,6 +140,11 @@
140
140
  background: var(--stilo-color-active);
141
141
  }
142
142
 
143
+ /* The find button while its bar is open (T-043) */
144
+ .stilo-toolbar__button[data-item="find"][aria-expanded="true"] {
145
+ background: var(--stilo-color-active);
146
+ }
147
+
143
148
  .stilo-toolbar__button[aria-disabled="true"] {
144
149
  opacity: 0.4;
145
150
  cursor: default;
@@ -184,13 +189,24 @@
184
189
  width: auto;
185
190
  min-width: 120px;
186
191
  justify-content: space-between;
192
+ gap: 6px;
187
193
  padding: 0 8px;
188
194
  }
189
195
 
196
+ .stilo-dropdown__trigger[data-item="fontFamily"] {
197
+ width: 120px;
198
+ }
199
+
200
+ /* A long value is truncated, the chevron keeps its size */
201
+ .stilo-dropdown__trigger .stilo-icon {
202
+ flex-shrink: 0;
203
+ }
204
+
190
205
  .stilo-dropdown__value {
191
206
  overflow: hidden;
192
207
  text-overflow: ellipsis;
193
208
  white-space: nowrap;
209
+ font-weight: 600;
194
210
  }
195
211
 
196
212
  .stilo-dropdown__menu {
@@ -272,6 +288,87 @@
272
288
  font-weight: 600;
273
289
  }
274
290
 
291
+ /* Font size control: − field + */
292
+ .stilo-font-size {
293
+ display: inline-flex;
294
+ align-items: center;
295
+ gap: var(--stilo-toolbar-gap);
296
+ }
297
+
298
+ .stilo-font-size__input {
299
+ box-sizing: border-box;
300
+ width: 2.5em;
301
+ height: calc(var(--stilo-button-size) - 4px);
302
+ padding: 0 4px;
303
+ border: 1px solid var(--stilo-color-border);
304
+ border-radius: var(--stilo-radius);
305
+ background: var(--stilo-color-bg);
306
+ color: var(--stilo-color-text);
307
+ font-family: var(--stilo-font-family);
308
+ font-size: var(--stilo-font-size);
309
+ text-align: center;
310
+ font-weight: 600;
311
+ }
312
+
313
+ .stilo-font-size__input:focus-visible {
314
+ outline: 2px solid var(--stilo-color-focus);
315
+ outline-offset: -1px;
316
+ }
317
+
318
+ .stilo-font-size__input[aria-invalid="true"] {
319
+ border-color: var(--stilo-color-error);
320
+ }
321
+
322
+ .stilo-font-size__input[aria-disabled="true"] {
323
+ opacity: 0.4;
324
+ }
325
+
326
+ .stilo-font-size__list {
327
+ min-width: 4.5em;
328
+ max-height: 280px;
329
+ overflow-y: auto;
330
+ }
331
+
332
+ .stilo-font-size__option {
333
+ padding: 4px 12px;
334
+ border-radius: var(--stilo-radius);
335
+ cursor: pointer;
336
+ font-family: var(--stilo-font-family);
337
+ font-size: var(--stilo-font-size);
338
+ color: var(--stilo-color-text);
339
+ text-align: center;
340
+ }
341
+
342
+ .stilo-font-size__option:hover,
343
+ .stilo-font-size__option--active {
344
+ background: var(--stilo-color-hover);
345
+ }
346
+
347
+ .stilo-font-size__option[aria-selected="true"] {
348
+ background: var(--stilo-color-active);
349
+ }
350
+
351
+ /* Icon menu (text alignment): the options in a row. An icon dropdown (line spacing) has the same
352
+ trigger. */
353
+ .stilo-icon-menu__trigger,
354
+ .stilo-dropdown__trigger--icon {
355
+ width: auto;
356
+ min-width: var(--stilo-button-size);
357
+ gap: 2px;
358
+ padding: 0 4px;
359
+ }
360
+
361
+ .stilo-icon-menu {
362
+ display: flex;
363
+ gap: var(--stilo-toolbar-gap);
364
+ }
365
+
366
+ .stilo-icon-menu__trigger .stilo-icon:last-child,
367
+ .stilo-dropdown__trigger--icon .stilo-icon:last-child {
368
+ width: 12px;
369
+ height: 12px;
370
+ }
371
+
275
372
  /* Link popover */
276
373
  .stilo-link-popover__form {
277
374
  display: flex;
@@ -462,6 +559,132 @@
462
559
  color: var(--stilo-color-muted);
463
560
  }
464
561
 
562
+ /* Table menu (T-045): insert grid of 10 columns (GRID_COLUMNS in table-menu.ts), operations */
563
+ .stilo-table-menu {
564
+ font-family: var(--stilo-font-family);
565
+ font-size: var(--stilo-font-size);
566
+ color: var(--stilo-color-text);
567
+ }
568
+
569
+ .stilo-table-menu__picker {
570
+ display: flex;
571
+ flex-direction: column;
572
+ gap: 6px;
573
+ padding: 4px;
574
+ }
575
+
576
+ .stilo-table-menu__picker[hidden],
577
+ .stilo-table-menu__actions[hidden] {
578
+ display: none;
579
+ }
580
+
581
+ .stilo-table-menu__grid {
582
+ display: grid;
583
+ grid-template-columns: repeat(10, 18px);
584
+ gap: 3px;
585
+ }
586
+
587
+ .stilo-table-menu__cell {
588
+ width: 18px;
589
+ height: 18px;
590
+ padding: 0;
591
+ border: 1px solid var(--stilo-color-border);
592
+ border-radius: 3px;
593
+ background: var(--stilo-color-bg);
594
+ cursor: pointer;
595
+ }
596
+
597
+ .stilo-table-menu__cell--active {
598
+ border-color: var(--stilo-color-focus);
599
+ background: var(--stilo-color-active);
600
+ }
601
+
602
+ .stilo-table-menu__cell:focus-visible {
603
+ outline: 2px solid var(--stilo-color-focus);
604
+ outline-offset: 1px;
605
+ }
606
+
607
+ .stilo-table-menu__size {
608
+ text-align: center;
609
+ color: var(--stilo-color-muted);
610
+ }
611
+
612
+ .stilo-table-menu__header {
613
+ display: flex;
614
+ align-items: center;
615
+ gap: 6px;
616
+ cursor: pointer;
617
+ }
618
+
619
+ .stilo-table-menu__actions {
620
+ min-width: 200px;
621
+ }
622
+
623
+ .stilo-table-menu__actions .stilo-dropdown__option[aria-checked] {
624
+ background: transparent;
625
+ }
626
+
627
+ .stilo-table-menu__actions .stilo-dropdown__option[aria-checked]:hover,
628
+ .stilo-table-menu__actions .stilo-dropdown__option[aria-checked]:focus-visible {
629
+ background: var(--stilo-color-hover);
630
+ }
631
+
632
+ .stilo-table-menu__actions .stilo-dropdown__option[aria-checked]::after {
633
+ content: "✓";
634
+ margin-left: auto;
635
+ visibility: hidden;
636
+ }
637
+
638
+ .stilo-table-menu__actions .stilo-dropdown__option[aria-checked="true"]::after {
639
+ visibility: visible;
640
+ }
641
+
642
+ /* Table handles (T-049): row, column and corner, over the editor */
643
+ .stilo-table-handle {
644
+ position: absolute;
645
+ top: 0;
646
+ left: 0;
647
+ z-index: var(--stilo-z-popover);
648
+ display: flex;
649
+ align-items: center;
650
+ justify-content: center;
651
+ width: 18px;
652
+ height: 18px;
653
+ padding: 0;
654
+ border: 1px solid var(--stilo-color-border);
655
+ border-radius: var(--stilo-radius);
656
+ background: var(--stilo-color-bg);
657
+ color: var(--stilo-color-muted);
658
+ cursor: pointer;
659
+ }
660
+
661
+ .stilo-table-handle[hidden] {
662
+ display: none;
663
+ }
664
+
665
+ .stilo-table-handle:hover,
666
+ .stilo-table-handle[aria-expanded="true"] {
667
+ border-color: var(--stilo-color-focus);
668
+ color: var(--stilo-color-focus);
669
+ }
670
+
671
+ .stilo-table-handle .stilo-icon {
672
+ width: 14px;
673
+ height: 14px;
674
+ }
675
+
676
+ .stilo-table-handle-menu {
677
+ font-family: var(--stilo-font-family);
678
+ font-size: var(--stilo-font-size);
679
+ color: var(--stilo-color-text);
680
+ }
681
+
682
+ .stilo-table-menu__separator {
683
+ height: 1px;
684
+ margin: 4px 0;
685
+ background: var(--stilo-color-separator);
686
+ }
687
+
465
688
  /* Color split button (T-026): the main part shows the last used color under its icon */
466
689
  .stilo-split {
467
690
  display: flex;
@@ -633,3 +856,141 @@
633
856
  font: inherit;
634
857
  cursor: pointer;
635
858
  }
859
+
860
+ /*
861
+ * Find bar (T-043): a floating panel at the top right, just under the toolbar, over the content
862
+ * (the content does not move). It lives in the toolbar container, so it stays at the top with a
863
+ * sticky toolbar; without `sticky` the container is made a positioned ancestor.
864
+ */
865
+ .stilo-find-bar-host:not(.stilo-toolbar-host) {
866
+ position: relative;
867
+ }
868
+
869
+ .stilo-find-bar {
870
+ position: absolute;
871
+ top: calc(100% + 4px);
872
+ right: 8px;
873
+ /* Under the popovers of the toolbar (character picker, colors, menus), which open over it. */
874
+ z-index: calc(var(--stilo-z-popover) - 1);
875
+ box-sizing: border-box;
876
+ display: flex;
877
+ flex-direction: column;
878
+ gap: 4px;
879
+ max-width: calc(100% - 16px);
880
+ padding: 6px 8px;
881
+ border: 1px solid var(--stilo-color-border);
882
+ border-radius: var(--stilo-radius);
883
+ background: var(--stilo-color-bg);
884
+ box-shadow: var(--stilo-popover-shadow);
885
+ color: var(--stilo-color-text);
886
+ font-family: var(--stilo-font-family);
887
+ font-size: var(--stilo-font-size);
888
+ transition:
889
+ opacity 0.15s ease,
890
+ transform 0.15s ease,
891
+ display 0.15s allow-discrete;
892
+ }
893
+
894
+ /* Slides in from above; browsers without @starting-style show it at once. */
895
+ @starting-style {
896
+ .stilo-find-bar {
897
+ opacity: 0;
898
+ transform: translateY(-6px);
899
+ }
900
+ }
901
+
902
+ @media (prefers-reduced-motion: reduce) {
903
+ .stilo-find-bar {
904
+ transition: none;
905
+ }
906
+ }
907
+
908
+ .stilo-find-bar__row {
909
+ display: flex;
910
+ align-items: center;
911
+ gap: 4px;
912
+ }
913
+
914
+ .stilo-find-bar[hidden] {
915
+ display: none;
916
+ opacity: 0;
917
+ transform: translateY(-6px);
918
+ }
919
+
920
+ .stilo-find-bar__row[hidden] {
921
+ display: none;
922
+ }
923
+
924
+ .stilo-find-bar__input {
925
+ box-sizing: border-box;
926
+ width: 200px;
927
+ min-width: 0;
928
+ flex: 1 1 auto;
929
+ padding: 4px 8px;
930
+ border: 1px solid var(--stilo-color-border);
931
+ border-radius: var(--stilo-radius);
932
+ background: var(--stilo-color-bg);
933
+ color: inherit;
934
+ font: inherit;
935
+ }
936
+
937
+ .stilo-find-bar__input:focus-visible {
938
+ outline: 2px solid var(--stilo-color-focus);
939
+ outline-offset: -1px;
940
+ }
941
+
942
+ .stilo-find-bar__count {
943
+ min-width: 7em;
944
+ color: var(--stilo-color-muted);
945
+ font-size: 0.9em;
946
+ white-space: nowrap;
947
+ }
948
+
949
+ .stilo-find-bar__button {
950
+ display: flex;
951
+ align-items: center;
952
+ justify-content: center;
953
+ min-width: 28px;
954
+ height: 28px;
955
+ padding: 0;
956
+ border: none;
957
+ border-radius: var(--stilo-radius);
958
+ background: transparent;
959
+ color: inherit;
960
+ cursor: pointer;
961
+ font: inherit;
962
+ }
963
+
964
+ .stilo-find-bar__button:hover {
965
+ background: var(--stilo-color-hover);
966
+ }
967
+
968
+ .stilo-find-bar__button:focus-visible {
969
+ outline: 2px solid var(--stilo-color-focus);
970
+ outline-offset: 1px;
971
+ }
972
+
973
+ .stilo-find-bar__toggle[aria-pressed="true"] {
974
+ background: var(--stilo-color-active);
975
+ }
976
+
977
+ .stilo-find-bar__button--text {
978
+ padding: 0 10px;
979
+ white-space: nowrap;
980
+ border: 1px solid var(--stilo-color-border);
981
+ background: var(--stilo-color-bg);
982
+ }
983
+
984
+ /* Status bar (T-043): word and character count under the editor */
985
+ .stilo-status-bar {
986
+ display: flex;
987
+ gap: 16px;
988
+ padding: 4px 12px;
989
+ border-top: 1px solid var(--stilo-color-separator);
990
+ border-bottom-left-radius: inherit;
991
+ border-bottom-right-radius: inherit;
992
+ background: var(--stilo-color-toolbar-bg);
993
+ color: var(--stilo-color-muted);
994
+ font-family: var(--stilo-font-family);
995
+ font-size: 12px;
996
+ }