@fuzdev/fuz_code 0.46.2 → 0.46.3
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/CodeTextarea.svelte +28 -42
- package/package.json +1 -1
package/dist/CodeTextarea.svelte
CHANGED
|
@@ -96,61 +96,47 @@
|
|
|
96
96
|
<style>
|
|
97
97
|
.code_textarea {
|
|
98
98
|
position: relative;
|
|
99
|
-
width: 100%;
|
|
100
99
|
}
|
|
101
100
|
|
|
102
|
-
/*
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
/* The textarea keeps fuz_css's native textarea styling — padding, border (with
|
|
102
|
+
its hover/focus) and the page-inherited font size and tab size. Only the
|
|
103
|
+
overlay deltas are set: transparent text/background so the backdrop shows
|
|
104
|
+
through, a mono font, a visible caret (the text itself is transparent), and
|
|
105
|
+
`line-height: inherit` to undo the `line-height: normal` fuz_css forces on
|
|
106
|
+
inputs, so it tracks the page and matches the backdrop. */
|
|
107
107
|
.code_textarea textarea {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
margin: 0;
|
|
111
|
-
width: 100%;
|
|
112
|
-
/* fuz_css pads the textarea but not `pre` — pin both the same */
|
|
113
|
-
padding: var(--space_xs3) var(--space_xs);
|
|
114
|
-
/* fuz_css borders the textarea but not `pre`; a transparent border on both
|
|
115
|
-
keeps the box metrics identical (the textarea's is colored below) */
|
|
116
|
-
border: 1px solid transparent;
|
|
117
|
-
border-radius: var(--radius_xs, 2px);
|
|
118
|
-
/* the textarea would otherwise inherit the page's proportional font and
|
|
119
|
-
`line-height: normal`; the backdrop `pre` is already mono */
|
|
108
|
+
position: relative;
|
|
109
|
+
z-index: 1;
|
|
120
110
|
font-family: var(--font_family_mono);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
white-space: pre-wrap;
|
|
126
|
-
overflow-wrap: break-word;
|
|
127
|
-
overflow: auto;
|
|
128
|
-
/* reserve gutter on both layers so the textarea's scrollbar doesn't shrink
|
|
129
|
-
its wrap width relative to the backdrop, which would drift highlights */
|
|
130
|
-
scrollbar-gutter: stable;
|
|
111
|
+
line-height: inherit;
|
|
112
|
+
background-color: transparent;
|
|
113
|
+
color: transparent;
|
|
114
|
+
caret-color: var(--text_color);
|
|
131
115
|
}
|
|
132
116
|
|
|
133
|
-
/*
|
|
134
|
-
|
|
135
|
-
|
|
117
|
+
/* The backdrop `pre` holds the highlighted text under the transparent textarea.
|
|
118
|
+
It's pulled out of flow so the textarea sizes the box; `inset: 0` fills and
|
|
119
|
+
clips it to that box (scroll-synced in JS). It mirrors the textarea's fuz_css
|
|
120
|
+
box — the same padding and border width — and overrides what fuz_css sets
|
|
121
|
+
differently on a `pre`: `white-space: pre`, and the flow margin that would
|
|
122
|
+
otherwise shrink this absolute box. */
|
|
136
123
|
.code_textarea_backdrop {
|
|
137
124
|
position: absolute;
|
|
138
125
|
inset: 0;
|
|
126
|
+
margin: 0;
|
|
127
|
+
padding: var(--space_sm) var(--space_lg); /* fuz_css's textarea padding */
|
|
128
|
+
border: var(--border_width) var(--border_style) transparent;
|
|
129
|
+
white-space: pre-wrap;
|
|
130
|
+
overflow: hidden;
|
|
139
131
|
pointer-events: none;
|
|
140
132
|
user-select: none;
|
|
141
|
-
overflow: hidden;
|
|
142
133
|
}
|
|
143
134
|
|
|
135
|
+
/* both layers reserve a scrollbar gutter so the textarea's scrollbar can't
|
|
136
|
+
shrink its wrap width relative to the non-scrolling backdrop and drift the
|
|
137
|
+
highlights */
|
|
138
|
+
.code_textarea_backdrop,
|
|
144
139
|
.code_textarea textarea {
|
|
145
|
-
|
|
146
|
-
textarea is the only in-flow layer, so it sizes the container */
|
|
147
|
-
position: relative;
|
|
148
|
-
z-index: 1;
|
|
149
|
-
/* the textarea's own text is invisible; the backdrop (a styled `pre`) shows
|
|
150
|
-
through, so restore a visible caret and border over the transparent ones */
|
|
151
|
-
background-color: transparent;
|
|
152
|
-
color: transparent;
|
|
153
|
-
caret-color: var(--text_color);
|
|
154
|
-
border-color: var(--border_color);
|
|
140
|
+
scrollbar-gutter: stable;
|
|
155
141
|
}
|
|
156
142
|
</style>
|