@wordpress/block-editor
Version:
103 lines (101 loc) • 3.31 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/block-editor/src/layouts/flow.js
var flow_exports = {};
__export(flow_exports, {
default: () => flow_default
});
module.exports = __toCommonJS(flow_exports);
var import_i18n = require("@wordpress/i18n");
var import_utils = require("./utils");
var import_gap = require("../hooks/gap");
var import_utils2 = require("../hooks/utils");
var import_definitions = require("./definitions");
var flow_default = {
name: "default",
label: (0, import_i18n.__)("Flow"),
inspectorControls: function DefaultLayoutInspectorControls() {
return null;
},
toolBarControls: function DefaultLayoutToolbarControls() {
return null;
},
getLayoutStyle: function getLayoutStyle({
selector,
style,
blockName,
hasBlockGapSupport,
layoutDefinitions = import_definitions.LAYOUT_DEFINITIONS
}) {
const blockGapStyleValue = (0, import_gap.getGapCSSValue)(style?.spacing?.blockGap);
let blockGapValue = "";
if (!(0, import_utils2.shouldSkipSerialization)(blockName, "spacing", "blockGap")) {
if (blockGapStyleValue?.top) {
blockGapValue = (0, import_gap.getGapCSSValue)(blockGapStyleValue?.top);
} else if (typeof blockGapStyleValue === "string") {
blockGapValue = (0, import_gap.getGapCSSValue)(blockGapStyleValue);
}
}
let output = "";
if (hasBlockGapSupport && blockGapValue) {
output += (0, import_utils.getBlockGapCSS)(
selector,
layoutDefinitions,
"default",
blockGapValue
);
}
return output;
},
getOrientation() {
return "vertical";
},
getAlignments(layout, isBlockBasedTheme) {
const alignmentInfo = (0, import_utils.getAlignmentsInfo)(layout);
if (layout.alignments !== void 0) {
if (!layout.alignments.includes("none")) {
layout.alignments.unshift("none");
}
return layout.alignments.map((alignment) => ({
name: alignment,
info: alignmentInfo[alignment]
}));
}
const alignments = [
{ name: "left" },
{ name: "center" },
{ name: "right" }
];
if (!isBlockBasedTheme) {
const { contentSize, wideSize } = layout;
if (contentSize) {
alignments.unshift({ name: "full" });
}
if (wideSize) {
alignments.unshift({
name: "wide",
info: alignmentInfo.wide
});
}
}
alignments.unshift({ name: "none", info: alignmentInfo.none });
return alignments;
}
};
//# sourceMappingURL=flow.js.map