@fragiola/primitives 0.0.0-stage → 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +50 -2
  3. package/dist/async-list-Bv6ff5Oj.js +81 -0
  4. package/dist/async-list-Bv6ff5Oj.js.map +1 -0
  5. package/dist/async-list.d.ts +2 -0
  6. package/dist/async-list.js +1 -0
  7. package/dist/calendar-keys-DGYpjLwv.d.ts +12 -0
  8. package/dist/calendar-system-B5U5HcPQ.d.ts +415 -0
  9. package/dist/calendar-systems-Daa6Q_ca.js +659 -0
  10. package/dist/calendar-systems-Daa6Q_ca.js.map +1 -0
  11. package/dist/calendar-systems.d.ts +3 -0
  12. package/dist/calendar-systems.js +1 -0
  13. package/dist/carousel-LRbWqbAx.js +375 -0
  14. package/dist/carousel-LRbWqbAx.js.map +1 -0
  15. package/dist/carousel.d.ts +2 -0
  16. package/dist/carousel.js +1 -0
  17. package/dist/cascade-B155Xvvv.js +64 -0
  18. package/dist/cascade-B155Xvvv.js.map +1 -0
  19. package/dist/cascade.d.ts +2 -0
  20. package/dist/cascade.js +1 -0
  21. package/dist/clipboard-Cy2cbGEW.js +33 -0
  22. package/dist/clipboard-Cy2cbGEW.js.map +1 -0
  23. package/dist/clipboard.d.ts +2 -0
  24. package/dist/clipboard.js +1 -0
  25. package/dist/collection-Dbk-PB5S.js +609 -0
  26. package/dist/collection-Dbk-PB5S.js.map +1 -0
  27. package/dist/collection.d.ts +2 -0
  28. package/dist/collection.js +3 -0
  29. package/dist/color-sURV5Irg.js +699 -0
  30. package/dist/color-sURV5Irg.js.map +1 -0
  31. package/dist/color.d.ts +2 -0
  32. package/dist/color.js +1 -0
  33. package/dist/command-DueCXi65.js +104 -0
  34. package/dist/command-DueCXi65.js.map +1 -0
  35. package/dist/command.d.ts +2 -0
  36. package/dist/command.js +1 -0
  37. package/dist/date-CrbFSJKQ.js +215 -0
  38. package/dist/date-CrbFSJKQ.js.map +1 -0
  39. package/dist/date.d.ts +4 -0
  40. package/dist/date.js +1 -0
  41. package/dist/direction-CTnVLpmd.d.ts +8 -0
  42. package/dist/direction-DJDPvnxJ.js +13 -0
  43. package/dist/direction-DJDPvnxJ.js.map +1 -0
  44. package/dist/direction.d.ts +2 -0
  45. package/dist/direction.js +1 -0
  46. package/dist/drag-session-CSr06B5v.js +41 -0
  47. package/dist/drag-session-CSr06B5v.js.map +1 -0
  48. package/dist/file-DSLtfzbi.js +263 -0
  49. package/dist/file-DSLtfzbi.js.map +1 -0
  50. package/dist/file.d.ts +2 -0
  51. package/dist/file.js +1 -0
  52. package/dist/focus-BI-VvM0f.js +75 -0
  53. package/dist/focus-BI-VvM0f.js.map +1 -0
  54. package/dist/focus.d.ts +2 -0
  55. package/dist/focus.js +3 -0
  56. package/dist/form-DovwKtqz.js +501 -0
  57. package/dist/form-DovwKtqz.js.map +1 -0
  58. package/dist/form.d.ts +2 -0
  59. package/dist/form.js +1 -0
  60. package/dist/hover-BakyPYnC.js +62 -0
  61. package/dist/hover-BakyPYnC.js.map +1 -0
  62. package/dist/hover.d.ts +2 -0
  63. package/dist/hover.js +1 -0
  64. package/dist/id-B0Y8iZrc.js +13 -0
  65. package/dist/id-B0Y8iZrc.js.map +1 -0
  66. package/dist/id.d.ts +2 -0
  67. package/dist/id.js +1 -0
  68. package/dist/image-D4X_yRYw.js +44 -0
  69. package/dist/image-D4X_yRYw.js.map +1 -0
  70. package/dist/image.d.ts +2 -0
  71. package/dist/image.js +1 -0
  72. package/dist/index-B0rwIZw9.d.ts +51 -0
  73. package/dist/index-B4wF1isn.d.ts +128 -0
  74. package/dist/index-BHiBRE01.d.ts +20 -0
  75. package/dist/index-BNlMm-0u.d.ts +17 -0
  76. package/dist/index-BapNrjY9.d.ts +48 -0
  77. package/dist/index-Bd-tVb7C.d.ts +6 -0
  78. package/dist/index-BjE8nDiX.d.ts +125 -0
  79. package/dist/index-BpbT-FsX.d.ts +117 -0
  80. package/dist/index-CBgGcTeX.d.ts +37 -0
  81. package/dist/index-CGThV_Md.d.ts +100 -0
  82. package/dist/index-CMig3TXL.d.ts +28 -0
  83. package/dist/index-CWFRduRd.d.ts +212 -0
  84. package/dist/index-CkrHWyU_.d.ts +33 -0
  85. package/dist/index-Cwu6f7y1.d.ts +18 -0
  86. package/dist/index-D10LDdR6.d.ts +139 -0
  87. package/dist/index-D146vm21.d.ts +104 -0
  88. package/dist/index-DGKhEvNr.d.ts +107 -0
  89. package/dist/index-DbAu4s16.d.ts +48 -0
  90. package/dist/index-DdaCj6IO.d.ts +54 -0
  91. package/dist/index-DeHcNdjC.d.ts +68 -0
  92. package/dist/index-DeR4ncrW.d.ts +93 -0
  93. package/dist/index-HIksgK0e.d.ts +70 -0
  94. package/dist/index-IZB0mlZl.d.ts +71 -0
  95. package/dist/index-IfDZj87U.d.ts +28 -0
  96. package/dist/index-SrTuVBms.d.ts +75 -0
  97. package/dist/index-T9UcYvkf.d.ts +339 -0
  98. package/dist/index-fRTojAoR.d.ts +31 -0
  99. package/dist/index-fuLUke9n.d.ts +6 -0
  100. package/dist/index-l63esAck.d.ts +104 -0
  101. package/dist/index-raSUg9U7.d.ts +38 -0
  102. package/dist/index-twgzPKvZ.d.ts +278 -0
  103. package/dist/index-wBpjRykh.d.ts +125 -0
  104. package/dist/index.d.ts +39 -0
  105. package/dist/index.js +42 -0
  106. package/dist/inert-DlGToy3q.js +80 -0
  107. package/dist/inert-DlGToy3q.js.map +1 -0
  108. package/dist/inert.d.ts +2 -0
  109. package/dist/inert.js +1 -0
  110. package/dist/layer-stack-BEtzaFC1.js +118 -0
  111. package/dist/layer-stack-BEtzaFC1.js.map +1 -0
  112. package/dist/layers-C-N4rrZX.js +24 -0
  113. package/dist/layers-C-N4rrZX.js.map +1 -0
  114. package/dist/layers.d.ts +2 -0
  115. package/dist/layers.js +3 -0
  116. package/dist/list-navigation-CbWv4DK5.js +40 -0
  117. package/dist/list-navigation-CbWv4DK5.js.map +1 -0
  118. package/dist/month-year-BG5imFUq.js +108 -0
  119. package/dist/month-year-BG5imFUq.js.map +1 -0
  120. package/dist/month-year.d.ts +3 -0
  121. package/dist/month-year.js +1 -0
  122. package/dist/number-BFUio97d.js +316 -0
  123. package/dist/number-BFUio97d.js.map +1 -0
  124. package/dist/number.d.ts +2 -0
  125. package/dist/number.js +1 -0
  126. package/dist/overlay-BwPyiM3T.js +78 -0
  127. package/dist/overlay-BwPyiM3T.js.map +1 -0
  128. package/dist/overlay.d.ts +2 -0
  129. package/dist/overlay.js +1 -0
  130. package/dist/pagination-BkVzaIGP.js +51 -0
  131. package/dist/pagination-BkVzaIGP.js.map +1 -0
  132. package/dist/pagination.d.ts +2 -0
  133. package/dist/pagination.js +1 -0
  134. package/dist/plain-date-idQH1P6X.d.ts +29 -0
  135. package/dist/plain-date-time-B8PGahhe.d.ts +99 -0
  136. package/dist/pointer-CuDtD9XA.js +189 -0
  137. package/dist/pointer-CuDtD9XA.js.map +1 -0
  138. package/dist/pointer.d.ts +2 -0
  139. package/dist/pointer.js +3 -0
  140. package/dist/positioning-DDUQ75mB.js +148 -0
  141. package/dist/positioning-DDUQ75mB.js.map +1 -0
  142. package/dist/positioning.d.ts +2 -0
  143. package/dist/positioning.js +1 -0
  144. package/dist/presence-BhKDOmII.js +86 -0
  145. package/dist/presence-BhKDOmII.js.map +1 -0
  146. package/dist/presence.d.ts +2 -0
  147. package/dist/presence.js +1 -0
  148. package/dist/range-o0_GBhyY.js +158 -0
  149. package/dist/range-o0_GBhyY.js.map +1 -0
  150. package/dist/range.d.ts +2 -0
  151. package/dist/range.js +1 -0
  152. package/dist/scroll-area-BYNhv36t.js +447 -0
  153. package/dist/scroll-area-BYNhv36t.js.map +1 -0
  154. package/dist/scroll-area.d.ts +2 -0
  155. package/dist/scroll-area.js +1 -0
  156. package/dist/scroll-lock-JzRNOA1O.js +42 -0
  157. package/dist/scroll-lock-JzRNOA1O.js.map +1 -0
  158. package/dist/scroll-lock.d.ts +2 -0
  159. package/dist/scroll-lock.js +1 -0
  160. package/dist/segments-eRu5G_Bd.js +587 -0
  161. package/dist/segments-eRu5G_Bd.js.map +1 -0
  162. package/dist/segments.d.ts +3 -0
  163. package/dist/segments.js +1 -0
  164. package/dist/selection-Cor67w_V.js +287 -0
  165. package/dist/selection-Cor67w_V.js.map +1 -0
  166. package/dist/selection.d.ts +2 -0
  167. package/dist/selection.js +1 -0
  168. package/dist/swipe.d.ts +2 -0
  169. package/dist/swipe.js +1 -0
  170. package/dist/tabbable-BPiLssIv.js +35 -0
  171. package/dist/tabbable-BPiLssIv.js.map +1 -0
  172. package/dist/time-Ct6oq9kt.js +208 -0
  173. package/dist/time-Ct6oq9kt.js.map +1 -0
  174. package/dist/time-zone-DegkzwST.js +305 -0
  175. package/dist/time-zone-DegkzwST.js.map +1 -0
  176. package/dist/time-zone.d.ts +2 -0
  177. package/dist/time-zone.js +1 -0
  178. package/dist/time.d.ts +2 -0
  179. package/dist/time.js +1 -0
  180. package/dist/toast-BjRpJalM.js +400 -0
  181. package/dist/toast-BjRpJalM.js.map +1 -0
  182. package/dist/toast.d.ts +2 -0
  183. package/dist/toast.js +1 -0
  184. package/dist/unit-grid-DJy8lb5D.d.ts +21 -0
  185. package/dist/virtual-BlX1RuHD.js +306 -0
  186. package/dist/virtual-BlX1RuHD.js.map +1 -0
  187. package/dist/virtual.d.ts +2 -0
  188. package/dist/virtual.js +1 -0
  189. package/dist/watch-swipe-BIucfr9O.js +301 -0
  190. package/dist/watch-swipe-BIucfr9O.js.map +1 -0
  191. package/package.json +234 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mauro de Souza
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,51 @@
1
- # Temporary Holding Version
1
+ # @fragiola/primitives
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The framework-free **DOM toolkit** of [Fragiola Primitives](https://fragiola.com/primitives):
4
+ the DOM behaviours and the pure math that the React, Vue and Angular primitives
5
+ (`@fragiola/primitives-react`, `-vue`, `-angular`) share. It holds no component state: every
6
+ function takes elements and options, and returns a value or a cleanup.
7
+
8
+ ```sh
9
+ pnpm add @fragiola/primitives
10
+ ```
11
+
12
+ **One entry per mechanism.** Import what you use from its subpath; the root entry only re-exports
13
+ them, so both tree-shake to the same output.
14
+
15
+ | entry | what |
16
+ | --- | --- |
17
+ | `@fragiola/primitives/overlay` | `openOverlaySession(document, options)`: a layer, the focus-out watch and the focus return of an overlay |
18
+ | `@fragiola/primitives/layers` | `pushLayer(document, options)` (Escape and outside press on the topmost overlay), `watchFocusOutside` |
19
+ | `@fragiola/primitives/focus` | `getTabbables`, `nextTabbableAfter`, `previousTabbableBefore`, `trapFocus`, `focusInitial`, `isKeyboardModality` |
20
+ | `@fragiola/primitives/scroll-area` | a scroll area's DOM side: `createScrollArea` (measures the viewport and its content on scroll and resize, writes the thumbs' sizes and transforms and the overflow variables, runs the thumb drag, the track press and the scrollbar's wheel, reports the overflow edges, scrolling and hover), its geometry (`thumbGeometry`, `scrollFromStart`, `scrollForThumbOffset`) |
21
+ | `@fragiola/primitives/scroll-lock` | `lockScroll(document)` → unlock (counted) |
22
+ | `@fragiola/primitives/inert` | `inertOutside(elements)` → restore |
23
+ | `@fragiola/primitives/positioning` | `anchorFloating(anchor, floating, options)` → cleanup (Floating UI), `toPlacement`, `fromPlacement`, `Side`, `Align` |
24
+ | `@fragiola/primitives/collection` | `stepIndex`, `edgeIndex`, `stepThroughNone`, `tabsKeyTarget`, `menuKeyTarget`, `submenuKeys`, the roving focus (`rovingKeyTarget`, `rovingKeys`, `rovingTabStop`, `textFieldKeepsKey`, `inDocumentOrder`), `createTypeahead`, the combobox's item helpers, `chipKeyTarget`, the tags' keys (`tagGroupKeyTarget`, `removalFocusIndex`, `tagsInputInputKeyTarget`, `tagsInputTagKeyTarget`), a segmented control's Indicator (`segmentIndicatorBox`, `placeSegmentIndicator`) |
25
+ | `@fragiola/primitives/presence` | `nextFrame`, `waitForAnimations` |
26
+ | `@fragiola/primitives/color` | the color model: an immutable `Color` in rgb, hsl and hsb with alpha, `parseColor`, `formatColor`, `convertColor` (a fixed precision per channel), the channels' ranges and `Intl` text, the CSS gradients of a track, an area and a wheel, an area's and a wheel's keys and geometry, the browser's eyedropper (`openEyeDropper`, `supportsEyeDropper`) |
27
+ | `@fragiola/primitives/carousel` | a carousel's DOM side: its pages (`carouselPages`, pure math), the scroll to a page and the page a scroll settled on, the mouse drag, the hover and focus watch (`watchCarousel`, native listeners) and the rotation's delay (`createRotationTimer`) |
28
+ | `@fragiola/primitives/clipboard` | a copy to the clipboard: `writeClipboard` (the asynchronous Clipboard API, no `execCommand` fallback) and `announceText` (a live region's text, a new node each time) |
29
+ | `@fragiola/primitives/pagination` | a pagination's range: `paginationRange` (the pages and ellipses around the current page, the boundaries kept), `pageCount`, `clampPage`; pure math |
30
+ | `@fragiola/primitives/pointer` | `startDrag`, `isInSafeArea`, `isInHoverBridge`, `trackHoverBridge` |
31
+ | `@fragiola/primitives/swipe` | `watchSwipe(element, options)` → cleanup (pointer and touch swipes, scroll containment), `swipeRelease`, `swipeMovement`, `swipeProgress`, `resolveSnapPoints` |
32
+ | `@fragiola/primitives/toast` | the toast queue: `createToastManager` (add, update, close, promise toasts, a limit and its queue, priorities, timeouts and pauses; a plain module can import it), `watchToastViewport` (the F6 landmark, the pauses, the live regions), `measureToastHeight` |
33
+ | `@fragiola/primitives/hover` | `createHoverIntent`, `createDelayGroup` |
34
+ | `@fragiola/primitives/range` | range math (`snapToStep`, `valueToPercent`, thumbs), `sliderKeyTarget` and a rating's steps (`ratingKeyTarget`, `ratingValueAt`, `ratingItemState`) |
35
+ | `@fragiola/primitives/number` | a number field's localized text (`formatNumber`, `parseNumber`, `isNumberText`: grouping, decimal separators, non-Latin digits, currency and percent), `stepNumber`, `clampNumber`, the press-and-hold `watchAutoRepeat` and the `watchScrub` of a scrub area |
36
+ | `@fragiola/primitives/selection` | the collections mechanism: the list model (`createListModel`), the selection rules (`applySelection`: `none`, `single`, `multiple`, the APG's toggle and replace models, ranges, select all) and the listbox's key map (`listKeyTarget`, `listPressSelection`, `pageTarget`), a wrapping list's row above or below (`rowTarget`, a color swatch picker's) |
37
+ | `@fragiola/primitives/virtual` | the virtualizer: `createVirtualizer` (the rows of a long list for its scroll position: fixed or measured sizes, overscan, pinned rows, sticky group labels, `scrollToIndex`, `pageIndex`), the pure `virtualLayout`, `scrollContainer` |
38
+ | `@fragiola/primitives/async-list` | `createAsyncList`: the first page, the next pages and a filter text's pages through a loader, a stale load aborted, the loading and error states |
39
+ | `@fragiola/primitives/form` | `bridgeForm`, `validateField`, the field's state and change rules, `onSubmitAttempt`, a Label's press (`preventLabelSelection`, `labelFocusTarget`), an OTP field's value (`normalizeOtp`, `replaceOtp`, `removeOtpCharacter`, `otpPattern`), a tags input's rules (`takeTags`, `editTag`) |
40
+ | `@fragiola/primitives/date` | `PlainDate` (`{ year, month, day }`, no time zone) and its math, `monthGrid`, `calendarKeyTarget`, the locale data from `Intl` |
41
+ | `@fragiola/primitives/month-year` | `PlainYearMonth` and `PlainYear` (no day, no time zone), their ranges and ISO text, the month and year calendars' 12-item page (`unitPageStart`, `unitRows`, `unitKeyTarget`) and their names from `Intl` (`formatMonthName`, `formatYearMonth`, `formatYear`, `formatYearSpan`) |
42
+ | `@fragiola/primitives/time` | `PlainTime` and `PlainDateTime` (no time zone), their comparison, math (`addTime`, `cycleTime`, `addDateTime`), ISO text and the clock's now; `TimeRange` |
43
+ | `@fragiola/primitives/segments` | the date and time fields' segment editing: `segmentFormat` (from `Intl.DateTimeFormat#formatToParts`: order, literals, hour cycle, digits, day periods, names), `dateSegments`, `typeSegment`, `eraseSegment`, `stepSegment`, `segmentKeyDown`, `segmentTarget` (across several groups: a range's two ends) |
44
+ | `@fragiola/primitives/id` | `createId` |
45
+ | `@fragiola/primitives/direction` | `getDirection(element)` |
46
+
47
+ ESM only, `"sideEffects": false`. It never touches the global `document` or `window` (only an
48
+ element's `ownerDocument` and `defaultView`), and its only runtime dependency is
49
+ `@floating-ui/dom`, reached by the positioning entry alone.
50
+
51
+ MIT licence.
@@ -0,0 +1,81 @@
1
+ // src/async-list/async-list.ts
2
+ function createAsyncList(options) {
3
+ let state = {
4
+ items: [],
5
+ filterText: options.filterText ?? "",
6
+ status: "idle",
7
+ error: void 0,
8
+ hasMore: false
9
+ };
10
+ let cursor;
11
+ let controller = null;
12
+ const set = (next) => {
13
+ state = {
14
+ ...state,
15
+ ...next
16
+ };
17
+ options.onChange?.(state);
18
+ };
19
+ const run = (more) => {
20
+ controller?.abort();
21
+ const own = new AbortController();
22
+ controller = own;
23
+ if (!more) cursor = void 0;
24
+ set({
25
+ status: more ? "loading-more" : "loading",
26
+ error: void 0,
27
+ ...more ? {} : { hasMore: false }
28
+ });
29
+ let page;
30
+ try {
31
+ page = options.load({
32
+ signal: own.signal,
33
+ filterText: state.filterText,
34
+ cursor: more ? cursor : void 0
35
+ });
36
+ } catch (error) {
37
+ page = Promise.reject(error);
38
+ }
39
+ page.then((result) => {
40
+ if (controller !== own || own.signal.aborted) return;
41
+ controller = null;
42
+ cursor = result.cursor ?? void 0;
43
+ set({
44
+ items: more ? [...state.items, ...result.items] : result.items,
45
+ status: "idle",
46
+ hasMore: result.cursor !== void 0 && result.cursor !== null
47
+ });
48
+ }, (error) => {
49
+ if (controller !== own || own.signal.aborted) return;
50
+ controller = null;
51
+ set({
52
+ status: "error",
53
+ error
54
+ });
55
+ });
56
+ };
57
+ return {
58
+ state: () => state,
59
+ reload: () => run(false),
60
+ loadMore() {
61
+ if (state.status !== "idle" || !state.hasMore) return;
62
+ run(true);
63
+ },
64
+ setFilterText(text) {
65
+ state = {
66
+ ...state,
67
+ filterText: text
68
+ };
69
+ run(false);
70
+ },
71
+ abort() {
72
+ if (controller === null) return;
73
+ controller.abort();
74
+ controller = null;
75
+ set({ status: "idle" });
76
+ }
77
+ };
78
+ }
79
+ export { createAsyncList as t };
80
+
81
+ //# sourceMappingURL=async-list-Bv6ff5Oj.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-list-Bv6ff5Oj.js","names":[],"sources":["../src/async-list/async-list.ts"],"sourcesContent":["/**\n * Where an async list is: `loading` (the first page, or a new filter text), `loading-more` (the\n * next page), `error` (the last load failed), `idle`.\n */\nexport type AsyncListStatus = \"idle\" | \"loading\" | \"loading-more\" | \"error\";\n\nexport interface AsyncListState<Item> {\n items: readonly Item[];\n /** The text the items were asked for (sent to the loader). */\n filterText: string;\n status: AsyncListStatus;\n /** What the last failed load threw (`undefined` unless `status` is `error`). */\n error: unknown;\n /** Whether the loader gave a cursor for a next page. */\n hasMore: boolean;\n}\n\n/** What the loader is asked: its abort signal, the filter text and the next page's cursor. */\nexport interface AsyncListRequest<Cursor> {\n /** Aborted when a newer load replaces this one: a stale load's result is never used. */\n signal: AbortSignal;\n filterText: string;\n /** `undefined` for the first page, else the cursor the previous page gave. */\n cursor: Cursor | undefined;\n}\n\n/** A page of items, and the cursor of the next one (`null` or absent: no next page). */\nexport interface AsyncListPage<Item, Cursor> {\n items: readonly Item[];\n cursor?: Cursor | null;\n}\n\nexport type AsyncListLoad<Item, Cursor> = (\n request: AsyncListRequest<Cursor>,\n) => Promise<AsyncListPage<Item, Cursor>>;\n\nexport interface AsyncListOptions<Item, Cursor> {\n load: AsyncListLoad<Item, Cursor>;\n /** The first filter text (default `\"\"`). */\n filterText?: string;\n /** The state changed. */\n onChange?: (state: AsyncListState<Item>) => void;\n}\n\n/**\n * An async list (spec/README.md, \"Async lists\"): loads the first page, the next pages and the\n * pages of a new filter text through the consumer's loader, aborting a stale load, and keeps the\n * items, the status and the error. Framework-free; a framework wraps it in its own state.\n */\nexport interface AsyncList<Item> {\n state(): AsyncListState<Item>;\n /** Loads the first page again (aborting a load in flight). */\n reload(): void;\n /** Loads the next page, unless one is loading, the last load failed, or there is none. */\n loadMore(): void;\n /** Loads the first page for a new text (aborting a load in flight); the items stay until it arrives. */\n setFilterText(text: string): void;\n /** Aborts a load in flight (the list goes back to `idle`). */\n abort(): void;\n}\n\nexport function createAsyncList<Item, Cursor = unknown>(\n options: AsyncListOptions<Item, Cursor>,\n): AsyncList<Item> {\n let state: AsyncListState<Item> = {\n items: [],\n filterText: options.filterText ?? \"\",\n status: \"idle\",\n error: undefined,\n hasMore: false,\n };\n let cursor: Cursor | undefined;\n let controller: AbortController | null = null;\n\n const set = (next: Partial<AsyncListState<Item>>) => {\n state = { ...state, ...next };\n options.onChange?.(state);\n };\n const run = (more: boolean) => {\n controller?.abort();\n const own = new AbortController();\n controller = own;\n if (!more) {\n // a first page: the previous text's cursor is not this one's\n cursor = undefined;\n }\n set({\n status: more ? \"loading-more\" : \"loading\",\n error: undefined,\n ...(more ? {} : { hasMore: false }),\n });\n let page: Promise<AsyncListPage<Item, Cursor>>;\n try {\n page = options.load({\n signal: own.signal,\n filterText: state.filterText,\n cursor: more ? cursor : undefined,\n });\n } catch (error) {\n page = Promise.reject(error);\n }\n page.then(\n (result) => {\n // a newer load replaced this one: its result is stale\n if (controller !== own || own.signal.aborted) {\n return;\n }\n controller = null;\n cursor = result.cursor ?? undefined;\n set({\n items: more\n ? [...state.items, ...result.items]\n : result.items,\n status: \"idle\",\n hasMore:\n result.cursor !== undefined && result.cursor !== null,\n });\n },\n (error: unknown) => {\n if (controller !== own || own.signal.aborted) {\n return;\n }\n controller = null;\n set({ status: \"error\", error });\n },\n );\n };\n\n return {\n state: () => state,\n reload: () => run(false),\n loadMore() {\n // after a failed load, only `reload` loads again (no retry loop at the list's end)\n if (state.status !== \"idle\" || !state.hasMore) {\n return;\n }\n run(true);\n },\n setFilterText(text) {\n state = { ...state, filterText: text };\n run(false);\n },\n abort() {\n if (controller === null) {\n return;\n }\n controller.abort();\n controller = null;\n set({ status: \"idle\" });\n },\n };\n}\n"],"mappings":";AA6DA,SAAgB,gBACZ,SACe;CACf,IAAI,QAA8B;EAC9B,OAAO,CAAC;EACR,YAAY,QAAQ,cAAc;EAClC,QAAQ;EACR,OAAO,KAAA;EACP,SAAS;CACb;CACA,IAAI;CACJ,IAAI,aAAqC;CAEzC,MAAM,OAAO,SAAwC;EACjD,QAAQ;GAAE,GAAG;GAAO,GAAG;EAAK;EAC5B,QAAQ,WAAW,KAAK;CAC5B;CACA,MAAM,OAAO,SAAkB;EAC3B,YAAY,MAAM;EAClB,MAAM,MAAM,IAAI,gBAAgB;EAChC,aAAa;EACb,IAAI,CAAC,MAED,SAAS,KAAA;EAEb,IAAI;GACA,QAAQ,OAAO,iBAAiB;GAChC,OAAO,KAAA;GACP,GAAI,OAAO,CAAC,IAAI,EAAE,SAAS,MAAM;EACrC,CAAC;EACD,IAAI;EACJ,IAAI;GACA,OAAO,QAAQ,KAAK;IAChB,QAAQ,IAAI;IACZ,YAAY,MAAM;IAClB,QAAQ,OAAO,SAAS,KAAA;GAC5B,CAAC;EACL,SAAS,OAAO;GACZ,OAAO,QAAQ,OAAO,KAAK;EAC/B;EACA,KAAK,MACA,WAAW;GAER,IAAI,eAAe,OAAO,IAAI,OAAO,SACjC;GAEJ,aAAa;GACb,SAAS,OAAO,UAAU,KAAA;GAC1B,IAAI;IACA,OAAO,OACD,CAAC,GAAG,MAAM,OAAO,GAAG,OAAO,KAAK,IAChC,OAAO;IACb,QAAQ;IACR,SACI,OAAO,WAAW,KAAA,KAAa,OAAO,WAAW;GACzD,CAAC;EACL,IACC,UAAmB;GAChB,IAAI,eAAe,OAAO,IAAI,OAAO,SACjC;GAEJ,aAAa;GACb,IAAI;IAAE,QAAQ;IAAS;GAAM,CAAC;EAClC,CACJ;CACJ;CAEA,OAAO;EACH,aAAa;EACb,cAAc,IAAI,KAAK;EACvB,WAAW;GAEP,IAAI,MAAM,WAAW,UAAU,CAAC,MAAM,SAClC;GAEJ,IAAI,IAAI;EACZ;EACA,cAAc,MAAM;GAChB,QAAQ;IAAE,GAAG;IAAO,YAAY;GAAK;GACrC,IAAI,KAAK;EACb;EACA,QAAQ;GACJ,IAAI,eAAe,MACf;GAEJ,WAAW,MAAM;GACjB,aAAa;GACb,IAAI,EAAE,QAAQ,OAAO,CAAC;EAC1B;CACJ;AACJ"}
@@ -0,0 +1,2 @@
1
+ import { a as AsyncListRequest, c as createAsyncList, i as AsyncListPage, n as AsyncListLoad, o as AsyncListState, r as AsyncListOptions, s as AsyncListStatus, t as AsyncList } from "./index-DdaCj6IO.js";
2
+ export { type AsyncList, type AsyncListLoad, type AsyncListOptions, type AsyncListPage, type AsyncListRequest, type AsyncListState, type AsyncListStatus, createAsyncList };
@@ -0,0 +1 @@
1
+ export { t as createAsyncList } from "./async-list-Bv6ff5Oj.js";
@@ -0,0 +1,12 @@
1
+ import { n as PlainDate } from "./plain-date-idQH1P6X.js";
2
+ interface CalendarKeyOptions {
3
+ rtl: boolean;
4
+ firstDayOfWeek: number;
5
+ shiftKey: boolean;
6
+ }
7
+ /**
8
+ * The date a key moves the focused date to in a calendar grid (spec/calendar.md, "Keyboard", the
9
+ * APG date grid), or `null` when the key does not move it.
10
+ */
11
+ declare function calendarKeyTarget(key: string, focused: PlainDate, { rtl, firstDayOfWeek, shiftKey }: CalendarKeyOptions): PlainDate | null;
12
+ export { calendarKeyTarget as n, CalendarKeyOptions as t };
@@ -0,0 +1,415 @@
1
+ import { t as CalendarKeyOptions } from "./calendar-keys-DGYpjLwv.js";
2
+ import { n as PlainDate } from "./plain-date-idQH1P6X.js";
3
+ import { n as UnitKeyOptions } from "./unit-grid-DJy8lb5D.js";
4
+ import { f as IsoTimePrecision, h as TimeField, n as PlainDateTime, p as PlainTime, t as DateTimeDuration } from "./plain-date-time-B8PGahhe.js";
5
+ /** A month or a year of a calendar system: `{ year, month }`, or `{ year }`. */
6
+ interface CalendarUnit {
7
+ readonly year: number;
8
+ readonly month?: number;
9
+ }
10
+ /**
11
+ * The items of a month or year calendar in a calendar system (spec/calendar-systems.md, "Month and
12
+ * year calendars"), as numbers: a month's `monthIndex` (a page is its year: 12 or 13 months), or
13
+ * the year (a page of 12 from a multiple of 12, as the ISO calendar's).
14
+ */
15
+ interface CalendarUnits {
16
+ /** The number of a month or year. */
17
+ index(item: CalendarUnit): number;
18
+ /** The month or year of a number. */
19
+ item(index: number): CalendarUnit;
20
+ /** The first item of the page holding `index`. */
21
+ pageStart(index: number): number;
22
+ /** How many items the page starting at `start` holds. */
23
+ pageSize(start: number): number;
24
+ /** The first item of the next (`1`) or previous (`-1`) page (a year can have 13 months). */
25
+ page(start: number, delta: 1 | -1): number;
26
+ /** Today's month or year (the page's local date). */
27
+ today(): number;
28
+ /** The page starting at `start`, in rows of `columns`. */
29
+ rows(start: number, columns: number): number[][];
30
+ /** The item a key moves to (the ISO calendar's `unitKeyTarget`, a page being a year). */
31
+ keyTarget(key: string, focused: number, options: UnitKeyOptions): number | null;
32
+ /** The month or year of an ISO date. */
33
+ fromDate(date: PlainDate): number;
34
+ /** The ISO dates of a month or year. */
35
+ days(index: number): PlainDate[];
36
+ /**
37
+ * A CalendarView's choice of a month or year: its enabled day nearest to the focused date's
38
+ * place in it (the same day of the month, the same month and day of the year); `undefined`
39
+ * when every day is disabled.
40
+ */
41
+ nearest(index: number, focused: PlainDate, enabled: (date: PlainDate) => boolean): PlainDate | undefined;
42
+ /** A month's cell content ("Azar"), a year's ("1405"). */
43
+ text(locale: string, index: number): string;
44
+ /** A cell's name ("Azar 1405", "1405"). */
45
+ name(locale: string, index: number): string;
46
+ /** The page's heading: the year of a month page, the span of a year page ("1395 – 1406"). */
47
+ heading(locale: string, start: number): string;
48
+ /**
49
+ * The form's text: the ISO date of the first day with the system (RFC 9557, Temporal's
50
+ * `toString` of a non-ISO month): `2026-10-23[u-ca=persian]`.
51
+ */
52
+ iso(index: number): string;
53
+ }
54
+ /**
55
+ * A date and wall-clock time in a time zone (spec/time-zones.md, "Values"): a `PlainDateTime`
56
+ * with its IANA `timeZone` and the `offset` from UTC it has there, in milliseconds (positive east:
57
+ * `+05:30` is 19 800 000). The offset tells the two times of a DST overlap apart. A plain,
58
+ * immutable object: every function returns a new one.
59
+ */
60
+ interface ZonedDateTime extends PlainDateTime {
61
+ readonly timeZone: string;
62
+ readonly offset: number;
63
+ }
64
+ /**
65
+ * Which time a wall-clock time names when its zone skips it (a DST gap) or repeats it (an
66
+ * overlap), as Temporal's `disambiguation`: `compatible` (the default) takes the later one in a
67
+ * gap and the earlier in an overlap, `earlier` and `later` always that one, `reject` throws a
68
+ * `RangeError`.
69
+ */
70
+ type Disambiguation = "compatible" | "earlier" | "later" | "reject";
71
+ /**
72
+ * The zone's offset from UTC at an instant, in milliseconds, read from `Intl` (the wall-clock
73
+ * fields it writes there, less the instant).
74
+ */
75
+ declare function offsetAt(timeZone: string, epochMs: number): number;
76
+ /** The zone the page runs in (`Intl`'s default). */
77
+ declare function localTimeZone(): string;
78
+ /** The instant (epoch milliseconds) of a zoned date and time. */
79
+ declare function toInstant(value: ZonedDateTime): number;
80
+ /** The date and time an instant (epoch milliseconds or a `Date`) has in a zone. */
81
+ declare function fromInstant(instant: number | Date, timeZone: string): ZonedDateTime;
82
+ /**
83
+ * A wall-clock date and time in a zone (spec/time-zones.md, "DST gaps and overlaps"), resolved
84
+ * with `disambiguation` when the zone skips or repeats it. In a gap, `compatible` and `later` move
85
+ * it forward by the gap (02:30 becomes 03:30), `earlier` back (01:30); `reject` throws.
86
+ */
87
+ declare function toZoned(value: PlainDateTime, timeZone: string, disambiguation?: Disambiguation): ZonedDateTime;
88
+ /** The same instant in another zone. */
89
+ declare function toTimeZone(value: ZonedDateTime, timeZone: string): ZonedDateTime;
90
+ /** Negative when `a` is the earlier instant, positive when later, 0 when the same. */
91
+ declare function compareZoned(a: ZonedDateTime, b: ZonedDateTime): number;
92
+ /**
93
+ * Adds a duration as Temporal's `ZonedDateTime#add`: the years, months and days to the wall-clock
94
+ * date (resolved `compatible`, so a day added across a DST change keeps its wall time), then the
95
+ * time in exact time (an hour added across a gap is one real hour).
96
+ */
97
+ declare function addZoned(value: ZonedDateTime, duration: DateTimeDuration): ZonedDateTime;
98
+ /**
99
+ * Steps one time field and wraps within its range, carrying nothing (the date segments' and
100
+ * React Aria's `cycle`): the hour walks the day's real hours (23 on a spring-forward day, 25 on a
101
+ * fall-back one, the repeated hour twice); a minute or second keeps the offset it had when the
102
+ * wall time still exists there, else resolves with `disambiguation`.
103
+ */
104
+ declare function cycleZoned(value: ZonedDateTime, field: Exclude<TimeField, "millisecond">, amount: number, disambiguation?: Disambiguation): ZonedDateTime;
105
+ /** `+05:30`, `-04:00` (`+00:00` for UTC); seconds only when the offset has them. */
106
+ declare function toIsoOffset(offset: number): string;
107
+ /**
108
+ * `2026-03-08T03:30-04:00[America/New_York]` (RFC 9557, Temporal's `ZonedDateTime#toString`): the
109
+ * wall time (see `toIsoDateTime` for `precision`), the offset and the zone.
110
+ */
111
+ declare function toIsoZoned(value: ZonedDateTime, precision?: IsoTimePrecision): string;
112
+ /**
113
+ * Parses `YYYY-MM-DDTHH:MM[:SS[.sss]][±HH:MM][<zone>]`; the offset, when it is one the zone has
114
+ * at that wall time, picks it (one of an overlap's two), else the wall time is resolved with
115
+ * `disambiguation`. `null` when the text is not one, or its zone is unknown.
116
+ */
117
+ declare function fromIsoZoned(text: string, disambiguation?: Disambiguation): ZonedDateTime | null;
118
+ /** The zone's name at the value's instant, from `Intl` (`timeZoneName`, default `short`: "EST"). */
119
+ declare function formatTimeZoneName(locale: string, value: ZonedDateTime, style?: Intl.DateTimeFormatOptions["timeZoneName"]): string;
120
+ /**
121
+ * A time zone as a date field or picker takes it (spec/time-zones.md, "In the fields"): its id and
122
+ * the zoned math the field calls. A field given one holds `ZonedDateTime` values in that zone;
123
+ * no component imports `/time-zone`, so a field given none bundles none of it.
124
+ */
125
+ interface TimeZone {
126
+ /** The IANA id (`America/New_York`). */
127
+ readonly id: string;
128
+ /** A wall-clock date and time in this zone, resolved with `disambiguation`. */
129
+ resolve(value: PlainDateTime, disambiguation?: Disambiguation): ZonedDateTime;
130
+ /** The same instant in this zone. */
131
+ convert(value: ZonedDateTime): ZonedDateTime;
132
+ /** The date and time of an instant (epoch milliseconds or a `Date`) in this zone. */
133
+ at(instant: number | Date): ZonedDateTime;
134
+ /** The zone's short name at the value's instant ("EST", "GMT+5:30"), from `Intl`. */
135
+ name(locale: string, value: ZonedDateTime): string;
136
+ /** The value's ISO text with its offset and zone (what a form submits). */
137
+ toIso(value: ZonedDateTime, precision?: IsoTimePrecision): string;
138
+ /**
139
+ * A wall time chosen (a picker's date, a segment's sample): resolved with `disambiguation`,
140
+ * `reject` read as `compatible`, so a choice always has a value.
141
+ */
142
+ choose(value: PlainDateTime, disambiguation?: Disambiguation): ZonedDateTime;
143
+ /** A value as this zone's wall time: a zoned one from another zone at its instant here. */
144
+ wallTime<Value extends Partial<PlainDateTime>>(value: Value): Value;
145
+ /**
146
+ * The text of a part the zone writes: its name segment's (`timeZoneName`) at a sample's wall
147
+ * time (its UTC fields); `undefined` for any other part.
148
+ */
149
+ segmentText(format: SegmentFormat, type: SegmentType, sample: Date): string | undefined;
150
+ /** The zoned value of a typed wall time, with the format's `disambiguation` (`null`: rejected). */
151
+ segmentsToDateTime(format: SegmentFormat, date: PlainDate, time: PlainTime): ZonedDateTime | null;
152
+ /** The Intl options of a field's format, with the zone's name where a date and time shows it. */
153
+ segmentOptions(options: SegmentFormatOptions, intl: Intl.DateTimeFormatOptions): Intl.DateTimeFormatOptions;
154
+ }
155
+ /** The time zone `id` (default: the page's own) for a date field or picker's `timeZone`. */
156
+ declare function timeZone(id?: string): TimeZone;
157
+ /** What a segment of a date or time field shows (spec/date-field.md, "Segments"). */
158
+ type SegmentType = "era" | "year" | "month" | "day" | "hour" | "minute" | "second" | "dayPeriod" | "timeZoneName" | "literal";
159
+ /**
160
+ * The segments the user edits; the others (`literal`, `timeZoneName`) are only shown, and an
161
+ * `era` only in a calendar system of several eras (spec/calendar-systems.md, "In the fields").
162
+ */
163
+ type EditableSegmentType = "era" | "year" | "month" | "day" | "hour" | "minute" | "second" | "dayPeriod";
164
+ /** The smallest unit a field edits: `day` for a date alone, else the time down to it. */
165
+ type SegmentGranularity = "day" | "hour" | "minute" | "second";
166
+ /** What a field holds: a date (and, finer than `day`, its time) or a time alone. */
167
+ type SegmentKind = "date" | "time";
168
+ /** `Intl`'s hour cycles: 0–11, 1–12, 0–23, 1–24. */
169
+ type HourCycle = "h11" | "h12" | "h23" | "h24";
170
+ interface SegmentFormatOptions {
171
+ /** BCP 47. */
172
+ readonly locale: string;
173
+ readonly kind: SegmentKind;
174
+ /** Default: `day` for a date, `minute` for a time (a time's `day` reads as `minute`). */
175
+ readonly granularity?: SegmentGranularity | undefined;
176
+ /** `12` or `24` (the locale picks `h11` or `h12` for 12), or an exact cycle; default: the locale's. */
177
+ readonly hourCycle?: 12 | 24 | HourCycle | undefined;
178
+ /**
179
+ * A calendar system (spec/calendar-systems.md): the segments show and edit its fields; values
180
+ * stay ISO. Default: none (the ISO calendar, as the locale writes it).
181
+ */
182
+ readonly calendar?: CalendarSystem | undefined;
183
+ /**
184
+ * A time zone (spec/time-zones.md): the values are `ZonedDateTime`s in it, and a date and
185
+ * time shows a `timeZoneName` segment unless `hideTimeZone`.
186
+ */
187
+ readonly timeZone?: TimeZone | undefined;
188
+ readonly hideTimeZone?: boolean | undefined;
189
+ /** How a wall time the zone skips or repeats resolves (default `compatible`). */
190
+ readonly disambiguation?: Disambiguation | undefined;
191
+ }
192
+ /** One piece of the format, in the locale's order: a segment, or the literal text between. */
193
+ interface SegmentPart {
194
+ readonly type: SegmentType;
195
+ /** The text of a `literal` (or `era`) part, as `Intl` writes it; `""` for the others. */
196
+ readonly literal: string;
197
+ }
198
+ /**
199
+ * A field's format for a locale (from `Intl.DateTimeFormat#formatToParts`): the order of its
200
+ * segments and the literals between them, its hour cycle, its digits and the texts `Intl` gives
201
+ * for the day periods and the segments' names. Built once per locale and options.
202
+ */
203
+ interface SegmentFormat {
204
+ readonly locale: string;
205
+ readonly kind: SegmentKind;
206
+ readonly granularity: SegmentGranularity;
207
+ readonly parts: readonly SegmentPart[];
208
+ /** The editable segments, in the locale's order. */
209
+ readonly types: readonly EditableSegmentType[];
210
+ /** `null` when the format has no hour. */
211
+ readonly hourCycle: HourCycle | null;
212
+ /** The locale's ten digits, 0 to 9 (`Intl`'s numbering system). */
213
+ readonly digits: readonly string[];
214
+ /** The day period texts, AM then PM (`["", ""]` when the format has none). */
215
+ readonly dayPeriods: readonly [string, string];
216
+ /** Each segment's name, from `Intl.DisplayNames` (`dateTimeField`), when the engine has it. */
217
+ readonly names: Readonly<Partial<Record<SegmentType, string>>>;
218
+ /** Formats a UTC date in the field's segments (`timeZone: "UTC"`). */
219
+ readonly formatter: Intl.DateTimeFormat;
220
+ /** Formats a UTC date's month name (`month: "long"`), the month's `aria-valuetext`. */
221
+ readonly monthNames: Intl.DateTimeFormat;
222
+ /** The calendar system, when the field has one. */
223
+ readonly calendar?: CalendarSystem | undefined;
224
+ /** The eras' names (`era: "short"`), oldest first, when the era is editable. */
225
+ readonly eras?: readonly string[] | undefined;
226
+ /** The time zone, when the field holds zoned values. */
227
+ readonly timeZone?: TimeZone | undefined;
228
+ readonly disambiguation?: Disambiguation | undefined;
229
+ }
230
+ /**
231
+ * The format of a date or time field in a locale (spec/date-field.md, "Segments"): the parts of
232
+ * `Intl.DateTimeFormat#formatToParts` for the field's segments, in the locale's order, with its
233
+ * literals, hour cycle and digits.
234
+ */
235
+ declare function segmentFormat(options: SegmentFormatOptions): SegmentFormat;
236
+ /**
237
+ * What the user has set of a field, segment by segment (spec/date-field.md, "Editing"): a
238
+ * segment left out is a placeholder. `hour` is 0–23 whatever the hour cycle; `dayPeriod` (0 AM,
239
+ * 1 PM) is kept only once the user set it (with an hour set, the hour's half of the day agrees
240
+ * with it). A plain, immutable object: every function returns a new one.
241
+ */
242
+ type SegmentValues = { readonly [type in EditableSegmentType]?: number; };
243
+ /** A segment's range, in the unit it shows (an hour in its cycle: 1–12 for `h12`). */
244
+ interface SegmentRange {
245
+ readonly min: number;
246
+ readonly max: number;
247
+ /** The most digits it is typed with (`0` for the day period, typed by a letter). */
248
+ readonly digits: number;
249
+ }
250
+ /** The amount Page Up and Page Down step a segment by (spec/date-field.md, "Keyboard"). */
251
+ declare const SEGMENT_PAGE_STEPS: Readonly<Record<EditableSegmentType, number>>;
252
+ /** The range of a segment, given what else is set (a day's maximum follows its month and year). */
253
+ declare function segmentRange(format: SegmentFormat, values: SegmentValues, type: EditableSegmentType): SegmentRange;
254
+ /** The hour as its cycle shows it (`h12`: 0 → 12, 13 → 1). */
255
+ declare function displayHour(hour: number, cycle: HourCycle | null): number;
256
+ /** A segment's value in the unit it shows; `undefined` while it is a placeholder. */
257
+ declare function shownValue(format: SegmentFormat, values: SegmentValues, type: EditableSegmentType): number | undefined;
258
+ /**
259
+ * Sets a segment to a value in the unit it shows (an hour in its cycle, kept in its half of the
260
+ * day; a day period moves a set hour into its half), or clears it with `undefined`. A day past
261
+ * its month's end is clamped into it.
262
+ */
263
+ declare function setSegment(format: SegmentFormat, values: SegmentValues, type: EditableSegmentType, shown: number | undefined, seed?: SegmentValues): SegmentValues;
264
+ /**
265
+ * Steps a segment by `amount`, wrapping within its range and carrying nothing into the others (an
266
+ * hour of a 12-hour cycle stays in its half of the day; the day period toggles). A placeholder
267
+ * takes the seed's value instead (the field's `placeholderValue`), with no step.
268
+ */
269
+ declare function stepSegment(format: SegmentFormat, values: SegmentValues, type: EditableSegmentType, amount: number, seed?: SegmentValues): SegmentValues;
270
+ /** Sets a segment to the edge of its range (Home: `min`, End: `max`). */
271
+ declare function segmentToEdge(format: SegmentFormat, values: SegmentValues, type: EditableSegmentType, edge: "min" | "max", seed?: SegmentValues): SegmentValues;
272
+ /** Whether every editable segment of the format is set. */
273
+ declare function isSegmentsComplete(format: SegmentFormat, values: SegmentValues): boolean;
274
+ /**
275
+ * The segment values of a date, a time or a date and time (only the format's segments; a day
276
+ * period follows the hour). `null` gives no value: every segment a placeholder.
277
+ */
278
+ declare function segmentValuesOf(format: SegmentFormat, input: Partial<PlainDateTime> | null | undefined): SegmentValues;
279
+ /**
280
+ * The date of complete values (`null` while a date segment is a placeholder); with a calendar
281
+ * system's `format`, the ISO date of its fields (its hook).
282
+ */
283
+ declare function segmentsToDate(values: SegmentValues, format?: SegmentFormat): PlainDate | null;
284
+ /** The time of values (the segments a format has not are 0); `null` with no hour. */
285
+ declare function segmentsToTime(values: SegmentValues): PlainTime | null;
286
+ /**
287
+ * The date and time of values; `null` while the date or the hour is a placeholder. With a time
288
+ * zone's `format`, a `ZonedDateTime` resolved with its `disambiguation` (`null` when `reject`
289
+ * meets a wall time the zone skips or repeats).
290
+ */
291
+ declare function segmentsToDateTime(values: SegmentValues, format?: SegmentFormat): PlainDateTime | null;
292
+ /**
293
+ * The format in the system: its era is editable where the system has several (a Japanese date's),
294
+ * with the eras' names (`era: "short"`), oldest first.
295
+ */
296
+ declare function segmentCalendarFormat(format: SegmentFormat): SegmentFormat;
297
+ /** The range of the era, the month (13 in a Hebrew leap year) and the day; none for the time. */
298
+ declare function segmentCalendarRange(format: SegmentFormat, values: SegmentValues, type: EditableSegmentType): SegmentRange | undefined;
299
+ /**
300
+ * The values, completed where they are placeholders, as the UTC date `Intl` formats: the longest
301
+ * year (a day set with no year keeps the longest month), an era set with no year its second year
302
+ * (wholly in it).
303
+ */
304
+ declare function segmentCalendarSample(format: SegmentFormat, values: SegmentValues): Date;
305
+ /** A value with its ISO date as the system's fields (the era's year where the era is edited). */
306
+ declare function segmentCalendarFields(format: SegmentFormat, value: Partial<PlainDateTime>): Partial<PlainDateTime> & {
307
+ era?: number;
308
+ };
309
+ /** The ISO date of the values' fields; `null` while a date segment is a placeholder. */
310
+ declare function segmentCalendarDate(format: SegmentFormat, values: SegmentValues): PlainDate | null;
311
+ /** The calendar systems of spec/calendar-systems.md, by their `Intl` (CLDR) identifier. */
312
+ type CalendarId = "gregory" | "buddhist" | "japanese" | "roc" | "persian" | "indian" | "islamic-civil" | "islamic-tbla" | "islamic-umalqura" | "hebrew" | "coptic" | "ethiopic" | "ethioaa";
313
+ /**
314
+ * An ISO date's fields in a calendar system (spec/calendar-systems.md, "Fields"). `year` is the
315
+ * system's arithmetic year (it keeps counting across eras: Temporal's `year`); `era` is an index
316
+ * into the system's eras (oldest first) and `eraYear` the year within it, as `Intl` writes it;
317
+ * `month` is the month's place in its year (1–13: a Hebrew leap year's Adar I is 6).
318
+ */
319
+ interface CalendarDateFields {
320
+ readonly era: number;
321
+ readonly eraYear: number;
322
+ readonly year: number;
323
+ readonly month: number;
324
+ readonly day: number;
325
+ }
326
+ /** A month of a calendar system: its arithmetic year and its place in the year. */
327
+ interface CalendarYearMonth {
328
+ readonly year: number;
329
+ readonly month: number;
330
+ }
331
+ /**
332
+ * The fields a date is built from: the arithmetic `year`, or an `era` and its `eraYear`; a month
333
+ * or day past its year's or month's end is clamped into it (Temporal's `constrain`).
334
+ */
335
+ interface CalendarFieldsInput {
336
+ readonly year?: number;
337
+ readonly era?: number;
338
+ readonly eraYear?: number;
339
+ readonly month: number;
340
+ readonly day: number;
341
+ }
342
+ /**
343
+ * A calendar system (spec/calendar-systems.md): the date math and the names of a non-Gregorian
344
+ * calendar over ISO dates. Values stay ISO `PlainDate`s; a component given one shows and moves
345
+ * through its months and years. Each system is its own export of `@fragiola/primitives/calendar-systems`,
346
+ * so an app pays only for the systems it imports, and one that passes none pays nothing.
347
+ */
348
+ interface CalendarSystem {
349
+ readonly id: CalendarId;
350
+ /** `locale` with this calendar (`-u-ca-<id>`): `Intl` writes its names. */
351
+ locale(locale: string): string;
352
+ /** The fields of an ISO date. */
353
+ fields(date: PlainDate): CalendarDateFields;
354
+ /** The ISO date of fields (clamped into the month and year). */
355
+ fromFields(fields: CalendarFieldsInput): PlainDate;
356
+ /** How many eras the system has (era segments are editable when more than one). */
357
+ eraCount(): number;
358
+ /** The arithmetic year of an era's year. */
359
+ yearOfEra(era: number, eraYear: number): number;
360
+ /** An era's name from `Intl` (`era: "short"`). */
361
+ eraName(locale: string, era: number): string;
362
+ monthsInYear(year: number): number;
363
+ daysInMonth(year: number, month: number): number;
364
+ /**
365
+ * A year whose months are the longest the system has (a leap year), for a month or day
366
+ * typed before its year.
367
+ */
368
+ referenceYear(): number;
369
+ startOfMonth(date: PlainDate): PlainDate;
370
+ endOfMonth(date: PlainDate): PlainDate;
371
+ /** The same day `months` later, clamped to the target month's last day. */
372
+ addMonths(date: PlainDate, months: number): PlainDate;
373
+ /** The same month and day `years` later (a leap month to its common year's month), clamped. */
374
+ addYears(date: PlainDate, years: number): PlainDate;
375
+ /** The difference in whole months from `a`'s month to `b`'s month. */
376
+ monthsBetween(a: PlainDate, b: PlainDate): number;
377
+ isSameMonth(a: PlainDate, b: PlainDate): boolean;
378
+ /** The 6 weeks shown for the month holding `date`, from the locale's first day. */
379
+ monthGrid(date: PlainDate, firstDayOfWeek: number): PlainDate[][];
380
+ /** `calendarKeyTarget` (`/date`) in this system: Page Up and Down move by its months and years. */
381
+ keyTarget(key: string, focused: PlainDate, options: CalendarKeyOptions): PlainDate | null;
382
+ /** A month as one number (its months counted from the system's year 0): `+ 1` is the next. */
383
+ monthIndex(month: CalendarYearMonth): number;
384
+ fromMonthIndex(index: number): CalendarYearMonth;
385
+ /** The ISO date of a month's first day. */
386
+ monthStart(month: CalendarYearMonth): PlainDate;
387
+ /** The month of an ISO date. */
388
+ yearMonthOf(date: PlainDate): CalendarYearMonth;
389
+ /**
390
+ * A day cell's name: the weekday, day, month and year in this system. Its fields are explicit
391
+ * (not `dateStyle: "full"`): Chromium's ICU has no Hebrew-calendar `he` date styles and writes
392
+ * `57870310 12:00 AM` for them (spec/calendar-systems.md, "Recorded limits").
393
+ */
394
+ fullDate(locale: string, date: PlainDate): string;
395
+ /** An ISO date written by `Intl` in this system (`timeZone: "UTC"`: no host zone moves it). */
396
+ format(locale: string, date: PlainDate, options: Intl.DateTimeFormatOptions): string;
397
+ /**
398
+ * `Intl.DateTimeFormat#formatRange` of two ISO dates in this system, every space written as
399
+ * U+0020 (engines differ on the spaces around the dash: the `/month-year` year span's rule).
400
+ */
401
+ formatRange(locale: string, start: PlainDate, end: PlainDate, options: Intl.DateTimeFormatOptions): string;
402
+ /** The items of a month or year calendar in this system (cached per kind). */
403
+ units(kind: "month" | "year"): CalendarUnits;
404
+ /** A field's format in this system: the era editable where it has several, their names. */
405
+ segmentFormat: typeof segmentCalendarFormat;
406
+ /** The range of the era, month and day segments (`undefined` for the others). */
407
+ segmentRange: typeof segmentCalendarRange;
408
+ /** Segment values as the UTC date `Intl` formats, completed where they are placeholders. */
409
+ segmentSample: typeof segmentCalendarSample;
410
+ /** A value's date as this system's fields (`segmentValuesOf`). */
411
+ segmentValuesOf: typeof segmentCalendarFields;
412
+ /** The ISO date of segment values (`segmentsToDate`); `null` while one is a placeholder. */
413
+ segmentsToDate: typeof segmentCalendarDate;
414
+ }
415
+ export { timeZone as A, offsetAt as B, SegmentFormatOptions as C, SegmentType as D, SegmentPart as E, cycleZoned as F, toZoned as G, toIsoOffset as H, formatTimeZoneName as I, CalendarUnit as K, fromInstant as L, ZonedDateTime as M, addZoned as N, segmentFormat as O, compareZoned as P, fromIsoZoned as R, SegmentFormat as S, SegmentKind as T, toIsoZoned as U, toInstant as V, toTimeZone as W, setSegment as _, CalendarYearMonth as a, EditableSegmentType as b, SegmentValues as c, segmentRange as d, segmentToEdge as f, segmentsToTime as g, segmentsToDateTime as h, CalendarSystem as i, Disambiguation as j, TimeZone as k, displayHour as l, segmentsToDate as m, CalendarFieldsInput as n, SEGMENT_PAGE_STEPS as o, segmentValuesOf as p, CalendarUnits as q, CalendarId as r, SegmentRange as s, CalendarDateFields as t, isSegmentsComplete as u, shownValue as v, SegmentGranularity as w, HourCycle as x, stepSegment as y, localTimeZone as z };