gesso-core 0.6.16 → 0.6.18
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/CHANGELOG.md +17 -0
- package/dist/{CanvasSurface-Dz-AXwa4.js → CanvasSurface-BSvtTgJZ.js} +120 -25
- package/dist/CanvasSurface-BSvtTgJZ.js.map +1 -0
- package/dist/{index-5CNL7kuO.d.ts → index-Bi5ggOnd.d.ts} +90 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +41 -6
- package/dist/index.js.map +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +1 -1
- package/dist/CanvasSurface-Dz-AXwa4.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# gesso-core
|
|
2
2
|
|
|
3
|
+
## 0.6.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3ca92f7: `withContrast(theme, 'high', { surfaces })` and `highContrastColors(colors, { surfaces })` leave the names a custom palette says are grounds as they leave the stock ones. Every name a palette added was raised as a foreground against the page, so a code editor's selection or a diff's filled lines turned bright enough that what was drawn on them could not be read.
|
|
8
|
+
- 7da31d2: A text with `textOverflow: 'ellipsis'` that has no room for even the ellipsis draws nothing, as a hidden overflow clips it in CSS. Squeezed to nothing beside other text (a folder's name after a long file name, in a row that shrinks it first), it drew whole, since a zero width is measured as no limit, or as an ellipsis wider than its box, over whatever came after it. Both renderers place text through `layoutTextLines`, so both agree.
|
|
9
|
+
- 32f00f4: A hard line that fits whole is not broken. Line breaking added up its pieces' widths, which a font that kerns across a join ("grid-" and "test.ts") makes wider than the line measured whole, the width a box sized to its own text is given; such a line broke at the hyphen and drew "grid-…" with room to spare.
|
|
10
|
+
- 4a73051: `orientation` says which way a tablist, toolbar, list or separator runs when it is not the way its role assumes, and the semantics mirror sets `aria-orientation` from it. A column of tabs, as an activity bar is, was announced as horizontal, so a screen reader told its user to press Left and Right; with `orientation: 'vertical'` it says Up and Down.
|
|
11
|
+
- 95a6503: A focusable node inside a role whose children are presentational (a button inside a button) is warned of, once, in the console. ARIA hides it, so it has no record in the mirror and Tab stops on it in silence; nothing said so until a Tab walk found the silence.
|
|
12
|
+
- 1b6e6a7: Recolouring a text's runs is a repaint. A change to `spans` that keeps every run's text and font and changes only its colour, background or decoration marks paint and nothing else; before, it measured the text again and rebuilt its semantics, which is what a code editor colouring a line a frame after drawing it paid on every line, on every keystroke.
|
|
13
|
+
|
|
14
|
+
## 0.6.17
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- fcf0d04: An anchored overlay taller than the room on the side it opens on is now cut to that room, instead of running off the edge of the window. The room reaches the overlay's layout the way a `maxHeight` would, so a scroll container inside it scrolls what does not fit. An overlay placed at a point, such as a context menu, that fits on neither side of the point but fits in the window opens on the side asked for and slides back over the point until all of it is on the screen, as a native context menu does, rather than starting off the top of the window. Overlays that fit are placed exactly as before.
|
|
19
|
+
|
|
3
20
|
## 0.6.16
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -1704,6 +1704,20 @@ function textSpansEqual(a, b) {
|
|
|
1704
1704
|
for (let i = 0; i < a.length; i++) if (!spansEqual(a[i], b[i])) return false;
|
|
1705
1705
|
return true;
|
|
1706
1706
|
}
|
|
1707
|
+
/**
|
|
1708
|
+
* Whether two lists of runs are the same text, set the same way, and
|
|
1709
|
+
* differ at most in colour, background and decoration, which are drawn
|
|
1710
|
+
* rather than measured.
|
|
1711
|
+
*/
|
|
1712
|
+
function spansDifferOnlyInPaint(a, b) {
|
|
1713
|
+
if (a === void 0 || b === void 0 || a.length !== b.length) return false;
|
|
1714
|
+
for (let i = 0; i < a.length; i++) {
|
|
1715
|
+
const x = a[i];
|
|
1716
|
+
const y = b[i];
|
|
1717
|
+
if (x.text !== y.text || x.fontFamily !== y.fontFamily || x.fontSize !== y.fontSize || x.fontWeight !== y.fontWeight || x.fontStyle !== y.fontStyle || x.fontStretch !== y.fontStretch || x.fontVariant !== y.fontVariant || x.fontKerning !== y.fontKerning || x.letterSpacing !== y.letterSpacing || x.hidden !== y.hidden || x.link !== y.link) return false;
|
|
1718
|
+
}
|
|
1719
|
+
return true;
|
|
1720
|
+
}
|
|
1707
1721
|
function spansEqual(a, b) {
|
|
1708
1722
|
return a.text === b.text && a.fontFamily === b.fontFamily && a.fontSize === b.fontSize && a.fontWeight === b.fontWeight && a.fontStyle === b.fontStyle && a.fontStretch === b.fontStretch && a.fontVariant === b.fontVariant && a.fontKerning === b.fontKerning && a.letterSpacing === b.letterSpacing && a.hidden === b.hidden && colorValueEqual(a.color, b.color) && colorValueEqual(a.backgroundColor, b.backgroundColor) && a.textDecoration === b.textDecoration && a.link === b.link;
|
|
1709
1723
|
}
|
|
@@ -2079,15 +2093,17 @@ const FOREGROUNDS = {
|
|
|
2079
2093
|
* Every extra name a custom palette added is raised too, against the
|
|
2080
2094
|
* page background, because a palette that grew a token for its own
|
|
2081
2095
|
* accent should not be the one thing that stays quiet when the setting
|
|
2082
|
-
* is turned on
|
|
2083
|
-
* the surface they are
|
|
2096
|
+
* is turned on; unless it says it is a ground (`surfaces`). The named
|
|
2097
|
+
* foregrounds above override that default with the surface they are
|
|
2098
|
+
* really drawn on.
|
|
2084
2099
|
*/
|
|
2085
|
-
function highContrastColors(colors) {
|
|
2100
|
+
function highContrastColors(colors, options = {}) {
|
|
2101
|
+
const surfaces = /* @__PURE__ */ new Set([...SURFACES, ...options.surfaces ?? []]);
|
|
2086
2102
|
const source = colors;
|
|
2087
2103
|
const raised = { ...source };
|
|
2088
2104
|
for (const name of Object.keys(source)) {
|
|
2089
2105
|
const value = source[name];
|
|
2090
|
-
if (value === void 0 ||
|
|
2106
|
+
if (value === void 0 || surfaces.has(name)) continue;
|
|
2091
2107
|
const against = source[FOREGROUNDS[name] ?? "background"];
|
|
2092
2108
|
if (against === void 0) continue;
|
|
2093
2109
|
raised[name] = raiseContrast(value, against, HIGH_CONTRAST_RATIO);
|
|
@@ -2383,13 +2399,13 @@ function withDensity(theme, density) {
|
|
|
2383
2399
|
* application does anyway, since the setting it follows is a cell and
|
|
2384
2400
|
* both themes exist for the life of the application.
|
|
2385
2401
|
*/
|
|
2386
|
-
function withContrast(theme, contrast) {
|
|
2402
|
+
function withContrast(theme, contrast, options = {}) {
|
|
2387
2403
|
if (theme.contrast === contrast) return theme;
|
|
2388
2404
|
if (contrast === "standard") throw new Error("withContrast cannot lower a raised palette; keep the standard theme and derive the high one.");
|
|
2389
2405
|
return {
|
|
2390
2406
|
...theme,
|
|
2391
2407
|
contrast,
|
|
2392
|
-
colors: highContrastColors(theme.colors)
|
|
2408
|
+
colors: highContrastColors(theme.colors, options)
|
|
2393
2409
|
};
|
|
2394
2410
|
}
|
|
2395
2411
|
//#endregion
|
|
@@ -4117,7 +4133,8 @@ const UiProperties = {
|
|
|
4117
4133
|
defaultValue: void 0,
|
|
4118
4134
|
inherited: false,
|
|
4119
4135
|
affects: 261,
|
|
4120
|
-
compare: textSpansEqual
|
|
4136
|
+
compare: textSpansEqual,
|
|
4137
|
+
narrowEffects: (previous, next, flags) => spansDifferOnlyInPaint(previous, next) ? P : flags
|
|
4121
4138
|
}),
|
|
4122
4139
|
verticalAlign: defineProperty({
|
|
4123
4140
|
name: "verticalAlign",
|
|
@@ -4420,6 +4437,16 @@ const UiProperties = {
|
|
|
4420
4437
|
affects: S
|
|
4421
4438
|
}),
|
|
4422
4439
|
/**
|
|
4440
|
+
* Which way a tablist, toolbar, list or separator runs, when not the
|
|
4441
|
+
* way its role assumes: a column of tabs. See `aria-orientation`.
|
|
4442
|
+
*/
|
|
4443
|
+
orientation: defineProperty({
|
|
4444
|
+
name: "orientation",
|
|
4445
|
+
defaultValue: void 0,
|
|
4446
|
+
inherited: false,
|
|
4447
|
+
affects: S
|
|
4448
|
+
}),
|
|
4449
|
+
/**
|
|
4423
4450
|
* How deep a treeitem sits, 1 for a root. A tree is rendered as a
|
|
4424
4451
|
* flat list of rows — it must be, to be virtualized — so the nesting
|
|
4425
4452
|
* exists nowhere else for a reader to find.
|
|
@@ -6820,18 +6847,21 @@ function layoutParagraph(request, runs) {
|
|
|
6820
6847
|
start: paragraphStart,
|
|
6821
6848
|
text: paragraph,
|
|
6822
6849
|
segments: cached.segments,
|
|
6850
|
+
whole: cached.maxContentWidth,
|
|
6823
6851
|
cached
|
|
6824
6852
|
});
|
|
6825
6853
|
maxContentWidth = Math.max(maxContentWidth, cached.maxContentWidth);
|
|
6826
6854
|
minContentWidth = Math.max(minContentWidth, cached.minContentWidth);
|
|
6827
6855
|
} else {
|
|
6828
6856
|
const segments = segmentParagraph(paragraph, wrap);
|
|
6857
|
+
const whole = measure(paragraph, paragraphStart, paragraphEnd);
|
|
6829
6858
|
paragraphs.push({
|
|
6830
6859
|
start: paragraphStart,
|
|
6831
6860
|
text: paragraph,
|
|
6832
|
-
segments
|
|
6861
|
+
segments,
|
|
6862
|
+
whole
|
|
6833
6863
|
});
|
|
6834
|
-
maxContentWidth = Math.max(maxContentWidth,
|
|
6864
|
+
maxContentWidth = Math.max(maxContentWidth, whole);
|
|
6835
6865
|
for (const segment of segments) minContentWidth = Math.max(minContentWidth, measure(paragraph.slice(segment.start, segment.end), paragraphStart + segment.start, paragraphStart + segment.end));
|
|
6836
6866
|
}
|
|
6837
6867
|
if (paragraphEnd >= text.length) break;
|
|
@@ -6841,11 +6871,12 @@ function layoutParagraph(request, runs) {
|
|
|
6841
6871
|
const unwrapped = wrap === "none" || !isFinite(available);
|
|
6842
6872
|
const lines = [];
|
|
6843
6873
|
for (const paragraph of paragraphs) {
|
|
6874
|
+
const width = paragraph.whole <= available + FIT_EPSILON ? Infinity : available;
|
|
6844
6875
|
if (paragraph.cached !== void 0) {
|
|
6845
6876
|
const key = unwrapped ? -1 : available;
|
|
6846
6877
|
let relative = paragraph.cached.lines.get(key);
|
|
6847
6878
|
if (relative === void 0) {
|
|
6848
|
-
relative = breakHardLine(paragraph.text, paragraph.segments,
|
|
6879
|
+
relative = breakHardLine(paragraph.text, paragraph.segments, width, unwrapped, measure);
|
|
6849
6880
|
if (paragraph.cached.lines.size >= WIDTHS_PER_LINE) paragraph.cached.lines.clear();
|
|
6850
6881
|
paragraph.cached.lines.set(key, relative);
|
|
6851
6882
|
}
|
|
@@ -6859,7 +6890,7 @@ function layoutParagraph(request, runs) {
|
|
|
6859
6890
|
}
|
|
6860
6891
|
const before = lines.length;
|
|
6861
6892
|
if (unwrapped) pushLine(text, paragraph.text, paragraph.start, 0, paragraph.text.length, measure, spanned, lines);
|
|
6862
|
-
else breakGreedy(text, paragraph.text, paragraph.start, paragraph.segments,
|
|
6893
|
+
else breakGreedy(text, paragraph.text, paragraph.start, paragraph.segments, width, measure, spanned, lines);
|
|
6863
6894
|
if (lines.length === before) lines.push({
|
|
6864
6895
|
start: paragraph.start,
|
|
6865
6896
|
end: paragraph.start,
|
|
@@ -8435,8 +8466,12 @@ const drawStyle = {
|
|
|
8435
8466
|
function layoutTextLines(box, state, measurer) {
|
|
8436
8467
|
const text = state.text;
|
|
8437
8468
|
if (text === void 0 || text.length === 0 || state.fontSize <= 0) return [];
|
|
8438
|
-
|
|
8469
|
+
if (state.textOverflow === "ellipsis" && box.width <= 0) return [];
|
|
8470
|
+
const placements = placeLines(box, state, measurer.layout(textMeasureRequest(text, state, box)));
|
|
8471
|
+
return state.textOverflow === "ellipsis" ? placements.filter((placement) => placement.width <= box.width + FIT_TOLERANCE) : placements;
|
|
8439
8472
|
}
|
|
8473
|
+
/** How far past its box a line may measure and still be drawn: rounding, not overflow. */
|
|
8474
|
+
const FIT_TOLERANCE = .5;
|
|
8440
8475
|
/** The measure request paint makes for a node's text: the one layout made too. */
|
|
8441
8476
|
function textMeasureRequest(text, state, box) {
|
|
8442
8477
|
return {
|
|
@@ -12442,6 +12477,7 @@ var UiEditingController = class {
|
|
|
12442
12477
|
text: surface.text,
|
|
12443
12478
|
selectionStart: surface.selectionStart,
|
|
12444
12479
|
selectionEnd: surface.selectionEnd,
|
|
12480
|
+
...surface.selectionDirection === void 0 ? {} : { selectionDirection: surface.selectionDirection },
|
|
12445
12481
|
caret: this.drawnBox(node, surface.caret),
|
|
12446
12482
|
multiline: surface.multiline ?? true,
|
|
12447
12483
|
composing: this.surfaceComposition !== null,
|
|
@@ -13818,6 +13854,16 @@ var LayoutRecord = class {
|
|
|
13818
13854
|
*/
|
|
13819
13855
|
positioned = false;
|
|
13820
13856
|
absolute = false;
|
|
13857
|
+
/**
|
|
13858
|
+
* Absolute or sticky: where the node goes depends on more than its
|
|
13859
|
+
* parent's flow (its containing block, or the scroll), so it is never
|
|
13860
|
+
* a relayout boundary. A relative node is in flow and only drawn
|
|
13861
|
+
* offset, so one with a fixed size is: a change inside it is laid out
|
|
13862
|
+
* from it, as from any other.
|
|
13863
|
+
*/
|
|
13864
|
+
get displaced() {
|
|
13865
|
+
return this.absolute || this.sticky;
|
|
13866
|
+
}
|
|
13821
13867
|
top = void 0;
|
|
13822
13868
|
right = void 0;
|
|
13823
13869
|
bottom = void 0;
|
|
@@ -15427,7 +15473,7 @@ var LayoutEngine = class {
|
|
|
15427
15473
|
for (;;) {
|
|
15428
15474
|
if (current === this.layoutRoot || current.parent === null) break;
|
|
15429
15475
|
const cRec = this.records.get(current);
|
|
15430
|
-
if (current !== node && cRec?.relayoutBoundary && !cRec.
|
|
15476
|
+
if (current !== node && cRec?.relayoutBoundary && !cRec.displaced) break;
|
|
15431
15477
|
current = current.parent;
|
|
15432
15478
|
depth++;
|
|
15433
15479
|
}
|
|
@@ -16090,7 +16136,7 @@ var LayoutEngine = class {
|
|
|
16090
16136
|
const explicitBoth = this.lengthProp(placement.item, "width", void 0) !== void 0 && this.lengthProp(placement.item, "height", void 0) !== void 0;
|
|
16091
16137
|
cRec.contentMatters = gridRec.contentMatters || !explicitBoth;
|
|
16092
16138
|
this.measure(placement.item, new Constraints(0, Infinity, 0, Infinity));
|
|
16093
|
-
cRec.relayoutBoundary = explicitBoth && !cRec.contentMatters && cRec.aspectRatio === void 0 && !cRec.
|
|
16139
|
+
cRec.relayoutBoundary = explicitBoth && !cRec.contentMatters && cRec.aspectRatio === void 0 && !cRec.displaced;
|
|
16094
16140
|
const marginH = cRec.marginLeft + cRec.marginRight;
|
|
16095
16141
|
const contribution = {
|
|
16096
16142
|
min: this.minContentContribution(placement.item, cRec) + marginH,
|
|
@@ -16411,7 +16457,7 @@ var LayoutEngine = class {
|
|
|
16411
16457
|
} else minMain = row ? cRec.minWidth : cRec.minHeight;
|
|
16412
16458
|
const basis = this.flexBasis(child, cRec, mainBase);
|
|
16413
16459
|
const baseMain = basis ?? measuredMain;
|
|
16414
|
-
const sizeFree = (explicitMain !== void 0 || basis !== void 0 && !minFromContent) && (explicitCross || align === 3 && crossTightForStretch) && cRec.aspectRatio === void 0 && !cRec.
|
|
16460
|
+
const sizeFree = (explicitMain !== void 0 || basis !== void 0 && !minFromContent) && (explicitCross || align === 3 && crossTightForStretch) && cRec.aspectRatio === void 0 && !cRec.displaced;
|
|
16415
16461
|
const physicalStart = row ? cRec.marginLeft : cRec.marginTop;
|
|
16416
16462
|
const physicalEnd = row ? cRec.marginRight : cRec.marginBottom;
|
|
16417
16463
|
const physicalStartAuto = row ? cRec.marginLeftAuto : cRec.marginTopAuto;
|
|
@@ -16808,7 +16854,7 @@ var LayoutEngine = class {
|
|
|
16808
16854
|
const stretchY = definiteHeight !== void 0 && this.stackAlignment(child, "selfY", "height", stackY) === 3;
|
|
16809
16855
|
cRec.contentMatters = rec.contentMatters;
|
|
16810
16856
|
this.measure(child, this.stackQuestion(cRec, content, stretchX, stretchY));
|
|
16811
|
-
cRec.relayoutBoundary = (explicitWidth || stretchX) && (explicitHeight || stretchY) && cRec.aspectRatio === void 0 && !cRec.
|
|
16857
|
+
cRec.relayoutBoundary = (explicitWidth || stretchX) && (explicitHeight || stretchY) && cRec.aspectRatio === void 0 && !cRec.displaced && !cRec.contentMatters;
|
|
16812
16858
|
maxWidth = Math.max(maxWidth, cRec.outerWidth);
|
|
16813
16859
|
maxHeight = Math.max(maxHeight, cRec.outerHeight);
|
|
16814
16860
|
minContent = Math.max(minContent, this.minContentContribution(child, cRec) + cRec.marginLeft + cRec.marginRight);
|
|
@@ -16872,7 +16918,7 @@ var LayoutEngine = class {
|
|
|
16872
16918
|
const childBase = vertical ? new Constraints(crossTight ? crossLimit : 0, crossLimit, 0, Infinity) : new Constraints(0, Infinity, crossTight ? crossLimit : 0, crossLimit);
|
|
16873
16919
|
cRec.contentMatters = contentMatters;
|
|
16874
16920
|
this.measure(child, childBase);
|
|
16875
|
-
cRec.relayoutBoundary = explicitMain !== void 0 && (explicitCross || crossTight) && cRec.aspectRatio === void 0 && !cRec.
|
|
16921
|
+
cRec.relayoutBoundary = explicitMain !== void 0 && (explicitCross || crossTight) && cRec.aspectRatio === void 0 && !cRec.displaced;
|
|
16876
16922
|
const measuredMain = vertical ? cRec.measuredHeight : cRec.measuredWidth;
|
|
16877
16923
|
const measuredCross = vertical ? cRec.measuredWidth : cRec.measuredHeight;
|
|
16878
16924
|
const marginMain = vertical ? cRec.marginTop + cRec.marginBottom : cRec.marginLeft + cRec.marginRight;
|
|
@@ -17165,7 +17211,7 @@ var LayoutEngine = class {
|
|
|
17165
17211
|
this.trackAnchor(child, null);
|
|
17166
17212
|
this.absoluteBlocks.set(child, block);
|
|
17167
17213
|
this.measure(child, new Constraints(0, Math.max(0, block.width), 0, Math.max(0, block.height)));
|
|
17168
|
-
this.placeBeside(child, cRec, block.x + point.x, block.y + point.y, 0, 0, block);
|
|
17214
|
+
this.placeBeside(child, cRec, block.x + point.x, block.y + point.y, 0, 0, block, true);
|
|
17169
17215
|
return;
|
|
17170
17216
|
} else {
|
|
17171
17217
|
this.anchoredNodes.delete(child);
|
|
@@ -17257,33 +17303,82 @@ var LayoutEngine = class {
|
|
|
17257
17303
|
* no size — flipping to the opposite side when the named one would
|
|
17258
17304
|
* overflow the block and the other has more room, and clamping along
|
|
17259
17305
|
* the side to stay inside it.
|
|
17260
|
-
|
|
17261
|
-
|
|
17262
|
-
|
|
17263
|
-
|
|
17306
|
+
*
|
|
17307
|
+
* **A node taller than the room on its side is measured again into
|
|
17308
|
+
* that room.** Flipping picks the side with more space, and that was
|
|
17309
|
+
* all it did: a thirty-command Format menu under a title 44 pixels
|
|
17310
|
+
* down ran off the bottom of an 813-pixel window, and a 424-pixel
|
|
17311
|
+
* context menu opened at y 410 flipped above the point and started
|
|
17312
|
+
* at -14, its first rows off the top of the screen. Neither could be
|
|
17313
|
+
* scrolled, because nothing ever told the menu it had less height
|
|
17314
|
+
* than it asked for.
|
|
17315
|
+
*
|
|
17316
|
+
* The room is a loose bound and not a smaller painted rect, so it
|
|
17317
|
+
* reaches the node's layout the way a `maxHeight` would: a scroller
|
|
17318
|
+
* inside it is offered the height that is left and scrolls the rest,
|
|
17319
|
+
* a scroll view is capped at it, and a plain column, which cannot
|
|
17320
|
+
* shrink, still overflows as it always did. The side was chosen on
|
|
17321
|
+
* the height asked for, before the cap, so a menu that fits on
|
|
17322
|
+
* neither side still opens on the roomier one.
|
|
17323
|
+
*
|
|
17324
|
+
* A node placed at a `point` slides instead, when it fits in the block
|
|
17325
|
+
* at all: a context menu that has room on neither side of the pointer
|
|
17326
|
+
* opens on the side asked for and moves back over the pointer until
|
|
17327
|
+
* it is inside, whole, as a native one does, rather than being
|
|
17328
|
+
* cut short and made to scroll with half the screen free. Covering a
|
|
17329
|
+
* point hides nothing; covering an anchor would hide the very title
|
|
17330
|
+
* or button the panel belongs to, so an anchored node is capped.
|
|
17331
|
+
*
|
|
17332
|
+
* An anchored node that still does not fit, because what it holds
|
|
17333
|
+
* cannot shrink, is kept from starting before the block's edge, so
|
|
17334
|
+
* its first rows are on the screen; it is not pushed back over its
|
|
17335
|
+
* anchor, and runs past the far edge as it always did. A node that
|
|
17336
|
+
* fits is placed exactly as before, against an anchor scrolled out
|
|
17337
|
+
* of view included: a tooltip follows its anchor off the screen
|
|
17338
|
+
* rather than sticking to the edge without it.
|
|
17339
|
+
*/
|
|
17340
|
+
placeBeside(child, cRec, ax, ay, aw, ah, block, point = false) {
|
|
17341
|
+
let width = cRec.measuredWidth;
|
|
17342
|
+
let height = cRec.measuredHeight;
|
|
17264
17343
|
const gap = this.numberProp(child, "anchorOffset") ?? 0;
|
|
17265
17344
|
const { side, align } = this.parsePlacement(child.properties.get("placement"));
|
|
17266
17345
|
const vertical = side === "top" || side === "bottom";
|
|
17267
17346
|
let resolvedSide = side;
|
|
17347
|
+
let room;
|
|
17268
17348
|
if (vertical) {
|
|
17269
17349
|
const roomBelow = block.y + block.height - (ay + ah + gap);
|
|
17270
17350
|
const roomAbove = ay - gap - block.y;
|
|
17271
17351
|
if (side === "bottom" && height > roomBelow && roomAbove > roomBelow) resolvedSide = "top";
|
|
17272
17352
|
else if (side === "top" && height > roomAbove && roomBelow > roomAbove) resolvedSide = "bottom";
|
|
17353
|
+
room = resolvedSide === "bottom" ? roomBelow : roomAbove;
|
|
17273
17354
|
} else {
|
|
17274
17355
|
const roomRight = block.x + block.width - (ax + aw + gap);
|
|
17275
17356
|
const roomLeft = ax - gap - block.x;
|
|
17276
17357
|
if (side === "right" && width > roomRight && roomLeft > roomRight) resolvedSide = "left";
|
|
17277
17358
|
else if (side === "left" && width > roomLeft && roomRight > roomLeft) resolvedSide = "right";
|
|
17359
|
+
room = resolvedSide === "right" ? roomRight : roomLeft;
|
|
17360
|
+
}
|
|
17361
|
+
const overflows = (vertical ? height : width) > room;
|
|
17362
|
+
const slides = overflows && point && (vertical ? height <= block.height : width <= block.width);
|
|
17363
|
+
if (slides) resolvedSide = side;
|
|
17364
|
+
else if (overflows) {
|
|
17365
|
+
const limit = Math.max(0, room);
|
|
17366
|
+
this.measure(child, vertical ? new Constraints(0, Math.max(0, block.width), 0, limit) : new Constraints(0, limit, 0, Math.max(0, block.height)));
|
|
17367
|
+
width = cRec.measuredWidth;
|
|
17368
|
+
height = cRec.measuredHeight;
|
|
17278
17369
|
}
|
|
17279
17370
|
let x;
|
|
17280
17371
|
let y;
|
|
17281
17372
|
if (vertical) {
|
|
17282
17373
|
y = resolvedSide === "bottom" ? ay + ah + gap : ay - gap - height;
|
|
17374
|
+
if (slides) y = this.clamp(y, block.y, Math.max(block.y, block.y + block.height - height));
|
|
17375
|
+
else if (overflows) y = Math.max(y, block.y);
|
|
17283
17376
|
x = align === "start" ? ax : align === "end" ? ax + aw - width : ax + (aw - width) / 2;
|
|
17284
17377
|
x = this.clamp(x, block.x, Math.max(block.x, block.x + block.width - width));
|
|
17285
17378
|
} else {
|
|
17286
17379
|
x = resolvedSide === "right" ? ax + aw + gap : ax - gap - width;
|
|
17380
|
+
if (slides) x = this.clamp(x, block.x, Math.max(block.x, block.x + block.width - width));
|
|
17381
|
+
else if (overflows) x = Math.max(x, block.x);
|
|
17287
17382
|
y = align === "start" ? ay : align === "end" ? ay + ah - height : ay + (ah - height) / 2;
|
|
17288
17383
|
y = this.clamp(y, block.y, Math.max(block.y, block.y + block.height - height));
|
|
17289
17384
|
}
|
|
@@ -17819,7 +17914,7 @@ var LayoutEngine = class {
|
|
|
17819
17914
|
if (!bounded) this.relayoutRoots.add(this.layoutRoot ?? current);
|
|
17820
17915
|
return;
|
|
17821
17916
|
}
|
|
17822
|
-
if (!bounded && rec?.relayoutBoundary && !rec.
|
|
17917
|
+
if (!bounded && rec?.relayoutBoundary && !rec.displaced && (current !== node || selfCanBound)) {
|
|
17823
17918
|
this.relayoutRoots.add(current);
|
|
17824
17919
|
/**
|
|
17825
17920
|
* The boundary is where the *relayout* starts, and the walk
|
|
@@ -21417,6 +21512,6 @@ function createCanvasSurface(host) {
|
|
|
21417
21512
|
return new CanvasSurface(host);
|
|
21418
21513
|
}
|
|
21419
21514
|
//#endregion
|
|
21420
|
-
export { isImeKey as $,
|
|
21515
|
+
export { isImeKey as $, UiCompositionEvent as $a, defaultShadows as $i, proportionalFontMetrics as $n, gradientPaint as $r, registerFontStack as $t, withOverrideSource as A, colorValuesEqual as Aa, bandOf as Ai, linkHoverOf as An, propertyIsInherited as Ar, adjacentField as At, FlexDirection as B, DirtyNodeSet as Ba, noThemeExtensions as Bi, isEditableNode as Bn, validateRole as Br, createCanvasTextStyle as Bt, SCROLLBAR_LINGER_MS as C, textStylesEqual as Ca, propertyValuesEqual as Ci, isNodeInert as Cn, resolveString as Cr, hasDrawnText as Ct, formatExplanation as D, UiBasicColors as Da, noInsets as Di, resolveCursor as Dn, inheritedPropertyFlags as Dr, selectionRectsIn as Dt, formatConstraints as E, lightColors as Ea, insetsEqual as Ei, isPressable as En, getPropertyNames as Er, paragraphGeometryFrom as Et, clampSize as F, rgba as Fa, themesEqual as Fi, CARET_WIDTH as Fn, UI_SEMANTIC_STATES as Fr, detectEditingPlatform as Ft, CrossAxisAlignment as G, writeOverrideProperty as Ga, highContrastColors as Gi, resolveColorValue as Gn, paintValuesEqual as Gr, runFontString as Gt, placeGridItems as H, overrideSources as Ha, themeExtensionsEqual as Hi, isReadOnly as Hn, UI_SUBGRID_AXES as Hr, fillTextRects as Ht, constraintsEqual as I, createEnvironmentKey as Ia, withContrast as Ii, EDITOR_PROP as In, isUiRole as Ir, isPrintable as It, parseCrossAxisAlignment as J, hasVisualState as Ja, densityFactors as Ji, CharacterCountTextMeasurer as Jn, parseTransform as Jr, textRunBackgrounds as Jt, MainAxisAlignment as K, UiVisualState as Ka, raiseContrast as Ki, isVideoSurface as Kn, pathValuesEqual as Kr, spanOf as Kt, tightenConstraints as L, findEnvironmentKey as La, withDensity as Li, caretVisibleAt as Ln, isUiSemanticState as Lr, EditableLayout as Lt, contentOffset as M, normalizeColor as Ma, unknownContainerSize as Mi, linkRunAtPointIn as Mn, propertyValuesEqualByName as Mr, edgeField as Mt, LayoutRecord as N, parseColor as Na, darkTheme as Ni, setLinkHover as Nn, UiProperties as Nr, editingGroupOf as Nt, formatNumber as O, colorToHex as Oa, observeViewportInsets as Oi, clearLinkHover as On, inheritedPropertyNames as Or, wordRangeIn as Ot, Constraints as P, rgb8 as Pa, lightTheme as Pi, CARET_BLINK_MS as Pn, UI_ROLES as Pr, commandForKey as Pt, capturePointer as Q, UiBeforeInputEvent as Qa, spacingSteps as Qi, layoutParagraph as Qn, MAX_GRADIENT_STOPS as Qr, fontStackFor as Qt, MAX_MEASURES_PER_CHILD as R, UiEnvironment as Ra, defineThemeExtension as Ri, editorFor as Rn, normalizeStates as Rr, applyCanvasTextStyle as Rt, SCROLLBAR_FADE_MS as S, textSpansEqual as Sa, defineProperty as Si, isNodeHitTestable as Sn, resolvePropertyByName as Sr, UiInputDispatcher as St, describeOverrides as T, darkColors as Ta, UiInsetRegistry as Ti, isNodeTabStop as Tn, findPropertyDefinition as Tr, paragraphGeometry as Tt, sizeGridTracks as U, resetOverrideWarnings as Ua, withThemeExtension as Ui, nextCaretToggle as Un, validateSubgrid as Ur, layoutTextLines as Ut, parseFlexDirection as V, clearOverrideProperty as Va, themeExtension as Vi, isMultiline as Vn, validateStates as Vr, drawText as Vt, AlignContent as W, writeDeclaredProperty as Wa, contrastRatio as Wi, syncEditorValue as Wn, inputsEqual as Wr, runCanvasStyleInto as Wt, CanvasPlatformSurface as X, visualStatesEqual as Xa, scaleSpacing as Xi, spannedRunsFor as Xn, transformIsIdentity as Xr, bumpFontStack as Xt, parseMainAxisAlignment as Y, visualState as Ya, defaultSpacing as Yi, ParagraphTextMeasurer as Yn, transform as Yr, textRunDecorations as Yt, UiPlatformAdapter as Z, MOUSE_POINTER as Za, spacingEqual as Zi, ELLIPSIS as Zn, transformsEqual as Zr, clearFontStacks as Zt, LABEL_PADDING_X as _, resolvedSpansOf as _a, borderRadiusEqual as _i, selectableTextNodes as _n, UiGraph as _r, scrollLeaderOf as _t, PaintPictureCache as a, boxShadowReach as aa, fr as ai, computeObjectFitRect as an, UiPasteEvent as ao, offsetAtX as ar, UiGestureRecognizer as at, snapScroll as b, spansDifferOnlyInPaint as ba, normalizeBorderRadius as bi, setSelectionRange as bn, resolveNumber as br, scrollbarThumbs as bt, EMPTY_RECORDING as c, isShapeName as ca, isMinMaxTrack as ci, normalizeTextAlign as cn, UiSelectionChangeEvent as co, EditableTextModel as cr, isScrollContainer as ct, tracePathData as d, isTypographyRole as da, percent as di, TEXT_MATCHES_PROP as dn, UiWheelEvent as do, lineStartAt as dr, UiFocusManager as dt, shadowsEqual as ea, gradientsEqual as ei, DEFAULT_FONT_FAMILY as en, UiEventType as eo, caretRectFor as er, pointerDeviceOf as et, ScaledImageCache as f, typographyEqual as fa, repeat as fi, clearMatchRanges as fn, noKeyModifiers as fo, nextGraphemeEnd as fr, UiHitTester as ft, paintsAfterChildren as g, hiddenRangesOf as ga, borderRadiusCorners as gi, clearSelectionRange as gn, UiBinding as go, wordRangeAt as gr, SCROLLBAR_THICKNESS as gt, hasDecorationPhase as h, flattenTextSpans as ha, borderRadius as hi, TEXT_SELECTION_PROP as hn, DirtyFlags as ho, previousWordStart as hr, SCROLLBAR_MIN_THUMB as ht, traceRoundedRect as i, boxShadowRadius as ia, auto as ii, colorToCss as in, UiKeyboardEvent as io, offsetAtPoint as ir, UiTouchScroller as it, accumulatedOffsetTo as j, colorsEqual as ja, containerBands as ji, linkOf as jn, propertyNarrowers as jr, comparePositions as jt, labelNode as k, colorToRgba as ka, UiContainerSizeSource as ki, hasTextLinks as kn, propertyEffects as kr, textInputOf as kt, PaintRecorder as l, shapesEqual as la, isPercentLength as li, normalizeVerticalAlign as ln, UiTextChangeEvent as lo, graphemeBoundaries as lr, UiKeyboardController as lt, decorationRect as m, editableSpansOf as ma, UiBorderRadiuses as mi, setMatchRanges as mn, UiNodeType as mo, previousGraphemeStart as mr, SCROLLBAR_INSET as mt, createCanvasSurface as n, boxShadow as na, radialGradient as ni, DEFAULT_FONT_WEIGHT as nn, UiGestureEvent as no, lineIndexForOffset as nr, touchActionFor as nt, paintPictures as o, boxShadowsEqual as oa, isAutoLength as oi, createPaintState as on, UiPinchEvent as oo, offsetForVerticalMove as or, UiPinchRecognizer as ot, decorationColor as p, defaultTextStyle as pa, resolveLength as pi, matchRangesOf as pn, wheelDeltaYOf as po, nextWordEnd as pr, SCROLLBAR_HOVER_ZONE as pt, parseAlignContent as q, defaultVisualState as qa, relativeLuminance as qi, videoFrameSize as qn, UiTransforms as qr, textMeasureRequest as qt, Canvas2DRenderer as r, boxShadowArraysEqual as ra, validateGradient as ri, DEFAULT_TEXT_COLOR as rn, UiInputEvent as ro, lineLimit as rr, UiEditingController as rt, PaintTarget as s, defaultShapes as sa, isFrLength as si, isPaintVisible as sn, UiPointerEvent as so, selectionRects as sr, UiWheelController as st, CanvasSurface as t, BOX_SHADOW_BLUR_REACH as ta, linearGradient as ti, DEFAULT_FONT_SIZE as tn, UiFocusEvent as to, lineIndexAtY as tr, prepareInputSurface as tt, replayPaint as u, defaultTypography as ua, minmax as ui, resolvePaintState as un, UiWheelDeltaMode as uo, lineEndAt as ur, UiPointerController as ut, drawOverlayShapes as v, spanAtOffset as va, borderRadiusIsZero as vi, selectableTextOf as vn, DEFAULT_LINE_HEIGHT_FACTOR as vr, scrollRange as vt, describeLength as w, colorsEqualPalette as wa, UiEnvironmentKeys as wi, isNodeSelectable as wn, closestPropertyName as wr, offsetAtPointIn as wt, LayoutEngine as x, textContentOf as xa, uniformBorderRadius as xi, isNodeFocusable as xn, resolveProperty as xr, scrollbarZoneAt as xt, labelOrigin as y, spannedTextOf as ya, borderRadiusValuesEqual as yi, selectionRangeOf as yn, resolveBoolean as yr, scrollbarThumb as yt, isLayoutProtocol as z, UiNode as za, hasThemeExtension as zi, editorOf as zn, statesEqual as zr, buildFontString as zt };
|
|
21421
21516
|
|
|
21422
|
-
//# sourceMappingURL=CanvasSurface-
|
|
21517
|
+
//# sourceMappingURL=CanvasSurface-BSvtTgJZ.js.map
|