UNPKG

@wordpress/block-library

Version:
8 lines (7 loc) 3.11 kB
{ "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,SAAS,UAAU;AACnB,SAAS,SAAS,YAAY;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,2BAA2B;AAEpC,IAAM,aAAa;AAAA,EAClB;AAAA,IACC,MAAM;AAAA,IACN,OAAO,GAAI,iBAAkB;AAAA,IAC7B,aAAa;AAAA,MACZ;AAAA,IACD;AAAA,IACA,YAAY;AAAA,MACX,gBAAgB,EAAE,QAAQ,eAAe;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,OAAO,GAAI,SAAU;AAAA,IACrB,aAAa,GAAI,kCAAmC;AAAA,IACpD,MAAM;AAAA,IACN,YAAY;AAAA,MACX,QAAQ;AAAA,QACP,MAAM;AAAA,MACP;AAAA,IACD;AAAA,IACA,UAAU,CAAE,oBACX,oBAAqB,gBAAgB,MAAO;AAAA,IAC7C,OAAO,CAAE,WAAY;AAAA,EACtB;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,OAAO,GAAI,cAAe;AAAA,IAC1B,aAAa,GAAI,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": [] }