@tanstack/lit-query 0.2.31 → 0.2.32
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 +1 -1
- package/build/legacy/index.cjs +16 -32
- package/build/legacy/index.cjs.map +1 -1
- package/build/legacy/index.d.cts +1 -29
- package/build/legacy/index.d.cts.map +1 -1
- package/build/legacy/index.d.ts +1 -29
- package/build/legacy/index.d.ts.map +1 -1
- package/build/legacy/index.js +16 -32
- package/build/legacy/index.js.map +1 -1
- package/build/modern/index.cjs +16 -32
- package/build/modern/index.cjs.map +1 -1
- package/build/modern/index.d.cts +1 -29
- package/build/modern/index.d.cts.map +1 -1
- package/build/modern/index.d.ts +1 -29
- package/build/modern/index.d.ts.map +1 -1
- package/build/modern/index.js +16 -32
- package/build/modern/index.js.map +1 -1
- package/package.json +3 -4
- package/src/useIsFetching.ts +2 -2
package/build/modern/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
let _tanstack_query_core = require("@tanstack/query-core");
|
|
3
3
|
let _lit_context = require("@lit/context");
|
|
4
4
|
let lit = require("lit");
|
|
5
|
-
|
|
5
|
+
// src/context.ts
|
|
6
6
|
/**
|
|
7
7
|
* Lit context key used by `QueryClientProvider` and host-bound APIs to share a
|
|
8
8
|
* `QueryClient` through the DOM tree.
|
|
@@ -96,8 +96,7 @@ function useQueryClient() {
|
|
|
96
96
|
function resolveQueryClient(explicit) {
|
|
97
97
|
return explicit ?? useQueryClient();
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
//#region src/QueryClientProvider.ts
|
|
99
|
+
// src/QueryClientProvider.ts
|
|
101
100
|
/**
|
|
102
101
|
* Lit element that provides a `QueryClient` to descendant Lit Query
|
|
103
102
|
* controllers through Lit context.
|
|
@@ -224,8 +223,7 @@ var QueryClientProvider = class extends lit.LitElement {
|
|
|
224
223
|
return this.client;
|
|
225
224
|
}
|
|
226
225
|
};
|
|
227
|
-
|
|
228
|
-
//#region src/accessor.ts
|
|
226
|
+
// src/accessor.ts
|
|
229
227
|
/**
|
|
230
228
|
* Reads an {@link Accessor}: calls it if it is a function, otherwise returns it as is.
|
|
231
229
|
* @param value - The value, or a getter that returns it.
|
|
@@ -248,8 +246,7 @@ function createValueAccessor(getter) {
|
|
|
248
246
|
});
|
|
249
247
|
return accessor;
|
|
250
248
|
}
|
|
251
|
-
|
|
252
|
-
//#region src/controllers/BaseController.ts
|
|
249
|
+
// src/controllers/BaseController.ts
|
|
253
250
|
/**
|
|
254
251
|
* Base class of the query controllers. It resolves the `QueryClient`, either
|
|
255
252
|
* passed explicitly or provided through context by a `QueryClientProvider`,
|
|
@@ -444,8 +441,7 @@ var BaseController = class {
|
|
|
444
441
|
return true;
|
|
445
442
|
}
|
|
446
443
|
};
|
|
447
|
-
|
|
448
|
-
//#region src/queryObserverResultTracker.ts
|
|
444
|
+
// src/queryObserverResultTracker.ts
|
|
449
445
|
/**
|
|
450
446
|
* Wraps observer results with property tracking when `notifyOnChangeProps` is
|
|
451
447
|
* not set, so the observer only notifies about the properties the host reads.
|
|
@@ -477,8 +473,7 @@ var QueryObserverResultTracker = class {
|
|
|
477
473
|
return usesTracking ? observer.trackResult(result) : result;
|
|
478
474
|
}
|
|
479
475
|
};
|
|
480
|
-
|
|
481
|
-
//#region src/createInfiniteQueryController.ts
|
|
476
|
+
// src/createInfiniteQueryController.ts
|
|
482
477
|
/**
|
|
483
478
|
* Returns the result used while no `QueryClient` is available: `'pending'` and idle, with methods
|
|
484
479
|
* that reject with the missing client error.
|
|
@@ -680,8 +675,7 @@ function createInfiniteQueryController(host, options, queryClient) {
|
|
|
680
675
|
destroy: () => controller.destroy()
|
|
681
676
|
});
|
|
682
677
|
}
|
|
683
|
-
|
|
684
|
-
//#region src/createMutationController.ts
|
|
678
|
+
// src/createMutationController.ts
|
|
685
679
|
/**
|
|
686
680
|
* Returns the result used while no `QueryClient` is available: `'idle'`, with a `mutate` that
|
|
687
681
|
* rejects with the missing client error.
|
|
@@ -837,8 +831,7 @@ function createMutationController(host, options, queryClient) {
|
|
|
837
831
|
destroy: () => controller.destroy()
|
|
838
832
|
});
|
|
839
833
|
}
|
|
840
|
-
|
|
841
|
-
//#region src/createQueriesController.ts
|
|
834
|
+
// src/createQueriesController.ts
|
|
842
835
|
/**
|
|
843
836
|
* Returns the result used while no `QueryClient` is available: `'pending'` and idle, with methods
|
|
844
837
|
* that reject with the missing client error.
|
|
@@ -1129,8 +1122,7 @@ function createQueriesController(host, options, queryClient) {
|
|
|
1129
1122
|
const controller = new QueriesController(host, options, queryClient);
|
|
1130
1123
|
return Object.assign(createValueAccessor(() => controller.readCurrent()), { destroy: () => controller.destroy() });
|
|
1131
1124
|
}
|
|
1132
|
-
|
|
1133
|
-
//#region src/createQueryController.ts
|
|
1125
|
+
// src/createQueryController.ts
|
|
1134
1126
|
/**
|
|
1135
1127
|
* Returns the result used while no `QueryClient` is available: `'pending'` and idle, with methods
|
|
1136
1128
|
* that reject with the missing client error.
|
|
@@ -1320,8 +1312,7 @@ function createQueryController(host, options, queryClient) {
|
|
|
1320
1312
|
destroy: () => controller.destroy()
|
|
1321
1313
|
});
|
|
1322
1314
|
}
|
|
1323
|
-
|
|
1324
|
-
//#region src/useIsFetching.ts
|
|
1315
|
+
// src/useIsFetching.ts
|
|
1325
1316
|
var IsFetchingController = class extends BaseController {
|
|
1326
1317
|
constructor(host, filters = {}, queryClient) {
|
|
1327
1318
|
super(host, 0, queryClient);
|
|
@@ -1416,8 +1407,7 @@ function useIsFetching(host, filters = {}, queryClient) {
|
|
|
1416
1407
|
const controller = new IsFetchingController(host, filters, queryClient);
|
|
1417
1408
|
return Object.assign(createValueAccessor(() => controller.current), { destroy: () => controller.destroy() });
|
|
1418
1409
|
}
|
|
1419
|
-
|
|
1420
|
-
//#region src/useIsMutating.ts
|
|
1410
|
+
// src/useIsMutating.ts
|
|
1421
1411
|
var IsMutatingController = class extends BaseController {
|
|
1422
1412
|
constructor(host, filters = {}, queryClient) {
|
|
1423
1413
|
super(host, 0, queryClient);
|
|
@@ -1512,8 +1502,7 @@ function useIsMutating(host, filters = {}, queryClient) {
|
|
|
1512
1502
|
const controller = new IsMutatingController(host, filters, queryClient);
|
|
1513
1503
|
return Object.assign(createValueAccessor(() => controller.current), { destroy: () => controller.destroy() });
|
|
1514
1504
|
}
|
|
1515
|
-
|
|
1516
|
-
//#region src/useMutationState.ts
|
|
1505
|
+
// src/useMutationState.ts
|
|
1517
1506
|
var MutationStateController = class extends BaseController {
|
|
1518
1507
|
constructor(host, options, queryClient) {
|
|
1519
1508
|
super(host, [], queryClient);
|
|
@@ -1621,18 +1610,15 @@ function useMutationState(host, options = {}, queryClient) {
|
|
|
1621
1610
|
const controller = new MutationStateController(host, options, queryClient);
|
|
1622
1611
|
return Object.assign(createValueAccessor(() => controller.current), { destroy: () => controller.destroy() });
|
|
1623
1612
|
}
|
|
1624
|
-
|
|
1625
|
-
//#region src/queryOptions.ts
|
|
1613
|
+
// src/queryOptions.ts
|
|
1626
1614
|
function queryOptions(options) {
|
|
1627
1615
|
return options;
|
|
1628
1616
|
}
|
|
1629
|
-
|
|
1630
|
-
//#region src/infiniteQueryOptions.ts
|
|
1617
|
+
// src/infiniteQueryOptions.ts
|
|
1631
1618
|
function infiniteQueryOptions(options) {
|
|
1632
1619
|
return options;
|
|
1633
1620
|
}
|
|
1634
|
-
|
|
1635
|
-
//#region src/mutationOptions.ts
|
|
1621
|
+
// src/mutationOptions.ts
|
|
1636
1622
|
/**
|
|
1637
1623
|
* Preserves and types mutation options for reuse across Lit Query APIs.
|
|
1638
1624
|
* @param options - Mutation options to preserve.
|
|
@@ -1650,10 +1636,8 @@ function infiniteQueryOptions(options) {
|
|
|
1650
1636
|
function mutationOptions(options) {
|
|
1651
1637
|
return options;
|
|
1652
1638
|
}
|
|
1653
|
-
|
|
1654
|
-
//#region src/index.ts
|
|
1639
|
+
// src/index.ts
|
|
1655
1640
|
/* istanbul ignore file */
|
|
1656
|
-
//#endregion
|
|
1657
1641
|
exports.QueryClientProvider = QueryClientProvider;
|
|
1658
1642
|
exports.createInfiniteQueryController = createInfiniteQueryController;
|
|
1659
1643
|
exports.createMutationController = createMutationController;
|