@contentful/field-editor-reference 6.19.1 → 6.19.2-alpha.0
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.
|
@@ -10,100 +10,13 @@ function _export(target, all) {
|
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
12
|
SharedQueryClientProvider: function() {
|
|
13
|
-
return SharedQueryClientProvider;
|
|
13
|
+
return _fieldeditorshared.SharedQueryClientProvider;
|
|
14
14
|
},
|
|
15
15
|
useQuery: function() {
|
|
16
|
-
return useQuery;
|
|
16
|
+
return _fieldeditorshared.useQuery;
|
|
17
17
|
},
|
|
18
18
|
useQueryClient: function() {
|
|
19
|
-
return useQueryClient;
|
|
19
|
+
return _fieldeditorshared.useQueryClient;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
const
|
|
23
|
-
const _reactquery = require("@tanstack/react-query");
|
|
24
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
25
|
-
if (typeof WeakMap !== "function") return null;
|
|
26
|
-
var cacheBabelInterop = new WeakMap();
|
|
27
|
-
var cacheNodeInterop = new WeakMap();
|
|
28
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
29
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
30
|
-
})(nodeInterop);
|
|
31
|
-
}
|
|
32
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
33
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
34
|
-
return obj;
|
|
35
|
-
}
|
|
36
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
37
|
-
return {
|
|
38
|
-
default: obj
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
42
|
-
if (cache && cache.has(obj)) {
|
|
43
|
-
return cache.get(obj);
|
|
44
|
-
}
|
|
45
|
-
var newObj = {
|
|
46
|
-
__proto__: null
|
|
47
|
-
};
|
|
48
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
49
|
-
for(var key in obj){
|
|
50
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
51
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
52
|
-
if (desc && (desc.get || desc.set)) {
|
|
53
|
-
Object.defineProperty(newObj, key, desc);
|
|
54
|
-
} else {
|
|
55
|
-
newObj[key] = obj[key];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
newObj.default = obj;
|
|
60
|
-
if (cache) {
|
|
61
|
-
cache.set(obj, newObj);
|
|
62
|
-
}
|
|
63
|
-
return newObj;
|
|
64
|
-
}
|
|
65
|
-
const clientContext = /*#__PURE__*/ _react.createContext(undefined);
|
|
66
|
-
function useMaybeHostQueryClient() {
|
|
67
|
-
try {
|
|
68
|
-
return (0, _reactquery.useQueryClient)();
|
|
69
|
-
} catch {
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function useQueryClient() {
|
|
74
|
-
const client = _react.useContext(clientContext);
|
|
75
|
-
const hostClient = useMaybeHostQueryClient();
|
|
76
|
-
return _react.useMemo(()=>{
|
|
77
|
-
if (client) {
|
|
78
|
-
return client;
|
|
79
|
-
}
|
|
80
|
-
if (hostClient) return hostClient;
|
|
81
|
-
return new _reactquery.QueryClient({
|
|
82
|
-
defaultOptions: {
|
|
83
|
-
queries: {
|
|
84
|
-
useErrorBoundary: false,
|
|
85
|
-
refetchOnWindowFocus: false,
|
|
86
|
-
refetchOnReconnect: true,
|
|
87
|
-
refetchOnMount: false,
|
|
88
|
-
staleTime: Infinity,
|
|
89
|
-
retry: false
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}, [
|
|
94
|
-
client,
|
|
95
|
-
hostClient
|
|
96
|
-
]);
|
|
97
|
-
}
|
|
98
|
-
const useQuery = (key, fn, opt)=>{
|
|
99
|
-
return (0, _reactquery.useQuery)(key, fn, {
|
|
100
|
-
...opt,
|
|
101
|
-
context: clientContext
|
|
102
|
-
});
|
|
103
|
-
};
|
|
104
|
-
function SharedQueryClientProvider({ children }) {
|
|
105
|
-
const client = useQueryClient();
|
|
106
|
-
return /*#__PURE__*/ _react.createElement(clientContext.Provider, {
|
|
107
|
-
value: client
|
|
108
|
-
}, children);
|
|
109
|
-
}
|
|
22
|
+
const _fieldeditorshared = require("@contentful/field-editor-shared");
|
|
@@ -1,47 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { QueryClient, useQuery as useRQ, useQueryClient as useHostQueryClient } from '@tanstack/react-query';
|
|
3
|
-
const clientContext = /*#__PURE__*/ React.createContext(undefined);
|
|
4
|
-
function useMaybeHostQueryClient() {
|
|
5
|
-
try {
|
|
6
|
-
return useHostQueryClient();
|
|
7
|
-
} catch {
|
|
8
|
-
return undefined;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
export function useQueryClient() {
|
|
12
|
-
const client = React.useContext(clientContext);
|
|
13
|
-
const hostClient = useMaybeHostQueryClient();
|
|
14
|
-
return React.useMemo(()=>{
|
|
15
|
-
if (client) {
|
|
16
|
-
return client;
|
|
17
|
-
}
|
|
18
|
-
if (hostClient) return hostClient;
|
|
19
|
-
return new QueryClient({
|
|
20
|
-
defaultOptions: {
|
|
21
|
-
queries: {
|
|
22
|
-
useErrorBoundary: false,
|
|
23
|
-
refetchOnWindowFocus: false,
|
|
24
|
-
refetchOnReconnect: true,
|
|
25
|
-
refetchOnMount: false,
|
|
26
|
-
staleTime: Infinity,
|
|
27
|
-
retry: false
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}, [
|
|
32
|
-
client,
|
|
33
|
-
hostClient
|
|
34
|
-
]);
|
|
35
|
-
}
|
|
36
|
-
export const useQuery = (key, fn, opt)=>{
|
|
37
|
-
return useRQ(key, fn, {
|
|
38
|
-
...opt,
|
|
39
|
-
context: clientContext
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
export function SharedQueryClientProvider({ children }) {
|
|
43
|
-
const client = useQueryClient();
|
|
44
|
-
return /*#__PURE__*/ React.createElement(clientContext.Provider, {
|
|
45
|
-
value: client
|
|
46
|
-
}, children);
|
|
47
|
-
}
|
|
1
|
+
export { SharedQueryClientProvider, useQueryClient, useQuery } from '@contentful/field-editor-shared';
|
|
@@ -88,12 +88,12 @@ declare const useEntityLoader: () => {
|
|
|
88
88
|
};
|
|
89
89
|
export declare function useEntity<E extends FetchableEntity>(entityType: FetchableEntityType, entityId: string, options?: Omit<UseEntityOptions, 'releaseId'>): UseEntityResult<E>;
|
|
90
90
|
export declare function useResource<R extends Resource = Resource>(resourceType: string, urn: string, { locale, referencingEntryId, ...options }?: UseResourceOptions): {
|
|
91
|
-
status: "
|
|
91
|
+
status: "loading" | "error" | "success";
|
|
92
92
|
data: ResourceInfo<R> | undefined;
|
|
93
93
|
error: unknown;
|
|
94
94
|
};
|
|
95
95
|
export declare function useResourceProvider(organizationId: string, appDefinitionId: string): {
|
|
96
|
-
status: "
|
|
96
|
+
status: "loading" | "error" | "success";
|
|
97
97
|
data: ResourceProvider | undefined;
|
|
98
98
|
error: unknown;
|
|
99
99
|
};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { QueryClient, useQuery as useRQ } from '@tanstack/react-query';
|
|
3
|
-
export declare function useQueryClient(): QueryClient;
|
|
4
|
-
export declare const useQuery: typeof useRQ;
|
|
5
1
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* Re-export query client utilities from shared package.
|
|
3
|
+
* This maintains backwards compatibility while using the shared implementation.
|
|
8
4
|
*/
|
|
9
|
-
export
|
|
5
|
+
export { SharedQueryClientProvider, useQueryClient, useQuery, } from '@contentful/field-editor-shared';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-reference",
|
|
3
|
-
"version": "6.19.
|
|
3
|
+
"version": "6.19.2-alpha.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@contentful/f36-components": "^5.8.1",
|
|
40
40
|
"@contentful/f36-icons": "^5.8.1",
|
|
41
41
|
"@contentful/f36-tokens": "^5.1.0",
|
|
42
|
-
"@contentful/field-editor-shared": "^2.17.0",
|
|
42
|
+
"@contentful/field-editor-shared": "^2.17.1-alpha.0",
|
|
43
43
|
"@contentful/mimetype": "^2.2.29",
|
|
44
44
|
"@dnd-kit/core": "^6.0.8",
|
|
45
45
|
"@dnd-kit/sortable": "^8.0.0",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"registry": "https://npm.pkg.github.com/"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "447875c5a2ef25eb4552c29b990d90ec40bc6985"
|
|
72
72
|
}
|