@react-x11/components 0.14.1 → 0.16.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/code-editor/node.d.ts +13 -0
- package/dist/code-editor/node.d.ts.map +1 -1
- package/dist/code-editor/node.js +23 -5
- package/dist/code-editor/node.js.map +1 -1
- package/dist/html/css/cascade.d.ts +171 -26
- package/dist/html/css/cascade.d.ts.map +1 -1
- package/dist/html/css/cascade.js +616 -216
- package/dist/html/css/cascade.js.map +1 -1
- package/dist/html/css/color.d.ts +25 -0
- package/dist/html/css/color.d.ts.map +1 -1
- package/dist/html/css/color.js +307 -19
- package/dist/html/css/color.js.map +1 -1
- package/dist/html/css/content.d.ts +11 -6
- package/dist/html/css/content.d.ts.map +1 -1
- package/dist/html/css/content.js +171 -12
- package/dist/html/css/content.js.map +1 -1
- package/dist/html/css/parse.d.ts.map +1 -1
- package/dist/html/css/parse.js +62 -9
- package/dist/html/css/parse.js.map +1 -1
- package/dist/html/css/shapes.d.ts +18 -0
- package/dist/html/css/shapes.d.ts.map +1 -1
- package/dist/html/css/shapes.js +21 -1
- package/dist/html/css/shapes.js.map +1 -1
- package/dist/html/css/style.d.ts +42 -5
- package/dist/html/css/style.d.ts.map +1 -1
- package/dist/html/css/style.js +74 -12
- package/dist/html/css/style.js.map +1 -1
- package/dist/html/css/ua.js +15 -0
- package/dist/html/css/ua.js.map +1 -1
- package/dist/html/css/values.d.ts +5 -0
- package/dist/html/css/values.d.ts.map +1 -1
- package/dist/html/css/values.js +18 -9
- package/dist/html/css/values.js.map +1 -1
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +7 -0
- package/dist/html/index.js.map +1 -1
- package/dist/html/layout/block.d.ts +29 -9
- package/dist/html/layout/block.d.ts.map +1 -1
- package/dist/html/layout/block.js +141 -52
- package/dist/html/layout/block.js.map +1 -1
- package/dist/html/layout/boxes.d.ts +16 -2
- package/dist/html/layout/boxes.d.ts.map +1 -1
- package/dist/html/layout/boxes.js +144 -23
- package/dist/html/layout/boxes.js.map +1 -1
- package/dist/html/layout/css-grid.d.ts.map +1 -1
- package/dist/html/layout/css-grid.js +11 -9
- 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 +1631 -221
- package/dist/html/layout/flex.js.map +1 -1
- package/dist/html/layout/inline.d.ts +15 -3
- package/dist/html/layout/inline.d.ts.map +1 -1
- package/dist/html/layout/inline.js +23 -8
- package/dist/html/layout/inline.js.map +1 -1
- package/dist/html/layout/table.d.ts +27 -1
- package/dist/html/layout/table.d.ts.map +1 -1
- package/dist/html/layout/table.js +886 -324
- package/dist/html/layout/table.js.map +1 -1
- package/dist/html/node.d.ts +35 -4
- package/dist/html/node.d.ts.map +1 -1
- package/dist/html/node.js +118 -26
- package/dist/html/node.js.map +1 -1
- package/dist/html/paint.d.ts.map +1 -1
- package/dist/html/paint.js +558 -178
- package/dist/html/paint.js.map +1 -1
- package/dist/html/resources.js +14 -1
- package/dist/html/resources.js.map +1 -1
- package/dist/html/svg.d.ts +23 -7
- package/dist/html/svg.d.ts.map +1 -1
- package/dist/html/svg.js +264 -59
- package/dist/html/svg.js.map +1 -1
- package/dist/html/widgets.d.ts.map +1 -1
- package/dist/html/widgets.js +57 -4
- package/dist/html/widgets.js.map +1 -1
- package/package.json +3 -3
- package/src/code-editor/node.ts +24 -5
- package/src/html/css/cascade.ts +697 -221
- package/src/html/css/color.ts +345 -18
- package/src/html/css/content.ts +173 -15
- package/src/html/css/parse.ts +60 -8
- package/src/html/css/shapes.ts +35 -1
- package/src/html/css/style.ts +122 -17
- package/src/html/css/ua.ts +15 -0
- package/src/html/css/values.ts +23 -9
- package/src/html/index.ts +7 -0
- package/src/html/layout/block.ts +149 -58
- package/src/html/layout/boxes.ts +171 -27
- package/src/html/layout/css-grid.ts +12 -9
- package/src/html/layout/flex.ts +1843 -212
- package/src/html/layout/inline.ts +27 -7
- package/src/html/layout/table.ts +961 -332
- package/src/html/node.ts +151 -27
- package/src/html/paint.ts +692 -234
- package/src/html/resources.ts +13 -1
- package/src/html/svg.ts +299 -56
- package/src/html/widgets.ts +61 -4
package/dist/html/css/style.js
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
// correct at every width, which is the whole of the resize story.
|
|
15
15
|
import { AUTO, alphaOf, fourSides, inkColor, isTransparent, keywordFontSize, parseAlpha, parseColor, isPct, parseLength, parseNumber, parseWeight, resolve, splitCommas, splitValue, } from './values.js';
|
|
16
16
|
import { parseUrl, readIdent, startsIdent } from './parse.js';
|
|
17
|
-
import {
|
|
17
|
+
import { parseContent, parseCounterList, parseListStyleType, parseQuotes, } from './content.js';
|
|
18
18
|
import { parseRotate, parseScale, parseTransform } from './transform.js';
|
|
19
|
-
import { LIGHT_DARK, lightDark, usedColorScheme } from './color.js';
|
|
19
|
+
import { LIGHT_DARK, SYSTEM_COLOR, lightDark, systemColors, usedColorScheme, } from './color.js';
|
|
20
20
|
import { svgPaint } from './shapes.js';
|
|
21
21
|
/** Whether a length is one `padding` takes: not `auto`, not negative. A
|
|
22
22
|
* `calc()` with a percentage in it has no sign until layout, which clamps
|
|
@@ -206,6 +206,36 @@ export const INHERITED = [
|
|
|
206
206
|
'quotes',
|
|
207
207
|
'custom',
|
|
208
208
|
];
|
|
209
|
+
/** Core's focus ring, where a look names none (`DEFAULT_FOCUS_RING`). */
|
|
210
|
+
const FOCUS_RING = { color: '#2980b9', width: 2, offset: 1 };
|
|
211
|
+
/**
|
|
212
|
+
* An `outline-style: auto` as the platform's focus ring: the palette's
|
|
213
|
+
* width and, where the outline's colour is the text's or the keyword's,
|
|
214
|
+
* its colour, the palette's gap outside `outline-offset` — so a field the
|
|
215
|
+
* document draws is ringed as the window's own fields are. A browser
|
|
216
|
+
* draws `auto` in a style of its own the same way, whatever width it was
|
|
217
|
+
* given. `look` is the device one, as every length here is, and `scale`
|
|
218
|
+
* what makes core's defaults device lengths too.
|
|
219
|
+
*/
|
|
220
|
+
export function settleOutline(style, look, scale) {
|
|
221
|
+
if (style.outlineStyle !== 'auto')
|
|
222
|
+
return;
|
|
223
|
+
style.outlineWidth = look.focusRingWidth ?? FOCUS_RING.width * scale;
|
|
224
|
+
style.outlineOffset += look.focusRingOffset ?? FOCUS_RING.offset * scale;
|
|
225
|
+
if (style.outlineColor === 'currentColor') {
|
|
226
|
+
style.outlineColor = look.focusRing ?? FOCUS_RING.color;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/** `-webkit-focus-ring-color`, a colour of an outline's. */
|
|
230
|
+
function outlineColorOf(v, ctx) {
|
|
231
|
+
const lower = v.trim().toLowerCase();
|
|
232
|
+
if (lower === 'invert')
|
|
233
|
+
return 'currentColor';
|
|
234
|
+
if (lower === '-webkit-focus-ring-color') {
|
|
235
|
+
return ctx.focusRing ?? FOCUS_RING.color;
|
|
236
|
+
}
|
|
237
|
+
return parseColor(v);
|
|
238
|
+
}
|
|
209
239
|
export function initialStyle(look, scale = 1) {
|
|
210
240
|
// `medium`, in device pixels
|
|
211
241
|
const medium = BORDER_WIDTH_KEYWORDS.medium * scale;
|
|
@@ -259,7 +289,7 @@ export function initialStyle(look, scale = 1) {
|
|
|
259
289
|
captionSide: 'top',
|
|
260
290
|
emptyCells: 'show',
|
|
261
291
|
tableTextAlignSet: false,
|
|
262
|
-
quotes:
|
|
292
|
+
quotes: 'auto',
|
|
263
293
|
custom: null,
|
|
264
294
|
display: 'inline',
|
|
265
295
|
flowRoot: false,
|
|
@@ -397,7 +427,7 @@ export function initialStyle(look, scale = 1) {
|
|
|
397
427
|
flexDirection: 'row',
|
|
398
428
|
flexWrap: 'nowrap',
|
|
399
429
|
justifyContent: 'normal',
|
|
400
|
-
alignItems: '
|
|
430
|
+
alignItems: 'normal',
|
|
401
431
|
alignSelf: 'auto',
|
|
402
432
|
alignContent: 'stretch',
|
|
403
433
|
flexGrow: 0,
|
|
@@ -581,6 +611,9 @@ export function firstLineParent(parent, onLine) {
|
|
|
581
611
|
}
|
|
582
612
|
// --- applying a declaration -------------------------------------------------
|
|
583
613
|
/** Longhands that take a colour and nothing else, by property name. */
|
|
614
|
+
/** The properties a colour is written in, alone or in a shorthand, a
|
|
615
|
+
* shadow, a gradient or an image's mask. */
|
|
616
|
+
const TAKES_COLOR = /^(?:color|background|border|outline|box-shadow|text-shadow|text-decoration|text-emphasis|column-rule|fill|stroke|stop-color|flood-color|lighting-color|caret-color|accent-color|scrollbar-color|filter|mask|list-style|-webkit-text-(?:fill|stroke))/;
|
|
584
617
|
const COLOR_PROPS = {
|
|
585
618
|
color: 'color',
|
|
586
619
|
'background-color': 'backgroundColor',
|
|
@@ -680,6 +713,11 @@ export function applyDeclaration(style, parent, prop, rawValue, ctx) {
|
|
|
680
713
|
if (/!\s*important$/i.test(value)) {
|
|
681
714
|
value = value.replace(/!\s*important$/i, '').trim();
|
|
682
715
|
}
|
|
716
|
+
// a system colour is a `light-dark()` of its own, in a property that
|
|
717
|
+
// takes a colour: `Menu` is a font in `font`, and `Mark` a family's name
|
|
718
|
+
if (TAKES_COLOR.test(name) && SYSTEM_COLOR.test(value)) {
|
|
719
|
+
value = systemColors(value, ctx.systemColors);
|
|
720
|
+
}
|
|
683
721
|
// the branch of each `light-dark()` this element's scheme picks, before
|
|
684
722
|
// anything reads the value: it stands wherever a colour can, in a
|
|
685
723
|
// shorthand, a shadow, a gradient or a mix, and most often arrives
|
|
@@ -1415,7 +1453,7 @@ export function applyDeclaration(style, parent, prop, rawValue, ctx) {
|
|
|
1415
1453
|
width = w;
|
|
1416
1454
|
continue;
|
|
1417
1455
|
}
|
|
1418
|
-
const c =
|
|
1456
|
+
const c = outlineColorOf(part, ctx);
|
|
1419
1457
|
if (c === null)
|
|
1420
1458
|
return;
|
|
1421
1459
|
color = c;
|
|
@@ -1439,8 +1477,7 @@ export function applyDeclaration(style, parent, prop, rawValue, ctx) {
|
|
|
1439
1477
|
}
|
|
1440
1478
|
case 'outline-color': {
|
|
1441
1479
|
// `invert` is the text's colour where a browser cannot invert
|
|
1442
|
-
const
|
|
1443
|
-
const c = v === 'invert' ? 'currentColor' : parseColor(value);
|
|
1480
|
+
const c = outlineColorOf(value, ctx);
|
|
1444
1481
|
if (c !== null)
|
|
1445
1482
|
style.outlineColor = c;
|
|
1446
1483
|
return;
|
|
@@ -2286,14 +2323,17 @@ export function applyDeclaration(style, parent, prop, rawValue, ctx) {
|
|
|
2286
2323
|
return;
|
|
2287
2324
|
}
|
|
2288
2325
|
case 'align-items': {
|
|
2289
|
-
const v =
|
|
2326
|
+
const v = value.trim().toLowerCase() === 'normal'
|
|
2327
|
+
? 'normal'
|
|
2328
|
+
: alignKeyword(value);
|
|
2290
2329
|
if (v)
|
|
2291
2330
|
style.alignItems = v;
|
|
2292
2331
|
return;
|
|
2293
2332
|
}
|
|
2294
2333
|
case 'align-self': {
|
|
2295
|
-
|
|
2296
|
-
|
|
2334
|
+
const keyword = value.trim().toLowerCase();
|
|
2335
|
+
if (keyword === 'auto' || keyword === 'normal') {
|
|
2336
|
+
style.alignSelf = keyword;
|
|
2297
2337
|
return;
|
|
2298
2338
|
}
|
|
2299
2339
|
const v = alignKeyword(value);
|
|
@@ -2303,10 +2343,14 @@ export function applyDeclaration(style, parent, prop, rawValue, ctx) {
|
|
|
2303
2343
|
}
|
|
2304
2344
|
case 'align-content': {
|
|
2305
2345
|
// `normal` is `stretch` in a flex and a grid container, the only
|
|
2306
|
-
// boxes it moves anything in (CSS Box Alignment 3, 5.1)
|
|
2346
|
+
// boxes it moves anything in (CSS Box Alignment 3, 5.1); `start` and
|
|
2347
|
+
// `end` are the box's own edges, and stay those
|
|
2348
|
+
const plain = overflowAligned(value);
|
|
2307
2349
|
const v = value.trim().toLowerCase() === 'normal'
|
|
2308
2350
|
? 'stretch'
|
|
2309
|
-
:
|
|
2351
|
+
: plain === 'start' || plain === 'end'
|
|
2352
|
+
? plain
|
|
2353
|
+
: alignKeyword(value);
|
|
2310
2354
|
if (v)
|
|
2311
2355
|
style.alignContent = v;
|
|
2312
2356
|
return;
|
|
@@ -2771,6 +2815,24 @@ export function settleContentVisibility(style) {
|
|
|
2771
2815
|
style.contain &= ~CONTAIN_INLINE_SIZE;
|
|
2772
2816
|
}
|
|
2773
2817
|
}
|
|
2818
|
+
/**
|
|
2819
|
+
* `align-items: normal` and `align-self: normal`, settled once the cascade
|
|
2820
|
+
* knows what the box and its parent are. In a grid `normal` stretches an
|
|
2821
|
+
* item only where it has neither a natural size nor a ratio, and `stretch`
|
|
2822
|
+
* stretches every item (CSS Grid 1, 6.2; CSS Box Alignment 3, 6.1), so the
|
|
2823
|
+
* grid keeps the two apart; everywhere else `normal` is `stretch`, and a
|
|
2824
|
+
* flex box reads nothing new. Unread, `normal` was dropped, and a grid could
|
|
2825
|
+
* not tell an unset `align-items` from `stretch`: an image under an explicit
|
|
2826
|
+
* `stretch` kept the height its ratio gave it.
|
|
2827
|
+
*/
|
|
2828
|
+
export function settleAlign(style, parent) {
|
|
2829
|
+
if (style.alignItems === 'normal' && !style.grid) {
|
|
2830
|
+
style.alignItems = 'stretch';
|
|
2831
|
+
}
|
|
2832
|
+
if (style.alignSelf === 'normal' && !parent?.grid) {
|
|
2833
|
+
style.alignSelf = 'stretch';
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2774
2836
|
export function settleOverflow(style) {
|
|
2775
2837
|
const x = style.overflowX;
|
|
2776
2838
|
const y = style.overflowY;
|