@astryxdesign/core 0.7.16-canary.gfef050d → 0.7.16

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,95 @@
1
1
  # @xds/core
2
2
 
3
+ # 0.7.16
4
+
5
+ #### Experimental APIs
6
+
7
+ - Adds the English strings of the Lab media player (`@astryx.mediaPlayer.*`): control names, spoken times, chapter and marker context, and previous and next track. They are Lab strings shipped in Core's locale file, as Lab ListInput's strings are; they add no public API to `@astryxdesign/core`. ([#11438](https://github.com/meta/astryx/pull/11438))
8
+
9
+ #### New Features
10
+
11
+ - NumberInput takes `entryErrorBehavior`, so a form can pass one value to all of its date, time, and number fields. A typed number is complete only at Enter or blur, so both values keep NumberInput's current timing: its rejection, `aria-invalid`, announcement, and `onEntryErrorChange` report appear at Enter or blur, never while a person types. Setting the prop, or FormLayout's `defaultEntryErrorBehavior`, changes nothing a person sees in a NumberInput. Pagination's page box passes `'complete'`, so a FormLayout around it never changes it. ([#11492](https://github.com/meta/astryx/pull/11492))
12
+ - DateInput, DateTimeInput, and TimeInput take `entryErrorBehavior`, and FormLayout takes `defaultEntryErrorBehavior`. The prop sets when a field shows its own entry error, such as a date the calendar does not have or a time outside `min` and `max`. It does not set when validation runs, and it is not React Aria's `validationBehavior`. `'complete'`, the default, keeps each field's current timing. `'blur-or-enter'` holds the message, `aria-invalid`, the invalid styling, the announcement, and the `onEntryErrorChange` report until the person presses Enter or leaves the field; an edit that makes the entry valid or empty still clears the error at once. A field's own prop wins over the form default, a nested FormLayout replaces it, and a Dialog opened from the form starts without it. PowerSearch value editors and Table filter editors keep `'complete'`. The new `EntryErrorBehavior` type names the two values. ([#11485](https://github.com/meta/astryx/pull/11485))
13
+ - A Lightbox gallery's caption sits in a band two lines tall under every photo, so the photo keeps one size and place from item to item. A photo with no caption keeps the band's space without its backing. A longer caption shows two lines, the second ending in an inline "more" link, which opens the whole caption over the photo. The whole caption is always the viewer's accessible description. ([#9810](https://github.com/meta/astryx/pull/9810))
14
+ The viewer is a media surface: its controls, caption and counter take the theme's dark surface tokens through `MediaTheme`. The caption is body `Text` whose lines start at one edge, "more" and "less" are `Link`'s button form in the caption's own type, and the band clears the screen's bottom edge and its safe area. A gallery's caption sits on a backing that keeps it at 4.5:1 over any photo. A tap that opens the viewer paints no focus ring on its first control, and paging from a focused "more" or "less" keeps focus in the viewer.
15
+ - NumberInput: `onEntryErrorChange` reports why the field rejects typed text, so an app can word its own message. It receives a `NumberInputEntryError` with a `kind` that does not depend on the locale (`unreadable`, `fractional` for a fraction when `isIntegerOnly`, or `outOfRange` for any number while `min` is above `max`), the typed `text`, and, for `fractional` and `outOfRange`, the number as `value`. It runs each time the rejection changes: at Enter or blur, when an edit makes the text valid or empty, when a new `value`, `min`, `max`, or `isIntegerOnly` changes or ends it, and when disabling the field drops the text. It reports `null` when the rejection ends, or when the field unmounts while one stands, and never twice for the same rejection. Pass an `error` `status` with a message to word the rejection; that message is the one announced. ([#11415](https://github.com/meta/astryx/pull/11415))
16
+ - New message `@astryx.richTextEditor.link.urlPlaceholder` ("example.com"), the placeholder of the RichText toolbar's link field. The descriptions of the other `@astryx.richTextEditor.link.*` messages and `@astryx.richTextEditor.toolbar.link` now describe the link popover that replaces the link dialog; their messages are unchanged. ([#8717](https://github.com/meta/astryx/pull/8717))
17
+ - Column windowing keeps focus and place: with `useTableColumnsVirtualization`, a focused cell whose column scrolls out of the window stays mounted with its original element until focus leaves the table, moves to another cell, or its column is removed, when focus returns to the Table's scroll area. Focus in a menu that a cell opens keeps the cell's column too. Changing column order, widths, visibility or pinning keeps the first visible column and how far it is scrolled. Tables that do not opt in are unchanged. ([#11018](https://github.com/meta/astryx/pull/11018))
18
+ - Tables can window their columns: pass `useTableColumnsVirtualization({initialViewportWidth})` to `Table.virtualization`. Table keeps every column definition and width, mounts only the unpinned columns near the inline viewport plus two overscan columns per side, keeps pinned columns mounted, and gives mounted cells full-table `aria-colindex` values with `aria-colcount` on the table. When the scroll area is at least as wide as the table's minimum width, every column mounts. `Table.virtualization` also accepts a list with at most one rows and one columns capability. Unsupported content or structure renders every column with a development warning. Adding or removing the columns capability remounts the table. Tables that do not opt in render as before; their Table import carries about 0.5 KB gzip of column windowing wiring, and the column planner loads only with the hook. ([#11014](https://github.com/meta/astryx/pull/11014))
19
+ - Add Table infinite loading with `useTableInfiniteScroll({hasMore, isLoading, onLoadMore})`. One Promise request latch coordinates automatic and manual loading, failures pause automatic retry, and the persistent busy Button owns progress announcements and focus continuity. ([#10570](https://github.com/meta/astryx/pull/10570))
20
+ - Tables can window rows and columns together: pass both `useTableRowsVirtualization` and `useTableColumnsVirtualization` to `Table.virtualization` as a list. Table mounts only the cells near the viewport on both axes, keeps full-table `aria-rowindex` and `aria-colindex` values, and keeps a focused cell's row and column mounted while either scrolls away. Tables that do not opt in are unchanged. ([#11019](https://github.com/meta/astryx/pull/11019))
21
+ - TextArea `htmlMaxLength` sets the native `maxlength` attribute, so a form can cap typing in UTF-16 code units, including an SSR form before hydration. It is independent of `maxLength`, the soft counter, which still counts user-perceived characters and never blocks typing. TextArea adds no truncation or validation of its own, and renders no native `maxlength` when `htmlMaxLength` is unset. ([#11295](https://github.com/meta/astryx/pull/11295))
22
+ - TimeInput: `onEntryErrorChange` reports why the field rejects typed text, so an app can word its own message. It receives a `TimeInputEntryError` with a `kind` that does not depend on the locale (`unreadable`, or `outOfRange` for a time before `min` or after `max`), the typed `text`, and, for `outOfRange`, the ISO time `value`. It runs each time the shown rejection changes, including when a new `min`, `max`, or `value`, or disabling the field, changes it, never twice for the same rejection, and with `null` when the rejection ends or the field unmounts while it stands. The native and bottom-sheet surfaces take no typed text, so they never report. ([#11413](https://github.com/meta/astryx/pull/11413))
23
+ - `useTruncation` takes `isExpanded`: pass true while the text is shown in full; the hook keeps reporting whether it is cut off when clamped. A Lightbox caption uses it, so its "less" stays while the caption is open. ([#9810](https://github.com/meta/astryx/pull/9810))
24
+
25
+ #### Fixes
26
+
27
+ - AppShell keeps server-rendered content when a screen is narrower than the server assumed. On a phone, the shell learned its mobile layout in an urgent update right after it hydrated. When the content inside the shell had not hydrated yet, because its code streams in or loads later, React rendered that content again in place of its server HTML: a visitor lost scroll position and focus, and images inside loaded twice. The shell now takes the client's breakpoint answer in a transition, which waits for that content to hydrate. A client-rendered app and a correct `mobileNav.defaultIsMobile` hint behave as before. No API changes. ([#11441](https://github.com/meta/astryx/pull/11441))
28
+ - BottomSheet syncs its focus return target at commit, and no longer copies its stack view during render. A sheet removed after a render React discards, as a suspended transition does, returns focus to its committed `finalFocusRef`. ([#10918](https://github.com/meta/astryx/pull/10918))
29
+ - BottomSheet: when a touch flick closes a sheet, the dim behind it now clears in step with the sheet. Before, the sheet was gone in about a tenth of a second while the dim was still mostly there, and it kept fading for over half a second more. The fade now follows the close spring's own progress. Reduced motion and every other close are unchanged. ([#11400](https://github.com/meta/astryx/pull/11400))
30
+ - BottomSheet keeps its snap points and its reactivated entrance in state, and syncs its drag's stop resolver at commit. A render React discards that changes `snapPoints`, as a suspended transition can, no longer changes the stop a released drag rests at. ([#10873](https://github.com/meta/astryx/pull/10873))
31
+ - ChatComposerInput: an empty input keeps its one-line height and takes typing after a page restyle, for example after an open Dialog that holds a SegmentedControl unmounts. Before, its editable area could collapse to 0px, so a click landed beside it and typing did nothing until a reload. ([#11428](https://github.com/meta/astryx/pull/11428))
32
+ - useContainerReveal keeps revealed content always visible only when the primary pointer is coarse (a phone or tablet). A touchscreen laptop used with a mouse or trackpad now reveals on hover and keyboard focus like any other mouse device. Previously any touchscreen kept the content visible at rest, so a Thumbnail's hover remove button, Markdown heading links, and every app's hover-revealed row actions never hid. ([#11218](https://github.com/meta/astryx/pull/11218))
33
+ - A theme's padding written with `clamp()`, `calc()`, `min()`, `max()` or `var()` with a fallback now builds as written. The theme compiler splits `padding`, `paddingBlock` and `paddingInline` on the spaces between values only, never on a space inside parentheses or quotes, so `padding: clamp(8px, 2vw, 16px)` stays one value instead of becoming broken CSS. No API changes. ([#11347](https://github.com/meta/astryx/pull/11347))
34
+ - DateInput, DateTimeInput: a `value` that the app passes at an Enter or blur that keeps a rejected date no longer erases it, so the entry meets WCAG 2.2 3.3.1 (Error Identification). Before, when an app set `value` in the same update as an Enter or blur that kept unreadable, incomplete, nonexistent, or out-of-range date text, as an app does when it restores the date it had before the edit, the field dropped the text, its message, and `aria-invalid`, and reported `null` through `onEntryErrorChange`; a native date control lost its rejection message the same way. Now the text, its rejection, and its message stay at every such Enter or blur, a blur after an Enter included, so the person can correct the entry, and nothing is reported. A later new `value` replaces the text, as before. No app code changes are needed. ([#11470](https://github.com/meta/astryx/pull/11470))
35
+ - DateInput, DateTimeInput: in a standalone field, rejected dates now meet WCAG 2.2 1.4.1 (Use of Color) and 3.3.1 (Error Identification); inside an InputGroup they set `aria-invalid` and are announced. Before, text that is not a date was marked invalid and announced on every keystroke, with no visible message, and Enter or blur reverted it. A native date control flagged each partial year while the year was typed, showed no message, and dropped the rejection when it restored the committed date at blur. Now text that is not a date shows nothing while you type; Enter or blur keeps it in the field and shows "Invalid date" as the field's error status, with `aria-invalid` and one announcement. Its message replaces a caller `status`, as the field's other rejections already do; with `onEntryErrorChange`, a caller `error` status with a message still wins. A native date control's rejection waits for Enter or blur, shows the out-of-range message a typed date shows, under the same `status` rules, and stays shown after the control restores the committed date at blur. A shown rejection stays through an edit that leaves the date wrong or unfinished, and clears once the date is valid or empty. What a form posts does not change: while kept text is not a date, a hidden input posts the committed date under the field's `name`, and the next Enter submits the form. ([#11407](https://github.com/meta/astryx/pull/11407))
36
+ - SideNav, TopNav, Breadcrumbs: a Ctrl-, Cmd-, Shift- or Alt-click on a link in the mobile navigation drawer opens it the way the browser decides, a new tab for instance, and leaves the drawer open. A plain click still closes it, and so does a modified click that the row's own `onClick` cancels, since nothing opens elsewhere. (#8979) ([#9390](https://github.com/meta/astryx/pull/9390))
37
+ - DropdownMenu syncs the refs its show and hide call at commit. After a render React discards, as a suspended transition does, its entrance under a finger holds input as the committed menu says. ([#10905](https://github.com/meta/astryx/pull/10905))
38
+ - In forced-colors mode (Windows contrast themes), `primary` and `secondary` Buttons gain a `ButtonText` border, and `destructive` keeps its `CanvasText` border; in a connected `ButtonGroup` the solid buttons keep the group's dividers and close the group's outer edge, with no doubled seam. Floating surfaces that separate from the page with a box shadow alone gain a `CanvasText` border: `Popover` and every surface `usePopover` paints (including `DropdownMenu`), `DropdownMenuSubMenu` flyouts, `ContextMenu`, and an `isInline` `Dialog`. Forced colors removes fills and box shadows, which left these controls and surfaces without an edge. The borders exist only in forced colors, so nothing changes elsewhere. A theme that sets a solid variant's own border width keeps it, so Gothic's `secondary` Button stays borderless. ([#7677](https://github.com/meta/astryx/pull/7677))
39
+ - A layer with several triggers now opens at another trigger when the press on that trigger is the one that closes it, with a mouse or a finger. A press on the open trigger still closes it. ([#11337](https://github.com/meta/astryx/pull/11337))
40
+ - An anchored layer flush against its trigger, or over its edge, no longer slides over it: its entrance scales in place, as it does for a layer over its trigger's center. A menu at the pointer still slides from the side it lands on. ([#11417](https://github.com/meta/astryx/pull/11417))
41
+ - An anchored layer that has room to its trigger no longer starts its entrance over it: its first step toward the trigger stops at that room. So a tall tooltip 4 px beside its trigger no longer covers it on its first frame in Safari. ([#11396](https://github.com/meta/astryx/pull/11396))
42
+ - The layer runtime syncs its close-start and replayed-show refs at commit, not during render, and its keep-open press reads the committed open state or the shown layer. A render React discards no longer leaves its values for later callbacks. ([#10912](https://github.com/meta/astryx/pull/10912))
43
+ - A light-dismiss layer opened while a press is released no longer closes at that release. A DropdownMenu or ContextMenu row that opens a Popover when chosen with a mouse now leaves it open, as it already did with a finger; the next press outside, or Escape, closes it as before. ([#11258](https://github.com/meta/astryx/pull/11258))
44
+ - A mouse click on the dark space beside a Lightbox photo now closes the viewer. Before, the viewer stayed open after a click there within the photo's natural width, or within a wider caption's width. ([#11354](https://github.com/meta/astryx/pull/11354))
45
+ - A single photo's caption in a `Lightbox` now shows as a gallery's does. It sits in the band at the bottom of the viewer, on the caption's backing, which keeps 4.5:1 over any page behind it. The photo centres above it. A caption longer than two lines ends in "more", which opens it in full over the photo. A single photo with no caption shows no band. ([#10284](https://github.com/meta/astryx/pull/10284))
46
+ - When a reorderable `List` row does not render again, its handle's name still follows it. A handle named after its place ("Reorder item N") follows that place when rows above it go or the rows reorder. A label that gains or loses its text renames the handle. ([#10815](https://github.com/meta/astryx/pull/10815))
47
+ - DropdownMenu, ContextMenu, Selector, TabList, TopNav, SideNav, Breadcrumbs: when a finger picks a menu row, the click guard cancels only that finger's `touchend` once the menu has named the touch, so another finger's `touchend` passes. The menu names the touch from the `touchstart` that follows its `pointerdown`. A `touchend` without `changedTouches`, or a lift whose touch the menu could not name, keeps the old rule: the next `touchend` is cancelled. ([#11164](https://github.com/meta/astryx/pull/11164))
48
+ - MoreMenu, InfoTip, PowerSearch (with its PowerSearchToken and PowerSearchFilterEditor defaults), Toast, and InputClearButton now pass host `data-*` attributes to their own element, as other components do: the trigger button for MoreMenu and InfoTip, the primary control for PowerSearch, the token and editor root for the PowerSearch defaults, the toast element for Toast, and the button for InputClearButton. Component-owned attributes stay with the component. A new test renders every exported component that renders an element of its own with a `data-*` attribute, and fails when the attribute does not reach the DOM. ([#11406](https://github.com/meta/astryx/pull/11406))
49
+ - NumberInput: a rejected entry now shows a message and stays in the field, so the field meets WCAG 2.2 1.4.1 (Use of Color) and 3.3.1 (Error Identification). Before, every draft that was not an accepted number, an unfinished one such as `-` included, set `aria-invalid` and was announced on each keystroke, while the text only turned secondary; blur then reverted a draft that did not parse, with no message. Now nothing is marked or announced while a person types, because a typed number is complete only at Enter or blur. At Enter or blur, text that is not a number, a fraction when `isIntegerOnly`, or any number while `min` is above `max` stays in the field: the field shows "Invalid number" as its error status, tied to the input by `aria-describedby`, sets `aria-invalid`, and announces it once. Inside an InputGroup the rejection sets `aria-invalid` and is announced. An edit that makes the draft valid or empty clears it at once. A number outside an ordinary range still clamps and commits through `onChange`. A caller `error` status with a message still shows in place of the field's message; a `warning` or `success` status no longer hides a rejection. What a form posts does not change: while blur keeps a rejected draft, a hidden input posts the committed number as the field showed it before. Pagination's `input` variant shows the message on its page box's status icon and widens the box beside the typed text while a rejected entry stays, so the bar keeps its height. No app code changes are needed. ([#11415](https://github.com/meta/astryx/pull/11415))
50
+ - Under a finger, a Popover that overlaps its trigger now grows from where it meets the trigger, as the pointer entrance does. A popover a few pixels over its trigger's side grows from that side, not from below. A popover over its trigger's center grows from that center by scale only. Every other landing grows as before. ([#10949](https://github.com/meta/astryx/pull/10949))
51
+ - Toast announces the rendered message when a body's text comes only from a component, and from custom layouts (#7853) ([#11175](https://github.com/meta/astryx/pull/11175))
52
+ - SegmentedControl: where the control has no layout, as in a unit test's DOM, a click on a later segment keeps that segment selected instead of switching to the first segment a moment later. Browsers are unaffected. ([#11487](https://github.com/meta/astryx/pull/11487))
53
+ - Selector's presentation syncs its show, hide and popover-content refs at commit. After a render React discards, as a suspended transition does, opening the popover runs the committed show. ([#10917](https://github.com/meta/astryx/pull/10917))
54
+ - Slider syncs its values, change-end callback and touch update refs at commit. After a render React discards, as a suspended transition does, a press on the track reports the committed value to the committed `onChangeEnd`, and a finger dragging a thumb reports to the committed `onChange`. ([#10913](https://github.com/meta/astryx/pull/10913))
55
+ - Table: `useTableSortableState` calls the `onSortChange` of the last committed render. Before, a sort click during a transition that had not committed yet called the callback from that pending render. ([#11433](https://github.com/meta/astryx/pull/11433))
56
+ - TimeInput, DateTimeInput: a rejected typed time now meets WCAG 2.2 1.4.1 (Use of Color) and 3.3.1 (Error Identification). Before, every draft that was not an accepted time, an unfinished one such as `1` included, was marked invalid and announced on each keystroke, shown only as secondary-color text, and blur reverted it with no message; a native time edit outside `min` or `max` showed no message and its rejection cleared at blur. Now an unfinished time is never flagged: a time outside `min` or `max` shows once it is complete (its hours, both minute digits, both second digits when the field shows seconds, and in 12-hour text its day period unless the hour reads 0 or 13–23), and text that is not a time shows at Enter or blur. The rejected text stays in the field, and a standalone field shows the "Invalid time" message as its error status, with `aria-invalid` and one announcement; inside an InputGroup the rejection sets `aria-invalid` and is announced. Enter in TimeInput and in DateTimeInput's time field commits the typed time and still submits a surrounding form; in DateTimeInput's open preset-time list, Enter picks a time as before. A native time control restores the committed time at blur and keeps its rejection shown. A caller `error` status with a message still shows over the field's message, and the rejection is announced once; a `warning` or `success` status no longer hides a rejection. In DateTimeInput, a date rejection's message comes first and a time rejection under it is announced. What a form posts does not change: while blur keeps a rejected TimeInput draft, a hidden input carries the field's `name` with the committed time. ([#11413](https://github.com/meta/astryx/pull/11413))
57
+ - `TimeInput` and `DateTimeInput`: a bound with no whole minute inside the range keeps its own seconds, so the clamp stays inside the range. Before, `clampTime('12:00','23:59:30')` answered `23:59` — below the minimum the caller set. In a `TimeInput` sheet a wheel rest past such a bound committed nothing; in a `DateTimeInput` sheet, changing the date onto such a bound committed the out-of-range `23:59`. (#10159) ([#10159](https://github.com/meta/astryx/pull/10159))
58
+ - Tooltip's and HoverCard's touch trigger, and Tooltip's handlers with the controlled and enabled flags they carry, sync at commit. After a render React discards, as a suspended transition does, a tap answers with the committed props, and a press outside still closes a shown tooltip. ([#10892](https://github.com/meta/astryx/pull/10892))
59
+
60
+ #### Performance
61
+
62
+ - Markdown text transforms that declare `requiredSubstrings` look for those substrings in one pass over the source. Before, each paragraph searched the rest of the document again, so long Markdown (such as a long streamed chat answer) rendered more slowly with each paragraph. Output is unchanged. ([#11403](https://github.com/meta/astryx/pull/11403))
63
+
64
+ #### Documentation
65
+
66
+ - The docs playgrounds for TextInput, TextArea, NumberInput, CheckboxInput, Switch, ProgressBar and StatusDot open with realistic values instead of prop-name placeholders, the Heading playground opens as a level-1 heading instead of inheriting Text's sample with `type: 'body'`, and the ButtonGroup, TabList, SegmentedControl and TopNav playgrounds open with named sample items instead of numbered ones. ([#11351](https://github.com/meta/astryx/pull/11351))
67
+ - Hook docs for `useOutlineFromDOM`, so `astryx hook useOutlineFromDOM` and `astryx search` return it, and a `useOutlineFromDOM — Article` example block: an article and an Outline built from its headings through the hook, with a button that adds a section and its linked entry. ([#11234](https://github.com/meta/astryx/pull/11234))
68
+ - ListItem's `startContent` and `endContent` docs now say that the content sits inside the row, before the label or after the label and description, not before or after the item. ([#11336](https://github.com/meta/astryx/pull/11336))
69
+ - MetadataList's guidance now says that assistive technology reads each label with its value, and that the title does not name the list or add a heading. Its prop docs now list `className` and `style`, and the `label` docs say that `position: 'start'` places a label at the inline start of its value, not on the left. ([#11391](https://github.com/meta/astryx/pull/11391))
70
+
71
+ #### Contributors
72
+
73
+ Thanks to everyone who contributed to this release:
74
+
75
+ - @aashish254
76
+ - @cixzhang
77
+ - @ejc3
78
+ - @emilyhorsman
79
+ - @ernestt
80
+ - @HelloOjasMutreja
81
+ - @humbertovirtudes
82
+ - @josephfarina
83
+ - @kentonquatman
84
+ - @LekhNayak
85
+ - @lzcmian
86
+ - @nynexman4464
87
+ - @popsiclelmlm
88
+ - @shashank03-dev
89
+ - @vjeux
90
+
91
+ ---
92
+
3
93
  # 0.7.15
4
94
 
5
95
  #### New Features
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAuBH,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AA4DhD,YAAY,EAAC,iBAAiB,EAAE,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAC,iBAAiB,EAAE,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AA4LhF,UAAU,sBAAuB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAChE,q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AM,CAAC,EAAE,KAAK,CAAC;IACf,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AAED,MAAM,MAAM,gBAAgB,GAC1B,0BAA0B,GAAG,wBAAwB,CAAC;AAq7BxD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BA6BlD;yBA7Be,WAAW"}
@@ -135,7 +135,7 @@ const styles = {
135
135
  $$css: true
136
136
  },
137
137
  scrimClosing: {
138
- kb4ib: "x1cz9k3x",
138
+ kb4ib: "x1w553ls",
139
139
  $$css: true
140
140
  },
141
141
  positioner: {
@@ -196,19 +196,20 @@ function scrimOpacityForView(view) {
196
196
 
197
197
  /**
198
198
  * Writes the fade a touch drag's close paces on `dialog`'s scrim, or clears
199
- * it when `ms` is null. `written` keeps the value the host wrote, so a clear
200
- * removes only that value.
199
+ * it when `fade` is null. `written` keeps the duration the host wrote, so a
200
+ * clear removes only that fade.
201
201
  */
202
- function writeScrimFadeDuration(dialog, ms, written) {
202
+ function writeScrimFade(dialog, fade, written) {
203
203
  if (dialog == null) {
204
204
  return;
205
205
  }
206
206
  const current = dialog.style.getPropertyValue('--_sheet-scrim-duration');
207
- if (ms == null) {
208
- // Remove only the value this host wrote. A stack's 0s pin written since
207
+ if (fade == null) {
208
+ // Remove only the fade this host wrote. A stack's 0s pin written since
209
209
  // then stays.
210
210
  if (written.current != null && current === written.current) {
211
211
  dialog.style.removeProperty('--_sheet-scrim-duration');
212
+ dialog.style.removeProperty('--_sheet-scrim-easing');
212
213
  }
213
214
  written.current = null;
214
215
  return;
@@ -217,8 +218,9 @@ function writeScrimFadeDuration(dialog, ms, written) {
217
218
  if (current === '0s') {
218
219
  return;
219
220
  }
220
- written.current = `${ms}ms`;
221
+ written.current = `${fade.durationMs}ms`;
221
222
  dialog.style.setProperty('--_sheet-scrim-duration', written.current);
223
+ dialog.style.setProperty('--_sheet-scrim-easing', fade.easing);
222
224
  }
223
225
  function panelStateForSwitcherPhase(phase, alignmentOffset) {
224
226
  switch (phase) {
@@ -388,12 +390,12 @@ function StandaloneBottomSheet({
388
390
  }, []);
389
391
  // The fade duration a touch drag's close wrote, until that close ends.
390
392
  const scrimFadeRef = useRef(null);
391
- const handleScrimFadeDuration = useCallback((panel, ms) => {
393
+ const handleScrimFade = useCallback((panel, fade) => {
392
394
  const view = stackViewRef.current;
393
395
  if (view.isStacked && !view.ownsScrim) {
394
396
  return;
395
397
  }
396
- writeScrimFadeDuration(panel.closest('dialog'), ms, scrimFadeRef);
398
+ writeScrimFade(panel.closest('dialog'), fade, scrimFadeRef);
397
399
  }, []);
398
400
 
399
401
  // A sheet joins the registry for as long as it is presented. For a modal
@@ -707,7 +709,7 @@ function StandaloneBottomSheet({
707
709
  xstyle: xstyle,
708
710
  onDismiss: dismissOnLightInteraction,
709
711
  onScrimOpacity: handleScrimOpacity,
710
- onScrimFadeDuration: handleScrimFadeDuration,
712
+ onScrimFade: handleScrimFade,
711
713
  onElementChange: handlePanelElementChange,
712
714
  handleRef: outletRef,
713
715
  onMotionStart: handleMotionStart,
@@ -829,8 +831,8 @@ function SwitcherBottomSheetItem({
829
831
  // close ends. The step a drag closes becomes the flow's retained step, so
830
832
  // its backdrop is the flow's scrim.
831
833
  const scrimFadeRef = useRef(null);
832
- const handleScrimFadeDuration = useCallback((panel, ms) => {
833
- writeScrimFadeDuration(panel.closest('dialog'), ms, scrimFadeRef);
834
+ const handleScrimFade = useCallback((panel, fade) => {
835
+ writeScrimFade(panel.closest('dialog'), fade, scrimFadeRef);
834
836
  }, []);
835
837
  useLayoutEffect(() => {
836
838
  if (!hasValidSheetId) {
@@ -978,7 +980,7 @@ function SwitcherBottomSheetItem({
978
980
  xstyle: xstyle,
979
981
  onDismiss: dismissOnSwipe,
980
982
  onScrimOpacity: handleScrimOpacity,
981
- onScrimFadeDuration: handleScrimFadeDuration,
983
+ onScrimFade: handleScrimFade,
982
984
  onElementChange: handlePanelElementChange,
983
985
  onMotionStart: handleMotionStart,
984
986
  onMotionComplete: handleMotionComplete,
@@ -25,6 +25,14 @@ declare const HEIGHT_BUDGETS: {
25
25
  };
26
26
  export type BottomSheetHeight = keyof typeof HEIGHT_BUDGETS;
27
27
  export type { BottomSheetSnapPoint };
28
+ /**
29
+ * The scrim's fade under a touch drag's close: the close's duration in ms,
30
+ * and its progress as CSS easing, so the fade follows the sheet.
31
+ */
32
+ export interface ScrimFade {
33
+ readonly durationMs: number;
34
+ readonly easing: string;
35
+ }
28
36
  export declare const REDUCED_MOTION_COARSE_QUERY = "(prefers-reduced-motion: reduce) and (pointer: coarse)";
29
37
  export type BottomSheetPanelMotion = 'entering' | 'aligning' | 'fading' | 'exiting';
30
38
  export type BottomSheetPanelState = {
@@ -76,12 +84,12 @@ interface BottomSheetPanelProps extends BaseProps<HTMLDivElement> {
76
84
  onDismiss: () => void;
77
85
  onScrimOpacity: (opacity: number) => void;
78
86
  /**
79
- * The scrim's fade under a touch drag's close, in milliseconds, or null
80
- * once that close ends or a reopen takes the sheet back. `panel` is the
81
- * sheet's element: the commit that starts the close can detach the host's
82
- * dialog ref while this runs.
87
+ * The scrim's fade under a touch drag's close, or null once that close
88
+ * ends or a reopen takes the sheet back. `panel` is the sheet's element:
89
+ * the commit that starts the close can detach the host's dialog ref while
90
+ * this runs.
83
91
  */
84
- onScrimFadeDuration?: (panel: HTMLElement, ms: number | null) => void;
92
+ onScrimFade?: (panel: HTMLElement, fade: ScrimFade | null) => void;
85
93
  onElementChange?: (element: HTMLDivElement | null) => void;
86
94
  /**
87
95
  * A ref for the grab handle's element. The handle stays mounted with the
@@ -92,7 +100,7 @@ interface BottomSheetPanelProps extends BaseProps<HTMLDivElement> {
92
100
  onMotionComplete?: (motion: BottomSheetPanelMotion) => void;
93
101
  }
94
102
  /** Internal visual and gesture surface shared by every BottomSheet host. */
95
- export declare function BottomSheetPanel({ ref, state, isOpenRequested, height, label, children, padding, snapPoints, className, style, tabIndex, xstyle, isEntrySettled, onEntrySettled, onTransitionEnd, isSwipeDismissAllowed, isPageScrollLocked, onDismiss, onScrimOpacity, onScrimFadeDuration, onElementChange, handleRef, onMotionStart, onMotionComplete, ...props }: BottomSheetPanelProps): import("react").JSX.Element;
103
+ export declare function BottomSheetPanel({ ref, state, isOpenRequested, height, label, children, padding, snapPoints, className, style, tabIndex, xstyle, isEntrySettled, onEntrySettled, onTransitionEnd, isSwipeDismissAllowed, isPageScrollLocked, onDismiss, onScrimOpacity, onScrimFade, onElementChange, handleRef, onMotionStart, onMotionComplete, ...props }: BottomSheetPanelProps): import("react").JSX.Element;
96
104
  export declare namespace BottomSheetPanel {
97
105
  var displayName: string;
98
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetPanel.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetPanel.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EASL,KAAK,SAAS,EACd,KAAK,GAAG,EACT,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA+B5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,eAAe,CAAC;AAYvB,QAAA,MAAM,cAAc;;;;CAIV,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,cAAc,CAAC;AAC5D,YAAY,EAAC,oBAAoB,EAAC,CAAC;AAsNnC,eAAO,MAAM,2BAA2B,2DACkB,CAAC;AAyO3D,MAAM,MAAM,sBAAsB,GAChC,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEjD,MAAM,MAAM,qBAAqB,GAC7B;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAC,GAChB;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAC,GACjC;IACE,IAAI,EAAE,UAAU,C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AAO,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3D;;;OAGG;IACH,SAAS,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACzD,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;CAC7D;AAyJD,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,EAC/B,GAAG,EACH,KAAK,EACL,eAAe,EACf,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,UAAU,EACV,SAAS,EACT,KAAK,EACL,QAAQ,EACR,MAAM,EACN,cAAsB,EACtB,cAAc,EACd,eAAe,EACf,qBAA4B,EAC5B,kBAA0B,EAC1B,SAAS,EACT,cAAc,EACd,WAAW,EACX,eAAe,EACf,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,GAAG,KAAK,EACT,EAAE,qBAAqB,+BA2iBvB;yBArkBe,gBAAgB"}
@@ -37,7 +37,7 @@ import { containerPaddingBlockEndVarStyles, containerPaddingInlineVarStyles, ove
37
37
  import { subscribeInput } from "../utils/inputStream.js";
38
38
  import { isValidSnapPoint, resolveSnapPoints } from "./snapOffsets.js";
39
39
  import { animatorFor, SETTLE_THRESHOLD } from "../motion/animator.js";
40
- import { resolveSettleMs } from "../motion/resolveMotion.js";
40
+ import { resolveMoveTiming } from "../motion/resolveMotion.js";
41
41
  import { springs } from "../motion/uikit/springs.js";
42
42
  import { useMobileKeyboard } from "../keyboard/useMobileKeyboard.js";
43
43
  import { scrollPreservationPadding, sheetLayoutHeight, useSheetGestures } from "./useSheetGestures.js";
@@ -72,21 +72,32 @@ const BLOCK_SIZE_PROPERTIES = ['height', 'minHeight', 'maxHeight', 'blockSize',
72
72
  function hasStyles(xstyle) {
73
73
  return Array.isArray(xstyle) ? xstyle.some(hasStyles) : xstyle != null && typeof xstyle === 'object';
74
74
  }
75
+
76
+ /**
77
+ * The scrim's fade under a touch drag's close: the close's duration in ms,
78
+ * and its progress as CSS easing, so the fade follows the sheet.
79
+ */
80
+
75
81
  function supportsWebAnimations() {
76
82
  return typeof Element !== 'undefined' && typeof Element.prototype.animate === 'function';
77
83
  }
78
84
 
79
85
  /**
80
- * How long a drag's close plays, in ms. It is the close spring's move from
81
- * where the finger left the sheet, timed as the shared animator times it.
86
+ * How a drag's close plays: the close spring's move from where the finger
87
+ * left the sheet, timed as the shared animator times it, and its progress
88
+ * toward the point where the sheet leaves view. The sheet's surface reaches
89
+ * below the screen (the reserve), so it leaves view before the close ends,
90
+ * and the scrim is clear when it does.
82
91
  */
83
- function dragExitMs(element, exit) {
84
- return resolveSettleMs(element, springs.sheetDismissSwipe, {
92
+ function dragExitFade(element, exit) {
93
+ const viewportHeight = element.ownerDocument.defaultView?.innerHeight ?? 0;
94
+ const shown = Math.max(0, viewportHeight - element.getBoundingClientRect().top);
95
+ return resolveMoveTiming(element, springs.sheetDismissSwipe, {
85
96
  from: 0,
86
97
  to: exit.distance,
87
98
  velocity: exit.velocity,
88
99
  epsilon: SETTLE_THRESHOLD.y
89
- });
100
+ }, Math.min(exit.distance, shown));
90
101
  }
91
102
 
92
103
  /** The running fade that clears the scrim behind `panel`, if any. */
@@ -276,6 +287,7 @@ const styles = {
276
287
  k6sLGO: "x1q1rmc8",
277
288
  "--_sheet-scrim-opacity": "xnvc5mv",
278
289
  "--_sheet-scrim-duration": "x1jx3mzq",
290
+ "--_sheet-scrim-easing": "x1pfqsku",
279
291
  $$css: true
280
292
  },
281
293
  sheetSettled: {
@@ -485,7 +497,7 @@ export function BottomSheetPanel({
485
497
  isPageScrollLocked = false,
486
498
  onDismiss,
487
499
  onScrimOpacity,
488
- onScrimFadeDuration,
500
+ onScrimFade,
489
501
  onElementChange,
490
502
  handleRef,
491
503
  onMotionStart,
@@ -496,7 +508,7 @@ export function BottomSheetPanel({
496
508
  const dismissKeyboardRef = useRef(null);
497
509
  const onMotionStartRef = useCommittedRef(onMotionStart);
498
510
  const onMotionCompleteRef = useCommittedRef(onMotionComplete);
499
- const onScrimFadeDurationRef = useCommittedRef(onScrimFadeDuration);
511
+ const onScrimFadeRef = useCommittedRef(onScrimFade);
500
512
  const startedMotionRef = useRef(null);
501
513
  const pendingMotionCompleteRef = useRef(null);
502
514
  const isEntering = state.kind === 'open' && state.entering;
@@ -687,14 +699,14 @@ export function BottomSheetPanel({
687
699
  return;
688
700
  }
689
701
  // The host's current callback hears the fade end, as it heard its start.
690
- const reportFade = durationMs => {
691
- onScrimFadeDurationRef.current?.(element, durationMs);
702
+ const reportFade = fade => {
703
+ onScrimFadeRef.current?.(element, fade);
692
704
  };
693
- reportFade(dragExitMs(element, playedDragExit));
705
+ reportFade(dragExitFade(element, playedDragExit));
694
706
  return () => {
695
707
  reportFade(null);
696
708
  };
697
- }, [onScrimFadeDurationRef, playedDragExit]);
709
+ }, [onScrimFadeRef, playedDragExit]);
698
710
  // Syncs the motion with the panel's CSS transition, or a drag's exit with
699
711
  // the shared animator. The motion completes when that one ends.
700
712
  useLayoutEffect(() => {
@@ -754,7 +766,7 @@ export function BottomSheetPanel({
754
766
  });
755
767
  void exit.finished.then(() => {
756
768
  isFinished = true;
757
- onScrimFadeDurationRef.current?.(element, null);
769
+ onScrimFadeRef.current?.(element, null);
758
770
  if (isCurrent) {
759
771
  complete();
760
772
  }
@@ -779,7 +791,7 @@ export function BottomSheetPanel({
779
791
  // retained sheet's fade starts at once and the two fades cross.
780
792
  const crossFadeMotion = isCrossFade && motion === 'exiting';
781
793
  return waitForTransition(elementRef.current, motion === 'fading' || crossFadeMotion ? 'opacity' : 'transform', complete);
782
- }, [motion, isCrossFade, playedDragExit, isReactivatedEntrance, onMotionCompleteRef, onScrimFadeDurationRef]);
794
+ }, [motion, isCrossFade, playedDragExit, isReactivatedEntrance, onMotionCompleteRef, onScrimFadeRef]);
783
795
  // The snap is transform-only; the layout height reconciles when it lands.
784
796
  // waitForTransition — the same helper the motion states use — resolves that
785
797
  // even when no `transitionend` is coming: inline or computed
@@ -32,7 +32,8 @@ export interface MetadataListProps extends Omit<BaseProps<HTMLDivElement>, 'titl
32
32
  columns?: MetadataListColumns;
33
33
  /**
34
34
  * Label display configuration.
35
- * - position: 'start' places labels to the left, 'top' stacks labels above content
35
+ * - position: 'start' places each label at the inline start of its value,
36
+ * 'top' stacks labels above content
36
37
  * - width: Custom label width (number in px or CSS string)
37
38
  *
38
39
  * Defaults to `{ position: 'top' }` for multi-column layouts and
@@ -1 +1 @@
1
- {"version":3,"file":"MetadataList.d.ts","sourceRoot":"","sources":["../../src/MetadataList/MetadataList.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAqC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAQzE,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAgB5C,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE9D,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAC7C,SAAS,CAAC,cAAc,CAAC,EACzB,OAAO,CACR;IACC,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,uBAAuB,CAAC;IAChC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACxC;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;A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EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,GAAG,SAAS,EACb,EAAE,iBAAiB,+BA+HnB;yBA5Ie,YAAY"}
@@ -168,7 +168,7 @@ export function MetadataList({
168
168
  if (isStacked) {
169
169
  return columns === 'single' || columns === 1 ? styles.gridStackedSingle : styles.gridStackedMulti;
170
170
  }
171
- // Labels on the left
171
+ // Labels at the inline start
172
172
  if (columns === 'single' || columns === 1) {
173
173
  return styles.gridSingle;
174
174
  }
package/dist/astryx.css CHANGED
@@ -201,6 +201,7 @@
201
201
  .x18jk3ff{--_segmented-control-padding:var(--spacing-0-5)}
202
202
  .x9icjy1{--_segmented-control-radius:var(--radius-element)}
203
203
  .x1jx3mzq{--_sheet-scrim-duration:initial}
204
+ .x1pfqsku{--_sheet-scrim-easing:initial}
204
205
  .xnvc5mv{--_sheet-scrim-opacity:initial}
205
206
  .x69vvuq{--_spinner-box-size:calc(var(--_spinner-ring-diameter) + var(--_spinner-ring-stroke) * 2)}
206
207
  .x2lq4xu{--_spinner-ring-diameter:var(--spinner-diameter)}
@@ -2684,8 +2685,8 @@
2684
2685
  .xc0dz0a:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::backdrop{transition-property:opacity,display}
2685
2686
  .x167zut7:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::backdrop{transition-property:opacity}
2686
2687
  .x1hu8v7x:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{transition-property:transform}
2687
- .x1cz9k3x:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::backdrop{transition-timing-function:linear}
2688
2688
  .xyt8op7:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{transition-timing-function:linear}
2689
+ .x1w553ls:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::backdrop{transition-timing-function:var(--_sheet-scrim-easing,linear)}
2689
2690
  .x15h3t91:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::backdrop{transition-timing-function:var(--ease-standard)}
2690
2691
  .x1dlmc9c:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{transition-timing-function:var(--ease-standard)}
2691
2692
  .xa5v58t:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{transition-timing-function:var(--ease-standard)}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @file shared-context.ts
3
+ * @input Core's shared React context helper
4
+ * @output `@astryxdesign/core/internal/shared-context`: createSharedContext,
5
+ * re-exported by name for Lab components
6
+ * @position An internal entry reserved for Astryx's own packages:
7
+ * undocumented, outside the public API and its compatibility promise,
8
+ * versioned in lockstep with Core, and allowed only in Core and Lab by the
9
+ * `@astryx/no-core-internal-import` lint rule. Core components import the
10
+ * same module by relative path. Named re-exports only.
11
+ *
12
+ * SYNC: When modified, update scripts/sync-exports.js.
13
+ */
14
+ export { createSharedContext } from '../utils/sharedContext.js';
15
+ //# sourceMappingURL=shared-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-context.d.ts","sourceRoot":"","sources":["../../src/internal/shared-context.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ /**
3
+ * @file shared-context.ts
4
+ * @input Core's shared React context helper
5
+ * @output `@astryxdesign/core/internal/shared-context`: createSharedContext,
6
+ * re-exported by name for Lab components
7
+ * @position An internal entry reserved for Astryx's own packages:
8
+ * undocumented, outside the public API and its compatibility promise,
9
+ * versioned in lockstep with Core, and allowed only in Core and Lab by the
10
+ * `@astryx/no-core-internal-import` lint rule. Core components import the
11
+ * same module by relative path. Named re-exports only.
12
+ *
13
+ * SYNC: When modified, update scripts/sync-exports.js.
14
+ */
15
+ export { createSharedContext } from "../utils/sharedContext.js";
@@ -1 +1 @@
1
- {"version":3,"file":"animatedLayout.d.ts","sourceRoot":"","sources":["../../src/motion/animatedLayout.ts"],"names":[],"mappings":"AAoGA,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,UAAU,CAAC;AAqBlB,sDAAsD;AACtD,KAAK,YAAY,GACb;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAA;CAAC,GAC1D;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,GACD;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAC,CAAC;AAE/B,sEAAsE;AACtE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAsCD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAM5E;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,iBAAiB,EACzB,QAAQ,EAAE,MAAM,GACf,aAAa,CAQf;AAipBD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAGzD;AAkMD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAE1D;AAS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AAkB,EAClB,QAAe,EACf,KAAK,GACN,GAAE;IACD,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,KAAK,eAAe,CAAC;CAClE,GACL,gBAAgB,CAuKlB;AAMD,mEAAmE;AACnE,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,aAAa,IAAI,IAAI,CAAC;IACtB;;;;OAIG;IACH,OAAO,IAAI,IAAI,CAAC;IAChB,wEAAwE;IACxE,MAAM,IAAI,IAAI,CAAC;CAChB;AA8KD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,EACzC,UAAU,EAAE,MAAM,WAAW,GAAG,IAAI,EACpC,EAAC,IAAkB,EAAC,GAAE;IAAC,IAAI,CAAC,EAAE,UAAU,CAAA;CAAM,GAC7C,gBAAgB,CA8JlB;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,EACzC,OAAO,EAAE,WAAW,GAAG,UAAU,GAAG,IAAI,GACvC,IAAI,CA2BN;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAMtD;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+B9D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CAE3D"}
@@ -82,6 +82,7 @@
82
82
  */
83
83
 
84
84
  import { LATE_START_MS } from "./frameBlock.js";
85
+ import { linearEasing, sampleCount } from "./linearEasing.js";
85
86
  import { sharedKey, sharedMap, sharedState, sharedWeakMap, sharedWeakSet } from "../utils/sharedRealm.js";
86
87
  import { paintedBackground } from "./inertClone.js";
87
88
  import { inertCopy, isCopyable, placeOver, visiblePartCopy, wrapText } from "./transientCopy.js";
@@ -95,8 +96,6 @@ import { batchPresented, clearPresentedResolve, registerPresentedOffset, writePr
95
96
  const MIN_SHIFT_PX = 0.5;
96
97
  /** The touch cross-fade's cap (`design:reduced-motion` DR2). */
97
98
  const CROSS_FADE_CAP_MS = 200;
98
- /** Keyframes per second the motion is sampled at. */
99
- const SAMPLES_PER_SECOND = 60;
100
99
 
101
100
  // ---------------------------------------------------------------------------
102
101
  // Motion
@@ -167,21 +166,10 @@ export function springGlide(spring, velocity) {
167
166
  const remaining = t => t >= durationMs ? 0 : 1 - curve.value(t / 1000);
168
167
  return {
169
168
  durationMs,
170
- easing: linearEasing(durationMs, remaining),
169
+ easing: linearEasing(durationMs, t => 1 - remaining(t)),
171
170
  remaining
172
171
  };
173
172
  }
174
-
175
- /** A move's remaining fraction over time as CSS `linear()` easing text. */
176
- function linearEasing(durationMs, remaining) {
177
- const count = sampleCount(durationMs);
178
- const stops = [];
179
- for (let i = 0; i < count; i++) {
180
- const done = 1 - remaining(i / (count - 1) * durationMs);
181
- stops.push(String(Math.round(done * 10000) / 10000));
182
- }
183
- return `linear(${stops.join(', ')})`;
184
- }
185
173
  function releaseGlideFor(area) {
186
174
  for (let at = area; at != null; at = at.parentElement) {
187
175
  const progress = releaseGlides.get(at);
@@ -215,9 +203,6 @@ function layoutMotion(area) {
215
203
  progress
216
204
  };
217
205
  }
218
- function sampleCount(durationMs) {
219
- return Math.max(2, Math.ceil(durationMs / 1000 * SAMPLES_PER_SECOND) + 1);
220
- }
221
206
 
222
207
  /** Linear keyframes over `durationMs`, one per frame, from `frame(t ms)`. */
223
208
  function sampleOver(durationMs, frame) {
@@ -0,0 +1,9 @@
1
+ /** How many samples cover `durationMs`, both ends included: at least 2. */
2
+ export declare function sampleCount(durationMs: number): number;
3
+ /**
4
+ * The curve `done` traces over `durationMs` as CSS `linear()` easing text,
5
+ * one stop per frame. `done(t)` is the fraction of the move done `t` ms in.
6
+ * A CSS transition with this easing and duration follows the curve.
7
+ */
8
+ export declare function linearEasing(durationMs: number, done: (t: number) => number): string;
9
+ //# sourceMappingURL=linearEasing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linearEasing.d.ts","sourceRoot":"","sources":["../../src/motion/linearEasing.ts"],"names":[],"mappings":"AAaA,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,GAC1B,MAAM,CAQR"}
@@ -0,0 +1,32 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file linearEasing.ts
5
+ * @input A duration and the fraction of a move done at each time
6
+ * @output Exports `linearEasing`, that curve as CSS `linear()` easing text,
7
+ * and `sampleCount`, how many samples cover a duration at 60 per second
8
+ * @position Pure math under the motion helpers; no DOM, no React
9
+ */
10
+
11
+ /** Samples per second of a sampled curve: one per frame at 60 Hz. */
12
+ const SAMPLES_PER_SECOND = 60;
13
+
14
+ /** How many samples cover `durationMs`, both ends included: at least 2. */
15
+ export function sampleCount(durationMs) {
16
+ return Math.max(2, Math.ceil(durationMs / 1000 * SAMPLES_PER_SECOND) + 1);
17
+ }
18
+
19
+ /**
20
+ * The curve `done` traces over `durationMs` as CSS `linear()` easing text,
21
+ * one stop per frame. `done(t)` is the fraction of the move done `t` ms in.
22
+ * A CSS transition with this easing and duration follows the curve.
23
+ */
24
+ export function linearEasing(durationMs, done) {
25
+ const count = sampleCount(durationMs);
26
+ const stops = [];
27
+ for (let i = 0; i < count; i++) {
28
+ const value = done(i / (count - 1) * durationMs);
29
+ stops.push(String(Math.round(value * 10000) / 10000));
30
+ }
31
+ return `linear(${stops.join(', ')})`;
32
+ }