@wordpress/preferences 1.1.0 → 1.3.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.
package/CHANGELOG.md
CHANGED
package/build/store/selectors.js
CHANGED
|
@@ -19,6 +19,6 @@ function get(state, scope, name) {
|
|
|
19
19
|
var _state$preferences$sc, _state$defaults$scope;
|
|
20
20
|
|
|
21
21
|
const value = (_state$preferences$sc = state.preferences[scope]) === null || _state$preferences$sc === void 0 ? void 0 : _state$preferences$sc[name];
|
|
22
|
-
return value !==
|
|
22
|
+
return value !== undefined ? value : (_state$defaults$scope = state.defaults[scope]) === null || _state$defaults$scope === void 0 ? void 0 : _state$defaults$scope[name];
|
|
23
23
|
}
|
|
24
24
|
//# sourceMappingURL=selectors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/preferences/src/store/selectors.js"],"names":["get","state","scope","name","value","preferences","defaults"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,GAAT,CAAcC,KAAd,EAAqBC,KAArB,EAA4BC,IAA5B,EAAmC;AAAA;;AACzC,QAAMC,KAAK,4BAAGH,KAAK,CAACI,WAAN,CAAmBH,KAAnB,CAAH,0DAAG,sBAA8BC,IAA9B,CAAd;AACA,SAAOC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/preferences/src/store/selectors.js"],"names":["get","state","scope","name","value","preferences","undefined","defaults"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,GAAT,CAAcC,KAAd,EAAqBC,KAArB,EAA4BC,IAA5B,EAAmC;AAAA;;AACzC,QAAMC,KAAK,4BAAGH,KAAK,CAACI,WAAN,CAAmBH,KAAnB,CAAH,0DAAG,sBAA8BC,IAA9B,CAAd;AACA,SAAOC,KAAK,KAAKE,SAAV,GAAsBF,KAAtB,4BAA8BH,KAAK,CAACM,QAAN,CAAgBL,KAAhB,CAA9B,0DAA8B,sBAA2BC,IAA3B,CAArC;AACA","sourcesContent":["/**\n * Returns a boolean indicating whether a prefer is active for a particular\n * scope.\n *\n * @param {Object} state The store state.\n * @param {string} scope The scope of the feature (e.g. core/edit-post).\n * @param {string} name The name of the feature.\n *\n * @return {*} Is the feature enabled?\n */\nexport function get( state, scope, name ) {\n\tconst value = state.preferences[ scope ]?.[ name ];\n\treturn value !== undefined ? value : state.defaults[ scope ]?.[ name ];\n}\n"]}
|
|
@@ -12,6 +12,6 @@ export function get(state, scope, name) {
|
|
|
12
12
|
var _state$preferences$sc, _state$defaults$scope;
|
|
13
13
|
|
|
14
14
|
const value = (_state$preferences$sc = state.preferences[scope]) === null || _state$preferences$sc === void 0 ? void 0 : _state$preferences$sc[name];
|
|
15
|
-
return value !==
|
|
15
|
+
return value !== undefined ? value : (_state$defaults$scope = state.defaults[scope]) === null || _state$defaults$scope === void 0 ? void 0 : _state$defaults$scope[name];
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=selectors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/preferences/src/store/selectors.js"],"names":["get","state","scope","name","value","preferences","defaults"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,GAAT,CAAcC,KAAd,EAAqBC,KAArB,EAA4BC,IAA5B,EAAmC;AAAA;;AACzC,QAAMC,KAAK,4BAAGH,KAAK,CAACI,WAAN,CAAmBH,KAAnB,CAAH,0DAAG,sBAA8BC,IAA9B,CAAd;AACA,SAAOC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/preferences/src/store/selectors.js"],"names":["get","state","scope","name","value","preferences","undefined","defaults"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,GAAT,CAAcC,KAAd,EAAqBC,KAArB,EAA4BC,IAA5B,EAAmC;AAAA;;AACzC,QAAMC,KAAK,4BAAGH,KAAK,CAACI,WAAN,CAAmBH,KAAnB,CAAH,0DAAG,sBAA8BC,IAA9B,CAAd;AACA,SAAOC,KAAK,KAAKE,SAAV,GAAsBF,KAAtB,4BAA8BH,KAAK,CAACM,QAAN,CAAgBL,KAAhB,CAA9B,0DAA8B,sBAA2BC,IAA3B,CAArC;AACA","sourcesContent":["/**\n * Returns a boolean indicating whether a prefer is active for a particular\n * scope.\n *\n * @param {Object} state The store state.\n * @param {string} scope The scope of the feature (e.g. core/edit-post).\n * @param {string} name The name of the feature.\n *\n * @return {*} Is the feature enabled?\n */\nexport function get( state, scope, name ) {\n\tconst value = state.preferences[ scope ]?.[ name ];\n\treturn value !== undefined ? value : state.defaults[ scope ]?.[ name ];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/preferences",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Utilities for managing WordPress preferences.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -30,15 +30,19 @@
|
|
|
30
30
|
"sideEffects": false,
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/runtime": "^7.16.0",
|
|
33
|
-
"@wordpress/a11y": "^3.
|
|
34
|
-
"@wordpress/components": "^19.
|
|
35
|
-
"@wordpress/data": "^6.
|
|
36
|
-
"@wordpress/i18n": "^4.
|
|
37
|
-
"@wordpress/icons": "^8.
|
|
33
|
+
"@wordpress/a11y": "^3.7.0",
|
|
34
|
+
"@wordpress/components": "^19.9.0",
|
|
35
|
+
"@wordpress/data": "^6.7.0",
|
|
36
|
+
"@wordpress/i18n": "^4.7.0",
|
|
37
|
+
"@wordpress/icons": "^8.3.0",
|
|
38
38
|
"classnames": "^2.3.1"
|
|
39
39
|
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"react": "^17.0.0",
|
|
42
|
+
"react-dom": "^17.0.0"
|
|
43
|
+
},
|
|
40
44
|
"publishConfig": {
|
|
41
45
|
"access": "public"
|
|
42
46
|
},
|
|
43
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "1ba52312b56db563df2d8d4fba5b00613fb46d8c"
|
|
44
48
|
}
|
package/src/store/selectors.js
CHANGED