@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/README.md
CHANGED
package/build/legacy/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.
|
|
@@ -222,8 +221,7 @@ var QueryClientProvider = class extends lit.LitElement {
|
|
|
222
221
|
}
|
|
223
222
|
};
|
|
224
223
|
QueryClientProvider.properties = { client: { attribute: false } };
|
|
225
|
-
|
|
226
|
-
//#region src/accessor.ts
|
|
224
|
+
// src/accessor.ts
|
|
227
225
|
/**
|
|
228
226
|
* Reads an {@link Accessor}: calls it if it is a function, otherwise returns it as is.
|
|
229
227
|
* @param value - The value, or a getter that returns it.
|
|
@@ -246,8 +244,7 @@ function createValueAccessor(getter) {
|
|
|
246
244
|
});
|
|
247
245
|
return accessor;
|
|
248
246
|
}
|
|
249
|
-
|
|
250
|
-
//#region src/controllers/BaseController.ts
|
|
247
|
+
// src/controllers/BaseController.ts
|
|
251
248
|
/**
|
|
252
249
|
* Base class of the query controllers. It resolves the `QueryClient`, either
|
|
253
250
|
* passed explicitly or provided through context by a `QueryClientProvider`,
|
|
@@ -443,8 +440,7 @@ var BaseController = class {
|
|
|
443
440
|
return true;
|
|
444
441
|
}
|
|
445
442
|
};
|
|
446
|
-
|
|
447
|
-
//#region src/queryObserverResultTracker.ts
|
|
443
|
+
// src/queryObserverResultTracker.ts
|
|
448
444
|
/**
|
|
449
445
|
* Wraps observer results with property tracking when `notifyOnChangeProps` is
|
|
450
446
|
* not set, so the observer only notifies about the properties the host reads.
|
|
@@ -476,8 +472,7 @@ var QueryObserverResultTracker = class {
|
|
|
476
472
|
return usesTracking ? observer.trackResult(result) : result;
|
|
477
473
|
}
|
|
478
474
|
};
|
|
479
|
-
|
|
480
|
-
//#region src/createInfiniteQueryController.ts
|
|
475
|
+
// src/createInfiniteQueryController.ts
|
|
481
476
|
/**
|
|
482
477
|
* Returns the result used while no `QueryClient` is available: `'pending'` and idle, with methods
|
|
483
478
|
* that reject with the missing client error.
|
|
@@ -682,8 +677,7 @@ function createInfiniteQueryController(host, options, queryClient) {
|
|
|
682
677
|
destroy: () => controller.destroy()
|
|
683
678
|
});
|
|
684
679
|
}
|
|
685
|
-
|
|
686
|
-
//#region src/createMutationController.ts
|
|
680
|
+
// src/createMutationController.ts
|
|
687
681
|
/**
|
|
688
682
|
* Returns the result used while no `QueryClient` is available: `'idle'`, with a `mutate` that
|
|
689
683
|
* rejects with the missing client error.
|
|
@@ -840,8 +834,7 @@ function createMutationController(host, options, queryClient) {
|
|
|
840
834
|
destroy: () => controller.destroy()
|
|
841
835
|
});
|
|
842
836
|
}
|
|
843
|
-
|
|
844
|
-
//#region src/createQueriesController.ts
|
|
837
|
+
// src/createQueriesController.ts
|
|
845
838
|
/**
|
|
846
839
|
* Returns the result used while no `QueryClient` is available: `'pending'` and idle, with methods
|
|
847
840
|
* that reject with the missing client error.
|
|
@@ -1133,8 +1126,7 @@ function createQueriesController(host, options, queryClient) {
|
|
|
1133
1126
|
const controller = new QueriesController(host, options, queryClient);
|
|
1134
1127
|
return Object.assign(createValueAccessor(() => controller.readCurrent()), { destroy: () => controller.destroy() });
|
|
1135
1128
|
}
|
|
1136
|
-
|
|
1137
|
-
//#region src/createQueryController.ts
|
|
1129
|
+
// src/createQueryController.ts
|
|
1138
1130
|
/**
|
|
1139
1131
|
* Returns the result used while no `QueryClient` is available: `'pending'` and idle, with methods
|
|
1140
1132
|
* that reject with the missing client error.
|
|
@@ -1327,8 +1319,7 @@ function createQueryController(host, options, queryClient) {
|
|
|
1327
1319
|
destroy: () => controller.destroy()
|
|
1328
1320
|
});
|
|
1329
1321
|
}
|
|
1330
|
-
|
|
1331
|
-
//#region src/useIsFetching.ts
|
|
1322
|
+
// src/useIsFetching.ts
|
|
1332
1323
|
var IsFetchingController = class extends BaseController {
|
|
1333
1324
|
constructor(host, filters = {}, queryClient) {
|
|
1334
1325
|
super(host, 0, queryClient);
|
|
@@ -1426,8 +1417,7 @@ function useIsFetching(host, filters = {}, queryClient) {
|
|
|
1426
1417
|
const controller = new IsFetchingController(host, filters, queryClient);
|
|
1427
1418
|
return Object.assign(createValueAccessor(() => controller.current), { destroy: () => controller.destroy() });
|
|
1428
1419
|
}
|
|
1429
|
-
|
|
1430
|
-
//#region src/useIsMutating.ts
|
|
1420
|
+
// src/useIsMutating.ts
|
|
1431
1421
|
var IsMutatingController = class extends BaseController {
|
|
1432
1422
|
constructor(host, filters = {}, queryClient) {
|
|
1433
1423
|
super(host, 0, queryClient);
|
|
@@ -1525,8 +1515,7 @@ function useIsMutating(host, filters = {}, queryClient) {
|
|
|
1525
1515
|
const controller = new IsMutatingController(host, filters, queryClient);
|
|
1526
1516
|
return Object.assign(createValueAccessor(() => controller.current), { destroy: () => controller.destroy() });
|
|
1527
1517
|
}
|
|
1528
|
-
|
|
1529
|
-
//#region src/useMutationState.ts
|
|
1518
|
+
// src/useMutationState.ts
|
|
1530
1519
|
var MutationStateController = class extends BaseController {
|
|
1531
1520
|
constructor(host, options, queryClient) {
|
|
1532
1521
|
super(host, [], queryClient);
|
|
@@ -1637,18 +1626,15 @@ function useMutationState(host, options = {}, queryClient) {
|
|
|
1637
1626
|
const controller = new MutationStateController(host, options, queryClient);
|
|
1638
1627
|
return Object.assign(createValueAccessor(() => controller.current), { destroy: () => controller.destroy() });
|
|
1639
1628
|
}
|
|
1640
|
-
|
|
1641
|
-
//#region src/queryOptions.ts
|
|
1629
|
+
// src/queryOptions.ts
|
|
1642
1630
|
function queryOptions(options) {
|
|
1643
1631
|
return options;
|
|
1644
1632
|
}
|
|
1645
|
-
|
|
1646
|
-
//#region src/infiniteQueryOptions.ts
|
|
1633
|
+
// src/infiniteQueryOptions.ts
|
|
1647
1634
|
function infiniteQueryOptions(options) {
|
|
1648
1635
|
return options;
|
|
1649
1636
|
}
|
|
1650
|
-
|
|
1651
|
-
//#region src/mutationOptions.ts
|
|
1637
|
+
// src/mutationOptions.ts
|
|
1652
1638
|
/**
|
|
1653
1639
|
* Preserves and types mutation options for reuse across Lit Query APIs.
|
|
1654
1640
|
* @param options - Mutation options to preserve.
|
|
@@ -1666,10 +1652,8 @@ function infiniteQueryOptions(options) {
|
|
|
1666
1652
|
function mutationOptions(options) {
|
|
1667
1653
|
return options;
|
|
1668
1654
|
}
|
|
1669
|
-
|
|
1670
|
-
//#region src/index.ts
|
|
1655
|
+
// src/index.ts
|
|
1671
1656
|
/* istanbul ignore file */
|
|
1672
|
-
//#endregion
|
|
1673
1657
|
exports.QueryClientProvider = QueryClientProvider;
|
|
1674
1658
|
exports.createInfiniteQueryController = createInfiniteQueryController;
|
|
1675
1659
|
exports.createMutationController = createMutationController;
|