@wordpress/blocks
Version:
Block API for WordPress.
74 lines (72 loc) • 2.47 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/blocks/src/store/private-actions.js
var private_actions_exports = {};
__export(private_actions_exports, {
addBlockBindingsSource: () => addBlockBindingsSource,
addBootstrappedBlockType: () => addBootstrappedBlockType,
addUnprocessedBlockType: () => addUnprocessedBlockType,
removeBlockBindingsSource: () => removeBlockBindingsSource
});
module.exports = __toCommonJS(private_actions_exports);
var import_process_block_type = require("./process-block-type");
function addBootstrappedBlockType(name, blockType) {
return {
type: "ADD_BOOTSTRAPPED_BLOCK_TYPE",
name,
blockType
};
}
function addUnprocessedBlockType(name, blockType) {
return ({ dispatch }) => {
dispatch({ type: "ADD_UNPROCESSED_BLOCK_TYPE", name, blockType });
const processedBlockType = dispatch(
(0, import_process_block_type.processBlockType)(name, blockType)
);
if (!processedBlockType) {
return;
}
dispatch.addBlockTypes(processedBlockType);
};
}
function addBlockBindingsSource(source) {
return {
type: "ADD_BLOCK_BINDINGS_SOURCE",
name: source.name,
label: source.label,
usesContext: source.usesContext,
getValues: source.getValues,
setValues: source.setValues,
canUserEditValue: source.canUserEditValue,
getFieldsList: source.getFieldsList
};
}
function removeBlockBindingsSource(name) {
return {
type: "REMOVE_BLOCK_BINDINGS_SOURCE",
name
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
addBlockBindingsSource,
addBootstrappedBlockType,
addUnprocessedBlockType,
removeBlockBindingsSource
});
//# sourceMappingURL=private-actions.js.map