@warp-drive-mirror/core 5.10.0-alpha.12 → 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 +32 -0
- 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-CnlWuUd5.d.ts → fields-D6173Q_a.d.ts} +126 -5
- 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-DBnp5uP6.d.ts → internal-CgOlgOt3.d.ts} +496 -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-B9WcEdYg.js → src-DlNeupkA.js} +221 -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-CkkrRFE1.js → src-FSk0Z_Lp.js} +212 -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-oz6OaQXu.js → src-Isk_Je7q.js} +214 -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-BGKCOL5L.js → src-CoSpuocQ.js} +212 -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-CGypdIsf.js → src-FK_rMde5.js} +214 -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-CnlWuUd5.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-DBnp5uP6.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-B9WcEdYg.js.map +0 -1
- package/dist/store-DNF9Rgoh.js.map +0 -1
- package/dist/symbols-DjRDCeX0.d.ts.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-CkkrRFE1.js.map +0 -1
- package/dist/unpkg/dev/store-BIFNM_fB.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-oz6OaQXu.js.map +0 -1
- package/dist/unpkg/dev-deprecated/store-X1WN7P_O.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-BGKCOL5L.js.map +0 -1
- package/dist/unpkg/prod/store-BWhmb7Ob.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-CGypdIsf.js.map +0 -1
- package/dist/unpkg/prod-deprecated/store-BWhmb7Ob.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-MiwUbGdT.js";
|
|
3
3
|
import { getGlobalConfig, macroCondition } from "@embroider/macros";
|
|
4
4
|
|
|
5
5
|
//#region src/signals/reactivity/configure.ts
|
|
@@ -34,6 +34,8 @@ const OBJECT_SIGNAL = getOrSetGlobal("#{}", Symbol("#{}"));
|
|
|
34
34
|
* scenarios you may also be interested in integrating with the {@link NotificationManager}
|
|
35
35
|
* more directly.
|
|
36
36
|
*
|
|
37
|
+
* @summary The create, consume, notify, and memo hooks a framework or TC39 signals implementation
|
|
38
|
+
* supplies to `setupSignals` to make WarpDrive data reactive.
|
|
37
39
|
* @public
|
|
38
40
|
*/
|
|
39
41
|
/**
|
|
@@ -49,6 +51,8 @@ const OBJECT_SIGNAL = getOrSetGlobal("#{}", Symbol("#{}"));
|
|
|
49
51
|
* }
|
|
50
52
|
* ```
|
|
51
53
|
*
|
|
54
|
+
* @summary The options passed to the `setupSignals` callback, including the well-known key WarpDrive
|
|
55
|
+
* uses for an array's contents signal.
|
|
52
56
|
* @public
|
|
53
57
|
*/
|
|
54
58
|
/**
|
|
@@ -61,6 +65,8 @@ const OBJECT_SIGNAL = getOrSetGlobal("#{}", Symbol("#{}"));
|
|
|
61
65
|
* See {@link SignalHooks} for the implementation the callback function should
|
|
62
66
|
* return.
|
|
63
67
|
*
|
|
68
|
+
* @summary Registers the signal hooks WarpDrive uses for reactivity, built by a callback that receives
|
|
69
|
+
* `HooksOptions`.
|
|
64
70
|
* @public
|
|
65
71
|
* @param buildConfig - a function that takes options and returns a configuration object
|
|
66
72
|
*/
|
|
@@ -615,6 +621,8 @@ async function watchStream(stream, loadingState) {
|
|
|
615
621
|
* reactive properties that can be used to build UIs that respond
|
|
616
622
|
* to the progress of a request.
|
|
617
623
|
*
|
|
624
|
+
* @summary Reactive download progress for a request, such as bytes loaded and timing, built by lazily
|
|
625
|
+
* reading its response stream.
|
|
618
626
|
* @hideconstructor
|
|
619
627
|
*/
|
|
620
628
|
var RequestLoadingState = class {
|
|
@@ -833,9 +841,11 @@ defineNonEnumerableSignal(RequestLoadingState.prototype, "_lastPacketTime", 0);
|
|
|
833
841
|
*
|
|
834
842
|
*/
|
|
835
843
|
/**
|
|
836
|
-
* The state of a request
|
|
837
|
-
*
|
|
838
|
-
* cancelled
|
|
844
|
+
* The state of a request that was aborted before it settled.
|
|
845
|
+
*
|
|
846
|
+
* A cancelled request has `status: 'cancelled'` and its `reason` is an
|
|
847
|
+
* `AbortError`. `isError` is also `true`, as for a {@link RejectedRequest},
|
|
848
|
+
* so check `status` or `isCancelled` to tell the two apart.
|
|
839
849
|
*
|
|
840
850
|
*/
|
|
841
851
|
/**
|
|
@@ -869,6 +879,8 @@ defineNonEnumerableSignal(RequestLoadingState.prototype, "_lastPacketTime", 0);
|
|
|
869
879
|
* - {@link RejectedRequest}
|
|
870
880
|
* - {@link CancelledRequest}
|
|
871
881
|
*
|
|
882
|
+
* @summary The reactive pending, fulfilled, rejected, or cancelled state of a request `Future`, as
|
|
883
|
+
* returned by `getRequestState`.
|
|
872
884
|
*/
|
|
873
885
|
const RequestStateProto = {};
|
|
874
886
|
function performRefresh(requester, request, isReload) {
|
|
@@ -923,7 +935,7 @@ function createRequestState(future) {
|
|
|
923
935
|
if (state.isError) {
|
|
924
936
|
promiseState.error = state.result;
|
|
925
937
|
promiseState.reason = state.result;
|
|
926
|
-
promiseState.status = "rejected";
|
|
938
|
+
promiseState.status = isAbortError(state.result) ? "cancelled" : "rejected";
|
|
927
939
|
promiseState.isError = true;
|
|
928
940
|
promiseState.isPending = false;
|
|
929
941
|
promiseState.isLoading = false;
|
|
@@ -959,7 +971,7 @@ function createRequestState(future) {
|
|
|
959
971
|
});
|
|
960
972
|
promiseState.error = error;
|
|
961
973
|
promiseState.reason = error;
|
|
962
|
-
promiseState.status = "rejected";
|
|
974
|
+
promiseState.status = isAbortError(error) ? "cancelled" : "rejected";
|
|
963
975
|
promiseState.isError = true;
|
|
964
976
|
promiseState.isPending = false;
|
|
965
977
|
promiseState.isLoading = false;
|
|
@@ -971,6 +983,26 @@ function createRequestState(future) {
|
|
|
971
983
|
/**
|
|
972
984
|
* `getRequestState` can be used in both JavaScript and Template contexts.
|
|
973
985
|
*
|
|
986
|
+
* It returns a {@link RequestState}: a reactive object that updates as the
|
|
987
|
+
* request advances. Calling it again with the same {@link Future} returns the
|
|
988
|
+
* same object. Check `status` to narrow it to one of four states:
|
|
989
|
+
*
|
|
990
|
+
* - {@link PendingRequest} (`'pending'`) is the initial state, before the
|
|
991
|
+
* request settles.
|
|
992
|
+
* - {@link ResolvedRequest} (`'fulfilled'`) holds the response content on `value`.
|
|
993
|
+
* - {@link RejectedRequest} (`'rejected'`) holds the error on `reason`.
|
|
994
|
+
* - {@link CancelledRequest} (`'cancelled'`) is a request that was aborted.
|
|
995
|
+
* `isError` is also `true` for a cancelled request, so check `status` or
|
|
996
|
+
* `isCancelled` rather than `isError` if you handle it differently.
|
|
997
|
+
*
|
|
998
|
+
* Every state also exposes a {@link RequestLoadingState} on `loadingState`
|
|
999
|
+
* for tracking the progress of the response stream.
|
|
1000
|
+
*
|
|
1001
|
+
* The [Reactive Control Flow](/guides/the-manual/reactivity/control-flow) guide shows
|
|
1002
|
+
* how to render request states with it, and
|
|
1003
|
+
* [Using The Response](/guides/the-manual/requests/using-the-response) covers the
|
|
1004
|
+
* `Future` it reads.
|
|
1005
|
+
*
|
|
974
1006
|
* ```ts
|
|
975
1007
|
* import { getRequestState } from '@warp-drive-mirror/ember';
|
|
976
1008
|
*
|
|
@@ -1017,6 +1049,10 @@ function createRequestState(future) {
|
|
|
1017
1049
|
* which offers a number of additional capabilities for requests *beyond* what
|
|
1018
1050
|
* `RequestState` provides.
|
|
1019
1051
|
*
|
|
1052
|
+
* @param future - the request {@link Future} to track, as returned by `store.request` or `requestManager.request`
|
|
1053
|
+
* @return the cached {@link RequestState} for `future`
|
|
1054
|
+
* @summary Returns a cached, reactive state object tracking a request `Future` through pending, success,
|
|
1055
|
+
* error, and cancellation.
|
|
1020
1056
|
*/
|
|
1021
1057
|
function getRequestState(future) {
|
|
1022
1058
|
let state = RequestCache.get(future);
|
|
@@ -1092,28 +1128,47 @@ function isNeverString(val) {
|
|
|
1092
1128
|
/**
|
|
1093
1129
|
* The individual autorefresh strategies a {@link RequestSubscription}
|
|
1094
1130
|
* may combine, see {@link AutorefreshBehaviorCombos}.
|
|
1131
|
+
*
|
|
1132
|
+
* @summary One autorefresh trigger for a request subscription: on reconnecting (`online`), on a timer
|
|
1133
|
+
* (`interval`), or on store invalidation (`invalid`).
|
|
1095
1134
|
*/
|
|
1096
1135
|
/**
|
|
1097
1136
|
* The value accepted by {@link SubscriptionArgs.autorefresh}: either a
|
|
1098
1137
|
* boolean, a single {@link AutorefreshBehaviorType}, or a comma-separated
|
|
1099
1138
|
* combination of up to three of them.
|
|
1139
|
+
*
|
|
1140
|
+
* @summary The accepted values for a request subscription's `autorefresh` option: a boolean or a
|
|
1141
|
+
* comma-separated mix of `online`, `interval`, and `invalid`.
|
|
1100
1142
|
*/
|
|
1101
1143
|
/**
|
|
1102
1144
|
* Utilities to assist in recovering from the error.
|
|
1145
|
+
*
|
|
1146
|
+
* @summary The online and visibility state plus a `retry` function that a request subscription exposes
|
|
1147
|
+
* for recovering from a failed request.
|
|
1103
1148
|
*/
|
|
1104
1149
|
/** @deprecated use {@link RecoveryFeatures} */
|
|
1105
1150
|
/**
|
|
1106
1151
|
* Utilities for keeping the request fresh
|
|
1152
|
+
*
|
|
1153
|
+
* @summary The online, visibility, and refreshing state plus `refresh`, `reload`, and `abort` functions a
|
|
1154
|
+
* request subscription exposes alongside successful content.
|
|
1107
1155
|
*/
|
|
1108
1156
|
/**
|
|
1109
1157
|
* The args accepted by the `<Request />` component.
|
|
1158
|
+
*
|
|
1159
|
+
* @summary The arguments of the `<Request />` component: the request or query to run, autorefresh
|
|
1160
|
+
* options, and an optional store or subscription.
|
|
1110
1161
|
*/
|
|
1111
1162
|
/**
|
|
1112
1163
|
* The args accepted by a {@link RequestSubscription}.
|
|
1164
|
+
*
|
|
1165
|
+
* @summary Options for a request subscription: the request or query to monitor and its autorefresh settings.
|
|
1113
1166
|
*/
|
|
1114
1167
|
/**
|
|
1115
1168
|
* A reactive class
|
|
1116
1169
|
*
|
|
1170
|
+
* @summary Reactive subscription that monitors a request or query, tracking online, visibility and refresh state and
|
|
1171
|
+
* handling autorefresh, reload and retry.
|
|
1117
1172
|
* @hideconstructor
|
|
1118
1173
|
*/
|
|
1119
1174
|
var RequestSubscription = class {
|
|
@@ -1544,6 +1599,9 @@ function isStore(store) {
|
|
|
1544
1599
|
/**
|
|
1545
1600
|
* Creates a {@link RequestSubscription}, the reactive class powering the
|
|
1546
1601
|
* `<Request />` component's autorefresh, retry, and refresh behaviors.
|
|
1602
|
+
*
|
|
1603
|
+
* @summary Creates a reactive subscription to a request or query that tracks its state and handles
|
|
1604
|
+
* autorefresh, retry, and refresh.
|
|
1547
1605
|
*/
|
|
1548
1606
|
function createRequestSubscription(store, args) {
|
|
1549
1607
|
return new RequestSubscription(store, args);
|
|
@@ -1610,6 +1668,8 @@ function getHref(link) {
|
|
|
1610
1668
|
* }
|
|
1611
1669
|
* ```
|
|
1612
1670
|
*
|
|
1671
|
+
* @summary Experimental: one page of a paginated collection, exposing its request, loading and error status, data,
|
|
1672
|
+
* and links to neighboring pages.
|
|
1613
1673
|
* @since 5.9.0
|
|
1614
1674
|
* @public
|
|
1615
1675
|
* @hideconstructor
|
|
@@ -1792,63 +1852,209 @@ var PageCache = class {
|
|
|
1792
1852
|
decorateMethodV2(this.prototype, "isLinked", [memoized]);
|
|
1793
1853
|
}
|
|
1794
1854
|
async load(request) {
|
|
1855
|
+
this.request = request;
|
|
1856
|
+
this.state = getRequestState(this.request);
|
|
1857
|
+
let content;
|
|
1858
|
+
try {
|
|
1859
|
+
content = (await this.request).content;
|
|
1860
|
+
} catch {
|
|
1861
|
+
return null;
|
|
1862
|
+
}
|
|
1863
|
+
this.applyDocument(content);
|
|
1864
|
+
return content;
|
|
1865
|
+
}
|
|
1866
|
+
/**
|
|
1867
|
+
* Re-applies an already-loaded page from a newer request for the same page
|
|
1868
|
+
* (a reload, or a route-driven navigation back to it). The newer document is
|
|
1869
|
+
* authoritative: its links and page hints replace the ones recorded from
|
|
1870
|
+
* the earlier load, and the collection total is updated from it. The page
|
|
1871
|
+
* keeps its current request until the newer one resolves, so a page on
|
|
1872
|
+
* screen does not flash a loading state; a rejected request leaves the
|
|
1873
|
+
* page untouched.
|
|
1874
|
+
*
|
|
1875
|
+
* @internal
|
|
1876
|
+
*/
|
|
1877
|
+
async update(request) {
|
|
1878
|
+
const state = getRequestState(request);
|
|
1879
|
+
let content;
|
|
1795
1880
|
try {
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1881
|
+
content = (await request).content;
|
|
1882
|
+
} catch {
|
|
1883
|
+
return null;
|
|
1884
|
+
}
|
|
1885
|
+
this.request = request;
|
|
1886
|
+
this.state = state;
|
|
1887
|
+
this.applyDocument(content);
|
|
1888
|
+
return content;
|
|
1889
|
+
}
|
|
1890
|
+
/**
|
|
1891
|
+
* Records a loaded document's links and page number, and links this page
|
|
1892
|
+
* into the shared page graph.
|
|
1893
|
+
*
|
|
1894
|
+
* The document is authoritative for what it states: a link it names
|
|
1895
|
+
* explicitly (including an explicit `null`) overwrites whatever a neighbor
|
|
1896
|
+
* or an earlier load of this page recorded, and a link it omits is kept.
|
|
1897
|
+
* `next`/`prev` name the adjacent pages; `first`/`last` name the ends of
|
|
1898
|
+
* the collection, beyond which nothing may remain linked.
|
|
1899
|
+
*
|
|
1900
|
+
* For a numbered collection the document must also agree with the page
|
|
1901
|
+
* numbers: `next` is the page after this one, `prev` the page before, a
|
|
1902
|
+
* page without `prev` is page 1, a page without `next` is the last page,
|
|
1903
|
+
* `first` is page 1 and `last` is page `totalPages`. A document that
|
|
1904
|
+
* contradicts this is a server (or collection-mixing) bug and is asserted
|
|
1905
|
+
* in development, before anything is recorded from it. A cursor collection
|
|
1906
|
+
* has no numbers, so there its links are the only authority.
|
|
1907
|
+
*
|
|
1908
|
+
* @internal
|
|
1909
|
+
*/
|
|
1910
|
+
applyDocument(content) {
|
|
1911
|
+
const links = content?.links ?? {};
|
|
1912
|
+
const self = getHref(content?.links?.self);
|
|
1913
|
+
const first = getHref(content?.links?.first);
|
|
1914
|
+
const last = getHref(content?.links?.last);
|
|
1915
|
+
const next = getHref(content?.links?.next);
|
|
1916
|
+
const prev = getHref(content?.links?.prev);
|
|
1917
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
1918
|
+
if (!test) throw new Error("Expected the page to have a self link");
|
|
1919
|
+
})(self);
|
|
1920
|
+
const { currentPage, totalPages } = this.manager.readPageHints(content);
|
|
1921
|
+
const firstPage = first ? this.manager.getPageCache(first) : null;
|
|
1922
|
+
const lastPage = last ? this.manager.getPageCache(last) : null;
|
|
1923
|
+
const prevPage = prev ? this.manager.getPageCache(prev) : null;
|
|
1924
|
+
const nextPage = next ? this.manager.getPageCache(next) : null;
|
|
1925
|
+
if (this.manager.isNumbered) {
|
|
1926
|
+
const ownNumber = (page) => page === this ? currentPage : page.pageNumber;
|
|
1804
1927
|
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
1805
|
-
if (!test) throw new Error(
|
|
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
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1928
|
+
if (!test) throw new Error(`Page ${self} is page ${currentPage} but the collection has ${totalPages} pages: it lies beyond the collection total`);
|
|
1929
|
+
})(!currentPage || !totalPages || currentPage <= totalPages);
|
|
1930
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
1931
|
+
if (!test) throw new Error(`Page ${self} is page ${currentPage} and has no prev link but is not the first page`);
|
|
1932
|
+
})(!("prev" in links && !prev && currentPage > 1));
|
|
1933
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
1934
|
+
if (!test) throw new Error(`Page ${self} is page ${currentPage} of ${totalPages} and has no next link but is not the last page`);
|
|
1935
|
+
})(!("next" in links && !next && currentPage > 0 && totalPages > 0 && currentPage < totalPages));
|
|
1936
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
1937
|
+
if (!test) throw new Error(`Page ${self} is page ${currentPage} but its next link names page ${nextPage ? ownNumber(nextPage) : 0}, expected page ${currentPage + 1}`);
|
|
1938
|
+
})(!nextPage || !currentPage || !ownNumber(nextPage) || ownNumber(nextPage) === currentPage + 1);
|
|
1939
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
1940
|
+
if (!test) throw new Error(`Page ${self} is page ${currentPage} but its prev link names page ${prevPage ? ownNumber(prevPage) : 0}, expected page ${currentPage - 1}`);
|
|
1941
|
+
})(!prevPage || !currentPage || !ownNumber(prevPage) || ownNumber(prevPage) === currentPage - 1);
|
|
1942
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
1943
|
+
if (!test) throw new Error(`Page ${self} has a first link that names page ${firstPage ? ownNumber(firstPage) : 0}, expected page 1`);
|
|
1944
|
+
})(!firstPage || !ownNumber(firstPage) || ownNumber(firstPage) === 1);
|
|
1945
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
1946
|
+
if (!test) throw new Error(`Page ${self} has a last link that names page ${lastPage ? ownNumber(lastPage) : 0}, expected the last page ${totalPages}`);
|
|
1947
|
+
})(!lastPage || !totalPages || !ownNumber(lastPage) || ownNumber(lastPage) === totalPages);
|
|
1948
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
1949
|
+
if (!test) throw new Error(`Page ${self} has a first link to ${first} but that first page has a page linked before it`);
|
|
1950
|
+
})(!firstPage?.before);
|
|
1951
|
+
}
|
|
1952
|
+
if (currentPage) this.pageNumber = currentPage;
|
|
1953
|
+
this.manager.totalPages = totalPages;
|
|
1954
|
+
const stated = {};
|
|
1955
|
+
if ("first" in links) stated.first = first;
|
|
1956
|
+
if ("last" in links) stated.last = last;
|
|
1957
|
+
if ("next" in links) stated.next = next;
|
|
1958
|
+
if ("prev" in links) stated.prev = prev;
|
|
1959
|
+
this.updateLinks(stated);
|
|
1960
|
+
if ("next" in links && !next) {
|
|
1961
|
+
const after = this.after;
|
|
1962
|
+
this.detachAfter();
|
|
1963
|
+
if (after?.prevLink === self) after.updateLinks({ prev: null });
|
|
1964
|
+
}
|
|
1965
|
+
if ("prev" in links && !prev) {
|
|
1966
|
+
const before = this.before;
|
|
1967
|
+
this.detachBefore();
|
|
1968
|
+
if (before?.nextLink === self) before.updateLinks({ next: null });
|
|
1969
|
+
}
|
|
1970
|
+
if (lastPage) {
|
|
1971
|
+
lastPage.detachAfter();
|
|
1972
|
+
lastPage.updateLinks({ next: null });
|
|
1973
|
+
}
|
|
1974
|
+
if (firstPage) {
|
|
1975
|
+
firstPage.detachBefore();
|
|
1976
|
+
firstPage.updateLinks({ prev: null });
|
|
1977
|
+
}
|
|
1978
|
+
if (firstPage) {
|
|
1979
|
+
firstPage.setPageNumber(1);
|
|
1980
|
+
if (firstPage !== this && !firstPage.after) this.linkFirst(firstPage);
|
|
1981
|
+
}
|
|
1982
|
+
if (lastPage) {
|
|
1983
|
+
lastPage.setPageNumber(this.manager.totalPages);
|
|
1984
|
+
if (lastPage !== this && !lastPage.before) this.linkLast(lastPage);
|
|
1985
|
+
}
|
|
1986
|
+
if (nextPage) {
|
|
1987
|
+
nextPage.setPageNumber(this.pageNumber + 1);
|
|
1988
|
+
nextPage.updateLinks({ prev: self });
|
|
1989
|
+
}
|
|
1990
|
+
if (prevPage) {
|
|
1991
|
+
prevPage.setPageNumber(this.pageNumber - 1);
|
|
1992
|
+
prevPage.updateLinks({ next: self });
|
|
1993
|
+
}
|
|
1994
|
+
if (nextPage && this.after && this.after !== nextPage && this.after.pageNumber <= nextPage.pageNumber) this.detachAfter();
|
|
1995
|
+
if (prevPage && this.before && this.before !== prevPage && this.before.pageNumber >= prevPage.pageNumber) this.detachBefore();
|
|
1996
|
+
if (this.isLinked) {
|
|
1997
|
+
if (prevPage) prevPage.updateLinkage({ after: this });
|
|
1998
|
+
if (nextPage) nextPage.updateLinkage({ before: this });
|
|
1999
|
+
} else if (prevPage?.isLinked) {
|
|
2000
|
+
this.updateLinkage({ before: prevPage });
|
|
2001
|
+
if (nextPage) nextPage.updateLinkage({ before: this });
|
|
2002
|
+
} else if (nextPage?.isLinked) {
|
|
2003
|
+
this.updateLinkage({ after: nextPage });
|
|
2004
|
+
if (prevPage) prevPage.updateLinkage({ after: this });
|
|
2005
|
+
} else if ((prevPage || nextPage) && (firstPage || lastPage)) this.lookupLinkage(firstPage, lastPage);
|
|
2006
|
+
else if (prevPage || nextPage) this.updateLinkage({
|
|
2007
|
+
before: prevPage,
|
|
2008
|
+
after: nextPage
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
2011
|
+
/** @internal */
|
|
2012
|
+
detachAfter() {
|
|
2013
|
+
const after = this.after;
|
|
2014
|
+
if (after) {
|
|
2015
|
+
if (after.before === this) after.setBefore(null);
|
|
2016
|
+
this.setAfter(null);
|
|
2017
|
+
}
|
|
1850
2018
|
}
|
|
1851
2019
|
/** @internal */
|
|
2020
|
+
detachBefore() {
|
|
2021
|
+
const before = this.before;
|
|
2022
|
+
if (before) {
|
|
2023
|
+
if (before.after === this) before.setAfter(null);
|
|
2024
|
+
this.setBefore(null);
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
/**
|
|
2028
|
+
* Links an unlinked `first` page before the earliest page reachable
|
|
2029
|
+
* backwards from this one that must follow it.
|
|
2030
|
+
*
|
|
2031
|
+
* @internal
|
|
2032
|
+
*/
|
|
2033
|
+
linkFirst(firstPage) {
|
|
2034
|
+
let head = this;
|
|
2035
|
+
while (head.before && head.before !== firstPage && (!head.before.pageNumber || head.before.pageNumber > firstPage.pageNumber)) head = head.before;
|
|
2036
|
+
firstPage.updateLinkage({ after: head });
|
|
2037
|
+
}
|
|
2038
|
+
/**
|
|
2039
|
+
* Links an unlinked `last` page after the furthest page reachable forwards
|
|
2040
|
+
* from this one that must precede it.
|
|
2041
|
+
*
|
|
2042
|
+
* @internal
|
|
2043
|
+
*/
|
|
2044
|
+
linkLast(lastPage) {
|
|
2045
|
+
let tail = this;
|
|
2046
|
+
while (tail.after && tail.after !== lastPage && (!tail.after.pageNumber || !lastPage.pageNumber || tail.after.pageNumber < lastPage.pageNumber)) tail = tail.after;
|
|
2047
|
+
lastPage.updateLinkage({ before: tail });
|
|
2048
|
+
}
|
|
2049
|
+
/**
|
|
2050
|
+
* Places this page between `before` and `after` in the graph (a missing side
|
|
2051
|
+
* is taken from the given side's current neighbor, so a single side splices
|
|
2052
|
+
* this page in). Pointers this page or the displaced neighbors held to their
|
|
2053
|
+
* old positions are cleared first, so a page moved within the graph never
|
|
2054
|
+
* leaves a dangling link behind that could close a cycle.
|
|
2055
|
+
*
|
|
2056
|
+
* @internal
|
|
2057
|
+
*/
|
|
1852
2058
|
updateLinkage({ before, after }) {
|
|
1853
2059
|
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
1854
2060
|
if (!test) throw new Error("Expected at least one of before or after page states to link to this page");
|
|
@@ -1856,10 +2062,16 @@ var PageCache = class {
|
|
|
1856
2062
|
const leftSide = before ?? after?.before;
|
|
1857
2063
|
const rightSide = after ?? before?.after;
|
|
1858
2064
|
if (leftSide && leftSide !== this) {
|
|
2065
|
+
if (this.before !== leftSide) this.detachBefore();
|
|
2066
|
+
const displaced = leftSide.after;
|
|
2067
|
+
if (displaced && displaced !== this && displaced !== rightSide && displaced.before === leftSide) displaced.setBefore(null);
|
|
1859
2068
|
leftSide.setAfter(this);
|
|
1860
2069
|
this.setBefore(leftSide);
|
|
1861
2070
|
}
|
|
1862
2071
|
if (rightSide && rightSide !== this) {
|
|
2072
|
+
if (this.after !== rightSide) this.detachAfter();
|
|
2073
|
+
const displaced = rightSide.before;
|
|
2074
|
+
if (displaced && displaced !== this && displaced !== leftSide && displaced.after === rightSide) displaced.setAfter(null);
|
|
1863
2075
|
rightSide.setBefore(this);
|
|
1864
2076
|
this.setAfter(rightSide);
|
|
1865
2077
|
}
|
|
@@ -1899,16 +2111,18 @@ var PageCache = class {
|
|
|
1899
2111
|
})(page !== this);
|
|
1900
2112
|
this.after = page;
|
|
1901
2113
|
}
|
|
1902
|
-
/**
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
if (
|
|
1911
|
-
if (
|
|
2114
|
+
/**
|
|
2115
|
+
* Records the given links. Only the keys present are applied, so a caller
|
|
2116
|
+
* states exactly what it knows: an explicit `null` clears a link, an
|
|
2117
|
+
* omitted key leaves the recorded link alone.
|
|
2118
|
+
*
|
|
2119
|
+
* @internal
|
|
2120
|
+
*/
|
|
2121
|
+
updateLinks = (links) => {
|
|
2122
|
+
if ("prev" in links) this.prevLink = links.prev ?? null;
|
|
2123
|
+
if ("next" in links) this.nextLink = links.next ?? null;
|
|
2124
|
+
if ("first" in links) this.firstLink = links.first ?? null;
|
|
2125
|
+
if ("last" in links) this.lastLink = links.last ?? null;
|
|
1912
2126
|
};
|
|
1913
2127
|
/** @internal */
|
|
1914
2128
|
setPageNumber = (pageNumber) => {
|
|
@@ -1934,6 +2148,8 @@ const PaginationCacheMap = /* @__PURE__ */ new Map();
|
|
|
1934
2148
|
* collection must provide the same function reference — define it once at module
|
|
1935
2149
|
* scope and import it everywhere.
|
|
1936
2150
|
*
|
|
2151
|
+
* @summary Experimental: a function you pass to `<Paginate />` that reads `currentPage` and `totalPages` from a
|
|
2152
|
+
* loaded document when they are not in the default `meta` locations.
|
|
1937
2153
|
* @since 5.9.0
|
|
1938
2154
|
* @public
|
|
1939
2155
|
*/
|
|
@@ -1942,6 +2158,8 @@ const PaginationCacheMap = /* @__PURE__ */ new Map();
|
|
|
1942
2158
|
* document `meta`, matching the behavior used before `pageHints` was configurable.
|
|
1943
2159
|
* Used whenever the consumer does not provide a `pageHints` function.
|
|
1944
2160
|
*
|
|
2161
|
+
* @summary Experimental: the fallback page-hints function, reading `meta.page` or `meta.currentPage` and
|
|
2162
|
+
* `meta.totalPages` from a document, with `0` meaning unknown.
|
|
1945
2163
|
* @since 5.9.0
|
|
1946
2164
|
* @public
|
|
1947
2165
|
*/
|
|
@@ -1961,6 +2179,8 @@ const defaultPageHints = (document) => {
|
|
|
1961
2179
|
* interact with — the cache itself is plumbing shared between the pagination
|
|
1962
2180
|
* classes.
|
|
1963
2181
|
*
|
|
2182
|
+
* @summary Experimental: the shared, app-wide store of loaded pages, page order, and `totalPages` for one paginated
|
|
2183
|
+
* collection, keyed by its `first` or `self` link.
|
|
1964
2184
|
* @since 5.9.0
|
|
1965
2185
|
* @public
|
|
1966
2186
|
* @hideconstructor
|
|
@@ -2055,17 +2275,28 @@ var PaginationCache = class {
|
|
|
2055
2275
|
}
|
|
2056
2276
|
return page;
|
|
2057
2277
|
}
|
|
2058
|
-
/**
|
|
2059
|
-
|
|
2278
|
+
/**
|
|
2279
|
+
* Loads the page at `url` with `request` when it is not loaded (or its load
|
|
2280
|
+
* failed), or re-applies `request`'s document when it is a newer request
|
|
2281
|
+
* for an already-loaded page (a reload, or navigating back to it: the newer
|
|
2282
|
+
* document is authoritative for the page's links and the collection total,
|
|
2283
|
+
* which may have changed since the first load).
|
|
2284
|
+
*
|
|
2285
|
+
* Resolves to the page once that has settled. A rejected request settles
|
|
2286
|
+
* too — it is surfaced through the page's state, not thrown. The promise
|
|
2287
|
+
* rejects only when the document contradicts the collection (see
|
|
2288
|
+
* {@link PageCache.applyDocument}), so the caller that triggered the load
|
|
2289
|
+
* is the one that hears about it.
|
|
2290
|
+
*
|
|
2291
|
+
* @internal
|
|
2292
|
+
*/
|
|
2293
|
+
async loadPage(url, request) {
|
|
2060
2294
|
const page = this.getPageCache(url);
|
|
2061
2295
|
if ((!page.isLoaded || page.isError) && request) {
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
page.
|
|
2066
|
-
this.updateFirstPage(page);
|
|
2067
|
-
if (document) this.totalPages = this.getTotalPages(document);
|
|
2068
|
-
});
|
|
2296
|
+
await page.load(request);
|
|
2297
|
+
this.updateFirstPage(page);
|
|
2298
|
+
} else if (request && page.isSuccess && request !== page.request) {
|
|
2299
|
+
if (await page.update(request)) this.updateFirstPage(page);
|
|
2069
2300
|
}
|
|
2070
2301
|
return page;
|
|
2071
2302
|
}
|
|
@@ -2075,10 +2306,6 @@ var PaginationCache = class {
|
|
|
2075
2306
|
while (maybeFirstPage.before) maybeFirstPage = maybeFirstPage.before;
|
|
2076
2307
|
if (!this.firstPage || this.firstPage.pageNumber > maybeFirstPage.pageNumber) this.firstPage = maybeFirstPage;
|
|
2077
2308
|
}
|
|
2078
|
-
/** @internal */
|
|
2079
|
-
getTotalPages(document) {
|
|
2080
|
-
return this.readPageHints(document).totalPages;
|
|
2081
|
-
}
|
|
2082
2309
|
/**
|
|
2083
2310
|
* Every page known to the shared graph, in order — loaded pages and pages
|
|
2084
2311
|
* known only from links — across all components sharing the collection.
|
|
@@ -2094,14 +2321,13 @@ var PaginationCache = class {
|
|
|
2094
2321
|
* ```
|
|
2095
2322
|
*/
|
|
2096
2323
|
get pages() {
|
|
2097
|
-
const
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
} };
|
|
2324
|
+
const pages = [];
|
|
2325
|
+
let page = this.firstPage;
|
|
2326
|
+
while (page) {
|
|
2327
|
+
pages.push(page);
|
|
2328
|
+
page = page.after;
|
|
2329
|
+
}
|
|
2330
|
+
return pages;
|
|
2105
2331
|
}
|
|
2106
2332
|
/**
|
|
2107
2333
|
* The items of every loaded page in the shared graph, flattened into one
|
|
@@ -2115,10 +2341,9 @@ var PaginationCache = class {
|
|
|
2115
2341
|
decorateMethodV2(this.prototype, "pages", [memoized]);
|
|
2116
2342
|
}
|
|
2117
2343
|
get data() {
|
|
2118
|
-
const
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
} };
|
|
2344
|
+
const items = [];
|
|
2345
|
+
for (const page of this.pages) if (page.data) items.push(...page.data);
|
|
2346
|
+
return items;
|
|
2122
2347
|
}
|
|
2123
2348
|
static {
|
|
2124
2349
|
decorateMethodV2(this.prototype, "data", [memoized]);
|
|
@@ -2129,6 +2354,8 @@ var PaginationCache = class {
|
|
|
2129
2354
|
* `first` or `self` link). Returns the same instance for the same key for the
|
|
2130
2355
|
* lifetime of the module.
|
|
2131
2356
|
*
|
|
2357
|
+
* @summary Experimental: returns the shared pagination cache for a collection's `first` or `self` link, creating it
|
|
2358
|
+
* on first use.
|
|
2132
2359
|
* @since 5.9.0
|
|
2133
2360
|
* @public
|
|
2134
2361
|
*/
|
|
@@ -2145,6 +2372,7 @@ function getPaginationCache(key) {
|
|
|
2145
2372
|
* Primarily intended for test isolation, since the cache is keyed by url and
|
|
2146
2373
|
* otherwise persists for the lifetime of the module.
|
|
2147
2374
|
*
|
|
2375
|
+
* @summary Experimental: discards every shared pagination cache, mainly so tests start from a clean state.
|
|
2148
2376
|
* @since 5.9.0
|
|
2149
2377
|
* @public
|
|
2150
2378
|
*/
|
|
@@ -2161,25 +2389,40 @@ function clearPaginationCache() {
|
|
|
2161
2389
|
*
|
|
2162
2390
|
* - `'paged'` — single-page view, see {@link PagedPaginationState}.
|
|
2163
2391
|
* - `'infinite'` — accumulated view, see {@link InfinitePaginationState}.
|
|
2392
|
+
*
|
|
2393
|
+
* @summary Experimental: the `@mode` value of `<Paginate />`, either `'paged'` for a single-page view or
|
|
2394
|
+
* `'infinite'` for an accumulated view, which selects the yielded pagination API.
|
|
2164
2395
|
*/
|
|
2165
2396
|
/**
|
|
2166
2397
|
* The part of a {@link PaginationState} available to both navigation surfaces.
|
|
2398
|
+
*
|
|
2399
|
+
* @summary Experimental: the pagination state members available in both paged and infinite mode, namely
|
|
2400
|
+
* `totalPages` and `adoptPage`.
|
|
2167
2401
|
*/
|
|
2168
2402
|
/**
|
|
2169
2403
|
* The paged (single-page view) surface of a {@link PaginationState}: render
|
|
2170
2404
|
* {@link PaginationState.activePageRequest | activePageRequest}, navigate with
|
|
2171
2405
|
* {@link PaginationState.loadPage | loadPage}. This is what the `<Paginate />`
|
|
2172
2406
|
* component yields in `'paged'` mode (the default).
|
|
2407
|
+
*
|
|
2408
|
+
* @summary Experimental: the pagination state `<Paginate />` yields in paged mode, exposing the active page, its
|
|
2409
|
+
* request, and `loadPage` for navigating to a page by URL.
|
|
2173
2410
|
*/
|
|
2174
2411
|
/**
|
|
2175
2412
|
* The infinite (accumulated view) surface of a {@link PaginationState}: render
|
|
2176
2413
|
* {@link PaginationState.data | data}, grow it with
|
|
2177
2414
|
* {@link PaginationState.loadNext | loadNext}/{@link PaginationState.loadPrev | loadPrev}.
|
|
2178
2415
|
* This is what the `<Paginate />` component yields in `'infinite'` mode.
|
|
2416
|
+
*
|
|
2417
|
+
* @summary Experimental: the pagination state `<Paginate />` yields in infinite mode, exposing the accumulated
|
|
2418
|
+
* items and pages plus `loadNext` and `loadPrev` to extend them.
|
|
2179
2419
|
*/
|
|
2180
2420
|
/**
|
|
2181
2421
|
* Resolves a {@link PaginateMode} to the surface it exposes, so a component
|
|
2182
2422
|
* generic over the mode can yield only that surface.
|
|
2423
|
+
*
|
|
2424
|
+
* @summary Experimental: resolves a pagination mode to its state type, the infinite-mode state for `'infinite'`
|
|
2425
|
+
* and the paged-mode state otherwise.
|
|
2183
2426
|
*/
|
|
2184
2427
|
/**
|
|
2185
2428
|
* The per-component, local pagination state. It houses the state that is unique
|
|
@@ -2203,6 +2446,8 @@ function clearPaginationCache() {
|
|
|
2203
2446
|
* Instances are created via {@link getPaginationState} (or by the `<Paginate />`
|
|
2204
2447
|
* component on your behalf), never constructed directly.
|
|
2205
2448
|
*
|
|
2449
|
+
* @summary Experimental: one component's pagination state over a shared collection, tracking the active page and
|
|
2450
|
+
* the loaded run and providing paged and infinite navigation.
|
|
2206
2451
|
* @since 5.9.0
|
|
2207
2452
|
* @public
|
|
2208
2453
|
* @hideconstructor
|
|
@@ -2233,10 +2478,23 @@ var PaginationState = class {
|
|
|
2233
2478
|
* them backward/forward. Both seed to {@link initialPage}; a purely paged
|
|
2234
2479
|
* consumer never extends them, so they stay put and are effectively unused.
|
|
2235
2480
|
*
|
|
2481
|
+
* Only ever written through {@link extendRun} and {@link restartRun}, which
|
|
2482
|
+
* keep {@link runMembers} in step.
|
|
2483
|
+
*
|
|
2236
2484
|
* @internal
|
|
2237
2485
|
*/
|
|
2238
2486
|
/** @internal */
|
|
2239
2487
|
/**
|
|
2488
|
+
* Every page this component has loaded into its run — what the frontier
|
|
2489
|
+
* spanned each time it moved. Bounds the walk in {@link pages}: the shared
|
|
2490
|
+
* graph may relink a page in the run to one that another component sharing
|
|
2491
|
+
* the collection loaded, and that page is not part of this run until it is
|
|
2492
|
+
* loaded through here. Untracked bookkeeping — it only changes together with
|
|
2493
|
+
* the frontier signals, which carry the notification.
|
|
2494
|
+
*
|
|
2495
|
+
* @internal
|
|
2496
|
+
*/
|
|
2497
|
+
/**
|
|
2240
2498
|
* The request of the latest {@link adoptPage} call — only that call may
|
|
2241
2499
|
* commit. Later calls (or a {@link loadPage} navigation) claim the slot,
|
|
2242
2500
|
* superseding in-flight adoptions so the newest navigation always wins.
|
|
@@ -2249,6 +2507,7 @@ var PaginationState = class {
|
|
|
2249
2507
|
this.request = request;
|
|
2250
2508
|
this.pageHints = pageHints;
|
|
2251
2509
|
this._adoptTarget = null;
|
|
2510
|
+
this.runMembers = /* @__PURE__ */ new Set();
|
|
2252
2511
|
this.setup();
|
|
2253
2512
|
}
|
|
2254
2513
|
/**
|
|
@@ -2297,21 +2556,44 @@ var PaginationState = class {
|
|
|
2297
2556
|
* same collection to different extents each see only what they have scrolled
|
|
2298
2557
|
* through. For every page known to the whole collection, see
|
|
2299
2558
|
* {@link PaginationCache.pages}.
|
|
2559
|
+
*
|
|
2560
|
+
* The run is walked through the shared graph, so it ends early when a page
|
|
2561
|
+
* that was in it no longer follows the page before it — a reload that showed
|
|
2562
|
+
* the collection now ends sooner, or that its next cursor moved. It also ends
|
|
2563
|
+
* before a page this component never loaded: a reload may relink a page in
|
|
2564
|
+
* the run to one another component sharing the collection scrolled to, and
|
|
2565
|
+
* that page joins this run only through {@link loadNext}.
|
|
2300
2566
|
*/
|
|
2301
2567
|
static {
|
|
2302
2568
|
decorateMethodV2(this.prototype, "totalPages", [memoized]);
|
|
2303
2569
|
}
|
|
2304
2570
|
get pages() {
|
|
2305
|
-
const
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
}
|
|
2571
|
+
const pages = [];
|
|
2572
|
+
const end = this.frontierEnd;
|
|
2573
|
+
let page = this.frontierStart;
|
|
2574
|
+
while (page) {
|
|
2575
|
+
pages.push(page);
|
|
2576
|
+
if (page === end) break;
|
|
2577
|
+
const next = page.after;
|
|
2578
|
+
if (!next?.isSuccess || !this.runMembers.has(next)) break;
|
|
2579
|
+
page = next;
|
|
2580
|
+
}
|
|
2581
|
+
return pages;
|
|
2582
|
+
}
|
|
2583
|
+
/**
|
|
2584
|
+
* The last page of the run {@link pages} walks — the forward frontier, or
|
|
2585
|
+
* the page before the first one that no longer follows in the graph or that
|
|
2586
|
+
* this component never loaded.
|
|
2587
|
+
*
|
|
2588
|
+
* @internal
|
|
2589
|
+
*/
|
|
2590
|
+
static {
|
|
2591
|
+
decorateMethodV2(this.prototype, "pages", [memoized]);
|
|
2592
|
+
}
|
|
2593
|
+
get runEnd() {
|
|
2594
|
+
let end = null;
|
|
2595
|
+
for (const page of this.pages) end = page;
|
|
2596
|
+
return end;
|
|
2315
2597
|
}
|
|
2316
2598
|
/**
|
|
2317
2599
|
* The accumulated items across the loaded run, from the backward frontier to
|
|
@@ -2336,13 +2618,12 @@ var PaginationState = class {
|
|
|
2336
2618
|
* ```
|
|
2337
2619
|
*/
|
|
2338
2620
|
static {
|
|
2339
|
-
decorateMethodV2(this.prototype, "
|
|
2621
|
+
decorateMethodV2(this.prototype, "runEnd", [memoized]);
|
|
2340
2622
|
}
|
|
2341
2623
|
get data() {
|
|
2342
|
-
const
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
} };
|
|
2624
|
+
const items = [];
|
|
2625
|
+
for (const page of this.pages) if (page.data) items.push(...page.data);
|
|
2626
|
+
return items;
|
|
2346
2627
|
}
|
|
2347
2628
|
/**
|
|
2348
2629
|
* Whether a page exists after the forward frontier — i.e. there is more to load
|
|
@@ -2358,7 +2639,7 @@ var PaginationState = class {
|
|
|
2358
2639
|
decorateMethodV2(this.prototype, "data", [memoized]);
|
|
2359
2640
|
}
|
|
2360
2641
|
get hasNext() {
|
|
2361
|
-
return Boolean(this.
|
|
2642
|
+
return Boolean(this.runEnd?.nextLink);
|
|
2362
2643
|
}
|
|
2363
2644
|
/**
|
|
2364
2645
|
* Whether a page exists before the backward frontier.
|
|
@@ -2373,7 +2654,10 @@ var PaginationState = class {
|
|
|
2373
2654
|
* The request for the page just after the forward frontier, for the infinite
|
|
2374
2655
|
* surface. `null` until {@link loadNext} fires it (so a `<Request>` wrapping it
|
|
2375
2656
|
* renders its idle block), the in-flight `Future` while that page loads, then
|
|
2376
|
-
* `null` again once the frontier advances onto it. Also `null` at end-of-list
|
|
2657
|
+
* `null` again once the frontier advances onto it. Also `null` at end-of-list,
|
|
2658
|
+
* and while the page sits loaded in the shared cache (another component
|
|
2659
|
+
* scrolled to it) but outside this run — {@link loadNext} then joins it
|
|
2660
|
+
* without a request of its own.
|
|
2377
2661
|
*
|
|
2378
2662
|
* ```gts
|
|
2379
2663
|
* {{#if pages.hasNext}}
|
|
@@ -2388,9 +2672,9 @@ var PaginationState = class {
|
|
|
2388
2672
|
decorateMethodV2(this.prototype, "hasPrevious", [memoized]);
|
|
2389
2673
|
}
|
|
2390
2674
|
get nextRequest() {
|
|
2391
|
-
const url = this.
|
|
2675
|
+
const url = this.runEnd?.nextLink;
|
|
2392
2676
|
if (!url) return null;
|
|
2393
|
-
return this.
|
|
2677
|
+
return this.pendingRequest(url);
|
|
2394
2678
|
}
|
|
2395
2679
|
/**
|
|
2396
2680
|
* The request for the page just before the backward frontier. Mirror of
|
|
@@ -2402,12 +2686,24 @@ var PaginationState = class {
|
|
|
2402
2686
|
get previousRequest() {
|
|
2403
2687
|
const url = this.frontierStart?.prevLink;
|
|
2404
2688
|
if (!url) return null;
|
|
2405
|
-
return this.
|
|
2689
|
+
return this.pendingRequest(url);
|
|
2406
2690
|
}
|
|
2407
|
-
/**
|
|
2691
|
+
/**
|
|
2692
|
+
* The request of the page at `url` unless it already succeeded, in which
|
|
2693
|
+
* case there is nothing pending: the page either sits in this run, or joins
|
|
2694
|
+
* it on the next {@link loadNext}/{@link loadPrev} without a new request.
|
|
2695
|
+
*
|
|
2696
|
+
* @internal
|
|
2697
|
+
*/
|
|
2408
2698
|
static {
|
|
2409
2699
|
decorateMethodV2(this.prototype, "previousRequest", [memoized]);
|
|
2410
2700
|
}
|
|
2701
|
+
pendingRequest(url) {
|
|
2702
|
+
const page = this.paginationCache?.getPageCache(url);
|
|
2703
|
+
if (!page || page.isSuccess) return null;
|
|
2704
|
+
return page.request ?? null;
|
|
2705
|
+
}
|
|
2706
|
+
/** @internal */
|
|
2411
2707
|
async setup() {
|
|
2412
2708
|
let document;
|
|
2413
2709
|
try {
|
|
@@ -2424,9 +2720,31 @@ var PaginationState = class {
|
|
|
2424
2720
|
const cache = getPaginationCache(firstLink ?? selfLink ?? "");
|
|
2425
2721
|
cache.installPageHints(this.pageHints);
|
|
2426
2722
|
this.paginationCache = cache;
|
|
2427
|
-
|
|
2428
|
-
this.activePage = this.initialPage =
|
|
2429
|
-
this.
|
|
2723
|
+
const page = cache.getPageCache(selfLink);
|
|
2724
|
+
this.activePage = this.initialPage = page;
|
|
2725
|
+
this.restartRun(page);
|
|
2726
|
+
await cache.loadPage(selfLink, this.request);
|
|
2727
|
+
}
|
|
2728
|
+
/**
|
|
2729
|
+
* Moves the frontier onto a page adjacent to the run, recording it as a
|
|
2730
|
+
* member.
|
|
2731
|
+
*
|
|
2732
|
+
* @internal
|
|
2733
|
+
*/
|
|
2734
|
+
extendRun(dir, page) {
|
|
2735
|
+
this.runMembers.add(page);
|
|
2736
|
+
if (dir === "next") this.frontierEnd = page;
|
|
2737
|
+
else this.frontierStart = page;
|
|
2738
|
+
}
|
|
2739
|
+
/**
|
|
2740
|
+
* Restarts the run at a single page, forgetting every earlier member.
|
|
2741
|
+
*
|
|
2742
|
+
* @internal
|
|
2743
|
+
*/
|
|
2744
|
+
restartRun(page) {
|
|
2745
|
+
this.runMembers.clear();
|
|
2746
|
+
this.runMembers.add(page);
|
|
2747
|
+
this.frontierStart = this.frontierEnd = page;
|
|
2430
2748
|
}
|
|
2431
2749
|
/**
|
|
2432
2750
|
* Commits a resolved, membership-proven page into this state, making it the
|
|
@@ -2443,9 +2761,9 @@ var PaginationState = class {
|
|
|
2443
2761
|
_activate(page, url) {
|
|
2444
2762
|
this.activePage = page;
|
|
2445
2763
|
for (const existing of this.pages) if (existing === page) return;
|
|
2446
|
-
if (this.
|
|
2447
|
-
else if (this.frontierStart?.prevLink === url) this.
|
|
2448
|
-
else this.
|
|
2764
|
+
if (this.runEnd?.nextLink === url) this.extendRun("next", page);
|
|
2765
|
+
else if (this.frontierStart?.prevLink === url) this.extendRun("prev", page);
|
|
2766
|
+
else this.restartRun(page);
|
|
2449
2767
|
}
|
|
2450
2768
|
/**
|
|
2451
2769
|
* Adopts an externally-issued request into this pagination, making its page
|
|
@@ -2476,6 +2794,10 @@ var PaginationState = class {
|
|
|
2476
2794
|
* - this state has not finished setting up its own collection yet
|
|
2477
2795
|
* - the call was superseded by a newer navigation
|
|
2478
2796
|
*
|
|
2797
|
+
* In development, a document that contradicts the collection's page
|
|
2798
|
+
* numbers (a `next` that skips a page, a `first` that is not page 1, ...)
|
|
2799
|
+
* rejects instead of resolving: the graph is not updated from it.
|
|
2800
|
+
*
|
|
2479
2801
|
* ```ts
|
|
2480
2802
|
* const pages = getPaginationState(initialRequest);
|
|
2481
2803
|
* // later, e.g. in a route model hook reacting to a ?page= param:
|
|
@@ -2505,12 +2827,7 @@ var PaginationState = class {
|
|
|
2505
2827
|
if (!test) throw new Error("Expected the adopted document to have a self link");
|
|
2506
2828
|
})(selfLink);
|
|
2507
2829
|
if (!selfLink || (firstLink ?? selfLink) !== cache.key) return null;
|
|
2508
|
-
const page = cache.loadPage(selfLink, request);
|
|
2509
|
-
try {
|
|
2510
|
-
await page.request;
|
|
2511
|
-
} catch {
|
|
2512
|
-
return null;
|
|
2513
|
-
}
|
|
2830
|
+
const page = await cache.loadPage(selfLink, request);
|
|
2514
2831
|
if (this._adoptTarget !== request) return null;
|
|
2515
2832
|
this._activate(page, selfLink);
|
|
2516
2833
|
return page.value;
|
|
@@ -2557,7 +2874,7 @@ var PaginationState = class {
|
|
|
2557
2874
|
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
2558
2875
|
if (!test) throw new Error("Expected the pagination cache to be set up before loading a page");
|
|
2559
2876
|
})(cache);
|
|
2560
|
-
const frontier = dir === "next" ? this.
|
|
2877
|
+
const frontier = dir === "next" ? this.runEnd : this.frontierStart;
|
|
2561
2878
|
const url = dir === "next" ? frontier?.nextLink : frontier?.prevLink;
|
|
2562
2879
|
if (!url) return null;
|
|
2563
2880
|
const page = cache.getPageCache(url);
|
|
@@ -2570,15 +2887,12 @@ var PaginationState = class {
|
|
|
2570
2887
|
method: "GET",
|
|
2571
2888
|
url
|
|
2572
2889
|
});
|
|
2573
|
-
cache.loadPage(url, request);
|
|
2574
|
-
}
|
|
2575
|
-
try {
|
|
2890
|
+
await cache.loadPage(url, request);
|
|
2891
|
+
} else try {
|
|
2576
2892
|
await page.request;
|
|
2577
|
-
} catch {
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
if (dir === "next") this.frontierEnd = page;
|
|
2581
|
-
else this.frontierStart = page;
|
|
2893
|
+
} catch {}
|
|
2894
|
+
if (!page.isSuccess) return null;
|
|
2895
|
+
this.extendRun(dir, page);
|
|
2582
2896
|
return page.value;
|
|
2583
2897
|
};
|
|
2584
2898
|
/**
|
|
@@ -2597,7 +2911,9 @@ var PaginationState = class {
|
|
|
2597
2911
|
* On failure the page stays active and {@link activePageRequest} resolves to
|
|
2598
2912
|
* it, so a wrapping `<Request>` renders its error block. Calling again (for
|
|
2599
2913
|
* example clicking the page's link a second time) retries: the failed page
|
|
2600
|
-
* is re-requested with a forced reload.
|
|
2914
|
+
* is re-requested with a forced reload. In development, a document that
|
|
2915
|
+
* contradicts the collection's page numbers rejects instead (see
|
|
2916
|
+
* {@link adoptPage}).
|
|
2601
2917
|
*
|
|
2602
2918
|
* ```gts
|
|
2603
2919
|
* <EachLink @pages={{pages}}>
|
|
@@ -2624,12 +2940,8 @@ var PaginationState = class {
|
|
|
2624
2940
|
method: "GET",
|
|
2625
2941
|
url
|
|
2626
2942
|
});
|
|
2627
|
-
cache.loadPage(url, request);
|
|
2628
|
-
|
|
2629
|
-
await page.request;
|
|
2630
|
-
} catch {
|
|
2631
|
-
return null;
|
|
2632
|
-
}
|
|
2943
|
+
await cache.loadPage(url, request);
|
|
2944
|
+
if (!page.isSuccess) return null;
|
|
2633
2945
|
}
|
|
2634
2946
|
return page.value;
|
|
2635
2947
|
};
|
|
@@ -2656,6 +2968,8 @@ const PaginationStateCache = /* @__PURE__ */ new WeakMap();
|
|
|
2656
2968
|
* await pages.loadNext();
|
|
2657
2969
|
* ```
|
|
2658
2970
|
*
|
|
2971
|
+
* @summary Experimental: returns the pagination state for a request, creating it on first call and returning the
|
|
2972
|
+
* same instance for the same request thereafter.
|
|
2659
2973
|
* @since 5.9.0
|
|
2660
2974
|
* @public
|
|
2661
2975
|
*/
|
|
@@ -2689,6 +3003,8 @@ const PaginationLinksCache = /* @__PURE__ */ new WeakMap();
|
|
|
2689
3003
|
* </EachLink>
|
|
2690
3004
|
* ```
|
|
2691
3005
|
*
|
|
3006
|
+
* @summary Experimental: a numbered page link with its page number, whether it is current, its distance from the
|
|
3007
|
+
* active page, and `setActive` to load and show that page.
|
|
2692
3008
|
* @since 5.9.0
|
|
2693
3009
|
* @public
|
|
2694
3010
|
* @hideconstructor
|
|
@@ -2738,6 +3054,8 @@ var RealPaginationLink = class {
|
|
|
2738
3054
|
* </EachLink>
|
|
2739
3055
|
* ```
|
|
2740
3056
|
*
|
|
3057
|
+
* @summary Experimental: a non-navigable gap marker in numbered pagination links, standing in for a range of
|
|
3058
|
+
* not-yet-loaded pages, usually shown as an ellipsis.
|
|
2741
3059
|
* @since 5.9.0
|
|
2742
3060
|
* @public
|
|
2743
3061
|
* @hideconstructor
|
|
@@ -2790,6 +3108,8 @@ var PlaceholderPaginationLink = class {
|
|
|
2790
3108
|
* </EachLink>
|
|
2791
3109
|
* ```
|
|
2792
3110
|
*
|
|
3111
|
+
* @summary Experimental: a `first`, `prev`, `next`, or `last` link relative to the active page, with `setActive`
|
|
3112
|
+
* to load it, and the only kind of link cursor-based pagination has.
|
|
2793
3113
|
* @since 5.9.0
|
|
2794
3114
|
* @public
|
|
2795
3115
|
* @hideconstructor
|
|
@@ -2841,6 +3161,9 @@ var RelationalPaginationLink = class {
|
|
|
2841
3161
|
* }
|
|
2842
3162
|
* }
|
|
2843
3163
|
* ```
|
|
3164
|
+
*
|
|
3165
|
+
* @summary Experimental: an entry in the numbered pagination links list, either a navigable numbered link or a
|
|
3166
|
+
* placeholder for a gap, told apart by `isReal`.
|
|
2844
3167
|
*/
|
|
2845
3168
|
/**
|
|
2846
3169
|
* The reactive set of navigation links derived from a {@link PaginationState}.
|
|
@@ -2870,6 +3193,8 @@ var RelationalPaginationLink = class {
|
|
|
2870
3193
|
* - {@link PlaceholderPaginationLink}
|
|
2871
3194
|
* - {@link RelationalPaginationLink}
|
|
2872
3195
|
*
|
|
3196
|
+
* @summary Experimental: the reactive navigation links for a pagination state, with numbered links and gap
|
|
3197
|
+
* placeholders plus `first`, `prev`, `next`, and `last` links for the active page.
|
|
2873
3198
|
* @since 5.9.0
|
|
2874
3199
|
* @public
|
|
2875
3200
|
* @hideconstructor
|
|
@@ -2981,6 +3306,8 @@ var PaginationLinks = class {
|
|
|
2981
3306
|
* }
|
|
2982
3307
|
* ```
|
|
2983
3308
|
*
|
|
3309
|
+
* @summary Experimental: returns the navigation links for a paged pagination state, creating them on first call and
|
|
3310
|
+
* returning the same instance for the same state.
|
|
2984
3311
|
* @since 5.9.0
|
|
2985
3312
|
* @public
|
|
2986
3313
|
*/
|
|
@@ -2998,29 +3325,46 @@ function getPaginationLinks(state) {
|
|
|
2998
3325
|
/**
|
|
2999
3326
|
* The content features available in both pagination modes: the state and
|
|
3000
3327
|
* controls of the initial request.
|
|
3328
|
+
*
|
|
3329
|
+
* @summary Experimental: the request status flags and controls, like `isRefreshing`, `refresh`, and `reload`,
|
|
3330
|
+
* that `<Paginate />` yields to its content block in both modes.
|
|
3001
3331
|
*/
|
|
3002
3332
|
/**
|
|
3003
3333
|
* The content features yielded in `'paged'` mode: navigation happens by
|
|
3004
3334
|
* loading a specific page.
|
|
3335
|
+
*
|
|
3336
|
+
* @summary Experimental: the request controls `<Paginate />` yields to its content block in paged mode, adding
|
|
3337
|
+
* `loadPage` to navigate to a page by URL.
|
|
3005
3338
|
*/
|
|
3006
3339
|
/**
|
|
3007
3340
|
* The content features yielded in `'infinite'` mode: navigation happens by
|
|
3008
3341
|
* extending the loaded run at either end.
|
|
3342
|
+
*
|
|
3343
|
+
* @summary Experimental: the request controls `<Paginate />` yields to its content block in infinite mode, adding
|
|
3344
|
+
* `loadNext` and `loadPrev` to extend the loaded pages.
|
|
3009
3345
|
*/
|
|
3010
3346
|
/**
|
|
3011
3347
|
* The full set of content features a {@link PaginationSubscription} builds —
|
|
3012
3348
|
* both modes' surfaces. The `<Paginate />` component narrows this to one mode
|
|
3013
3349
|
* via {@link PaginationContentFeaturesFor} before yielding.
|
|
3350
|
+
*
|
|
3351
|
+
* @summary Experimental: the combined paged and infinite content features a pagination subscription builds, before
|
|
3352
|
+
* `<Paginate />` narrows them to one mode.
|
|
3014
3353
|
*/
|
|
3015
3354
|
/**
|
|
3016
3355
|
* Resolves a {@link PaginateMode} to the content features it exposes. Mirror of
|
|
3017
3356
|
* {@link PaginationStateFor}.
|
|
3357
|
+
*
|
|
3358
|
+
* @summary Experimental: resolves a pagination mode to the content features `<Paginate />` yields, the infinite
|
|
3359
|
+
* set for `'infinite'` and the paged set otherwise.
|
|
3018
3360
|
*/
|
|
3019
3361
|
/**
|
|
3020
3362
|
* Lifecycle glue for the `<Paginate />` component. Owns the initial
|
|
3021
3363
|
* {@link RequestSubscription} (loading/error state, autorefresh, disposal) and
|
|
3022
3364
|
* the per-component {@link PaginationState} that it hands to the component.
|
|
3023
3365
|
*
|
|
3366
|
+
* @summary Experimental: the lifecycle core of `<Paginate />`, owning the initial request subscription and the
|
|
3367
|
+
* component's pagination state.
|
|
3024
3368
|
* @since 5.9.0
|
|
3025
3369
|
* @public
|
|
3026
3370
|
* @hideconstructor
|
|
@@ -3282,6 +3626,8 @@ defineSignal(PaginationSubscription.prototype, "_navRequest", null);
|
|
|
3282
3626
|
* subscription[DISPOSE](); // tear down when the owning component unmounts
|
|
3283
3627
|
* ```
|
|
3284
3628
|
*
|
|
3629
|
+
* @summary Experimental: creates the subscription that manages a `<Paginate />` component's initial request
|
|
3630
|
+
* lifecycle and pagination state, for managing that lifecycle yourself.
|
|
3285
3631
|
* @since 5.9.0
|
|
3286
3632
|
* @public
|
|
3287
3633
|
*/
|
|
@@ -3313,6 +3659,8 @@ function _DISPOSE$1() {
|
|
|
3313
3659
|
* `<Paginate />` component, so they stay in sync as pages load and the active
|
|
3314
3660
|
* page changes.
|
|
3315
3661
|
*
|
|
3662
|
+
* @summary Experimental: the framework-agnostic lifecycle core of a pagination links component such as
|
|
3663
|
+
* `<EachLink />`, exposing the navigation links for a paged pagination state.
|
|
3316
3664
|
* @since 5.9.0
|
|
3317
3665
|
* @public
|
|
3318
3666
|
* @hideconstructor
|
|
@@ -3354,6 +3702,8 @@ var PaginationLinksSubscription = class {
|
|
|
3354
3702
|
* subscription[DISPOSE](); // tear down when the owning component unmounts
|
|
3355
3703
|
* ```
|
|
3356
3704
|
*
|
|
3705
|
+
* @summary Experimental: creates the subscription a pagination links component such as `<EachLink />` uses to
|
|
3706
|
+
* derive navigation links from a paged pagination state.
|
|
3357
3707
|
* @since 5.9.0
|
|
3358
3708
|
* @public
|
|
3359
3709
|
*/
|
|
@@ -3375,18 +3725,24 @@ const PromiseCache = /* @__PURE__ */ new WeakMap();
|
|
|
3375
3725
|
* The state of a promise in the "pending"
|
|
3376
3726
|
* state. This is the default initial state.
|
|
3377
3727
|
*
|
|
3728
|
+
* @summary The `getPromiseState` state for a promise that has not yet settled, with `isPending` true and
|
|
3729
|
+
* no value or reason.
|
|
3378
3730
|
*/
|
|
3379
3731
|
/**
|
|
3380
3732
|
* The state of a promise in the "fulfilled" state.
|
|
3381
3733
|
* This is the state of a promise that has resolved
|
|
3382
3734
|
* successfully.
|
|
3383
3735
|
*
|
|
3736
|
+
* @summary The `getPromiseState` state for a promise that resolved, with `isSuccess` true and the
|
|
3737
|
+
* resolved `value`.
|
|
3384
3738
|
*/
|
|
3385
3739
|
/**
|
|
3386
3740
|
* The state of a promise in the "rejected" state.
|
|
3387
3741
|
* This is the state of a promise that has rejected
|
|
3388
3742
|
* with an error.
|
|
3389
3743
|
*
|
|
3744
|
+
* @summary The `getPromiseState` state for a promise that rejected, with `isError` true and the
|
|
3745
|
+
* rejection `reason`.
|
|
3390
3746
|
*/
|
|
3391
3747
|
/**
|
|
3392
3748
|
* The state of a promise. This is the type that is returned
|
|
@@ -3397,6 +3753,8 @@ const PromiseCache = /* @__PURE__ */ new WeakMap();
|
|
|
3397
3753
|
* - {@link ResolvedPromise}
|
|
3398
3754
|
* - {@link RejectedPromise}
|
|
3399
3755
|
*
|
|
3756
|
+
* @summary The reactive pending, fulfilled, or rejected state of a promise, as returned by
|
|
3757
|
+
* `getPromiseState`.
|
|
3400
3758
|
*/
|
|
3401
3759
|
const PromiseStateProto = {};
|
|
3402
3760
|
defineSignal(PromiseStateProto, "reason", null);
|
|
@@ -3462,6 +3820,9 @@ function getPromise(promise) {
|
|
|
3462
3820
|
/**
|
|
3463
3821
|
* Returns a reactive state-machine for the provided promise or awaitable.
|
|
3464
3822
|
*
|
|
3823
|
+
* The [Async as Reactive State](/guides/the-manual/reactivity/derivation) guide shows
|
|
3824
|
+
* how to use it in place of tracked loading and error state.
|
|
3825
|
+
*
|
|
3465
3826
|
* Repeat calls to `getPromiseState` with the same promise will return the same state object
|
|
3466
3827
|
* making is safe and easy to use in templates and JavaScript code to produce reactive
|
|
3467
3828
|
* behaviors around promises.
|
|
@@ -3511,6 +3872,9 @@ function getPromise(promise) {
|
|
|
3511
3872
|
* If looking to use in a template, consider also the `<Await />` component.
|
|
3512
3873
|
*
|
|
3513
3874
|
* See also {@link PromiseState}
|
|
3875
|
+
*
|
|
3876
|
+
* @summary Returns a cached, reactive state object tracking whether a promise is pending, fulfilled, or
|
|
3877
|
+
* rejected, for use in JS or templates.
|
|
3514
3878
|
*/
|
|
3515
3879
|
function getPromiseState(promise) {
|
|
3516
3880
|
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
@@ -3527,4 +3891,4 @@ function getPromiseState(promise) {
|
|
|
3527
3891
|
|
|
3528
3892
|
//#endregion
|
|
3529
3893
|
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 };
|
|
3530
|
-
//# sourceMappingURL=-private-
|
|
3894
|
+
//# sourceMappingURL=-private-BpyvBYFj.js.map
|