@plaudit/gutenberg-api-extensions 2.2.0 → 2.4.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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RangeControlProps } from "@wordpress/components/build-types/range-control/types";
|
|
2
2
|
import type { TextControlProps } from "@wordpress/components/build-types/text-control/types";
|
|
3
3
|
import type { TextareaControlProps } from "@wordpress/components/build-types/textarea-control/types";
|
|
4
|
+
import type { ToggleControlProps } from "@wordpress/components/build-types/toggle-control/types";
|
|
4
5
|
import type { SimpleNativeProperty } from "./simple-native-property";
|
|
5
6
|
type CommonPropertyConfig<T, V> = {
|
|
6
7
|
name: string;
|
|
@@ -8,6 +9,7 @@ type CommonPropertyConfig<T, V> = {
|
|
|
8
9
|
default: T;
|
|
9
10
|
enum?: T[];
|
|
10
11
|
component?: V;
|
|
12
|
+
help?: string;
|
|
11
13
|
};
|
|
12
14
|
export declare function rangeProperty(config: CommonPropertyConfig<number, RangeControlProps> & {
|
|
13
15
|
min: number;
|
|
@@ -15,6 +17,7 @@ export declare function rangeProperty(config: CommonPropertyConfig<number, Range
|
|
|
15
17
|
step?: number;
|
|
16
18
|
enum?: number[];
|
|
17
19
|
}): SimpleNativeProperty;
|
|
20
|
+
export declare function toggleProperty(config: CommonPropertyConfig<boolean, ToggleControlProps>): SimpleNativeProperty;
|
|
18
21
|
export declare function textProperty(config: CommonPropertyConfig<string, TextControlProps>): SimpleNativeProperty;
|
|
19
22
|
export declare function textareaProperty(config: CommonPropertyConfig<string, TextareaControlProps>): SimpleNativeProperty;
|
|
20
23
|
export type ImagePropertyData = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MediaUpload, MediaUploadCheck } from "@wordpress/block-editor";
|
|
2
|
-
import { Button, Card, CardBody, CardHeader, FocalPointPicker, RangeControl, ResponsiveWrapper, TextareaControl, TextControl, __experimentalHeading as Heading } from "@wordpress/components";
|
|
2
|
+
import { Button, Card, CardBody, CardHeader, FocalPointPicker, RangeControl, ResponsiveWrapper, TextareaControl, TextControl, __experimentalHeading as Heading, ToggleControl } from "@wordpress/components";
|
|
3
3
|
import { useSelect } from "@wordpress/data";
|
|
4
4
|
import { __ } from "@wordpress/i18n";
|
|
5
5
|
import React from "react";
|
|
@@ -10,7 +10,17 @@ export function rangeProperty(config) {
|
|
|
10
10
|
enum: config.enum,
|
|
11
11
|
default: config.default,
|
|
12
12
|
renderer(value, onChange) {
|
|
13
|
-
return React.createElement(RangeControl, Object.assign({ value: value, onChange: onChange, min: config.min, max: config.max, label: config.label, step: config.step }, config.component));
|
|
13
|
+
return React.createElement(RangeControl, Object.assign({ value: value, onChange: onChange, min: config.min, max: config.max, label: config.label, step: config.step, help: config.help }, config.component));
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function toggleProperty(config) {
|
|
18
|
+
return {
|
|
19
|
+
name: config.name,
|
|
20
|
+
type: 'boolean',
|
|
21
|
+
default: config.default,
|
|
22
|
+
renderer(value, onChange) {
|
|
23
|
+
return React.createElement(ToggleControl, Object.assign({ checked: value, onChange: onChange, label: config.label, help: config.help }, config.component));
|
|
14
24
|
}
|
|
15
25
|
};
|
|
16
26
|
}
|
|
@@ -20,7 +30,7 @@ export function textProperty(config) {
|
|
|
20
30
|
type: 'string',
|
|
21
31
|
default: config.default,
|
|
22
32
|
renderer(value, onChange) {
|
|
23
|
-
return React.createElement(TextControl, Object.assign({ value: value, onChange: onChange }, config.component));
|
|
33
|
+
return React.createElement(TextControl, Object.assign({ value: value, onChange: onChange, label: config.label, help: config.help }, config.component));
|
|
24
34
|
}
|
|
25
35
|
};
|
|
26
36
|
}
|
|
@@ -30,7 +40,7 @@ export function textareaProperty(config) {
|
|
|
30
40
|
type: 'string',
|
|
31
41
|
default: config.default,
|
|
32
42
|
renderer(value, onChange) {
|
|
33
|
-
return React.createElement(TextareaControl, Object.assign({ value: value, onChange: onChange }, config.component));
|
|
43
|
+
return React.createElement(TextareaControl, Object.assign({ value: value, onChange: onChange, label: config.label, help: config.help }, config.component));
|
|
34
44
|
}
|
|
35
45
|
};
|
|
36
46
|
}
|
package/build/blocks/index.d.ts
CHANGED
package/build/blocks/index.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import { installLayeredBlockStylesSupport } from "./layered-styles";
|
|
2
|
+
import { installSimpleNativePropertiesSupport } from "./simple-native-property";
|
|
1
3
|
export * from "./simple-block";
|
|
2
4
|
export * from "./layered-styles";
|
|
3
5
|
export * from "./simple-native-property";
|
|
4
6
|
export * from './common-native-property-implementations';
|
|
7
|
+
export function installGutenbergBlockExtensions() {
|
|
8
|
+
installLayeredBlockStylesSupport();
|
|
9
|
+
installSimpleNativePropertiesSupport();
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plaudit/gutenberg-api-extensions",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepublishOnly": "rm -rf build && mkdir build && tsc",
|
|
6
6
|
"build": "tsc",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@wordpress/block-editor": "^12.19.
|
|
25
|
-
"@wordpress/blocks": "^12.28.
|
|
26
|
-
"@wordpress/components": "^26.0.
|
|
24
|
+
"@wordpress/block-editor": "^12.19.1",
|
|
25
|
+
"@wordpress/blocks": "^12.28.1",
|
|
26
|
+
"@wordpress/components": "^26.0.1",
|
|
27
27
|
"@wordpress/compose": "^6.28.0",
|
|
28
|
-
"@wordpress/core-data": "^6.28.
|
|
28
|
+
"@wordpress/core-data": "^6.28.1",
|
|
29
29
|
"@wordpress/data": "^9.21.0",
|
|
30
30
|
"@wordpress/element": "^5.28.0",
|
|
31
31
|
"@wordpress/hooks": "^3.51.0",
|