@wordpress/block-library
Version:
Block library for the WordPress editor.
91 lines (90 loc) • 3.34 kB
JavaScript
;
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
// \0rolldown/runtime.js
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
let _wordpress_i18n = require("@wordpress/i18n");
let _wordpress_icons = require("@wordpress/icons");
let _wordpress_hooks = require("@wordpress/hooks");
let __deprecated_tsx = require("./deprecated.cjs");
__deprecated_tsx = __toESM(__deprecated_tsx);
let ___utils_init_block_js = require("../utils/init-block.cjs");
___utils_init_block_js = __toESM(___utils_init_block_js);
let __block_json = require("./block.json");
__block_json = __toESM(__block_json);
let __edit_jsx = require("./edit.cjs");
__edit_jsx = __toESM(__edit_jsx);
let __save_jsx = require("./save.cjs");
__save_jsx = __toESM(__save_jsx);
let __hooks_js = require("./hooks.cjs");
let __transforms_js = require("./transforms.cjs");
__transforms_js = __toESM(__transforms_js);
let __variations_js = require("./variations.cjs");
__variations_js = __toESM(__variations_js);
// packages/block-library/src/navigation-link/index.js
const { name } = __block_json.default;
const settings = {
icon: _wordpress_icons.customLink,
__experimentalLabel(attributes, { context }) {
if (context === "list-view") return attributes?.label;
if (context === "appender") {
const type = attributes?.type || "link";
return (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n._x)("Add %s", "add default block type"), type);
}
return attributes?.label;
},
merge(leftAttributes, { label: rightLabel = "" }) {
return {
...leftAttributes,
label: leftAttributes.label + rightLabel
};
},
edit: __edit_jsx.default,
save: __save_jsx.default,
example: { attributes: {
label: (0, _wordpress_i18n._x)("Example Link", "navigation link preview example"),
url: "https://example.com"
} },
deprecated: __deprecated_tsx.default,
transforms: __transforms_js.default,
variations: __variations_js.default
};
const init = () => {
(0, _wordpress_hooks.addFilter)("blocks.registerBlockType", "core/navigation-link", __hooks_js.enhanceNavigationLinkVariations);
return (0, ___utils_init_block_js.default)({
name,
metadata: __block_json.default,
settings
});
};
exports.init = init;
Object.defineProperty(exports, "metadata", {
enumerable: true,
get: function() {
return __block_json.default;
}
});
exports.name = name;
exports.settings = settings;
//# sourceMappingURL=index.cjs.map