@warp-drive-mirror/core 5.10.0-alpha.10 → 5.10.0-alpha.13
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/README.md +116 -6
- package/dist/{-private-CjK1Dmuh.js → -private-BpyvBYFj.js} +508 -144
- package/dist/-private-BpyvBYFj.js.map +1 -0
- package/dist/{unpkg/dev/-private-Dtj8O5W7.js → -private-CmNOwhK0.js} +3 -1
- package/dist/{-private-Dtj8O5W7.js.map → -private-CmNOwhK0.js.map} +1 -1
- package/dist/{aliases-BWYW5EhX.d.ts → aliases-BQmAxXmb.d.ts} +4 -1
- package/dist/aliases-BQmAxXmb.d.ts.map +1 -0
- package/dist/{change-C7kqv2kW.d.ts → change-DClXcHvr.d.ts} +4 -2
- package/dist/change-DClXcHvr.d.ts.map +1 -0
- package/dist/{concepts-DFldVwEM.d.ts → concepts-DzuY5M1K.d.ts} +14 -5
- package/dist/concepts-DzuY5M1K.d.ts.map +1 -0
- package/dist/{configure-B_F639tN.d.ts → configure-CjsojjiI.d.ts} +7 -1
- package/dist/configure-CjsojjiI.d.ts.map +1 -0
- package/dist/configure.d.ts +1 -1
- package/dist/configure.js +1 -1
- package/dist/{document-Ca4ZZBd9.d.ts → document-Ni8Ns26t.d.ts} +22 -4
- package/dist/document-Ni8Ns26t.d.ts.map +1 -0
- package/dist/{error-0uD6GkNX.d.ts → error-APuUdUGk.d.ts} +4 -2
- package/dist/error-APuUdUGk.d.ts.map +1 -0
- package/dist/{fields-FM7peCiM.d.ts → fields-D6173Q_a.d.ts} +134 -7
- package/dist/fields-D6173Q_a.d.ts.map +1 -0
- package/dist/graph/-private.d.ts +1 -1
- package/dist/graph/-private.js +2 -0
- package/dist/graph/-private.js.map +1 -1
- package/dist/{graph-DLqYXP2z.d.ts → graph-rjTyJ-gd.d.ts} +25 -5
- package/dist/graph-rjTyJ-gd.d.ts.map +1 -0
- package/dist/{identifier-DQnqOSJK.d.ts → identifier-B_tK3FUw.d.ts} +29 -4
- package/dist/identifier-B_tK3FUw.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{internal-9XuWZdDv.d.ts → internal-CgOlgOt3.d.ts} +497 -31
- package/dist/internal-CgOlgOt3.d.ts.map +1 -0
- package/dist/{json-api-raw-C5APJHHB.d.ts → json-api-raw-BxzNsCg0.d.ts} +44 -2
- package/dist/json-api-raw-BxzNsCg0.d.ts.map +1 -0
- package/dist/{mutations-CqtoGB4t.d.ts → mutations-C81gbYjB.d.ts} +18 -2
- package/dist/mutations-C81gbYjB.d.ts.map +1 -0
- package/dist/{operations-D1qA6r0_.d.ts → operations-B4pQM7D6.d.ts} +39 -5
- package/dist/operations-B4pQM7D6.d.ts.map +1 -0
- package/dist/{params-DrEx3bf8.d.ts → params-dbHiSOMF.d.ts} +11 -1
- package/dist/params-dbHiSOMF.d.ts.map +1 -0
- package/dist/{raw-D5hnjiq7.d.ts → raw-CiC64nCY.d.ts} +10 -1
- package/dist/raw-CiC64nCY.d.ts.map +1 -0
- package/dist/reactive/-private.d.ts +1 -1
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.d.ts +2 -2
- package/dist/reactive.js +3 -3
- package/dist/{record-D3QQcaIR.d.ts → record-DDxPtzcY.d.ts} +22 -2
- package/dist/record-DDxPtzcY.d.ts.map +1 -0
- package/dist/{relationship-CmHzMPKf.d.ts → relationship-BlGIXgj4.d.ts} +10 -3
- package/dist/relationship-BlGIXgj4.d.ts.map +1 -0
- package/dist/{request-Di274pQz.js → request-MiwUbGdT.js} +26 -1
- package/dist/request-MiwUbGdT.js.map +1 -0
- package/dist/request.d.ts +1 -1
- package/dist/request.js +1 -1
- package/dist/signals/-leaked.d.ts +86 -4
- package/dist/signals/-leaked.d.ts.map +1 -1
- package/dist/signals/-leaked.js +1 -1
- package/dist/{src-TlQlgL5V.js → src-DlNeupkA.js} +222 -20
- package/dist/src-DlNeupkA.js.map +1 -0
- package/dist/store/-private.d.ts +1 -1
- package/dist/store/-private.js +1 -1
- package/dist/{store-DNF9Rgoh.js → store-lcyaxrpj.js} +16 -1
- package/dist/store-lcyaxrpj.js.map +1 -0
- package/dist/store.d.ts +1 -1
- package/dist/store.js +1 -1
- package/dist/{symbols-DjRDCeX0.d.ts → symbols-Cu9un1NR.d.ts} +10 -1
- package/dist/symbols-Cu9un1NR.d.ts.map +1 -0
- package/dist/types/-private.js +1 -1
- package/dist/types/cache/aliases.d.ts +1 -1
- package/dist/types/cache/change.d.ts +1 -1
- package/dist/types/cache/mutations.d.ts +1 -1
- package/dist/types/cache/operations.d.ts +1 -1
- package/dist/types/cache/relationship.d.ts +1 -1
- package/dist/types/cache.d.ts +1 -1
- package/dist/types/graph.d.ts +1 -1
- package/dist/types/identifier.d.ts +1 -1
- package/dist/types/identifier.js +33 -3
- package/dist/types/identifier.js.map +1 -1
- package/dist/types/json/raw.d.ts +1 -1
- package/dist/types/params.d.ts +1 -1
- package/dist/types/record.d.ts +1 -1
- package/dist/types/record.js +25 -0
- package/dist/types/record.js.map +1 -1
- package/dist/types/request.d.ts +1 -1
- package/dist/types/request.js +80 -0
- package/dist/types/request.js.map +1 -1
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/types/schema/concepts.d.ts +1 -1
- package/dist/types/schema/fields.d.ts +1 -1
- package/dist/types/schema/fields.js +132 -3
- package/dist/types/schema/fields.js.map +1 -1
- package/dist/types/schema/schema-service.d.ts +1 -1
- package/dist/types/spec/document.d.ts +1 -1
- package/dist/types/spec/error.d.ts +1 -1
- package/dist/types/spec/json-api-raw.d.ts +1 -1
- package/dist/types/symbols.d.ts +1 -1
- package/dist/types/symbols.js +14 -0
- package/dist/types/symbols.js.map +1 -1
- package/dist/types/utils.d.ts +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/unpkg/{dev-deprecated/-private-DrQgwtNS.js → dev/-private-BH4O810v.js} +508 -144
- package/dist/unpkg/dev/-private-BH4O810v.js.map +1 -0
- package/dist/{-private-Dtj8O5W7.js → unpkg/dev/-private-CmNOwhK0.js} +3 -1
- package/dist/unpkg/dev/{-private-Dtj8O5W7.js.map → -private-CmNOwhK0.js.map} +1 -1
- package/dist/unpkg/dev/configure.js +1 -1
- package/dist/unpkg/dev/graph/-private.js +2 -0
- 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-nAaeDlS9.js → dev/request-Fe-vpe-u.js} +26 -1
- package/dist/unpkg/dev/request-Fe-vpe-u.js.map +1 -0
- package/dist/unpkg/dev/request.js +1 -1
- package/dist/unpkg/dev/signals/-leaked.js +1 -1
- package/dist/unpkg/dev/{src-D8uKAIUN.js → src-FSk0Z_Lp.js} +213 -13
- package/dist/unpkg/dev/src-FSk0Z_Lp.js.map +1 -0
- package/dist/unpkg/dev/store/-private.js +1 -1
- package/dist/unpkg/dev/{store-BIFNM_fB.js → store-BUV8Pfi7.js} +16 -1
- package/dist/unpkg/dev/store-BUV8Pfi7.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/identifier.js +33 -3
- package/dist/unpkg/dev/types/identifier.js.map +1 -1
- package/dist/unpkg/dev/types/record.js +25 -0
- package/dist/unpkg/dev/types/record.js.map +1 -1
- package/dist/unpkg/dev/types/request.js +80 -0
- package/dist/unpkg/dev/types/request.js.map +1 -1
- package/dist/unpkg/dev/types/schema/fields.js +132 -3
- package/dist/unpkg/dev/types/schema/fields.js.map +1 -1
- package/dist/unpkg/dev/types/symbols.js +14 -0
- package/dist/unpkg/dev/types/symbols.js.map +1 -1
- package/dist/unpkg/{dev/-private-DrQgwtNS.js → dev-deprecated/-private-BH4O810v.js} +508 -144
- package/dist/unpkg/dev-deprecated/-private-BH4O810v.js.map +1 -0
- package/dist/unpkg/{prod-deprecated/-private-Dtj8O5W7.js → dev-deprecated/-private-CmNOwhK0.js} +3 -1
- package/dist/unpkg/dev-deprecated/{-private-Dtj8O5W7.js.map → -private-CmNOwhK0.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/configure.js +1 -1
- package/dist/unpkg/dev-deprecated/graph/-private.js +2 -0
- 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-nAaeDlS9.js → dev-deprecated/request-Fe-vpe-u.js} +26 -1
- package/dist/unpkg/dev-deprecated/request-Fe-vpe-u.js.map +1 -0
- package/dist/unpkg/dev-deprecated/request.js +1 -1
- package/dist/unpkg/dev-deprecated/signals/-leaked.js +1 -1
- package/dist/unpkg/dev-deprecated/{src-BlewXGbB.js → src-Isk_Je7q.js} +215 -13
- package/dist/unpkg/dev-deprecated/src-Isk_Je7q.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/{store-X1WN7P_O.js → store-CCZBSe0p.js} +16 -1
- package/dist/unpkg/dev-deprecated/store-CCZBSe0p.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/identifier.js +33 -3
- package/dist/unpkg/dev-deprecated/types/identifier.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/record.js +25 -0
- package/dist/unpkg/dev-deprecated/types/record.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/request.js +80 -0
- package/dist/unpkg/dev-deprecated/types/request.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/schema/fields.js +132 -3
- package/dist/unpkg/dev-deprecated/types/schema/fields.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/symbols.js +14 -0
- package/dist/unpkg/dev-deprecated/types/symbols.js.map +1 -1
- package/dist/unpkg/prod/-private-CmNOwhK0.js +24 -0
- package/dist/unpkg/prod/{-private-Dtj8O5W7.js.map → -private-CmNOwhK0.js.map} +1 -1
- package/dist/unpkg/prod/{-private-Dg1vsF-H.js → -private-DKVDMUfT.js} +481 -138
- package/dist/unpkg/prod/-private-DKVDMUfT.js.map +1 -0
- package/dist/unpkg/prod/configure.js +1 -1
- package/dist/unpkg/prod/graph/-private.js +2 -0
- 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-DK7nNaAf.js → request-ndw2Fy91.js} +26 -1
- package/dist/unpkg/prod/request-ndw2Fy91.js.map +1 -0
- package/dist/unpkg/prod/request.js +1 -1
- package/dist/unpkg/prod/signals/-leaked.js +1 -1
- package/dist/unpkg/prod/{src-DGB6WvXW.js → src-CoSpuocQ.js} +213 -13
- package/dist/unpkg/prod/src-CoSpuocQ.js.map +1 -0
- package/dist/unpkg/prod/store/-private.js +1 -1
- package/dist/unpkg/{prod-deprecated/store-BWhmb7Ob.js → prod/store-CQOsqdST.js} +16 -1
- package/dist/unpkg/prod/store-CQOsqdST.js.map +1 -0
- package/dist/unpkg/prod/store.js +1 -1
- package/dist/unpkg/prod/types/-private.js +1 -1
- package/dist/unpkg/prod/types/identifier.js +33 -3
- package/dist/unpkg/prod/types/identifier.js.map +1 -1
- package/dist/unpkg/prod/types/record.js +25 -0
- package/dist/unpkg/prod/types/record.js.map +1 -1
- package/dist/unpkg/prod/types/request.js +80 -0
- package/dist/unpkg/prod/types/request.js.map +1 -1
- package/dist/unpkg/prod/types/schema/fields.js +132 -3
- package/dist/unpkg/prod/types/schema/fields.js.map +1 -1
- package/dist/unpkg/prod/types/symbols.js +14 -0
- package/dist/unpkg/prod/types/symbols.js.map +1 -1
- package/dist/unpkg/{dev-deprecated/-private-Dtj8O5W7.js → prod-deprecated/-private-CmNOwhK0.js} +3 -1
- package/dist/unpkg/prod-deprecated/{-private-Dtj8O5W7.js.map → -private-CmNOwhK0.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/{-private-Dg1vsF-H.js → -private-DKVDMUfT.js} +481 -138
- package/dist/unpkg/prod-deprecated/-private-DKVDMUfT.js.map +1 -0
- package/dist/unpkg/prod-deprecated/configure.js +1 -1
- package/dist/unpkg/prod-deprecated/graph/-private.js +2 -0
- 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-DK7nNaAf.js → request-ndw2Fy91.js} +26 -1
- package/dist/unpkg/prod-deprecated/request-ndw2Fy91.js.map +1 -0
- package/dist/unpkg/prod-deprecated/request.js +1 -1
- package/dist/unpkg/prod-deprecated/signals/-leaked.js +1 -1
- package/dist/unpkg/prod-deprecated/{src-B9AnmJPz.js → src-FK_rMde5.js} +215 -13
- package/dist/unpkg/prod-deprecated/src-FK_rMde5.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store/-private.js +1 -1
- package/dist/unpkg/{prod/store-BWhmb7Ob.js → prod-deprecated/store-CQOsqdST.js} +16 -1
- package/dist/unpkg/prod-deprecated/store-CQOsqdST.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store.js +1 -1
- package/dist/unpkg/prod-deprecated/types/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/types/identifier.js +33 -3
- package/dist/unpkg/prod-deprecated/types/identifier.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/record.js +25 -0
- package/dist/unpkg/prod-deprecated/types/record.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/request.js +80 -0
- package/dist/unpkg/prod-deprecated/types/request.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/schema/fields.js +132 -3
- package/dist/unpkg/prod-deprecated/types/schema/fields.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/symbols.js +14 -0
- package/dist/unpkg/prod-deprecated/types/symbols.js.map +1 -1
- package/dist/{utils-BtURiy8l.d.ts → utils-CNmQoKm8.d.ts} +8 -1
- package/dist/utils-CNmQoKm8.d.ts.map +1 -0
- package/package.json +5 -5
- package/dist/-private-CjK1Dmuh.js.map +0 -1
- package/dist/aliases-BWYW5EhX.d.ts.map +0 -1
- package/dist/change-C7kqv2kW.d.ts.map +0 -1
- package/dist/concepts-DFldVwEM.d.ts.map +0 -1
- package/dist/configure-B_F639tN.d.ts.map +0 -1
- package/dist/document-Ca4ZZBd9.d.ts.map +0 -1
- package/dist/error-0uD6GkNX.d.ts.map +0 -1
- package/dist/fields-FM7peCiM.d.ts.map +0 -1
- package/dist/graph-DLqYXP2z.d.ts.map +0 -1
- package/dist/identifier-DQnqOSJK.d.ts.map +0 -1
- package/dist/internal-9XuWZdDv.d.ts.map +0 -1
- package/dist/json-api-raw-C5APJHHB.d.ts.map +0 -1
- package/dist/mutations-CqtoGB4t.d.ts.map +0 -1
- package/dist/operations-D1qA6r0_.d.ts.map +0 -1
- package/dist/params-DrEx3bf8.d.ts.map +0 -1
- package/dist/raw-D5hnjiq7.d.ts.map +0 -1
- package/dist/record-D3QQcaIR.d.ts.map +0 -1
- package/dist/relationship-CmHzMPKf.d.ts.map +0 -1
- package/dist/request-Di274pQz.js.map +0 -1
- package/dist/src-TlQlgL5V.js.map +0 -1
- package/dist/store-DNF9Rgoh.js.map +0 -1
- package/dist/symbols-DjRDCeX0.d.ts.map +0 -1
- package/dist/types/schema/fields.type-test.d.ts +0 -1
- package/dist/types/schema/fields.type-test.js +0 -79
- package/dist/types/schema/fields.type-test.js.map +0 -1
- package/dist/unpkg/dev/-private-DrQgwtNS.js.map +0 -1
- package/dist/unpkg/dev/request-nAaeDlS9.js.map +0 -1
- package/dist/unpkg/dev/src-D8uKAIUN.js.map +0 -1
- package/dist/unpkg/dev/store-BIFNM_fB.js.map +0 -1
- package/dist/unpkg/dev/types/schema/fields.type-test.js +0 -79
- package/dist/unpkg/dev/types/schema/fields.type-test.js.map +0 -1
- package/dist/unpkg/dev-deprecated/-private-DrQgwtNS.js.map +0 -1
- package/dist/unpkg/dev-deprecated/request-nAaeDlS9.js.map +0 -1
- package/dist/unpkg/dev-deprecated/src-BlewXGbB.js.map +0 -1
- package/dist/unpkg/dev-deprecated/store-X1WN7P_O.js.map +0 -1
- package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js +0 -79
- package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js.map +0 -1
- package/dist/unpkg/prod/-private-Dg1vsF-H.js.map +0 -1
- package/dist/unpkg/prod/-private-Dtj8O5W7.js +0 -22
- package/dist/unpkg/prod/request-DK7nNaAf.js.map +0 -1
- package/dist/unpkg/prod/src-DGB6WvXW.js.map +0 -1
- package/dist/unpkg/prod/store-BWhmb7Ob.js.map +0 -1
- package/dist/unpkg/prod/types/schema/fields.type-test.js +0 -79
- package/dist/unpkg/prod/types/schema/fields.type-test.js.map +0 -1
- package/dist/unpkg/prod-deprecated/-private-Dg1vsF-H.js.map +0 -1
- package/dist/unpkg/prod-deprecated/request-DK7nNaAf.js.map +0 -1
- package/dist/unpkg/prod-deprecated/src-B9AnmJPz.js.map +0 -1
- package/dist/unpkg/prod-deprecated/store-BWhmb7Ob.js.map +0 -1
- package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js +0 -79
- package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js.map +0 -1
- package/dist/utils-BtURiy8l.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getOrSetGlobal, peekTransient, setTransient } from "./types/-private.js";
|
|
2
|
-
import { f as setPromiseResult, o as DOMError, u as getPromiseResult } from "./request-
|
|
2
|
+
import { f as setPromiseResult, o as DOMError, u as getPromiseResult } from "./request-Fe-vpe-u.js";
|
|
3
3
|
|
|
4
4
|
//#region src/signals/reactivity/configure.ts
|
|
5
5
|
const ARRAY_SIGNAL = getOrSetGlobal("#[]", Symbol("#[]"));
|
|
@@ -33,6 +33,8 @@ const OBJECT_SIGNAL = getOrSetGlobal("#{}", Symbol("#{}"));
|
|
|
33
33
|
* scenarios you may also be interested in integrating with the {@link NotificationManager}
|
|
34
34
|
* more directly.
|
|
35
35
|
*
|
|
36
|
+
* @summary The create, consume, notify, and memo hooks a framework or TC39 signals implementation
|
|
37
|
+
* supplies to `setupSignals` to make WarpDrive data reactive.
|
|
36
38
|
* @public
|
|
37
39
|
*/
|
|
38
40
|
/**
|
|
@@ -48,6 +50,8 @@ const OBJECT_SIGNAL = getOrSetGlobal("#{}", Symbol("#{}"));
|
|
|
48
50
|
* }
|
|
49
51
|
* ```
|
|
50
52
|
*
|
|
53
|
+
* @summary The options passed to the `setupSignals` callback, including the well-known key WarpDrive
|
|
54
|
+
* uses for an array's contents signal.
|
|
51
55
|
* @public
|
|
52
56
|
*/
|
|
53
57
|
/**
|
|
@@ -60,6 +64,8 @@ const OBJECT_SIGNAL = getOrSetGlobal("#{}", Symbol("#{}"));
|
|
|
60
64
|
* See {@link SignalHooks} for the implementation the callback function should
|
|
61
65
|
* return.
|
|
62
66
|
*
|
|
67
|
+
* @summary Registers the signal hooks WarpDrive uses for reactivity, built by a callback that receives
|
|
68
|
+
* `HooksOptions`.
|
|
63
69
|
* @public
|
|
64
70
|
* @param buildConfig - a function that takes options and returns a configuration object
|
|
65
71
|
*/
|
|
@@ -609,6 +615,8 @@ async function watchStream(stream, loadingState) {
|
|
|
609
615
|
* reactive properties that can be used to build UIs that respond
|
|
610
616
|
* to the progress of a request.
|
|
611
617
|
*
|
|
618
|
+
* @summary Reactive download progress for a request, such as bytes loaded and timing, built by lazily
|
|
619
|
+
* reading its response stream.
|
|
612
620
|
* @hideconstructor
|
|
613
621
|
*/
|
|
614
622
|
var RequestLoadingState = class {
|
|
@@ -827,9 +835,11 @@ defineNonEnumerableSignal(RequestLoadingState.prototype, "_lastPacketTime", 0);
|
|
|
827
835
|
*
|
|
828
836
|
*/
|
|
829
837
|
/**
|
|
830
|
-
* The state of a request
|
|
831
|
-
*
|
|
832
|
-
* cancelled
|
|
838
|
+
* The state of a request that was aborted before it settled.
|
|
839
|
+
*
|
|
840
|
+
* A cancelled request has `status: 'cancelled'` and its `reason` is an
|
|
841
|
+
* `AbortError`. `isError` is also `true`, as for a {@link RejectedRequest},
|
|
842
|
+
* so check `status` or `isCancelled` to tell the two apart.
|
|
833
843
|
*
|
|
834
844
|
*/
|
|
835
845
|
/**
|
|
@@ -863,6 +873,8 @@ defineNonEnumerableSignal(RequestLoadingState.prototype, "_lastPacketTime", 0);
|
|
|
863
873
|
* - {@link RejectedRequest}
|
|
864
874
|
* - {@link CancelledRequest}
|
|
865
875
|
*
|
|
876
|
+
* @summary The reactive pending, fulfilled, rejected, or cancelled state of a request `Future`, as
|
|
877
|
+
* returned by `getRequestState`.
|
|
866
878
|
*/
|
|
867
879
|
const RequestStateProto = {};
|
|
868
880
|
function performRefresh(requester, request, isReload) {
|
|
@@ -917,7 +929,7 @@ function createRequestState(future) {
|
|
|
917
929
|
if (state.isError) {
|
|
918
930
|
promiseState.error = state.result;
|
|
919
931
|
promiseState.reason = state.result;
|
|
920
|
-
promiseState.status = "rejected";
|
|
932
|
+
promiseState.status = isAbortError(state.result) ? "cancelled" : "rejected";
|
|
921
933
|
promiseState.isError = true;
|
|
922
934
|
promiseState.isPending = false;
|
|
923
935
|
promiseState.isLoading = false;
|
|
@@ -953,7 +965,7 @@ function createRequestState(future) {
|
|
|
953
965
|
});
|
|
954
966
|
promiseState.error = error;
|
|
955
967
|
promiseState.reason = error;
|
|
956
|
-
promiseState.status = "rejected";
|
|
968
|
+
promiseState.status = isAbortError(error) ? "cancelled" : "rejected";
|
|
957
969
|
promiseState.isError = true;
|
|
958
970
|
promiseState.isPending = false;
|
|
959
971
|
promiseState.isLoading = false;
|
|
@@ -965,6 +977,26 @@ function createRequestState(future) {
|
|
|
965
977
|
/**
|
|
966
978
|
* `getRequestState` can be used in both JavaScript and Template contexts.
|
|
967
979
|
*
|
|
980
|
+
* It returns a {@link RequestState}: a reactive object that updates as the
|
|
981
|
+
* request advances. Calling it again with the same {@link Future} returns the
|
|
982
|
+
* same object. Check `status` to narrow it to one of four states:
|
|
983
|
+
*
|
|
984
|
+
* - {@link PendingRequest} (`'pending'`) is the initial state, before the
|
|
985
|
+
* request settles.
|
|
986
|
+
* - {@link ResolvedRequest} (`'fulfilled'`) holds the response content on `value`.
|
|
987
|
+
* - {@link RejectedRequest} (`'rejected'`) holds the error on `reason`.
|
|
988
|
+
* - {@link CancelledRequest} (`'cancelled'`) is a request that was aborted.
|
|
989
|
+
* `isError` is also `true` for a cancelled request, so check `status` or
|
|
990
|
+
* `isCancelled` rather than `isError` if you handle it differently.
|
|
991
|
+
*
|
|
992
|
+
* Every state also exposes a {@link RequestLoadingState} on `loadingState`
|
|
993
|
+
* for tracking the progress of the response stream.
|
|
994
|
+
*
|
|
995
|
+
* The [Reactive Control Flow](/guides/the-manual/reactivity/control-flow) guide shows
|
|
996
|
+
* how to render request states with it, and
|
|
997
|
+
* [Using The Response](/guides/the-manual/requests/using-the-response) covers the
|
|
998
|
+
* `Future` it reads.
|
|
999
|
+
*
|
|
968
1000
|
* ```ts
|
|
969
1001
|
* import { getRequestState } from '@warp-drive-mirror/ember';
|
|
970
1002
|
*
|
|
@@ -1011,6 +1043,10 @@ function createRequestState(future) {
|
|
|
1011
1043
|
* which offers a number of additional capabilities for requests *beyond* what
|
|
1012
1044
|
* `RequestState` provides.
|
|
1013
1045
|
*
|
|
1046
|
+
* @param future - the request {@link Future} to track, as returned by `store.request` or `requestManager.request`
|
|
1047
|
+
* @return the cached {@link RequestState} for `future`
|
|
1048
|
+
* @summary Returns a cached, reactive state object tracking a request `Future` through pending, success,
|
|
1049
|
+
* error, and cancellation.
|
|
1014
1050
|
*/
|
|
1015
1051
|
function getRequestState(future) {
|
|
1016
1052
|
let state = RequestCache.get(future);
|
|
@@ -1086,28 +1122,47 @@ function isNeverString(val) {
|
|
|
1086
1122
|
/**
|
|
1087
1123
|
* The individual autorefresh strategies a {@link RequestSubscription}
|
|
1088
1124
|
* may combine, see {@link AutorefreshBehaviorCombos}.
|
|
1125
|
+
*
|
|
1126
|
+
* @summary One autorefresh trigger for a request subscription: on reconnecting (`online`), on a timer
|
|
1127
|
+
* (`interval`), or on store invalidation (`invalid`).
|
|
1089
1128
|
*/
|
|
1090
1129
|
/**
|
|
1091
1130
|
* The value accepted by {@link SubscriptionArgs.autorefresh}: either a
|
|
1092
1131
|
* boolean, a single {@link AutorefreshBehaviorType}, or a comma-separated
|
|
1093
1132
|
* combination of up to three of them.
|
|
1133
|
+
*
|
|
1134
|
+
* @summary The accepted values for a request subscription's `autorefresh` option: a boolean or a
|
|
1135
|
+
* comma-separated mix of `online`, `interval`, and `invalid`.
|
|
1094
1136
|
*/
|
|
1095
1137
|
/**
|
|
1096
1138
|
* Utilities to assist in recovering from the error.
|
|
1139
|
+
*
|
|
1140
|
+
* @summary The online and visibility state plus a `retry` function that a request subscription exposes
|
|
1141
|
+
* for recovering from a failed request.
|
|
1097
1142
|
*/
|
|
1098
1143
|
/** @deprecated use {@link RecoveryFeatures} */
|
|
1099
1144
|
/**
|
|
1100
1145
|
* Utilities for keeping the request fresh
|
|
1146
|
+
*
|
|
1147
|
+
* @summary The online, visibility, and refreshing state plus `refresh`, `reload`, and `abort` functions a
|
|
1148
|
+
* request subscription exposes alongside successful content.
|
|
1101
1149
|
*/
|
|
1102
1150
|
/**
|
|
1103
1151
|
* The args accepted by the `<Request />` component.
|
|
1152
|
+
*
|
|
1153
|
+
* @summary The arguments of the `<Request />` component: the request or query to run, autorefresh
|
|
1154
|
+
* options, and an optional store or subscription.
|
|
1104
1155
|
*/
|
|
1105
1156
|
/**
|
|
1106
1157
|
* The args accepted by a {@link RequestSubscription}.
|
|
1158
|
+
*
|
|
1159
|
+
* @summary Options for a request subscription: the request or query to monitor and its autorefresh settings.
|
|
1107
1160
|
*/
|
|
1108
1161
|
/**
|
|
1109
1162
|
* A reactive class
|
|
1110
1163
|
*
|
|
1164
|
+
* @summary Reactive subscription that monitors a request or query, tracking online, visibility and refresh state and
|
|
1165
|
+
* handling autorefresh, reload and retry.
|
|
1111
1166
|
* @hideconstructor
|
|
1112
1167
|
*/
|
|
1113
1168
|
var RequestSubscription = class {
|
|
@@ -1533,6 +1588,9 @@ function isStore(store) {
|
|
|
1533
1588
|
/**
|
|
1534
1589
|
* Creates a {@link RequestSubscription}, the reactive class powering the
|
|
1535
1590
|
* `<Request />` component's autorefresh, retry, and refresh behaviors.
|
|
1591
|
+
*
|
|
1592
|
+
* @summary Creates a reactive subscription to a request or query that tracks its state and handles
|
|
1593
|
+
* autorefresh, retry, and refresh.
|
|
1536
1594
|
*/
|
|
1537
1595
|
function createRequestSubscription(store, args) {
|
|
1538
1596
|
return new RequestSubscription(store, args);
|
|
@@ -1599,6 +1657,8 @@ function getHref(link) {
|
|
|
1599
1657
|
* }
|
|
1600
1658
|
* ```
|
|
1601
1659
|
*
|
|
1660
|
+
* @summary Experimental: one page of a paginated collection, exposing its request, loading and error status, data,
|
|
1661
|
+
* and links to neighboring pages.
|
|
1602
1662
|
* @since 5.9.0
|
|
1603
1663
|
* @public
|
|
1604
1664
|
* @hideconstructor
|
|
@@ -1781,63 +1841,209 @@ var PageCache = class {
|
|
|
1781
1841
|
decorateMethodV2(this.prototype, "isLinked", [memoized]);
|
|
1782
1842
|
}
|
|
1783
1843
|
async load(request) {
|
|
1844
|
+
this.request = request;
|
|
1845
|
+
this.state = getRequestState(this.request);
|
|
1846
|
+
let content;
|
|
1847
|
+
try {
|
|
1848
|
+
content = (await this.request).content;
|
|
1849
|
+
} catch {
|
|
1850
|
+
return null;
|
|
1851
|
+
}
|
|
1852
|
+
this.applyDocument(content);
|
|
1853
|
+
return content;
|
|
1854
|
+
}
|
|
1855
|
+
/**
|
|
1856
|
+
* Re-applies an already-loaded page from a newer request for the same page
|
|
1857
|
+
* (a reload, or a route-driven navigation back to it). The newer document is
|
|
1858
|
+
* authoritative: its links and page hints replace the ones recorded from
|
|
1859
|
+
* the earlier load, and the collection total is updated from it. The page
|
|
1860
|
+
* keeps its current request until the newer one resolves, so a page on
|
|
1861
|
+
* screen does not flash a loading state; a rejected request leaves the
|
|
1862
|
+
* page untouched.
|
|
1863
|
+
*
|
|
1864
|
+
* @internal
|
|
1865
|
+
*/
|
|
1866
|
+
async update(request) {
|
|
1867
|
+
const state = getRequestState(request);
|
|
1868
|
+
let content;
|
|
1784
1869
|
try {
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1870
|
+
content = (await request).content;
|
|
1871
|
+
} catch {
|
|
1872
|
+
return null;
|
|
1873
|
+
}
|
|
1874
|
+
this.request = request;
|
|
1875
|
+
this.state = state;
|
|
1876
|
+
this.applyDocument(content);
|
|
1877
|
+
return content;
|
|
1878
|
+
}
|
|
1879
|
+
/**
|
|
1880
|
+
* Records a loaded document's links and page number, and links this page
|
|
1881
|
+
* into the shared page graph.
|
|
1882
|
+
*
|
|
1883
|
+
* The document is authoritative for what it states: a link it names
|
|
1884
|
+
* explicitly (including an explicit `null`) overwrites whatever a neighbor
|
|
1885
|
+
* or an earlier load of this page recorded, and a link it omits is kept.
|
|
1886
|
+
* `next`/`prev` name the adjacent pages; `first`/`last` name the ends of
|
|
1887
|
+
* the collection, beyond which nothing may remain linked.
|
|
1888
|
+
*
|
|
1889
|
+
* For a numbered collection the document must also agree with the page
|
|
1890
|
+
* numbers: `next` is the page after this one, `prev` the page before, a
|
|
1891
|
+
* page without `prev` is page 1, a page without `next` is the last page,
|
|
1892
|
+
* `first` is page 1 and `last` is page `totalPages`. A document that
|
|
1893
|
+
* contradicts this is a server (or collection-mixing) bug and is asserted
|
|
1894
|
+
* in development, before anything is recorded from it. A cursor collection
|
|
1895
|
+
* has no numbers, so there its links are the only authority.
|
|
1896
|
+
*
|
|
1897
|
+
* @internal
|
|
1898
|
+
*/
|
|
1899
|
+
applyDocument(content) {
|
|
1900
|
+
const links = content?.links ?? {};
|
|
1901
|
+
const self = getHref(content?.links?.self);
|
|
1902
|
+
const first = getHref(content?.links?.first);
|
|
1903
|
+
const last = getHref(content?.links?.last);
|
|
1904
|
+
const next = getHref(content?.links?.next);
|
|
1905
|
+
const prev = getHref(content?.links?.prev);
|
|
1906
|
+
((test) => {
|
|
1907
|
+
if (!test) throw new Error("Expected the page to have a self link");
|
|
1908
|
+
})(self);
|
|
1909
|
+
const { currentPage, totalPages } = this.manager.readPageHints(content);
|
|
1910
|
+
const firstPage = first ? this.manager.getPageCache(first) : null;
|
|
1911
|
+
const lastPage = last ? this.manager.getPageCache(last) : null;
|
|
1912
|
+
const prevPage = prev ? this.manager.getPageCache(prev) : null;
|
|
1913
|
+
const nextPage = next ? this.manager.getPageCache(next) : null;
|
|
1914
|
+
if (this.manager.isNumbered) {
|
|
1915
|
+
const ownNumber = (page) => page === this ? currentPage : page.pageNumber;
|
|
1793
1916
|
((test) => {
|
|
1794
|
-
if (!test) throw new Error(
|
|
1795
|
-
})(
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1917
|
+
if (!test) throw new Error(`Page ${self} is page ${currentPage} but the collection has ${totalPages} pages: it lies beyond the collection total`);
|
|
1918
|
+
})(!currentPage || !totalPages || currentPage <= totalPages);
|
|
1919
|
+
((test) => {
|
|
1920
|
+
if (!test) throw new Error(`Page ${self} is page ${currentPage} and has no prev link but is not the first page`);
|
|
1921
|
+
})(!("prev" in links && !prev && currentPage > 1));
|
|
1922
|
+
((test) => {
|
|
1923
|
+
if (!test) throw new Error(`Page ${self} is page ${currentPage} of ${totalPages} and has no next link but is not the last page`);
|
|
1924
|
+
})(!("next" in links && !next && currentPage > 0 && totalPages > 0 && currentPage < totalPages));
|
|
1925
|
+
((test) => {
|
|
1926
|
+
if (!test) throw new Error(`Page ${self} is page ${currentPage} but its next link names page ${nextPage ? ownNumber(nextPage) : 0}, expected page ${currentPage + 1}`);
|
|
1927
|
+
})(!nextPage || !currentPage || !ownNumber(nextPage) || ownNumber(nextPage) === currentPage + 1);
|
|
1928
|
+
((test) => {
|
|
1929
|
+
if (!test) throw new Error(`Page ${self} is page ${currentPage} but its prev link names page ${prevPage ? ownNumber(prevPage) : 0}, expected page ${currentPage - 1}`);
|
|
1930
|
+
})(!prevPage || !currentPage || !ownNumber(prevPage) || ownNumber(prevPage) === currentPage - 1);
|
|
1931
|
+
((test) => {
|
|
1932
|
+
if (!test) throw new Error(`Page ${self} has a first link that names page ${firstPage ? ownNumber(firstPage) : 0}, expected page 1`);
|
|
1933
|
+
})(!firstPage || !ownNumber(firstPage) || ownNumber(firstPage) === 1);
|
|
1934
|
+
((test) => {
|
|
1935
|
+
if (!test) throw new Error(`Page ${self} has a last link that names page ${lastPage ? ownNumber(lastPage) : 0}, expected the last page ${totalPages}`);
|
|
1936
|
+
})(!lastPage || !totalPages || !ownNumber(lastPage) || ownNumber(lastPage) === totalPages);
|
|
1937
|
+
((test) => {
|
|
1938
|
+
if (!test) throw new Error(`Page ${self} has a first link to ${first} but that first page has a page linked before it`);
|
|
1939
|
+
})(!firstPage?.before);
|
|
1940
|
+
}
|
|
1941
|
+
if (currentPage) this.pageNumber = currentPage;
|
|
1942
|
+
this.manager.totalPages = totalPages;
|
|
1943
|
+
const stated = {};
|
|
1944
|
+
if ("first" in links) stated.first = first;
|
|
1945
|
+
if ("last" in links) stated.last = last;
|
|
1946
|
+
if ("next" in links) stated.next = next;
|
|
1947
|
+
if ("prev" in links) stated.prev = prev;
|
|
1948
|
+
this.updateLinks(stated);
|
|
1949
|
+
if ("next" in links && !next) {
|
|
1950
|
+
const after = this.after;
|
|
1951
|
+
this.detachAfter();
|
|
1952
|
+
if (after?.prevLink === self) after.updateLinks({ prev: null });
|
|
1953
|
+
}
|
|
1954
|
+
if ("prev" in links && !prev) {
|
|
1955
|
+
const before = this.before;
|
|
1956
|
+
this.detachBefore();
|
|
1957
|
+
if (before?.nextLink === self) before.updateLinks({ next: null });
|
|
1958
|
+
}
|
|
1959
|
+
if (lastPage) {
|
|
1960
|
+
lastPage.detachAfter();
|
|
1961
|
+
lastPage.updateLinks({ next: null });
|
|
1962
|
+
}
|
|
1963
|
+
if (firstPage) {
|
|
1964
|
+
firstPage.detachBefore();
|
|
1965
|
+
firstPage.updateLinks({ prev: null });
|
|
1966
|
+
}
|
|
1967
|
+
if (firstPage) {
|
|
1968
|
+
firstPage.setPageNumber(1);
|
|
1969
|
+
if (firstPage !== this && !firstPage.after) this.linkFirst(firstPage);
|
|
1970
|
+
}
|
|
1971
|
+
if (lastPage) {
|
|
1972
|
+
lastPage.setPageNumber(this.manager.totalPages);
|
|
1973
|
+
if (lastPage !== this && !lastPage.before) this.linkLast(lastPage);
|
|
1974
|
+
}
|
|
1975
|
+
if (nextPage) {
|
|
1976
|
+
nextPage.setPageNumber(this.pageNumber + 1);
|
|
1977
|
+
nextPage.updateLinks({ prev: self });
|
|
1978
|
+
}
|
|
1979
|
+
if (prevPage) {
|
|
1980
|
+
prevPage.setPageNumber(this.pageNumber - 1);
|
|
1981
|
+
prevPage.updateLinks({ next: self });
|
|
1982
|
+
}
|
|
1983
|
+
if (nextPage && this.after && this.after !== nextPage && this.after.pageNumber <= nextPage.pageNumber) this.detachAfter();
|
|
1984
|
+
if (prevPage && this.before && this.before !== prevPage && this.before.pageNumber >= prevPage.pageNumber) this.detachBefore();
|
|
1985
|
+
if (this.isLinked) {
|
|
1986
|
+
if (prevPage) prevPage.updateLinkage({ after: this });
|
|
1987
|
+
if (nextPage) nextPage.updateLinkage({ before: this });
|
|
1988
|
+
} else if (prevPage?.isLinked) {
|
|
1989
|
+
this.updateLinkage({ before: prevPage });
|
|
1990
|
+
if (nextPage) nextPage.updateLinkage({ before: this });
|
|
1991
|
+
} else if (nextPage?.isLinked) {
|
|
1992
|
+
this.updateLinkage({ after: nextPage });
|
|
1993
|
+
if (prevPage) prevPage.updateLinkage({ after: this });
|
|
1994
|
+
} else if ((prevPage || nextPage) && (firstPage || lastPage)) this.lookupLinkage(firstPage, lastPage);
|
|
1995
|
+
else if (prevPage || nextPage) this.updateLinkage({
|
|
1996
|
+
before: prevPage,
|
|
1997
|
+
after: nextPage
|
|
1998
|
+
});
|
|
1999
|
+
}
|
|
2000
|
+
/** @internal */
|
|
2001
|
+
detachAfter() {
|
|
2002
|
+
const after = this.after;
|
|
2003
|
+
if (after) {
|
|
2004
|
+
if (after.before === this) after.setBefore(null);
|
|
2005
|
+
this.setAfter(null);
|
|
2006
|
+
}
|
|
1839
2007
|
}
|
|
1840
2008
|
/** @internal */
|
|
2009
|
+
detachBefore() {
|
|
2010
|
+
const before = this.before;
|
|
2011
|
+
if (before) {
|
|
2012
|
+
if (before.after === this) before.setAfter(null);
|
|
2013
|
+
this.setBefore(null);
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2017
|
+
* Links an unlinked `first` page before the earliest page reachable
|
|
2018
|
+
* backwards from this one that must follow it.
|
|
2019
|
+
*
|
|
2020
|
+
* @internal
|
|
2021
|
+
*/
|
|
2022
|
+
linkFirst(firstPage) {
|
|
2023
|
+
let head = this;
|
|
2024
|
+
while (head.before && head.before !== firstPage && (!head.before.pageNumber || head.before.pageNumber > firstPage.pageNumber)) head = head.before;
|
|
2025
|
+
firstPage.updateLinkage({ after: head });
|
|
2026
|
+
}
|
|
2027
|
+
/**
|
|
2028
|
+
* Links an unlinked `last` page after the furthest page reachable forwards
|
|
2029
|
+
* from this one that must precede it.
|
|
2030
|
+
*
|
|
2031
|
+
* @internal
|
|
2032
|
+
*/
|
|
2033
|
+
linkLast(lastPage) {
|
|
2034
|
+
let tail = this;
|
|
2035
|
+
while (tail.after && tail.after !== lastPage && (!tail.after.pageNumber || !lastPage.pageNumber || tail.after.pageNumber < lastPage.pageNumber)) tail = tail.after;
|
|
2036
|
+
lastPage.updateLinkage({ before: tail });
|
|
2037
|
+
}
|
|
2038
|
+
/**
|
|
2039
|
+
* Places this page between `before` and `after` in the graph (a missing side
|
|
2040
|
+
* is taken from the given side's current neighbor, so a single side splices
|
|
2041
|
+
* this page in). Pointers this page or the displaced neighbors held to their
|
|
2042
|
+
* old positions are cleared first, so a page moved within the graph never
|
|
2043
|
+
* leaves a dangling link behind that could close a cycle.
|
|
2044
|
+
*
|
|
2045
|
+
* @internal
|
|
2046
|
+
*/
|
|
1841
2047
|
updateLinkage({ before, after }) {
|
|
1842
2048
|
((test) => {
|
|
1843
2049
|
if (!test) throw new Error("Expected at least one of before or after page states to link to this page");
|
|
@@ -1845,10 +2051,16 @@ var PageCache = class {
|
|
|
1845
2051
|
const leftSide = before ?? after?.before;
|
|
1846
2052
|
const rightSide = after ?? before?.after;
|
|
1847
2053
|
if (leftSide && leftSide !== this) {
|
|
2054
|
+
if (this.before !== leftSide) this.detachBefore();
|
|
2055
|
+
const displaced = leftSide.after;
|
|
2056
|
+
if (displaced && displaced !== this && displaced !== rightSide && displaced.before === leftSide) displaced.setBefore(null);
|
|
1848
2057
|
leftSide.setAfter(this);
|
|
1849
2058
|
this.setBefore(leftSide);
|
|
1850
2059
|
}
|
|
1851
2060
|
if (rightSide && rightSide !== this) {
|
|
2061
|
+
if (this.after !== rightSide) this.detachAfter();
|
|
2062
|
+
const displaced = rightSide.before;
|
|
2063
|
+
if (displaced && displaced !== this && displaced !== leftSide && displaced.after === rightSide) displaced.setAfter(null);
|
|
1852
2064
|
rightSide.setBefore(this);
|
|
1853
2065
|
this.setAfter(rightSide);
|
|
1854
2066
|
}
|
|
@@ -1888,16 +2100,18 @@ var PageCache = class {
|
|
|
1888
2100
|
})(page !== this);
|
|
1889
2101
|
this.after = page;
|
|
1890
2102
|
}
|
|
1891
|
-
/**
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
if (
|
|
1900
|
-
if (
|
|
2103
|
+
/**
|
|
2104
|
+
* Records the given links. Only the keys present are applied, so a caller
|
|
2105
|
+
* states exactly what it knows: an explicit `null` clears a link, an
|
|
2106
|
+
* omitted key leaves the recorded link alone.
|
|
2107
|
+
*
|
|
2108
|
+
* @internal
|
|
2109
|
+
*/
|
|
2110
|
+
updateLinks = (links) => {
|
|
2111
|
+
if ("prev" in links) this.prevLink = links.prev ?? null;
|
|
2112
|
+
if ("next" in links) this.nextLink = links.next ?? null;
|
|
2113
|
+
if ("first" in links) this.firstLink = links.first ?? null;
|
|
2114
|
+
if ("last" in links) this.lastLink = links.last ?? null;
|
|
1901
2115
|
};
|
|
1902
2116
|
/** @internal */
|
|
1903
2117
|
setPageNumber = (pageNumber) => {
|
|
@@ -1923,6 +2137,8 @@ const PaginationCacheMap = /* @__PURE__ */ new Map();
|
|
|
1923
2137
|
* collection must provide the same function reference — define it once at module
|
|
1924
2138
|
* scope and import it everywhere.
|
|
1925
2139
|
*
|
|
2140
|
+
* @summary Experimental: a function you pass to `<Paginate />` that reads `currentPage` and `totalPages` from a
|
|
2141
|
+
* loaded document when they are not in the default `meta` locations.
|
|
1926
2142
|
* @since 5.9.0
|
|
1927
2143
|
* @public
|
|
1928
2144
|
*/
|
|
@@ -1931,6 +2147,8 @@ const PaginationCacheMap = /* @__PURE__ */ new Map();
|
|
|
1931
2147
|
* document `meta`, matching the behavior used before `pageHints` was configurable.
|
|
1932
2148
|
* Used whenever the consumer does not provide a `pageHints` function.
|
|
1933
2149
|
*
|
|
2150
|
+
* @summary Experimental: the fallback page-hints function, reading `meta.page` or `meta.currentPage` and
|
|
2151
|
+
* `meta.totalPages` from a document, with `0` meaning unknown.
|
|
1934
2152
|
* @since 5.9.0
|
|
1935
2153
|
* @public
|
|
1936
2154
|
*/
|
|
@@ -1950,6 +2168,8 @@ const defaultPageHints = (document) => {
|
|
|
1950
2168
|
* interact with — the cache itself is plumbing shared between the pagination
|
|
1951
2169
|
* classes.
|
|
1952
2170
|
*
|
|
2171
|
+
* @summary Experimental: the shared, app-wide store of loaded pages, page order, and `totalPages` for one paginated
|
|
2172
|
+
* collection, keyed by its `first` or `self` link.
|
|
1953
2173
|
* @since 5.9.0
|
|
1954
2174
|
* @public
|
|
1955
2175
|
* @hideconstructor
|
|
@@ -2044,17 +2264,28 @@ var PaginationCache = class {
|
|
|
2044
2264
|
}
|
|
2045
2265
|
return page;
|
|
2046
2266
|
}
|
|
2047
|
-
/**
|
|
2048
|
-
|
|
2267
|
+
/**
|
|
2268
|
+
* Loads the page at `url` with `request` when it is not loaded (or its load
|
|
2269
|
+
* failed), or re-applies `request`'s document when it is a newer request
|
|
2270
|
+
* for an already-loaded page (a reload, or navigating back to it: the newer
|
|
2271
|
+
* document is authoritative for the page's links and the collection total,
|
|
2272
|
+
* which may have changed since the first load).
|
|
2273
|
+
*
|
|
2274
|
+
* Resolves to the page once that has settled. A rejected request settles
|
|
2275
|
+
* too — it is surfaced through the page's state, not thrown. The promise
|
|
2276
|
+
* rejects only when the document contradicts the collection (see
|
|
2277
|
+
* {@link PageCache.applyDocument}), so the caller that triggered the load
|
|
2278
|
+
* is the one that hears about it.
|
|
2279
|
+
*
|
|
2280
|
+
* @internal
|
|
2281
|
+
*/
|
|
2282
|
+
async loadPage(url, request) {
|
|
2049
2283
|
const page = this.getPageCache(url);
|
|
2050
2284
|
if ((!page.isLoaded || page.isError) && request) {
|
|
2051
|
-
(
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
page.
|
|
2055
|
-
this.updateFirstPage(page);
|
|
2056
|
-
if (document) this.totalPages = this.getTotalPages(document);
|
|
2057
|
-
});
|
|
2285
|
+
await page.load(request);
|
|
2286
|
+
this.updateFirstPage(page);
|
|
2287
|
+
} else if (request && page.isSuccess && request !== page.request) {
|
|
2288
|
+
if (await page.update(request)) this.updateFirstPage(page);
|
|
2058
2289
|
}
|
|
2059
2290
|
return page;
|
|
2060
2291
|
}
|
|
@@ -2064,10 +2295,6 @@ var PaginationCache = class {
|
|
|
2064
2295
|
while (maybeFirstPage.before) maybeFirstPage = maybeFirstPage.before;
|
|
2065
2296
|
if (!this.firstPage || this.firstPage.pageNumber > maybeFirstPage.pageNumber) this.firstPage = maybeFirstPage;
|
|
2066
2297
|
}
|
|
2067
|
-
/** @internal */
|
|
2068
|
-
getTotalPages(document) {
|
|
2069
|
-
return this.readPageHints(document).totalPages;
|
|
2070
|
-
}
|
|
2071
2298
|
/**
|
|
2072
2299
|
* Every page known to the shared graph, in order — loaded pages and pages
|
|
2073
2300
|
* known only from links — across all components sharing the collection.
|
|
@@ -2083,14 +2310,13 @@ var PaginationCache = class {
|
|
|
2083
2310
|
* ```
|
|
2084
2311
|
*/
|
|
2085
2312
|
get pages() {
|
|
2086
|
-
const
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
} };
|
|
2313
|
+
const pages = [];
|
|
2314
|
+
let page = this.firstPage;
|
|
2315
|
+
while (page) {
|
|
2316
|
+
pages.push(page);
|
|
2317
|
+
page = page.after;
|
|
2318
|
+
}
|
|
2319
|
+
return pages;
|
|
2094
2320
|
}
|
|
2095
2321
|
/**
|
|
2096
2322
|
* The items of every loaded page in the shared graph, flattened into one
|
|
@@ -2104,10 +2330,9 @@ var PaginationCache = class {
|
|
|
2104
2330
|
decorateMethodV2(this.prototype, "pages", [memoized]);
|
|
2105
2331
|
}
|
|
2106
2332
|
get data() {
|
|
2107
|
-
const
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
} };
|
|
2333
|
+
const items = [];
|
|
2334
|
+
for (const page of this.pages) if (page.data) items.push(...page.data);
|
|
2335
|
+
return items;
|
|
2111
2336
|
}
|
|
2112
2337
|
static {
|
|
2113
2338
|
decorateMethodV2(this.prototype, "data", [memoized]);
|
|
@@ -2118,6 +2343,8 @@ var PaginationCache = class {
|
|
|
2118
2343
|
* `first` or `self` link). Returns the same instance for the same key for the
|
|
2119
2344
|
* lifetime of the module.
|
|
2120
2345
|
*
|
|
2346
|
+
* @summary Experimental: returns the shared pagination cache for a collection's `first` or `self` link, creating it
|
|
2347
|
+
* on first use.
|
|
2121
2348
|
* @since 5.9.0
|
|
2122
2349
|
* @public
|
|
2123
2350
|
*/
|
|
@@ -2134,6 +2361,7 @@ function getPaginationCache(key) {
|
|
|
2134
2361
|
* Primarily intended for test isolation, since the cache is keyed by url and
|
|
2135
2362
|
* otherwise persists for the lifetime of the module.
|
|
2136
2363
|
*
|
|
2364
|
+
* @summary Experimental: discards every shared pagination cache, mainly so tests start from a clean state.
|
|
2137
2365
|
* @since 5.9.0
|
|
2138
2366
|
* @public
|
|
2139
2367
|
*/
|
|
@@ -2150,25 +2378,40 @@ function clearPaginationCache() {
|
|
|
2150
2378
|
*
|
|
2151
2379
|
* - `'paged'` — single-page view, see {@link PagedPaginationState}.
|
|
2152
2380
|
* - `'infinite'` — accumulated view, see {@link InfinitePaginationState}.
|
|
2381
|
+
*
|
|
2382
|
+
* @summary Experimental: the `@mode` value of `<Paginate />`, either `'paged'` for a single-page view or
|
|
2383
|
+
* `'infinite'` for an accumulated view, which selects the yielded pagination API.
|
|
2153
2384
|
*/
|
|
2154
2385
|
/**
|
|
2155
2386
|
* The part of a {@link PaginationState} available to both navigation surfaces.
|
|
2387
|
+
*
|
|
2388
|
+
* @summary Experimental: the pagination state members available in both paged and infinite mode, namely
|
|
2389
|
+
* `totalPages` and `adoptPage`.
|
|
2156
2390
|
*/
|
|
2157
2391
|
/**
|
|
2158
2392
|
* The paged (single-page view) surface of a {@link PaginationState}: render
|
|
2159
2393
|
* {@link PaginationState.activePageRequest | activePageRequest}, navigate with
|
|
2160
2394
|
* {@link PaginationState.loadPage | loadPage}. This is what the `<Paginate />`
|
|
2161
2395
|
* component yields in `'paged'` mode (the default).
|
|
2396
|
+
*
|
|
2397
|
+
* @summary Experimental: the pagination state `<Paginate />` yields in paged mode, exposing the active page, its
|
|
2398
|
+
* request, and `loadPage` for navigating to a page by URL.
|
|
2162
2399
|
*/
|
|
2163
2400
|
/**
|
|
2164
2401
|
* The infinite (accumulated view) surface of a {@link PaginationState}: render
|
|
2165
2402
|
* {@link PaginationState.data | data}, grow it with
|
|
2166
2403
|
* {@link PaginationState.loadNext | loadNext}/{@link PaginationState.loadPrev | loadPrev}.
|
|
2167
2404
|
* This is what the `<Paginate />` component yields in `'infinite'` mode.
|
|
2405
|
+
*
|
|
2406
|
+
* @summary Experimental: the pagination state `<Paginate />` yields in infinite mode, exposing the accumulated
|
|
2407
|
+
* items and pages plus `loadNext` and `loadPrev` to extend them.
|
|
2168
2408
|
*/
|
|
2169
2409
|
/**
|
|
2170
2410
|
* Resolves a {@link PaginateMode} to the surface it exposes, so a component
|
|
2171
2411
|
* generic over the mode can yield only that surface.
|
|
2412
|
+
*
|
|
2413
|
+
* @summary Experimental: resolves a pagination mode to its state type, the infinite-mode state for `'infinite'`
|
|
2414
|
+
* and the paged-mode state otherwise.
|
|
2172
2415
|
*/
|
|
2173
2416
|
/**
|
|
2174
2417
|
* The per-component, local pagination state. It houses the state that is unique
|
|
@@ -2192,6 +2435,8 @@ function clearPaginationCache() {
|
|
|
2192
2435
|
* Instances are created via {@link getPaginationState} (or by the `<Paginate />`
|
|
2193
2436
|
* component on your behalf), never constructed directly.
|
|
2194
2437
|
*
|
|
2438
|
+
* @summary Experimental: one component's pagination state over a shared collection, tracking the active page and
|
|
2439
|
+
* the loaded run and providing paged and infinite navigation.
|
|
2195
2440
|
* @since 5.9.0
|
|
2196
2441
|
* @public
|
|
2197
2442
|
* @hideconstructor
|
|
@@ -2222,10 +2467,23 @@ var PaginationState = class {
|
|
|
2222
2467
|
* them backward/forward. Both seed to {@link initialPage}; a purely paged
|
|
2223
2468
|
* consumer never extends them, so they stay put and are effectively unused.
|
|
2224
2469
|
*
|
|
2470
|
+
* Only ever written through {@link extendRun} and {@link restartRun}, which
|
|
2471
|
+
* keep {@link runMembers} in step.
|
|
2472
|
+
*
|
|
2225
2473
|
* @internal
|
|
2226
2474
|
*/
|
|
2227
2475
|
/** @internal */
|
|
2228
2476
|
/**
|
|
2477
|
+
* Every page this component has loaded into its run — what the frontier
|
|
2478
|
+
* spanned each time it moved. Bounds the walk in {@link pages}: the shared
|
|
2479
|
+
* graph may relink a page in the run to one that another component sharing
|
|
2480
|
+
* the collection loaded, and that page is not part of this run until it is
|
|
2481
|
+
* loaded through here. Untracked bookkeeping — it only changes together with
|
|
2482
|
+
* the frontier signals, which carry the notification.
|
|
2483
|
+
*
|
|
2484
|
+
* @internal
|
|
2485
|
+
*/
|
|
2486
|
+
/**
|
|
2229
2487
|
* The request of the latest {@link adoptPage} call — only that call may
|
|
2230
2488
|
* commit. Later calls (or a {@link loadPage} navigation) claim the slot,
|
|
2231
2489
|
* superseding in-flight adoptions so the newest navigation always wins.
|
|
@@ -2238,6 +2496,7 @@ var PaginationState = class {
|
|
|
2238
2496
|
this.request = request;
|
|
2239
2497
|
this.pageHints = pageHints;
|
|
2240
2498
|
this._adoptTarget = null;
|
|
2499
|
+
this.runMembers = /* @__PURE__ */ new Set();
|
|
2241
2500
|
this.setup();
|
|
2242
2501
|
}
|
|
2243
2502
|
/**
|
|
@@ -2286,21 +2545,44 @@ var PaginationState = class {
|
|
|
2286
2545
|
* same collection to different extents each see only what they have scrolled
|
|
2287
2546
|
* through. For every page known to the whole collection, see
|
|
2288
2547
|
* {@link PaginationCache.pages}.
|
|
2548
|
+
*
|
|
2549
|
+
* The run is walked through the shared graph, so it ends early when a page
|
|
2550
|
+
* that was in it no longer follows the page before it — a reload that showed
|
|
2551
|
+
* the collection now ends sooner, or that its next cursor moved. It also ends
|
|
2552
|
+
* before a page this component never loaded: a reload may relink a page in
|
|
2553
|
+
* the run to one another component sharing the collection scrolled to, and
|
|
2554
|
+
* that page joins this run only through {@link loadNext}.
|
|
2289
2555
|
*/
|
|
2290
2556
|
static {
|
|
2291
2557
|
decorateMethodV2(this.prototype, "totalPages", [memoized]);
|
|
2292
2558
|
}
|
|
2293
2559
|
get pages() {
|
|
2294
|
-
const
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
}
|
|
2560
|
+
const pages = [];
|
|
2561
|
+
const end = this.frontierEnd;
|
|
2562
|
+
let page = this.frontierStart;
|
|
2563
|
+
while (page) {
|
|
2564
|
+
pages.push(page);
|
|
2565
|
+
if (page === end) break;
|
|
2566
|
+
const next = page.after;
|
|
2567
|
+
if (!next?.isSuccess || !this.runMembers.has(next)) break;
|
|
2568
|
+
page = next;
|
|
2569
|
+
}
|
|
2570
|
+
return pages;
|
|
2571
|
+
}
|
|
2572
|
+
/**
|
|
2573
|
+
* The last page of the run {@link pages} walks — the forward frontier, or
|
|
2574
|
+
* the page before the first one that no longer follows in the graph or that
|
|
2575
|
+
* this component never loaded.
|
|
2576
|
+
*
|
|
2577
|
+
* @internal
|
|
2578
|
+
*/
|
|
2579
|
+
static {
|
|
2580
|
+
decorateMethodV2(this.prototype, "pages", [memoized]);
|
|
2581
|
+
}
|
|
2582
|
+
get runEnd() {
|
|
2583
|
+
let end = null;
|
|
2584
|
+
for (const page of this.pages) end = page;
|
|
2585
|
+
return end;
|
|
2304
2586
|
}
|
|
2305
2587
|
/**
|
|
2306
2588
|
* The accumulated items across the loaded run, from the backward frontier to
|
|
@@ -2325,13 +2607,12 @@ var PaginationState = class {
|
|
|
2325
2607
|
* ```
|
|
2326
2608
|
*/
|
|
2327
2609
|
static {
|
|
2328
|
-
decorateMethodV2(this.prototype, "
|
|
2610
|
+
decorateMethodV2(this.prototype, "runEnd", [memoized]);
|
|
2329
2611
|
}
|
|
2330
2612
|
get data() {
|
|
2331
|
-
const
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
} };
|
|
2613
|
+
const items = [];
|
|
2614
|
+
for (const page of this.pages) if (page.data) items.push(...page.data);
|
|
2615
|
+
return items;
|
|
2335
2616
|
}
|
|
2336
2617
|
/**
|
|
2337
2618
|
* Whether a page exists after the forward frontier — i.e. there is more to load
|
|
@@ -2347,7 +2628,7 @@ var PaginationState = class {
|
|
|
2347
2628
|
decorateMethodV2(this.prototype, "data", [memoized]);
|
|
2348
2629
|
}
|
|
2349
2630
|
get hasNext() {
|
|
2350
|
-
return Boolean(this.
|
|
2631
|
+
return Boolean(this.runEnd?.nextLink);
|
|
2351
2632
|
}
|
|
2352
2633
|
/**
|
|
2353
2634
|
* Whether a page exists before the backward frontier.
|
|
@@ -2362,7 +2643,10 @@ var PaginationState = class {
|
|
|
2362
2643
|
* The request for the page just after the forward frontier, for the infinite
|
|
2363
2644
|
* surface. `null` until {@link loadNext} fires it (so a `<Request>` wrapping it
|
|
2364
2645
|
* renders its idle block), the in-flight `Future` while that page loads, then
|
|
2365
|
-
* `null` again once the frontier advances onto it. Also `null` at end-of-list
|
|
2646
|
+
* `null` again once the frontier advances onto it. Also `null` at end-of-list,
|
|
2647
|
+
* and while the page sits loaded in the shared cache (another component
|
|
2648
|
+
* scrolled to it) but outside this run — {@link loadNext} then joins it
|
|
2649
|
+
* without a request of its own.
|
|
2366
2650
|
*
|
|
2367
2651
|
* ```gts
|
|
2368
2652
|
* {{#if pages.hasNext}}
|
|
@@ -2377,9 +2661,9 @@ var PaginationState = class {
|
|
|
2377
2661
|
decorateMethodV2(this.prototype, "hasPrevious", [memoized]);
|
|
2378
2662
|
}
|
|
2379
2663
|
get nextRequest() {
|
|
2380
|
-
const url = this.
|
|
2664
|
+
const url = this.runEnd?.nextLink;
|
|
2381
2665
|
if (!url) return null;
|
|
2382
|
-
return this.
|
|
2666
|
+
return this.pendingRequest(url);
|
|
2383
2667
|
}
|
|
2384
2668
|
/**
|
|
2385
2669
|
* The request for the page just before the backward frontier. Mirror of
|
|
@@ -2391,12 +2675,24 @@ var PaginationState = class {
|
|
|
2391
2675
|
get previousRequest() {
|
|
2392
2676
|
const url = this.frontierStart?.prevLink;
|
|
2393
2677
|
if (!url) return null;
|
|
2394
|
-
return this.
|
|
2678
|
+
return this.pendingRequest(url);
|
|
2395
2679
|
}
|
|
2396
|
-
/**
|
|
2680
|
+
/**
|
|
2681
|
+
* The request of the page at `url` unless it already succeeded, in which
|
|
2682
|
+
* case there is nothing pending: the page either sits in this run, or joins
|
|
2683
|
+
* it on the next {@link loadNext}/{@link loadPrev} without a new request.
|
|
2684
|
+
*
|
|
2685
|
+
* @internal
|
|
2686
|
+
*/
|
|
2397
2687
|
static {
|
|
2398
2688
|
decorateMethodV2(this.prototype, "previousRequest", [memoized]);
|
|
2399
2689
|
}
|
|
2690
|
+
pendingRequest(url) {
|
|
2691
|
+
const page = this.paginationCache?.getPageCache(url);
|
|
2692
|
+
if (!page || page.isSuccess) return null;
|
|
2693
|
+
return page.request ?? null;
|
|
2694
|
+
}
|
|
2695
|
+
/** @internal */
|
|
2400
2696
|
async setup() {
|
|
2401
2697
|
let document;
|
|
2402
2698
|
try {
|
|
@@ -2413,9 +2709,31 @@ var PaginationState = class {
|
|
|
2413
2709
|
const cache = getPaginationCache(firstLink ?? selfLink ?? "");
|
|
2414
2710
|
cache.installPageHints(this.pageHints);
|
|
2415
2711
|
this.paginationCache = cache;
|
|
2416
|
-
|
|
2417
|
-
this.activePage = this.initialPage =
|
|
2418
|
-
this.
|
|
2712
|
+
const page = cache.getPageCache(selfLink);
|
|
2713
|
+
this.activePage = this.initialPage = page;
|
|
2714
|
+
this.restartRun(page);
|
|
2715
|
+
await cache.loadPage(selfLink, this.request);
|
|
2716
|
+
}
|
|
2717
|
+
/**
|
|
2718
|
+
* Moves the frontier onto a page adjacent to the run, recording it as a
|
|
2719
|
+
* member.
|
|
2720
|
+
*
|
|
2721
|
+
* @internal
|
|
2722
|
+
*/
|
|
2723
|
+
extendRun(dir, page) {
|
|
2724
|
+
this.runMembers.add(page);
|
|
2725
|
+
if (dir === "next") this.frontierEnd = page;
|
|
2726
|
+
else this.frontierStart = page;
|
|
2727
|
+
}
|
|
2728
|
+
/**
|
|
2729
|
+
* Restarts the run at a single page, forgetting every earlier member.
|
|
2730
|
+
*
|
|
2731
|
+
* @internal
|
|
2732
|
+
*/
|
|
2733
|
+
restartRun(page) {
|
|
2734
|
+
this.runMembers.clear();
|
|
2735
|
+
this.runMembers.add(page);
|
|
2736
|
+
this.frontierStart = this.frontierEnd = page;
|
|
2419
2737
|
}
|
|
2420
2738
|
/**
|
|
2421
2739
|
* Commits a resolved, membership-proven page into this state, making it the
|
|
@@ -2432,9 +2750,9 @@ var PaginationState = class {
|
|
|
2432
2750
|
_activate(page, url) {
|
|
2433
2751
|
this.activePage = page;
|
|
2434
2752
|
for (const existing of this.pages) if (existing === page) return;
|
|
2435
|
-
if (this.
|
|
2436
|
-
else if (this.frontierStart?.prevLink === url) this.
|
|
2437
|
-
else this.
|
|
2753
|
+
if (this.runEnd?.nextLink === url) this.extendRun("next", page);
|
|
2754
|
+
else if (this.frontierStart?.prevLink === url) this.extendRun("prev", page);
|
|
2755
|
+
else this.restartRun(page);
|
|
2438
2756
|
}
|
|
2439
2757
|
/**
|
|
2440
2758
|
* Adopts an externally-issued request into this pagination, making its page
|
|
@@ -2465,6 +2783,10 @@ var PaginationState = class {
|
|
|
2465
2783
|
* - this state has not finished setting up its own collection yet
|
|
2466
2784
|
* - the call was superseded by a newer navigation
|
|
2467
2785
|
*
|
|
2786
|
+
* In development, a document that contradicts the collection's page
|
|
2787
|
+
* numbers (a `next` that skips a page, a `first` that is not page 1, ...)
|
|
2788
|
+
* rejects instead of resolving: the graph is not updated from it.
|
|
2789
|
+
*
|
|
2468
2790
|
* ```ts
|
|
2469
2791
|
* const pages = getPaginationState(initialRequest);
|
|
2470
2792
|
* // later, e.g. in a route model hook reacting to a ?page= param:
|
|
@@ -2494,12 +2816,7 @@ var PaginationState = class {
|
|
|
2494
2816
|
if (!test) throw new Error("Expected the adopted document to have a self link");
|
|
2495
2817
|
})(selfLink);
|
|
2496
2818
|
if (!selfLink || (firstLink ?? selfLink) !== cache.key) return null;
|
|
2497
|
-
const page = cache.loadPage(selfLink, request);
|
|
2498
|
-
try {
|
|
2499
|
-
await page.request;
|
|
2500
|
-
} catch {
|
|
2501
|
-
return null;
|
|
2502
|
-
}
|
|
2819
|
+
const page = await cache.loadPage(selfLink, request);
|
|
2503
2820
|
if (this._adoptTarget !== request) return null;
|
|
2504
2821
|
this._activate(page, selfLink);
|
|
2505
2822
|
return page.value;
|
|
@@ -2546,7 +2863,7 @@ var PaginationState = class {
|
|
|
2546
2863
|
((test) => {
|
|
2547
2864
|
if (!test) throw new Error("Expected the pagination cache to be set up before loading a page");
|
|
2548
2865
|
})(cache);
|
|
2549
|
-
const frontier = dir === "next" ? this.
|
|
2866
|
+
const frontier = dir === "next" ? this.runEnd : this.frontierStart;
|
|
2550
2867
|
const url = dir === "next" ? frontier?.nextLink : frontier?.prevLink;
|
|
2551
2868
|
if (!url) return null;
|
|
2552
2869
|
const page = cache.getPageCache(url);
|
|
@@ -2559,15 +2876,12 @@ var PaginationState = class {
|
|
|
2559
2876
|
method: "GET",
|
|
2560
2877
|
url
|
|
2561
2878
|
});
|
|
2562
|
-
cache.loadPage(url, request);
|
|
2563
|
-
}
|
|
2564
|
-
try {
|
|
2879
|
+
await cache.loadPage(url, request);
|
|
2880
|
+
} else try {
|
|
2565
2881
|
await page.request;
|
|
2566
|
-
} catch {
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
if (dir === "next") this.frontierEnd = page;
|
|
2570
|
-
else this.frontierStart = page;
|
|
2882
|
+
} catch {}
|
|
2883
|
+
if (!page.isSuccess) return null;
|
|
2884
|
+
this.extendRun(dir, page);
|
|
2571
2885
|
return page.value;
|
|
2572
2886
|
};
|
|
2573
2887
|
/**
|
|
@@ -2586,7 +2900,9 @@ var PaginationState = class {
|
|
|
2586
2900
|
* On failure the page stays active and {@link activePageRequest} resolves to
|
|
2587
2901
|
* it, so a wrapping `<Request>` renders its error block. Calling again (for
|
|
2588
2902
|
* example clicking the page's link a second time) retries: the failed page
|
|
2589
|
-
* is re-requested with a forced reload.
|
|
2903
|
+
* is re-requested with a forced reload. In development, a document that
|
|
2904
|
+
* contradicts the collection's page numbers rejects instead (see
|
|
2905
|
+
* {@link adoptPage}).
|
|
2590
2906
|
*
|
|
2591
2907
|
* ```gts
|
|
2592
2908
|
* <EachLink @pages={{pages}}>
|
|
@@ -2613,12 +2929,8 @@ var PaginationState = class {
|
|
|
2613
2929
|
method: "GET",
|
|
2614
2930
|
url
|
|
2615
2931
|
});
|
|
2616
|
-
cache.loadPage(url, request);
|
|
2617
|
-
|
|
2618
|
-
await page.request;
|
|
2619
|
-
} catch {
|
|
2620
|
-
return null;
|
|
2621
|
-
}
|
|
2932
|
+
await cache.loadPage(url, request);
|
|
2933
|
+
if (!page.isSuccess) return null;
|
|
2622
2934
|
}
|
|
2623
2935
|
return page.value;
|
|
2624
2936
|
};
|
|
@@ -2645,6 +2957,8 @@ const PaginationStateCache = /* @__PURE__ */ new WeakMap();
|
|
|
2645
2957
|
* await pages.loadNext();
|
|
2646
2958
|
* ```
|
|
2647
2959
|
*
|
|
2960
|
+
* @summary Experimental: returns the pagination state for a request, creating it on first call and returning the
|
|
2961
|
+
* same instance for the same request thereafter.
|
|
2648
2962
|
* @since 5.9.0
|
|
2649
2963
|
* @public
|
|
2650
2964
|
*/
|
|
@@ -2678,6 +2992,8 @@ const PaginationLinksCache = /* @__PURE__ */ new WeakMap();
|
|
|
2678
2992
|
* </EachLink>
|
|
2679
2993
|
* ```
|
|
2680
2994
|
*
|
|
2995
|
+
* @summary Experimental: a numbered page link with its page number, whether it is current, its distance from the
|
|
2996
|
+
* active page, and `setActive` to load and show that page.
|
|
2681
2997
|
* @since 5.9.0
|
|
2682
2998
|
* @public
|
|
2683
2999
|
* @hideconstructor
|
|
@@ -2727,6 +3043,8 @@ var RealPaginationLink = class {
|
|
|
2727
3043
|
* </EachLink>
|
|
2728
3044
|
* ```
|
|
2729
3045
|
*
|
|
3046
|
+
* @summary Experimental: a non-navigable gap marker in numbered pagination links, standing in for a range of
|
|
3047
|
+
* not-yet-loaded pages, usually shown as an ellipsis.
|
|
2730
3048
|
* @since 5.9.0
|
|
2731
3049
|
* @public
|
|
2732
3050
|
* @hideconstructor
|
|
@@ -2779,6 +3097,8 @@ var PlaceholderPaginationLink = class {
|
|
|
2779
3097
|
* </EachLink>
|
|
2780
3098
|
* ```
|
|
2781
3099
|
*
|
|
3100
|
+
* @summary Experimental: a `first`, `prev`, `next`, or `last` link relative to the active page, with `setActive`
|
|
3101
|
+
* to load it, and the only kind of link cursor-based pagination has.
|
|
2782
3102
|
* @since 5.9.0
|
|
2783
3103
|
* @public
|
|
2784
3104
|
* @hideconstructor
|
|
@@ -2830,6 +3150,9 @@ var RelationalPaginationLink = class {
|
|
|
2830
3150
|
* }
|
|
2831
3151
|
* }
|
|
2832
3152
|
* ```
|
|
3153
|
+
*
|
|
3154
|
+
* @summary Experimental: an entry in the numbered pagination links list, either a navigable numbered link or a
|
|
3155
|
+
* placeholder for a gap, told apart by `isReal`.
|
|
2833
3156
|
*/
|
|
2834
3157
|
/**
|
|
2835
3158
|
* The reactive set of navigation links derived from a {@link PaginationState}.
|
|
@@ -2859,6 +3182,8 @@ var RelationalPaginationLink = class {
|
|
|
2859
3182
|
* - {@link PlaceholderPaginationLink}
|
|
2860
3183
|
* - {@link RelationalPaginationLink}
|
|
2861
3184
|
*
|
|
3185
|
+
* @summary Experimental: the reactive navigation links for a pagination state, with numbered links and gap
|
|
3186
|
+
* placeholders plus `first`, `prev`, `next`, and `last` links for the active page.
|
|
2862
3187
|
* @since 5.9.0
|
|
2863
3188
|
* @public
|
|
2864
3189
|
* @hideconstructor
|
|
@@ -2970,6 +3295,8 @@ var PaginationLinks = class {
|
|
|
2970
3295
|
* }
|
|
2971
3296
|
* ```
|
|
2972
3297
|
*
|
|
3298
|
+
* @summary Experimental: returns the navigation links for a paged pagination state, creating them on first call and
|
|
3299
|
+
* returning the same instance for the same state.
|
|
2973
3300
|
* @since 5.9.0
|
|
2974
3301
|
* @public
|
|
2975
3302
|
*/
|
|
@@ -2987,29 +3314,46 @@ function getPaginationLinks(state) {
|
|
|
2987
3314
|
/**
|
|
2988
3315
|
* The content features available in both pagination modes: the state and
|
|
2989
3316
|
* controls of the initial request.
|
|
3317
|
+
*
|
|
3318
|
+
* @summary Experimental: the request status flags and controls, like `isRefreshing`, `refresh`, and `reload`,
|
|
3319
|
+
* that `<Paginate />` yields to its content block in both modes.
|
|
2990
3320
|
*/
|
|
2991
3321
|
/**
|
|
2992
3322
|
* The content features yielded in `'paged'` mode: navigation happens by
|
|
2993
3323
|
* loading a specific page.
|
|
3324
|
+
*
|
|
3325
|
+
* @summary Experimental: the request controls `<Paginate />` yields to its content block in paged mode, adding
|
|
3326
|
+
* `loadPage` to navigate to a page by URL.
|
|
2994
3327
|
*/
|
|
2995
3328
|
/**
|
|
2996
3329
|
* The content features yielded in `'infinite'` mode: navigation happens by
|
|
2997
3330
|
* extending the loaded run at either end.
|
|
3331
|
+
*
|
|
3332
|
+
* @summary Experimental: the request controls `<Paginate />` yields to its content block in infinite mode, adding
|
|
3333
|
+
* `loadNext` and `loadPrev` to extend the loaded pages.
|
|
2998
3334
|
*/
|
|
2999
3335
|
/**
|
|
3000
3336
|
* The full set of content features a {@link PaginationSubscription} builds —
|
|
3001
3337
|
* both modes' surfaces. The `<Paginate />` component narrows this to one mode
|
|
3002
3338
|
* via {@link PaginationContentFeaturesFor} before yielding.
|
|
3339
|
+
*
|
|
3340
|
+
* @summary Experimental: the combined paged and infinite content features a pagination subscription builds, before
|
|
3341
|
+
* `<Paginate />` narrows them to one mode.
|
|
3003
3342
|
*/
|
|
3004
3343
|
/**
|
|
3005
3344
|
* Resolves a {@link PaginateMode} to the content features it exposes. Mirror of
|
|
3006
3345
|
* {@link PaginationStateFor}.
|
|
3346
|
+
*
|
|
3347
|
+
* @summary Experimental: resolves a pagination mode to the content features `<Paginate />` yields, the infinite
|
|
3348
|
+
* set for `'infinite'` and the paged set otherwise.
|
|
3007
3349
|
*/
|
|
3008
3350
|
/**
|
|
3009
3351
|
* Lifecycle glue for the `<Paginate />` component. Owns the initial
|
|
3010
3352
|
* {@link RequestSubscription} (loading/error state, autorefresh, disposal) and
|
|
3011
3353
|
* the per-component {@link PaginationState} that it hands to the component.
|
|
3012
3354
|
*
|
|
3355
|
+
* @summary Experimental: the lifecycle core of `<Paginate />`, owning the initial request subscription and the
|
|
3356
|
+
* component's pagination state.
|
|
3013
3357
|
* @since 5.9.0
|
|
3014
3358
|
* @public
|
|
3015
3359
|
* @hideconstructor
|
|
@@ -3271,6 +3615,8 @@ defineSignal(PaginationSubscription.prototype, "_navRequest", null);
|
|
|
3271
3615
|
* subscription[DISPOSE](); // tear down when the owning component unmounts
|
|
3272
3616
|
* ```
|
|
3273
3617
|
*
|
|
3618
|
+
* @summary Experimental: creates the subscription that manages a `<Paginate />` component's initial request
|
|
3619
|
+
* lifecycle and pagination state, for managing that lifecycle yourself.
|
|
3274
3620
|
* @since 5.9.0
|
|
3275
3621
|
* @public
|
|
3276
3622
|
*/
|
|
@@ -3302,6 +3648,8 @@ function _DISPOSE$1() {
|
|
|
3302
3648
|
* `<Paginate />` component, so they stay in sync as pages load and the active
|
|
3303
3649
|
* page changes.
|
|
3304
3650
|
*
|
|
3651
|
+
* @summary Experimental: the framework-agnostic lifecycle core of a pagination links component such as
|
|
3652
|
+
* `<EachLink />`, exposing the navigation links for a paged pagination state.
|
|
3305
3653
|
* @since 5.9.0
|
|
3306
3654
|
* @public
|
|
3307
3655
|
* @hideconstructor
|
|
@@ -3343,6 +3691,8 @@ var PaginationLinksSubscription = class {
|
|
|
3343
3691
|
* subscription[DISPOSE](); // tear down when the owning component unmounts
|
|
3344
3692
|
* ```
|
|
3345
3693
|
*
|
|
3694
|
+
* @summary Experimental: creates the subscription a pagination links component such as `<EachLink />` uses to
|
|
3695
|
+
* derive navigation links from a paged pagination state.
|
|
3346
3696
|
* @since 5.9.0
|
|
3347
3697
|
* @public
|
|
3348
3698
|
*/
|
|
@@ -3364,18 +3714,24 @@ const PromiseCache = /* @__PURE__ */ new WeakMap();
|
|
|
3364
3714
|
* The state of a promise in the "pending"
|
|
3365
3715
|
* state. This is the default initial state.
|
|
3366
3716
|
*
|
|
3717
|
+
* @summary The `getPromiseState` state for a promise that has not yet settled, with `isPending` true and
|
|
3718
|
+
* no value or reason.
|
|
3367
3719
|
*/
|
|
3368
3720
|
/**
|
|
3369
3721
|
* The state of a promise in the "fulfilled" state.
|
|
3370
3722
|
* This is the state of a promise that has resolved
|
|
3371
3723
|
* successfully.
|
|
3372
3724
|
*
|
|
3725
|
+
* @summary The `getPromiseState` state for a promise that resolved, with `isSuccess` true and the
|
|
3726
|
+
* resolved `value`.
|
|
3373
3727
|
*/
|
|
3374
3728
|
/**
|
|
3375
3729
|
* The state of a promise in the "rejected" state.
|
|
3376
3730
|
* This is the state of a promise that has rejected
|
|
3377
3731
|
* with an error.
|
|
3378
3732
|
*
|
|
3733
|
+
* @summary The `getPromiseState` state for a promise that rejected, with `isError` true and the
|
|
3734
|
+
* rejection `reason`.
|
|
3379
3735
|
*/
|
|
3380
3736
|
/**
|
|
3381
3737
|
* The state of a promise. This is the type that is returned
|
|
@@ -3386,6 +3742,8 @@ const PromiseCache = /* @__PURE__ */ new WeakMap();
|
|
|
3386
3742
|
* - {@link ResolvedPromise}
|
|
3387
3743
|
* - {@link RejectedPromise}
|
|
3388
3744
|
*
|
|
3745
|
+
* @summary The reactive pending, fulfilled, or rejected state of a promise, as returned by
|
|
3746
|
+
* `getPromiseState`.
|
|
3389
3747
|
*/
|
|
3390
3748
|
const PromiseStateProto = {};
|
|
3391
3749
|
defineSignal(PromiseStateProto, "reason", null);
|
|
@@ -3451,6 +3809,9 @@ function getPromise(promise) {
|
|
|
3451
3809
|
/**
|
|
3452
3810
|
* Returns a reactive state-machine for the provided promise or awaitable.
|
|
3453
3811
|
*
|
|
3812
|
+
* The [Async as Reactive State](/guides/the-manual/reactivity/derivation) guide shows
|
|
3813
|
+
* how to use it in place of tracked loading and error state.
|
|
3814
|
+
*
|
|
3454
3815
|
* Repeat calls to `getPromiseState` with the same promise will return the same state object
|
|
3455
3816
|
* making is safe and easy to use in templates and JavaScript code to produce reactive
|
|
3456
3817
|
* behaviors around promises.
|
|
@@ -3500,6 +3861,9 @@ function getPromise(promise) {
|
|
|
3500
3861
|
* If looking to use in a template, consider also the `<Await />` component.
|
|
3501
3862
|
*
|
|
3502
3863
|
* See also {@link PromiseState}
|
|
3864
|
+
*
|
|
3865
|
+
* @summary Returns a cached, reactive state object tracking whether a promise is pending, fulfilled, or
|
|
3866
|
+
* rejected, for use in JS or templates.
|
|
3503
3867
|
*/
|
|
3504
3868
|
function getPromiseState(promise) {
|
|
3505
3869
|
((test) => {
|
|
@@ -3516,4 +3880,4 @@ function getPromiseState(promise) {
|
|
|
3516
3880
|
|
|
3517
3881
|
//#endregion
|
|
3518
3882
|
export { ARRAY_SIGNAL as A, createInternalMemo as C, notifyInternalSignal as D, makeInitializer as E, setupSignals as M, waitFor as N, peekInternalSignal as O, willSyncFlushWatchers as P, consumeInternalSignal as S, getOrCreateInternalSignal as T, entangleSignal as _, getPaginationState as a, signal as b, getPaginationCache as c, getRequestState as d, createSignalDescriptor as f, entangleInitiallyStaleSignal as g, defineSignal as h, getPaginationLinks as i, OBJECT_SIGNAL as j, withSignalStore as k, DISPOSE as l, defineNonEnumerableSignal as m, createPaginationLinksSubscription as n, clearPaginationCache as o, defineGate as p, createPaginationSubscription as r, defaultPageHints as s, getPromiseState as t, createRequestSubscription as u, gate as v, createInternalSignal as w, Signals as x, memoized as y };
|
|
3519
|
-
//# sourceMappingURL=-private-
|
|
3883
|
+
//# sourceMappingURL=-private-BH4O810v.js.map
|