@wordpress/block-library 6.0.9 → 6.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/build/cover/edit.js +8 -3
  2. package/build/cover/edit.js.map +1 -1
  3. package/build/gallery/edit.js +1 -1
  4. package/build/gallery/edit.js.map +1 -1
  5. package/build/gallery/v1/update-gallery-modal.js +1 -1
  6. package/build/gallery/v1/update-gallery-modal.js.map +1 -1
  7. package/build/index.js +3 -2
  8. package/build/index.js.map +1 -1
  9. package/build/navigation/deprecated.js +118 -12
  10. package/build/navigation/deprecated.js.map +1 -1
  11. package/build/navigation/edit/index.js +45 -31
  12. package/build/navigation/edit/index.js.map +1 -1
  13. package/build/navigation/edit/navigation-menu-selector.js +2 -2
  14. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  15. package/build/navigation/edit/placeholder/index.js +16 -48
  16. package/build/navigation/edit/placeholder/index.js.map +1 -1
  17. package/build/navigation/edit/unsaved-inner-blocks.js +4 -35
  18. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  19. package/build/navigation/edit/use-create-navigation-menu.js +50 -0
  20. package/build/navigation/edit/use-create-navigation-menu.js.map +1 -0
  21. package/build/navigation/edit/use-generate-default-navigation-title.js +73 -0
  22. package/build/navigation/edit/use-generate-default-navigation-title.js.map +1 -0
  23. package/build/navigation/index.js +1 -1
  24. package/build/navigation/save.js +2 -2
  25. package/build/navigation/save.js.map +1 -1
  26. package/build/navigation/use-navigation-menu.js +19 -8
  27. package/build/navigation/use-navigation-menu.js.map +1 -1
  28. package/build/pattern/index.js +1 -1
  29. package/build/post-featured-image/edit.js +2 -3
  30. package/build/post-featured-image/edit.js.map +1 -1
  31. package/build/post-terms/index.js +1 -1
  32. package/build/post-title/edit.js +2 -2
  33. package/build/post-title/edit.js.map +1 -1
  34. package/build/query-title/index.js +1 -1
  35. package/build/site-logo/index.js +1 -1
  36. package/build/site-tagline/index.js +1 -1
  37. package/build/site-title/index.js +1 -1
  38. package/build/template-part/edit/placeholder/index.js +1 -1
  39. package/build/template-part/edit/placeholder/index.js.map +1 -1
  40. package/build/template-part/index.js +2 -1
  41. package/build/template-part/index.js.map +1 -1
  42. package/build-module/cover/edit.js +8 -3
  43. package/build-module/cover/edit.js.map +1 -1
  44. package/build-module/gallery/edit.js +1 -1
  45. package/build-module/gallery/edit.js.map +1 -1
  46. package/build-module/gallery/v1/update-gallery-modal.js +1 -1
  47. package/build-module/gallery/v1/update-gallery-modal.js.map +1 -1
  48. package/build-module/index.js +3 -2
  49. package/build-module/index.js.map +1 -1
  50. package/build-module/navigation/deprecated.js +118 -12
  51. package/build-module/navigation/deprecated.js.map +1 -1
  52. package/build-module/navigation/edit/index.js +46 -31
  53. package/build-module/navigation/edit/index.js.map +1 -1
  54. package/build-module/navigation/edit/navigation-menu-selector.js +2 -2
  55. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  56. package/build-module/navigation/edit/placeholder/index.js +15 -45
  57. package/build-module/navigation/edit/placeholder/index.js.map +1 -1
  58. package/build-module/navigation/edit/unsaved-inner-blocks.js +6 -35
  59. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  60. package/build-module/navigation/edit/use-create-navigation-menu.js +36 -0
  61. package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -0
  62. package/build-module/navigation/edit/use-generate-default-navigation-title.js +57 -0
  63. package/build-module/navigation/edit/use-generate-default-navigation-title.js.map +1 -0
  64. package/build-module/navigation/index.js +1 -1
  65. package/build-module/navigation/save.js +2 -2
  66. package/build-module/navigation/save.js.map +1 -1
  67. package/build-module/navigation/use-navigation-menu.js +19 -8
  68. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  69. package/build-module/pattern/index.js +1 -1
  70. package/build-module/post-featured-image/edit.js +2 -3
  71. package/build-module/post-featured-image/edit.js.map +1 -1
  72. package/build-module/post-terms/index.js +1 -1
  73. package/build-module/post-title/edit.js +2 -2
  74. package/build-module/post-title/edit.js.map +1 -1
  75. package/build-module/query-title/index.js +1 -1
  76. package/build-module/site-logo/index.js +1 -1
  77. package/build-module/site-tagline/index.js +1 -1
  78. package/build-module/site-title/index.js +1 -1
  79. package/build-module/template-part/edit/placeholder/index.js +2 -2
  80. package/build-module/template-part/edit/placeholder/index.js.map +1 -1
  81. package/build-module/template-part/index.js +2 -1
  82. package/build-module/template-part/index.js.map +1 -1
  83. package/build-style/editor-rtl.css +5 -4
  84. package/build-style/editor.css +5 -4
  85. package/build-style/gallery/editor-rtl.css +1 -0
  86. package/build-style/gallery/editor.css +1 -0
  87. package/build-style/post-featured-image/editor-rtl.css +2 -2
  88. package/build-style/post-featured-image/editor.css +2 -2
  89. package/build-style/site-logo/editor-rtl.css +2 -2
  90. package/build-style/site-logo/editor.css +2 -2
  91. package/package.json +8 -8
  92. package/src/calendar/index.php +2 -2
  93. package/src/cover/edit.js +8 -1
  94. package/src/gallery/edit.js +1 -1
  95. package/src/gallery/editor.scss +1 -0
  96. package/src/gallery/v1/update-gallery-modal.js +1 -1
  97. package/src/index.js +27 -25
  98. package/src/navigation/block.json +1 -1
  99. package/src/navigation/deprecated.js +105 -4
  100. package/src/navigation/edit/index.js +43 -36
  101. package/src/navigation/edit/navigation-menu-selector.js +2 -2
  102. package/src/navigation/edit/placeholder/index.js +16 -62
  103. package/src/navigation/edit/unsaved-inner-blocks.js +6 -57
  104. package/src/navigation/edit/use-create-navigation-menu.js +39 -0
  105. package/src/navigation/edit/use-generate-default-navigation-title.js +79 -0
  106. package/src/navigation/index.php +128 -14
  107. package/src/navigation/save.js +2 -2
  108. package/src/navigation/use-navigation-menu.js +20 -9
  109. package/src/page-list/index.php +5 -0
  110. package/src/pattern/block.json +1 -1
  111. package/src/post-featured-image/edit.js +2 -5
  112. package/src/post-featured-image/editor.scss +2 -2
  113. package/src/post-terms/block.json +1 -1
  114. package/src/post-title/edit.js +2 -2
  115. package/src/query-title/block.json +1 -1
  116. package/src/site-logo/block.json +1 -1
  117. package/src/site-logo/editor.scss +2 -2
  118. package/src/site-tagline/block.json +1 -1
  119. package/src/site-title/block.json +1 -1
  120. package/src/template-part/block.json +2 -1
  121. package/src/template-part/edit/placeholder/index.js +2 -2
  122. package/src/template-part/index.php +2 -1
  123. package/build/navigation/edit/navigation-menu-name-modal.js +0 -55
  124. package/build/navigation/edit/navigation-menu-name-modal.js.map +0 -1
  125. package/build/navigation/edit/navigation-menu-publish-button.js +0 -53
  126. package/build/navigation/edit/navigation-menu-publish-button.js.map +0 -1
  127. package/build-module/navigation/edit/navigation-menu-name-modal.js +0 -47
  128. package/build-module/navigation/edit/navigation-menu-name-modal.js.map +0 -1
  129. package/build-module/navigation/edit/navigation-menu-publish-button.js +0 -40
  130. package/build-module/navigation/edit/navigation-menu-publish-button.js.map +0 -1
  131. package/src/navigation/edit/navigation-menu-name-modal.js +0 -69
  132. package/src/navigation/edit/navigation-menu-publish-button.js +0 -57
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/template-part/edit/placeholder/index.js"],"names":["find","__","sprintf","useCallback","useState","useDispatch","useSelect","Placeholder","Dropdown","Button","Spinner","serialize","store","coreStore","TemplatePartSelection","PatternsSetup","PLACEHOLDER_STEPS","initial","patterns","TemplatePartPlaceholder","area","clientId","setAttributes","enableSelection","hasResolvedReplacements","saveEntityRecord","step","setStep","areaIcon","areaLabel","select","definedAreas","__experimentalGetDefaultTemplatePartAreas","selectedArea","defaultArea","icon","label","onCreate","startingBlocks","title","record","slug","content","templatePart","theme","undefined","toLowerCase","isOpen","onToggle","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,WAAT,EAAsBC,QAAtB,QAAsC,oBAAtC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAsBC,QAAtB,EAAgCC,MAAhC,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QAAQ,EAAC,mBAFV;AAGC,IAAA,YAAY,EAAG;AAAA,UAAE;AAAEuB,QAAAA,MAAF;AAAUC,QAAAA;AAAV,OAAF;AAAA,aACd,8BACGzB,eAAe,IAChB,cAAC,MAAD;AACC,QAAA,OAAO,EAAC,SADT;AAEC,QAAA,OAAO,EAAGyB,QAFX;AAGC,yBAAgBD;AAHjB,SAKG9C,EAAE,CAAE,iBAAF,CALL,CAFF,EAUC,cAAC,MAAD;AACC,QAAA,OAAO,EACNsB,eAAe,GACZ,UADY,GAEZ,SAJL;AAMC,QAAA,OAAO,EAAG,MACTI,OAAO,CACNX,iBAAiB,CAACE,QADZ;AAPT,SAYGhB,OAAO,EACR;AACAD,MAAAA,EAAE,CAAE,QAAF,CAFM,EAGR4B,SAAS,CAACiB,WAAV,EAHQ,CAZV,CAVD,CADc;AAAA,KAHhB;AAkCC,IAAA,aAAa,EAAG;AAAA,UAAE;AAAEG,QAAAA;AAAF,OAAF;AAAA,aACf,cAAC,qBAAD;AACC,QAAA,aAAa,EAAG3B,aADjB;AAEC,QAAA,OAAO,EAAG2B,OAFX;AAGC,QAAA,IAAI,EAAG7B;AAHR,QADe;AAAA;AAlCjB,IAtBF,CAFF,EAqEGM,IAAI,KAAKV,iBAAiB,CAACE,QAA3B,IACD,cAAC,aAAD;AACC,IAAA,IAAI,EAAGE,IADR;AAEC,IAAA,SAAS,EAAGS,SAFb;AAGC,IAAA,QAAQ,EAAGD,QAHZ;AAIC,IAAA,QAAQ,EAAGS,QAJZ;AAKC,IAAA,QAAQ,EAAGhB,QALZ;AAMC,IAAA,gBAAgB,EAAG,MAClBM,OAAO,CAAEX,iBAAiB,CAACC,OAApB;AAPT,IAtEF,CADD;AAoFA","sourcesContent":["/**\n * External dependencies\n */\nimport { find } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useState } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Placeholder, Dropdown, Button, Spinner } from '@wordpress/components';\nimport { serialize } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartSelection from '../selection';\nimport PatternsSetup from './patterns-setup';\n\nconst PLACEHOLDER_STEPS = {\n\tinitial: 1,\n\tpatterns: 2,\n};\n\nexport default function TemplatePartPlaceholder( {\n\tarea,\n\tclientId,\n\tsetAttributes,\n\tenableSelection,\n\thasResolvedReplacements,\n} ) {\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst [ step, setStep ] = useState( PLACEHOLDER_STEPS.initial );\n\n\tconst { areaIcon, areaLabel } = useSelect(\n\t\t( select ) => {\n\t\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t\t// Blocks can be loaded into a *non-post* block editor.\n\t\t\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\t\t\tconst definedAreas = select(\n\t\t\t\t'core/editor'\n\t\t\t).__experimentalGetDefaultTemplatePartAreas();\n\n\t\t\tconst selectedArea = find( definedAreas, { area } );\n\t\t\tconst defaultArea = find( definedAreas, { area: 'uncategorized' } );\n\n\t\t\treturn {\n\t\t\t\tareaIcon: selectedArea?.icon || defaultArea?.icon,\n\t\t\t\tareaLabel: selectedArea?.label || __( 'Template Part' ),\n\t\t\t};\n\t\t},\n\t\t[ area ]\n\t);\n\n\tconst onCreate = useCallback(\n\t\tasync (\n\t\t\tstartingBlocks = [],\n\t\t\ttitle = __( 'Untitled Template Part' )\n\t\t) => {\n\t\t\t// If we have `area` set from block attributes, means an exposed\n\t\t\t// block variation was inserted. So add this prop to the template\n\t\t\t// part entity on creation. Afterwards remove `area` value from\n\t\t\t// block attributes.\n\t\t\tconst record = {\n\t\t\t\ttitle,\n\t\t\t\tslug: 'template-part',\n\t\t\t\tcontent: serialize( startingBlocks ),\n\t\t\t\t// `area` is filterable on the server and defaults to `UNCATEGORIZED`\n\t\t\t\t// if provided value is not allowed.\n\t\t\t\tarea,\n\t\t\t};\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\trecord\n\t\t\t);\n\t\t\tsetAttributes( {\n\t\t\t\tslug: templatePart.slug,\n\t\t\t\ttheme: templatePart.theme,\n\t\t\t\tarea: undefined,\n\t\t\t} );\n\t\t},\n\t\t[ setAttributes, area ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ step === PLACEHOLDER_STEPS.initial && (\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ areaIcon }\n\t\t\t\t\tlabel={ areaLabel }\n\t\t\t\t\tinstructions={\n\t\t\t\t\t\tenableSelection\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'Choose an existing %s or create a new one.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tareaLabel.toLowerCase()\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t\t\t\t__( 'Create a new %s.' ),\n\t\t\t\t\t\t\t\t\tareaLabel.toLowerCase()\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ ! hasResolvedReplacements ? (\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tcontentClassName=\"wp-block-template-part__placeholder-preview-dropdown-content\"\n\t\t\t\t\t\t\tposition=\"bottom right left\"\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ enableSelection && (\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Choose existing' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\tenableSelection\n\t\t\t\t\t\t\t\t\t\t\t\t? 'tertiary'\n\t\t\t\t\t\t\t\t\t\t\t\t: 'primary'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetStep(\n\t\t\t\t\t\t\t\t\t\t\t\tPLACEHOLDER_STEPS.patterns\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t\t\t\t\t\t__( 'New %s' ),\n\t\t\t\t\t\t\t\t\t\t\tareaLabel.toLowerCase()\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<TemplatePartSelection\n\t\t\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t\t{ step === PLACEHOLDER_STEPS.patterns && (\n\t\t\t\t<PatternsSetup\n\t\t\t\t\tarea={ area }\n\t\t\t\t\tareaLabel={ areaLabel }\n\t\t\t\t\tareaIcon={ areaIcon }\n\t\t\t\t\tonCreate={ onCreate }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tresetPlaceholder={ () =>\n\t\t\t\t\t\tsetStep( PLACEHOLDER_STEPS.initial )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/template-part/edit/placeholder/index.js"],"names":["find","kebabCase","__","sprintf","useCallback","useState","useDispatch","useSelect","Placeholder","Dropdown","Button","Spinner","serialize","store","coreStore","TemplatePartSelection","PatternsSetup","PLACEHOLDER_STEPS","initial","patterns","TemplatePartPlaceholder","area","clientId","setAttributes","enableSelection","hasResolvedReplacements","saveEntityRecord","step","setStep","areaIcon","areaLabel","select","definedAreas","__experimentalGetDefaultTemplatePartAreas","selectedArea","defaultArea","icon","label","onCreate","startingBlocks","title","record","slug","content","templatePart","theme","undefined","toLowerCase","isOpen","onToggle","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,SAAf,QAAgC,QAAhC;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,WAAT,EAAsBC,QAAtB,QAAsC,oBAAtC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAsBC,QAAtB,EAAgCC,MAAhC,EAAwCC,OAAxC,QAAuD,uBAAvD;AACA,SAASC,SAAT,QAA0B,mBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,qBAAP,MAAkC,cAAlC;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AAEA,MAAMC,iBAAiB,GAAG;AACzBC,EAAAA,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BAAgBD;AAHjB,SAKG9C,EAAE,CAAE,iBAAF,CALL,CAFF,EAUC,cAAC,MAAD;AACC,QAAA,OAAO,EACNsB,eAAe,GACZ,UADY,GAEZ,SAJL;AAMC,QAAA,OAAO,EAAG,MACTI,OAAO,CACNX,iBAAiB,CAACE,QADZ;AAPT,SAYGhB,OAAO,EACR;AACAD,MAAAA,EAAE,CAAE,QAAF,CAFM,EAGR4B,SAAS,CAACiB,WAAV,EAHQ,CAZV,CAVD,CADc;AAAA,KAHhB;AAkCC,IAAA,aAAa,EAAG;AAAA,UAAE;AAAEG,QAAAA;AAAF,OAAF;AAAA,aACf,cAAC,qBAAD;AACC,QAAA,aAAa,EAAG3B,aADjB;AAEC,QAAA,OAAO,EAAG2B,OAFX;AAGC,QAAA,IAAI,EAAG7B;AAHR,QADe;AAAA;AAlCjB,IAtBF,CAFF,EAqEGM,IAAI,KAAKV,iBAAiB,CAACE,QAA3B,IACD,cAAC,aAAD;AACC,IAAA,IAAI,EAAGE,IADR;AAEC,IAAA,SAAS,EAAGS,SAFb;AAGC,IAAA,QAAQ,EAAGD,QAHZ;AAIC,IAAA,QAAQ,EAAGS,QAJZ;AAKC,IAAA,QAAQ,EAAGhB,QALZ;AAMC,IAAA,gBAAgB,EAAG,MAClBM,OAAO,CAAEX,iBAAiB,CAACC,OAApB;AAPT,IAtEF,CADD;AAoFA","sourcesContent":["/**\n * External dependencies\n */\nimport { find, kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useState } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Placeholder, Dropdown, Button, Spinner } from '@wordpress/components';\nimport { serialize } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartSelection from '../selection';\nimport PatternsSetup from './patterns-setup';\n\nconst PLACEHOLDER_STEPS = {\n\tinitial: 1,\n\tpatterns: 2,\n};\n\nexport default function TemplatePartPlaceholder( {\n\tarea,\n\tclientId,\n\tsetAttributes,\n\tenableSelection,\n\thasResolvedReplacements,\n} ) {\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst [ step, setStep ] = useState( PLACEHOLDER_STEPS.initial );\n\n\tconst { areaIcon, areaLabel } = useSelect(\n\t\t( select ) => {\n\t\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t\t// Blocks can be loaded into a *non-post* block editor.\n\t\t\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\t\t\tconst definedAreas = select(\n\t\t\t\t'core/editor'\n\t\t\t).__experimentalGetDefaultTemplatePartAreas();\n\n\t\t\tconst selectedArea = find( definedAreas, { area } );\n\t\t\tconst defaultArea = find( definedAreas, { area: 'uncategorized' } );\n\n\t\t\treturn {\n\t\t\t\tareaIcon: selectedArea?.icon || defaultArea?.icon,\n\t\t\t\tareaLabel: selectedArea?.label || __( 'Template Part' ),\n\t\t\t};\n\t\t},\n\t\t[ area ]\n\t);\n\n\tconst onCreate = useCallback(\n\t\tasync (\n\t\t\tstartingBlocks = [],\n\t\t\ttitle = __( 'Untitled Template Part' )\n\t\t) => {\n\t\t\t// If we have `area` set from block attributes, means an exposed\n\t\t\t// block variation was inserted. So add this prop to the template\n\t\t\t// part entity on creation. Afterwards remove `area` value from\n\t\t\t// block attributes.\n\t\t\tconst record = {\n\t\t\t\ttitle,\n\t\t\t\tslug: kebabCase( title ),\n\t\t\t\tcontent: serialize( startingBlocks ),\n\t\t\t\t// `area` is filterable on the server and defaults to `UNCATEGORIZED`\n\t\t\t\t// if provided value is not allowed.\n\t\t\t\tarea,\n\t\t\t};\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\trecord\n\t\t\t);\n\t\t\tsetAttributes( {\n\t\t\t\tslug: templatePart.slug,\n\t\t\t\ttheme: templatePart.theme,\n\t\t\t\tarea: undefined,\n\t\t\t} );\n\t\t},\n\t\t[ setAttributes, area ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ step === PLACEHOLDER_STEPS.initial && (\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ areaIcon }\n\t\t\t\t\tlabel={ areaLabel }\n\t\t\t\t\tinstructions={\n\t\t\t\t\t\tenableSelection\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'Choose an existing %s or create a new one.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tareaLabel.toLowerCase()\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t\t\t\t__( 'Create a new %s.' ),\n\t\t\t\t\t\t\t\t\tareaLabel.toLowerCase()\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ ! hasResolvedReplacements ? (\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tcontentClassName=\"wp-block-template-part__placeholder-preview-dropdown-content\"\n\t\t\t\t\t\t\tposition=\"bottom right left\"\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ enableSelection && (\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Choose existing' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\tenableSelection\n\t\t\t\t\t\t\t\t\t\t\t\t? 'tertiary'\n\t\t\t\t\t\t\t\t\t\t\t\t: 'primary'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetStep(\n\t\t\t\t\t\t\t\t\t\t\t\tPLACEHOLDER_STEPS.patterns\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t\t\t\t\t\t__( 'New %s' ),\n\t\t\t\t\t\t\t\t\t\t\tareaLabel.toLowerCase()\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<TemplatePartSelection\n\t\t\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t\t{ step === PLACEHOLDER_STEPS.patterns && (\n\t\t\t\t<PatternsSetup\n\t\t\t\t\tarea={ area }\n\t\t\t\t\tareaLabel={ areaLabel }\n\t\t\t\t\tareaIcon={ areaIcon }\n\t\t\t\t\tonCreate={ onCreate }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tresetPlaceholder={ () =>\n\t\t\t\t\t\tsetStep( PLACEHOLDER_STEPS.initial )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
@@ -45,7 +45,8 @@ const metadata = {
45
45
  spacing: {
46
46
  padding: true
47
47
  },
48
- __experimentalLayout: true
48
+ __experimentalLayout: true,
49
+ reusable: false
49
50
  },
50
51
  editorStyle: "wp-block-template-part-editor"
51
52
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/template-part/index.js"],"names":["startCase","store","coreDataStore","select","symbolFilled","addFilter","edit","enhanceTemplatePartVariations","name","metadata","settings","icon","__experimentalLabel","slug","theme","entity","getEntityRecord","title","rendered"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,MAAT,QAAuB,iBAAvB;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SAASC,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,IAAP,MAAiB,QAAjB;AACA,SAASC,6BAAT,QAA8C,cAA9C;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AACA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAEP,YADiB;AAEvBQ,EAAAA,mBAAmB,EAAE,QAAuB;AAAA;;AAAA,QAArB;AAAEC,MAAAA,IAAF;AAAQC,MAAAA;AAAR,KAAqB;;AAC3C;AACA;AACA,QAAK,CAAED,IAAP,EAAc;AACb;AACA;;AAED,UAAME,MAAM,GAAGZ,MAAM,CAAED,aAAF,CAAN,CAAwBc,eAAxB,CACd,UADc,EAEd,kBAFc,EAGdF,KAAK,GAAG,IAAR,GAAeD,IAHD,CAAf;;AAKA,QAAK,CAAEE,MAAP,EAAgB;AACf;AACA;;AAED,WAAOf,SAAS,CAAE,kBAAAe,MAAM,CAACE,KAAP,gEAAcC,QAAd,KAA0BH,MAAM,CAACF,IAAnC,CAAhB;AACA,GAnBsB;AAoBvBP,EAAAA;AApBuB,CAAjB,C,CAuBP;;AACAD,SAAS,CACR,0BADQ,EAER,oBAFQ,EAGRE,6BAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport { startCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { select } from '@wordpress/data';\nimport { symbolFilled } from '@wordpress/icons';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport { enhanceTemplatePartVariations } from './variations';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon: symbolFilled,\n\t__experimentalLabel: ( { slug, theme } ) => {\n\t\t// Attempt to find entity title if block is a template part.\n\t\t// Require slug to request, otherwise entity is uncreated and will throw 404.\n\t\tif ( ! slug ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst entity = select( coreDataStore ).getEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\ttheme + '//' + slug\n\t\t);\n\t\tif ( ! entity ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn startCase( entity.title?.rendered || entity.slug );\n\t},\n\tedit,\n};\n\n// Importing this file includes side effects. This is whitelisted in block-library/package.json under sideEffects\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/template-part',\n\tenhanceTemplatePartVariations\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/template-part/index.js"],"names":["startCase","store","coreDataStore","select","symbolFilled","addFilter","edit","enhanceTemplatePartVariations","name","metadata","settings","icon","__experimentalLabel","slug","theme","entity","getEntityRecord","title","rendered"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,MAAT,QAAuB,iBAAvB;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SAASC,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,IAAP,MAAiB,QAAjB;AACA,SAASC,6BAAT,QAA8C,cAA9C;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AACA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAEP,YADiB;AAEvBQ,EAAAA,mBAAmB,EAAE,QAAuB;AAAA;;AAAA,QAArB;AAAEC,MAAAA,IAAF;AAAQC,MAAAA;AAAR,KAAqB;;AAC3C;AACA;AACA,QAAK,CAAED,IAAP,EAAc;AACb;AACA;;AAED,UAAME,MAAM,GAAGZ,MAAM,CAAED,aAAF,CAAN,CAAwBc,eAAxB,CACd,UADc,EAEd,kBAFc,EAGdF,KAAK,GAAG,IAAR,GAAeD,IAHD,CAAf;;AAKA,QAAK,CAAEE,MAAP,EAAgB;AACf;AACA;;AAED,WAAOf,SAAS,CAAE,kBAAAe,MAAM,CAACE,KAAP,gEAAcC,QAAd,KAA0BH,MAAM,CAACF,IAAnC,CAAhB;AACA,GAnBsB;AAoBvBP,EAAAA;AApBuB,CAAjB,C,CAuBP;;AACAD,SAAS,CACR,0BADQ,EAER,oBAFQ,EAGRE,6BAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport { startCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { select } from '@wordpress/data';\nimport { symbolFilled } from '@wordpress/icons';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport { enhanceTemplatePartVariations } from './variations';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon: symbolFilled,\n\t__experimentalLabel: ( { slug, theme } ) => {\n\t\t// Attempt to find entity title if block is a template part.\n\t\t// Require slug to request, otherwise entity is uncreated and will throw 404.\n\t\tif ( ! slug ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst entity = select( coreDataStore ).getEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\ttheme + '//' + slug\n\t\t);\n\t\tif ( ! entity ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn startCase( entity.title?.rendered || entity.slug );\n\t},\n\tedit,\n};\n\n// Importing this file includes side effects. This is whitelisted in block-library/package.json under sideEffects\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/template-part',\n\tenhanceTemplatePartVariations\n);\n"]}
@@ -820,6 +820,7 @@ figure.wp-block-gallery .components-spinner {
820
820
  bottom: 0;
821
821
  right: 0;
822
822
  z-index: 1;
823
+ pointer-events: none;
823
824
  }
824
825
  .blocks-gallery-item figure.is-transient img {
825
826
  opacity: 0.3;
@@ -1975,7 +1976,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
1975
1976
  bottom: 0;
1976
1977
  right: 0;
1977
1978
  border: 1px dashed currentColor;
1978
- opacity: 0.3;
1979
+ opacity: 0.4;
1979
1980
  pointer-events: none;
1980
1981
  border-radius: inherit;
1981
1982
  }
@@ -2015,7 +2016,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
2015
2016
  height: 100%;
2016
2017
  stroke: currentColor;
2017
2018
  stroke-dasharray: 3;
2018
- opacity: 0.3;
2019
+ opacity: 0.4;
2019
2020
  }
2020
2021
  .wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button {
2021
2022
  background: var(--wp-admin-theme-color);
@@ -2502,7 +2503,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
2502
2503
  bottom: 0;
2503
2504
  right: 0;
2504
2505
  border: 1px dashed currentColor;
2505
- opacity: 0.3;
2506
+ opacity: 0.4;
2506
2507
  pointer-events: none;
2507
2508
  border-radius: inherit;
2508
2509
  }
@@ -2547,7 +2548,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
2547
2548
  height: 100%;
2548
2549
  stroke: currentColor;
2549
2550
  stroke-dasharray: 3;
2550
- opacity: 0.3;
2551
+ opacity: 0.4;
2551
2552
  }
2552
2553
  .wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder {
2553
2554
  min-height: 48px;
@@ -825,6 +825,7 @@ figure.wp-block-gallery .components-spinner {
825
825
  bottom: 0;
826
826
  left: 0;
827
827
  z-index: 1;
828
+ pointer-events: none;
828
829
  }
829
830
  .blocks-gallery-item figure.is-transient img {
830
831
  opacity: 0.3;
@@ -1980,7 +1981,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
1980
1981
  bottom: 0;
1981
1982
  left: 0;
1982
1983
  border: 1px dashed currentColor;
1983
- opacity: 0.3;
1984
+ opacity: 0.4;
1984
1985
  pointer-events: none;
1985
1986
  border-radius: inherit;
1986
1987
  }
@@ -2020,7 +2021,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
2020
2021
  height: 100%;
2021
2022
  stroke: currentColor;
2022
2023
  stroke-dasharray: 3;
2023
- opacity: 0.3;
2024
+ opacity: 0.4;
2024
2025
  }
2025
2026
  .wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button {
2026
2027
  background: var(--wp-admin-theme-color);
@@ -2510,7 +2511,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
2510
2511
  bottom: 0;
2511
2512
  left: 0;
2512
2513
  border: 1px dashed currentColor;
2513
- opacity: 0.3;
2514
+ opacity: 0.4;
2514
2515
  pointer-events: none;
2515
2516
  border-radius: inherit;
2516
2517
  }
@@ -2555,7 +2556,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
2555
2556
  height: 100%;
2556
2557
  stroke: currentColor;
2557
2558
  stroke-dasharray: 3;
2558
- opacity: 0.3;
2559
+ opacity: 0.4;
2559
2560
  }
2560
2561
  .wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder {
2561
2562
  min-height: 48px;
@@ -173,6 +173,7 @@ figure.wp-block-gallery .components-spinner {
173
173
  bottom: 0;
174
174
  right: 0;
175
175
  z-index: 1;
176
+ pointer-events: none;
176
177
  }
177
178
  .blocks-gallery-item figure.is-transient img {
178
179
  opacity: 0.3;
@@ -173,6 +173,7 @@ figure.wp-block-gallery .components-spinner {
173
173
  bottom: 0;
174
174
  left: 0;
175
175
  z-index: 1;
176
+ pointer-events: none;
176
177
  }
177
178
  .blocks-gallery-item figure.is-transient img {
178
179
  opacity: 0.3;
@@ -114,7 +114,7 @@
114
114
  bottom: 0;
115
115
  right: 0;
116
116
  border: 1px dashed currentColor;
117
- opacity: 0.3;
117
+ opacity: 0.4;
118
118
  pointer-events: none;
119
119
  border-radius: inherit;
120
120
  }
@@ -159,7 +159,7 @@
159
159
  height: 100%;
160
160
  stroke: currentColor;
161
161
  stroke-dasharray: 3;
162
- opacity: 0.3;
162
+ opacity: 0.4;
163
163
  }
164
164
  .wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder {
165
165
  min-height: 48px;
@@ -114,7 +114,7 @@
114
114
  bottom: 0;
115
115
  left: 0;
116
116
  border: 1px dashed currentColor;
117
- opacity: 0.3;
117
+ opacity: 0.4;
118
118
  pointer-events: none;
119
119
  border-radius: inherit;
120
120
  }
@@ -159,7 +159,7 @@
159
159
  height: 100%;
160
160
  stroke: currentColor;
161
161
  stroke-dasharray: 3;
162
- opacity: 0.3;
162
+ opacity: 0.4;
163
163
  }
164
164
  .wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder {
165
165
  min-height: 48px;
@@ -154,7 +154,7 @@
154
154
  bottom: 0;
155
155
  right: 0;
156
156
  border: 1px dashed currentColor;
157
- opacity: 0.3;
157
+ opacity: 0.4;
158
158
  pointer-events: none;
159
159
  border-radius: inherit;
160
160
  }
@@ -194,7 +194,7 @@
194
194
  height: 100%;
195
195
  stroke: currentColor;
196
196
  stroke-dasharray: 3;
197
- opacity: 0.3;
197
+ opacity: 0.4;
198
198
  }
199
199
  .wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button {
200
200
  background: var(--wp-admin-theme-color);
@@ -154,7 +154,7 @@
154
154
  bottom: 0;
155
155
  left: 0;
156
156
  border: 1px dashed currentColor;
157
- opacity: 0.3;
157
+ opacity: 0.4;
158
158
  pointer-events: none;
159
159
  border-radius: inherit;
160
160
  }
@@ -194,7 +194,7 @@
194
194
  height: 100%;
195
195
  stroke: currentColor;
196
196
  stroke-dasharray: 3;
197
- opacity: 0.3;
197
+ opacity: 0.4;
198
198
  }
199
199
  .wp-block-site-logo.wp-block-site-logo.is-selected .components-button.components-button {
200
200
  background: var(--wp-admin-theme-color);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "6.0.9",
3
+ "version": "6.0.10",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -37,11 +37,11 @@
37
37
  "@wordpress/api-fetch": "^5.2.6",
38
38
  "@wordpress/autop": "^3.2.3",
39
39
  "@wordpress/blob": "^3.2.2",
40
- "@wordpress/block-editor": "^8.0.5",
40
+ "@wordpress/block-editor": "^8.0.6",
41
41
  "@wordpress/blocks": "^11.1.4",
42
- "@wordpress/components": "^19.0.5",
42
+ "@wordpress/components": "^19.1.0",
43
43
  "@wordpress/compose": "^5.0.6",
44
- "@wordpress/core-data": "^4.0.7",
44
+ "@wordpress/core-data": "^4.0.8",
45
45
  "@wordpress/data": "^6.1.4",
46
46
  "@wordpress/date": "^4.2.3",
47
47
  "@wordpress/deprecated": "^3.2.3",
@@ -52,14 +52,14 @@
52
52
  "@wordpress/html-entities": "^3.2.3",
53
53
  "@wordpress/i18n": "^4.2.4",
54
54
  "@wordpress/icons": "^6.1.1",
55
- "@wordpress/interface": "^4.1.7",
55
+ "@wordpress/interface": "^4.1.8",
56
56
  "@wordpress/is-shallow-equal": "^4.2.1",
57
57
  "@wordpress/keycodes": "^3.2.4",
58
58
  "@wordpress/notices": "^3.2.7",
59
59
  "@wordpress/primitives": "^3.0.4",
60
- "@wordpress/reusable-blocks": "^3.0.11",
60
+ "@wordpress/reusable-blocks": "^3.0.12",
61
61
  "@wordpress/rich-text": "^5.0.6",
62
- "@wordpress/server-side-render": "^3.0.9",
62
+ "@wordpress/server-side-render": "^3.0.10",
63
63
  "@wordpress/url": "^3.3.1",
64
64
  "@wordpress/viewport": "^4.0.6",
65
65
  "classnames": "^2.3.1",
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "518e7a279a0f596612232c55c83a351460f8816d"
76
+ "gitHead": "6d3bd917064b4b194677233ee426f5988fa441b9"
77
77
  }
@@ -85,7 +85,7 @@ function block_core_calendar_has_published_posts() {
85
85
  }
86
86
 
87
87
  // On single sites we try our own cached option first.
88
- $has_published_posts = get_option( 'gutenberg_calendar_block_has_published_posts', null );
88
+ $has_published_posts = get_option( 'wp_calendar_block_has_published_posts', null );
89
89
  if ( null !== $has_published_posts ) {
90
90
  return (bool) $has_published_posts;
91
91
  }
@@ -103,7 +103,7 @@ function block_core_calendar_has_published_posts() {
103
103
  function block_core_calendar_update_has_published_posts() {
104
104
  global $wpdb;
105
105
  $has_published_posts = (bool) $wpdb->get_var( "SELECT 1 as test FROM {$wpdb->posts} WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1" );
106
- update_option( 'gutenberg_calendar_block_has_published_posts', $has_published_posts );
106
+ update_option( 'wp_calendar_block_has_published_posts', $has_published_posts );
107
107
  return $has_published_posts;
108
108
  }
109
109
 
package/src/cover/edit.js CHANGED
@@ -310,6 +310,7 @@ function CoverEdit( {
310
310
  setAttributes,
311
311
  setOverlayColor,
312
312
  toggleSelection,
313
+ markNextChangeAsNotPersistent,
313
314
  } ) {
314
315
  const {
315
316
  contentPosition,
@@ -391,6 +392,8 @@ function CoverEdit( {
391
392
  );
392
393
 
393
394
  useEffect( () => {
395
+ // This side-effect should not create an undo level.
396
+ markNextChangeAsNotPersistent();
394
397
  setAttributes( { isDark: isCoverDark } );
395
398
  }, [ isCoverDark ] );
396
399
 
@@ -769,10 +772,14 @@ function CoverEdit( {
769
772
 
770
773
  export default compose( [
771
774
  withDispatch( ( dispatch ) => {
772
- const { toggleSelection } = dispatch( blockEditorStore );
775
+ const {
776
+ toggleSelection,
777
+ __unstableMarkNextChangeAsNotPersistent,
778
+ } = dispatch( blockEditorStore );
773
779
 
774
780
  return {
775
781
  toggleSelection,
782
+ markNextChangeAsNotPersistent: __unstableMarkNextChangeAsNotPersistent,
776
783
  };
777
784
  } ),
778
785
  withColors( { overlayColor: 'background-color' } ),
@@ -498,7 +498,7 @@ function GalleryEdit( props ) {
498
498
  hideCancelButton={ true }
499
499
  />
500
500
  ) }
501
- { Platform.isWeb && ! imageSizeOptions && (
501
+ { Platform.isWeb && ! imageSizeOptions && hasImageIds && (
502
502
  <BaseControl className={ 'gallery-image-sizes' }>
503
503
  <BaseControl.VisualLabel>
504
504
  { __( 'Image size' ) }
@@ -128,6 +128,7 @@ figure.wp-block-gallery {
128
128
  bottom: 0;
129
129
  left: 0;
130
130
  z-index: 1;
131
+ pointer-events: none;
131
132
  }
132
133
  }
133
134
 
@@ -39,7 +39,7 @@ export const updateGallery = ( {
39
39
  }
40
40
  const innerBlocks = images.map( ( image ) =>
41
41
  createBlock( 'core/image', {
42
- id: parseInt( image.id, 10 ),
42
+ id: image.id ? parseInt( image.id, 10 ) : null,
43
43
  url: image.url,
44
44
  alt: image.alt,
45
45
  caption: image.caption,
package/src/index.js CHANGED
@@ -149,53 +149,55 @@ export const __experimentalGetCoreBlocks = () => [
149
149
  html,
150
150
  latestComments,
151
151
  latestPosts,
152
- logInOut,
153
152
  mediaText,
154
153
  missing,
155
154
  more,
156
- navigation,
157
- navigationLink,
158
- navigationSubmenu,
159
155
  nextpage,
160
156
  pageList,
161
157
  pattern,
162
- postAuthor,
163
- postComments,
164
- postContent,
165
- postDate,
166
- postExcerpt,
167
- postFeaturedImage,
168
- postNavigationLink,
169
- postTemplate,
170
- postTerms,
171
- postTitle,
172
158
  preformatted,
173
159
  pullquote,
174
- query,
175
- queryPagination,
176
- queryPaginationNext,
177
- queryPaginationNumbers,
178
- queryPaginationPrevious,
179
- queryTitle,
180
160
  reusableBlock,
181
161
  rss,
182
162
  search,
183
163
  separator,
184
164
  shortcode,
185
- siteLogo,
186
- siteTagline,
187
- siteTitle,
188
165
  socialLink,
189
166
  socialLinks,
190
167
  spacer,
191
168
  table,
192
169
  // tableOfContents,
193
170
  tagCloud,
194
- templatePart,
195
- termDescription,
196
171
  textColumns,
197
172
  verse,
198
173
  video,
174
+
175
+ // theme blocks
176
+ navigation,
177
+ navigationLink,
178
+ navigationSubmenu,
179
+ siteLogo,
180
+ siteTitle,
181
+ siteTagline,
182
+ query,
183
+ templatePart,
184
+ postTitle,
185
+ postExcerpt,
186
+ postFeaturedImage,
187
+ postContent,
188
+ postAuthor,
189
+ postDate,
190
+ postTerms,
191
+ postNavigationLink,
192
+ postTemplate,
193
+ queryPagination,
194
+ queryPaginationNext,
195
+ queryPaginationNumbers,
196
+ queryPaginationPrevious,
197
+ postComments,
198
+ logInOut,
199
+ termDescription,
200
+ queryTitle,
199
201
  ];
200
202
 
201
203
  /**
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "textdomain": "default",
13
13
  "attributes": {
14
- "navigationMenuId": {
14
+ "ref": {
15
15
  "type": "number"
16
16
  },
17
17
  "textColor": {
@@ -21,6 +21,13 @@ const TYPOGRAPHY_PRESET_DEPRECATION_MAP = {
21
21
  textTransform: 'var:preset|text-transform|',
22
22
  };
23
23
 
24
+ const migrateIdToRef = ( { navigationMenuId, ...attributes } ) => {
25
+ return {
26
+ ...attributes,
27
+ ref: navigationMenuId,
28
+ };
29
+ };
30
+
24
31
  const migrateWithLayout = ( attributes ) => {
25
32
  if ( !! attributes.layout ) {
26
33
  return attributes;
@@ -47,6 +54,97 @@ const migrateWithLayout = ( attributes ) => {
47
54
  return updatedAttributes;
48
55
  };
49
56
 
57
+ const v6 = {
58
+ attributes: {
59
+ navigationMenuId: {
60
+ type: 'number',
61
+ },
62
+ textColor: {
63
+ type: 'string',
64
+ },
65
+ customTextColor: {
66
+ type: 'string',
67
+ },
68
+ rgbTextColor: {
69
+ type: 'string',
70
+ },
71
+ backgroundColor: {
72
+ type: 'string',
73
+ },
74
+ customBackgroundColor: {
75
+ type: 'string',
76
+ },
77
+ rgbBackgroundColor: {
78
+ type: 'string',
79
+ },
80
+ showSubmenuIcon: {
81
+ type: 'boolean',
82
+ default: true,
83
+ },
84
+ openSubmenusOnClick: {
85
+ type: 'boolean',
86
+ default: false,
87
+ },
88
+ overlayMenu: {
89
+ type: 'string',
90
+ default: 'mobile',
91
+ },
92
+ __unstableLocation: {
93
+ type: 'string',
94
+ },
95
+ overlayBackgroundColor: {
96
+ type: 'string',
97
+ },
98
+ customOverlayBackgroundColor: {
99
+ type: 'string',
100
+ },
101
+ overlayTextColor: {
102
+ type: 'string',
103
+ },
104
+ customOverlayTextColor: {
105
+ type: 'string',
106
+ },
107
+ },
108
+ supports: {
109
+ align: [ 'wide', 'full' ],
110
+ anchor: true,
111
+ html: false,
112
+ inserter: true,
113
+ typography: {
114
+ fontSize: true,
115
+ lineHeight: true,
116
+ __experimentalFontStyle: true,
117
+ __experimentalFontWeight: true,
118
+ __experimentalTextTransform: true,
119
+ __experimentalFontFamily: true,
120
+ __experimentalTextDecoration: true,
121
+ __experimentalDefaultControls: {
122
+ fontSize: true,
123
+ },
124
+ },
125
+ spacing: {
126
+ blockGap: true,
127
+ units: [ 'px', 'em', 'rem', 'vh', 'vw' ],
128
+ __experimentalDefaultControls: {
129
+ blockGap: true,
130
+ },
131
+ },
132
+ __experimentalLayout: {
133
+ allowSwitching: false,
134
+ allowInheriting: false,
135
+ default: {
136
+ type: 'flex',
137
+ setCascadingProperties: true,
138
+ },
139
+ },
140
+ },
141
+ save() {
142
+ return <InnerBlocks.Content />;
143
+ },
144
+ isEligible: ( { navigationMenuId } ) => !! navigationMenuId,
145
+ migrate: migrateIdToRef,
146
+ };
147
+
50
148
  const v5 = {
51
149
  attributes: {
52
150
  navigationMenuId: {
@@ -135,7 +233,7 @@ const v5 = {
135
233
  },
136
234
  isEligible: ( { itemsJustification, orientation } ) =>
137
235
  !! itemsJustification || !! orientation,
138
- migrate: migrateWithLayout,
236
+ migrate: compose( migrateIdToRef, migrateWithLayout ),
139
237
  };
140
238
 
141
239
  const v4 = {
@@ -218,7 +316,7 @@ const v4 = {
218
316
  save() {
219
317
  return <InnerBlocks.Content />;
220
318
  },
221
- migrate: compose( migrateWithLayout, migrateFontFamily ),
319
+ migrate: compose( migrateIdToRef, migrateWithLayout, migrateFontFamily ),
222
320
  isEligible( { style } ) {
223
321
  return style?.typography?.fontFamily;
224
322
  },
@@ -259,6 +357,7 @@ const migrateTypographyPresets = function ( attributes ) {
259
357
  };
260
358
 
261
359
  const deprecated = [
360
+ v6,
262
361
  v5,
263
362
  v4,
264
363
  // Remove `isResponsive` attribute.
@@ -336,6 +435,7 @@ const deprecated = [
336
435
  return attributes.isResponsive;
337
436
  },
338
437
  migrate: compose(
438
+ migrateIdToRef,
339
439
  migrateWithLayout,
340
440
  migrateFontFamily,
341
441
  migrateIsResponsive
@@ -410,6 +510,7 @@ const deprecated = [
410
510
  return false;
411
511
  },
412
512
  migrate: compose(
513
+ migrateIdToRef,
413
514
  migrateWithLayout,
414
515
  migrateFontFamily,
415
516
  migrateTypographyPresets
@@ -454,7 +555,7 @@ const deprecated = [
454
555
  html: false,
455
556
  inserter: true,
456
557
  },
457
- migrate( attributes ) {
558
+ migrate: compose( migrateIdToRef, ( attributes ) => {
458
559
  return {
459
560
  ...omit( attributes, [ 'rgbTextColor', 'rgbBackgroundColor' ] ),
460
561
  customTextColor: attributes.textColor
@@ -464,7 +565,7 @@ const deprecated = [
464
565
  ? undefined
465
566
  : attributes.rgbBackgroundColor,
466
567
  };
467
- },
568
+ } ),
468
569
  save() {
469
570
  return <InnerBlocks.Content />;
470
571
  },