@plaudit/gutenberg-api-extensions 1.3.1 → 1.4.1

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.
@@ -5,8 +5,8 @@ import React, { type ReactNode } from "react";
5
5
  export type SimpleBlockTypeConfig<TAttributes extends Record<string, any>> = {
6
6
  icon?: BlockConfiguration<TAttributes>['icon'] | undefined;
7
7
  defaults: Required<TAttributes>;
8
- controls: NonNullable<Block<TAttributes>['edit']>;
9
- renderer: (attributes: BlockSaveProps<TAttributes>, wrapperProps: UseBlockProps | UseBlockProps['save'], innerBlocks: () => React.ReactElement) => ReactNode;
8
+ controls?: NonNullable<Block<TAttributes>['edit']>;
9
+ renderer: (attributes: BlockSaveProps<TAttributes>, wrapperProps: UseBlockProps | UseBlockProps['save'], innerBlocks: () => React.ReactElement, mode: "edit" | "save") => ReactNode;
10
10
  innerBlocksProps?: InnerBlocks.Props;
11
11
  settings?: Partial<BlockConfiguration<TAttributes>>;
12
12
  };
@@ -15,12 +15,12 @@ export function registerSimpleBlockType(metadata, config) {
15
15
  }
16
16
  return registerBlockType(metadata, Object.assign(Object.assign({}, config.settings), { icon: (_a = config.icon) !== null && _a !== void 0 ? _a : plauditIcon, edit(props) {
17
17
  const populatedProps = applyDefaults(props);
18
- const rendered = config.renderer(populatedProps, useBlockProps, () => React.createElement(InnerBlocks, Object.assign({}, config.innerBlocksProps)));
18
+ const rendered = config.renderer(populatedProps, useBlockProps, () => React.createElement(InnerBlocks, Object.assign({}, config.innerBlocksProps)), "edit");
19
19
  return React.createElement(React.Fragment, null,
20
- React.createElement(config.controls, Object.assign({}, populatedProps)),
20
+ config.controls && React.createElement(config.controls, Object.assign({}, populatedProps)),
21
21
  rendered);
22
22
  },
23
23
  save(props) {
24
- return config.renderer(applyDefaults(props), useBlockProps.save, () => React.createElement(InnerBlocks.Content, null));
24
+ return config.renderer(applyDefaults(props), useBlockProps.save, () => React.createElement(InnerBlocks.Content, null), "save");
25
25
  } }));
26
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/gutenberg-api-extensions",
3
- "version": "1.3.1",
3
+ "version": "1.4.1",
4
4
  "scripts": {
5
5
  "prepublishOnly": "rm -rf build && mkdir build && tsc",
6
6
  "build": "tsc",
@@ -14,22 +14,22 @@
14
14
  "./controls": "./build/controls/index.js"
15
15
  },
16
16
  "dependencies": {
17
- "@wordpress/block-editor": "^12.3.0",
18
- "@wordpress/blocks": "^12.12.0",
19
- "@wordpress/components": "^25.1.0",
20
- "@wordpress/compose": "^6.12.0",
21
- "@wordpress/core-data": "^6.12.0",
22
- "@wordpress/data": "^9.5.0",
23
- "@wordpress/element": "^5.12.0",
24
- "@wordpress/hooks": "^3.35.0",
25
- "@wordpress/i18n": "^4.35.0",
17
+ "@wordpress/block-editor": "^12.4.0",
18
+ "@wordpress/blocks": "^12.13.0",
19
+ "@wordpress/components": "^25.2.0",
20
+ "@wordpress/compose": "^6.13.0",
21
+ "@wordpress/core-data": "^6.13.0",
22
+ "@wordpress/data": "^9.6.0",
23
+ "@wordpress/element": "^5.13.0",
24
+ "@wordpress/hooks": "^3.36.0",
25
+ "@wordpress/i18n": "^4.36.0",
26
26
  "react": "^18.2.0",
27
27
  "react-dom": "^18.2.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@types/react": "^18.2.13",
30
+ "@types/react": "^18.2.14",
31
31
  "@types/wordpress__block-editor": "^11.5.1",
32
32
  "@types/wordpress__blocks": "^12.5.0",
33
- "typescript": "^5.1.3"
33
+ "typescript": "^5.1.6"
34
34
  }
35
35
  }