@warp-drive/core 5.9.0-beta.1 → 5.9.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/-private-BL9zXgJB.js +3530 -0
- package/dist/-private-BL9zXgJB.js.map +1 -0
- package/dist/{-private-DMzvF_Q6.js → -private-Cxa8cMBj.js} +2 -2
- package/dist/-private-Cxa8cMBj.js.map +1 -0
- package/dist/{unpkg/dev-deprecated/-private-DL4tfrv9.js → -private-xK1KgxZJ.js} +2 -2
- package/dist/{-private-b1g4dhl0.js.map → -private-xK1KgxZJ.js.map} +1 -1
- package/{declarations/concepts-LHsLJZMl.d.ts → dist/concepts-DFldVwEM.d.ts} +2 -2
- package/{declarations/concepts-LHsLJZMl.d.ts.map → dist/concepts-DFldVwEM.d.ts.map} +1 -1
- package/dist/configure.js +1 -1
- package/dist/graph/-private.d.ts +2 -0
- package/dist/graph/-private.js +46 -33
- package/dist/graph/-private.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/{declarations/internal-Cz-893zD.d.ts → dist/internal-DtWOpxrR.d.ts} +2763 -2271
- package/dist/internal-DtWOpxrR.d.ts.map +1 -0
- package/dist/reactive/-private.d.ts +2 -0
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.d.ts +2 -0
- package/dist/reactive.js +3 -3
- package/{declarations → dist}/record-D3QQcaIR.d.ts.map +1 -1
- package/dist/{request--vRFALbQ.js → request-z2NByNx0.js} +2 -2
- package/dist/request-z2NByNx0.js.map +1 -0
- package/dist/request.d.ts +2 -0
- package/dist/request.js +1 -1
- package/dist/signals/-leaked.d.ts +1060 -0
- package/dist/signals/-leaked.d.ts.map +1 -0
- package/dist/signals/-leaked.js +2 -2
- package/dist/{src-Dex_phWI.js → src-s5HHjglV.js} +192 -53
- package/dist/src-s5HHjglV.js.map +1 -0
- package/dist/store/-private.d.ts +2 -0
- package/dist/store/-private.js +1 -1
- package/dist/store-DNF9Rgoh.js.map +1 -1
- package/dist/store.d.ts +2 -0
- package/{declarations → dist}/types/-private.d.ts +1 -1
- package/{declarations → dist}/types/-private.d.ts.map +1 -1
- package/dist/types/-private.js +1 -1
- package/dist/types/cache.d.ts +2 -0
- package/dist/types/record.js.map +1 -1
- package/dist/types/request.d.ts +2 -0
- package/dist/types/request.js +1 -1
- package/dist/types/request.js.map +1 -1
- package/dist/types/runtime.js +1 -1
- package/dist/types/schema/concepts.d.ts +2 -0
- package/dist/types/schema/fields.js.map +1 -1
- package/dist/types/schema/schema-service.d.ts +2 -0
- package/dist/types/symbols.js +1 -1
- package/dist/types/symbols.js.map +1 -1
- package/{declarations → dist}/types.d.ts +1 -1
- package/dist/{-private-b1g4dhl0.js → unpkg/dev/-private-BGCYELwo.js} +2 -2
- package/dist/unpkg/{dev-deprecated/-private-DL4tfrv9.js.map → dev/-private-BGCYELwo.js.map} +1 -1
- package/dist/unpkg/{dev-deprecated/-private-2RfQ2761.js → dev/-private-DhiS6yOR.js} +2 -2
- package/dist/unpkg/dev/-private-DhiS6yOR.js.map +1 -0
- package/dist/unpkg/dev/-private-pNQae3qH.js +3519 -0
- package/dist/unpkg/dev/-private-pNQae3qH.js.map +1 -0
- package/dist/unpkg/dev/configure.js +1 -1
- package/dist/unpkg/dev/graph/-private.js +46 -33
- package/dist/unpkg/dev/graph/-private.js.map +1 -1
- package/dist/unpkg/dev/index.js +1 -1
- package/dist/unpkg/dev/reactive/-private.js +1 -1
- package/dist/unpkg/dev/reactive.js +3 -3
- package/dist/unpkg/{dev-deprecated/request-DAuXbfYi.js → dev/request-BbbzRou7.js} +2 -2
- package/dist/unpkg/dev/request-BbbzRou7.js.map +1 -0
- package/dist/unpkg/dev/request.js +1 -1
- package/dist/unpkg/dev/{runtime-EoVKAhTv.js → runtime-DoDtzXJb.js} +2 -2
- package/dist/unpkg/dev/runtime-DoDtzXJb.js.map +1 -0
- package/dist/unpkg/dev/signals/-leaked.js +2 -2
- package/dist/unpkg/dev/{src-Bxlr_vue.js → src-Cf7NXXR2.js} +194 -55
- package/dist/unpkg/dev/src-Cf7NXXR2.js.map +1 -0
- package/dist/unpkg/dev/store/-private.js +1 -1
- package/dist/unpkg/{dev-deprecated/store-TcP2H4Af.js → dev/store-DamE3C4y.js} +2 -2
- package/dist/unpkg/dev/store-DamE3C4y.js.map +1 -0
- package/dist/unpkg/dev/store.js +1 -1
- package/dist/unpkg/dev/types/-private.js +1 -1
- package/dist/unpkg/dev/types/record.js.map +1 -1
- package/dist/unpkg/dev/types/request.js +1 -1
- package/dist/unpkg/dev/types/request.js.map +1 -1
- package/dist/unpkg/dev/types/runtime.js +1 -1
- package/dist/unpkg/dev/types/schema/fields.js.map +1 -1
- package/dist/unpkg/dev/types/symbols.js +1 -1
- package/dist/unpkg/dev/types/symbols.js.map +1 -1
- package/dist/unpkg/{dev/-private-DL4tfrv9.js → dev-deprecated/-private-BGCYELwo.js} +2 -2
- package/dist/unpkg/{prod/-private-Z9i0icpE.js.map → dev-deprecated/-private-BGCYELwo.js.map} +1 -1
- package/dist/unpkg/{dev/-private-2RfQ2761.js → dev-deprecated/-private-DhiS6yOR.js} +2 -2
- package/dist/unpkg/dev-deprecated/-private-DhiS6yOR.js.map +1 -0
- package/dist/unpkg/dev-deprecated/-private-pNQae3qH.js +3519 -0
- package/dist/unpkg/dev-deprecated/-private-pNQae3qH.js.map +1 -0
- package/dist/unpkg/dev-deprecated/configure.js +1 -1
- package/dist/unpkg/dev-deprecated/graph/-private.js +47 -34
- package/dist/unpkg/dev-deprecated/graph/-private.js.map +1 -1
- package/dist/unpkg/dev-deprecated/index.js +1 -1
- package/dist/unpkg/dev-deprecated/reactive/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/reactive.js +3 -3
- package/dist/unpkg/{dev/request-DAuXbfYi.js → dev-deprecated/request-BbbzRou7.js} +2 -2
- package/dist/unpkg/dev-deprecated/request-BbbzRou7.js.map +1 -0
- package/dist/unpkg/dev-deprecated/request.js +1 -1
- package/dist/unpkg/dev-deprecated/{runtime-BacZMq1r.js → runtime-CPL2BGgT.js} +2 -2
- package/dist/unpkg/dev-deprecated/runtime-CPL2BGgT.js.map +1 -0
- package/dist/unpkg/dev-deprecated/signals/-leaked.js +2 -2
- package/dist/unpkg/dev-deprecated/{src-DEl2Ca3T.js → src-CSuFUXv4.js} +195 -56
- package/dist/unpkg/dev-deprecated/src-CSuFUXv4.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store/-private.js +1 -1
- package/dist/unpkg/{dev/store-DmiFvT1B.js → dev-deprecated/store-Bsdz5mRe.js} +2 -2
- package/dist/unpkg/dev-deprecated/store-Bsdz5mRe.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store.js +1 -1
- package/dist/unpkg/dev-deprecated/types/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/types/record.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/request.js +1 -1
- package/dist/unpkg/dev-deprecated/types/request.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/runtime.js +1 -1
- package/dist/unpkg/dev-deprecated/types/schema/fields.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/symbols.js +1 -1
- package/dist/unpkg/dev-deprecated/types/symbols.js.map +1 -1
- package/dist/unpkg/prod/-private-8gd8hbwm.js +22 -0
- package/dist/unpkg/{prod-deprecated/-private-Z9i0icpE.js.map → prod/-private-8gd8hbwm.js.map} +1 -1
- package/dist/unpkg/prod/{-private-BK71-uXR.js → -private-B6aLbrgV.js} +2 -2
- package/dist/unpkg/prod/-private-B6aLbrgV.js.map +1 -0
- package/dist/unpkg/prod/-private-ggVX_Iob.js +3294 -0
- package/dist/unpkg/prod/-private-ggVX_Iob.js.map +1 -0
- package/dist/unpkg/prod/configure.js +1 -1
- package/dist/unpkg/prod/graph/-private.js +45 -32
- package/dist/unpkg/prod/graph/-private.js.map +1 -1
- package/dist/unpkg/prod/index.js +1 -1
- package/dist/unpkg/prod/reactive/-private.js +1 -1
- package/dist/unpkg/prod/reactive.js +3 -3
- package/dist/unpkg/prod/{request-BcJNzSgv.js → request-BoeppjDj.js} +2 -2
- package/dist/unpkg/prod/request-BoeppjDj.js.map +1 -0
- package/dist/unpkg/prod/request.js +1 -1
- package/dist/unpkg/prod/signals/-leaked.js +2 -2
- package/dist/unpkg/prod/{src-Dzz-j6pp.js → src-C0wuASrN.js} +196 -53
- package/dist/unpkg/prod/src-C0wuASrN.js.map +1 -0
- package/dist/unpkg/prod/store/-private.js +1 -1
- package/dist/unpkg/prod/store-BWhmb7Ob.js.map +1 -1
- package/dist/unpkg/prod/types/-private.js +1 -1
- package/dist/unpkg/prod/types/record.js.map +1 -1
- package/dist/unpkg/prod/types/request.js +1 -1
- package/dist/unpkg/prod/types/request.js.map +1 -1
- package/dist/unpkg/prod/types/runtime.js +1 -1
- package/dist/unpkg/prod/types/schema/fields.js.map +1 -1
- package/dist/unpkg/prod/types/symbols.js +1 -1
- package/dist/unpkg/prod/types/symbols.js.map +1 -1
- package/dist/unpkg/prod-deprecated/{-private-Z9i0icpE.js → -private-8gd8hbwm.js} +2 -2
- package/dist/unpkg/{dev/-private-DL4tfrv9.js.map → prod-deprecated/-private-8gd8hbwm.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/{-private-BK71-uXR.js → -private-B6aLbrgV.js} +2 -2
- package/dist/unpkg/prod-deprecated/-private-B6aLbrgV.js.map +1 -0
- package/dist/unpkg/prod-deprecated/-private-ggVX_Iob.js +3294 -0
- package/dist/unpkg/prod-deprecated/-private-ggVX_Iob.js.map +1 -0
- package/dist/unpkg/prod-deprecated/configure.js +1 -1
- package/dist/unpkg/prod-deprecated/graph/-private.js +46 -35
- package/dist/unpkg/prod-deprecated/graph/-private.js.map +1 -1
- package/dist/unpkg/prod-deprecated/index.js +1 -1
- package/dist/unpkg/prod-deprecated/reactive/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/reactive.js +3 -3
- package/dist/unpkg/prod-deprecated/{request-BcJNzSgv.js → request-BoeppjDj.js} +2 -2
- package/dist/unpkg/prod-deprecated/request-BoeppjDj.js.map +1 -0
- package/dist/unpkg/prod-deprecated/request.js +1 -1
- package/dist/unpkg/prod-deprecated/signals/-leaked.js +2 -2
- package/dist/unpkg/prod-deprecated/{src-BOifHFQ5.js → src-BXOgNqmz.js} +197 -54
- package/dist/unpkg/prod-deprecated/src-BXOgNqmz.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/store-BWhmb7Ob.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/types/record.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/request.js +1 -1
- package/dist/unpkg/prod-deprecated/types/request.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/runtime.js +1 -1
- package/dist/unpkg/prod-deprecated/types/schema/fields.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/symbols.js +1 -1
- package/dist/unpkg/prod-deprecated/types/symbols.js.map +1 -1
- package/package.json +15 -19
- package/declarations/graph/-private.d.ts +0 -2
- package/declarations/index.d.ts +0 -2
- package/declarations/internal-Cz-893zD.d.ts.map +0 -1
- package/declarations/reactive/-private.d.ts +0 -2
- package/declarations/reactive.d.ts +0 -2
- package/declarations/request.d.ts +0 -2
- package/declarations/signals/-leaked.d.ts +0 -63
- package/declarations/signals/-leaked.d.ts.map +0 -1
- package/declarations/store/-private.d.ts +0 -2
- package/declarations/store.d.ts +0 -8358
- package/declarations/store.d.ts.map +0 -1
- package/declarations/types/cache.d.ts +0 -2
- package/declarations/types/request.d.ts +0 -2
- package/declarations/types/schema/concepts.d.ts +0 -2
- package/declarations/types/schema/schema-service.d.ts +0 -2
- package/dist/-private-DMzvF_Q6.js.map +0 -1
- package/dist/-private-HjaQ1wp1.js +0 -1695
- package/dist/-private-HjaQ1wp1.js.map +0 -1
- package/dist/request--vRFALbQ.js.map +0 -1
- package/dist/src-Dex_phWI.js.map +0 -1
- package/dist/unpkg/dev/-private-2RfQ2761.js.map +0 -1
- package/dist/unpkg/dev/-private-CM1zxNws.js +0 -1684
- package/dist/unpkg/dev/-private-CM1zxNws.js.map +0 -1
- package/dist/unpkg/dev/request-DAuXbfYi.js.map +0 -1
- package/dist/unpkg/dev/runtime-EoVKAhTv.js.map +0 -1
- package/dist/unpkg/dev/src-Bxlr_vue.js.map +0 -1
- package/dist/unpkg/dev/store-DmiFvT1B.js.map +0 -1
- package/dist/unpkg/dev-deprecated/-private-2RfQ2761.js.map +0 -1
- package/dist/unpkg/dev-deprecated/-private-CM1zxNws.js +0 -1684
- package/dist/unpkg/dev-deprecated/-private-CM1zxNws.js.map +0 -1
- package/dist/unpkg/dev-deprecated/request-DAuXbfYi.js.map +0 -1
- package/dist/unpkg/dev-deprecated/runtime-BacZMq1r.js.map +0 -1
- package/dist/unpkg/dev-deprecated/src-DEl2Ca3T.js.map +0 -1
- package/dist/unpkg/dev-deprecated/store-TcP2H4Af.js.map +0 -1
- package/dist/unpkg/prod/-private-BK71-uXR.js.map +0 -1
- package/dist/unpkg/prod/-private-TNaS5Piv.js +0 -1494
- package/dist/unpkg/prod/-private-TNaS5Piv.js.map +0 -1
- package/dist/unpkg/prod/-private-Z9i0icpE.js +0 -22
- package/dist/unpkg/prod/request-BcJNzSgv.js.map +0 -1
- package/dist/unpkg/prod/src-Dzz-j6pp.js.map +0 -1
- package/dist/unpkg/prod-deprecated/-private-BK71-uXR.js.map +0 -1
- package/dist/unpkg/prod-deprecated/-private-TNaS5Piv.js +0 -1494
- package/dist/unpkg/prod-deprecated/-private-TNaS5Piv.js.map +0 -1
- package/dist/unpkg/prod-deprecated/request-BcJNzSgv.js.map +0 -1
- package/dist/unpkg/prod-deprecated/src-BOifHFQ5.js.map +0 -1
- /package/{declarations → dist}/aliases-BWYW5EhX.d.ts +0 -0
- /package/{declarations → dist}/aliases-BWYW5EhX.d.ts.map +0 -0
- /package/{declarations → dist}/build-config/babel-macros.d.ts +0 -0
- /package/{declarations → dist}/build-config/canary-features.d.ts +0 -0
- /package/{declarations → dist}/build-config/debugging.d.ts +0 -0
- /package/{declarations → dist}/build-config/deprecations.d.ts +0 -0
- /package/{declarations → dist}/build-config/env.d.ts +0 -0
- /package/{declarations → dist}/build-config/macros.d.ts +0 -0
- /package/{declarations → dist}/build-config.d.ts +0 -0
- /package/{declarations → dist}/change-C7kqv2kW.d.ts +0 -0
- /package/{declarations → dist}/change-C7kqv2kW.d.ts.map +0 -0
- /package/{declarations → dist}/configure-B_F639tN.d.ts +0 -0
- /package/{declarations → dist}/configure-B_F639tN.d.ts.map +0 -0
- /package/{declarations → dist}/configure.d.ts +0 -0
- /package/{declarations → dist}/document-BEn91SwT.d.ts +0 -0
- /package/{declarations → dist}/document-BEn91SwT.d.ts.map +0 -0
- /package/{declarations → dist}/error-50OSEhsF.d.ts +0 -0
- /package/{declarations → dist}/error-50OSEhsF.d.ts.map +0 -0
- /package/{declarations → dist}/fields-FM7peCiM.d.ts +0 -0
- /package/{declarations → dist}/fields-FM7peCiM.d.ts.map +0 -0
- /package/{declarations → dist}/graph-DLqYXP2z.d.ts +0 -0
- /package/{declarations → dist}/graph-DLqYXP2z.d.ts.map +0 -0
- /package/{declarations → dist}/identifier-DQnqOSJK.d.ts +0 -0
- /package/{declarations → dist}/identifier-DQnqOSJK.d.ts.map +0 -0
- /package/{declarations → dist}/json-api-raw-C5APJHHB.d.ts +0 -0
- /package/{declarations → dist}/json-api-raw-C5APJHHB.d.ts.map +0 -0
- /package/{declarations → dist}/mutations-CqtoGB4t.d.ts +0 -0
- /package/{declarations → dist}/mutations-CqtoGB4t.d.ts.map +0 -0
- /package/{declarations → dist}/operations-D1qA6r0_.d.ts +0 -0
- /package/{declarations → dist}/operations-D1qA6r0_.d.ts.map +0 -0
- /package/{declarations → dist}/params-DrEx3bf8.d.ts +0 -0
- /package/{declarations → dist}/params-DrEx3bf8.d.ts.map +0 -0
- /package/{declarations → dist}/raw-D5hnjiq7.d.ts +0 -0
- /package/{declarations → dist}/raw-D5hnjiq7.d.ts.map +0 -0
- /package/{declarations → dist}/record-D3QQcaIR.d.ts +0 -0
- /package/{declarations → dist}/relationship-CmHzMPKf.d.ts +0 -0
- /package/{declarations → dist}/relationship-CmHzMPKf.d.ts.map +0 -0
- /package/{declarations → dist}/symbols-DjRDCeX0.d.ts +0 -0
- /package/{declarations → dist}/symbols-DjRDCeX0.d.ts.map +0 -0
- /package/{declarations → dist}/types/cache/aliases.d.ts +0 -0
- /package/{declarations → dist}/types/cache/change.d.ts +0 -0
- /package/{declarations → dist}/types/cache/mutations.d.ts +0 -0
- /package/{declarations → dist}/types/cache/operations.d.ts +0 -0
- /package/{declarations → dist}/types/cache/relationship.d.ts +0 -0
- /package/{declarations → dist}/types/graph.d.ts +0 -0
- /package/{declarations → dist}/types/identifier.d.ts +0 -0
- /package/{declarations → dist}/types/json/raw.d.ts +0 -0
- /package/{declarations → dist}/types/params.d.ts +0 -0
- /package/{declarations → dist}/types/record.d.ts +0 -0
- /package/{declarations → dist}/types/runtime.d.ts +0 -0
- /package/{declarations → dist}/types/runtime.d.ts.map +0 -0
- /package/{declarations → dist}/types/schema/fields.d.ts +0 -0
- /package/{declarations → dist}/types/schema/fields.type-test.d.ts +0 -0
- /package/{declarations → dist}/types/spec/document.d.ts +0 -0
- /package/{declarations → dist}/types/spec/error.d.ts +0 -0
- /package/{declarations → dist}/types/spec/json-api-raw.d.ts +0 -0
- /package/{declarations → dist}/types/symbols.d.ts +0 -0
- /package/{declarations → dist}/types/utils.d.ts +0 -0
- /package/{declarations → dist}/utils/string.d.ts +0 -0
- /package/{declarations → dist}/utils/string.d.ts.map +0 -0
- /package/{declarations → dist}/utils-BtURiy8l.d.ts +0 -0
- /package/{declarations → dist}/utils-BtURiy8l.d.ts.map +0 -0
|
@@ -0,0 +1,1060 @@
|
|
|
1
|
+
import { Ct as ReactiveDocument, Xn as StructuredErrorDocument, Y as Store, a as notifyInternalSignal, c as AutorefreshBehaviorCombos, d as RecoveryFeatures, f as RequestArgs, g as RequestLoadingState, i as makeInitializer, l as ContentFeatures, m as SubscriptionArgs, n as WarpDriveSignal, nr as Future, o as peekInternalSignal, or as RequestManager, r as getOrCreateInternalSignal, s as withSignalStore, t as SignalStore, u as DISPOSE } from "../internal-DtWOpxrR.js";
|
|
2
|
+
import { o as waitFor } from "../configure-B_F639tN.js";
|
|
3
|
+
//#region src/signals/page-cache.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Extracts the `data` member of a document type, or the document type itself
|
|
6
|
+
* when it has no `data` member.
|
|
7
|
+
*/
|
|
8
|
+
type ContentData<RT> = RT extends {
|
|
9
|
+
data: infer D;
|
|
10
|
+
} ? D : RT;
|
|
11
|
+
/**
|
|
12
|
+
* The element type of a collection document's `data` array — the item type an
|
|
13
|
+
* infinite view renders. See {@link PaginationState.data}.
|
|
14
|
+
*/
|
|
15
|
+
type ContentItem<RT> = ContentData<RT> extends readonly (infer I)[] ? I : ContentData<RT>;
|
|
16
|
+
/**
|
|
17
|
+
* A single page of a paginated collection: its request, its loaded document, and
|
|
18
|
+
* its links to neighboring pages in the shared page graph.
|
|
19
|
+
*
|
|
20
|
+
* Pages are yielded to consumers as `Readonly<PageCache>` — through
|
|
21
|
+
* {@link PaginationState.activePage}, {@link PaginationState.pages}, and the
|
|
22
|
+
* relational getters below — to read a page's data and request status when
|
|
23
|
+
* building pagination UIs:
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* const page = paginationState.activePage;
|
|
27
|
+
*
|
|
28
|
+
* if (page?.isLoading) {
|
|
29
|
+
* // show a spinner
|
|
30
|
+
* } else if (page?.isError) {
|
|
31
|
+
* // show page.reason
|
|
32
|
+
* } else {
|
|
33
|
+
* // render page.data
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @since 5.9.0
|
|
38
|
+
* @public
|
|
39
|
+
* @hideconstructor
|
|
40
|
+
*/
|
|
41
|
+
declare class PageCache<RT = unknown, E = unknown> {
|
|
42
|
+
/**
|
|
43
|
+
* The request that loaded (or is loading) this page, or `null` if the page is
|
|
44
|
+
* known from links but was never requested. Wrap it in a `<Request>` component
|
|
45
|
+
* to render the page's loading, error, and content states.
|
|
46
|
+
*/
|
|
47
|
+
request: Future<RT> | null;
|
|
48
|
+
/** The `self` link of this page — the URL that identifies it in the collection. */
|
|
49
|
+
selfLink: string | null;
|
|
50
|
+
/** The `prev` link of this page, or `null` at the start of the collection. */
|
|
51
|
+
prevLink: string | null;
|
|
52
|
+
/** The `next` link of this page, or `null` at the end of the collection. */
|
|
53
|
+
nextLink: string | null;
|
|
54
|
+
/** The `first` link of the collection, when the response exposed one. */
|
|
55
|
+
firstLink: string | null;
|
|
56
|
+
/** The `last` link of the collection, when the response exposed one. */
|
|
57
|
+
lastLink: string | null;
|
|
58
|
+
/**
|
|
59
|
+
* The 1-based page number, or `0` when unknown (for example cursor-based
|
|
60
|
+
* pagination, where pages have no ordinal position). Derived from the
|
|
61
|
+
* collection's {@link PageHints}.
|
|
62
|
+
*/
|
|
63
|
+
pageNumber: number;
|
|
64
|
+
constructor(manager: PaginationCache<RT, E>, url: string);
|
|
65
|
+
/**
|
|
66
|
+
* The document this page's request resolved to, or `null` while it has not
|
|
67
|
+
* resolved.
|
|
68
|
+
*/
|
|
69
|
+
get value(): RT | null;
|
|
70
|
+
/**
|
|
71
|
+
* The `data` member of the loaded document — the page's items — or `null`
|
|
72
|
+
* while the page has not loaded.
|
|
73
|
+
*/
|
|
74
|
+
get data(): ContentData<RT> | null;
|
|
75
|
+
/**
|
|
76
|
+
* Whether a request has ever been issued for this page. `false` for pages that
|
|
77
|
+
* are known only from links.
|
|
78
|
+
*/
|
|
79
|
+
get isRequested(): boolean;
|
|
80
|
+
/** Whether this page's request has settled (successfully or with an error). */
|
|
81
|
+
get isLoaded(): boolean;
|
|
82
|
+
/** Whether this page's request is currently in flight. */
|
|
83
|
+
get isLoading(): boolean;
|
|
84
|
+
/** Whether this page's request resolved successfully. */
|
|
85
|
+
get isSuccess(): boolean;
|
|
86
|
+
/** Whether this page's request was cancelled (aborted). */
|
|
87
|
+
get isCancelled(): boolean;
|
|
88
|
+
/** Whether this page's request rejected with an error. */
|
|
89
|
+
get isError(): boolean;
|
|
90
|
+
/** The error this page's request rejected with, or `null` if it did not reject. */
|
|
91
|
+
get reason(): StructuredErrorDocument<E> | null;
|
|
92
|
+
/** The page at this page's `prev` link, or `null` at the start of the collection. */
|
|
93
|
+
get prev(): PageCache<RT, E> | null;
|
|
94
|
+
/** The page at this page's `next` link, or `null` at the end of the collection. */
|
|
95
|
+
get next(): PageCache<RT, E> | null;
|
|
96
|
+
/** The first page of the collection, when the response exposed a `first` link. */
|
|
97
|
+
get first(): PageCache<RT, E> | null;
|
|
98
|
+
/** The last page of the collection, when the response exposed a `last` link. */
|
|
99
|
+
get last(): PageCache<RT, E> | null;
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/signals/pagination-cache.d.ts
|
|
103
|
+
/**
|
|
104
|
+
* A hint function for extracting the `currentPage` and `totalPages` from a loaded
|
|
105
|
+
* document, for when the response does not expose these values through the
|
|
106
|
+
* default `meta` locations. Provided by the consumer via `<Paginate />`'s
|
|
107
|
+
* `@pageHints` arg:
|
|
108
|
+
*
|
|
109
|
+
* ```gts
|
|
110
|
+
* <Paginate @pageHints={{...}} />
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* Since these values are attached to the shared {@link PaginationCache}, the hint is
|
|
114
|
+
* a property of the *collection*, not the component. Every `<Paginate />` sharing a
|
|
115
|
+
* collection must provide the same function reference — define it once at module
|
|
116
|
+
* scope and import it everywhere.
|
|
117
|
+
*
|
|
118
|
+
* @since 5.9.0
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
interface PageHints {
|
|
122
|
+
(document: ReactiveDocument<unknown>): {
|
|
123
|
+
currentPage: number;
|
|
124
|
+
totalPages: number;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* The default {@link PageHints}. Reads `currentPage`/`page` and `totalPages` from the
|
|
129
|
+
* document `meta`, matching the behavior used before `pageHints` was configurable.
|
|
130
|
+
* Used whenever the consumer does not provide a `pageHints` function.
|
|
131
|
+
*
|
|
132
|
+
* @since 5.9.0
|
|
133
|
+
* @public
|
|
134
|
+
*/
|
|
135
|
+
declare const defaultPageHints: PageHints;
|
|
136
|
+
/**
|
|
137
|
+
* The global, shared cache for a paginated collection. Keyed by the collection's
|
|
138
|
+
* `first` (or `self`) link, so that multiple components paging the same collection
|
|
139
|
+
* share loaded pages, the page graph, and `totalPages`.
|
|
140
|
+
*
|
|
141
|
+
* This holds only shared, request-agnostic data. Per-component state (the active
|
|
142
|
+
* page, navigation) lives on {@link PaginationState}, which is the API consumers
|
|
143
|
+
* interact with — the cache itself is plumbing shared between the pagination
|
|
144
|
+
* classes.
|
|
145
|
+
*
|
|
146
|
+
* @since 5.9.0
|
|
147
|
+
* @public
|
|
148
|
+
* @hideconstructor
|
|
149
|
+
*/
|
|
150
|
+
declare class PaginationCache<RT = unknown, E = unknown> {
|
|
151
|
+
/**
|
|
152
|
+
* The total number of pages in the collection, or `0` when unknown. Consumers
|
|
153
|
+
* should read this via {@link PaginationState.totalPages}.
|
|
154
|
+
*/
|
|
155
|
+
totalPages: number;
|
|
156
|
+
constructor(key: string);
|
|
157
|
+
/**
|
|
158
|
+
* Every page known to the shared graph, in order — loaded pages and pages
|
|
159
|
+
* known only from links — across all components sharing the collection.
|
|
160
|
+
*
|
|
161
|
+
* This is the whole-collection view. For the run a single component is
|
|
162
|
+
* viewing, use {@link PaginationState.pages}.
|
|
163
|
+
*
|
|
164
|
+
* ```ts
|
|
165
|
+
* const cache = getPaginationCache(firstLink);
|
|
166
|
+
* for (const page of cache.pages) {
|
|
167
|
+
* // page.isLoaded, page.pageNumber, page.data, ...
|
|
168
|
+
* }
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
get pages(): Iterable<Readonly<PageCache<RT, E>>>;
|
|
172
|
+
/**
|
|
173
|
+
* The items of every loaded page in the shared graph, flattened into one
|
|
174
|
+
* contiguous iterable in page order. Pages that are known but not loaded
|
|
175
|
+
* contribute nothing.
|
|
176
|
+
*
|
|
177
|
+
* This is the whole-collection view. For the run a single component is
|
|
178
|
+
* viewing, use {@link PaginationState.data}.
|
|
179
|
+
*/
|
|
180
|
+
get data(): Iterable<ContentItem<RT>>;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Get the shared {@link PaginationCache} for a given cache key (the collection's
|
|
184
|
+
* `first` or `self` link). Returns the same instance for the same key for the
|
|
185
|
+
* lifetime of the module.
|
|
186
|
+
*
|
|
187
|
+
* @since 5.9.0
|
|
188
|
+
* @public
|
|
189
|
+
*/
|
|
190
|
+
declare function getPaginationCache<RT, E>(key: string): PaginationCache<RT, E>;
|
|
191
|
+
/**
|
|
192
|
+
* Clears the module-level pagination cache used by {@link getPaginationCache}.
|
|
193
|
+
* Primarily intended for test isolation, since the cache is keyed by url and
|
|
194
|
+
* otherwise persists for the lifetime of the module.
|
|
195
|
+
*
|
|
196
|
+
* @since 5.9.0
|
|
197
|
+
* @public
|
|
198
|
+
*/
|
|
199
|
+
declare function clearPaginationCache(): void;
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region src/signals/pagination-state.d.ts
|
|
202
|
+
/**
|
|
203
|
+
* The two navigation surfaces a `<Paginate />` component can drive. Selecting
|
|
204
|
+
* one (via the component's `@mode` arg) narrows the yielded state so the two
|
|
205
|
+
* APIs cannot be mixed:
|
|
206
|
+
*
|
|
207
|
+
* - `'paged'` — single-page view, see {@link PagedPaginationState}.
|
|
208
|
+
* - `'infinite'` — accumulated view, see {@link InfinitePaginationState}.
|
|
209
|
+
*/
|
|
210
|
+
type PaginateMode = "paged" | "infinite";
|
|
211
|
+
/**
|
|
212
|
+
* The part of a {@link PaginationState} available to both navigation surfaces.
|
|
213
|
+
*/
|
|
214
|
+
interface SharedPaginationState<RT = unknown, E = unknown> {
|
|
215
|
+
/** See {@link PaginationState.totalPages}. */
|
|
216
|
+
readonly totalPages: number;
|
|
217
|
+
/** See {@link PaginationState.adoptPage}. */
|
|
218
|
+
adoptPage(request: Future<RT>): Promise<RT | null>;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* The paged (single-page view) surface of a {@link PaginationState}: render
|
|
222
|
+
* {@link PaginationState.activePageRequest | activePageRequest}, navigate with
|
|
223
|
+
* {@link PaginationState.loadPage | loadPage}. This is what the `<Paginate />`
|
|
224
|
+
* component yields in `'paged'` mode (the default).
|
|
225
|
+
*/
|
|
226
|
+
interface PagedPaginationState<RT = unknown, E = unknown> extends SharedPaginationState<RT, E> {
|
|
227
|
+
/** See {@link PaginationState.activePage}. */
|
|
228
|
+
readonly activePage: Readonly<PageCache<RT, E>> | null;
|
|
229
|
+
/** See {@link PaginationState.activePageRequest}. */
|
|
230
|
+
readonly activePageRequest: Future<RT> | null;
|
|
231
|
+
/** See {@link PaginationState.loadPage}. */
|
|
232
|
+
loadPage: (url: string) => Promise<RT | null>;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* The infinite (accumulated view) surface of a {@link PaginationState}: render
|
|
236
|
+
* {@link PaginationState.data | data}, grow it with
|
|
237
|
+
* {@link PaginationState.loadNext | loadNext}/{@link PaginationState.loadPrev | loadPrev}.
|
|
238
|
+
* This is what the `<Paginate />` component yields in `'infinite'` mode.
|
|
239
|
+
*/
|
|
240
|
+
interface InfinitePaginationState<RT = unknown, E = unknown> extends SharedPaginationState<RT, E> {
|
|
241
|
+
/** See {@link PaginationState.data}. */
|
|
242
|
+
readonly data: Iterable<ContentItem<RT>>;
|
|
243
|
+
/** See {@link PaginationState.pages}. */
|
|
244
|
+
readonly pages: Iterable<Readonly<PageCache<RT, E>>>;
|
|
245
|
+
/** See {@link PaginationState.hasNext}. */
|
|
246
|
+
readonly hasNext: boolean;
|
|
247
|
+
/** See {@link PaginationState.hasPrevious}. */
|
|
248
|
+
readonly hasPrevious: boolean;
|
|
249
|
+
/** See {@link PaginationState.nextRequest}. */
|
|
250
|
+
readonly nextRequest: Future<RT> | null;
|
|
251
|
+
/** See {@link PaginationState.previousRequest}. */
|
|
252
|
+
readonly previousRequest: Future<RT> | null;
|
|
253
|
+
/** See {@link PaginationState.loadNext}. */
|
|
254
|
+
loadNext: () => Promise<RT | null>;
|
|
255
|
+
/** See {@link PaginationState.loadPrev}. */
|
|
256
|
+
loadPrev: () => Promise<RT | null>;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Resolves a {@link PaginateMode} to the surface it exposes, so a component
|
|
260
|
+
* generic over the mode can yield only that surface.
|
|
261
|
+
*/
|
|
262
|
+
type PaginationStateFor<RT = unknown, E = unknown, M extends PaginateMode = "paged"> = M extends "infinite" ? InfinitePaginationState<RT, E> : PagedPaginationState<RT, E>;
|
|
263
|
+
/**
|
|
264
|
+
* The per-component, local pagination state. It houses the state that is unique
|
|
265
|
+
* to a single component instance — the active page and navigation — while
|
|
266
|
+
* referencing a shared {@link PaginationCache} for the page graph and data.
|
|
267
|
+
*
|
|
268
|
+
* This is the object yielded by the `<Paginate />` component, narrowed by the
|
|
269
|
+
* component's `@mode` arg to one of its two navigation surfaces so the two
|
|
270
|
+
* APIs cannot be mixed:
|
|
271
|
+
*
|
|
272
|
+
* - **Paged** (`@mode="paged"`, the default): {@link PagedPaginationState} —
|
|
273
|
+
* render {@link activePageRequest}, navigate with {@link loadPage} (what the
|
|
274
|
+
* numbered/relational links call). Reads {@link activePage}.
|
|
275
|
+
* - **Infinite** (`@mode="infinite"`): {@link InfinitePaginationState} — render
|
|
276
|
+
* {@link data}, wrap {@link nextRequest}/{@link previousRequest} in `<Request>`
|
|
277
|
+
* for loading state, and grow the view with {@link loadNext}/{@link loadPrev}.
|
|
278
|
+
*
|
|
279
|
+
* Both surfaces read the same shared page graph; the mode only selects which
|
|
280
|
+
* API is exposed.
|
|
281
|
+
*
|
|
282
|
+
* Instances are created via {@link getPaginationState} (or by the `<Paginate />`
|
|
283
|
+
* component on your behalf), never constructed directly.
|
|
284
|
+
*
|
|
285
|
+
* @since 5.9.0
|
|
286
|
+
* @public
|
|
287
|
+
* @hideconstructor
|
|
288
|
+
*/
|
|
289
|
+
declare class PaginationState<RT = unknown, E = unknown> implements PagedPaginationState<RT, E>, InfinitePaginationState<RT, E> {
|
|
290
|
+
/**
|
|
291
|
+
* The page the paged surface is currently showing. Starts at the page this
|
|
292
|
+
* component first loaded and moves whenever {@link loadPage} runs (for
|
|
293
|
+
* example a numbered link is clicked).
|
|
294
|
+
*/
|
|
295
|
+
activePage: Readonly<PageCache<RT, E>> | null;
|
|
296
|
+
constructor(request: Future<RT>, pageHints?: PageHints);
|
|
297
|
+
/**
|
|
298
|
+
* The request for the {@link activePage}, for the paged surface to render. This
|
|
299
|
+
* is what a single-page view wraps in a `<Request>` to show the active page's
|
|
300
|
+
* loading, error, and content states:
|
|
301
|
+
*
|
|
302
|
+
* ```gts
|
|
303
|
+
* <Paginate @request={{this.request}}>
|
|
304
|
+
* <:content as |pages|>
|
|
305
|
+
* <Request @request={{pages.activePageRequest}}>
|
|
306
|
+
* <:content as |result|>
|
|
307
|
+
* {{#each result.data as |item|}}...{{/each}}
|
|
308
|
+
* </:content>
|
|
309
|
+
* </Request>
|
|
310
|
+
* </:content>
|
|
311
|
+
* </Paginate>
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
get activePageRequest(): Future<RT> | null;
|
|
315
|
+
/**
|
|
316
|
+
* The total number of pages in the collection, or `0` when it is unknown (for
|
|
317
|
+
* example a cursor-based collection that reports no total).
|
|
318
|
+
*
|
|
319
|
+
* ```gts
|
|
320
|
+
* <p>Page {{pages.activePage.pageNumber}} of {{pages.totalPages}}</p>
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
get totalPages(): number;
|
|
324
|
+
/**
|
|
325
|
+
* The pages of the run this component is viewing, from the backward frontier
|
|
326
|
+
* to the forward frontier inclusive, in order. Part of the infinite surface:
|
|
327
|
+
* it is the same run as {@link data}, yielding the {@link PageCache} objects
|
|
328
|
+
* instead of their flattened items — use it when the UI needs per-page
|
|
329
|
+
* boundaries or request states.
|
|
330
|
+
*
|
|
331
|
+
* Grows as {@link loadNext}/{@link loadPrev} extend the frontier. Scoped to
|
|
332
|
+
* this component's frontier (not the shared cache), so components paging the
|
|
333
|
+
* same collection to different extents each see only what they have scrolled
|
|
334
|
+
* through. For every page known to the whole collection, see
|
|
335
|
+
* {@link PaginationCache.pages}.
|
|
336
|
+
*/
|
|
337
|
+
get pages(): Iterable<Readonly<PageCache<RT, E>>>;
|
|
338
|
+
/**
|
|
339
|
+
* The accumulated items across the loaded run, from the backward frontier to
|
|
340
|
+
* the forward frontier inclusive — the single set an infinite collection renders.
|
|
341
|
+
* Grows as {@link loadNext}/{@link loadPrev} extend the frontier. Scoped to this
|
|
342
|
+
* component's frontier (not the shared cache), so components paging the same
|
|
343
|
+
* collection to different extents each see only what they have scrolled through.
|
|
344
|
+
*
|
|
345
|
+
* The flattened items of {@link pages}, as one contiguous iterable. For the
|
|
346
|
+
* items of every loaded page in the whole collection, see
|
|
347
|
+
* {@link PaginationCache.data}.
|
|
348
|
+
*
|
|
349
|
+
* ```gts
|
|
350
|
+
* <Paginate @request={{this.request}} @mode="infinite">
|
|
351
|
+
* <:content as |pages features|>
|
|
352
|
+
* {{#each pages.data as |item|}}...{{/each}}
|
|
353
|
+
* {{#if pages.hasNext}}
|
|
354
|
+
* <button {{on "click" features.loadNext}}>Load more</button>
|
|
355
|
+
* {{/if}}
|
|
356
|
+
* </:content>
|
|
357
|
+
* </Paginate>
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
get data(): Iterable<ContentItem<RT>>;
|
|
361
|
+
/**
|
|
362
|
+
* Whether a page exists after the forward frontier — i.e. there is more to load
|
|
363
|
+
* going forward. Use to hide the trailing load-more sentinel at end-of-list:
|
|
364
|
+
*
|
|
365
|
+
* ```gts
|
|
366
|
+
* {{#if pages.hasNext}}
|
|
367
|
+
* <button {{on "click" features.loadNext}}>Load more</button>
|
|
368
|
+
* {{/if}}
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
get hasNext(): boolean;
|
|
372
|
+
/**
|
|
373
|
+
* Whether a page exists before the backward frontier.
|
|
374
|
+
*/
|
|
375
|
+
get hasPrevious(): boolean;
|
|
376
|
+
/**
|
|
377
|
+
* The request for the page just after the forward frontier, for the infinite
|
|
378
|
+
* surface. `null` until {@link loadNext} fires it (so a `<Request>` wrapping it
|
|
379
|
+
* renders its idle block), the in-flight `Future` while that page loads, then
|
|
380
|
+
* `null` again once the frontier advances onto it. Also `null` at end-of-list.
|
|
381
|
+
*
|
|
382
|
+
* ```gts
|
|
383
|
+
* {{#if pages.hasNext}}
|
|
384
|
+
* <Request @request={{pages.nextRequest}}>
|
|
385
|
+
* <:idle><button {{on "click" features.loadNext}}>Load more</button></:idle>
|
|
386
|
+
* <:loading><Spinner /></:loading>
|
|
387
|
+
* </Request>
|
|
388
|
+
* {{/if}}
|
|
389
|
+
* ```
|
|
390
|
+
*/
|
|
391
|
+
get nextRequest(): Future<RT> | null;
|
|
392
|
+
/**
|
|
393
|
+
* The request for the page just before the backward frontier. Mirror of
|
|
394
|
+
* {@link nextRequest} for {@link loadPrev}.
|
|
395
|
+
*/
|
|
396
|
+
get previousRequest(): Future<RT> | null;
|
|
397
|
+
/**
|
|
398
|
+
* Adopts an externally-issued request into this pagination, making its page
|
|
399
|
+
* the {@link activePage} — the programmatic entry point for route-driven
|
|
400
|
+
* navigation when managing a `PaginationState` directly (the `<Paginate />`
|
|
401
|
+
* component uses the same mechanism for a changed `@request` arg).
|
|
402
|
+
*
|
|
403
|
+
* Awaits the request and verifies that its document is a page of this
|
|
404
|
+
* state's collection (same `first` — or `self` — link). On a match, the
|
|
405
|
+
* page is loaded (a page already in the shared cache is reused) and — once
|
|
406
|
+
* its request settles — committed: it becomes the active page, and the
|
|
407
|
+
* infinite surface's run is kept coherent (a page already inside the run
|
|
408
|
+
* leaves it untouched, an adjacent page extends it, a disjoint page resets
|
|
409
|
+
* the run to the adopted page). The commit happens only after the page has
|
|
410
|
+
* loaded, so the previous page stays active — and rendered — while the
|
|
411
|
+
* adoption resolves. Returns the page's document.
|
|
412
|
+
*
|
|
413
|
+
* Concurrent calls race safely: the latest call wins. An earlier in-flight
|
|
414
|
+
* adoption is superseded and commits nothing, and a {@link loadPage}
|
|
415
|
+
* navigation also supersedes a pending adoption (the user's click is the
|
|
416
|
+
* newer intent).
|
|
417
|
+
*
|
|
418
|
+
* Returns `null` — leaving the state untouched — whenever the adoption does
|
|
419
|
+
* not commit:
|
|
420
|
+
*
|
|
421
|
+
* - the request (or its page's load) rejected
|
|
422
|
+
* - the document is a page of a *different* collection
|
|
423
|
+
* - this state has not finished setting up its own collection yet
|
|
424
|
+
* - the call was superseded by a newer navigation
|
|
425
|
+
*
|
|
426
|
+
* ```ts
|
|
427
|
+
* const pages = getPaginationState(initialRequest);
|
|
428
|
+
* // later, e.g. in a route model hook reacting to a ?page= param:
|
|
429
|
+
* const adopted = await pages.adoptPage(store.request(query));
|
|
430
|
+
* if (adopted === null) {
|
|
431
|
+
* // not part of this collection — start a fresh pagination
|
|
432
|
+
* }
|
|
433
|
+
* ```
|
|
434
|
+
*
|
|
435
|
+
* It is a stable reference, so it is safe to pass around as an "action" or
|
|
436
|
+
* "event" handler.
|
|
437
|
+
*/
|
|
438
|
+
adoptPage: (request: Future<RT>) => Promise<RT | null>;
|
|
439
|
+
/**
|
|
440
|
+
* Extends the backward frontier by one page, prepending it to {@link data}.
|
|
441
|
+
* The frontier advances only once the page has loaded, so
|
|
442
|
+
* {@link previousRequest} tracks the in-flight page meanwhile. Returns the
|
|
443
|
+
* loaded value, or `null` when there is no previous page or the load fails.
|
|
444
|
+
*
|
|
445
|
+
* On failure the frontier stays put and {@link previousRequest} keeps
|
|
446
|
+
* resolving to the failed page, so a wrapping `<Request>` renders its error
|
|
447
|
+
* block. Calling again retries: the failed page is re-requested with a
|
|
448
|
+
* forced reload.
|
|
449
|
+
*
|
|
450
|
+
* In templates it is also available as the `loadPrev` content feature
|
|
451
|
+
* ({@link InfinitePaginationContentFeatures.loadPrev}) yielded by
|
|
452
|
+
* `<Paginate />`; the two are the same function.
|
|
453
|
+
*
|
|
454
|
+
* It is a stable reference, so it is safe to pass around as an "action" or
|
|
455
|
+
* "event" handler.
|
|
456
|
+
*/
|
|
457
|
+
loadPrev: () => Promise<RT | null>;
|
|
458
|
+
/**
|
|
459
|
+
* Extends the forward frontier by one page, appending it to {@link data}.
|
|
460
|
+
* Mirror of {@link loadPrev}.
|
|
461
|
+
*
|
|
462
|
+
* In templates it is also available as the `loadNext` content feature
|
|
463
|
+
* ({@link InfinitePaginationContentFeatures.loadNext}) yielded by
|
|
464
|
+
* `<Paginate />`; the two are the same function.
|
|
465
|
+
*
|
|
466
|
+
* ```gts
|
|
467
|
+
* <button {{on "click" pages.loadNext}}>Load more</button>
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
470
|
+
loadNext: () => Promise<RT | null>;
|
|
471
|
+
/**
|
|
472
|
+
* Loads a specific page by its URL and makes it the {@link activePage},
|
|
473
|
+
* requesting it first if it is not already loaded. This is the paged surface's
|
|
474
|
+
* navigation entry point, called by the numbered and relational links.
|
|
475
|
+
*
|
|
476
|
+
* In templates it is also available as the `loadPage` content feature
|
|
477
|
+
* ({@link PagedPaginationContentFeatures.loadPage}) yielded by `<Paginate />`;
|
|
478
|
+
* the two are the same function.
|
|
479
|
+
*
|
|
480
|
+
* It is a stable reference, so it is safe to pass around as an "action" or
|
|
481
|
+
* "event" handler. Returns the page's value, or `null` if it has none or
|
|
482
|
+
* the load fails.
|
|
483
|
+
*
|
|
484
|
+
* On failure the page stays active and {@link activePageRequest} resolves to
|
|
485
|
+
* it, so a wrapping `<Request>` renders its error block. Calling again (for
|
|
486
|
+
* example clicking the page's link a second time) retries: the failed page
|
|
487
|
+
* is re-requested with a forced reload.
|
|
488
|
+
*
|
|
489
|
+
* ```gts
|
|
490
|
+
* <EachLink @pages={{pages}}>
|
|
491
|
+
* <:link as |link|>
|
|
492
|
+
* <button {{on "click" (fn features.loadPage link.url)}}>{{link.text}}</button>
|
|
493
|
+
* </:link>
|
|
494
|
+
* </EachLink>
|
|
495
|
+
* ```
|
|
496
|
+
*/
|
|
497
|
+
loadPage: (url: string) => Promise<RT | null>;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Get the {@link PaginationState} for a given request. Returns the same instance
|
|
501
|
+
* for the same request future, so that repeated calls (e.g. in a template, or
|
|
502
|
+
* alongside the `<Paginate />` component using the same request) share the same
|
|
503
|
+
* local pagination state. Keyed by request identity, just like
|
|
504
|
+
* {@link getRequestState}.
|
|
505
|
+
*
|
|
506
|
+
* ```ts
|
|
507
|
+
* const future = store.request(query);
|
|
508
|
+
* const pages = getPaginationState(future);
|
|
509
|
+
*
|
|
510
|
+
* await future;
|
|
511
|
+
* pages.totalPages; // now known, if the response exposed it
|
|
512
|
+
* await pages.loadNext();
|
|
513
|
+
* ```
|
|
514
|
+
*
|
|
515
|
+
* @since 5.9.0
|
|
516
|
+
* @public
|
|
517
|
+
*/
|
|
518
|
+
declare function getPaginationState<RT, E>(request: Future<RT>, pageHints?: PageHints): PaginationState<RT, E>;
|
|
519
|
+
//#endregion
|
|
520
|
+
//#region src/signals/pagination-links.d.ts
|
|
521
|
+
/**
|
|
522
|
+
* A single numbered link, e.g. page `3`. Loads its page and makes it active when
|
|
523
|
+
* {@link setActive} runs. Carries its {@link index} and its
|
|
524
|
+
* {@link distanceFromActiveIndex} so a UI can style links by how far they sit
|
|
525
|
+
* from the current page.
|
|
526
|
+
*
|
|
527
|
+
* ```gts
|
|
528
|
+
* <EachLink @pages={{pages}} as |state|>
|
|
529
|
+
* {{#each state.links as |link|}}
|
|
530
|
+
* {{#if link.isReal}}
|
|
531
|
+
* <button class={{if link.isCurrent "active"}} {{on "click" link.setActive}}>
|
|
532
|
+
* {{link.text}}
|
|
533
|
+
* </button>
|
|
534
|
+
* {{/if}}
|
|
535
|
+
* {{/each}}
|
|
536
|
+
* </EachLink>
|
|
537
|
+
* ```
|
|
538
|
+
*
|
|
539
|
+
* @since 5.9.0
|
|
540
|
+
* @public
|
|
541
|
+
* @hideconstructor
|
|
542
|
+
*/
|
|
543
|
+
declare class RealPaginationLink {
|
|
544
|
+
readonly isReal: true;
|
|
545
|
+
readonly url: string;
|
|
546
|
+
readonly index: number;
|
|
547
|
+
readonly isCurrent: boolean;
|
|
548
|
+
readonly distanceFromActiveIndex: number;
|
|
549
|
+
constructor(url: string, index: number, activeIndex: number, loadPage: (url: string) => Promise<unknown>);
|
|
550
|
+
get text(): string;
|
|
551
|
+
/**
|
|
552
|
+
* Loads this link's page and makes it the active page on the associated
|
|
553
|
+
* {@link PaginationState}. It is a stable reference, so it is safe to pass
|
|
554
|
+
* around as an "action" or "event" handler:
|
|
555
|
+
*
|
|
556
|
+
* ```gts
|
|
557
|
+
* <button {{on "click" link.setActive}}>{{link.text}}</button>
|
|
558
|
+
* ```
|
|
559
|
+
*/
|
|
560
|
+
setActive: () => Promise<unknown>;
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* A stand-in for a run of pages that have not been loaded yet, rendered as an
|
|
564
|
+
* ellipsis between numbered links. It covers an {@link indexRange} rather than a
|
|
565
|
+
* single page and has no page to navigate to.
|
|
566
|
+
*
|
|
567
|
+
* ```gts
|
|
568
|
+
* <EachLink @pages={{pages}} as |state|>
|
|
569
|
+
* {{#each state.links as |link|}}
|
|
570
|
+
* {{#unless link.isReal}}
|
|
571
|
+
* <span title="{{link.rangeSize}} more pages">{{link.text}}</span>
|
|
572
|
+
* {{/unless}}
|
|
573
|
+
* {{/each}}
|
|
574
|
+
* </EachLink>
|
|
575
|
+
* ```
|
|
576
|
+
*
|
|
577
|
+
* @since 5.9.0
|
|
578
|
+
* @public
|
|
579
|
+
* @hideconstructor
|
|
580
|
+
*/
|
|
581
|
+
declare class PlaceholderPaginationLink {
|
|
582
|
+
readonly isReal: false;
|
|
583
|
+
/**
|
|
584
|
+
* The inclusive `[start, end]` page-number range of not-yet-loaded pages this
|
|
585
|
+
* placeholder stands in for.
|
|
586
|
+
*/
|
|
587
|
+
indexRange: [start: number, end: number];
|
|
588
|
+
text: string;
|
|
589
|
+
constructor(index: [start: number, end: number], activeIndex: number);
|
|
590
|
+
/** The number of pages this placeholder covers. */
|
|
591
|
+
get rangeSize(): number;
|
|
592
|
+
/**
|
|
593
|
+
* The distance between the active page and the nearest edge of this
|
|
594
|
+
* placeholder's index range.
|
|
595
|
+
*/
|
|
596
|
+
get distanceFromActiveIndex(): number;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* A relational (`first`/`prev`/`next`/`last`) navigation link, relative to the
|
|
600
|
+
* active page. Unlike {@link RealPaginationLink} these carry no ordinal index —
|
|
601
|
+
* they are the only links available for cursor-based pagination, where pages are
|
|
602
|
+
* chained purely by opaque relational links with no page number or total. They
|
|
603
|
+
* are also available in numbered pagination as a convenience.
|
|
604
|
+
*
|
|
605
|
+
* ```gts
|
|
606
|
+
* <EachLink @pages={{pages}} as |state|>
|
|
607
|
+
* {{#if state.prev}}<button {{on "click" state.prev.setActive}}>Previous</button>{{/if}}
|
|
608
|
+
* {{#if state.next}}<button {{on "click" state.next.setActive}}>Next</button>{{/if}}
|
|
609
|
+
* </EachLink>
|
|
610
|
+
* ```
|
|
611
|
+
*
|
|
612
|
+
* @since 5.9.0
|
|
613
|
+
* @public
|
|
614
|
+
* @hideconstructor
|
|
615
|
+
*/
|
|
616
|
+
declare class RelationalPaginationLink {
|
|
617
|
+
readonly isReal: true;
|
|
618
|
+
readonly rel: "first" | "prev" | "next" | "last";
|
|
619
|
+
readonly url: string;
|
|
620
|
+
/**
|
|
621
|
+
* Whether this link points at the page that is already active — for example
|
|
622
|
+
* the `first` link while the first page is being viewed. Useful for
|
|
623
|
+
* disabling the control.
|
|
624
|
+
*/
|
|
625
|
+
readonly isCurrent: boolean;
|
|
626
|
+
constructor(rel: "first" | "prev" | "next" | "last", url: string, isCurrent: boolean, loadPage: (url: string) => Promise<unknown>);
|
|
627
|
+
get text(): string;
|
|
628
|
+
/**
|
|
629
|
+
* Loads this link's page and makes it the active page on the associated
|
|
630
|
+
* {@link PaginationState}. It is a stable reference, so it is safe to pass
|
|
631
|
+
* around as an "action" or "event" handler:
|
|
632
|
+
*
|
|
633
|
+
* ```gts
|
|
634
|
+
* <button {{on "click" link.setActive}}>{{link.text}}</button>
|
|
635
|
+
* ```
|
|
636
|
+
*/
|
|
637
|
+
setActive: () => Promise<unknown>;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* A member of {@link PaginationLinks.links}: either a numbered
|
|
641
|
+
* {@link RealPaginationLink} or a {@link PlaceholderPaginationLink} standing in
|
|
642
|
+
* for a gap. Discriminate with {@link RealPaginationLink.isReal | isReal}:
|
|
643
|
+
*
|
|
644
|
+
* ```ts
|
|
645
|
+
* for (const link of links.links) {
|
|
646
|
+
* if (link.isReal) {
|
|
647
|
+
* // numbered link: link.index, link.setActive
|
|
648
|
+
* } else {
|
|
649
|
+
* // gap: link.indexRange
|
|
650
|
+
* }
|
|
651
|
+
* }
|
|
652
|
+
* ```
|
|
653
|
+
*/
|
|
654
|
+
type PaginationLink = RealPaginationLink | PlaceholderPaginationLink;
|
|
655
|
+
/**
|
|
656
|
+
* The reactive set of navigation links derived from a {@link PaginationState}.
|
|
657
|
+
* Where `PaginationState` tracks which pages are loaded and which one is active,
|
|
658
|
+
* `PaginationLinks` turns that page graph into the links a UI renders to move
|
|
659
|
+
* between pages.
|
|
660
|
+
*
|
|
661
|
+
* It provides two kinds of link:
|
|
662
|
+
*
|
|
663
|
+
* - {@link links}: the numbered links, with {@link PlaceholderPaginationLink}
|
|
664
|
+
* placeholders standing in for gaps of not-yet-loaded pages. Only numbered
|
|
665
|
+
* collections (where the server exposes page numbers) produce these.
|
|
666
|
+
* - {@link prev} and {@link next}: the relational links for the active page.
|
|
667
|
+
* Available in both numbered and cursor-based pagination, and the only links a
|
|
668
|
+
* cursor-based collection has.
|
|
669
|
+
* - {@link first} and {@link last}: the relational links to the collection's
|
|
670
|
+
* edges, when the response exposes them. Usually present on every page —
|
|
671
|
+
* including the edge page itself, where the link's
|
|
672
|
+
* {@link RelationalPaginationLink.isCurrent | isCurrent} is `true`.
|
|
673
|
+
*
|
|
674
|
+
* Every link updates as pages load and as the active page changes, since they
|
|
675
|
+
* read straight from the state's shared page graph. To get the links for a
|
|
676
|
+
* state, use {@link getPaginationLinks}.
|
|
677
|
+
*
|
|
678
|
+
* See also:
|
|
679
|
+
* - {@link RealPaginationLink}
|
|
680
|
+
* - {@link PlaceholderPaginationLink}
|
|
681
|
+
* - {@link RelationalPaginationLink}
|
|
682
|
+
*
|
|
683
|
+
* @since 5.9.0
|
|
684
|
+
* @public
|
|
685
|
+
* @hideconstructor
|
|
686
|
+
*/
|
|
687
|
+
declare class PaginationLinks<RT = unknown, E = unknown> {
|
|
688
|
+
constructor(paginationState: PagedPaginationState<RT, E>);
|
|
689
|
+
/**
|
|
690
|
+
* The relational `first` link of the collection, or `null` when the active
|
|
691
|
+
* page's response did not expose one. Unlike {@link prev}/{@link next} it is
|
|
692
|
+
* usually present on every page — including the first page itself, where the
|
|
693
|
+
* link's {@link RelationalPaginationLink.isCurrent | isCurrent} is `true`
|
|
694
|
+
* (useful for disabling the control).
|
|
695
|
+
*/
|
|
696
|
+
get first(): RelationalPaginationLink | null;
|
|
697
|
+
/**
|
|
698
|
+
* The relational `prev` link for the active page, or `null` at the start of the
|
|
699
|
+
* collection. Available in both numbered and cursor pagination.
|
|
700
|
+
*/
|
|
701
|
+
get prev(): RelationalPaginationLink | null;
|
|
702
|
+
/**
|
|
703
|
+
* The relational `next` link for the active page, or `null` at the end of the
|
|
704
|
+
* collection. Available in both numbered and cursor pagination.
|
|
705
|
+
*/
|
|
706
|
+
get next(): RelationalPaginationLink | null;
|
|
707
|
+
/**
|
|
708
|
+
* The relational `last` link of the collection, or `null` when the active
|
|
709
|
+
* page's response did not expose one. Mirror of {@link first} for the end of
|
|
710
|
+
* the collection.
|
|
711
|
+
*/
|
|
712
|
+
get last(): RelationalPaginationLink | null;
|
|
713
|
+
/**
|
|
714
|
+
* The numbered links and placeholders, derived from the shared page graph.
|
|
715
|
+
*
|
|
716
|
+
* Only produced for numbered pagination (where the server exposes page numbers).
|
|
717
|
+
* Cursor-based collections have no page numbers, so this is empty — use
|
|
718
|
+
* {@link prev}/{@link next} for cursor navigation.
|
|
719
|
+
*/
|
|
720
|
+
get links(): PaginationLink[];
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Get the {@link PaginationLinks} for a given {@link PaginationState}. Returns
|
|
724
|
+
* the same instance for the same state, so repeated calls (for example a
|
|
725
|
+
* `<Paginate />` component and a separate links component reading the same state)
|
|
726
|
+
* share one set of links. Keyed by state identity, the same way
|
|
727
|
+
* {@link getPaginationState} is keyed by request and {@link getRequestState} by
|
|
728
|
+
* future.
|
|
729
|
+
*
|
|
730
|
+
* ```ts
|
|
731
|
+
* const links = getPaginationLinks(paginationState);
|
|
732
|
+
*
|
|
733
|
+
* for (const link of links.links) {
|
|
734
|
+
* if (link.isReal) {
|
|
735
|
+
* // render a numbered link, using link.setActive as the click handler
|
|
736
|
+
* } else {
|
|
737
|
+
* // render an ellipsis for the gap link.indexRange covers
|
|
738
|
+
* }
|
|
739
|
+
* }
|
|
740
|
+
* ```
|
|
741
|
+
*
|
|
742
|
+
* @since 5.9.0
|
|
743
|
+
* @public
|
|
744
|
+
*/
|
|
745
|
+
declare function getPaginationLinks<RT, E>(state: PagedPaginationState<RT, E>): Readonly<PaginationLinks<RT, E>>;
|
|
746
|
+
//#endregion
|
|
747
|
+
//#region src/signals/pagination-subscription.d.ts
|
|
748
|
+
interface ErrorFeatures {
|
|
749
|
+
isHidden: boolean;
|
|
750
|
+
isOnline: boolean;
|
|
751
|
+
retry: () => Promise<void>;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* The content features available in both pagination modes: the state and
|
|
755
|
+
* controls of the initial request.
|
|
756
|
+
*/
|
|
757
|
+
interface SharedPaginationContentFeatures<RT> {
|
|
758
|
+
isOnline: boolean;
|
|
759
|
+
isHidden: boolean;
|
|
760
|
+
isRefreshing: boolean;
|
|
761
|
+
/**
|
|
762
|
+
* Whether a changed `@request` arg is currently resolving against the
|
|
763
|
+
* loaded collection — e.g. a route-driven navigation (browser back button).
|
|
764
|
+
* The existing content stays rendered while this is `true`; once the
|
|
765
|
+
* request resolves it either becomes the active page (same collection) or
|
|
766
|
+
* the component resets to the new collection.
|
|
767
|
+
*/
|
|
768
|
+
isNavigating: boolean;
|
|
769
|
+
refresh: () => Promise<void>;
|
|
770
|
+
reload: () => Promise<void>;
|
|
771
|
+
abort?: () => void;
|
|
772
|
+
latestRequest?: Future<RT>;
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* The content features yielded in `'paged'` mode: navigation happens by
|
|
776
|
+
* loading a specific page.
|
|
777
|
+
*/
|
|
778
|
+
interface PagedPaginationContentFeatures<RT> extends SharedPaginationContentFeatures<RT> {
|
|
779
|
+
loadPage: (url: string) => Promise<RT | null>;
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* The content features yielded in `'infinite'` mode: navigation happens by
|
|
783
|
+
* extending the loaded run at either end.
|
|
784
|
+
*/
|
|
785
|
+
interface InfinitePaginationContentFeatures<RT> extends SharedPaginationContentFeatures<RT> {
|
|
786
|
+
loadNext: () => Promise<RT | null>;
|
|
787
|
+
loadPrev: () => Promise<RT | null>;
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* The full set of content features a {@link PaginationSubscription} builds —
|
|
791
|
+
* both modes' surfaces. The `<Paginate />` component narrows this to one mode
|
|
792
|
+
* via {@link PaginationContentFeaturesFor} before yielding.
|
|
793
|
+
*/
|
|
794
|
+
type PaginationContentFeatures<RT> = PagedPaginationContentFeatures<RT> & InfinitePaginationContentFeatures<RT>;
|
|
795
|
+
/**
|
|
796
|
+
* Resolves a {@link PaginateMode} to the content features it exposes. Mirror of
|
|
797
|
+
* {@link PaginationStateFor}.
|
|
798
|
+
*/
|
|
799
|
+
type PaginationContentFeaturesFor<RT = unknown, M extends PaginateMode = "paged"> = M extends "infinite" ? InfinitePaginationContentFeatures<RT> : PagedPaginationContentFeatures<RT>;
|
|
800
|
+
interface PaginationSubscriptionArgs<RT, E> extends SubscriptionArgs<RT, E> {
|
|
801
|
+
/**
|
|
802
|
+
* A function to extract the `currentPage` and `totalPages` from a loaded document
|
|
803
|
+
* when they are not available in the default `meta` locations. Must be the same
|
|
804
|
+
* reference across all `<Paginate />` components sharing a collection.
|
|
805
|
+
*/
|
|
806
|
+
pageHints?: PageHints;
|
|
807
|
+
}
|
|
808
|
+
interface PaginateArgs<RT, E> extends PaginationSubscriptionArgs<RT, E> {
|
|
809
|
+
/**
|
|
810
|
+
* Which navigation surface the component yields: `'paged'` (the default) or
|
|
811
|
+
* `'infinite'`. Type-only — it narrows the yielded state and features so the
|
|
812
|
+
* two surfaces cannot be mixed, and is never read at runtime.
|
|
813
|
+
*/
|
|
814
|
+
mode?: PaginateMode;
|
|
815
|
+
subscription?: PaginationSubscription<RT, E>;
|
|
816
|
+
/**
|
|
817
|
+
* The store instance to use for making requests. If contexts are available,
|
|
818
|
+
* the component will default to using the `store` on the context.
|
|
819
|
+
*
|
|
820
|
+
* This is required if the store is not available via context or should be
|
|
821
|
+
* different from the store provided via context.
|
|
822
|
+
*
|
|
823
|
+
*/
|
|
824
|
+
store?: Store | RequestManager;
|
|
825
|
+
}
|
|
826
|
+
interface PaginationSubscription<RT, E> {
|
|
827
|
+
/**
|
|
828
|
+
* The method to call when the component this subscription is attached to
|
|
829
|
+
* unmounts.
|
|
830
|
+
*/
|
|
831
|
+
[DISPOSE](): void;
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Lifecycle glue for the `<Paginate />` component. Owns the initial
|
|
835
|
+
* {@link RequestSubscription} (loading/error state, autorefresh, disposal) and
|
|
836
|
+
* the per-component {@link PaginationState} that it hands to the component.
|
|
837
|
+
*
|
|
838
|
+
* @since 5.9.0
|
|
839
|
+
* @public
|
|
840
|
+
* @hideconstructor
|
|
841
|
+
*/
|
|
842
|
+
declare class PaginationSubscription<RT, E> {
|
|
843
|
+
/**
|
|
844
|
+
* The Store this subscription subscribes to or the RequestManager
|
|
845
|
+
* which issues this request.
|
|
846
|
+
*/
|
|
847
|
+
store: Store | RequestManager;
|
|
848
|
+
constructor(store: Store | RequestManager, args: PaginationSubscriptionArgs<RT, E>);
|
|
849
|
+
/**
|
|
850
|
+
* The per-component pagination state yielded to the component.
|
|
851
|
+
*
|
|
852
|
+
* Keyed to the request that started the collection, not the current
|
|
853
|
+
* `@request` arg: when the arg changes, the existing state keeps rendering
|
|
854
|
+
* while {@link _resolveNavigation} resolves the new request in the
|
|
855
|
+
* background. A request that resolves to a page of the same collection is
|
|
856
|
+
* adopted into this state as the new active page (route-driven navigation,
|
|
857
|
+
* e.g. the browser back button); one that resolves to a different
|
|
858
|
+
* collection swaps in a fresh state (a true reset).
|
|
859
|
+
*
|
|
860
|
+
* A background `refresh` does not swap the request, so the pagination
|
|
861
|
+
* state is stable across refreshes.
|
|
862
|
+
*/
|
|
863
|
+
get paginationState(): PaginationState<RT, E>;
|
|
864
|
+
/**
|
|
865
|
+
* Whether there is no request or query to monitor, so the component has
|
|
866
|
+
* nothing to load.
|
|
867
|
+
*/
|
|
868
|
+
get isIdle(): boolean;
|
|
869
|
+
/**
|
|
870
|
+
* Whether the collection is still blocking-loading: no {@link PaginationState}
|
|
871
|
+
* has finished setting up yet. Only the very first page load (or the reset
|
|
872
|
+
* to a different collection) blocks here — extending the collection with
|
|
873
|
+
* `loadNext`/`loadPrev` does not, and neither does a changed `@request` arg
|
|
874
|
+
* while a collection is already on screen (that is {@link isNavigating}).
|
|
875
|
+
*
|
|
876
|
+
* Remains `true` for the moment between the request resolving and the
|
|
877
|
+
* {@link paginationState} finishing its setup from the response, so that
|
|
878
|
+
* {@link isSuccess} consumers never see a success state with an empty
|
|
879
|
+
* pagination surface.
|
|
880
|
+
*/
|
|
881
|
+
get isLoading(): boolean;
|
|
882
|
+
/**
|
|
883
|
+
* Whether a changed `@request` arg is resolving while a collection is
|
|
884
|
+
* already on screen — route-driven navigation, e.g. the browser back
|
|
885
|
+
* button. The content stays rendered (see {@link isSuccess}); consumers can
|
|
886
|
+
* use this to show a lightweight navigation indicator, the same way a
|
|
887
|
+
* `loadPage` call surfaces through the active page's request state.
|
|
888
|
+
*/
|
|
889
|
+
get isNavigating(): boolean;
|
|
890
|
+
/**
|
|
891
|
+
* The {@link RequestLoadingState} for the initial request, for building UIs
|
|
892
|
+
* that respond to download progress.
|
|
893
|
+
*/
|
|
894
|
+
get loadingState(): RequestLoadingState;
|
|
895
|
+
/**
|
|
896
|
+
* Whether the component has a set-up {@link paginationState} to render and
|
|
897
|
+
* the current request did not fail. Stays `true` while a changed `@request`
|
|
898
|
+
* arg resolves ({@link isNavigating}), so the existing content keeps
|
|
899
|
+
* rendering instead of falling back to a blocking loading state.
|
|
900
|
+
*/
|
|
901
|
+
get isSuccess(): boolean;
|
|
902
|
+
/**
|
|
903
|
+
* Whether the initial request was cancelled (aborted).
|
|
904
|
+
*/
|
|
905
|
+
get isCancelled(): boolean;
|
|
906
|
+
/**
|
|
907
|
+
* Whether the initial request rejected with an error.
|
|
908
|
+
*/
|
|
909
|
+
get isError(): boolean;
|
|
910
|
+
/**
|
|
911
|
+
* The error the initial request rejected with, or `null` if it did not reject.
|
|
912
|
+
*/
|
|
913
|
+
get reason(): StructuredErrorDocument<E> | null;
|
|
914
|
+
/**
|
|
915
|
+
* Error features to yield to the error slot of a component
|
|
916
|
+
*/
|
|
917
|
+
get errorFeatures(): ErrorFeatures;
|
|
918
|
+
/**
|
|
919
|
+
* Content features to yield to the content slot of a component
|
|
920
|
+
*/
|
|
921
|
+
get contentFeatures(): PaginationContentFeatures<RT>;
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* Creates the {@link PaginationSubscription} a `<Paginate />` component uses to
|
|
925
|
+
* manage its request lifecycle and pagination state. Pass the result back into
|
|
926
|
+
* the component via `@subscription` to manage the lifecycle externally.
|
|
927
|
+
*
|
|
928
|
+
* ```ts
|
|
929
|
+
* const subscription = createPaginationSubscription(store, { request });
|
|
930
|
+
*
|
|
931
|
+
* subscription.paginationState; // the per-component PaginationState
|
|
932
|
+
* subscription[DISPOSE](); // tear down when the owning component unmounts
|
|
933
|
+
* ```
|
|
934
|
+
*
|
|
935
|
+
* @since 5.9.0
|
|
936
|
+
* @public
|
|
937
|
+
*/
|
|
938
|
+
declare function createPaginationSubscription<RT, E>(store: Store | RequestManager, args: PaginationSubscriptionArgs<RT, E>): PaginationSubscription<RT, E>;
|
|
939
|
+
//#endregion
|
|
940
|
+
//#region src/signals/pagination-links-subscription.d.ts
|
|
941
|
+
interface PaginationLinksSubscription<RT, E> {
|
|
942
|
+
/**
|
|
943
|
+
* The method to call when the component this subscription is attached to
|
|
944
|
+
* unmounts.
|
|
945
|
+
*/
|
|
946
|
+
[DISPOSE](): void;
|
|
947
|
+
}
|
|
948
|
+
interface PaginationLinksSubscriptionArgs<RT, E> {
|
|
949
|
+
pages: PagedPaginationState<RT, E>;
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* The framework-agnostic core of a pagination links component (for example the
|
|
953
|
+
* `<EachLink />` component of `@warp-drive/ember`): it owns the component
|
|
954
|
+
* lifecycle, while the links themselves live on the {@link PaginationLinks}
|
|
955
|
+
* it exposes.
|
|
956
|
+
*
|
|
957
|
+
* Given the {@link PagedPaginationState} a `<Paginate />` component is driving,
|
|
958
|
+
* {@link paginationLinks} derives that state's `PaginationLinks` — the numbered
|
|
959
|
+
* links (with placeholders for gaps) and the relational
|
|
960
|
+
* `first`/`prev`/`next`/`last` links a component yields for the consumer to
|
|
961
|
+
* render. All of them read from the same shared page graph as the
|
|
962
|
+
* `<Paginate />` component, so they stay in sync as pages load and the active
|
|
963
|
+
* page changes.
|
|
964
|
+
*
|
|
965
|
+
* @since 5.9.0
|
|
966
|
+
* @public
|
|
967
|
+
* @hideconstructor
|
|
968
|
+
*/
|
|
969
|
+
declare class PaginationLinksSubscription<RT, E> {
|
|
970
|
+
constructor(args: PaginationLinksSubscriptionArgs<RT, E>);
|
|
971
|
+
/**
|
|
972
|
+
* The {@link PaginationLinks} derived from the {@link PagedPaginationState}
|
|
973
|
+
* passed as an arg — the surface a links component yields to its consumer:
|
|
974
|
+
* the numbered {@link PaginationLinks.links | links} (empty for cursor-based
|
|
975
|
+
* collections) and the relational {@link PaginationLinks.first | first}/
|
|
976
|
+
* {@link PaginationLinks.prev | prev}/{@link PaginationLinks.next | next}/
|
|
977
|
+
* {@link PaginationLinks.last | last} links.
|
|
978
|
+
*
|
|
979
|
+
* Recomputes when the `pages` arg changes, so a component whose pagination
|
|
980
|
+
* resets to a different collection derives fresh links automatically.
|
|
981
|
+
*/
|
|
982
|
+
get paginationLinks(): Readonly<PaginationLinks<RT, E>>;
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* Creates the {@link PaginationLinksSubscription} a links component (such as
|
|
986
|
+
* `<EachLink />`) uses to derive its links from a {@link PagedPaginationState}.
|
|
987
|
+
*
|
|
988
|
+
* ```ts
|
|
989
|
+
* const subscription = createPaginationLinksSubscription({ pages: paginationState });
|
|
990
|
+
*
|
|
991
|
+
* subscription.paginationLinks; // the derived PaginationLinks
|
|
992
|
+
* subscription[DISPOSE](); // tear down when the owning component unmounts
|
|
993
|
+
* ```
|
|
994
|
+
*
|
|
995
|
+
* @since 5.9.0
|
|
996
|
+
* @public
|
|
997
|
+
*/
|
|
998
|
+
declare function createPaginationLinksSubscription<RT, E>(args: PaginationLinksSubscriptionArgs<RT, E>): PaginationLinksSubscription<RT, E>;
|
|
999
|
+
//#endregion
|
|
1000
|
+
//#region src/signals/reactivity/signal.d.ts
|
|
1001
|
+
/**
|
|
1002
|
+
* Creates a signal for the key/object pairing and subscribes to the signal.
|
|
1003
|
+
*
|
|
1004
|
+
* Use when you need to ensure a signal exists and is subscribed to.
|
|
1005
|
+
*
|
|
1006
|
+
* @private
|
|
1007
|
+
*/
|
|
1008
|
+
declare function entangleSignal<T extends object>(signals: SignalStore, obj: T, key: string | symbol, initialValue: unknown): WarpDriveSignal;
|
|
1009
|
+
/**
|
|
1010
|
+
* define an enumerable signal property.
|
|
1011
|
+
*
|
|
1012
|
+
* Akin to Object.defineProperty.
|
|
1013
|
+
*
|
|
1014
|
+
* The signal will be lazily created when accessed and scoped to the
|
|
1015
|
+
* instance of the object.
|
|
1016
|
+
*
|
|
1017
|
+
* @private
|
|
1018
|
+
*/
|
|
1019
|
+
declare function defineSignal<T extends object>(obj: T, key: string, v?: unknown): void;
|
|
1020
|
+
/**
|
|
1021
|
+
* Define a non-enumerable signal property.
|
|
1022
|
+
*
|
|
1023
|
+
* @private
|
|
1024
|
+
*/
|
|
1025
|
+
declare function defineNonEnumerableSignal<T extends object>(obj: T, key: string, v?: unknown): void;
|
|
1026
|
+
interface DecoratorPropertyDescriptor extends PropertyDescriptor {
|
|
1027
|
+
initializer?: () => unknown;
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Decorator version of creating a signal.
|
|
1031
|
+
*/
|
|
1032
|
+
declare function signal<T extends object, K extends keyof T & string>(target: T, key: K, descriptor?: DecoratorPropertyDescriptor): void;
|
|
1033
|
+
/**
|
|
1034
|
+
* Decorator version of creating a memoized getter
|
|
1035
|
+
*/
|
|
1036
|
+
declare function memoized<T extends object, K extends keyof T & string>(target: T, key: K, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
1037
|
+
/**
|
|
1038
|
+
* Decorator version of creating a gate.
|
|
1039
|
+
*
|
|
1040
|
+
* @private
|
|
1041
|
+
*/
|
|
1042
|
+
declare function gate<T extends object, K extends keyof T & string>(_target: T, key: K, desc: PropertyDescriptor): PropertyDescriptor;
|
|
1043
|
+
/**
|
|
1044
|
+
* Defines a reactive "gated" property on `obj` using `desc` as its
|
|
1045
|
+
* getter/setter descriptor.
|
|
1046
|
+
*
|
|
1047
|
+
* Unlike a signal defined with {@link defineSignal}, a gated property's
|
|
1048
|
+
* consumers are not notified when the property is set, since its update
|
|
1049
|
+
* is expected to be controlled externally (for instance, by a signal it
|
|
1050
|
+
* derives its value from) unless the descriptor opts into being locally
|
|
1051
|
+
* managed.
|
|
1052
|
+
*
|
|
1053
|
+
* Akin to `Object.defineProperty`.
|
|
1054
|
+
*
|
|
1055
|
+
* @private
|
|
1056
|
+
*/
|
|
1057
|
+
declare function defineGate<T extends object>(obj: T, key: string, desc: PropertyDescriptor): void;
|
|
1058
|
+
//#endregion
|
|
1059
|
+
export { type AutorefreshBehaviorCombos, type ContentFeatures, DISPOSE, type InfinitePaginationContentFeatures, type InfinitePaginationState, type PageCache, type PageHints, type PagedPaginationContentFeatures, type PagedPaginationState, type PaginateArgs, type PaginateMode, type PaginationCache, type PaginationContentFeatures, type PaginationContentFeaturesFor, type PaginationLink, type PaginationLinks, type PaginationLinksSubscription, type PaginationState, type PaginationStateFor, type PaginationSubscription, type PlaceholderPaginationLink, type RealPaginationLink, type RecoveryFeatures, type RelationalPaginationLink, type RequestArgs, type SharedPaginationContentFeatures, type SharedPaginationState, type SignalStore, type SubscriptionArgs, clearPaginationCache, createPaginationLinksSubscription, createPaginationSubscription, defaultPageHints, defineGate, defineNonEnumerableSignal, defineSignal, entangleSignal, gate, getOrCreateInternalSignal, getPaginationCache, getPaginationLinks, getPaginationState, makeInitializer, memoized, notifyInternalSignal, peekInternalSignal, signal, waitFor, withSignalStore };
|
|
1060
|
+
//# sourceMappingURL=-leaked.d.ts.map
|