@wordpress/block-library
Version:
Block library for the WordPress editor.
1 lines • 1.82 kB
Source Map (JSON)
{"version":3,"file":"variations.cjs","names":["__"],"sources":["../../src/categories/variations.js"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { category as icon } from '@wordpress/icons';\n\nconst variations = [\n\t{\n\t\tname: 'terms',\n\t\ttitle: __( 'Terms List' ),\n\t\ticon,\n\t\tattributes: {\n\t\t\t// We need to set an attribute here that will be set when inserting the block.\n\t\t\t// We cannot leave this empty, as that would be interpreted as the default value,\n\t\t\t// which is `category` -- for which we're defining a distinct variation below,\n\t\t\t// for backwards compatibility reasons.\n\t\t\t// The logical fallback is thus the only other built-in and public taxonomy: Tags.\n\t\t\ttaxonomy: 'post_tag',\n\t\t},\n\t\tisActive: ( blockAttributes ) =>\n\t\t\t// This variation is used for any taxonomy other than `category`.\n\t\t\tblockAttributes.taxonomy !== 'category',\n\t},\n\t{\n\t\tname: 'categories',\n\t\ttitle: __( 'Categories List' ),\n\t\tdescription: __( 'Display a list of all categories.' ),\n\t\ticon,\n\t\tattributes: {\n\t\t\ttaxonomy: 'category',\n\t\t},\n\t\tisActive: [ 'taxonomy' ],\n\t\t// The following is needed to prevent \"Terms List\" from showing up twice in the inserter\n\t\t// (once for the block, once for the variation). Fortunately, it does not collide with\n\t\t// `categories` being the default value of the `taxonomy` attribute.\n\t\tisDefault: true,\n\t},\n];\n\nexport default variations;\n"],"mappings":";;;;;;;;AAGA,MAAM,aAAa,CAClB;CACC,MAAM;CACN,QAAA,GAAOA,gBAAAA,GAAAA,CAAI,YAAa;CACxB,MAAA,iBAAA;CACA,YAAY,EAMX,UAAU,WACX;CACA,WAAY,oBAEX,gBAAgB,aAAa;AAC/B,GACA;CACC,MAAM;CACN,QAAA,GAAOA,gBAAAA,GAAAA,CAAI,iBAAkB;CAC7B,cAAA,GAAaA,gBAAAA,GAAAA,CAAI,mCAAoC;CACrD,MAAA,iBAAA;CACA,YAAY,EACX,UAAU,WACX;CACA,UAAU,CAAE,UAAW;CAIvB,WAAW;AACZ,CACD"}