UNPKG

@wordpress/block-library

Version:
165 lines (161 loc) 3.49 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _clsx = _interopRequireDefault(require("clsx")); var _migrateFontFamily = _interopRequireDefault(require("../utils/migrate-font-family")); /** * External dependencies */ /** * Internal dependencies */ const v2 = { attributes: { textAlign: { type: 'string' }, format: { type: 'string' }, isLink: { type: 'boolean', default: false, role: 'content' }, displayType: { type: 'string', default: 'date' } }, supports: { html: false, color: { gradients: true, link: true, __experimentalDefaultControls: { background: true, text: true, link: true } }, spacing: { margin: true, padding: true }, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontWeight: true, __experimentalFontStyle: true, __experimentalTextTransform: true, __experimentalTextDecoration: true, __experimentalLetterSpacing: true, __experimentalDefaultControls: { fontSize: true } }, interactivity: { clientNavigation: true }, __experimentalBorder: { radius: true, color: true, width: true, style: true, __experimentalDefaultControls: { radius: true, color: true, width: true, style: true } } }, save() { return null; }, migrate({ className, displayType, metadata, ...otherAttributes }) { if (displayType === 'date' || displayType === 'modified') { if (displayType === 'modified') { className = (0, _clsx.default)(className, 'wp-block-post-date__modified-date'); } return { ...otherAttributes, className, metadata: { ...metadata, bindings: { datetime: { source: 'core/post-data', args: { key: displayType } } } } }; } }, isEligible(attributes) { // If there's neither an explicit `datetime` attribute nor a block binding for that attribute, // then we're dealing with an old version of the block. return !attributes.datetime && !attributes?.metadata?.bindings?.datetime; } }; const v1 = { attributes: { textAlign: { type: 'string' }, format: { type: 'string' }, isLink: { type: 'boolean', default: false } }, supports: { html: false, color: { gradients: true, link: true }, typography: { fontSize: true, lineHeight: true, __experimentalFontFamily: true, __experimentalFontWeight: true, __experimentalFontStyle: true, __experimentalTextTransform: true, __experimentalLetterSpacing: true } }, save() { return null; }, migrate: _migrateFontFamily.default, isEligible({ style }) { return style?.typography?.fontFamily; } }; /** * New deprecations need to be placed first * for them to have higher priority. * * Old deprecations may need to be updated as well. * * See block-deprecation.md */ var _default = exports.default = [v2, v1]; //# sourceMappingURL=deprecated.js.map