@wordpress/block-library
Version:
Block library for the WordPress editor.
8 lines (7 loc) • 3.14 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../src/gallery/variations.js"],
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { gallery, grid } from '@wordpress/icons';\nimport { ATTACHED_MEDIA } from './dynamic-source';\nimport { isGalleryFlexLayout } from './shared';\n\nconst variations = [\n\t{\n\t\tname: 'dynamic-gallery',\n\t\ttitle: __( 'Dynamic Gallery' ),\n\t\tdescription: __(\n\t\t\t'Display images from a source, such as those attached to the current post.'\n\t\t),\n\t\tattributes: {\n\t\t\tdynamicContent: { source: ATTACHED_MEDIA },\n\t\t},\n\t\t// Match any gallery that has a dynamic source configured, regardless of\n\t\t// the specific source or options, so the variation's title and\n\t\t// description describe the block whenever it runs in dynamic mode.\n\t\tisActive: ( blockAttributes ) => !! blockAttributes.dynamicContent,\n\t\t// No scopes for now. While dynamic mode only supports the \"attached to the\n\t\t// current post\" source, `'inserter'` is intentionally omitted: a dedicated\n\t\t// inserter entry would surface in post-less contexts (templates, template\n\t\t// parts, synced patterns) where there's no post to resolve images from. The\n\t\t// entry point is instead the inspector toggle on a regular Gallery.\n\t\t// `isActive` still relabels the block card to \"Dynamic Gallery\" regardless\n\t\t// of scope. Revisit adding `'inserter'` in a follow-up as the feature grows\n\t\t// beyond the post-attached source.\n\t\tscope: [],\n\t},\n\t{\n\t\tname: 'gallery-flex',\n\t\ttitle: __( 'Gallery' ),\n\t\tdescription: __( 'Arrange images in flexible rows.' ),\n\t\ticon: gallery,\n\t\tattributes: {\n\t\t\tlayout: {\n\t\t\t\ttype: 'flex',\n\t\t\t},\n\t\t},\n\t\tisActive: ( blockAttributes ) =>\n\t\t\tisGalleryFlexLayout( blockAttributes.layout ),\n\t\tscope: [ 'transform' ],\n\t},\n\t{\n\t\tname: 'gallery-grid',\n\t\ttitle: __( 'Gallery Grid' ),\n\t\tdescription: __( 'Arrange images in a grid.' ),\n\t\ticon: grid,\n\t\tattributes: {\n\t\t\tlayout: {\n\t\t\t\ttype: 'grid',\n\t\t\t},\n\t\t},\n\t\tisActive: ( blockAttributes ) =>\n\t\t\tblockAttributes.layout?.type === 'grid',\n\t\tscope: [ 'transform' ],\n\t},\n];\n\nexport default variations;\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmB;AACnB,mBAA8B;AAC9B,4BAA+B;AAC/B,oBAAoC;AAEpC,IAAM,aAAa;AAAA,EAClB;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,iBAAkB;AAAA,IAC7B,iBAAa;AAAA,MACZ;AAAA,IACD;AAAA,IACA,YAAY;AAAA,MACX,gBAAgB,EAAE,QAAQ,qCAAe;AAAA,IAC1C;AAAA;AAAA;AAAA;AAAA,IAIA,UAAU,CAAE,oBAAqB,CAAC,CAAE,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASpD,OAAO,CAAC;AAAA,EACT;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,SAAU;AAAA,IACrB,iBAAa,gBAAI,kCAAmC;AAAA,IACpD,MAAM;AAAA,IACN,YAAY;AAAA,MACX,QAAQ;AAAA,QACP,MAAM;AAAA,MACP;AAAA,IACD;AAAA,IACA,UAAU,CAAE,wBACX,mCAAqB,gBAAgB,MAAO;AAAA,IAC7C,OAAO,CAAE,WAAY;AAAA,EACtB;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,cAAe;AAAA,IAC1B,iBAAa,gBAAI,2BAA4B;AAAA,IAC7C,MAAM;AAAA,IACN,YAAY;AAAA,MACX,QAAQ;AAAA,QACP,MAAM;AAAA,MACP;AAAA,IACD;AAAA,IACA,UAAU,CAAE,oBACX,gBAAgB,QAAQ,SAAS;AAAA,IAClC,OAAO,CAAE,WAAY;AAAA,EACtB;AACD;AAEA,IAAO,qBAAQ;",
"names": []
}