mnfst 0.5.230 → 0.5.232

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.
@@ -1,75 +1,71 @@
1
- /* Manifest Text Edit */
1
+ /* Manifest Rich Text */
2
2
 
3
3
  @layer base, components, utilities;
4
4
 
5
- /* Self-contained. The editable area is a field first — it borrows the tokens inputs
6
- and textareas use, so it sits in a form without looking bolted on. Controls are
7
- styled where they are, not by where they sit, because they can be anywhere. */
8
-
9
5
  @layer components {
10
6
 
11
- :where([data-text-edit]) {
7
+ :where([data-rich-text]:not([data-edit-text])) {
12
8
  position: relative;
13
9
  overflow-y: auto;
14
- max-height: var(--text-edit-max-height, none);
10
+ max-height: var(--rich-text-max-height, none);
15
11
  outline: none;
16
12
 
17
- /* Page-level styling — set by .page controls, read back by $text.page.
18
- Presentation, so it lives here rather than inside the stored markup. */
19
- font-family: var(--text-edit-font, inherit);
20
- font-size: var(--text-edit-size, inherit);
21
- line-height: var(--text-edit-leading, inherit);
22
- text-align: var(--text-edit-align, start);
23
- color: var(--text-edit-color, inherit);
24
-
25
- /* Flagged from script: :empty never matches the <br> a contenteditable
26
- keeps, and the tag holding it is not predictable after a wipe. The
27
- placeholder OVERLAYS the first line (it is not a line of its own), so
28
- the caret sits on top of it and nothing jumps when typing starts. */
29
- &[data-text-edit-empty]::before {
13
+ /* Document-wide styles (.all controls, $rich.all) */
14
+ font-family: var(--rich-text-font, inherit);
15
+ font-size: var(--rich-text-size, inherit);
16
+ line-height: var(--rich-text-leading, inherit);
17
+ text-align: var(--rich-text-align, start);
18
+ color: var(--rich-text-color, inherit);
19
+
20
+ /* Placeholder overlays the first line */
21
+ &[data-rich-text-empty]::before {
30
22
  content: attr(placeholder);
31
23
  position: absolute;
32
- inset-block-start: var(--text-edit-padding, 0.75rem);
33
- inset-inline: var(--text-edit-padding, 0.75rem);
24
+ inset-block-start: var(--rich-text-padding, 0.75rem);
25
+ inset-inline: var(--rich-text-padding, 0.75rem);
34
26
  color: var(--color-content-subtle);
35
27
  pointer-events: none;
36
28
  }
37
29
  }
38
30
 
39
- /* An unstyled area has no field padding, so its placeholder hugs the line. */
40
- :where([data-text-edit].unstyle)[data-text-edit-empty]::before {
31
+ /* .all background on an unstyled area */
32
+ :where([data-rich-text].unstyle[style*="--rich-text-background"]) {
33
+ background: var(--rich-text-background);
34
+ }
35
+
36
+ /* Unstyled: placeholder hugs the line */
37
+ :where([data-rich-text].unstyle)[data-rich-text-empty]::before {
41
38
  inset-block-start: 0;
42
39
  inset-inline: 0;
43
40
  }
44
41
 
45
- /* The FIELD look. `.unstyle` drops it so an area can sit seamlessly in a
46
- page — a WYSIWYG document inherits its element's own type and colours;
47
- everything above (caret custody, placeholder, commands) still works. */
48
- :where([data-text-edit]:not(.unstyle)) {
49
- min-height: var(--text-edit-min-height, 8rem);
50
- padding: var(--text-edit-padding, 0.75rem);
51
- background: var(--text-edit-background, var(--color-surface-1));
42
+ /* Field look; .unstyle drops it */
43
+ :where([data-rich-text]:not(.unstyle, [data-edit-text])) {
44
+ min-height: var(--rich-text-min-height, 8rem);
45
+ padding: var(--rich-text-padding, 0.75rem);
46
+ background: var(--rich-text-background, var(--color-surface-1));
52
47
  border: 1px solid var(--color-line);
53
48
  border-radius: var(--radius);
54
49
 
55
- /* Held while the area owns the editing session — a <select> or colour
56
- control takes NATIVE focus by design, and the ring must not flicker
57
- off while the writer is mid-command. */
50
+ /* Held while a focus-taking control acts on the area */
58
51
  &:focus,
59
- &[data-text-edit-focused] {
52
+ &[data-rich-text-focused] {
60
53
  border-color: var(--color-content-subtle);
61
54
  }
62
55
  }
63
56
 
64
- /* ---- Selection menu (x-text-edit-menu) ----
65
- Positioned by the --text-edit-selection-* variables the plugin writes to
66
- :root, so the default needs no script; restyle or reposition freely. */
67
- :where([data-text-edit-menu]) {
57
+ /* Single-line (.inline) */
58
+ :where([data-rich-text-inline]:not(.unstyle, [data-edit-text])) {
59
+ min-height: var(--rich-text-min-height, auto);
60
+ }
61
+
62
+ /* ---- Selection menu (x-rich-text-menu) ---- */
63
+ :where([data-rich-text-menu]) {
68
64
  position: fixed;
69
65
  margin: 0;
70
66
  inset: auto;
71
- left: var(--text-edit-selection-center);
72
- top: var(--text-edit-selection-y);
67
+ left: var(--rich-text-selection-center);
68
+ top: var(--rich-text-selection-y);
73
69
  transform: translate(-50%, calc(-100% - 0.5rem));
74
70
  gap: 0.25rem;
75
71
  align-items: center;
@@ -80,27 +76,21 @@
80
76
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.2);
81
77
  }
82
78
 
83
- /* display only while OPEN: an author display on the base rule would beat
84
- the UA's closed-popover display:none, leaving the menu floating fixed
85
- over the page before any selection exists. */
86
- :where([data-text-edit-menu]:popover-open) {
79
+ /* Display only while open */
80
+ :where([data-rich-text-menu]:popover-open) {
87
81
  display: flex;
88
82
  }
89
83
 
90
- /* Without the Popover API the attribute is inert and the menu would render
91
- permanently fixed on the page — hide it there; the bubble is progressive
92
- enhancement. (In supporting browsers a closed popover is hidden natively.) */
84
+ /* No Popover API: hidden */
93
85
  @supports not selector(:popover-open) {
94
- :where([data-text-edit-menu]) {
86
+ :where([data-rich-text-menu]) {
95
87
  display: none;
96
88
  }
97
89
  }
98
90
 
99
- /* ---- Controls ----
100
- A control is marked wherever it lives, so a toolbar is optional markup and
101
- never a requirement. The reset already dims [aria-disabled=true]. */
102
- :where([data-text-edit-control]) {
103
- &[data-text-edit-active] {
91
+ /* ---- Controls ---- */
92
+ :where([data-rich-text-control]) {
93
+ &[data-rich-text-active] {
104
94
  background: color-mix(in oklch, var(--color-content-stark) 10%, transparent);
105
95
  color: var(--color-content-stark);
106
96
  }
@@ -111,15 +101,19 @@
111
101
  }
112
102
  }
113
103
 
114
- :where(button[data-text-edit-control]) {
104
+ /* Icon-only buttons */
105
+ :where(button[data-rich-text-control]:has(> svg:only-child)) {
115
106
  padding: 0.35rem;
116
107
  line-height: 0;
117
108
  }
118
109
 
119
- /* ---- Editable content ----
120
- The editor authors real block elements, so style them as elements. Deliberately
121
- lighter than the .prose class, which sets a reading measure this field can't use. */
122
- :where([data-text-edit]) {
110
+ /* Disabled controls still catch the click, so the area keeps focus */
111
+ :where([data-rich-text-control][aria-disabled=true]) {
112
+ pointer-events: auto;
113
+ }
114
+
115
+ /* ---- Editable content ---- */
116
+ :where([data-rich-text]:not([data-edit-text])) {
123
117
 
124
118
  & > * + * {
125
119
  margin-block-start: 0.75em;
@@ -197,21 +191,19 @@
197
191
  }
198
192
  }
199
193
 
200
- /* A block selection across cells. The browser can only highlight text, so an
201
- empty cell shows nothing — this is what makes a spreadsheet-style
202
- selection visible. */
203
- & :where(td, th)[data-text-edit-cell] {
194
+ /* Cell block selection */
195
+ & :where(td, th)[data-rich-text-cell] {
204
196
  background: color-mix(in oklch, var(--color-brand-content) 18%, transparent);
205
197
  }
206
198
 
207
- /* Borders read as grabbable only when the pointer is on one */
208
- &[data-text-edit-border="x"] { cursor: col-resize }
209
- &[data-text-edit-border="y"] { cursor: row-resize }
210
- &[data-text-edit-resizing] { user-select: none }
211
- &[data-text-edit-resizing="x"] { cursor: col-resize }
212
- &[data-text-edit-resizing="y"] { cursor: row-resize }
199
+ /* Table border resizing */
200
+ &[data-rich-text-border="x"] { cursor: col-resize }
201
+ &[data-rich-text-border="y"] { cursor: row-resize }
202
+ &[data-rich-text-resizing] { user-select: none }
203
+ &[data-rich-text-resizing="x"] { cursor: col-resize }
204
+ &[data-rich-text-resizing="y"] { cursor: row-resize }
213
205
 
214
- /* Task lists — the checkbox replaces the marker */
206
+ /* Task lists */
215
207
  & :where(ul[data-checklist]) {
216
208
  padding-inline-start: 0.25em;
217
209
  list-style: none;