@wordpress/block-library
Version:
Block library for the WordPress editor.
1 lines • 10.6 kB
Source Map (JSON)
{"version":3,"file":"deprecated.cjs","names":["migrateTextAlign","migrateFontFamily"],"sources":["../../src/post-date/deprecated.js"],"sourcesContent":["import clsx from 'clsx';\nimport migrateFontFamily from '../utils/migrate-font-family';\nimport migrateTextAlign from '../utils/migrate-text-align';\n\nconst v4 = {\n\tattributes: {\n\t\tdatetime: {\n\t\t\ttype: 'string',\n\t\t\trole: 'content',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\trole: 'content',\n\t\t},\n\t},\n\tsupports: {\n\t\tanchor: true,\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tbackground: true,\n\t\t\t\ttext: true,\n\t\t\t\tlink: true,\n\t\t\t},\n\t\t},\n\t\tspacing: {\n\t\t\tmargin: true,\n\t\t\tpadding: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalTextDecoration: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tfontSize: true,\n\t\t\t},\n\t\t},\n\t\tinteractivity: {\n\t\t\tclientNavigation: true,\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tradius: true,\n\t\t\tcolor: true,\n\t\t\twidth: true,\n\t\t\tstyle: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tradius: true,\n\t\t\t\tcolor: true,\n\t\t\t\twidth: true,\n\t\t\t\tstyle: true,\n\t\t\t},\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate: migrateTextAlign,\n\tisEligible( attributes ) {\n\t\treturn (\n\t\t\t!! attributes.textAlign ||\n\t\t\t!! attributes.className?.match(\n\t\t\t\t/\\bhas-text-align-(left|center|right)\\b/\n\t\t\t)\n\t\t);\n\t},\n};\n\nconst v3 = {\n\tattributes: {\n\t\tdatetime: {\n\t\t\ttype: 'string',\n\t\t\trole: 'content',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\trole: 'content',\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tbackground: true,\n\t\t\t\ttext: true,\n\t\t\t\tlink: true,\n\t\t\t},\n\t\t},\n\t\tspacing: {\n\t\t\tmargin: true,\n\t\t\tpadding: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalTextDecoration: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tfontSize: true,\n\t\t\t},\n\t\t},\n\t\tinteractivity: {\n\t\t\tclientNavigation: true,\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tradius: true,\n\t\t\tcolor: true,\n\t\t\twidth: true,\n\t\t\tstyle: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tradius: true,\n\t\t\t\tcolor: true,\n\t\t\t\twidth: true,\n\t\t\t\tstyle: true,\n\t\t\t},\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate( {\n\t\tmetadata: {\n\t\t\tbindings: {\n\t\t\t\tdatetime: {\n\t\t\t\t\tsource,\n\t\t\t\t\targs: { key, ...otherArgs },\n\t\t\t\t},\n\t\t\t\t...otherBindings\n\t\t\t},\n\t\t\t...otherMetadata\n\t\t},\n\t\t...otherAttributes\n\t} ) {\n\t\t// Change the block bindings source argument name from \"key\" to \"field\".\n\t\treturn migrateTextAlign( {\n\t\t\tmetadata: {\n\t\t\t\tbindings: {\n\t\t\t\t\tdatetime: {\n\t\t\t\t\t\tsource,\n\t\t\t\t\t\targs: { field: key, ...otherArgs },\n\t\t\t\t\t},\n\t\t\t\t\t...otherBindings,\n\t\t\t\t},\n\t\t\t\t...otherMetadata,\n\t\t\t},\n\t\t\t...otherAttributes,\n\t\t} );\n\t},\n\tisEligible( attributes ) {\n\t\treturn (\n\t\t\tattributes?.metadata?.bindings?.datetime?.source ===\n\t\t\t\t'core/post-data' &&\n\t\t\t!! attributes?.metadata?.bindings?.datetime?.args?.key\n\t\t);\n\t},\n};\n\nconst v2 = {\n\tattributes: {\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\trole: 'content',\n\t\t},\n\t\tdisplayType: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'date',\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tbackground: true,\n\t\t\t\ttext: true,\n\t\t\t\tlink: true,\n\t\t\t},\n\t\t},\n\t\tspacing: {\n\t\t\tmargin: true,\n\t\t\tpadding: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalTextDecoration: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tfontSize: true,\n\t\t\t},\n\t\t},\n\t\tinteractivity: {\n\t\t\tclientNavigation: true,\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tradius: true,\n\t\t\tcolor: true,\n\t\t\twidth: true,\n\t\t\tstyle: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tradius: true,\n\t\t\t\tcolor: true,\n\t\t\t\twidth: true,\n\t\t\t\tstyle: true,\n\t\t\t},\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate( { className, displayType, metadata, ...otherAttributes } ) {\n\t\tif ( displayType === 'date' || displayType === 'modified' ) {\n\t\t\tif ( displayType === 'modified' ) {\n\t\t\t\tclassName = clsx(\n\t\t\t\t\tclassName,\n\t\t\t\t\t'wp-block-post-date__modified-date'\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn migrateTextAlign( {\n\t\t\t\t...otherAttributes,\n\t\t\t\tclassName,\n\t\t\t\tmetadata: {\n\t\t\t\t\t...metadata,\n\t\t\t\t\tbindings: {\n\t\t\t\t\t\tdatetime: {\n\t\t\t\t\t\t\tsource: 'core/post-data',\n\t\t\t\t\t\t\targs: { field: displayType },\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t},\n\tisEligible( attributes ) {\n\t\t// If there's neither an explicit `datetime` attribute nor a block binding for that attribute,\n\t\t// then we're dealing with an old version of the block.\n\t\treturn (\n\t\t\t! attributes.datetime && ! attributes?.metadata?.bindings?.datetime\n\t\t);\n\t},\n};\n\nconst v1 = {\n\tattributes: {\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate( attributes ) {\n\t\treturn migrateTextAlign( migrateFontFamily( attributes ) );\n\t},\n\tisEligible( { style } ) {\n\t\treturn style?.typography?.fontFamily;\n\t},\n};\n\n/**\n * New deprecations need to be placed first\n * for them to have higher priority.\n *\n * Old deprecations may need to be updated as well.\n *\n * See block-deprecation.md\n */\nexport default [ v4, v3, v2, v1 ];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyUA,IAAA,qBAAe;CAAE;EApUhB,YAAY;GACX,UAAU;IACT,MAAM;IACN,MAAM;GACP;GACA,WAAW,EACV,MAAM,SACP;GACA,QAAQ,EACP,MAAM,SACP;GACA,QAAQ;IACP,MAAM;IACN,SAAS;IACT,MAAM;GACP;EACD;EACA,UAAU;GACT,QAAQ;GACR,MAAM;GACN,OAAO;IACN,WAAW;IACX,MAAM;IACN,+BAA+B;KAC9B,YAAY;KACZ,MAAM;KACN,MAAM;IACP;GACD;GACA,SAAS;IACR,QAAQ;IACR,SAAS;GACV;GACA,YAAY;IACX,UAAU;IACV,YAAY;IACZ,0BAA0B;IAC1B,0BAA0B;IAC1B,yBAAyB;IACzB,6BAA6B;IAC7B,8BAA8B;IAC9B,6BAA6B;IAC7B,+BAA+B,EAC9B,UAAU,KACX;GACD;GACA,eAAe,EACd,kBAAkB,KACnB;GACA,sBAAsB;IACrB,QAAQ;IACR,OAAO;IACP,OAAO;IACP,OAAO;IACP,+BAA+B;KAC9B,QAAQ;KACR,OAAO;KACP,OAAO;K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