@react-x11/components 0.13.0 → 0.14.0
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/html/controls.d.ts +29 -2
- package/dist/html/controls.d.ts.map +1 -1
- package/dist/html/controls.js +70 -2
- package/dist/html/controls.js.map +1 -1
- package/dist/html/css/cascade.d.ts.map +1 -1
- package/dist/html/css/cascade.js +26 -4
- package/dist/html/css/cascade.js.map +1 -1
- package/dist/html/css/color.d.ts +18 -0
- package/dist/html/css/color.d.ts.map +1 -1
- package/dist/html/css/color.js +27 -0
- package/dist/html/css/color.js.map +1 -1
- package/dist/html/css/parse.d.ts +18 -4
- package/dist/html/css/parse.d.ts.map +1 -1
- package/dist/html/css/parse.js +66 -28
- package/dist/html/css/parse.js.map +1 -1
- package/dist/html/css/style.d.ts +128 -15
- package/dist/html/css/style.d.ts.map +1 -1
- package/dist/html/css/style.js +561 -144
- package/dist/html/css/style.js.map +1 -1
- package/dist/html/css/transform.d.ts +85 -0
- package/dist/html/css/transform.d.ts.map +1 -0
- package/dist/html/css/transform.js +425 -0
- package/dist/html/css/transform.js.map +1 -0
- package/dist/html/css/ua.d.ts.map +1 -1
- package/dist/html/css/ua.js +14 -2
- package/dist/html/css/ua.js.map +1 -1
- package/dist/html/css/values.d.ts +4 -0
- package/dist/html/css/values.d.ts.map +1 -1
- package/dist/html/css/values.js.map +1 -1
- package/dist/html/fonts.d.ts +55 -5
- package/dist/html/fonts.d.ts.map +1 -1
- package/dist/html/fonts.js +284 -23
- package/dist/html/fonts.js.map +1 -1
- package/dist/html/layout/axes.d.ts +14 -0
- package/dist/html/layout/axes.d.ts.map +1 -0
- package/dist/html/layout/axes.js +28 -0
- package/dist/html/layout/axes.js.map +1 -0
- package/dist/html/layout/block.d.ts +93 -12
- package/dist/html/layout/block.d.ts.map +1 -1
- package/dist/html/layout/block.js +389 -39
- package/dist/html/layout/block.js.map +1 -1
- package/dist/html/layout/boxes.d.ts +59 -1
- package/dist/html/layout/boxes.d.ts.map +1 -1
- package/dist/html/layout/boxes.js +22 -2
- package/dist/html/layout/boxes.js.map +1 -1
- package/dist/html/layout/cache.d.ts +1 -1
- package/dist/html/layout/cache.d.ts.map +1 -1
- package/dist/html/layout/cache.js +6 -0
- package/dist/html/layout/cache.js.map +1 -1
- package/dist/html/layout/css-grid.d.ts.map +1 -1
- package/dist/html/layout/css-grid.js +90 -18
- package/dist/html/layout/css-grid.js.map +1 -1
- package/dist/html/layout/flex.d.ts.map +1 -1
- package/dist/html/layout/flex.js +570 -83
- package/dist/html/layout/flex.js.map +1 -1
- package/dist/html/layout/inline.d.ts +3 -0
- package/dist/html/layout/inline.d.ts.map +1 -1
- package/dist/html/layout/inline.js +144 -54
- package/dist/html/layout/inline.js.map +1 -1
- package/dist/html/layout/multicol.d.ts +42 -0
- package/dist/html/layout/multicol.d.ts.map +1 -0
- package/dist/html/layout/multicol.js +897 -0
- package/dist/html/layout/multicol.js.map +1 -0
- package/dist/html/layout/shaping.d.ts +7 -0
- package/dist/html/layout/shaping.d.ts.map +1 -1
- package/dist/html/layout/shaping.js +25 -20
- package/dist/html/layout/shaping.js.map +1 -1
- package/dist/html/layout/table.d.ts.map +1 -1
- package/dist/html/layout/table.js +62 -18
- package/dist/html/layout/table.js.map +1 -1
- package/dist/html/node.d.ts +3 -0
- package/dist/html/node.d.ts.map +1 -1
- package/dist/html/node.js +263 -36
- package/dist/html/node.js.map +1 -1
- package/dist/html/paint.d.ts +79 -4
- package/dist/html/paint.d.ts.map +1 -1
- package/dist/html/paint.js +1213 -141
- package/dist/html/paint.js.map +1 -1
- package/dist/html/svg.d.ts +15 -2
- package/dist/html/svg.d.ts.map +1 -1
- package/dist/html/svg.js +249 -17
- package/dist/html/svg.js.map +1 -1
- package/dist/html/widgets.js +87 -7
- package/dist/html/widgets.js.map +1 -1
- package/dist/html/woff2.d.ts +14 -0
- package/dist/html/woff2.d.ts.map +1 -0
- package/dist/html/woff2.js +608 -0
- package/dist/html/woff2.js.map +1 -0
- package/dist/maps/controller.d.ts +17 -1
- package/dist/maps/controller.d.ts.map +1 -1
- package/dist/maps/controller.js +27 -7
- package/dist/maps/controller.js.map +1 -1
- package/dist/richtext/node.d.ts +8 -1
- package/dist/richtext/node.d.ts.map +1 -1
- package/dist/richtext/node.js +5 -1
- package/dist/richtext/node.js.map +1 -1
- package/dist/richtext/runs.d.ts +25 -6
- package/dist/richtext/runs.d.ts.map +1 -1
- package/dist/richtext/runs.js +240 -24
- package/dist/richtext/runs.js.map +1 -1
- package/package.json +1 -1
- package/src/html/controls.ts +85 -2
- package/src/html/css/cascade.ts +23 -0
- package/src/html/css/color.ts +29 -0
- package/src/html/css/parse.ts +71 -31
- package/src/html/css/style.ts +664 -147
- package/src/html/css/transform.ts +459 -0
- package/src/html/css/ua.ts +15 -2
- package/src/html/css/values.ts +4 -0
- package/src/html/fonts.ts +312 -29
- package/src/html/layout/axes.ts +62 -0
- package/src/html/layout/block.ts +444 -37
- package/src/html/layout/boxes.ts +65 -3
- package/src/html/layout/cache.ts +6 -0
- package/src/html/layout/css-grid.ts +95 -22
- package/src/html/layout/flex.ts +671 -77
- package/src/html/layout/inline.ts +149 -55
- package/src/html/layout/multicol.ts +977 -0
- package/src/html/layout/shaping.ts +27 -18
- package/src/html/layout/table.ts +62 -19
- package/src/html/node.ts +300 -37
- package/src/html/paint.ts +1406 -206
- package/src/html/svg.ts +277 -19
- package/src/html/widgets.ts +95 -9
- package/src/html/woff2.ts +612 -0
- package/src/maps/controller.ts +28 -7
- package/src/richtext/node.ts +13 -2
- package/src/richtext/runs.ts +313 -35
package/dist/richtext/runs.js
CHANGED
|
@@ -92,60 +92,203 @@ export function paintRunBackgrounds(ctx, line, dx, dy, scale = 1) {
|
|
|
92
92
|
* is one logical pixel thick — `scale` device pixels, so a link on a 2x
|
|
93
93
|
* panel is underlined as heavily as on a 1x one, not with a hairline —
|
|
94
94
|
* and an underline two below the baseline, where the run sets neither
|
|
95
|
-
* (`underlineThickness`, `underlineOffset`, in device pixels by now).
|
|
95
|
+
* (`underlineThickness`, `underlineOffset`, in device pixels by now). A
|
|
96
|
+
* line through is a logical pixel as well where the run names no
|
|
97
|
+
* `strikeThickness`, and is drawn where its face puts it (`strikeTop`).
|
|
96
98
|
* `rules` picks a pass: CSS draws an underline under the glyphs and a
|
|
97
99
|
* line through over them (CSS 2.1 Appendix E), which is two passes around
|
|
98
|
-
* the glyphs'; drawn in one, both go over.
|
|
100
|
+
* the glyphs'; drawn in one, both go over.
|
|
101
|
+
*
|
|
102
|
+
* A rule is drawn a stretch at a time and not a run: a layout hands
|
|
103
|
+
* back a run a word, and a pattern begun again under each — dots spread
|
|
104
|
+
* from one end of their rule to the other, above all — is a pattern with
|
|
105
|
+
* a seam at every space. Runs that touch and draw the same rule share
|
|
106
|
+
* one. */
|
|
99
107
|
export function paintRunRules(ctx, line, dx, dy, scale = 1, rules = 'all') {
|
|
100
108
|
const t = ruleThickness(scale);
|
|
109
|
+
if (rules !== 'over') {
|
|
110
|
+
// the stretch being gathered: the span whose rule it is, and its ends
|
|
111
|
+
let ruled = null;
|
|
112
|
+
let from = 0;
|
|
113
|
+
let to = 0;
|
|
114
|
+
for (const r of line.runs) {
|
|
115
|
+
const span = r.span;
|
|
116
|
+
if (!span?.underline)
|
|
117
|
+
continue;
|
|
118
|
+
const end = r.x + r.width;
|
|
119
|
+
if (ruled &&
|
|
120
|
+
// on either side: a right-to-left stretch's runs come last first
|
|
121
|
+
(Math.abs(r.x - to) <= 0.5 || Math.abs(end - from) <= 0.5) &&
|
|
122
|
+
sameRule(ruled, span)) {
|
|
123
|
+
from = Math.min(from, r.x);
|
|
124
|
+
to = Math.max(to, end);
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if (ruled)
|
|
128
|
+
stretchRule(ctx, ruled, line, dx + from, dx + to, dy, t);
|
|
129
|
+
ruled = span;
|
|
130
|
+
from = r.x;
|
|
131
|
+
to = end;
|
|
132
|
+
}
|
|
133
|
+
if (ruled)
|
|
134
|
+
stretchRule(ctx, ruled, line, dx + from, dx + to, dy, t);
|
|
135
|
+
}
|
|
136
|
+
if (rules === 'under')
|
|
137
|
+
return;
|
|
138
|
+
// A line through, gathered the same way, and ended as well where the
|
|
139
|
+
// font size changes: it is drawn across each size where that size has
|
|
140
|
+
// it (`strikeTop`). The faces of one size are one stretch, at the height
|
|
141
|
+
// they have it between them — a word the face has no glyphs for is set
|
|
142
|
+
// in another, and the rule does not step for it.
|
|
143
|
+
let struck = null;
|
|
144
|
+
let size;
|
|
145
|
+
let from = 0;
|
|
146
|
+
let to = 0;
|
|
147
|
+
// the stretch's ascent: its first run's, and its runs' by how much of
|
|
148
|
+
// the stretch each sets, which is read only where they are not all the
|
|
149
|
+
// first's
|
|
150
|
+
let ascent = 0;
|
|
151
|
+
let summed = 0;
|
|
152
|
+
let widths = 0;
|
|
153
|
+
let mixed = false;
|
|
101
154
|
for (const r of line.runs) {
|
|
102
155
|
const span = r.span;
|
|
103
|
-
if (!span)
|
|
156
|
+
if (!span?.strike)
|
|
157
|
+
continue;
|
|
158
|
+
const own = inkExtent(r, line).ascent;
|
|
159
|
+
const end = r.x + r.width;
|
|
160
|
+
if (struck &&
|
|
161
|
+
r.run?.size === size &&
|
|
162
|
+
(Math.abs(r.x - to) <= 0.5 || Math.abs(end - from) <= 0.5) &&
|
|
163
|
+
sameStrike(struck, span)) {
|
|
164
|
+
from = Math.min(from, r.x);
|
|
165
|
+
to = Math.max(to, end);
|
|
166
|
+
summed += own * r.width;
|
|
167
|
+
widths += r.width;
|
|
168
|
+
if (own !== ascent)
|
|
169
|
+
mixed = true;
|
|
104
170
|
continue;
|
|
105
|
-
const underline = rules !== 'over' ? span.underline : undefined;
|
|
106
|
-
const strike = rules !== 'under' ? span.strike : undefined;
|
|
107
|
-
if (underline) {
|
|
108
|
-
ctx.fillStyle = underline;
|
|
109
|
-
underlineRule(ctx, Math.round(dx + line.x + r.x), Math.round(dy + line.baseline + (span.underlineOffset ?? 2 * t)), Math.ceil(r.width), span.underlineStyle ?? 'single', span.underlineThickness === undefined
|
|
110
|
-
? t
|
|
111
|
-
: Math.max(1, Math.round(span.underlineThickness)));
|
|
112
171
|
}
|
|
113
|
-
if (
|
|
114
|
-
const
|
|
115
|
-
ctx
|
|
116
|
-
ctx.fillRect(Math.round(dx + line.x + r.x), Math.round(dy + line.baseline - m.ascent * 0.38), Math.ceil(r.width), t);
|
|
172
|
+
if (struck) {
|
|
173
|
+
const mean = mixed && widths > 0 ? summed / widths : ascent;
|
|
174
|
+
strikeRule(ctx, struck, line, dx + from, dx + to, dy, mean, t);
|
|
117
175
|
}
|
|
176
|
+
struck = span;
|
|
177
|
+
size = r.run?.size;
|
|
178
|
+
from = r.x;
|
|
179
|
+
to = end;
|
|
180
|
+
ascent = own;
|
|
181
|
+
summed = own * r.width;
|
|
182
|
+
widths = r.width;
|
|
183
|
+
mixed = false;
|
|
184
|
+
}
|
|
185
|
+
if (struck) {
|
|
186
|
+
const mean = mixed && widths > 0 ? summed / widths : ascent;
|
|
187
|
+
strikeRule(ctx, struck, line, dx + from, dx + to, dy, mean, t);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/** The underline of a stretch of a line, from `from` to `to` of it, as
|
|
191
|
+
* `span` has it; `t` is the thickness of a rule that names none. */
|
|
192
|
+
function stretchRule(ctx, span, line, from, to, dy, t) {
|
|
193
|
+
const left = Math.round(line.x + from);
|
|
194
|
+
ctx.fillStyle = span.underline;
|
|
195
|
+
underlineRule(ctx, left, Math.round(dy + line.baseline + (span.underlineOffset ?? 2 * t)), Math.ceil(line.x + to - left), span.underlineStyle ?? 'single', span.underlineThickness === undefined
|
|
196
|
+
? t
|
|
197
|
+
: Math.max(1, Math.round(span.underlineThickness)), t);
|
|
198
|
+
}
|
|
199
|
+
/** How thick a run's line through is: what it says, on whole pixels, or
|
|
200
|
+
* `t`, a rule's own thickness. */
|
|
201
|
+
function strikeThickness(span, t) {
|
|
202
|
+
return span.strikeThickness === undefined
|
|
203
|
+
? t
|
|
204
|
+
: Math.max(1, Math.round(span.strikeThickness));
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Where the top of a line through is, across text whose faces' ascent is
|
|
208
|
+
* `ascent`. Through the middle of the letters with no ascender, which a
|
|
209
|
+
* face does not say the height of in a way both text engines report: a
|
|
210
|
+
* third of its ascent above the baseline, where Blink has it, and the
|
|
211
|
+
* rule's middle there, so that a thick one grows both ways from where a
|
|
212
|
+
* thin one is. The ascent is the text's own, and not that of the font the
|
|
213
|
+
* rule was set in: a line through is worked out again across text of
|
|
214
|
+
* another font size, from the metrics of the fonts that size is set in,
|
|
215
|
+
* so that the text is still crossed out (CSS Text Decoration 4, 2.5), and
|
|
216
|
+
* is not held to the one position an underline is (2.9). Blink measures
|
|
217
|
+
* the ascent of the font the rule was set in from the top of the text it
|
|
218
|
+
* crosses, which puts it near the top of larger text and under smaller.
|
|
219
|
+
* The curl is two levels and straddles the middle; a double rule's first
|
|
220
|
+
* line is the single one's, and its second under it, as Blink draws it.
|
|
221
|
+
*
|
|
222
|
+
* A run that names no thickness keeps the pixel it always had: the rule's
|
|
223
|
+
* top 38% of the ascent up, which at a text size is the same place, and a
|
|
224
|
+
* pixel off it at some.
|
|
225
|
+
*/
|
|
226
|
+
function strikeTop(line, dy, span, ascent, t) {
|
|
227
|
+
if (span.strikeThickness === undefined) {
|
|
228
|
+
return Math.round(dy + line.baseline - ascent * 0.38);
|
|
118
229
|
}
|
|
230
|
+
const thick = strikeThickness(span, t);
|
|
231
|
+
return Math.round(dy +
|
|
232
|
+
line.baseline -
|
|
233
|
+
ascent / 3 -
|
|
234
|
+
(span.strikeStyle === 'curly' ? thick : thick / 2));
|
|
235
|
+
}
|
|
236
|
+
/** The line through a stretch of a line, from `from` to `to` of it, as
|
|
237
|
+
* `span` has it, over faces whose ascent is `ascent`. */
|
|
238
|
+
function strikeRule(ctx, span, line, from, to, dy, ascent, t) {
|
|
239
|
+
const left = Math.round(line.x + from);
|
|
240
|
+
ctx.fillStyle = span.strike;
|
|
241
|
+
underlineRule(ctx, left, strikeTop(line, dy, span, ascent, t), Math.ceil(line.x + to - left), span.strikeStyle ?? 'single', strikeThickness(span, t), t);
|
|
242
|
+
}
|
|
243
|
+
/** Whether two spans are struck through with one rule: the same ink, style
|
|
244
|
+
* and thickness. Where it is drawn is their faces' to say (`strikeTop`). */
|
|
245
|
+
function sameStrike(a, b) {
|
|
246
|
+
return (a === b ||
|
|
247
|
+
(a.strike === b.strike &&
|
|
248
|
+
a.strikeStyle === b.strikeStyle &&
|
|
249
|
+
a.strikeThickness === b.strikeThickness));
|
|
250
|
+
}
|
|
251
|
+
/** Whether two spans are underlined with one rule: the same ink, style,
|
|
252
|
+
* place and thickness. */
|
|
253
|
+
function sameRule(a, b) {
|
|
254
|
+
return (a === b ||
|
|
255
|
+
(a.underline === b.underline &&
|
|
256
|
+
a.underlineStyle === b.underlineStyle &&
|
|
257
|
+
a.underlineOffset === b.underlineOffset &&
|
|
258
|
+
a.underlineThickness === b.underlineThickness));
|
|
119
259
|
}
|
|
120
260
|
/** One logical pixel on the device grid, never less than one device pixel. */
|
|
121
261
|
function ruleThickness(scale) {
|
|
122
262
|
return Math.max(1, Math.round(scale));
|
|
123
263
|
}
|
|
124
264
|
/**
|
|
125
|
-
* The rule under a run, in one of SGR 4's five styles.
|
|
265
|
+
* The rule under a run, or through it, in one of SGR 4's five styles.
|
|
126
266
|
*
|
|
127
267
|
* All five are built from rectangles `t` pixels thick — one logical pixel —
|
|
128
268
|
* rather than a stroked path: the mock backend has no path API, and a
|
|
129
269
|
* hairline stroke on a text baseline is not worth an antialiased path even
|
|
130
270
|
* where there is one. The curl is a two-level square wave — at a text size
|
|
131
271
|
* it reads as a squiggle, which is the entire job. The dot pitch and the
|
|
132
|
-
* dash length scale with the thickness, so the pattern is
|
|
133
|
-
* any display scale.
|
|
272
|
+
* dash length scale with the thickness (`dashedRule`), so the pattern is
|
|
273
|
+
* the pattern at any display scale. The one path is a thick dotted rule's
|
|
274
|
+
* (`dottedRule`): a square is a dot only while it is too small to be seen
|
|
275
|
+
* as a square.
|
|
276
|
+
*
|
|
277
|
+
* `gap` is what parts the two lines of a double rule: a logical pixel
|
|
278
|
+
* however thick they are, as Blink parts them, which for a rule of that
|
|
279
|
+
* thickness is the thickness between them it always was.
|
|
134
280
|
*/
|
|
135
|
-
export function underlineRule(ctx, x, y, width, style, t = 1) {
|
|
281
|
+
export function underlineRule(ctx, x, y, width, style, t = 1, gap = t) {
|
|
136
282
|
switch (style) {
|
|
137
283
|
case 'double':
|
|
138
284
|
ctx.fillRect(x, y, width, t);
|
|
139
|
-
ctx.fillRect(x, y +
|
|
285
|
+
ctx.fillRect(x, y + t + gap, width, t);
|
|
140
286
|
return;
|
|
141
287
|
case 'dotted':
|
|
142
|
-
|
|
143
|
-
ctx.fillRect(x + i, y, Math.min(t, width - i), t);
|
|
144
|
-
}
|
|
288
|
+
dottedRule(ctx, x, y, width, t);
|
|
145
289
|
return;
|
|
146
290
|
case 'dashed':
|
|
147
|
-
|
|
148
|
-
ctx.fillRect(x + i, y, Math.min(3 * t, width - i), t);
|
|
291
|
+
dashedRule(ctx, x, y, width, t);
|
|
149
292
|
return;
|
|
150
293
|
case 'curly':
|
|
151
294
|
for (let i = 0; i < width; i += 2 * t) {
|
|
@@ -157,6 +300,79 @@ export function underlineRule(ctx, x, y, width, style, t = 1) {
|
|
|
157
300
|
return;
|
|
158
301
|
}
|
|
159
302
|
}
|
|
303
|
+
/** The thickness a dashed rule's dashes stop being the long ones of a thin
|
|
304
|
+
* rule at. */
|
|
305
|
+
const THIN_DASHES = 3;
|
|
306
|
+
/**
|
|
307
|
+
* A dashed rule, its dashes the lengths Blink's are: three times the rule's
|
|
308
|
+
* thickness and two apart while it is thin, where a shorter dash reads as
|
|
309
|
+
* a dot and a nearer one as no gap, and twice and one from three pixels up.
|
|
310
|
+
* The first dash starts the rule and the last ends it, with as many between
|
|
311
|
+
* as leave the gaps nearest that: a rule that stopped where its length ran
|
|
312
|
+
* out ended on a sliver of a dash, or on nothing. One with room for two
|
|
313
|
+
* dashes and less than their gap is two, scaled to fit, and one too short
|
|
314
|
+
* for two is a line.
|
|
315
|
+
*/
|
|
316
|
+
function dashedRule(ctx, x, y, width, t) {
|
|
317
|
+
const thin = t < THIN_DASHES;
|
|
318
|
+
const dash = t * (thin ? 3 : 2);
|
|
319
|
+
const gap = t * (thin ? 2 : 1);
|
|
320
|
+
if (width <= 2 * dash) {
|
|
321
|
+
ctx.fillRect(x, y, width, t);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
if (width <= 2 * dash + gap) {
|
|
325
|
+
const each = Math.round((dash * width) / (2 * dash + gap));
|
|
326
|
+
ctx.fillRect(x, y, each, t);
|
|
327
|
+
ctx.fillRect(x + width - each, y, each, t);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
// the fewest dashes that gap fits between, and one more: whichever
|
|
331
|
+
// count's gap is nearer it
|
|
332
|
+
const few = Math.floor((width + gap) / (dash + gap));
|
|
333
|
+
const wide = (width - few * dash) / (few - 1);
|
|
334
|
+
const narrow = (width - (few + 1) * dash) / few;
|
|
335
|
+
const count = narrow <= 0 || Math.abs(wide - gap) < Math.abs(narrow - gap)
|
|
336
|
+
? few
|
|
337
|
+
: few + 1;
|
|
338
|
+
const pitch = (width - dash) / (count - 1);
|
|
339
|
+
for (let i = 0; i < count; i += 1) {
|
|
340
|
+
ctx.fillRect(x + Math.round(i * pitch), y, dash, t);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
/** The thickest a dotted rule's dots are squares at: past it a square
|
|
344
|
+
* reads as one. Where Blink's dotted stroke turns its caps round. */
|
|
345
|
+
const SQUARE_DOTS = 3;
|
|
346
|
+
/**
|
|
347
|
+
* A dotted rule: squares a thickness apart while it is thin, and round dots
|
|
348
|
+
* once it is thick enough for the shape to show — under a title, where the
|
|
349
|
+
* thickness follows the font size. The round ones are spread over the
|
|
350
|
+
* width, the first at its start and the last at its end, as many as leave
|
|
351
|
+
* the gap between two nearest to a dot's own width; a rule with room for
|
|
352
|
+
* fewer than two is one dot. A context with no path draws the squares.
|
|
353
|
+
*/
|
|
354
|
+
function dottedRule(ctx, x, y, width, t) {
|
|
355
|
+
if (t <= SQUARE_DOTS || !ctx.beginPath || !ctx.roundRect || !ctx.fill) {
|
|
356
|
+
for (let i = 0; i < width; i += 2 * t) {
|
|
357
|
+
ctx.fillRect(x + i, y, Math.min(t, width - i), t);
|
|
358
|
+
}
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
// the fewest dots a gap of their own width fits, and one more: whichever
|
|
362
|
+
// count's gap is nearer that width
|
|
363
|
+
const few = Math.max(1, Math.floor((width + t) / (2 * t)));
|
|
364
|
+
const wide = few > 1 ? (width - few * t) / (few - 1) : Infinity;
|
|
365
|
+
const narrow = (width - (few + 1) * t) / few;
|
|
366
|
+
const count = narrow <= 0 || Math.abs(wide - t) < Math.abs(narrow - t) ? few : few + 1;
|
|
367
|
+
const pitch = count > 1 ? (width - t) / (count - 1) : 0;
|
|
368
|
+
for (let i = 0; i < count; i += 1) {
|
|
369
|
+
// a path a dot: ntk knows a path that is one `roundRect` and fills it
|
|
370
|
+
// from its corners, where a path of them all is rasterized whole
|
|
371
|
+
ctx.beginPath();
|
|
372
|
+
ctx.roundRect(x + i * pitch, y, t, t, [t / 2]);
|
|
373
|
+
ctx.fill();
|
|
374
|
+
}
|
|
375
|
+
}
|
|
160
376
|
/** A selected empty line still shows as a sliver, so a selection spanning a
|
|
161
377
|
* blank line does not appear to skip it. Core's own width for the same. */
|
|
162
378
|
export const EMPTY_LINE_BAND = 4;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runs.js","sourceRoot":"","sources":["../../src/richtext/runs.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,2EAA2E;AAC3E,oEAAoE;AACpE,6EAA6E;A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,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;YACzC,CAAC,CAAC,EAAE,CAAC;IACT,CAAC;IACD,4EAA4E;IAC5E,yEAAyE;IACzE,gBAAgB;IAChB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClC,MAAM,GAAG,GAAmC,EAAE,CAAC;IAC/C,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC;YACnC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACjC,SAAS;QACX,CAAC;QACD,IAAI,KAAK,GAAG,IAAI;YAAE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC;QAC7D,IAAI,IAAI;YAAE,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;IACjC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,CAAC"}
|
package/package.json
CHANGED
package/src/html/controls.ts
CHANGED
|
@@ -29,9 +29,12 @@ import {
|
|
|
29
29
|
selectedOptions,
|
|
30
30
|
} from './form.js';
|
|
31
31
|
import type { ComputedStyle } from './css/style.js';
|
|
32
|
+
import { invert } from './css/transform.js';
|
|
32
33
|
import { isTransparent } from './css/values.js';
|
|
34
|
+
import { placedMatrix } from './layout/block.js';
|
|
33
35
|
import type { Box, BoxTree, ReplacedKind } from './layout/boxes.js';
|
|
34
36
|
import type { FontsLike } from './layout/inline.js';
|
|
37
|
+
import { clipAround } from './paint.js';
|
|
35
38
|
|
|
36
39
|
/** The palette numbers a control's box has to reserve room for. */
|
|
37
40
|
export interface ControlChrome {
|
|
@@ -77,6 +80,18 @@ export interface ControlRect {
|
|
|
77
80
|
* invisible, over its label.
|
|
78
81
|
*/
|
|
79
82
|
opacity?: number;
|
|
83
|
+
/**
|
|
84
|
+
* The part of the document the element shows through, where that is not
|
|
85
|
+
* all of its box: what its own `clip` and `clip-path` leave of it, and
|
|
86
|
+
* what the boxes that clip their overflow around it, and every
|
|
87
|
+
* `clip-path` above it, do (`clipAround`). The widget is cut to it, as
|
|
88
|
+
* the element's own drawing is. With no area, none of the element shows
|
|
89
|
+
* — a control a page hides for a screen reader alone, 1px square under
|
|
90
|
+
* `clip: rect(0, 0, 0, 0)` or `clip-path: inset(50%)`, beside the one it
|
|
91
|
+
* draws itself — and the widget is not seen and takes no press, and
|
|
92
|
+
* still takes the keyboard's focus, as the element does in a browser.
|
|
93
|
+
*/
|
|
94
|
+
clip?: { x: number; y: number; width: number; height: number };
|
|
80
95
|
}
|
|
81
96
|
|
|
82
97
|
/** Where a styled field's widget goes, and how its text looks. */
|
|
@@ -98,8 +113,9 @@ export interface BareField {
|
|
|
98
113
|
chevron?: boolean;
|
|
99
114
|
}
|
|
100
115
|
|
|
101
|
-
/** The rectangles every control in a laid-out document landed on.
|
|
102
|
-
|
|
116
|
+
/** The rectangles every control in a laid-out document landed on. `scale`
|
|
117
|
+
* is the document's device pixels to a CSS one. */
|
|
118
|
+
export function controlRectsOf(tree: BoxTree, scale = 1): ControlRect[] {
|
|
103
119
|
const out: ControlRect[] = [];
|
|
104
120
|
for (const box of tree.controls) {
|
|
105
121
|
if (!box.el) continue;
|
|
@@ -117,10 +133,26 @@ export function controlRectsOf(tree: BoxTree): ControlRect[] {
|
|
|
117
133
|
fontSize: box.style.fontSize,
|
|
118
134
|
};
|
|
119
135
|
let opacity = 1;
|
|
136
|
+
// A box scaled to nothing draws nothing of what it holds (CSS
|
|
137
|
+
// Transforms 1, 6), which is how a page keeps a menu it has not opened.
|
|
138
|
+
// A widget in it is not mounted; one in a box turned or scaled to
|
|
139
|
+
// anything else is mounted where the box was laid out, as it is — a
|
|
140
|
+
// widget is a node of its own, which no matrix of the document's reaches.
|
|
141
|
+
let flattened = false;
|
|
120
142
|
for (let at: Box | null = box; at; at = at.parent) {
|
|
121
143
|
opacity *= at.style.opacity;
|
|
144
|
+
const matrix = placedMatrix(at);
|
|
145
|
+
if (matrix && !invert(matrix)) flattened = true;
|
|
122
146
|
}
|
|
147
|
+
if (flattened) continue;
|
|
123
148
|
if (opacity < 1) rect.opacity = Math.max(0, opacity);
|
|
149
|
+
// cut by the clips around it where they do not leave it whole, and by
|
|
150
|
+
// its own box where it clips itself
|
|
151
|
+
const shown = pixelsOf(box);
|
|
152
|
+
const around = clipAround(box, scale);
|
|
153
|
+
if (clipsItself(box)) {
|
|
154
|
+
rect.clip = around ? between(around, shown) : shown;
|
|
155
|
+
} else if (around && !covers(around, shown)) rect.clip = around;
|
|
124
156
|
if (styledField(box.replaced, box.style)) {
|
|
125
157
|
rect.bare = {
|
|
126
158
|
x: box.contentX,
|
|
@@ -140,6 +172,57 @@ export function controlRectsOf(tree: BoxTree): ControlRect[] {
|
|
|
140
172
|
return out;
|
|
141
173
|
}
|
|
142
174
|
|
|
175
|
+
type Rect = { x: number; y: number; width: number; height: number };
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Whether a control is cut to its own box: one the page gave an `overflow`
|
|
179
|
+
* other than `visible`, as an inline block's content is cut (CSS 2.1
|
|
180
|
+
* 11.1.1). A browser paints no control past its border box whatever its
|
|
181
|
+
* `overflow` says, scaling a checkbox into a box a pixel square; a widget
|
|
182
|
+
* has a size of its own, and is cut where the page said its box cuts. At
|
|
183
|
+
* the border box, which the widget's own frame is drawn in. A text field is
|
|
184
|
+
* left out: it cuts its own text, and a sheet that gives every `<textarea>`
|
|
185
|
+
* `overflow: auto`, as normalize.css does, asks for nothing here.
|
|
186
|
+
*/
|
|
187
|
+
function clipsItself(box: Box): boolean {
|
|
188
|
+
if (box.replaced === 'input' || box.replaced === 'textarea') return false;
|
|
189
|
+
return box.style.overflowX !== 'visible' || box.style.overflowY !== 'visible';
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** A box's border box on the pixels it is drawn on. */
|
|
193
|
+
function pixelsOf(box: Box): Rect {
|
|
194
|
+
const x = Math.round(box.x);
|
|
195
|
+
const y = Math.round(box.y);
|
|
196
|
+
return {
|
|
197
|
+
x,
|
|
198
|
+
y,
|
|
199
|
+
width: Math.round(box.x + box.width) - x,
|
|
200
|
+
height: Math.round(box.y + box.height) - y,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** What two rectangles share, of no area where they share nothing. */
|
|
205
|
+
export function between(a: Rect, b: Rect): Rect {
|
|
206
|
+
const x = Math.max(a.x, b.x);
|
|
207
|
+
const y = Math.max(a.y, b.y);
|
|
208
|
+
return {
|
|
209
|
+
x,
|
|
210
|
+
y,
|
|
211
|
+
width: Math.max(0, Math.min(a.x + a.width, b.x + b.width) - x),
|
|
212
|
+
height: Math.max(0, Math.min(a.y + a.height, b.y + b.height) - y),
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** Whether a clip leaves a rectangle whole. */
|
|
217
|
+
function covers(clip: Rect, rect: Rect): boolean {
|
|
218
|
+
return (
|
|
219
|
+
clip.x <= rect.x &&
|
|
220
|
+
clip.y <= rect.y &&
|
|
221
|
+
clip.x + clip.width >= rect.x + rect.width &&
|
|
222
|
+
clip.y + clip.height >= rect.y + rect.height
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
143
226
|
/**
|
|
144
227
|
* Whether a field's box is the author's to draw: one given a border or a
|
|
145
228
|
* background of its own, which the UA sheet gives no control, or set to
|
package/src/html/css/cascade.ts
CHANGED
|
@@ -33,6 +33,7 @@ import type { Declaration, StyleRule, Stylesheet } from './parse.js';
|
|
|
33
33
|
import {
|
|
34
34
|
applyDeclaration,
|
|
35
35
|
blockify,
|
|
36
|
+
settleButton,
|
|
36
37
|
settleContentVisibility,
|
|
37
38
|
settleOverflow,
|
|
38
39
|
settleClamp,
|
|
@@ -1237,6 +1238,7 @@ export class Cascade {
|
|
|
1237
1238
|
parentStyle,
|
|
1238
1239
|
inFlexContainer,
|
|
1239
1240
|
candidates,
|
|
1241
|
+
true,
|
|
1240
1242
|
),
|
|
1241
1243
|
key: this._nextShareKey++,
|
|
1242
1244
|
};
|
|
@@ -1293,6 +1295,7 @@ export class Cascade {
|
|
|
1293
1295
|
parentStyle,
|
|
1294
1296
|
inFlexContainer,
|
|
1295
1297
|
this._candidates(el),
|
|
1298
|
+
true,
|
|
1296
1299
|
);
|
|
1297
1300
|
}
|
|
1298
1301
|
|
|
@@ -1509,6 +1512,9 @@ export class Cascade {
|
|
|
1509
1512
|
parentStyle: ComputedStyle,
|
|
1510
1513
|
inFlexContainer: boolean,
|
|
1511
1514
|
candidates: Candidate[],
|
|
1515
|
+
/** Whether the style is the element's own, and not that of one of its
|
|
1516
|
+
* pseudo-elements. */
|
|
1517
|
+
own = false,
|
|
1512
1518
|
): ComputedStyle {
|
|
1513
1519
|
const style = inherit(parentStyle, this.initial);
|
|
1514
1520
|
// custom properties first, in cascade order, so every `var()` in the
|
|
@@ -1521,10 +1527,14 @@ export class Cascade {
|
|
|
1521
1527
|
// em-relative length in the same rule resolves against this element's.
|
|
1522
1528
|
const root = isRootElement(el);
|
|
1523
1529
|
const rootStyle = root ? this.initial : (this._root ?? this.initial);
|
|
1530
|
+
// whose declaration is being applied: the UA sheet's families are the
|
|
1531
|
+
// host's own faces, and its lists end where they end
|
|
1532
|
+
let authored = true;
|
|
1524
1533
|
const ctxParent: UnitContext = {
|
|
1525
1534
|
em: parentStyle.fontSize,
|
|
1526
1535
|
rem: rootStyle.fontSize,
|
|
1527
1536
|
initial: this.initial,
|
|
1537
|
+
fallbackFamily: () => (authored ? this.initial.fontFamily : null),
|
|
1528
1538
|
vw: this.viewportWidth,
|
|
1529
1539
|
vh: this.viewportHeight,
|
|
1530
1540
|
scale: this.scale,
|
|
@@ -1543,6 +1553,7 @@ export class Cascade {
|
|
|
1543
1553
|
let sized = false;
|
|
1544
1554
|
let keyword = false;
|
|
1545
1555
|
for (const c of candidates) {
|
|
1556
|
+
authored = c.origin !== Origin.UserAgent;
|
|
1546
1557
|
for (const d of pick(c)) {
|
|
1547
1558
|
if (
|
|
1548
1559
|
d.prop === 'font-family' ||
|
|
@@ -1606,6 +1617,7 @@ export class Cascade {
|
|
|
1606
1617
|
// them. A `font` sets the size as well, which the first pass settled.
|
|
1607
1618
|
if (this._lh) {
|
|
1608
1619
|
for (const c of candidates) {
|
|
1620
|
+
authored = c.origin !== Origin.UserAgent;
|
|
1609
1621
|
for (const d of pick(c)) {
|
|
1610
1622
|
if (d.prop === 'line-height' || d.prop === 'font') {
|
|
1611
1623
|
this._apply(style, parentStyle, d, ctx);
|
|
@@ -1621,6 +1633,7 @@ export class Cascade {
|
|
|
1621
1633
|
}
|
|
1622
1634
|
const settled = style.fontSize;
|
|
1623
1635
|
for (const c of candidates) {
|
|
1636
|
+
authored = c.origin !== Origin.UserAgent;
|
|
1624
1637
|
for (const d of pick(c)) {
|
|
1625
1638
|
if (d.prop === 'font-size' || d.custom) continue;
|
|
1626
1639
|
this._apply(style, parentStyle, d, ctx);
|
|
@@ -1648,6 +1661,10 @@ export class Cascade {
|
|
|
1648
1661
|
settleOverflow(style);
|
|
1649
1662
|
settleContentVisibility(style);
|
|
1650
1663
|
blockify(style, inFlexContainer);
|
|
1664
|
+
// a button is laid out as one, whatever `display` it was given
|
|
1665
|
+
if (own && el.name.length === 6 && tagOf(el) === 'button') {
|
|
1666
|
+
settleButton(style);
|
|
1667
|
+
}
|
|
1651
1668
|
decorate(style);
|
|
1652
1669
|
// which faces of the document's own families this family, weight and
|
|
1653
1670
|
// slant ask for — known only now, with all three computed
|
|
@@ -2275,6 +2292,12 @@ function presentationHints(el: Element): Declaration[] {
|
|
|
2275
2292
|
const height = attr(el, 'height');
|
|
2276
2293
|
const h = height ? svgSizeHint(height) : null;
|
|
2277
2294
|
if (h) push('height', h);
|
|
2295
|
+
// and its paint is its `fill` and `stroke` properties' (13.2), which a
|
|
2296
|
+
// rule of the document's then sets over the attribute
|
|
2297
|
+
const fill = attr(el, 'fill');
|
|
2298
|
+
if (fill) push('fill', fill);
|
|
2299
|
+
const stroke = attr(el, 'stroke');
|
|
2300
|
+
if (stroke) push('stroke', stroke);
|
|
2278
2301
|
}
|
|
2279
2302
|
|
|
2280
2303
|
if (tag === 'table') {
|
package/src/html/css/color.ts
CHANGED
|
@@ -773,6 +773,24 @@ export function lightDark(
|
|
|
773
773
|
value: string,
|
|
774
774
|
scheme: 'light' | 'dark',
|
|
775
775
|
): string | null {
|
|
776
|
+
// kept by the value: the UA sheet's link colour is one, so every link of
|
|
777
|
+
// every document asks, and a theme's are a few asked by every element
|
|
778
|
+
const kept = PICKED[scheme];
|
|
779
|
+
let picked = kept.get(value);
|
|
780
|
+
if (picked === undefined) {
|
|
781
|
+
picked = pickScheme(value, scheme);
|
|
782
|
+
if (kept.size >= 512) kept.clear();
|
|
783
|
+
kept.set(value, picked);
|
|
784
|
+
}
|
|
785
|
+
return picked;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
const PICKED = {
|
|
789
|
+
light: new Map<string, string | null>(),
|
|
790
|
+
dark: new Map<string, string | null>(),
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
function pickScheme(value: string, scheme: 'light' | 'dark'): string | null {
|
|
776
794
|
let out = value;
|
|
777
795
|
// a branch can hold another, which the next round replaces
|
|
778
796
|
for (let round = 0; round < 32; round += 1) {
|
|
@@ -827,6 +845,17 @@ export function usedColorScheme(
|
|
|
827
845
|
return first ?? preferred;
|
|
828
846
|
}
|
|
829
847
|
|
|
848
|
+
/**
|
|
849
|
+
* A browser's own colours in each scheme — the system colours `Canvas`,
|
|
850
|
+
* `CanvasText` and `LinkText` (CSS Color 4, 6.2), as Chrome has them: what
|
|
851
|
+
* a document is drawn in where its root's scheme is not the palette's,
|
|
852
|
+
* which has the colours of its own scheme and of no other.
|
|
853
|
+
*/
|
|
854
|
+
export const SCHEME_COLORS = {
|
|
855
|
+
light: { canvas: '#ffffff', text: '#000000', link: '#0000ee' },
|
|
856
|
+
dark: { canvas: '#121212', text: '#ffffff', link: '#9e9eff' },
|
|
857
|
+
} as const;
|
|
858
|
+
|
|
830
859
|
const SCHEME_IDENT = /^-?(?:[a-z_]|--)[\w-]*$/;
|
|
831
860
|
/** What a scheme's name cannot be: the keywords the grammar has, and the
|
|
832
861
|
* CSS-wide ones, which reach here only in a list. */
|