UNPKG

@wordpress/block-library

Version:
1 lines • 991 B
{"version":3,"file":"map-template-part-to-block-pattern.cjs","names":["createTemplatePartId","parse"],"sources":["../../../../src/template-part/edit/utils/map-template-part-to-block-pattern.js"],"sourcesContent":["import { parse } from '@wordpress/blocks';\nimport { createTemplatePartId } from './create-template-part-id';\n\n/**\n * This maps the properties of a template part to those of a block pattern.\n * @param {Object} templatePart\n * @return {Object} The template part in the shape of block pattern.\n */\nexport function mapTemplatePartToBlockPattern( templatePart ) {\n\treturn {\n\t\tname: createTemplatePartId( templatePart.theme, templatePart.slug ),\n\t\ttitle: templatePart.title.rendered,\n\t\tblocks: parse( templatePart.content.raw ),\n\t\ttemplatePart,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;AAQA,SAAgB,8BAA+B,cAAe;CAC7D,OAAO;EACN,OAAA,GAAMA,6BAAAA,qBAAAA,CAAsB,aAAa,OAAO,aAAa,IAAK;EAClE,OAAO,aAAa,MAAM;EAC1B,SAAA,GAAQC,kBAAAA,MAAAA,CAAO,aAAa,QAAQ,GAAI;EACxC;CACD;AACD"}