@fuzdev/fuz_code 0.46.1 → 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,54 +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 */
103
- .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. */
104
107
  .code_textarea textarea {
105
- margin: 0;
106
- box-sizing: border-box;
107
- width: 100%;
108
- padding: var(--space_xs3) var(--space_xs);
109
- border: 1px solid transparent;
110
- border-radius: var(--radius_xs, 2px);
111
- font-family: var(--font_family_mono, monospace);
112
- font-size: var(--font_size_sm, 0.9rem);
113
- line-height: var(--line_height_md, 1.5);
114
- letter-spacing: inherit;
115
- tab-size: 2;
116
- white-space: pre-wrap;
117
- overflow-wrap: break-word;
118
- overflow: auto;
119
- /* reserve gutter on both layers so the textarea's scrollbar doesn't shrink
120
- its wrap width relative to the backdrop, which would drift highlights */
121
- scrollbar-gutter: stable;
108
+ position: relative;
109
+ z-index: 1;
110
+ font-family: var(--font_family_mono);
111
+ line-height: inherit;
112
+ background-color: transparent;
113
+ color: transparent;
114
+ caret-color: var(--text_color);
122
115
  }
123
116
 
124
- /* the backdrop is taken out of flow so the in-flow textarea (its `rows`/resize)
125
- defines the box; `inset: 0` makes the backdrop fill and clip to that box,
126
- 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. */
127
123
  .code_textarea_backdrop {
128
124
  position: absolute;
129
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;
130
131
  pointer-events: none;
131
132
  user-select: none;
132
- overflow: hidden;
133
- color: var(--text_color, currentColor);
134
133
  }
135
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,
136
139
  .code_textarea textarea {
137
- /* sits above the backdrop so the caret and selection are visible; the
138
- textarea is the only in-flow layer, so it sizes the container */
139
- position: relative;
140
- z-index: 1;
141
- display: block;
142
- background-color: transparent;
143
- /* the textarea's own text is invisible; the backdrop shows through */
144
- color: transparent;
145
- caret-color: var(--text_color, currentColor);
146
- border-color: var(--border_color, currentColor);
147
- resize: vertical;
140
+ scrollbar-gutter: stable;
148
141
  }
149
142
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzdev/fuz_code",
3
- "version": "0.46.1",
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",
@@ -56,7 +56,7 @@
56
56
  "@changesets/changelog-git": "^0.2.1",
57
57
  "@fuzdev/blake3_wasm": "^0.1.1",
58
58
  "@fuzdev/fuz_css": "^0.63.2",
59
- "@fuzdev/fuz_ui": "^0.205.0",
59
+ "@fuzdev/fuz_ui": "^0.205.1",
60
60
  "@fuzdev/fuz_util": "^0.65.1",
61
61
  "@fuzdev/gro": "^0.204.0",
62
62
  "@fuzdev/mdz": "^0.1.0",