@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.
@@ -96,61 +96,47 @@
96
96
  <style>
97
97
  .code_textarea {
98
98
  position: relative;
99
- width: 100%;
100
99
  }
101
100
 
102
- /* Metrics shared by both layers so characters align exactly. fuz_css styles
103
- `pre` and `textarea` differently, so each declaration here equalizes them;
104
- anything fuz_css already applies identically (box-sizing, the reset margin,
105
- colors) is left to it. */
106
- .code_textarea_backdrop,
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
- /* the backdrop `pre` isn't the last child, so fuz_css's flow rule would give
109
- it a bottom margin that shrinks its absolute box and drifts the last line */
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
- font-size: var(--font_size_sm);
122
- line-height: var(--line_height_md);
123
- tab-size: 2;
124
- /* fuz_css sets `pre` to `white-space: pre`; both must wrap to stay aligned */
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
- /* the backdrop is taken out of flow so the in-flow textarea (its `rows`/resize)
134
- defines the box; `inset: 0` makes the backdrop fill and clip to that box,
135
- scrolled programmatically to match the textarea */
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
- /* sits above the backdrop so the caret and selection are visible; the
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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzdev/fuz_code",
3
- "version": "0.46.2",
3
+ "version": "0.46.3",
4
4
  "description": "syntax styling utilities and components for TypeScript, Svelte, Markdown, and more",
5
5
  "glyph": "🎨",
6
6
  "logo": "logo.svg",