@wordpress/block-library 8.12.6 → 8.14.0
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.
- package/CHANGELOG.md +4 -0
- package/build/archives/index.js +5 -1
- package/build/archives/index.js.map +1 -1
- package/build/audio/index.js +5 -1
- package/build/audio/index.js.map +1 -1
- package/build/block/edit.native.js +2 -2
- package/build/block/edit.native.js.map +1 -1
- package/build/categories/index.js +5 -1
- package/build/categories/index.js.map +1 -1
- package/build/code/index.js +5 -1
- package/build/code/index.js.map +1 -1
- package/build/column/index.js +1 -0
- package/build/column/index.js.map +1 -1
- package/build/comments/index.js +1 -0
- package/build/comments/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +2 -1
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/index.js +1 -0
- package/build/cover/index.js.map +1 -1
- package/build/details/index.js +5 -1
- package/build/details/index.js.map +1 -1
- package/build/embed/util.js +9 -8
- package/build/embed/util.js.map +1 -1
- package/build/file/index.js +2 -1
- package/build/file/index.js.map +1 -1
- package/build/file/view.js +15 -1
- package/build/file/view.js.map +1 -1
- package/build/gallery/index.js +3 -1
- package/build/gallery/index.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/heading/index.js +5 -1
- package/build/heading/index.js.map +1 -1
- package/build/heading/transforms.js +5 -1
- package/build/heading/transforms.js.map +1 -1
- package/build/image/deprecated.js +453 -175
- package/build/image/deprecated.js.map +1 -1
- package/build/image/image.js +1 -1
- package/build/image/image.js.map +1 -1
- package/build/image/save.js +3 -1
- package/build/image/save.js.map +1 -1
- package/build/image/{interactivity.js → view-interactivity.js} +86 -44
- package/build/image/view-interactivity.js.map +1 -0
- package/build/index.js +12 -3
- package/build/index.js.map +1 -1
- package/build/list/index.js +5 -1
- package/build/list/index.js.map +1 -1
- package/build/list-item/utils.js +6 -1
- package/build/list-item/utils.js.map +1 -1
- package/build/media-text/index.js +1 -0
- package/build/media-text/index.js.map +1 -1
- package/build/missing/edit.js +22 -8
- package/build/missing/edit.js.map +1 -1
- package/build/navigation/index.js +3 -2
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/view.js +174 -50
- package/build/navigation/view.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js +3 -3
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +34 -39
- package/build/page-list/edit.js.map +1 -1
- package/build/page-list/use-convert-to-navigation-links.js +2 -15
- package/build/page-list/use-convert-to-navigation-links.js.map +1 -1
- package/build/paragraph/index.js +1 -0
- package/build/paragraph/index.js.map +1 -1
- package/build/paragraph/transforms.js +1 -0
- package/build/paragraph/transforms.js.map +1 -1
- package/build/post-comments-form/index.js +1 -0
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-navigation-link/index.js +1 -0
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-time-to-read/index.js +5 -1
- package/build/post-time-to-read/index.js.map +1 -1
- package/build/quote/index.js +1 -0
- package/build/quote/index.js.map +1 -1
- package/build/site-logo/index.js +5 -1
- package/build/site-logo/index.js.map +1 -1
- package/build/site-tagline/index.js +5 -1
- package/build/site-tagline/index.js.map +1 -1
- package/build/site-title/index.js +5 -1
- package/build/site-title/index.js.map +1 -1
- package/build/social-links/index.js +3 -1
- package/build/social-links/index.js.map +1 -1
- package/build/table/index.js +5 -1
- package/build/table/index.js.map +1 -1
- package/build/term-description/index.js +1 -0
- package/build/term-description/index.js.map +1 -1
- package/build/verse/index.js +5 -1
- package/build/verse/index.js.map +1 -1
- package/build/video/deprecated.js +5 -1
- package/build/video/deprecated.js.map +1 -1
- package/build/video/index.js +5 -1
- package/build/video/index.js.map +1 -1
- package/build-module/archives/index.js +5 -1
- package/build-module/archives/index.js.map +1 -1
- package/build-module/audio/index.js +5 -1
- package/build-module/audio/index.js.map +1 -1
- package/build-module/block/edit.native.js +2 -2
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/categories/index.js +5 -1
- package/build-module/categories/index.js.map +1 -1
- package/build-module/code/index.js +5 -1
- package/build-module/code/index.js.map +1 -1
- package/build-module/column/index.js +1 -0
- package/build-module/column/index.js.map +1 -1
- package/build-module/comments/index.js +1 -0
- package/build-module/comments/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +2 -1
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/index.js +1 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/details/index.js +5 -1
- package/build-module/details/index.js.map +1 -1
- package/build-module/embed/util.js +6 -6
- package/build-module/embed/util.js.map +1 -1
- package/build-module/file/index.js +2 -1
- package/build-module/file/index.js.map +1 -1
- package/build-module/file/view.js +15 -2
- package/build-module/file/view.js.map +1 -1
- package/build-module/gallery/index.js +3 -1
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/heading/index.js +5 -1
- package/build-module/heading/index.js.map +1 -1
- package/build-module/heading/transforms.js +5 -1
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/image/deprecated.js +454 -176
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/image.js +1 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/save.js +3 -1
- package/build-module/image/save.js.map +1 -1
- package/build-module/image/{interactivity.js → view-interactivity.js} +86 -44
- package/build-module/image/view-interactivity.js.map +1 -0
- package/build-module/index.js +12 -3
- package/build-module/index.js.map +1 -1
- package/build-module/list/index.js +5 -1
- package/build-module/list/index.js.map +1 -1
- package/build-module/list-item/utils.js +6 -1
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/media-text/index.js +1 -0
- package/build-module/media-text/index.js.map +1 -1
- package/build-module/missing/edit.js +22 -8
- package/build-module/missing/edit.js.map +1 -1
- package/build-module/navigation/index.js +3 -2
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/view.js +173 -50
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js +3 -3
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +34 -39
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/page-list/use-convert-to-navigation-links.js +3 -16
- package/build-module/page-list/use-convert-to-navigation-links.js.map +1 -1
- package/build-module/paragraph/index.js +1 -0
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/paragraph/transforms.js +1 -0
- package/build-module/paragraph/transforms.js.map +1 -1
- package/build-module/post-comments-form/index.js +1 -0
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-navigation-link/index.js +1 -0
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-time-to-read/index.js +5 -1
- package/build-module/post-time-to-read/index.js.map +1 -1
- package/build-module/quote/index.js +1 -0
- package/build-module/quote/index.js.map +1 -1
- package/build-module/site-logo/index.js +5 -1
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/site-tagline/index.js +5 -1
- package/build-module/site-tagline/index.js.map +1 -1
- package/build-module/site-title/index.js +5 -1
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-links/index.js +3 -1
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/table/index.js +5 -1
- package/build-module/table/index.js.map +1 -1
- package/build-module/term-description/index.js +1 -0
- package/build-module/term-description/index.js.map +1 -1
- package/build-module/verse/index.js +5 -1
- package/build-module/verse/index.js.map +1 -1
- package/build-module/video/deprecated.js +5 -1
- package/build-module/video/deprecated.js.map +1 -1
- package/build-module/video/index.js +5 -1
- package/build-module/video/index.js.map +1 -1
- package/build-style/image/style-rtl.css +16 -2
- package/build-style/image/style.css +16 -2
- package/build-style/style-rtl.css +16 -2
- package/build-style/style.css +16 -2
- package/package.json +33 -38
- package/src/archives/block.json +5 -1
- package/src/audio/block.json +5 -1
- package/src/block/edit.native.js +2 -2
- package/src/block/test/edit.native.js +4 -4
- package/src/categories/block.json +5 -1
- package/src/code/block.json +5 -1
- package/src/column/block.json +1 -0
- package/src/comments/block.json +1 -0
- package/src/cover/block.json +1 -0
- package/src/cover/edit/inspector-controls.js +1 -0
- package/src/details/block.json +5 -1
- package/src/embed/util.js +4 -6
- package/src/file/block.json +2 -1
- package/src/file/index.php +0 -17
- package/src/file/view.js +14 -5
- package/src/gallery/block.json +3 -1
- package/src/group/block.json +1 -0
- package/src/heading/block.json +5 -1
- package/src/heading/test/index.native.js +18 -0
- package/src/image/deprecated.js +597 -320
- package/src/image/image.js +2 -1
- package/src/image/save.js +2 -0
- package/src/image/style.scss +15 -2
- package/src/image/{interactivity.js → view-interactivity.js} +99 -50
- package/src/index.js +18 -1
- package/src/list/block.json +5 -1
- package/src/media-text/block.json +1 -0
- package/src/missing/edit.js +31 -11
- package/src/navigation/block.json +3 -2
- package/src/navigation/index.php +15 -20
- package/src/navigation/view.js +189 -67
- package/src/navigation-submenu/index.php +0 -10
- package/src/page-list/convert-to-links-modal.js +3 -3
- package/src/page-list/edit.js +65 -62
- package/src/page-list/use-convert-to-navigation-links.js +3 -20
- package/src/paragraph/block.json +1 -0
- package/src/post-comments-form/block.json +1 -0
- package/src/post-navigation-link/block.json +1 -0
- package/src/post-time-to-read/block.json +5 -1
- package/src/quote/block.json +1 -0
- package/src/site-logo/block.json +5 -1
- package/src/site-tagline/block.json +5 -1
- package/src/site-title/block.json +5 -1
- package/src/social-links/block.json +3 -1
- package/src/table/block.json +5 -1
- package/src/term-description/block.json +1 -0
- package/src/verse/block.json +5 -1
- package/src/video/block.json +5 -1
- package/build/file/interactivity.js +0 -19
- package/build/file/interactivity.js.map +0 -1
- package/build/heading/heading-level-icon.js +0 -61
- package/build/heading/heading-level-icon.js.map +0 -1
- package/build/image/interactivity.js.map +0 -1
- package/build/navigation/interactivity.js +0 -167
- package/build/navigation/interactivity.js.map +0 -1
- package/build/navigation/view-modal.js +0 -64
- package/build/navigation/view-modal.js.map +0 -1
- package/build/utils/interactivity/constants.js +0 -9
- package/build/utils/interactivity/constants.js.map +0 -1
- package/build/utils/interactivity/directives.js +0 -222
- package/build/utils/interactivity/directives.js.map +0 -1
- package/build/utils/interactivity/hooks.js +0 -159
- package/build/utils/interactivity/hooks.js.map +0 -1
- package/build/utils/interactivity/hydration.js +0 -34
- package/build/utils/interactivity/hydration.js.map +0 -1
- package/build/utils/interactivity/index.js +0 -32
- package/build/utils/interactivity/index.js.map +0 -1
- package/build/utils/interactivity/portals.js +0 -108
- package/build/utils/interactivity/portals.js.map +0 -1
- package/build/utils/interactivity/store.js +0 -66
- package/build/utils/interactivity/store.js.map +0 -1
- package/build/utils/interactivity/utils.js +0 -87
- package/build/utils/interactivity/utils.js.map +0 -1
- package/build/utils/interactivity/vdom.js +0 -119
- package/build/utils/interactivity/vdom.js.map +0 -1
- package/build-module/file/interactivity.js +0 -15
- package/build-module/file/interactivity.js.map +0 -1
- package/build-module/heading/heading-level-icon.js +0 -53
- package/build-module/heading/heading-level-icon.js.map +0 -1
- package/build-module/image/interactivity.js.map +0 -1
- package/build-module/navigation/interactivity.js +0 -164
- package/build-module/navigation/interactivity.js.map +0 -1
- package/build-module/navigation/view-modal.js +0 -58
- package/build-module/navigation/view-modal.js.map +0 -1
- package/build-module/utils/interactivity/constants.js +0 -2
- package/build-module/utils/interactivity/constants.js.map +0 -1
- package/build-module/utils/interactivity/directives.js +0 -209
- package/build-module/utils/interactivity/directives.js.map +0 -1
- package/build-module/utils/interactivity/hooks.js +0 -145
- package/build-module/utils/interactivity/hooks.js.map +0 -1
- package/build-module/utils/interactivity/hydration.js +0 -21
- package/build-module/utils/interactivity/hydration.js.map +0 -1
- package/build-module/utils/interactivity/index.js +0 -15
- package/build-module/utils/interactivity/index.js.map +0 -1
- package/build-module/utils/interactivity/portals.js +0 -100
- package/build-module/utils/interactivity/portals.js.map +0 -1
- package/build-module/utils/interactivity/store.js +0 -55
- package/build-module/utils/interactivity/store.js.map +0 -1
- package/build-module/utils/interactivity/utils.js +0 -75
- package/build-module/utils/interactivity/utils.js.map +0 -1
- package/build-module/utils/interactivity/vdom.js +0 -107
- package/build-module/utils/interactivity/vdom.js.map +0 -1
- package/src/file/interactivity.js +0 -15
- package/src/heading/heading-level-icon.js +0 -48
- package/src/navigation/interactivity.js +0 -169
- package/src/navigation/view-modal.js +0 -78
- package/src/utils/interactivity/constants.js +0 -1
- package/src/utils/interactivity/directives.js +0 -200
- package/src/utils/interactivity/hooks.js +0 -145
- package/src/utils/interactivity/hydration.js +0 -22
- package/src/utils/interactivity/index.js +0 -15
- package/src/utils/interactivity/portals.js +0 -98
- package/src/utils/interactivity/store.js +0 -45
- package/src/utils/interactivity/utils.js +0 -66
- package/src/utils/interactivity/vdom.js +0 -111
package/CHANGELOG.md
CHANGED
package/build/archives/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/archives/index.js"],"names":["name","metadata","settings","icon","example","edit","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AAVA;AACA;AACA;;AAGA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/archives/index.js"],"names":["name","metadata","settings","icon","example","edit","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,cADuB;AAEvBC,EAAAA,OAAO,EAAE,EAFc;AAGvBC,EAAAA,IAAI,EAAJA;AAHuB,CAAjB;;;AAMA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEN,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { archive as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
package/build/audio/index.js
CHANGED
package/build/audio/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/audio/index.js"],"names":["name","metadata","settings","icon","example","attributes","src","viewportWidth","transforms","deprecated","edit","save","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAbA;AACA;AACA;;AAGA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/audio/index.js"],"names":["name","metadata","settings","icon","example","attributes","src","viewportWidth","transforms","deprecated","edit","save","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,YADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,GAAG,EAAE;AADM,KADJ;AAIRC,IAAAA,aAAa,EAAE;AAJP,GAFc;AAQvBC,EAAAA,UAAU,EAAVA,mBARuB;AASvBC,EAAAA,UAAU,EAAVA,mBATuB;AAUvBC,EAAAA,IAAI,EAAJA,aAVuB;AAWvBC,EAAAA,IAAI,EAAJA;AAXuB,CAAjB;;;AAcA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEZ,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { audio as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsrc: 'https://upload.wikimedia.org/wikipedia/commons/d/dd/Armstrong_Small_Step.ogg',\n\t\t},\n\t\tviewportWidth: 350,\n\t},\n\ttransforms,\n\tdeprecated,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
|
@@ -115,9 +115,9 @@ function ReusableBlockEdit({
|
|
|
115
115
|
function renderSheet() {
|
|
116
116
|
const infoTitle = _reactNative.Platform.OS === 'android' ? (0, _i18n.sprintf)(
|
|
117
117
|
/* translators: %s: name of the host app (e.g. WordPress) */
|
|
118
|
-
(0, _i18n.__)('Editing
|
|
118
|
+
(0, _i18n.__)('Editing synced patterns is not yet supported on %s for Android'), hostAppNamespace) : (0, _i18n.sprintf)(
|
|
119
119
|
/* translators: %s: name of the host app (e.g. WordPress) */
|
|
120
|
-
(0, _i18n.__)('Editing
|
|
120
|
+
(0, _i18n.__)('Editing synced patterns is not yet supported on %s for iOS'), hostAppNamespace);
|
|
121
121
|
return (0, _element.createElement)(_components.BottomSheet, {
|
|
122
122
|
isVisible: showHelp,
|
|
123
123
|
hideHeader: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/block/edit.native.js"],"names":["ReusableBlockEdit","attributes","ref","clientId","isSelected","hasAlreadyRendered","showHelp","setShowHelp","infoTextStyle","styles","infoText","infoTextDark","infoTitleStyle","infoTitle","infoTitleDark","infoSheetIconStyle","infoSheetIcon","infoSheetIconDark","infoDescriptionStyle","infoDescription","infoDescriptionDark","actionButtonStyle","actionButton","actionButtonDark","spinnerStyle","spinner","spinnerDark","hasResolved","isEditing","isMissing","innerBlockCount","select","persistedBlock","coreStore","getEntityRecord","hasResolvedBlock","hasFinishedResolution","getBlockCount","blockEditorStore","reusableBlocksStore","__experimentalIsEditingReusableBlock","hostAppNamespace","editorStore","getEditorSettings","createSuccessNotice","noticesStore","__experimentalConvertBlockToStatic","convertBlockToStatic","clearSelectedBlock","blocks","onInput","onChange","id","title","openSheet","closeSheet","onConvertToRegularBlocks","successNotice","setImmediate","renderSheet","Platform","OS","infoContainer","help","color","size","element"],"mappings":";;;;;;;;;AAcA;;AAXA;;AAYA;;AAKA;;AAMA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AA7CA;AACA;AACA;;AASA;AACA;AACA;;AA4BA;AACA;AACA;AAIe,SAASA,iBAAT,CAA4B;AAC1CC,EAAAA,UAAU,EAAE;AAAEC,IAAAA;AAAF,GAD8B;AAE1CC,EAAAA,QAF0C;AAG1CC,EAAAA;AAH0C,CAA5B,EAIX;AACH,QAAMC,kBAAkB,GAAG,gDAAiBH,GAAjB,CAA3B;AAEA,QAAM,CAAEI,QAAF,EAAYC,WAAZ,IAA4B,uBAAU,KAAV,CAAlC;AACA,QAAMC,aAAa,GAAG,2CACrBC,iBAAOC,QADc,EAErBD,iBAAOE,YAFc,CAAtB;AAIA,QAAMC,cAAc,GAAG,2CACtBH,iBAAOI,SADe,EAEtBJ,iBAAOK,aAFe,CAAvB;AAIA,QAAMC,kBAAkB,GAAG,2CAC1BN,iBAAOO,aADmB,EAE1BP,iBAAOQ,iBAFmB,CAA3B;AAIA,QAAMC,oBAAoB,GAAG,2CAC5BT,iBAAOU,eADqB,EAE5BV,iBAAOW,mBAFqB,CAA7B;AAIA,QAAMC,iBAAiB,GAAG,2CACzBZ,iBAAOa,YADkB,EAEzBb,iBAAOc,gBAFkB,CAA1B;AAIA,QAAMC,YAAY,GAAG,2CACpBf,iBAAOgB,OADa,EAEpBhB,iBAAOiB,WAFa,CAArB;AAKA,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,SAAf;AAA0B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AD;AAAW,IAAA,KAAK,EAAGiD;AAAnB,IADjB,EAEGa,OAFH,EAGGP,WAAW,EAHd,CAPD,CADD,CADD;AAiBA","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tActivityIndicator,\n\tPlatform,\n\tText,\n\tTouchableWithoutFeedback,\n\tView,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useCallback } from '@wordpress/element';\nimport {\n\tuseEntityBlockEditor,\n\tuseEntityProp,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport {\n\tBottomSheet,\n\tIcon,\n\tDisabled,\n\tTextControl,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n\tInnerBlocks,\n\tWarning,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { help } from '@wordpress/icons';\nimport { store as reusableBlocksStore } from '@wordpress/reusable-blocks';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport styles from './editor.scss';\nimport EditTitle from './edit-title';\n\nexport default function ReusableBlockEdit( {\n\tattributes: { ref },\n\tclientId,\n\tisSelected,\n} ) {\n\tconst hasAlreadyRendered = useHasRecursion( ref );\n\n\tconst [ showHelp, setShowHelp ] = useState( false );\n\tconst infoTextStyle = usePreferredColorSchemeStyle(\n\t\tstyles.infoText,\n\t\tstyles.infoTextDark\n\t);\n\tconst infoTitleStyle = usePreferredColorSchemeStyle(\n\t\tstyles.infoTitle,\n\t\tstyles.infoTitleDark\n\t);\n\tconst infoSheetIconStyle = usePreferredColorSchemeStyle(\n\t\tstyles.infoSheetIcon,\n\t\tstyles.infoSheetIconDark\n\t);\n\tconst infoDescriptionStyle = usePreferredColorSchemeStyle(\n\t\tstyles.infoDescription,\n\t\tstyles.infoDescriptionDark\n\t);\n\tconst actionButtonStyle = usePreferredColorSchemeStyle(\n\t\tstyles.actionButton,\n\t\tstyles.actionButtonDark\n\t);\n\tconst spinnerStyle = usePreferredColorSchemeStyle(\n\t\tstyles.spinner,\n\t\tstyles.spinnerDark\n\t);\n\n\tconst { hasResolved, isEditing, isMissing, innerBlockCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst persistedBlock = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_block',\n\t\t\t\tref\n\t\t\t);\n\t\t\tconst hasResolvedBlock = select( coreStore ).hasFinishedResolution(\n\t\t\t\t'getEntityRecord',\n\t\t\t\t[ 'postType', 'wp_block', ref ]\n\t\t\t);\n\n\t\t\tconst { getBlockCount } = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\thasResolved: hasResolvedBlock,\n\t\t\t\tisEditing:\n\t\t\t\t\tselect(\n\t\t\t\t\t\treusableBlocksStore\n\t\t\t\t\t).__experimentalIsEditingReusableBlock( clientId ),\n\t\t\t\tisMissing: hasResolvedBlock && ! persistedBlock,\n\t\t\t\tinnerBlockCount: getBlockCount( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ ref, clientId ]\n\t);\n\tconst hostAppNamespace = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditorSettings().hostAppNamespace,\n\t\t[]\n\t);\n\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { __experimentalConvertBlockToStatic: convertBlockToStatic } =\n\t\tuseDispatch( reusableBlocksStore );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_block',\n\t\t{ id: ref }\n\t);\n\n\tconst [ title ] = useEntityProp( 'postType', 'wp_block', 'title', ref );\n\n\tfunction openSheet() {\n\t\tsetShowHelp( true );\n\t}\n\n\tfunction closeSheet() {\n\t\tsetShowHelp( false );\n\t}\n\n\tconst onConvertToRegularBlocks = useCallback( () => {\n\t\t/* translators: %s: name of the synced block */\n\t\tconst successNotice = __( '%s detached' );\n\t\tcreateSuccessNotice( sprintf( successNotice, title ) );\n\n\t\tclearSelectedBlock();\n\t\t// Convert action is executed at the end of the current JavaScript execution block\n\t\t// to prevent issues related to undo/redo actions.\n\t\tsetImmediate( () => convertBlockToStatic( clientId ) );\n\t}, [ title, clientId ] );\n\n\tfunction renderSheet() {\n\t\tconst infoTitle =\n\t\t\tPlatform.OS === 'android'\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: name of the host app (e.g. WordPress) */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Editing reusable blocks is not yet supported on %s for Android'\n\t\t\t\t\t\t),\n\t\t\t\t\t\thostAppNamespace\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: name of the host app (e.g. WordPress) */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Editing reusable blocks is not yet supported on %s for iOS'\n\t\t\t\t\t\t),\n\t\t\t\t\t\thostAppNamespace\n\t\t\t\t );\n\n\t\treturn (\n\t\t\t<BottomSheet\n\t\t\t\tisVisible={ showHelp }\n\t\t\t\thideHeader\n\t\t\t\tonClose={ closeSheet }\n\t\t\t>\n\t\t\t\t<View style={ styles.infoContainer }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ help }\n\t\t\t\t\t\tcolor={ infoSheetIconStyle.color }\n\t\t\t\t\t\tsize={ styles.infoSheetIcon.size }\n\t\t\t\t\t/>\n\t\t\t\t\t<Text style={ [ infoTextStyle, infoTitleStyle ] }>\n\t\t\t\t\t\t{ infoTitle }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<Text style={ [ infoTextStyle, infoDescriptionStyle ] }>\n\t\t\t\t\t\t{ innerBlockCount > 1\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'Alternatively, you can detach and edit these blocks separately by tapping “Detach patterns”.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Alternatively, you can detach and edit this block separately by tapping “Detach pattern”.'\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tinnerBlockCount > 1\n\t\t\t\t\t\t\t\t? __( 'Detach patterns' )\n\t\t\t\t\t\t\t\t: __( 'Detach pattern' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tseparatorType=\"topFullWidth\"\n\t\t\t\t\t\tonPress={ onConvertToRegularBlocks }\n\t\t\t\t\t\tlabelStyle={ actionButtonStyle }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t</BottomSheet>\n\t\t);\n\t}\n\n\tif ( hasAlreadyRendered ) {\n\t\treturn (\n\t\t\t<Warning\n\t\t\t\tmessage={ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isMissing ) {\n\t\treturn (\n\t\t\t<Warning\n\t\t\t\tmessage={ __( 'Block has been deleted or is unavailable.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( ! hasResolved ) {\n\t\treturn (\n\t\t\t<View style={ spinnerStyle }>\n\t\t\t\t<ActivityIndicator animating />\n\t\t\t</View>\n\t\t);\n\t}\n\n\tlet element = (\n\t\t<InnerBlocks\n\t\t\tvalue={ blocks }\n\t\t\tonChange={ onChange }\n\t\t\tonInput={ onInput }\n\t\t/>\n\t);\n\n\tif ( ! isEditing ) {\n\t\telement = <Disabled>{ element }</Disabled>;\n\t}\n\n\treturn (\n\t\t<RecursionProvider uniqueId={ ref }>\n\t\t\t<TouchableWithoutFeedback\n\t\t\t\tdisabled={ ! isSelected }\n\t\t\t\taccessibilityLabel={ __( 'Help button' ) }\n\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\taccessibilityHint={ __( 'Tap here to show help' ) }\n\t\t\t\tonPress={ openSheet }\n\t\t\t>\n\t\t\t\t<View>\n\t\t\t\t\t{ isSelected && <EditTitle title={ title } /> }\n\t\t\t\t\t{ element }\n\t\t\t\t\t{ renderSheet() }\n\t\t\t\t</View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t</RecursionProvider>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/block/edit.native.js"],"names":["ReusableBlockEdit","attributes","ref","clientId","isSelected","hasAlreadyRendered","showHelp","setShowHelp","infoTextStyle","styles","infoText","infoTextDark","infoTitleStyle","infoTitle","infoTitleDark","infoSheetIconStyle","infoSheetIcon","infoSheetIconDark","infoDescriptionStyle","infoDescription","infoDescriptionDark","actionButtonStyle","actionButton","actionButtonDark","spinnerStyle","spinner","spinnerDark","hasResolved","isEditing","isMissing","innerBlockCount","select","persistedBlock","coreStore","getEntityRecord","hasResolvedBlock","hasFinishedResolution","getBlockCount","blockEditorStore","reusableBlocksStore","__experimentalIsEditingReusableBlock","hostAppNamespace","editorStore","getEditorSettings","createSuccessNotice","noticesStore","__experimentalConvertBlockToStatic","convertBlockToStatic","clearSelectedBlock","blocks","onInput","onChange","id","title","openSheet","closeSheet","onConvertToRegularBlocks","successNotice","setImmediate","renderSheet","Platform","OS","infoContainer","help","color","size","element"],"mappings":";;;;;;;;;AAcA;;AAXA;;AAYA;;AAKA;;AAMA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AA7CA;AACA;AACA;;AASA;AACA;AACA;;AA4BA;AACA;AACA;AAIe,SAASA,iBAAT,CAA4B;AAC1CC,EAAAA,UAAU,EAAE;AAAEC,IAAAA;AAAF,GAD8B;AAE1CC,EAAAA,QAF0C;AAG1CC,EAAAA;AAH0C,CAA5B,EAIX;AACH,QAAMC,kBAAkB,GAAG,gDAAiBH,GAAjB,CAA3B;AAEA,QAAM,CAAEI,QAAF,EAAYC,WAAZ,IAA4B,uBAAU,KAAV,CAAlC;AAC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BAAC,wBAAD;AACC,IAAA,KAAK,EAAGjB,MADT;AAEC,IAAA,QAAQ,EAAGE,QAFZ;AAGC,IAAA,OAAO,EAAGD;AAHX,IADD;;AAQA,MAAK,CAAEtB,SAAP,EAAmB;AAClBsC,IAAAA,OAAO,GAAG,4BAAC,oBAAD,QAAYA,OAAZ,CAAV;AACA;;AAED,SACC,4BAAC,4CAAD;AAAmB,IAAA,QAAQ,EAAGhE;AAA9B,KACC,4BAAC,qCAAD;AACC,IAAA,QAAQ,EAAG,CAAEE,UADd;AAEC,IAAA,kBAAkB,EAAG,cAAI,aAAJ,CAFtB;AAGC,IAAA,iBAAiB,EAAG,QAHrB;AAIC,IAAA,iBAAiB,EAAG,cAAI,uBAAJ,CAJrB;AAKC,IAAA,OAAO,EAAGkD;AALX,KAOC,4BAAC,iBAAD,QACGlD,UAAU,IAAI,4BAAC,kBAAD;AAAW,IAAA,KAAK,EAAGiD;AAAnB,IADjB,EAEGa,OAFH,EAGGP,WAAW,EAHd,CAPD,CADD,CADD;AAiBA","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tActivityIndicator,\n\tPlatform,\n\tText,\n\tTouchableWithoutFeedback,\n\tView,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useCallback } from '@wordpress/element';\nimport {\n\tuseEntityBlockEditor,\n\tuseEntityProp,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport {\n\tBottomSheet,\n\tIcon,\n\tDisabled,\n\tTextControl,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n\tInnerBlocks,\n\tWarning,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { help } from '@wordpress/icons';\nimport { store as reusableBlocksStore } from '@wordpress/reusable-blocks';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport styles from './editor.scss';\nimport EditTitle from './edit-title';\n\nexport default function ReusableBlockEdit( {\n\tattributes: { ref },\n\tclientId,\n\tisSelected,\n} ) {\n\tconst hasAlreadyRendered = useHasRecursion( ref );\n\n\tconst [ showHelp, setShowHelp ] = useState( false );\n\tconst infoTextStyle = usePreferredColorSchemeStyle(\n\t\tstyles.infoText,\n\t\tstyles.infoTextDark\n\t);\n\tconst infoTitleStyle = usePreferredColorSchemeStyle(\n\t\tstyles.infoTitle,\n\t\tstyles.infoTitleDark\n\t);\n\tconst infoSheetIconStyle = usePreferredColorSchemeStyle(\n\t\tstyles.infoSheetIcon,\n\t\tstyles.infoSheetIconDark\n\t);\n\tconst infoDescriptionStyle = usePreferredColorSchemeStyle(\n\t\tstyles.infoDescription,\n\t\tstyles.infoDescriptionDark\n\t);\n\tconst actionButtonStyle = usePreferredColorSchemeStyle(\n\t\tstyles.actionButton,\n\t\tstyles.actionButtonDark\n\t);\n\tconst spinnerStyle = usePreferredColorSchemeStyle(\n\t\tstyles.spinner,\n\t\tstyles.spinnerDark\n\t);\n\n\tconst { hasResolved, isEditing, isMissing, innerBlockCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst persistedBlock = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_block',\n\t\t\t\tref\n\t\t\t);\n\t\t\tconst hasResolvedBlock = select( coreStore ).hasFinishedResolution(\n\t\t\t\t'getEntityRecord',\n\t\t\t\t[ 'postType', 'wp_block', ref ]\n\t\t\t);\n\n\t\t\tconst { getBlockCount } = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\thasResolved: hasResolvedBlock,\n\t\t\t\tisEditing:\n\t\t\t\t\tselect(\n\t\t\t\t\t\treusableBlocksStore\n\t\t\t\t\t).__experimentalIsEditingReusableBlock( clientId ),\n\t\t\t\tisMissing: hasResolvedBlock && ! persistedBlock,\n\t\t\t\tinnerBlockCount: getBlockCount( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ ref, clientId ]\n\t);\n\tconst hostAppNamespace = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditorSettings().hostAppNamespace,\n\t\t[]\n\t);\n\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { __experimentalConvertBlockToStatic: convertBlockToStatic } =\n\t\tuseDispatch( reusableBlocksStore );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_block',\n\t\t{ id: ref }\n\t);\n\n\tconst [ title ] = useEntityProp( 'postType', 'wp_block', 'title', ref );\n\n\tfunction openSheet() {\n\t\tsetShowHelp( true );\n\t}\n\n\tfunction closeSheet() {\n\t\tsetShowHelp( false );\n\t}\n\n\tconst onConvertToRegularBlocks = useCallback( () => {\n\t\t/* translators: %s: name of the synced block */\n\t\tconst successNotice = __( '%s detached' );\n\t\tcreateSuccessNotice( sprintf( successNotice, title ) );\n\n\t\tclearSelectedBlock();\n\t\t// Convert action is executed at the end of the current JavaScript execution block\n\t\t// to prevent issues related to undo/redo actions.\n\t\tsetImmediate( () => convertBlockToStatic( clientId ) );\n\t}, [ title, clientId ] );\n\n\tfunction renderSheet() {\n\t\tconst infoTitle =\n\t\t\tPlatform.OS === 'android'\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: name of the host app (e.g. WordPress) */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Editing synced patterns is not yet supported on %s for Android'\n\t\t\t\t\t\t),\n\t\t\t\t\t\thostAppNamespace\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: name of the host app (e.g. WordPress) */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Editing synced patterns is not yet supported on %s for iOS'\n\t\t\t\t\t\t),\n\t\t\t\t\t\thostAppNamespace\n\t\t\t\t );\n\n\t\treturn (\n\t\t\t<BottomSheet\n\t\t\t\tisVisible={ showHelp }\n\t\t\t\thideHeader\n\t\t\t\tonClose={ closeSheet }\n\t\t\t>\n\t\t\t\t<View style={ styles.infoContainer }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ help }\n\t\t\t\t\t\tcolor={ infoSheetIconStyle.color }\n\t\t\t\t\t\tsize={ styles.infoSheetIcon.size }\n\t\t\t\t\t/>\n\t\t\t\t\t<Text style={ [ infoTextStyle, infoTitleStyle ] }>\n\t\t\t\t\t\t{ infoTitle }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<Text style={ [ infoTextStyle, infoDescriptionStyle ] }>\n\t\t\t\t\t\t{ innerBlockCount > 1\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'Alternatively, you can detach and edit these blocks separately by tapping “Detach patterns”.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Alternatively, you can detach and edit this block separately by tapping “Detach pattern”.'\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tinnerBlockCount > 1\n\t\t\t\t\t\t\t\t? __( 'Detach patterns' )\n\t\t\t\t\t\t\t\t: __( 'Detach pattern' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tseparatorType=\"topFullWidth\"\n\t\t\t\t\t\tonPress={ onConvertToRegularBlocks }\n\t\t\t\t\t\tlabelStyle={ actionButtonStyle }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t</BottomSheet>\n\t\t);\n\t}\n\n\tif ( hasAlreadyRendered ) {\n\t\treturn (\n\t\t\t<Warning\n\t\t\t\tmessage={ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isMissing ) {\n\t\treturn (\n\t\t\t<Warning\n\t\t\t\tmessage={ __( 'Block has been deleted or is unavailable.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( ! hasResolved ) {\n\t\treturn (\n\t\t\t<View style={ spinnerStyle }>\n\t\t\t\t<ActivityIndicator animating />\n\t\t\t</View>\n\t\t);\n\t}\n\n\tlet element = (\n\t\t<InnerBlocks\n\t\t\tvalue={ blocks }\n\t\t\tonChange={ onChange }\n\t\t\tonInput={ onInput }\n\t\t/>\n\t);\n\n\tif ( ! isEditing ) {\n\t\telement = <Disabled>{ element }</Disabled>;\n\t}\n\n\treturn (\n\t\t<RecursionProvider uniqueId={ ref }>\n\t\t\t<TouchableWithoutFeedback\n\t\t\t\tdisabled={ ! isSelected }\n\t\t\t\taccessibilityLabel={ __( 'Help button' ) }\n\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\taccessibilityHint={ __( 'Tap here to show help' ) }\n\t\t\t\tonPress={ openSheet }\n\t\t\t>\n\t\t\t\t<View>\n\t\t\t\t\t{ isSelected && <EditTitle title={ title } /> }\n\t\t\t\t\t{ element }\n\t\t\t\t\t{ renderSheet() }\n\t\t\t\t</View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t</RecursionProvider>\n\t);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/categories/index.js"],"names":["name","metadata","settings","icon","example","edit","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AAVA;AACA;AACA;;AAGA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/categories/index.js"],"names":["name","metadata","settings","icon","example","edit","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,eADuB;AAEvBC,EAAAA,OAAO,EAAE,EAFc;AAGvBC,EAAAA,IAAI,EAAJA;AAHuB,CAAjB;;;AAMA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEN,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { category as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
package/build/code/index.js
CHANGED
package/build/code/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/code/index.js"],"names":["name","metadata","settings","icon","example","attributes","content","transforms","edit","save","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAEA;;AACA;;AAbA;AACA;AACA;;AAIA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/code/index.js"],"names":["name","metadata","settings","icon","example","attributes","content","transforms","edit","save","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAEA;;AACA;;AAbA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,WADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACX;AACA;AACAC,MAAAA,OAAO,EAAE,cACR,yLADQ;AAGT;;AANW;AADJ,GAFc;AAYvBC,EAAAA,UAAU,EAAVA,mBAZuB;AAavBC,EAAAA,IAAI,EAAJA,aAbuB;AAcvBC,EAAAA,IAAI,EAAJA;AAduB,CAAjB;;;AAiBA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEV,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { code as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\t/* eslint-disable @wordpress/i18n-no-collapsible-whitespace */\n\t\t\t// translators: Preserve \\n markers for line breaks\n\t\t\tcontent: __(\n\t\t\t\t'// A “block” is the abstract term used\\n// to describe units of markup that\\n// when composed together, form the\\n// content or layout of a page.\\nregisterBlockType( name, settings );'\n\t\t\t),\n\t\t\t/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
package/build/column/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/column/index.js"],"names":["name","metadata","settings","icon","edit","save","deprecated","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAEA;;AAZA;AACA;AACA;;AAGA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/column/index.js"],"names":["name","metadata","settings","icon","edit","save","deprecated","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAEA;;AAZA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,aADuB;AAEvBC,EAAAA,IAAI,EAAJA,aAFuB;AAGvBC,EAAAA,IAAI,EAAJA,aAHuB;AAIvBC,EAAAA,UAAU,EAAVA;AAJuB,CAAjB;;;AAOA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEP,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { column as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
package/build/comments/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/comments/index.js"],"names":["name","metadata","settings","icon","edit","save","deprecated","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AACA;;AACA;;AAZA;AACA;AACA;;AAGA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/comments/index.js"],"names":["name","metadata","settings","icon","edit","save","deprecated","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AACA;;AACA;;AAZA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,mBADuB;AAEvBC,EAAAA,IAAI,EAAJA,aAFuB;AAGvBC,EAAAA,IAAI,EAAJA,aAHuB;AAIvBC,EAAAA,UAAU,EAAVA;AAJuB,CAAjB;;;AAOA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEP,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { postComments as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
|
@@ -226,7 +226,8 @@ function CoverInspectorControls({
|
|
|
226
226
|
min: 0,
|
|
227
227
|
max: 100,
|
|
228
228
|
step: 10,
|
|
229
|
-
required: true
|
|
229
|
+
required: true,
|
|
230
|
+
__next40pxDefaultSize: true
|
|
230
231
|
}))), (0, _element.createElement)(_blockEditor.InspectorControls, {
|
|
231
232
|
group: "dimensions"
|
|
232
233
|
}, (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/cover/edit/inspector-controls.js"],"names":["CoverHeightInput","onChange","onUnitChange","unit","value","instanceId","UnitControl","inputId","isPx","units","availableUnits","defaultValues","px","em","rem","vw","vh","handleOnChange","unprocessedValue","inputValue","parseFloat","undefined","isNaN","computedValue","parsedQuantity","join","min","COVER_MIN_HEIGHT","CoverInspectorControls","attributes","setAttributes","clientId","setOverlayColor","coverRef","currentSettings","useFeaturedImage","dimRatio","focalPoint","hasParallax","isRepeated","minHeight","minHeightUnit","alt","tagName","isVideoBackground","isImageBackground","mediaElement","url","isImgElement","overlayColor","gradientValue","setGradient","toggleParallax","toggleIsRepeated","showFocalPointPicker","imperativeFocalPointPreview","styleOfRef","property","current","style","colorGradientSettings","htmlElementMessages","header","main","section","article","aside","footer","newFocalPoint","newAlt","id","backgroundType","hasColorsOrGradients","colorValue","color","label","onColorChange","onGradientChange","isShownByDefault","resetAllFilter","customOverlayColor","gradient","customGradient","newDimRation","newMinHeight","nextUnit"],"mappings":";;;;;;;AAGA;;AACA;;AAeA;;AACA;;AAOA;;AAKA;;AAhCA;AACA;AACA;;AA2BA;AACA;AACA;AAGA,SAASA,gBAAT,CAA2B;AAC1BC,EAAAA,QAD0B;AAE1BC,EAAAA,YAF0B;AAG1BC,EAAAA,IAAI,GAAG,IAHmB;AAI1BC,EAAAA,KAAK,GAAG;AAJkB,CAA3B,EAKI;AACH,QAAMC,UAAU,GAAG,4BAAeC,qCAAf,CAAnB;AACA,QAAMC,OAAO,GAAI,4BAA4BF,UAAY,EAAzD;AACA,QAAMG,IAAI,GAAGL,IAAI,KAAK,IAAtB;AAEA,QAAMM,KAAK,GAAG,8CAAgB;AAC7BC,IAAAA,cAAc,EAAE,6BAAY,eAAZ,KAAiC,CAChD,IADgD,EAEhD,IAFgD,EAGhD,KAHgD,EAIhD,IAJgD,EAKhD,IALgD,CADpB;AAQ7BC,IAAAA,aAAa,EAAE;AAAEC,MAAAA,EAAE,EAAE,GAAN;AAAW,WAAK,EAAhB;AAAoBC,MAAAA,EAAE,EAAE,EAAxB;AAA4BC,MAAAA,GAAG,EAAE,EAAjC;AAAqCC,MAAAA,EAAE,EAAE,EAAzC;AAA6CC,MAAAA,EAAE,EAAE;AAAjD;AARc,GAAhB,CAAd;;AAWA,QAAMC,cAAc,GAAKC,gBAAF,IAAwB;AAC9C,UAAMC,UAAU,GACfD,gBAAgB,KAAK,EAArB,GACGE,UAAU,CAAEF,gBAAF,CADb,GAEGG,SAHJ;;AAKA,QAAKC,KAAK,CAAEH,UAAF,CAAL,IAAuBA,UAAU,KAAKE,SAA3C,EAAuD;AACtD;AACA;;AACDpB,IAAAA,QAAQ,CAAEkB,UAAF,CAAR;AACA,GAVD;;AAYA,QAAMI,aAAa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,\n\tRangeControl,\n\tTextareaControl,\n\tToggleControl,\n\tSelectControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseSetting,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseGradient,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { COVER_MIN_HEIGHT, mediaPosition } from '../shared';\n\nfunction CoverHeightInput( {\n\tonChange,\n\tonUnitChange,\n\tunit = 'px',\n\tvalue = '',\n} ) {\n\tconst instanceId = useInstanceId( UnitControl );\n\tconst inputId = `block-cover-height-input-${ instanceId }`;\n\tconst isPx = unit === 'px';\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t\t'vh',\n\t\t],\n\t\tdefaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== ''\n\t\t\t\t? parseFloat( unprocessedValue )\n\t\t\t\t: undefined;\n\n\t\tif ( isNaN( inputValue ) && inputValue !== undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tonChange( inputValue );\n\t};\n\n\tconst computedValue = useMemo( () => {\n\t\tconst [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );\n\t\treturn [ parsedQuantity, unit ].join( '' );\n\t}, [ unit, value ] );\n\n\tconst min = isPx ? COVER_MIN_HEIGHT : 0;\n\n\treturn (\n\t\t<UnitControl\n\t\t\tlabel={ __( 'Minimum height of cover' ) }\n\t\t\tid={ inputId }\n\t\t\tisResetValueOnUnitChange\n\t\t\tmin={ min }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonUnitChange={ onUnitChange }\n\t\t\t__unstableInputWidth={ '80px' }\n\t\t\tunits={ units }\n\t\t\tvalue={ computedValue }\n\t\t/>\n\t);\n}\nexport default function CoverInspectorControls( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tsetOverlayColor,\n\tcoverRef,\n\tcurrentSettings,\n} ) {\n\tconst {\n\t\tuseFeaturedImage,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\ttagName,\n\t} = attributes;\n\tconst {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\turl,\n\t\tisImgElement,\n\t\toverlayColor,\n\t} = currentSettings;\n\n\tconst { gradientValue, setGradient } = __experimentalUseGradient();\n\n\tconst toggleParallax = () => {\n\t\tsetAttributes( {\n\t\t\thasParallax: ! hasParallax,\n\t\t\t...( ! hasParallax ? { focalPoint: undefined } : {} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tisRepeated: ! isRepeated,\n\t\t} );\n\t};\n\n\tconst showFocalPointPicker =\n\t\tisVideoBackground ||\n\t\t( isImageBackground && ( ! hasParallax || isRepeated ) );\n\n\tconst imperativeFocalPointPreview = ( value ) => {\n\t\tconst [ styleOfRef, property ] = mediaElement.current\n\t\t\t? [ mediaElement.current.style, 'objectPosition' ]\n\t\t\t: [ coverRef.current.style, 'backgroundPosition' ];\n\t\tstyleOfRef[ property ] = mediaPosition( value );\n\t};\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\tconst htmlElementMessages = {\n\t\theader: __(\n\t\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t\t),\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only. '\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\tarticle: __(\n\t\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t\tfooter: __(\n\t\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t\t),\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t{ !! url && (\n\t\t\t\t\t<PanelBody title={ __( 'Media settings' ) }>\n\t\t\t\t\t\t{ isImageBackground && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\tchecked={ hasParallax }\n\t\t\t\t\t\t\t\t\tonChange={ toggleParallax }\n\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\tchecked={ isRepeated }\n\t\t\t\t\t\t\t\t\tonChange={ toggleIsRepeated }\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\t{ showFocalPointPicker && (\n\t\t\t\t\t\t\t<FocalPointPicker\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Focal point picker' ) }\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tvalue={ focalPoint }\n\t\t\t\t\t\t\t\tonDragStart={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\tonDrag={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\tonChange={ ( newFocalPoint ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfocalPoint: newFocalPoint,\n\t\t\t\t\t\t\t\t\t} )\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\t{ ! useFeaturedImage &&\n\t\t\t\t\t\t\turl &&\n\t\t\t\t\t\t\tisImageBackground &&\n\t\t\t\t\t\t\tisImgElement && (\n\t\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\t\tonChange={ ( newAlt ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { alt: newAlt } )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/WAI/tutorials/images/decision-tree\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Leave empty if decorative.'\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/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\tclassName=\"block-library-cover__reset-button\"\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\turl: undefined,\n\t\t\t\t\t\t\t\t\t\tid: undefined,\n\t\t\t\t\t\t\t\t\t\tbackgroundType: undefined,\n\t\t\t\t\t\t\t\t\t\tfocalPoint: undefined,\n\t\t\t\t\t\t\t\t\t\thasParallax: undefined,\n\t\t\t\t\t\t\t\t\t\tisRepeated: undefined,\n\t\t\t\t\t\t\t\t\t\tuseFeaturedImage: false,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Clear Media' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcolorValue: overlayColor.color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tlabel: __( 'Overlay' ),\n\t\t\t\t\t\t\t\tonColorChange: setOverlayColor,\n\t\t\t\t\t\t\t\tonGradientChange: setGradient,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tresetAllFilter: () => ( {\n\t\t\t\t\t\t\t\t\toverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tcustomOverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t\t\tcustomGradient: undefined,\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\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => {\n\t\t\t\t\t\t\t// If there's a media background the dimRatio will be\n\t\t\t\t\t\t\t// defaulted to 50 whereas it will be 100 for colors.\n\t\t\t\t\t\t\treturn dimRatio === undefined\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: dimRatio !== ( url ? 50 : 100 );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { dimRatio: url ? 50 : 100 } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\t\tdimRatio: url ? 50 : 100,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\t\tvalue={ dimRatio }\n\t\t\t\t\t\t\tonChange={ ( newDimRation ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdimRatio: newDimRation,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\tstep={ 10 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"dimensions\">\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! minHeight }\n\t\t\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<CoverHeightInput\n\t\t\t\t\t\tvalue={ minHeight }\n\t\t\t\t\t\tunit={ minHeightUnit }\n\t\t\t\t\t\tonChange={ ( newMinHeight ) =>\n\t\t\t\t\t\t\tsetAttributes( { minHeight: newMinHeight } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonUnitChange={ ( nextUnit ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeightUnit: nextUnit,\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</ToolsPanelItem>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/cover/edit/inspector-controls.js"],"names":["CoverHeightInput","onChange","onUnitChange","unit","value","instanceId","UnitControl","inputId","isPx","units","availableUnits","defaultValues","px","em","rem","vw","vh","handleOnChange","unprocessedValue","inputValue","parseFloat","undefined","isNaN","computedValue","parsedQuantity","join","min","COVER_MIN_HEIGHT","CoverInspectorControls","attributes","setAttributes","clientId","setOverlayColor","coverRef","currentSettings","useFeaturedImage","dimRatio","focalPoint","hasParallax","isRepeated","minHeight","minHeightUnit","alt","tagName","isVideoBackground","isImageBackground","mediaElement","url","isImgElement","overlayColor","gradientValue","setGradient","toggleParallax","toggleIsRepeated","showFocalPointPicker","imperativeFocalPointPreview","styleOfRef","property","current","style","colorGradientSettings","htmlElementMessages","header","main","section","article","aside","footer","newFocalPoint","newAlt","id","backgroundType","hasColorsOrGradients","colorValue","color","label","onColorChange","onGradientChange","isShownByDefault","resetAllFilter","customOverlayColor","gradient","customGradient","newDimRation","newMinHeight","nextUnit"],"mappings":";;;;;;;AAGA;;AACA;;AAeA;;AACA;;AAOA;;AAKA;;AAhCA;AACA;AACA;;AA2BA;AACA;AACA;AAGA,SAASA,gBAAT,CAA2B;AAC1BC,EAAAA,QAD0B;AAE1BC,EAAAA,YAF0B;AAG1BC,EAAAA,IAAI,GAAG,IAHmB;AAI1BC,EAAAA,KAAK,GAAG;AAJkB,CAA3B,EAKI;AACH,QAAMC,UAAU,GAAG,4BAAeC,qCAAf,CAAnB;AACA,QAAMC,OAAO,GAAI,4BAA4BF,UAAY,EAAzD;AACA,QAAMG,IAAI,GAAGL,IAAI,KAAK,IAAtB;AAEA,QAAMM,KAAK,GAAG,8CAAgB;AA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EAAE;AAA1B,KAHS,EAIT;AAAEuE,MAAAA,KAAK,EAAE,WAAT;AAAsBvE,MAAAA,KAAK,EAAE;AAA7B,KAJS,EAKT;AAAEuE,MAAAA,KAAK,EAAE,WAAT;AAAsBvE,MAAAA,KAAK,EAAE;AAA7B,KALS,EAMT;AAAEuE,MAAAA,KAAK,EAAE,SAAT;AAAoBvE,MAAAA,KAAK,EAAE;AAA3B,KANS,EAOT;AAAEuE,MAAAA,KAAK,EAAE,UAAT;AAAqBvE,MAAAA,KAAK,EAAE;AAA5B,KAPS,CAHX;AAYC,IAAA,KAAK,EAAGuC,OAZT;AAaC,IAAA,QAAQ,EAAKvC,KAAF,IACV0B,aAAa,CAAE;AAAEa,MAAAA,OAAO,EAAEvC;AAAX,KAAF,CAdf;AAgBC,IAAA,IAAI,EAAGyD,mBAAmB,CAAElB,OAAF;AAhB3B,IADD,CA/KD,CADD;AAsMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport {\n\tButton,\n\tExternalLink,\n\tFocalPointPicker,\n\tPanelBody,\n\tPanelRow,\n\tRangeControl,\n\tTextareaControl,\n\tToggleControl,\n\tSelectControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseSetting,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseGradient,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { COVER_MIN_HEIGHT, mediaPosition } from '../shared';\n\nfunction CoverHeightInput( {\n\tonChange,\n\tonUnitChange,\n\tunit = 'px',\n\tvalue = '',\n} ) {\n\tconst instanceId = useInstanceId( UnitControl );\n\tconst inputId = `block-cover-height-input-${ instanceId }`;\n\tconst isPx = unit === 'px';\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t\t'vh',\n\t\t],\n\t\tdefaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== ''\n\t\t\t\t? parseFloat( unprocessedValue )\n\t\t\t\t: undefined;\n\n\t\tif ( isNaN( inputValue ) && inputValue !== undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tonChange( inputValue );\n\t};\n\n\tconst computedValue = useMemo( () => {\n\t\tconst [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );\n\t\treturn [ parsedQuantity, unit ].join( '' );\n\t}, [ unit, value ] );\n\n\tconst min = isPx ? COVER_MIN_HEIGHT : 0;\n\n\treturn (\n\t\t<UnitControl\n\t\t\tlabel={ __( 'Minimum height of cover' ) }\n\t\t\tid={ inputId }\n\t\t\tisResetValueOnUnitChange\n\t\t\tmin={ min }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonUnitChange={ onUnitChange }\n\t\t\t__unstableInputWidth={ '80px' }\n\t\t\tunits={ units }\n\t\t\tvalue={ computedValue }\n\t\t/>\n\t);\n}\nexport default function CoverInspectorControls( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tsetOverlayColor,\n\tcoverRef,\n\tcurrentSettings,\n} ) {\n\tconst {\n\t\tuseFeaturedImage,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\ttagName,\n\t} = attributes;\n\tconst {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\turl,\n\t\tisImgElement,\n\t\toverlayColor,\n\t} = currentSettings;\n\n\tconst { gradientValue, setGradient } = __experimentalUseGradient();\n\n\tconst toggleParallax = () => {\n\t\tsetAttributes( {\n\t\t\thasParallax: ! hasParallax,\n\t\t\t...( ! hasParallax ? { focalPoint: undefined } : {} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tisRepeated: ! isRepeated,\n\t\t} );\n\t};\n\n\tconst showFocalPointPicker =\n\t\tisVideoBackground ||\n\t\t( isImageBackground && ( ! hasParallax || isRepeated ) );\n\n\tconst imperativeFocalPointPreview = ( value ) => {\n\t\tconst [ styleOfRef, property ] = mediaElement.current\n\t\t\t? [ mediaElement.current.style, 'objectPosition' ]\n\t\t\t: [ coverRef.current.style, 'backgroundPosition' ];\n\t\tstyleOfRef[ property ] = mediaPosition( value );\n\t};\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\tconst htmlElementMessages = {\n\t\theader: __(\n\t\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t\t),\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only. '\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\tarticle: __(\n\t\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t\tfooter: __(\n\t\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t\t),\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t{ !! url && (\n\t\t\t\t\t<PanelBody title={ __( 'Media settings' ) }>\n\t\t\t\t\t\t{ isImageBackground && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\tchecked={ hasParallax }\n\t\t\t\t\t\t\t\t\tonChange={ toggleParallax }\n\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\tchecked={ isRepeated }\n\t\t\t\t\t\t\t\t\tonChange={ toggleIsRepeated }\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\t{ showFocalPointPicker && (\n\t\t\t\t\t\t\t<FocalPointPicker\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Focal point picker' ) }\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tvalue={ focalPoint }\n\t\t\t\t\t\t\t\tonDragStart={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\tonDrag={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\tonChange={ ( newFocalPoint ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfocalPoint: newFocalPoint,\n\t\t\t\t\t\t\t\t\t} )\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\t{ ! useFeaturedImage &&\n\t\t\t\t\t\t\turl &&\n\t\t\t\t\t\t\tisImageBackground &&\n\t\t\t\t\t\t\tisImgElement && (\n\t\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\t\tonChange={ ( newAlt ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { alt: newAlt } )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/WAI/tutorials/images/decision-tree\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Leave empty if decorative.'\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/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\tclassName=\"block-library-cover__reset-button\"\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\turl: undefined,\n\t\t\t\t\t\t\t\t\t\tid: undefined,\n\t\t\t\t\t\t\t\t\t\tbackgroundType: undefined,\n\t\t\t\t\t\t\t\t\t\tfocalPoint: undefined,\n\t\t\t\t\t\t\t\t\t\thasParallax: undefined,\n\t\t\t\t\t\t\t\t\t\tisRepeated: undefined,\n\t\t\t\t\t\t\t\t\t\tuseFeaturedImage: false,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Clear Media' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcolorValue: overlayColor.color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tlabel: __( 'Overlay' ),\n\t\t\t\t\t\t\t\tonColorChange: setOverlayColor,\n\t\t\t\t\t\t\t\tonGradientChange: setGradient,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tresetAllFilter: () => ( {\n\t\t\t\t\t\t\t\t\toverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tcustomOverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t\t\tcustomGradient: undefined,\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\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => {\n\t\t\t\t\t\t\t// If there's a media background the dimRatio will be\n\t\t\t\t\t\t\t// defaulted to 50 whereas it will be 100 for colors.\n\t\t\t\t\t\t\treturn dimRatio === undefined\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: dimRatio !== ( url ? 50 : 100 );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { dimRatio: url ? 50 : 100 } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\t\tdimRatio: url ? 50 : 100,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\t\tvalue={ dimRatio }\n\t\t\t\t\t\t\tonChange={ ( newDimRation ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tdimRatio: newDimRation,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\tstep={ 10 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"dimensions\">\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! minHeight }\n\t\t\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<CoverHeightInput\n\t\t\t\t\t\tvalue={ minHeight }\n\t\t\t\t\t\tunit={ minHeightUnit }\n\t\t\t\t\t\tonChange={ ( newMinHeight ) =>\n\t\t\t\t\t\t\tsetAttributes( { minHeight: newMinHeight } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonUnitChange={ ( nextUnit ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeightUnit: nextUnit,\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</ToolsPanelItem>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n"]}
|
package/build/cover/index.js
CHANGED
package/build/cover/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/cover/index.js"],"names":["name","metadata","settings","icon","example","attributes","customOverlayColor","dimRatio","url","innerBlocks","content","align","style","typography","fontSize","color","text","transforms","save","edit","deprecated","variations","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAfA;AACA;AACA;;AAIA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/cover/index.js"],"names":["name","metadata","settings","icon","example","attributes","customOverlayColor","dimRatio","url","innerBlocks","content","align","style","typography","fontSize","color","text","transforms","save","edit","deprecated","variations","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAfA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,YADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,kBAAkB,EAAE,SADT;AAEXC,MAAAA,QAAQ,EAAE,EAFC;AAGXC,MAAAA,GAAG,EAAE;AAHM,KADJ;AAMRC,IAAAA,WAAW,EAAE,CACZ;AACCT,MAAAA,IAAI,EAAE,gBADP;AAECK,MAAAA,UAAU,EAAE;AACXK,QAAAA,OAAO,EAAE,cAAI,8BAAJ,CADE;AAEXC,QAAAA,KAAK,EAAE,QAFI;AAGXC,QAAAA,KAAK,EAAE;AACNC,UAAAA,UAAU,EAAE;AACXC,YAAAA,QAAQ,EAAE;AADC,WADN;AAINC,UAAAA,KAAK,EAAE;AACNC,YAAAA,IAAI,EAAE;AADA;AAJD;AAHI;AAFb,KADY;AANL,GAFc;AA0BvBC,EAAAA,UAAU,EAAVA,mBA1BuB;AA2BvBC,EAAAA,IAAI,EAAJA,aA3BuB;AA4BvBC,EAAAA,IAAI,EAAJA,aA5BuB;AA6BvBC,EAAAA,UAAU,EAAVA,mBA7BuB;AA8BvBC,EAAAA,UAAU,EAAVA;AA9BuB,CAAjB;;;AAiCA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEtB,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { cover as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcustomOverlayColor: '#065174',\n\t\t\tdimRatio: 40,\n\t\t\turl: 'https://s.w.org/images/core/5.3/Windbuchencom.jpg',\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __( '<strong>Snow Patrol</strong>' ),\n\t\t\t\t\talign: 'center',\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\ttypography: {\n\t\t\t\t\t\t\tfontSize: 48,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\ttext: 'white',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tsave,\n\tedit,\n\tdeprecated,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
package/build/details/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/details/index.js"],"names":["name","metadata","settings","icon","example","attributes","summary","showContent","innerBlocks","content","save","edit","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AAEA;;AACA;;AAZA;AACA;AACA;;AAIA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/details/index.js"],"names":["name","metadata","settings","icon","example","attributes","summary","showContent","innerBlocks","content","save","edit","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AAEA;;AACA;;AAZA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,cADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,OAAO,EAAE,WADE;AAEXC,MAAAA,WAAW,EAAE;AAFF,KADJ;AAKRC,IAAAA,WAAW,EAAE,CACZ;AACCR,MAAAA,IAAI,EAAE,gBADP;AAECK,MAAAA,UAAU,EAAE;AACXI,QAAAA,OAAO,EAAE,cACR,kOADQ;AADE;AAFb,KADY;AALL,GAFc;AAkBvBC,EAAAA,IAAI,EAAJA,aAlBuB;AAmBvBC,EAAAA,IAAI,EAAJA;AAnBuB,CAAjB;;;AAsBA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEZ,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { details as icon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsummary: 'La Mancha',\n\t\t\tshowContent: true,\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t'In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.'\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\tsave,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
package/build/embed/util.js
CHANGED
|
@@ -13,19 +13,17 @@ exports.removeAspectRatioClasses = exports.matchesPatterns = exports.isFromWordP
|
|
|
13
13
|
|
|
14
14
|
var _element = require("@wordpress/element");
|
|
15
15
|
|
|
16
|
-
var _constants = require("./constants");
|
|
17
|
-
|
|
18
|
-
var _lodash = require("lodash");
|
|
19
|
-
|
|
20
16
|
var _dedupe = _interopRequireDefault(require("classnames/dedupe"));
|
|
21
17
|
|
|
22
18
|
var _memize = _interopRequireDefault(require("memize"));
|
|
23
19
|
|
|
20
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
21
|
+
|
|
24
22
|
var _blocks = require("@wordpress/blocks");
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
var _constants = require("./constants");
|
|
25
|
+
|
|
26
|
+
var _lockUnlock = require("../lock-unlock");
|
|
29
27
|
|
|
30
28
|
/**
|
|
31
29
|
* External dependencies
|
|
@@ -92,6 +90,9 @@ const metadata = {
|
|
|
92
90
|
const {
|
|
93
91
|
name: DEFAULT_EMBED_BLOCK
|
|
94
92
|
} = metadata;
|
|
93
|
+
const {
|
|
94
|
+
kebabCase
|
|
95
|
+
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
95
96
|
/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */
|
|
96
97
|
|
|
97
98
|
/**
|
|
@@ -356,7 +357,7 @@ const getAttributesFromPreview = (0, _memize.default)((preview, title, currentCl
|
|
|
356
357
|
html,
|
|
357
358
|
provider_name: providerName
|
|
358
359
|
} = preview;
|
|
359
|
-
const providerNameSlug =
|
|
360
|
+
const providerNameSlug = kebabCase((providerName || title).toLowerCase());
|
|
360
361
|
|
|
361
362
|
if (isFromWordPress(html)) {
|
|
362
363
|
type = _constants.WP_EMBED_TYPE;
|
package/build/embed/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/embed/util.js"],"names":["name","DEFAULT_EMBED_BLOCK","metadata","getEmbedInfoByProvider","provider","find","matchesPatterns","url","patterns","some","pattern","match","findMoreSuitableBlock","isFromWordPress","html","includes","getPhotoHtml","photo","imageUrl","thumbnail_url","photoPreview","title","createUpgradedEmbedBlock","props","attributesFromPreview","preview","attributes","providerNameSlug","type","restAttributes","matchedBlock","isCurrentBlockWP","WP_EMBED_TYPE","shouldCreateNewBlock","wpVariation","hasAspectRatioClass","existingClassNames","ASPECT_RATIOS","className","removeAspectRatioClasses","aspectRatioClassNames","reduce","accumulator","getClassNames","allowResponsive","previewDocument","document","implementation","createHTMLDocument","body","innerHTML","iframe","querySelector","height","width","aspectRatio","toFixed","ratioIndex","length","potentialRatio","ratio","ratioDiff","fallback","onReplace","link","content","getAttributesFromPreview","currentClassNames","isResponsive","provider_name","providerName","toLowerCase","getMergedAttributesWithPreview","currentAttributes"],"mappings":";;;;;;;;;;;;;AAeA;;AAZA;;AAKA;;AACA;;AACA;;AAMA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAQA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM;AAAEA,EAAAA,IAAI,EAAEC;AAAR,IAAgCC,QAAtC;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,sBAAsB,GAAKC,QAAF,IACrC,gCAAoBH,mBAApB,GAA2CI,IAA3C,CACC,CAAE;AAAEL,EAAAA;AAAF,CAAF,KAAgBA,IAAI,KAAKI,QAD1B,CADM;AAKP;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAME,eAAe,GAAG,CAAEC,GAAF,EAAOC,QAAQ,GAAG,EAAlB,KAC9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BF,IAAAA,UAAU,CAACE,IAAX,GAAkBA,IAAlB;AACAF,IAAAA,UAAU,CAACC,gBAAX,GAA8BA,gBAA9B;AACA,GAtBG,CAwBJ;AACA;AACA;;;AACA,MAAKQ,mBAAmB,CAAEgC,iBAAF,CAAxB,EAAgD;AAC/C,WAAOzC,UAAP;AACA;;AAEDA,EAAAA,UAAU,CAACY,SAAX,GAAuBK,aAAa,CACnC7B,IADmC,EAEnCqD,iBAFmC,EAGnCC,YAAY,IAAIxB,eAHmB,CAApC;AAMA,SAAOlB,UAAP;AACA,CA7CsC,CAAjC;AAgDP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,MAAM8C,8BAA8B,GAAG,CAC7CC,iBAD6C,EAE7ChD,OAF6C,EAG7CJ,KAH6C,EAI7C+C,YAJ6C,KAKzC;AACJ,QAAM;AAAExB,IAAAA,eAAF;AAAmBN,IAAAA;AAAnB,MAAiCmC,iBAAvC;AAEA,SAAO,EACN,GAAGA,iBADG;AAEN,OAAGP,wBAAwB,CAC1BzC,OAD0B,EAE1BJ,KAF0B,EAG1BiB,SAH0B,EAI1B8B,YAJ0B,EAK1BxB,eAL0B;AAFrB,GAAP;AAUA,CAlBM","sourcesContent":["/**\n * Internal dependencies\n */\nimport { ASPECT_RATIOS, WP_EMBED_TYPE } from './constants';\n\n/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\nimport classnames from 'classnames/dedupe';\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { renderToString } from '@wordpress/element';\nimport {\n\tcreateBlock,\n\tgetBlockType,\n\tgetBlockVariations,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\n\nconst { name: DEFAULT_EMBED_BLOCK } = metadata;\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n\n/**\n * Returns the embed block's information by matching the provided service provider\n *\n * @param {string} provider The embed block's provider\n * @return {WPBlockVariation} The embed block's information\n */\nexport const getEmbedInfoByProvider = ( provider ) =>\n\tgetBlockVariations( DEFAULT_EMBED_BLOCK )?.find(\n\t\t( { name } ) => name === provider\n\t);\n\n/**\n * Returns true if any of the regular expressions match the URL.\n *\n * @param {string} url The URL to test.\n * @param {Array} patterns The list of regular expressions to test agains.\n * @return {boolean} True if any of the regular expressions match the URL.\n */\nexport const matchesPatterns = ( url, patterns = [] ) =>\n\tpatterns.some( ( pattern ) => url.match( pattern ) );\n\n/**\n * Finds the block variation that should be used for the URL,\n * based on the provided URL and the variation's patterns.\n *\n * @param {string} url The URL to test.\n * @return {WPBlockVariation} The block variation that should be used for this URL\n */\nexport const findMoreSuitableBlock = ( url ) =>\n\tgetBlockVariations( DEFAULT_EMBED_BLOCK )?.find( ( { patterns } ) =>\n\t\tmatchesPatterns( url, patterns )\n\t);\n\nexport const isFromWordPress = ( html ) =>\n\thtml && html.includes( 'class=\"wp-embedded-content\"' );\n\nexport const getPhotoHtml = ( photo ) => {\n\t// If full image url not found use thumbnail.\n\tconst imageUrl = photo.url || photo.thumbnail_url;\n\n\t// 100% width for the preview so it fits nicely into the document, some \"thumbnails\" are\n\t// actually the full size photo.\n\tconst photoPreview = (\n\t\t<p>\n\t\t\t<img src={ imageUrl } alt={ photo.title } width=\"100%\" />\n\t\t</p>\n\t);\n\treturn renderToString( photoPreview );\n};\n\n/**\n * Creates a more suitable embed block based on the passed in props\n * and attributes generated from an embed block's preview.\n *\n * We require `attributesFromPreview` to be generated from the latest attributes\n * and preview, and because of the way the react lifecycle operates, we can't\n * guarantee that the attributes contained in the block's props are the latest\n * versions, so we require that these are generated separately.\n * See `getAttributesFromPreview` in the generated embed edit component.\n *\n * @param {Object} props The block's props.\n * @param {Object} [attributesFromPreview] Attributes generated from the block's most up to date preview.\n * @return {Object|undefined} A more suitable embed block if one exists.\n */\nexport const createUpgradedEmbedBlock = (\n\tprops,\n\tattributesFromPreview = {}\n) => {\n\tconst { preview, attributes = {} } = props;\n\tconst { url, providerNameSlug, type, ...restAttributes } = attributes;\n\n\tif ( ! url || ! getBlockType( DEFAULT_EMBED_BLOCK ) ) return;\n\n\tconst matchedBlock = findMoreSuitableBlock( url );\n\n\t// WordPress blocks can work on multiple sites, and so don't have patterns,\n\t// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.\n\tconst isCurrentBlockWP =\n\t\tproviderNameSlug === 'wordpress' || type === WP_EMBED_TYPE;\n\t// If current block is not WordPress and a more suitable block found\n\t// that is different from the current one, create the new matched block.\n\tconst shouldCreateNewBlock =\n\t\t! isCurrentBlockWP &&\n\t\tmatchedBlock &&\n\t\t( matchedBlock.attributes.providerNameSlug !== providerNameSlug ||\n\t\t\t! providerNameSlug );\n\tif ( shouldCreateNewBlock ) {\n\t\treturn createBlock( DEFAULT_EMBED_BLOCK, {\n\t\t\turl,\n\t\t\t...restAttributes,\n\t\t\t...matchedBlock.attributes,\n\t\t} );\n\t}\n\n\tconst wpVariation = getBlockVariations( DEFAULT_EMBED_BLOCK )?.find(\n\t\t( { name } ) => name === 'wordpress'\n\t);\n\n\t// We can't match the URL for WordPress embeds, we have to check the HTML instead.\n\tif (\n\t\t! wpVariation ||\n\t\t! preview ||\n\t\t! isFromWordPress( preview.html ) ||\n\t\tisCurrentBlockWP\n\t) {\n\t\treturn;\n\t}\n\n\t// This is not the WordPress embed block so transform it into one.\n\treturn createBlock( DEFAULT_EMBED_BLOCK, {\n\t\turl,\n\t\t...wpVariation.attributes,\n\t\t// By now we have the preview, but when the new block first renders, it\n\t\t// won't have had all the attributes set, and so won't get the correct\n\t\t// type and it won't render correctly. So, we pass through the current attributes\n\t\t// here so that the initial render works when we switch to the WordPress\n\t\t// block. This only affects the WordPress block because it can't be\n\t\t// rendered in the usual Sandbox (it has a sandbox of its own) and it\n\t\t// relies on the preview to set the correct render type.\n\t\t...attributesFromPreview,\n\t} );\n};\n\n/**\n * Determine if the block already has an aspect ratio class applied.\n *\n * @param {string} existingClassNames Existing block classes.\n * @return {boolean} True or false if the classnames contain an aspect ratio class.\n */\nexport const hasAspectRatioClass = ( existingClassNames ) => {\n\tif ( ! existingClassNames ) {\n\t\treturn false;\n\t}\n\treturn ASPECT_RATIOS.some( ( { className } ) =>\n\t\texistingClassNames.includes( className )\n\t);\n};\n\n/**\n * Removes all previously set aspect ratio related classes and return the rest\n * existing class names.\n *\n * @param {string} existingClassNames Any existing class names.\n * @return {string} The class names without any aspect ratio related class.\n */\nexport const removeAspectRatioClasses = ( existingClassNames ) => {\n\tif ( ! existingClassNames ) {\n\t\t// Avoids extraneous work and also, by returning the same value as\n\t\t// received, ensures the post is not dirtied by a change of the block\n\t\t// attribute from `undefined` to an emtpy string.\n\t\treturn existingClassNames;\n\t}\n\tconst aspectRatioClassNames = ASPECT_RATIOS.reduce(\n\t\t( accumulator, { className } ) => {\n\t\t\taccumulator[ className ] = false;\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ 'wp-has-aspect-ratio': false }\n\t);\n\treturn classnames( existingClassNames, aspectRatioClassNames );\n};\n\n/**\n * Returns class names with any relevant responsive aspect ratio names.\n *\n * @param {string} html The preview HTML that possibly contains an iframe with width and height set.\n * @param {string} existingClassNames Any existing class names.\n * @param {boolean} allowResponsive If the responsive class names should be added, or removed.\n * @return {string} Deduped class names.\n */\nexport function getClassNames(\n\thtml,\n\texistingClassNames,\n\tallowResponsive = true\n) {\n\tif ( ! allowResponsive ) {\n\t\treturn removeAspectRatioClasses( existingClassNames );\n\t}\n\n\tconst previewDocument = document.implementation.createHTMLDocument( '' );\n\tpreviewDocument.body.innerHTML = html;\n\tconst iframe = previewDocument.body.querySelector( 'iframe' );\n\n\t// If we have a fixed aspect iframe, and it's a responsive embed block.\n\tif ( iframe && iframe.height && iframe.width ) {\n\t\tconst aspectRatio = ( iframe.width / iframe.height ).toFixed( 2 );\n\t\t// Given the actual aspect ratio, find the widest ratio to support it.\n\t\tfor (\n\t\t\tlet ratioIndex = 0;\n\t\t\tratioIndex < ASPECT_RATIOS.length;\n\t\t\tratioIndex++\n\t\t) {\n\t\t\tconst potentialRatio = ASPECT_RATIOS[ ratioIndex ];\n\t\t\tif ( aspectRatio >= potentialRatio.ratio ) {\n\t\t\t\t// Evaluate the difference between actual aspect ratio and closest match.\n\t\t\t\t// If the difference is too big, do not scale the embed according to aspect ratio.\n\t\t\t\tconst ratioDiff = aspectRatio - potentialRatio.ratio;\n\t\t\t\tif ( ratioDiff > 0.1 ) {\n\t\t\t\t\t// No close aspect ratio match found.\n\t\t\t\t\treturn removeAspectRatioClasses( existingClassNames );\n\t\t\t\t}\n\t\t\t\t// Close aspect ratio match found.\n\t\t\t\treturn classnames(\n\t\t\t\t\tremoveAspectRatioClasses( existingClassNames ),\n\t\t\t\t\tpotentialRatio.className,\n\t\t\t\t\t'wp-has-aspect-ratio'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn existingClassNames;\n}\n\n/**\n * Fallback behaviour for unembeddable URLs.\n * Creates a paragraph block containing a link to the URL, and calls `onReplace`.\n *\n * @param {string} url The URL that could not be embedded.\n * @param {Function} onReplace Function to call with the created fallback block.\n */\nexport function fallback( url, onReplace ) {\n\tconst link = <a href={ url }>{ url }</a>;\n\tonReplace(\n\t\tcreateBlock( 'core/paragraph', { content: renderToString( link ) } )\n\t);\n}\n\n/***\n * Gets block attributes based on the preview and responsive state.\n *\n * @param {Object} preview The preview data.\n * @param {string} title The block's title, e.g. Twitter.\n * @param {Object} currentClassNames The block's current class names.\n * @param {boolean} isResponsive Boolean indicating if the block supports responsive content.\n * @param {boolean} allowResponsive Apply responsive classes to fixed size content.\n * @return {Object} Attributes and values.\n */\nexport const getAttributesFromPreview = memoize(\n\t(\n\t\tpreview,\n\t\ttitle,\n\t\tcurrentClassNames,\n\t\tisResponsive,\n\t\tallowResponsive = true\n\t) => {\n\t\tif ( ! preview ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst attributes = {};\n\t\t// Some plugins only return HTML with no type info, so default this to 'rich'.\n\t\tlet { type = 'rich' } = preview;\n\t\t// If we got a provider name from the API, use it for the slug, otherwise we use the title,\n\t\t// because not all embed code gives us a provider name.\n\t\tconst { html, provider_name: providerName } = preview;\n\t\tconst providerNameSlug = kebabCase(\n\t\t\t( providerName || title ).toLowerCase()\n\t\t);\n\n\t\tif ( isFromWordPress( html ) ) {\n\t\t\ttype = WP_EMBED_TYPE;\n\t\t}\n\n\t\tif ( html || 'photo' === type ) {\n\t\t\tattributes.type = type;\n\t\t\tattributes.providerNameSlug = providerNameSlug;\n\t\t}\n\n\t\t// Aspect ratio classes are removed when the embed URL is updated.\n\t\t// If the embed already has an aspect ratio class, that means the URL has not changed.\n\t\t// Which also means no need to regenerate it with getClassNames.\n\t\tif ( hasAspectRatioClass( currentClassNames ) ) {\n\t\t\treturn attributes;\n\t\t}\n\n\t\tattributes.className = getClassNames(\n\t\t\thtml,\n\t\t\tcurrentClassNames,\n\t\t\tisResponsive && allowResponsive\n\t\t);\n\n\t\treturn attributes;\n\t}\n);\n\n/**\n * Returns the attributes derived from the preview, merged with the current attributes.\n *\n * @param {Object} currentAttributes The current attributes of the block.\n * @param {Object} preview The preview data.\n * @param {string} title The block's title, e.g. Twitter.\n * @param {boolean} isResponsive Boolean indicating if the block supports responsive content.\n * @return {Object} Merged attributes.\n */\nexport const getMergedAttributesWithPreview = (\n\tcurrentAttributes,\n\tpreview,\n\ttitle,\n\tisResponsive\n) => {\n\tconst { allowResponsive, className } = currentAttributes;\n\n\treturn {\n\t\t...currentAttributes,\n\t\t...getAttributesFromPreview(\n\t\t\tpreview,\n\t\t\ttitle,\n\t\t\tclassName,\n\t\t\tisResponsive,\n\t\t\tallowResponsive\n\t\t),\n\t};\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/embed/util.js"],"names":["name","DEFAULT_EMBED_BLOCK","metadata","kebabCase","blockEditorPrivateApis","getEmbedInfoByProvider","provider","find","matchesPatterns","url","patterns","some","pattern","match","findMoreSuitableBlock","isFromWordPress","html","includes","getPhotoHtml","photo","imageUrl","thumbnail_url","photoPreview","title","createUpgradedEmbedBlock","props","attributesFromPreview","preview","attributes","providerNameSlug","type","restAttributes","matchedBlock","isCurrentBlockWP","WP_EMBED_TYPE","shouldCreateNewBlock","wpVariation","hasAspectRatioClass","existingClassNames","ASPECT_RATIOS","className","removeAspectRatioClasses","aspectRatioClassNames","reduce","accumulator","getClassNames","allowResponsive","previewDocument","document","implementation","createHTMLDocument","body","innerHTML","iframe","querySelector","height","width","aspectRatio","toFixed","ratioIndex","length","potentialRatio","ratio","ratioDiff","fallback","onReplace","link","content","getAttributesFromPreview","currentClassNames","isResponsive","provider_name","providerName","toLowerCase","getMergedAttributesWithPreview","currentAttributes"],"mappings":";;;;;;;;;;;;;AAUA;;AAPA;;AACA;;AAKA;;AAEA;;AAUA;;AACA;;AAtBA;AACA;AACA;;AAIA;AACA;AACA;;AASA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM;AAAEA,EAAAA,IAAI,EAAEC;AAAR,IAAgCC,QAAtC;AACA,MAAM;AAAEC,EAAAA;AAAF,IAAgB,wBAAQC,wBAAR,CAAtB;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,sBAAsB,GAAKC,QAAF,IACrC,gCAAoBL,mBAApB,GAA2CM,IAA3C,CACC,CAAE;AAAEP,EAAAA;AAAF,CAAF,KAAgBA,IAAI,KAAKM,QAD1B,CADM;AAKP;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAME,eAAe,GAAG,CAAEC,GAAF,EAAOC,QAAQ,GAAG,EAAlB,KAC9BA,QAAQ,CAACC,IAAT,CAAiBC,OAAF,IAAeH,GAAG,CAACI,KAAJ,CAAWD,OAAX,CAA9B,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAME,qBAAqB,GAAKL,GAAF,IACpC,gCAAoBR,mBAApB,GAA2CM,IAA3C,CAAiD,CAAE;AAAEG,EAAAA;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,UAAU,CAACY,SAAX,GAAuBK,aAAa,CACnC7B,IADmC,EAEnCqD,iBAFmC,EAGnCC,YAAY,IAAIxB,eAHmB,CAApC;AAMA,SAAOlB,UAAP;AACA,CA7CsC,CAAjC;AAgDP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,MAAM8C,8BAA8B,GAAG,CAC7CC,iBAD6C,EAE7ChD,OAF6C,EAG7CJ,KAH6C,EAI7C+C,YAJ6C,KAKzC;AACJ,QAAM;AAAExB,IAAAA,eAAF;AAAmBN,IAAAA;AAAnB,MAAiCmC,iBAAvC;AAEA,SAAO,EACN,GAAGA,iBADG;AAEN,OAAGP,wBAAwB,CAC1BzC,OAD0B,EAE1BJ,KAF0B,EAG1BiB,SAH0B,EAI1B8B,YAJ0B,EAK1BxB,eAL0B;AAFrB,GAAP;AAUA,CAlBM","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames/dedupe';\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { renderToString } from '@wordpress/element';\nimport {\n\tcreateBlock,\n\tgetBlockType,\n\tgetBlockVariations,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport { ASPECT_RATIOS, WP_EMBED_TYPE } from './constants';\nimport { unlock } from '../lock-unlock';\n\nconst { name: DEFAULT_EMBED_BLOCK } = metadata;\nconst { kebabCase } = unlock( blockEditorPrivateApis );\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n\n/**\n * Returns the embed block's information by matching the provided service provider\n *\n * @param {string} provider The embed block's provider\n * @return {WPBlockVariation} The embed block's information\n */\nexport const getEmbedInfoByProvider = ( provider ) =>\n\tgetBlockVariations( DEFAULT_EMBED_BLOCK )?.find(\n\t\t( { name } ) => name === provider\n\t);\n\n/**\n * Returns true if any of the regular expressions match the URL.\n *\n * @param {string} url The URL to test.\n * @param {Array} patterns The list of regular expressions to test agains.\n * @return {boolean} True if any of the regular expressions match the URL.\n */\nexport const matchesPatterns = ( url, patterns = [] ) =>\n\tpatterns.some( ( pattern ) => url.match( pattern ) );\n\n/**\n * Finds the block variation that should be used for the URL,\n * based on the provided URL and the variation's patterns.\n *\n * @param {string} url The URL to test.\n * @return {WPBlockVariation} The block variation that should be used for this URL\n */\nexport const findMoreSuitableBlock = ( url ) =>\n\tgetBlockVariations( DEFAULT_EMBED_BLOCK )?.find( ( { patterns } ) =>\n\t\tmatchesPatterns( url, patterns )\n\t);\n\nexport const isFromWordPress = ( html ) =>\n\thtml && html.includes( 'class=\"wp-embedded-content\"' );\n\nexport const getPhotoHtml = ( photo ) => {\n\t// If full image url not found use thumbnail.\n\tconst imageUrl = photo.url || photo.thumbnail_url;\n\n\t// 100% width for the preview so it fits nicely into the document, some \"thumbnails\" are\n\t// actually the full size photo.\n\tconst photoPreview = (\n\t\t<p>\n\t\t\t<img src={ imageUrl } alt={ photo.title } width=\"100%\" />\n\t\t</p>\n\t);\n\treturn renderToString( photoPreview );\n};\n\n/**\n * Creates a more suitable embed block based on the passed in props\n * and attributes generated from an embed block's preview.\n *\n * We require `attributesFromPreview` to be generated from the latest attributes\n * and preview, and because of the way the react lifecycle operates, we can't\n * guarantee that the attributes contained in the block's props are the latest\n * versions, so we require that these are generated separately.\n * See `getAttributesFromPreview` in the generated embed edit component.\n *\n * @param {Object} props The block's props.\n * @param {Object} [attributesFromPreview] Attributes generated from the block's most up to date preview.\n * @return {Object|undefined} A more suitable embed block if one exists.\n */\nexport const createUpgradedEmbedBlock = (\n\tprops,\n\tattributesFromPreview = {}\n) => {\n\tconst { preview, attributes = {} } = props;\n\tconst { url, providerNameSlug, type, ...restAttributes } = attributes;\n\n\tif ( ! url || ! getBlockType( DEFAULT_EMBED_BLOCK ) ) return;\n\n\tconst matchedBlock = findMoreSuitableBlock( url );\n\n\t// WordPress blocks can work on multiple sites, and so don't have patterns,\n\t// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.\n\tconst isCurrentBlockWP =\n\t\tproviderNameSlug === 'wordpress' || type === WP_EMBED_TYPE;\n\t// If current block is not WordPress and a more suitable block found\n\t// that is different from the current one, create the new matched block.\n\tconst shouldCreateNewBlock =\n\t\t! isCurrentBlockWP &&\n\t\tmatchedBlock &&\n\t\t( matchedBlock.attributes.providerNameSlug !== providerNameSlug ||\n\t\t\t! providerNameSlug );\n\tif ( shouldCreateNewBlock ) {\n\t\treturn createBlock( DEFAULT_EMBED_BLOCK, {\n\t\t\turl,\n\t\t\t...restAttributes,\n\t\t\t...matchedBlock.attributes,\n\t\t} );\n\t}\n\n\tconst wpVariation = getBlockVariations( DEFAULT_EMBED_BLOCK )?.find(\n\t\t( { name } ) => name === 'wordpress'\n\t);\n\n\t// We can't match the URL for WordPress embeds, we have to check the HTML instead.\n\tif (\n\t\t! wpVariation ||\n\t\t! preview ||\n\t\t! isFromWordPress( preview.html ) ||\n\t\tisCurrentBlockWP\n\t) {\n\t\treturn;\n\t}\n\n\t// This is not the WordPress embed block so transform it into one.\n\treturn createBlock( DEFAULT_EMBED_BLOCK, {\n\t\turl,\n\t\t...wpVariation.attributes,\n\t\t// By now we have the preview, but when the new block first renders, it\n\t\t// won't have had all the attributes set, and so won't get the correct\n\t\t// type and it won't render correctly. So, we pass through the current attributes\n\t\t// here so that the initial render works when we switch to the WordPress\n\t\t// block. This only affects the WordPress block because it can't be\n\t\t// rendered in the usual Sandbox (it has a sandbox of its own) and it\n\t\t// relies on the preview to set the correct render type.\n\t\t...attributesFromPreview,\n\t} );\n};\n\n/**\n * Determine if the block already has an aspect ratio class applied.\n *\n * @param {string} existingClassNames Existing block classes.\n * @return {boolean} True or false if the classnames contain an aspect ratio class.\n */\nexport const hasAspectRatioClass = ( existingClassNames ) => {\n\tif ( ! existingClassNames ) {\n\t\treturn false;\n\t}\n\treturn ASPECT_RATIOS.some( ( { className } ) =>\n\t\texistingClassNames.includes( className )\n\t);\n};\n\n/**\n * Removes all previously set aspect ratio related classes and return the rest\n * existing class names.\n *\n * @param {string} existingClassNames Any existing class names.\n * @return {string} The class names without any aspect ratio related class.\n */\nexport const removeAspectRatioClasses = ( existingClassNames ) => {\n\tif ( ! existingClassNames ) {\n\t\t// Avoids extraneous work and also, by returning the same value as\n\t\t// received, ensures the post is not dirtied by a change of the block\n\t\t// attribute from `undefined` to an emtpy string.\n\t\treturn existingClassNames;\n\t}\n\tconst aspectRatioClassNames = ASPECT_RATIOS.reduce(\n\t\t( accumulator, { className } ) => {\n\t\t\taccumulator[ className ] = false;\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ 'wp-has-aspect-ratio': false }\n\t);\n\treturn classnames( existingClassNames, aspectRatioClassNames );\n};\n\n/**\n * Returns class names with any relevant responsive aspect ratio names.\n *\n * @param {string} html The preview HTML that possibly contains an iframe with width and height set.\n * @param {string} existingClassNames Any existing class names.\n * @param {boolean} allowResponsive If the responsive class names should be added, or removed.\n * @return {string} Deduped class names.\n */\nexport function getClassNames(\n\thtml,\n\texistingClassNames,\n\tallowResponsive = true\n) {\n\tif ( ! allowResponsive ) {\n\t\treturn removeAspectRatioClasses( existingClassNames );\n\t}\n\n\tconst previewDocument = document.implementation.createHTMLDocument( '' );\n\tpreviewDocument.body.innerHTML = html;\n\tconst iframe = previewDocument.body.querySelector( 'iframe' );\n\n\t// If we have a fixed aspect iframe, and it's a responsive embed block.\n\tif ( iframe && iframe.height && iframe.width ) {\n\t\tconst aspectRatio = ( iframe.width / iframe.height ).toFixed( 2 );\n\t\t// Given the actual aspect ratio, find the widest ratio to support it.\n\t\tfor (\n\t\t\tlet ratioIndex = 0;\n\t\t\tratioIndex < ASPECT_RATIOS.length;\n\t\t\tratioIndex++\n\t\t) {\n\t\t\tconst potentialRatio = ASPECT_RATIOS[ ratioIndex ];\n\t\t\tif ( aspectRatio >= potentialRatio.ratio ) {\n\t\t\t\t// Evaluate the difference between actual aspect ratio and closest match.\n\t\t\t\t// If the difference is too big, do not scale the embed according to aspect ratio.\n\t\t\t\tconst ratioDiff = aspectRatio - potentialRatio.ratio;\n\t\t\t\tif ( ratioDiff > 0.1 ) {\n\t\t\t\t\t// No close aspect ratio match found.\n\t\t\t\t\treturn removeAspectRatioClasses( existingClassNames );\n\t\t\t\t}\n\t\t\t\t// Close aspect ratio match found.\n\t\t\t\treturn classnames(\n\t\t\t\t\tremoveAspectRatioClasses( existingClassNames ),\n\t\t\t\t\tpotentialRatio.className,\n\t\t\t\t\t'wp-has-aspect-ratio'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn existingClassNames;\n}\n\n/**\n * Fallback behaviour for unembeddable URLs.\n * Creates a paragraph block containing a link to the URL, and calls `onReplace`.\n *\n * @param {string} url The URL that could not be embedded.\n * @param {Function} onReplace Function to call with the created fallback block.\n */\nexport function fallback( url, onReplace ) {\n\tconst link = <a href={ url }>{ url }</a>;\n\tonReplace(\n\t\tcreateBlock( 'core/paragraph', { content: renderToString( link ) } )\n\t);\n}\n\n/***\n * Gets block attributes based on the preview and responsive state.\n *\n * @param {Object} preview The preview data.\n * @param {string} title The block's title, e.g. Twitter.\n * @param {Object} currentClassNames The block's current class names.\n * @param {boolean} isResponsive Boolean indicating if the block supports responsive content.\n * @param {boolean} allowResponsive Apply responsive classes to fixed size content.\n * @return {Object} Attributes and values.\n */\nexport const getAttributesFromPreview = memoize(\n\t(\n\t\tpreview,\n\t\ttitle,\n\t\tcurrentClassNames,\n\t\tisResponsive,\n\t\tallowResponsive = true\n\t) => {\n\t\tif ( ! preview ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst attributes = {};\n\t\t// Some plugins only return HTML with no type info, so default this to 'rich'.\n\t\tlet { type = 'rich' } = preview;\n\t\t// If we got a provider name from the API, use it for the slug, otherwise we use the title,\n\t\t// because not all embed code gives us a provider name.\n\t\tconst { html, provider_name: providerName } = preview;\n\t\tconst providerNameSlug = kebabCase(\n\t\t\t( providerName || title ).toLowerCase()\n\t\t);\n\n\t\tif ( isFromWordPress( html ) ) {\n\t\t\ttype = WP_EMBED_TYPE;\n\t\t}\n\n\t\tif ( html || 'photo' === type ) {\n\t\t\tattributes.type = type;\n\t\t\tattributes.providerNameSlug = providerNameSlug;\n\t\t}\n\n\t\t// Aspect ratio classes are removed when the embed URL is updated.\n\t\t// If the embed already has an aspect ratio class, that means the URL has not changed.\n\t\t// Which also means no need to regenerate it with getClassNames.\n\t\tif ( hasAspectRatioClass( currentClassNames ) ) {\n\t\t\treturn attributes;\n\t\t}\n\n\t\tattributes.className = getClassNames(\n\t\t\thtml,\n\t\t\tcurrentClassNames,\n\t\t\tisResponsive && allowResponsive\n\t\t);\n\n\t\treturn attributes;\n\t}\n);\n\n/**\n * Returns the attributes derived from the preview, merged with the current attributes.\n *\n * @param {Object} currentAttributes The current attributes of the block.\n * @param {Object} preview The preview data.\n * @param {string} title The block's title, e.g. Twitter.\n * @param {boolean} isResponsive Boolean indicating if the block supports responsive content.\n * @return {Object} Merged attributes.\n */\nexport const getMergedAttributesWithPreview = (\n\tcurrentAttributes,\n\tpreview,\n\ttitle,\n\tisResponsive\n) => {\n\tconst { allowResponsive, className } = currentAttributes;\n\n\treturn {\n\t\t...currentAttributes,\n\t\t...getAttributesFromPreview(\n\t\t\tpreview,\n\t\t\ttitle,\n\t\t\tclassName,\n\t\t\tisResponsive,\n\t\t\tallowResponsive\n\t\t),\n\t};\n};\n"]}
|
package/build/file/index.js
CHANGED
package/build/file/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/file/index.js"],"names":["name","metadata","settings","icon","example","attributes","href","fileName","transforms","deprecated","edit","save","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAdA;AACA;AACA;;AAIA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/file/index.js"],"names":["name","metadata","settings","icon","example","attributes","href","fileName","transforms","deprecated","edit","save","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAdA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,WADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,IAAI,EAAE,8EADK;AAEXC,MAAAA,QAAQ,EAAE,cAAI,sBAAJ,EAA4B,kBAA5B;AAFC;AADJ,GAFc;AAQvBC,EAAAA,UAAU,EAAVA,mBARuB;AASvBC,EAAAA,UAAU,EAAVA,mBATuB;AAUvBC,EAAAA,IAAI,EAAJA,aAVuB;AAWvBC,EAAAA,IAAI,EAAJA;AAXuB,CAAjB;;;AAcA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEZ,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\nimport { file as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\thref: 'https://upload.wikimedia.org/wikipedia/commons/d/dd/Armstrong_Small_Step.ogg',\n\t\t\tfileName: _x( 'Armstrong_Small_Step', 'Name of the file' ),\n\t\t},\n\t},\n\ttransforms,\n\tdeprecated,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
package/build/file/view.js
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interactivity = require("@wordpress/interactivity");
|
|
4
|
+
|
|
3
5
|
var _utils = require("./utils");
|
|
4
6
|
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
5
11
|
/**
|
|
6
12
|
* Internal dependencies
|
|
7
13
|
*/
|
|
8
|
-
|
|
14
|
+
(0, _interactivity.store)({
|
|
15
|
+
selectors: {
|
|
16
|
+
core: {
|
|
17
|
+
file: {
|
|
18
|
+
hasPdfPreview: _utils.browserSupportsPdfs
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
9
23
|
//# sourceMappingURL=view.js.map
|
package/build/file/view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/file/view.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/file/view.js"],"names":["selectors","core","file","hasPdfPreview"],"mappings":";;AAGA;;AAIA;;AAPA;AACA;AACA;;AAEA;AACA;AACA;AAGA,0BAAO;AACNA,EAAAA,SAAS,EAAE;AACVC,IAAAA,IAAI,EAAE;AACLC,MAAAA,IAAI,EAAE;AACLC,QAAAA,aAAa,EAAbA;AADK;AADD;AADI;AADL,CAAP","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store } from '@wordpress/interactivity';\n/**\n * Internal dependencies\n */\nimport { browserSupportsPdfs as hasPdfPreview } from './utils';\n\nstore( {\n\tselectors: {\n\t\tcore: {\n\t\t\tfile: {\n\t\t\t\thasPdfPreview,\n\t\t\t},\n\t\t},\n\t},\n} );\n"]}
|
package/build/gallery/index.js
CHANGED
|
@@ -143,7 +143,9 @@ const metadata = {
|
|
|
143
143
|
blockGap: ["horizontal", "vertical"],
|
|
144
144
|
__experimentalSkipSerialization: ["blockGap"],
|
|
145
145
|
__experimentalDefaultControls: {
|
|
146
|
-
blockGap: true
|
|
146
|
+
blockGap: true,
|
|
147
|
+
margin: false,
|
|
148
|
+
padding: false
|
|
147
149
|
}
|
|
148
150
|
},
|
|
149
151
|
color: {
|