@contentful/field-editor-slug 3.4.2-canary.sha-cf70e54f.30 → 3.4.2
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.
|
@@ -8,48 +8,7 @@ Object.defineProperty(exports, "TrackingFieldConnector", {
|
|
|
8
8
|
return TrackingFieldConnector;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react =
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
13
|
-
if (typeof WeakMap !== "function") return null;
|
|
14
|
-
var cacheBabelInterop = new WeakMap();
|
|
15
|
-
var cacheNodeInterop = new WeakMap();
|
|
16
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
17
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
18
|
-
})(nodeInterop);
|
|
19
|
-
}
|
|
20
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
21
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
22
|
-
return obj;
|
|
23
|
-
}
|
|
24
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
25
|
-
return {
|
|
26
|
-
default: obj
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
30
|
-
if (cache && cache.has(obj)) {
|
|
31
|
-
return cache.get(obj);
|
|
32
|
-
}
|
|
33
|
-
var newObj = {
|
|
34
|
-
__proto__: null
|
|
35
|
-
};
|
|
36
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
37
|
-
for(var key in obj){
|
|
38
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
39
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
40
|
-
if (desc && (desc.get || desc.set)) {
|
|
41
|
-
Object.defineProperty(newObj, key, desc);
|
|
42
|
-
} else {
|
|
43
|
-
newObj[key] = obj[key];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
newObj.default = obj;
|
|
48
|
-
if (cache) {
|
|
49
|
-
cache.set(obj, newObj);
|
|
50
|
-
}
|
|
51
|
-
return newObj;
|
|
52
|
-
}
|
|
11
|
+
const _react = require("react");
|
|
53
12
|
function getTitleField(sdk, trackingFieldId) {
|
|
54
13
|
const { entry, contentType } = sdk;
|
|
55
14
|
if (trackingFieldId && entry.fields[trackingFieldId]) {
|
|
@@ -58,7 +17,7 @@ function getTitleField(sdk, trackingFieldId) {
|
|
|
58
17
|
return entry.fields[contentType.displayField];
|
|
59
18
|
}
|
|
60
19
|
function TrackingFieldConnector(props) {
|
|
61
|
-
const [state, setState] = _react.useState(()=>{
|
|
20
|
+
const [state, setState] = (0, _react.useState)(()=>{
|
|
62
21
|
const titleField = getTitleField(props.sdk, props.trackingFieldId);
|
|
63
22
|
const entrySys = props.sdk.entry.getSys();
|
|
64
23
|
return {
|
|
@@ -67,10 +26,10 @@ function TrackingFieldConnector(props) {
|
|
|
67
26
|
isSame: titleField ? props.field.id === titleField.id : false
|
|
68
27
|
};
|
|
69
28
|
});
|
|
70
|
-
const propsRef = _react.useRef(props);
|
|
29
|
+
const propsRef = (0, _react.useRef)(props);
|
|
71
30
|
propsRef.current = props;
|
|
72
|
-
const initialIsSameRef = _react.useRef(state.isSame);
|
|
73
|
-
_react.useLayoutEffect(()=>{
|
|
31
|
+
const initialIsSameRef = (0, _react.useRef)(state.isSame);
|
|
32
|
+
(0, _react.useLayoutEffect)(()=>{
|
|
74
33
|
const initialProps = propsRef.current;
|
|
75
34
|
const unsubscribeSysChanges = initialProps.sdk.entry.onSysChanged((sys)=>{
|
|
76
35
|
setState((currentState)=>({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from 'react';
|
|
2
2
|
function getTitleField(sdk, trackingFieldId) {
|
|
3
3
|
const { entry, contentType } = sdk;
|
|
4
4
|
if (trackingFieldId && entry.fields[trackingFieldId]) {
|
|
@@ -7,7 +7,7 @@ function getTitleField(sdk, trackingFieldId) {
|
|
|
7
7
|
return entry.fields[contentType.displayField];
|
|
8
8
|
}
|
|
9
9
|
export function TrackingFieldConnector(props) {
|
|
10
|
-
const [state, setState] =
|
|
10
|
+
const [state, setState] = useState(()=>{
|
|
11
11
|
const titleField = getTitleField(props.sdk, props.trackingFieldId);
|
|
12
12
|
const entrySys = props.sdk.entry.getSys();
|
|
13
13
|
return {
|
|
@@ -16,10 +16,10 @@ export function TrackingFieldConnector(props) {
|
|
|
16
16
|
isSame: titleField ? props.field.id === titleField.id : false
|
|
17
17
|
};
|
|
18
18
|
});
|
|
19
|
-
const propsRef =
|
|
19
|
+
const propsRef = useRef(props);
|
|
20
20
|
propsRef.current = props;
|
|
21
|
-
const initialIsSameRef =
|
|
22
|
-
|
|
21
|
+
const initialIsSameRef = useRef(state.isSame);
|
|
22
|
+
useLayoutEffect(()=>{
|
|
23
23
|
const initialProps = propsRef.current;
|
|
24
24
|
const unsubscribeSysChanges = initialProps.sdk.entry.onSysChanged((sys)=>{
|
|
25
25
|
setState((currentState)=>({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
2
|
import { FieldAPI, FieldAppSDK } from '@contentful/app-sdk';
|
|
3
3
|
type Nullable = null | undefined;
|
|
4
4
|
interface TrackingFieldConnectorState<ValueType> {
|
|
@@ -12,7 +12,7 @@ interface TrackingFieldConnectorProps<ValueType> {
|
|
|
12
12
|
defaultLocale: string;
|
|
13
13
|
trackingFieldId?: string;
|
|
14
14
|
isOptionalLocaleWithFallback: boolean;
|
|
15
|
-
children?: (state: TrackingFieldConnectorState<ValueType>) =>
|
|
15
|
+
children?: (state: TrackingFieldConnectorState<ValueType>) => ReactNode;
|
|
16
16
|
}
|
|
17
|
-
export declare function TrackingFieldConnector<ValueType>(props: TrackingFieldConnectorProps<ValueType>):
|
|
17
|
+
export declare function TrackingFieldConnector<ValueType>(props: TrackingFieldConnectorProps<ValueType>): ReactNode;
|
|
18
18
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-slug",
|
|
3
|
-
"version": "3.4.2
|
|
3
|
+
"version": "3.4.2",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@contentful/f36-icons": "^6.7.1",
|
|
41
41
|
"@contentful/f36-note": "^6.7.0",
|
|
42
42
|
"@contentful/f36-tokens": "^6.1.2",
|
|
43
|
-
"@contentful/field-editor-shared": "^4.5.2
|
|
43
|
+
"@contentful/field-editor-shared": "^4.5.2",
|
|
44
44
|
"@emotion/css": "^11.13.5",
|
|
45
45
|
"@types/speakingurl": "^13.0.2",
|
|
46
46
|
"speakingurl": "^14.0.1",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@contentful/app-sdk": "^4.45.0",
|
|
51
|
-
"@contentful/field-editor-test-utils": "^3.1.
|
|
51
|
+
"@contentful/field-editor-test-utils": "^3.1.2",
|
|
52
52
|
"@lingui/core": "5.3.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"registry": "https://npm.pkg.github.com/"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "dabc9af0a14a4fe336716b35471e203a976dd14b"
|
|
64
64
|
}
|