@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-ndw2Fy91.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
|
*/
|
|
@@ -445,6 +451,8 @@ async function watchStream(stream, loadingState) {
|
|
|
445
451
|
* reactive properties that can be used to build UIs that respond
|
|
446
452
|
* to the progress of a request.
|
|
447
453
|
*
|
|
454
|
+
* @summary Reactive download progress for a request, such as bytes loaded and timing, built by lazily
|
|
455
|
+
* reading its response stream.
|
|
448
456
|
* @hideconstructor
|
|
449
457
|
*/
|
|
450
458
|
var RequestLoadingState = class {
|
|
@@ -663,9 +671,11 @@ defineNonEnumerableSignal(RequestLoadingState.prototype, "_lastPacketTime", 0);
|
|
|
663
671
|
*
|
|
664
672
|
*/
|
|
665
673
|
/**
|
|
666
|
-
* The state of a request
|
|
667
|
-
*
|
|
668
|
-
* cancelled
|
|
674
|
+
* The state of a request that was aborted before it settled.
|
|
675
|
+
*
|
|
676
|
+
* A cancelled request has `status: 'cancelled'` and its `reason` is an
|
|
677
|
+
* `AbortError`. `isError` is also `true`, as for a {@link RejectedRequest},
|
|
678
|
+
* so check `status` or `isCancelled` to tell the two apart.
|
|
669
679
|
*
|
|
670
680
|
*/
|
|
671
681
|
/**
|
|
@@ -699,6 +709,8 @@ defineNonEnumerableSignal(RequestLoadingState.prototype, "_lastPacketTime", 0);
|
|
|
699
709
|
* - {@link RejectedRequest}
|
|
700
710
|
* - {@link CancelledRequest}
|
|
701
711
|
*
|
|
712
|
+
* @summary The reactive pending, fulfilled, rejected, or cancelled state of a request `Future`, as
|
|
713
|
+
* returned by `getRequestState`.
|
|
702
714
|
*/
|
|
703
715
|
const RequestStateProto = {};
|
|
704
716
|
function performRefresh(requester, request, isReload) {
|
|
@@ -747,7 +759,7 @@ function createRequestState(future) {
|
|
|
747
759
|
if (state.isError) {
|
|
748
760
|
promiseState.error = state.result;
|
|
749
761
|
promiseState.reason = state.result;
|
|
750
|
-
promiseState.status = "rejected";
|
|
762
|
+
promiseState.status = isAbortError(state.result) ? "cancelled" : "rejected";
|
|
751
763
|
promiseState.isError = true;
|
|
752
764
|
promiseState.isPending = false;
|
|
753
765
|
promiseState.isLoading = false;
|
|
@@ -783,7 +795,7 @@ function createRequestState(future) {
|
|
|
783
795
|
});
|
|
784
796
|
promiseState.error = error;
|
|
785
797
|
promiseState.reason = error;
|
|
786
|
-
promiseState.status = "rejected";
|
|
798
|
+
promiseState.status = isAbortError(error) ? "cancelled" : "rejected";
|
|
787
799
|
promiseState.isError = true;
|
|
788
800
|
promiseState.isPending = false;
|
|
789
801
|
promiseState.isLoading = false;
|
|
@@ -795,6 +807,26 @@ function createRequestState(future) {
|
|
|
795
807
|
/**
|
|
796
808
|
* `getRequestState` can be used in both JavaScript and Template contexts.
|
|
797
809
|
*
|
|
810
|
+
* It returns a {@link RequestState}: a reactive object that updates as the
|
|
811
|
+
* request advances. Calling it again with the same {@link Future} returns the
|
|
812
|
+
* same object. Check `status` to narrow it to one of four states:
|
|
813
|
+
*
|
|
814
|
+
* - {@link PendingRequest} (`'pending'`) is the initial state, before the
|
|
815
|
+
* request settles.
|
|
816
|
+
* - {@link ResolvedRequest} (`'fulfilled'`) holds the response content on `value`.
|
|
817
|
+
* - {@link RejectedRequest} (`'rejected'`) holds the error on `reason`.
|
|
818
|
+
* - {@link CancelledRequest} (`'cancelled'`) is a request that was aborted.
|
|
819
|
+
* `isError` is also `true` for a cancelled request, so check `status` or
|
|
820
|
+
* `isCancelled` rather than `isError` if you handle it differently.
|
|
821
|
+
*
|
|
822
|
+
* Every state also exposes a {@link RequestLoadingState} on `loadingState`
|
|
823
|
+
* for tracking the progress of the response stream.
|
|
824
|
+
*
|
|
825
|
+
* The [Reactive Control Flow](/guides/the-manual/reactivity/control-flow) guide shows
|
|
826
|
+
* how to render request states with it, and
|
|
827
|
+
* [Using The Response](/guides/the-manual/requests/using-the-response) covers the
|
|
828
|
+
* `Future` it reads.
|
|
829
|
+
*
|
|
798
830
|
* ```ts
|
|
799
831
|
* import { getRequestState } from '@warp-drive-mirror/ember';
|
|
800
832
|
*
|
|
@@ -841,6 +873,10 @@ function createRequestState(future) {
|
|
|
841
873
|
* which offers a number of additional capabilities for requests *beyond* what
|
|
842
874
|
* `RequestState` provides.
|
|
843
875
|
*
|
|
876
|
+
* @param future - the request {@link Future} to track, as returned by `store.request` or `requestManager.request`
|
|
877
|
+
* @return the cached {@link RequestState} for `future`
|
|
878
|
+
* @summary Returns a cached, reactive state object tracking a request `Future` through pending, success,
|
|
879
|
+
* error, and cancellation.
|
|
844
880
|
*/
|
|
845
881
|
function getRequestState(future) {
|
|
846
882
|
let state = RequestCache.get(future);
|
|
@@ -913,28 +949,47 @@ const DISPOSE = Symbol.dispose || Symbol.for("dispose");
|
|
|
913
949
|
/**
|
|
914
950
|
* The individual autorefresh strategies a {@link RequestSubscription}
|
|
915
951
|
* may combine, see {@link AutorefreshBehaviorCombos}.
|
|
952
|
+
*
|
|
953
|
+
* @summary One autorefresh trigger for a request subscription: on reconnecting (`online`), on a timer
|
|
954
|
+
* (`interval`), or on store invalidation (`invalid`).
|
|
916
955
|
*/
|
|
917
956
|
/**
|
|
918
957
|
* The value accepted by {@link SubscriptionArgs.autorefresh}: either a
|
|
919
958
|
* boolean, a single {@link AutorefreshBehaviorType}, or a comma-separated
|
|
920
959
|
* combination of up to three of them.
|
|
960
|
+
*
|
|
961
|
+
* @summary The accepted values for a request subscription's `autorefresh` option: a boolean or a
|
|
962
|
+
* comma-separated mix of `online`, `interval`, and `invalid`.
|
|
921
963
|
*/
|
|
922
964
|
/**
|
|
923
965
|
* Utilities to assist in recovering from the error.
|
|
966
|
+
*
|
|
967
|
+
* @summary The online and visibility state plus a `retry` function that a request subscription exposes
|
|
968
|
+
* for recovering from a failed request.
|
|
924
969
|
*/
|
|
925
970
|
/** @deprecated use {@link RecoveryFeatures} */
|
|
926
971
|
/**
|
|
927
972
|
* Utilities for keeping the request fresh
|
|
973
|
+
*
|
|
974
|
+
* @summary The online, visibility, and refreshing state plus `refresh`, `reload`, and `abort` functions a
|
|
975
|
+
* request subscription exposes alongside successful content.
|
|
928
976
|
*/
|
|
929
977
|
/**
|
|
930
978
|
* The args accepted by the `<Request />` component.
|
|
979
|
+
*
|
|
980
|
+
* @summary The arguments of the `<Request />` component: the request or query to run, autorefresh
|
|
981
|
+
* options, and an optional store or subscription.
|
|
931
982
|
*/
|
|
932
983
|
/**
|
|
933
984
|
* The args accepted by a {@link RequestSubscription}.
|
|
985
|
+
*
|
|
986
|
+
* @summary Options for a request subscription: the request or query to monitor and its autorefresh settings.
|
|
934
987
|
*/
|
|
935
988
|
/**
|
|
936
989
|
* A reactive class
|
|
937
990
|
*
|
|
991
|
+
* @summary Reactive subscription that monitors a request or query, tracking online, visibility and refresh state and
|
|
992
|
+
* handling autorefresh, reload and retry.
|
|
938
993
|
* @hideconstructor
|
|
939
994
|
*/
|
|
940
995
|
var RequestSubscription = class {
|
|
@@ -1346,6 +1401,9 @@ function isStore(store) {
|
|
|
1346
1401
|
/**
|
|
1347
1402
|
* Creates a {@link RequestSubscription}, the reactive class powering the
|
|
1348
1403
|
* `<Request />` component's autorefresh, retry, and refresh behaviors.
|
|
1404
|
+
*
|
|
1405
|
+
* @summary Creates a reactive subscription to a request or query that tracks its state and handles
|
|
1406
|
+
* autorefresh, retry, and refresh.
|
|
1349
1407
|
*/
|
|
1350
1408
|
function createRequestSubscription(store, args) {
|
|
1351
1409
|
return new RequestSubscription(store, args);
|
|
@@ -1412,6 +1470,8 @@ function getHref(link) {
|
|
|
1412
1470
|
* }
|
|
1413
1471
|
* ```
|
|
1414
1472
|
*
|
|
1473
|
+
* @summary Experimental: one page of a paginated collection, exposing its request, loading and error status, data,
|
|
1474
|
+
* and links to neighboring pages.
|
|
1415
1475
|
* @since 5.9.0
|
|
1416
1476
|
* @public
|
|
1417
1477
|
* @hideconstructor
|
|
@@ -1594,68 +1654,194 @@ var PageCache = class {
|
|
|
1594
1654
|
decorateMethodV2(this.prototype, "isLinked", [memoized]);
|
|
1595
1655
|
}
|
|
1596
1656
|
async load(request) {
|
|
1657
|
+
this.request = request;
|
|
1658
|
+
this.state = getRequestState(this.request);
|
|
1659
|
+
let content;
|
|
1597
1660
|
try {
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1661
|
+
content = (await this.request).content;
|
|
1662
|
+
} catch {
|
|
1663
|
+
return null;
|
|
1664
|
+
}
|
|
1665
|
+
this.applyDocument(content);
|
|
1666
|
+
return content;
|
|
1667
|
+
}
|
|
1668
|
+
/**
|
|
1669
|
+
* Re-applies an already-loaded page from a newer request for the same page
|
|
1670
|
+
* (a reload, or a route-driven navigation back to it). The newer document is
|
|
1671
|
+
* authoritative: its links and page hints replace the ones recorded from
|
|
1672
|
+
* the earlier load, and the collection total is updated from it. The page
|
|
1673
|
+
* keeps its current request until the newer one resolves, so a page on
|
|
1674
|
+
* screen does not flash a loading state; a rejected request leaves the
|
|
1675
|
+
* page untouched.
|
|
1676
|
+
*
|
|
1677
|
+
* @internal
|
|
1678
|
+
*/
|
|
1679
|
+
async update(request) {
|
|
1680
|
+
const state = getRequestState(request);
|
|
1681
|
+
let content;
|
|
1682
|
+
try {
|
|
1683
|
+
content = (await request).content;
|
|
1684
|
+
} catch {
|
|
1685
|
+
return null;
|
|
1686
|
+
}
|
|
1687
|
+
this.request = request;
|
|
1688
|
+
this.state = state;
|
|
1689
|
+
this.applyDocument(content);
|
|
1690
|
+
return content;
|
|
1691
|
+
}
|
|
1692
|
+
/**
|
|
1693
|
+
* Records a loaded document's links and page number, and links this page
|
|
1694
|
+
* into the shared page graph.
|
|
1695
|
+
*
|
|
1696
|
+
* The document is authoritative for what it states: a link it names
|
|
1697
|
+
* explicitly (including an explicit `null`) overwrites whatever a neighbor
|
|
1698
|
+
* or an earlier load of this page recorded, and a link it omits is kept.
|
|
1699
|
+
* `next`/`prev` name the adjacent pages; `first`/`last` name the ends of
|
|
1700
|
+
* the collection, beyond which nothing may remain linked.
|
|
1701
|
+
*
|
|
1702
|
+
* For a numbered collection the document must also agree with the page
|
|
1703
|
+
* numbers: `next` is the page after this one, `prev` the page before, a
|
|
1704
|
+
* page without `prev` is page 1, a page without `next` is the last page,
|
|
1705
|
+
* `first` is page 1 and `last` is page `totalPages`. A document that
|
|
1706
|
+
* contradicts this is a server (or collection-mixing) bug and is asserted
|
|
1707
|
+
* in development, before anything is recorded from it. A cursor collection
|
|
1708
|
+
* has no numbers, so there its links are the only authority.
|
|
1709
|
+
*
|
|
1710
|
+
* @internal
|
|
1711
|
+
*/
|
|
1712
|
+
applyDocument(content) {
|
|
1713
|
+
const links = content?.links ?? {};
|
|
1714
|
+
const self = getHref(content?.links?.self);
|
|
1715
|
+
const first = getHref(content?.links?.first);
|
|
1716
|
+
const last = getHref(content?.links?.last);
|
|
1717
|
+
const next = getHref(content?.links?.next);
|
|
1718
|
+
const prev = getHref(content?.links?.prev);
|
|
1719
|
+
const { currentPage, totalPages } = this.manager.readPageHints(content);
|
|
1720
|
+
const firstPage = first ? this.manager.getPageCache(first) : null;
|
|
1721
|
+
const lastPage = last ? this.manager.getPageCache(last) : null;
|
|
1722
|
+
const prevPage = prev ? this.manager.getPageCache(prev) : null;
|
|
1723
|
+
const nextPage = next ? this.manager.getPageCache(next) : null;
|
|
1724
|
+
if (this.manager.isNumbered) {}
|
|
1725
|
+
if (currentPage) this.pageNumber = currentPage;
|
|
1726
|
+
this.manager.totalPages = totalPages;
|
|
1727
|
+
const stated = {};
|
|
1728
|
+
if ("first" in links) stated.first = first;
|
|
1729
|
+
if ("last" in links) stated.last = last;
|
|
1730
|
+
if ("next" in links) stated.next = next;
|
|
1731
|
+
if ("prev" in links) stated.prev = prev;
|
|
1732
|
+
this.updateLinks(stated);
|
|
1733
|
+
if ("next" in links && !next) {
|
|
1734
|
+
const after = this.after;
|
|
1735
|
+
this.detachAfter();
|
|
1736
|
+
if (after?.prevLink === self) after.updateLinks({ prev: null });
|
|
1737
|
+
}
|
|
1738
|
+
if ("prev" in links && !prev) {
|
|
1739
|
+
const before = this.before;
|
|
1740
|
+
this.detachBefore();
|
|
1741
|
+
if (before?.nextLink === self) before.updateLinks({ next: null });
|
|
1742
|
+
}
|
|
1743
|
+
if (lastPage) {
|
|
1744
|
+
lastPage.detachAfter();
|
|
1745
|
+
lastPage.updateLinks({ next: null });
|
|
1746
|
+
}
|
|
1747
|
+
if (firstPage) {
|
|
1748
|
+
firstPage.detachBefore();
|
|
1749
|
+
firstPage.updateLinks({ prev: null });
|
|
1750
|
+
}
|
|
1751
|
+
if (firstPage) {
|
|
1752
|
+
firstPage.setPageNumber(1);
|
|
1753
|
+
if (firstPage !== this && !firstPage.after) this.linkFirst(firstPage);
|
|
1754
|
+
}
|
|
1755
|
+
if (lastPage) {
|
|
1756
|
+
lastPage.setPageNumber(this.manager.totalPages);
|
|
1757
|
+
if (lastPage !== this && !lastPage.before) this.linkLast(lastPage);
|
|
1758
|
+
}
|
|
1759
|
+
if (nextPage) {
|
|
1760
|
+
nextPage.setPageNumber(this.pageNumber + 1);
|
|
1761
|
+
nextPage.updateLinks({ prev: self });
|
|
1762
|
+
}
|
|
1763
|
+
if (prevPage) {
|
|
1764
|
+
prevPage.setPageNumber(this.pageNumber - 1);
|
|
1765
|
+
prevPage.updateLinks({ next: self });
|
|
1766
|
+
}
|
|
1767
|
+
if (nextPage && this.after && this.after !== nextPage && this.after.pageNumber <= nextPage.pageNumber) this.detachAfter();
|
|
1768
|
+
if (prevPage && this.before && this.before !== prevPage && this.before.pageNumber >= prevPage.pageNumber) this.detachBefore();
|
|
1769
|
+
if (this.isLinked) {
|
|
1770
|
+
if (prevPage) prevPage.updateLinkage({ after: this });
|
|
1771
|
+
if (nextPage) nextPage.updateLinkage({ before: this });
|
|
1772
|
+
} else if (prevPage?.isLinked) {
|
|
1773
|
+
this.updateLinkage({ before: prevPage });
|
|
1774
|
+
if (nextPage) nextPage.updateLinkage({ before: this });
|
|
1775
|
+
} else if (nextPage?.isLinked) {
|
|
1776
|
+
this.updateLinkage({ after: nextPage });
|
|
1777
|
+
if (prevPage) prevPage.updateLinkage({ after: this });
|
|
1778
|
+
} else if ((prevPage || nextPage) && (firstPage || lastPage)) this.lookupLinkage(firstPage, lastPage);
|
|
1779
|
+
else if (prevPage || nextPage) this.updateLinkage({
|
|
1780
|
+
before: prevPage,
|
|
1781
|
+
after: nextPage
|
|
1782
|
+
});
|
|
1649
1783
|
}
|
|
1650
1784
|
/** @internal */
|
|
1785
|
+
detachAfter() {
|
|
1786
|
+
const after = this.after;
|
|
1787
|
+
if (after) {
|
|
1788
|
+
if (after.before === this) after.setBefore(null);
|
|
1789
|
+
this.setAfter(null);
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
/** @internal */
|
|
1793
|
+
detachBefore() {
|
|
1794
|
+
const before = this.before;
|
|
1795
|
+
if (before) {
|
|
1796
|
+
if (before.after === this) before.setAfter(null);
|
|
1797
|
+
this.setBefore(null);
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
/**
|
|
1801
|
+
* Links an unlinked `first` page before the earliest page reachable
|
|
1802
|
+
* backwards from this one that must follow it.
|
|
1803
|
+
*
|
|
1804
|
+
* @internal
|
|
1805
|
+
*/
|
|
1806
|
+
linkFirst(firstPage) {
|
|
1807
|
+
let head = this;
|
|
1808
|
+
while (head.before && head.before !== firstPage && (!head.before.pageNumber || head.before.pageNumber > firstPage.pageNumber)) head = head.before;
|
|
1809
|
+
firstPage.updateLinkage({ after: head });
|
|
1810
|
+
}
|
|
1811
|
+
/**
|
|
1812
|
+
* Links an unlinked `last` page after the furthest page reachable forwards
|
|
1813
|
+
* from this one that must precede it.
|
|
1814
|
+
*
|
|
1815
|
+
* @internal
|
|
1816
|
+
*/
|
|
1817
|
+
linkLast(lastPage) {
|
|
1818
|
+
let tail = this;
|
|
1819
|
+
while (tail.after && tail.after !== lastPage && (!tail.after.pageNumber || !lastPage.pageNumber || tail.after.pageNumber < lastPage.pageNumber)) tail = tail.after;
|
|
1820
|
+
lastPage.updateLinkage({ before: tail });
|
|
1821
|
+
}
|
|
1822
|
+
/**
|
|
1823
|
+
* Places this page between `before` and `after` in the graph (a missing side
|
|
1824
|
+
* is taken from the given side's current neighbor, so a single side splices
|
|
1825
|
+
* this page in). Pointers this page or the displaced neighbors held to their
|
|
1826
|
+
* old positions are cleared first, so a page moved within the graph never
|
|
1827
|
+
* leaves a dangling link behind that could close a cycle.
|
|
1828
|
+
*
|
|
1829
|
+
* @internal
|
|
1830
|
+
*/
|
|
1651
1831
|
updateLinkage({ before, after }) {
|
|
1652
1832
|
const leftSide = before ?? after?.before;
|
|
1653
1833
|
const rightSide = after ?? before?.after;
|
|
1654
1834
|
if (leftSide && leftSide !== this) {
|
|
1835
|
+
if (this.before !== leftSide) this.detachBefore();
|
|
1836
|
+
const displaced = leftSide.after;
|
|
1837
|
+
if (displaced && displaced !== this && displaced !== rightSide && displaced.before === leftSide) displaced.setBefore(null);
|
|
1655
1838
|
leftSide.setAfter(this);
|
|
1656
1839
|
this.setBefore(leftSide);
|
|
1657
1840
|
}
|
|
1658
1841
|
if (rightSide && rightSide !== this) {
|
|
1842
|
+
if (this.after !== rightSide) this.detachAfter();
|
|
1843
|
+
const displaced = rightSide.before;
|
|
1844
|
+
if (displaced && displaced !== this && displaced !== leftSide && displaced.after === rightSide) displaced.setAfter(null);
|
|
1659
1845
|
rightSide.setBefore(this);
|
|
1660
1846
|
this.setAfter(rightSide);
|
|
1661
1847
|
}
|
|
@@ -1686,16 +1872,18 @@ var PageCache = class {
|
|
|
1686
1872
|
setAfter(page) {
|
|
1687
1873
|
this.after = page;
|
|
1688
1874
|
}
|
|
1689
|
-
/**
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
if (
|
|
1698
|
-
if (
|
|
1875
|
+
/**
|
|
1876
|
+
* Records the given links. Only the keys present are applied, so a caller
|
|
1877
|
+
* states exactly what it knows: an explicit `null` clears a link, an
|
|
1878
|
+
* omitted key leaves the recorded link alone.
|
|
1879
|
+
*
|
|
1880
|
+
* @internal
|
|
1881
|
+
*/
|
|
1882
|
+
updateLinks = (links) => {
|
|
1883
|
+
if ("prev" in links) this.prevLink = links.prev ?? null;
|
|
1884
|
+
if ("next" in links) this.nextLink = links.next ?? null;
|
|
1885
|
+
if ("first" in links) this.firstLink = links.first ?? null;
|
|
1886
|
+
if ("last" in links) this.lastLink = links.last ?? null;
|
|
1699
1887
|
};
|
|
1700
1888
|
/** @internal */
|
|
1701
1889
|
setPageNumber = (pageNumber) => {
|
|
@@ -1721,6 +1909,8 @@ const PaginationCacheMap = /* @__PURE__ */ new Map();
|
|
|
1721
1909
|
* collection must provide the same function reference — define it once at module
|
|
1722
1910
|
* scope and import it everywhere.
|
|
1723
1911
|
*
|
|
1912
|
+
* @summary Experimental: a function you pass to `<Paginate />` that reads `currentPage` and `totalPages` from a
|
|
1913
|
+
* loaded document when they are not in the default `meta` locations.
|
|
1724
1914
|
* @since 5.9.0
|
|
1725
1915
|
* @public
|
|
1726
1916
|
*/
|
|
@@ -1729,6 +1919,8 @@ const PaginationCacheMap = /* @__PURE__ */ new Map();
|
|
|
1729
1919
|
* document `meta`, matching the behavior used before `pageHints` was configurable.
|
|
1730
1920
|
* Used whenever the consumer does not provide a `pageHints` function.
|
|
1731
1921
|
*
|
|
1922
|
+
* @summary Experimental: the fallback page-hints function, reading `meta.page` or `meta.currentPage` and
|
|
1923
|
+
* `meta.totalPages` from a document, with `0` meaning unknown.
|
|
1732
1924
|
* @since 5.9.0
|
|
1733
1925
|
* @public
|
|
1734
1926
|
*/
|
|
@@ -1748,6 +1940,8 @@ const defaultPageHints = (document) => {
|
|
|
1748
1940
|
* interact with — the cache itself is plumbing shared between the pagination
|
|
1749
1941
|
* classes.
|
|
1750
1942
|
*
|
|
1943
|
+
* @summary Experimental: the shared, app-wide store of loaded pages, page order, and `totalPages` for one paginated
|
|
1944
|
+
* collection, keyed by its `first` or `self` link.
|
|
1751
1945
|
* @since 5.9.0
|
|
1752
1946
|
* @public
|
|
1753
1947
|
* @hideconstructor
|
|
@@ -1839,13 +2033,29 @@ var PaginationCache = class {
|
|
|
1839
2033
|
}
|
|
1840
2034
|
return page;
|
|
1841
2035
|
}
|
|
1842
|
-
/**
|
|
1843
|
-
|
|
2036
|
+
/**
|
|
2037
|
+
* Loads the page at `url` with `request` when it is not loaded (or its load
|
|
2038
|
+
* failed), or re-applies `request`'s document when it is a newer request
|
|
2039
|
+
* for an already-loaded page (a reload, or navigating back to it: the newer
|
|
2040
|
+
* document is authoritative for the page's links and the collection total,
|
|
2041
|
+
* which may have changed since the first load).
|
|
2042
|
+
*
|
|
2043
|
+
* Resolves to the page once that has settled. A rejected request settles
|
|
2044
|
+
* too — it is surfaced through the page's state, not thrown. The promise
|
|
2045
|
+
* rejects only when the document contradicts the collection (see
|
|
2046
|
+
* {@link PageCache.applyDocument}), so the caller that triggered the load
|
|
2047
|
+
* is the one that hears about it.
|
|
2048
|
+
*
|
|
2049
|
+
* @internal
|
|
2050
|
+
*/
|
|
2051
|
+
async loadPage(url, request) {
|
|
1844
2052
|
const page = this.getPageCache(url);
|
|
1845
|
-
if ((!page.isLoaded || page.isError) && request)
|
|
2053
|
+
if ((!page.isLoaded || page.isError) && request) {
|
|
2054
|
+
await page.load(request);
|
|
1846
2055
|
this.updateFirstPage(page);
|
|
1847
|
-
|
|
1848
|
-
|
|
2056
|
+
} else if (request && page.isSuccess && request !== page.request) {
|
|
2057
|
+
if (await page.update(request)) this.updateFirstPage(page);
|
|
2058
|
+
}
|
|
1849
2059
|
return page;
|
|
1850
2060
|
}
|
|
1851
2061
|
/** @internal */
|
|
@@ -1854,10 +2064,6 @@ var PaginationCache = class {
|
|
|
1854
2064
|
while (maybeFirstPage.before) maybeFirstPage = maybeFirstPage.before;
|
|
1855
2065
|
if (!this.firstPage || this.firstPage.pageNumber > maybeFirstPage.pageNumber) this.firstPage = maybeFirstPage;
|
|
1856
2066
|
}
|
|
1857
|
-
/** @internal */
|
|
1858
|
-
getTotalPages(document) {
|
|
1859
|
-
return this.readPageHints(document).totalPages;
|
|
1860
|
-
}
|
|
1861
2067
|
/**
|
|
1862
2068
|
* Every page known to the shared graph, in order — loaded pages and pages
|
|
1863
2069
|
* known only from links — across all components sharing the collection.
|
|
@@ -1873,14 +2079,13 @@ var PaginationCache = class {
|
|
|
1873
2079
|
* ```
|
|
1874
2080
|
*/
|
|
1875
2081
|
get pages() {
|
|
1876
|
-
const
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
} };
|
|
2082
|
+
const pages = [];
|
|
2083
|
+
let page = this.firstPage;
|
|
2084
|
+
while (page) {
|
|
2085
|
+
pages.push(page);
|
|
2086
|
+
page = page.after;
|
|
2087
|
+
}
|
|
2088
|
+
return pages;
|
|
1884
2089
|
}
|
|
1885
2090
|
/**
|
|
1886
2091
|
* The items of every loaded page in the shared graph, flattened into one
|
|
@@ -1894,10 +2099,9 @@ var PaginationCache = class {
|
|
|
1894
2099
|
decorateMethodV2(this.prototype, "pages", [memoized]);
|
|
1895
2100
|
}
|
|
1896
2101
|
get data() {
|
|
1897
|
-
const
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
} };
|
|
2102
|
+
const items = [];
|
|
2103
|
+
for (const page of this.pages) if (page.data) items.push(...page.data);
|
|
2104
|
+
return items;
|
|
1901
2105
|
}
|
|
1902
2106
|
static {
|
|
1903
2107
|
decorateMethodV2(this.prototype, "data", [memoized]);
|
|
@@ -1908,6 +2112,8 @@ var PaginationCache = class {
|
|
|
1908
2112
|
* `first` or `self` link). Returns the same instance for the same key for the
|
|
1909
2113
|
* lifetime of the module.
|
|
1910
2114
|
*
|
|
2115
|
+
* @summary Experimental: returns the shared pagination cache for a collection's `first` or `self` link, creating it
|
|
2116
|
+
* on first use.
|
|
1911
2117
|
* @since 5.9.0
|
|
1912
2118
|
* @public
|
|
1913
2119
|
*/
|
|
@@ -1924,6 +2130,7 @@ function getPaginationCache(key) {
|
|
|
1924
2130
|
* Primarily intended for test isolation, since the cache is keyed by url and
|
|
1925
2131
|
* otherwise persists for the lifetime of the module.
|
|
1926
2132
|
*
|
|
2133
|
+
* @summary Experimental: discards every shared pagination cache, mainly so tests start from a clean state.
|
|
1927
2134
|
* @since 5.9.0
|
|
1928
2135
|
* @public
|
|
1929
2136
|
*/
|
|
@@ -1940,25 +2147,40 @@ function clearPaginationCache() {
|
|
|
1940
2147
|
*
|
|
1941
2148
|
* - `'paged'` — single-page view, see {@link PagedPaginationState}.
|
|
1942
2149
|
* - `'infinite'` — accumulated view, see {@link InfinitePaginationState}.
|
|
2150
|
+
*
|
|
2151
|
+
* @summary Experimental: the `@mode` value of `<Paginate />`, either `'paged'` for a single-page view or
|
|
2152
|
+
* `'infinite'` for an accumulated view, which selects the yielded pagination API.
|
|
1943
2153
|
*/
|
|
1944
2154
|
/**
|
|
1945
2155
|
* The part of a {@link PaginationState} available to both navigation surfaces.
|
|
2156
|
+
*
|
|
2157
|
+
* @summary Experimental: the pagination state members available in both paged and infinite mode, namely
|
|
2158
|
+
* `totalPages` and `adoptPage`.
|
|
1946
2159
|
*/
|
|
1947
2160
|
/**
|
|
1948
2161
|
* The paged (single-page view) surface of a {@link PaginationState}: render
|
|
1949
2162
|
* {@link PaginationState.activePageRequest | activePageRequest}, navigate with
|
|
1950
2163
|
* {@link PaginationState.loadPage | loadPage}. This is what the `<Paginate />`
|
|
1951
2164
|
* component yields in `'paged'` mode (the default).
|
|
2165
|
+
*
|
|
2166
|
+
* @summary Experimental: the pagination state `<Paginate />` yields in paged mode, exposing the active page, its
|
|
2167
|
+
* request, and `loadPage` for navigating to a page by URL.
|
|
1952
2168
|
*/
|
|
1953
2169
|
/**
|
|
1954
2170
|
* The infinite (accumulated view) surface of a {@link PaginationState}: render
|
|
1955
2171
|
* {@link PaginationState.data | data}, grow it with
|
|
1956
2172
|
* {@link PaginationState.loadNext | loadNext}/{@link PaginationState.loadPrev | loadPrev}.
|
|
1957
2173
|
* This is what the `<Paginate />` component yields in `'infinite'` mode.
|
|
2174
|
+
*
|
|
2175
|
+
* @summary Experimental: the pagination state `<Paginate />` yields in infinite mode, exposing the accumulated
|
|
2176
|
+
* items and pages plus `loadNext` and `loadPrev` to extend them.
|
|
1958
2177
|
*/
|
|
1959
2178
|
/**
|
|
1960
2179
|
* Resolves a {@link PaginateMode} to the surface it exposes, so a component
|
|
1961
2180
|
* generic over the mode can yield only that surface.
|
|
2181
|
+
*
|
|
2182
|
+
* @summary Experimental: resolves a pagination mode to its state type, the infinite-mode state for `'infinite'`
|
|
2183
|
+
* and the paged-mode state otherwise.
|
|
1962
2184
|
*/
|
|
1963
2185
|
/**
|
|
1964
2186
|
* The per-component, local pagination state. It houses the state that is unique
|
|
@@ -1982,6 +2204,8 @@ function clearPaginationCache() {
|
|
|
1982
2204
|
* Instances are created via {@link getPaginationState} (or by the `<Paginate />`
|
|
1983
2205
|
* component on your behalf), never constructed directly.
|
|
1984
2206
|
*
|
|
2207
|
+
* @summary Experimental: one component's pagination state over a shared collection, tracking the active page and
|
|
2208
|
+
* the loaded run and providing paged and infinite navigation.
|
|
1985
2209
|
* @since 5.9.0
|
|
1986
2210
|
* @public
|
|
1987
2211
|
* @hideconstructor
|
|
@@ -2012,10 +2236,23 @@ var PaginationState = class {
|
|
|
2012
2236
|
* them backward/forward. Both seed to {@link initialPage}; a purely paged
|
|
2013
2237
|
* consumer never extends them, so they stay put and are effectively unused.
|
|
2014
2238
|
*
|
|
2239
|
+
* Only ever written through {@link extendRun} and {@link restartRun}, which
|
|
2240
|
+
* keep {@link runMembers} in step.
|
|
2241
|
+
*
|
|
2015
2242
|
* @internal
|
|
2016
2243
|
*/
|
|
2017
2244
|
/** @internal */
|
|
2018
2245
|
/**
|
|
2246
|
+
* Every page this component has loaded into its run — what the frontier
|
|
2247
|
+
* spanned each time it moved. Bounds the walk in {@link pages}: the shared
|
|
2248
|
+
* graph may relink a page in the run to one that another component sharing
|
|
2249
|
+
* the collection loaded, and that page is not part of this run until it is
|
|
2250
|
+
* loaded through here. Untracked bookkeeping — it only changes together with
|
|
2251
|
+
* the frontier signals, which carry the notification.
|
|
2252
|
+
*
|
|
2253
|
+
* @internal
|
|
2254
|
+
*/
|
|
2255
|
+
/**
|
|
2019
2256
|
* The request of the latest {@link adoptPage} call — only that call may
|
|
2020
2257
|
* commit. Later calls (or a {@link loadPage} navigation) claim the slot,
|
|
2021
2258
|
* superseding in-flight adoptions so the newest navigation always wins.
|
|
@@ -2028,6 +2265,7 @@ var PaginationState = class {
|
|
|
2028
2265
|
this.request = request;
|
|
2029
2266
|
this.pageHints = pageHints;
|
|
2030
2267
|
this._adoptTarget = null;
|
|
2268
|
+
this.runMembers = /* @__PURE__ */ new Set();
|
|
2031
2269
|
this.setup();
|
|
2032
2270
|
}
|
|
2033
2271
|
/**
|
|
@@ -2076,21 +2314,44 @@ var PaginationState = class {
|
|
|
2076
2314
|
* same collection to different extents each see only what they have scrolled
|
|
2077
2315
|
* through. For every page known to the whole collection, see
|
|
2078
2316
|
* {@link PaginationCache.pages}.
|
|
2317
|
+
*
|
|
2318
|
+
* The run is walked through the shared graph, so it ends early when a page
|
|
2319
|
+
* that was in it no longer follows the page before it — a reload that showed
|
|
2320
|
+
* the collection now ends sooner, or that its next cursor moved. It also ends
|
|
2321
|
+
* before a page this component never loaded: a reload may relink a page in
|
|
2322
|
+
* the run to one another component sharing the collection scrolled to, and
|
|
2323
|
+
* that page joins this run only through {@link loadNext}.
|
|
2079
2324
|
*/
|
|
2080
2325
|
static {
|
|
2081
2326
|
decorateMethodV2(this.prototype, "totalPages", [memoized]);
|
|
2082
2327
|
}
|
|
2083
2328
|
get pages() {
|
|
2084
|
-
const
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
}
|
|
2329
|
+
const pages = [];
|
|
2330
|
+
const end = this.frontierEnd;
|
|
2331
|
+
let page = this.frontierStart;
|
|
2332
|
+
while (page) {
|
|
2333
|
+
pages.push(page);
|
|
2334
|
+
if (page === end) break;
|
|
2335
|
+
const next = page.after;
|
|
2336
|
+
if (!next?.isSuccess || !this.runMembers.has(next)) break;
|
|
2337
|
+
page = next;
|
|
2338
|
+
}
|
|
2339
|
+
return pages;
|
|
2340
|
+
}
|
|
2341
|
+
/**
|
|
2342
|
+
* The last page of the run {@link pages} walks — the forward frontier, or
|
|
2343
|
+
* the page before the first one that no longer follows in the graph or that
|
|
2344
|
+
* this component never loaded.
|
|
2345
|
+
*
|
|
2346
|
+
* @internal
|
|
2347
|
+
*/
|
|
2348
|
+
static {
|
|
2349
|
+
decorateMethodV2(this.prototype, "pages", [memoized]);
|
|
2350
|
+
}
|
|
2351
|
+
get runEnd() {
|
|
2352
|
+
let end = null;
|
|
2353
|
+
for (const page of this.pages) end = page;
|
|
2354
|
+
return end;
|
|
2094
2355
|
}
|
|
2095
2356
|
/**
|
|
2096
2357
|
* The accumulated items across the loaded run, from the backward frontier to
|
|
@@ -2115,13 +2376,12 @@ var PaginationState = class {
|
|
|
2115
2376
|
* ```
|
|
2116
2377
|
*/
|
|
2117
2378
|
static {
|
|
2118
|
-
decorateMethodV2(this.prototype, "
|
|
2379
|
+
decorateMethodV2(this.prototype, "runEnd", [memoized]);
|
|
2119
2380
|
}
|
|
2120
2381
|
get data() {
|
|
2121
|
-
const
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
} };
|
|
2382
|
+
const items = [];
|
|
2383
|
+
for (const page of this.pages) if (page.data) items.push(...page.data);
|
|
2384
|
+
return items;
|
|
2125
2385
|
}
|
|
2126
2386
|
/**
|
|
2127
2387
|
* Whether a page exists after the forward frontier — i.e. there is more to load
|
|
@@ -2137,7 +2397,7 @@ var PaginationState = class {
|
|
|
2137
2397
|
decorateMethodV2(this.prototype, "data", [memoized]);
|
|
2138
2398
|
}
|
|
2139
2399
|
get hasNext() {
|
|
2140
|
-
return Boolean(this.
|
|
2400
|
+
return Boolean(this.runEnd?.nextLink);
|
|
2141
2401
|
}
|
|
2142
2402
|
/**
|
|
2143
2403
|
* Whether a page exists before the backward frontier.
|
|
@@ -2152,7 +2412,10 @@ var PaginationState = class {
|
|
|
2152
2412
|
* The request for the page just after the forward frontier, for the infinite
|
|
2153
2413
|
* surface. `null` until {@link loadNext} fires it (so a `<Request>` wrapping it
|
|
2154
2414
|
* renders its idle block), the in-flight `Future` while that page loads, then
|
|
2155
|
-
* `null` again once the frontier advances onto it. Also `null` at end-of-list
|
|
2415
|
+
* `null` again once the frontier advances onto it. Also `null` at end-of-list,
|
|
2416
|
+
* and while the page sits loaded in the shared cache (another component
|
|
2417
|
+
* scrolled to it) but outside this run — {@link loadNext} then joins it
|
|
2418
|
+
* without a request of its own.
|
|
2156
2419
|
*
|
|
2157
2420
|
* ```gts
|
|
2158
2421
|
* {{#if pages.hasNext}}
|
|
@@ -2167,9 +2430,9 @@ var PaginationState = class {
|
|
|
2167
2430
|
decorateMethodV2(this.prototype, "hasPrevious", [memoized]);
|
|
2168
2431
|
}
|
|
2169
2432
|
get nextRequest() {
|
|
2170
|
-
const url = this.
|
|
2433
|
+
const url = this.runEnd?.nextLink;
|
|
2171
2434
|
if (!url) return null;
|
|
2172
|
-
return this.
|
|
2435
|
+
return this.pendingRequest(url);
|
|
2173
2436
|
}
|
|
2174
2437
|
/**
|
|
2175
2438
|
* The request for the page just before the backward frontier. Mirror of
|
|
@@ -2181,12 +2444,24 @@ var PaginationState = class {
|
|
|
2181
2444
|
get previousRequest() {
|
|
2182
2445
|
const url = this.frontierStart?.prevLink;
|
|
2183
2446
|
if (!url) return null;
|
|
2184
|
-
return this.
|
|
2447
|
+
return this.pendingRequest(url);
|
|
2185
2448
|
}
|
|
2186
|
-
/**
|
|
2449
|
+
/**
|
|
2450
|
+
* The request of the page at `url` unless it already succeeded, in which
|
|
2451
|
+
* case there is nothing pending: the page either sits in this run, or joins
|
|
2452
|
+
* it on the next {@link loadNext}/{@link loadPrev} without a new request.
|
|
2453
|
+
*
|
|
2454
|
+
* @internal
|
|
2455
|
+
*/
|
|
2187
2456
|
static {
|
|
2188
2457
|
decorateMethodV2(this.prototype, "previousRequest", [memoized]);
|
|
2189
2458
|
}
|
|
2459
|
+
pendingRequest(url) {
|
|
2460
|
+
const page = this.paginationCache?.getPageCache(url);
|
|
2461
|
+
if (!page || page.isSuccess) return null;
|
|
2462
|
+
return page.request ?? null;
|
|
2463
|
+
}
|
|
2464
|
+
/** @internal */
|
|
2190
2465
|
async setup() {
|
|
2191
2466
|
let document;
|
|
2192
2467
|
try {
|
|
@@ -2200,9 +2475,31 @@ var PaginationState = class {
|
|
|
2200
2475
|
const cache = getPaginationCache(cacheKey);
|
|
2201
2476
|
cache.installPageHints(this.pageHints);
|
|
2202
2477
|
this.paginationCache = cache;
|
|
2203
|
-
|
|
2204
|
-
this.activePage = this.initialPage =
|
|
2205
|
-
this.
|
|
2478
|
+
const page = cache.getPageCache(selfLink);
|
|
2479
|
+
this.activePage = this.initialPage = page;
|
|
2480
|
+
this.restartRun(page);
|
|
2481
|
+
await cache.loadPage(selfLink, this.request);
|
|
2482
|
+
}
|
|
2483
|
+
/**
|
|
2484
|
+
* Moves the frontier onto a page adjacent to the run, recording it as a
|
|
2485
|
+
* member.
|
|
2486
|
+
*
|
|
2487
|
+
* @internal
|
|
2488
|
+
*/
|
|
2489
|
+
extendRun(dir, page) {
|
|
2490
|
+
this.runMembers.add(page);
|
|
2491
|
+
if (dir === "next") this.frontierEnd = page;
|
|
2492
|
+
else this.frontierStart = page;
|
|
2493
|
+
}
|
|
2494
|
+
/**
|
|
2495
|
+
* Restarts the run at a single page, forgetting every earlier member.
|
|
2496
|
+
*
|
|
2497
|
+
* @internal
|
|
2498
|
+
*/
|
|
2499
|
+
restartRun(page) {
|
|
2500
|
+
this.runMembers.clear();
|
|
2501
|
+
this.runMembers.add(page);
|
|
2502
|
+
this.frontierStart = this.frontierEnd = page;
|
|
2206
2503
|
}
|
|
2207
2504
|
/**
|
|
2208
2505
|
* Commits a resolved, membership-proven page into this state, making it the
|
|
@@ -2219,9 +2516,9 @@ var PaginationState = class {
|
|
|
2219
2516
|
_activate(page, url) {
|
|
2220
2517
|
this.activePage = page;
|
|
2221
2518
|
for (const existing of this.pages) if (existing === page) return;
|
|
2222
|
-
if (this.
|
|
2223
|
-
else if (this.frontierStart?.prevLink === url) this.
|
|
2224
|
-
else this.
|
|
2519
|
+
if (this.runEnd?.nextLink === url) this.extendRun("next", page);
|
|
2520
|
+
else if (this.frontierStart?.prevLink === url) this.extendRun("prev", page);
|
|
2521
|
+
else this.restartRun(page);
|
|
2225
2522
|
}
|
|
2226
2523
|
/**
|
|
2227
2524
|
* Adopts an externally-issued request into this pagination, making its page
|
|
@@ -2252,6 +2549,10 @@ var PaginationState = class {
|
|
|
2252
2549
|
* - this state has not finished setting up its own collection yet
|
|
2253
2550
|
* - the call was superseded by a newer navigation
|
|
2254
2551
|
*
|
|
2552
|
+
* In development, a document that contradicts the collection's page
|
|
2553
|
+
* numbers (a `next` that skips a page, a `first` that is not page 1, ...)
|
|
2554
|
+
* rejects instead of resolving: the graph is not updated from it.
|
|
2555
|
+
*
|
|
2255
2556
|
* ```ts
|
|
2256
2557
|
* const pages = getPaginationState(initialRequest);
|
|
2257
2558
|
* // later, e.g. in a route model hook reacting to a ?page= param:
|
|
@@ -2278,12 +2579,7 @@ var PaginationState = class {
|
|
|
2278
2579
|
const selfLink = getHref(content.links?.self);
|
|
2279
2580
|
const firstLink = getHref(content.links?.first);
|
|
2280
2581
|
if (!selfLink || (firstLink ?? selfLink) !== cache.key) return null;
|
|
2281
|
-
const page = cache.loadPage(selfLink, request);
|
|
2282
|
-
try {
|
|
2283
|
-
await page.request;
|
|
2284
|
-
} catch {
|
|
2285
|
-
return null;
|
|
2286
|
-
}
|
|
2582
|
+
const page = await cache.loadPage(selfLink, request);
|
|
2287
2583
|
if (this._adoptTarget !== request) return null;
|
|
2288
2584
|
this._activate(page, selfLink);
|
|
2289
2585
|
return page.value;
|
|
@@ -2327,7 +2623,7 @@ var PaginationState = class {
|
|
|
2327
2623
|
/** @internal */
|
|
2328
2624
|
_extend = async (dir) => {
|
|
2329
2625
|
const cache = this.paginationCache;
|
|
2330
|
-
const frontier = dir === "next" ? this.
|
|
2626
|
+
const frontier = dir === "next" ? this.runEnd : this.frontierStart;
|
|
2331
2627
|
const url = dir === "next" ? frontier?.nextLink : frontier?.prevLink;
|
|
2332
2628
|
if (!url) return null;
|
|
2333
2629
|
const page = cache.getPageCache(url);
|
|
@@ -2340,15 +2636,12 @@ var PaginationState = class {
|
|
|
2340
2636
|
method: "GET",
|
|
2341
2637
|
url
|
|
2342
2638
|
});
|
|
2343
|
-
cache.loadPage(url, request);
|
|
2344
|
-
}
|
|
2345
|
-
try {
|
|
2639
|
+
await cache.loadPage(url, request);
|
|
2640
|
+
} else try {
|
|
2346
2641
|
await page.request;
|
|
2347
|
-
} catch {
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
if (dir === "next") this.frontierEnd = page;
|
|
2351
|
-
else this.frontierStart = page;
|
|
2642
|
+
} catch {}
|
|
2643
|
+
if (!page.isSuccess) return null;
|
|
2644
|
+
this.extendRun(dir, page);
|
|
2352
2645
|
return page.value;
|
|
2353
2646
|
};
|
|
2354
2647
|
/**
|
|
@@ -2367,7 +2660,9 @@ var PaginationState = class {
|
|
|
2367
2660
|
* On failure the page stays active and {@link activePageRequest} resolves to
|
|
2368
2661
|
* it, so a wrapping `<Request>` renders its error block. Calling again (for
|
|
2369
2662
|
* example clicking the page's link a second time) retries: the failed page
|
|
2370
|
-
* is re-requested with a forced reload.
|
|
2663
|
+
* is re-requested with a forced reload. In development, a document that
|
|
2664
|
+
* contradicts the collection's page numbers rejects instead (see
|
|
2665
|
+
* {@link adoptPage}).
|
|
2371
2666
|
*
|
|
2372
2667
|
* ```gts
|
|
2373
2668
|
* <EachLink @pages={{pages}}>
|
|
@@ -2391,12 +2686,8 @@ var PaginationState = class {
|
|
|
2391
2686
|
method: "GET",
|
|
2392
2687
|
url
|
|
2393
2688
|
});
|
|
2394
|
-
cache.loadPage(url, request);
|
|
2395
|
-
|
|
2396
|
-
await page.request;
|
|
2397
|
-
} catch {
|
|
2398
|
-
return null;
|
|
2399
|
-
}
|
|
2689
|
+
await cache.loadPage(url, request);
|
|
2690
|
+
if (!page.isSuccess) return null;
|
|
2400
2691
|
}
|
|
2401
2692
|
return page.value;
|
|
2402
2693
|
};
|
|
@@ -2423,6 +2714,8 @@ const PaginationStateCache = /* @__PURE__ */ new WeakMap();
|
|
|
2423
2714
|
* await pages.loadNext();
|
|
2424
2715
|
* ```
|
|
2425
2716
|
*
|
|
2717
|
+
* @summary Experimental: returns the pagination state for a request, creating it on first call and returning the
|
|
2718
|
+
* same instance for the same request thereafter.
|
|
2426
2719
|
* @since 5.9.0
|
|
2427
2720
|
* @public
|
|
2428
2721
|
*/
|
|
@@ -2456,6 +2749,8 @@ const PaginationLinksCache = /* @__PURE__ */ new WeakMap();
|
|
|
2456
2749
|
* </EachLink>
|
|
2457
2750
|
* ```
|
|
2458
2751
|
*
|
|
2752
|
+
* @summary Experimental: a numbered page link with its page number, whether it is current, its distance from the
|
|
2753
|
+
* active page, and `setActive` to load and show that page.
|
|
2459
2754
|
* @since 5.9.0
|
|
2460
2755
|
* @public
|
|
2461
2756
|
* @hideconstructor
|
|
@@ -2505,6 +2800,8 @@ var RealPaginationLink = class {
|
|
|
2505
2800
|
* </EachLink>
|
|
2506
2801
|
* ```
|
|
2507
2802
|
*
|
|
2803
|
+
* @summary Experimental: a non-navigable gap marker in numbered pagination links, standing in for a range of
|
|
2804
|
+
* not-yet-loaded pages, usually shown as an ellipsis.
|
|
2508
2805
|
* @since 5.9.0
|
|
2509
2806
|
* @public
|
|
2510
2807
|
* @hideconstructor
|
|
@@ -2557,6 +2854,8 @@ var PlaceholderPaginationLink = class {
|
|
|
2557
2854
|
* </EachLink>
|
|
2558
2855
|
* ```
|
|
2559
2856
|
*
|
|
2857
|
+
* @summary Experimental: a `first`, `prev`, `next`, or `last` link relative to the active page, with `setActive`
|
|
2858
|
+
* to load it, and the only kind of link cursor-based pagination has.
|
|
2560
2859
|
* @since 5.9.0
|
|
2561
2860
|
* @public
|
|
2562
2861
|
* @hideconstructor
|
|
@@ -2608,6 +2907,9 @@ var RelationalPaginationLink = class {
|
|
|
2608
2907
|
* }
|
|
2609
2908
|
* }
|
|
2610
2909
|
* ```
|
|
2910
|
+
*
|
|
2911
|
+
* @summary Experimental: an entry in the numbered pagination links list, either a navigable numbered link or a
|
|
2912
|
+
* placeholder for a gap, told apart by `isReal`.
|
|
2611
2913
|
*/
|
|
2612
2914
|
/**
|
|
2613
2915
|
* The reactive set of navigation links derived from a {@link PaginationState}.
|
|
@@ -2637,6 +2939,8 @@ var RelationalPaginationLink = class {
|
|
|
2637
2939
|
* - {@link PlaceholderPaginationLink}
|
|
2638
2940
|
* - {@link RelationalPaginationLink}
|
|
2639
2941
|
*
|
|
2942
|
+
* @summary Experimental: the reactive navigation links for a pagination state, with numbered links and gap
|
|
2943
|
+
* placeholders plus `first`, `prev`, `next`, and `last` links for the active page.
|
|
2640
2944
|
* @since 5.9.0
|
|
2641
2945
|
* @public
|
|
2642
2946
|
* @hideconstructor
|
|
@@ -2748,6 +3052,8 @@ var PaginationLinks = class {
|
|
|
2748
3052
|
* }
|
|
2749
3053
|
* ```
|
|
2750
3054
|
*
|
|
3055
|
+
* @summary Experimental: returns the navigation links for a paged pagination state, creating them on first call and
|
|
3056
|
+
* returning the same instance for the same state.
|
|
2751
3057
|
* @since 5.9.0
|
|
2752
3058
|
* @public
|
|
2753
3059
|
*/
|
|
@@ -2765,29 +3071,46 @@ function getPaginationLinks(state) {
|
|
|
2765
3071
|
/**
|
|
2766
3072
|
* The content features available in both pagination modes: the state and
|
|
2767
3073
|
* controls of the initial request.
|
|
3074
|
+
*
|
|
3075
|
+
* @summary Experimental: the request status flags and controls, like `isRefreshing`, `refresh`, and `reload`,
|
|
3076
|
+
* that `<Paginate />` yields to its content block in both modes.
|
|
2768
3077
|
*/
|
|
2769
3078
|
/**
|
|
2770
3079
|
* The content features yielded in `'paged'` mode: navigation happens by
|
|
2771
3080
|
* loading a specific page.
|
|
3081
|
+
*
|
|
3082
|
+
* @summary Experimental: the request controls `<Paginate />` yields to its content block in paged mode, adding
|
|
3083
|
+
* `loadPage` to navigate to a page by URL.
|
|
2772
3084
|
*/
|
|
2773
3085
|
/**
|
|
2774
3086
|
* The content features yielded in `'infinite'` mode: navigation happens by
|
|
2775
3087
|
* extending the loaded run at either end.
|
|
3088
|
+
*
|
|
3089
|
+
* @summary Experimental: the request controls `<Paginate />` yields to its content block in infinite mode, adding
|
|
3090
|
+
* `loadNext` and `loadPrev` to extend the loaded pages.
|
|
2776
3091
|
*/
|
|
2777
3092
|
/**
|
|
2778
3093
|
* The full set of content features a {@link PaginationSubscription} builds —
|
|
2779
3094
|
* both modes' surfaces. The `<Paginate />` component narrows this to one mode
|
|
2780
3095
|
* via {@link PaginationContentFeaturesFor} before yielding.
|
|
3096
|
+
*
|
|
3097
|
+
* @summary Experimental: the combined paged and infinite content features a pagination subscription builds, before
|
|
3098
|
+
* `<Paginate />` narrows them to one mode.
|
|
2781
3099
|
*/
|
|
2782
3100
|
/**
|
|
2783
3101
|
* Resolves a {@link PaginateMode} to the content features it exposes. Mirror of
|
|
2784
3102
|
* {@link PaginationStateFor}.
|
|
3103
|
+
*
|
|
3104
|
+
* @summary Experimental: resolves a pagination mode to the content features `<Paginate />` yields, the infinite
|
|
3105
|
+
* set for `'infinite'` and the paged set otherwise.
|
|
2785
3106
|
*/
|
|
2786
3107
|
/**
|
|
2787
3108
|
* Lifecycle glue for the `<Paginate />` component. Owns the initial
|
|
2788
3109
|
* {@link RequestSubscription} (loading/error state, autorefresh, disposal) and
|
|
2789
3110
|
* the per-component {@link PaginationState} that it hands to the component.
|
|
2790
3111
|
*
|
|
3112
|
+
* @summary Experimental: the lifecycle core of `<Paginate />`, owning the initial request subscription and the
|
|
3113
|
+
* component's pagination state.
|
|
2791
3114
|
* @since 5.9.0
|
|
2792
3115
|
* @public
|
|
2793
3116
|
* @hideconstructor
|
|
@@ -3049,6 +3372,8 @@ defineSignal(PaginationSubscription.prototype, "_navRequest", null);
|
|
|
3049
3372
|
* subscription[DISPOSE](); // tear down when the owning component unmounts
|
|
3050
3373
|
* ```
|
|
3051
3374
|
*
|
|
3375
|
+
* @summary Experimental: creates the subscription that manages a `<Paginate />` component's initial request
|
|
3376
|
+
* lifecycle and pagination state, for managing that lifecycle yourself.
|
|
3052
3377
|
* @since 5.9.0
|
|
3053
3378
|
* @public
|
|
3054
3379
|
*/
|
|
@@ -3080,6 +3405,8 @@ function _DISPOSE$1() {
|
|
|
3080
3405
|
* `<Paginate />` component, so they stay in sync as pages load and the active
|
|
3081
3406
|
* page changes.
|
|
3082
3407
|
*
|
|
3408
|
+
* @summary Experimental: the framework-agnostic lifecycle core of a pagination links component such as
|
|
3409
|
+
* `<EachLink />`, exposing the navigation links for a paged pagination state.
|
|
3083
3410
|
* @since 5.9.0
|
|
3084
3411
|
* @public
|
|
3085
3412
|
* @hideconstructor
|
|
@@ -3121,6 +3448,8 @@ var PaginationLinksSubscription = class {
|
|
|
3121
3448
|
* subscription[DISPOSE](); // tear down when the owning component unmounts
|
|
3122
3449
|
* ```
|
|
3123
3450
|
*
|
|
3451
|
+
* @summary Experimental: creates the subscription a pagination links component such as `<EachLink />` uses to
|
|
3452
|
+
* derive navigation links from a paged pagination state.
|
|
3124
3453
|
* @since 5.9.0
|
|
3125
3454
|
* @public
|
|
3126
3455
|
*/
|
|
@@ -3142,18 +3471,24 @@ const PromiseCache = /* @__PURE__ */ new WeakMap();
|
|
|
3142
3471
|
* The state of a promise in the "pending"
|
|
3143
3472
|
* state. This is the default initial state.
|
|
3144
3473
|
*
|
|
3474
|
+
* @summary The `getPromiseState` state for a promise that has not yet settled, with `isPending` true and
|
|
3475
|
+
* no value or reason.
|
|
3145
3476
|
*/
|
|
3146
3477
|
/**
|
|
3147
3478
|
* The state of a promise in the "fulfilled" state.
|
|
3148
3479
|
* This is the state of a promise that has resolved
|
|
3149
3480
|
* successfully.
|
|
3150
3481
|
*
|
|
3482
|
+
* @summary The `getPromiseState` state for a promise that resolved, with `isSuccess` true and the
|
|
3483
|
+
* resolved `value`.
|
|
3151
3484
|
*/
|
|
3152
3485
|
/**
|
|
3153
3486
|
* The state of a promise in the "rejected" state.
|
|
3154
3487
|
* This is the state of a promise that has rejected
|
|
3155
3488
|
* with an error.
|
|
3156
3489
|
*
|
|
3490
|
+
* @summary The `getPromiseState` state for a promise that rejected, with `isError` true and the
|
|
3491
|
+
* rejection `reason`.
|
|
3157
3492
|
*/
|
|
3158
3493
|
/**
|
|
3159
3494
|
* The state of a promise. This is the type that is returned
|
|
@@ -3164,6 +3499,8 @@ const PromiseCache = /* @__PURE__ */ new WeakMap();
|
|
|
3164
3499
|
* - {@link ResolvedPromise}
|
|
3165
3500
|
* - {@link RejectedPromise}
|
|
3166
3501
|
*
|
|
3502
|
+
* @summary The reactive pending, fulfilled, or rejected state of a promise, as returned by
|
|
3503
|
+
* `getPromiseState`.
|
|
3167
3504
|
*/
|
|
3168
3505
|
const PromiseStateProto = {};
|
|
3169
3506
|
defineSignal(PromiseStateProto, "reason", null);
|
|
@@ -3229,6 +3566,9 @@ function getPromise(promise) {
|
|
|
3229
3566
|
/**
|
|
3230
3567
|
* Returns a reactive state-machine for the provided promise or awaitable.
|
|
3231
3568
|
*
|
|
3569
|
+
* The [Async as Reactive State](/guides/the-manual/reactivity/derivation) guide shows
|
|
3570
|
+
* how to use it in place of tracked loading and error state.
|
|
3571
|
+
*
|
|
3232
3572
|
* Repeat calls to `getPromiseState` with the same promise will return the same state object
|
|
3233
3573
|
* making is safe and easy to use in templates and JavaScript code to produce reactive
|
|
3234
3574
|
* behaviors around promises.
|
|
@@ -3278,6 +3618,9 @@ function getPromise(promise) {
|
|
|
3278
3618
|
* If looking to use in a template, consider also the `<Await />` component.
|
|
3279
3619
|
*
|
|
3280
3620
|
* See also {@link PromiseState}
|
|
3621
|
+
*
|
|
3622
|
+
* @summary Returns a cached, reactive state object tracking whether a promise is pending, fulfilled, or
|
|
3623
|
+
* rejected, for use in JS or templates.
|
|
3281
3624
|
*/
|
|
3282
3625
|
function getPromiseState(promise) {
|
|
3283
3626
|
const _promise = getPromise(promise);
|
|
@@ -3291,4 +3634,4 @@ function getPromiseState(promise) {
|
|
|
3291
3634
|
|
|
3292
3635
|
//#endregion
|
|
3293
3636
|
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 };
|
|
3294
|
-
//# sourceMappingURL=-private-
|
|
3637
|
+
//# sourceMappingURL=-private-DKVDMUfT.js.map
|