gesso-core 0.6.21 → 0.6.22

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # gesso-core
2
2
 
3
+ ## 0.6.22
4
+
5
+ ### Patch Changes
6
+
7
+ - 02f186e: A scroll layer repaints a sticky node where a scroll carried it and where it sticks, so a spreadsheet's sticky header row and gutter no longer leave copies of themselves over the rows after scrolling down and back up. `LayoutEngine` gains `allStickyNodes()`, which `LayoutReader` may offer as well; a reader without it repaints a scroll layer whole every frame.
8
+
3
9
  ## 0.6.21
4
10
 
5
11
  ### Patch Changes
@@ -15499,6 +15499,14 @@ var LayoutEngine = class {
15499
15499
  return this.records.get(node);
15500
15500
  }
15501
15501
  /**
15502
+ * Every `position: 'sticky'` node in the tree. A sticky node moves
15503
+ * with a scroll without its box moving, so a renderer keeping a
15504
+ * scroll container's pixels has to be told where they are.
15505
+ */
15506
+ allStickyNodes() {
15507
+ return this.stickyNodes;
15508
+ }
15509
+ /**
15502
15510
  * A box around everything in a node's subtree that could take a
15503
15511
  * point, so a hit test can pass the subtree over instead of
15504
15512
  * descending into it. Undefined for a node with no record, and
@@ -20901,7 +20909,8 @@ var ScrollLayerCache = class {
20901
20909
  scrollX: snapScroll(rec.scrollX, this.dpr),
20902
20910
  scrollY: snapScroll(rec.scrollY, this.dpr),
20903
20911
  used: true,
20904
- items: /* @__PURE__ */ new Map()
20912
+ items: /* @__PURE__ */ new Map(),
20913
+ stuck: /* @__PURE__ */ new Map()
20905
20914
  };
20906
20915
  this.layers.set(node, layer);
20907
20916
  this.stats.built++;
@@ -21001,6 +21010,14 @@ var ScrollLayerCache = class {
21001
21010
  else if (!sameBox(was, now)) boxes.push(was, now);
21002
21011
  }
21003
21012
  for (const [item, was] of layer.items) if (!seen.has(item)) boxes.push(was);
21013
+ const stuck = stuckIn(container, layout);
21014
+ if (stuck === null) return "all";
21015
+ for (const [node, now] of stuck) {
21016
+ const was = layer.stuck.get(node);
21017
+ if (was === void 0) boxes.push(now);
21018
+ else if (!sameBox(was, now)) boxes.push(was, now);
21019
+ }
21020
+ for (const [node, was] of layer.stuck) if (!stuck.has(node)) boxes.push(was);
21004
21021
  const rects = [];
21005
21022
  let area = 0;
21006
21023
  for (const box of boxes) {
@@ -21019,6 +21036,7 @@ var ScrollLayerCache = class {
21019
21036
  const box = boxOf(layout, item);
21020
21037
  if (box !== void 0) layer.items.set(item, box);
21021
21038
  }
21039
+ layer.stuck = stuckIn(container, layout) ?? /* @__PURE__ */ new Map();
21022
21040
  }
21023
21041
  /** An item's box in the layer's pixels, widened for what paints past it, or null off the layer. */
21024
21042
  toLayer(layer, box) {
@@ -21099,6 +21117,42 @@ function itemHolding(container, node) {
21099
21117
  }
21100
21118
  return null;
21101
21119
  }
21120
+ /**
21121
+ * Where each sticky node inside a container is drawn, in the
21122
+ * container's children's coordinates: its box moved by its own shift
21123
+ * and by every sticky ancestor's up to the container. Null when the
21124
+ * reader cannot say which nodes are sticky, which no layer can survive.
21125
+ */
21126
+ function stuckIn(container, layout) {
21127
+ const sticky = layout.allStickyNodes?.();
21128
+ if (sticky === void 0) return null;
21129
+ const drawn = /* @__PURE__ */ new Map();
21130
+ for (const node of sticky) {
21131
+ const rec = layout.recordFor(node);
21132
+ if (rec === void 0) continue;
21133
+ let x = rec.x + rec.stickyOffsetX;
21134
+ let y = rec.y + rec.stickyOffsetY;
21135
+ let inside = false;
21136
+ for (let current = node.parent; current !== null; current = current.parent) {
21137
+ if (current === container) {
21138
+ inside = true;
21139
+ break;
21140
+ }
21141
+ const above = layout.recordFor(current);
21142
+ if (above !== void 0) {
21143
+ x += above.stickyOffsetX;
21144
+ y += above.stickyOffsetY;
21145
+ }
21146
+ }
21147
+ if (inside) drawn.set(node, {
21148
+ x,
21149
+ y,
21150
+ width: rec.width,
21151
+ height: rec.height
21152
+ });
21153
+ }
21154
+ return drawn;
21155
+ }
21102
21156
  function sameBox(a, b) {
21103
21157
  return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
21104
21158
  }
@@ -22335,4 +22389,4 @@ function createCanvasSurface(host) {
22335
22389
  //#endregion
22336
22390
  export { isImeKey as $, visualStatesEqual as $a, scaleSpacing as $i, spannedRunsFor as $n, transformIsIdentity as $r, registerFontStack as $t, withOverrideSource as A, UiBasicColors as Aa, noInsets as Ai, clearLinkHover as An, inheritedPropertyFlags as Ar, adjacentField as At, FlexDirection as B, findEnvironmentKey as Ba, withDensity as Bi, editorFor as Bn, isUiSemanticState as Br, createCanvasTextStyle as Bt, SCROLLBAR_LINGER_MS as C, spansDifferOnlyInPaint as Ca, normalizeBorderRadius as Ci, isNodeInert as Cn, resolveNumber as Cr, hasDrawnText as Ct, formatExplanation as D, colorsEqualPalette as Da, UiEnvironmentKeys as Di, isSubtreeInert as Dn, closestPropertyName as Dr, selectionRectsIn as Dt, formatConstraints as E, textStylesEqual as Ea, propertyValuesEqual as Ei, isPressable as En, resolveString as Er, paragraphGeometryFrom as Et, clampSize as F, normalizeColor as Fa, unknownContainerSize as Fi, setLinkHover as Fn, propertyValuesEqualByName as Fr, detectEditingPlatform as Ft, CrossAxisAlignment as G, overrideSources as Ga, themeExtensionsEqual as Gi, maskText as Gn, UI_SUBGRID_AXES as Gr, runFontString as Gt, placeGridItems as H, UiNode as Ha, hasThemeExtension as Hi, isEditableNode as Hn, statesEqual as Hr, fillTextRects as Ht, constraintsEqual as I, parseColor as Ia, darkTheme as Ii, CARET_BLINK_MS as In, UiProperties as Ir, isPrintable as It, parseCrossAxisAlignment as J, writeOverrideProperty as Ja, highContrastColors as Ji, resolveColorValue as Jn, paintValuesEqual as Jr, textRunBackgrounds as Jt, MainAxisAlignment as K, resetOverrideWarnings as Ka, withThemeExtension as Ki, nextCaretToggle as Kn, validateSubgrid as Kr, spanOf as Kt, tightenConstraints as L, rgb8 as La, lightTheme as Li, CARET_WIDTH as Ln, UI_ROLES as Lr, EditableLayout as Lt, contentOffset as M, colorToRgba as Ma, UiContainerSizeSource as Mi, linkHoverOf as Mn, propertyEffects as Mr, edgeField as Mt, LayoutRecord as N, colorValuesEqual as Na, bandOf as Ni, linkOf as Nn, propertyIsInherited as Nr, editingGroupOf as Nt, formatNumber as O, darkColors as Oa, UiInsetRegistry as Oi, pointerEventsOf as On, findPropertyDefinition as Or, wordRangeIn as Ot, Constraints as P, colorsEqual as Pa, containerBands as Pi, linkRunAtPointIn as Pn, propertyNarrowers as Pr, commandForKey as Pt, capturePointer as Q, visualState as Qa, defaultSpacing as Qi, ParagraphTextMeasurer as Qn, transform as Qr, fontStackFor as Qt, MAX_MEASURES_PER_CHILD as R, rgba as Ra, themesEqual as Ri, EDITOR_PROP as Rn, UI_SEMANTIC_STATES as Rr, applyCanvasTextStyle as Rt, SCROLLBAR_FADE_MS as S, spannedTextOf as Sa, borderRadiusValuesEqual as Si, isNodeHitTestable as Sn, resolveBoolean as Sr, UiInputDispatcher as St, describeOverrides as T, textSpansEqual as Ta, defineProperty as Ti, isNodeTabStop as Tn, resolvePropertyByName as Tr, paragraphGeometry as Tt, sizeGridTracks as U, DirtyNodeSet as Ua, noThemeExtensions as Ui, isMultiline as Un, validateRole as Ur, layoutTextLines as Ut, parseFlexDirection as V, UiEnvironment as Va, defineThemeExtension as Vi, editorOf as Vn, normalizeStates as Vr, drawText as Vt, AlignContent as W, clearOverrideProperty as Wa, themeExtension as Wi, isReadOnly as Wn, validateStates as Wr, runCanvasStyleInto as Wt, CanvasPlatformSurface as X, defaultVisualState as Xa, relativeLuminance as Xi, videoFrameSize as Xn, UiTransforms as Xr, bumpFontStack as Xt, parseMainAxisAlignment as Y, UiVisualState as Ya, raiseContrast as Yi, isVideoSurface as Yn, pathValuesEqual as Yr, textRunDecorations as Yt, UiPlatformAdapter as Z, hasVisualState as Za, densityFactors as Zi, CharacterCountTextMeasurer as Zn, parseTransform as Zr, clearFontStacks as Zt, LABEL_PADDING_X as _, editableSpansOf as _a, UiBorderRadiuses as _i, selectableTextNodes as _n, UiNodeType as _o, previousGraphemeStart as _r, scrollLeaderOf as _t, PaintPictureCache as a, boxShadow as aa, radialGradient as ai, computeObjectFitRect as an, UiGestureEvent as ao, lineIndexForOffset as ar, UiGestureRecognizer as at, snapScroll as b, resolvedSpansOf as ba, borderRadiusEqual as bi, setSelectionRange as bn, UiGraph as br, scrollbarThumbs as bt, EMPTY_RECORDING as c, boxShadowReach as ca, fr as ci, normalizeTextAlign as cn, UiPasteEvent as co, offsetAtX as cr, isScrollContainer as ct, tracePathData as d, isShapeName as da, isMinMaxTrack as di, TEXT_MATCHES_PROP as dn, UiSelectionChangeEvent as do, EditableTextModel as dr, UiFocusManager as dt, spacingEqual as ea, transformsEqual as ei, DEFAULT_FONT_FAMILY as en, MOUSE_POINTER as eo, ELLIPSIS as er, pointerDeviceOf as et, ScaledImageCache as f, shapesEqual as fa, isPercentLength as fi, clearMatchRanges as fn, UiTextChangeEvent as fo, graphemeBoundaries as fr, UiHitTester as ft, paintsAfterChildren as g, defaultTextStyle as ga, resolveLength as gi, clearSelectionRange as gn, wheelDeltaYOf as go, nextWordEnd as gr, SCROLLBAR_THICKNESS as gt, hasDecorationPhase as h, typographyEqual as ha, repeat as hi, TEXT_SELECTION_PROP as hn, noKeyModifiers as ho, nextGraphemeEnd as hr, SCROLLBAR_MIN_THUMB as ht, traceRoundedRect as i, BOX_SHADOW_BLUR_REACH as ia, linearGradient as ii, colorToCss as in, UiFocusEvent as io, lineIndexAtY as ir, UiTouchScroller as it, accumulatedOffsetTo as j, colorToHex as ja, observeViewportInsets as ji, hasTextLinks as jn, inheritedPropertyNames as jr, comparePositions as jt, labelNode as k, lightColors as ka, insetsEqual as ki, resolveCursor as kn, getPropertyNames as kr, textInputOf as kt, PaintRecorder as l, boxShadowsEqual as la, isAutoLength as li, normalizeVerticalAlign as ln, UiPinchEvent as lo, offsetForVerticalMove as lr, UiKeyboardController as lt, decorationRect as m, isTypographyRole as ma, percent as mi, setMatchRanges as mn, UiWheelEvent as mo, lineStartAt as mr, SCROLLBAR_INSET as mt, createCanvasSurface as n, defaultShadows as na, gradientPaint as ni, DEFAULT_FONT_WEIGHT as nn, UiCompositionEvent as no, proportionalFontMetrics as nr, touchActionFor as nt, paintPictures as o, boxShadowArraysEqual as oa, validateGradient as oi, createPaintState as on, UiInputEvent as oo, lineLimit as or, UiPinchRecognizer as ot, decorationColor as p, defaultTypography as pa, minmax as pi, matchRangesOf as pn, UiWheelDeltaMode as po, lineEndAt as pr, SCROLLBAR_HOVER_ZONE as pt, parseAlignContent as q, writeDeclaredProperty as qa, contrastRatio as qi, syncEditorValue as qn, inputsEqual as qr, textMeasureRequest as qt, Canvas2DRenderer as r, shadowsEqual as ra, gradientsEqual as ri, DEFAULT_TEXT_COLOR as rn, UiEventType as ro, caretRectFor as rr, UiEditingController as rt, PaintTarget as s, boxShadowRadius as sa, auto as si, isPaintVisible as sn, UiKeyboardEvent as so, offsetAtPoint as sr, UiWheelController as st, CanvasSurface as t, spacingSteps as ta, MAX_GRADIENT_STOPS as ti, DEFAULT_FONT_SIZE as tn, UiBeforeInputEvent as to, layoutParagraph as tr, prepareInputSurface as tt, replayPaint as u, defaultShapes as ua, isFrLength as ui, resolvePaintState as un, UiPointerEvent as uo, selectionRects as ur, UiPointerController as ut, drawOverlayShapes as v, flattenTextSpans as va, borderRadius as vi, selectableTextOf as vn, DirtyFlags as vo, previousWordStart as vr, scrollRange as vt, describeLength as w, textContentOf as wa, uniformBorderRadius as wi, isNodeSelectable as wn, resolveProperty as wr, offsetAtPointIn as wt, LayoutEngine as x, spanAtOffset as xa, borderRadiusIsZero as xi, isNodeFocusable as xn, DEFAULT_LINE_HEIGHT_FACTOR as xr, scrollbarZoneAt as xt, labelOrigin as y, hiddenRangesOf as ya, borderRadiusCorners as yi, selectionRangeOf as yn, UiBinding as yo, wordRangeAt as yr, scrollbarThumb as yt, isLayoutProtocol as z, createEnvironmentKey as za, withContrast as zi, caretVisibleAt as zn, isUiRole as zr, buildFontString as zt };
22337
22391
 
22338
- //# sourceMappingURL=CanvasSurface-BAhcLj2K.js.map
22392
+ //# sourceMappingURL=CanvasSurface-BxHC-NQ8.js.map