@wordpress/block-library 9.7.1-next.1f6eadc42.0 → 9.8.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.
Files changed (114) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/categories/edit.js +38 -17
  3. package/build/categories/edit.js.map +1 -1
  4. package/build/categories/index.js +10 -3
  5. package/build/categories/index.js.map +1 -1
  6. package/build/categories/variations.js +43 -0
  7. package/build/categories/variations.js.map +1 -0
  8. package/build/embed/edit.js +1 -0
  9. package/build/embed/edit.js.map +1 -1
  10. package/build/embed/edit.native.js +1 -0
  11. package/build/embed/edit.native.js.map +1 -1
  12. package/build/embed/embed-preview.js +80 -100
  13. package/build/embed/embed-preview.js.map +1 -1
  14. package/build/embed/embed-preview.native.js +1 -0
  15. package/build/embed/embed-preview.native.js.map +1 -1
  16. package/build/form/view.js +1 -0
  17. package/build/form/view.js.map +1 -1
  18. package/build/image/image.js +5 -2
  19. package/build/image/image.js.map +1 -1
  20. package/build/index.js +1 -0
  21. package/build/index.js.map +1 -1
  22. package/build/navigation-submenu/index.js +13 -0
  23. package/build/navigation-submenu/index.js.map +1 -1
  24. package/build/post-template/edit.js +6 -1
  25. package/build/post-template/edit.js.map +1 -1
  26. package/build/post-title/index.js +1 -4
  27. package/build/post-title/index.js.map +1 -1
  28. package/build/query/edit/inspector-controls/format-controls.js +102 -0
  29. package/build/query/edit/inspector-controls/format-controls.js.map +1 -0
  30. package/build/query/edit/inspector-controls/index.js +45 -9
  31. package/build/query/edit/inspector-controls/index.js.map +1 -1
  32. package/build/query/edit/query-content.js +26 -10
  33. package/build/query/edit/query-content.js.map +1 -1
  34. package/build/query/index.js +3 -1
  35. package/build/query/index.js.map +1 -1
  36. package/build/query/utils.js +12 -1
  37. package/build/query/utils.js.map +1 -1
  38. package/build/site-title/index.js +1 -4
  39. package/build/site-title/index.js.map +1 -1
  40. package/build/social-link/edit.js +13 -11
  41. package/build/social-link/edit.js.map +1 -1
  42. package/build-module/categories/edit.js +40 -19
  43. package/build-module/categories/edit.js.map +1 -1
  44. package/build-module/categories/index.js +10 -3
  45. package/build-module/categories/index.js.map +1 -1
  46. package/build-module/categories/variations.js +36 -0
  47. package/build-module/categories/variations.js.map +1 -0
  48. package/build-module/embed/edit.js +1 -0
  49. package/build-module/embed/edit.js.map +1 -1
  50. package/build-module/embed/edit.native.js +1 -0
  51. package/build-module/embed/edit.native.js.map +1 -1
  52. package/build-module/embed/embed-preview.js +80 -100
  53. package/build-module/embed/embed-preview.js.map +1 -1
  54. package/build-module/embed/embed-preview.native.js +1 -0
  55. package/build-module/embed/embed-preview.native.js.map +1 -1
  56. package/build-module/form/view.js +1 -0
  57. package/build-module/form/view.js.map +1 -1
  58. package/build-module/image/image.js +5 -2
  59. package/build-module/image/image.js.map +1 -1
  60. package/build-module/index.js +1 -0
  61. package/build-module/index.js.map +1 -1
  62. package/build-module/navigation-submenu/index.js +13 -0
  63. package/build-module/navigation-submenu/index.js.map +1 -1
  64. package/build-module/post-template/edit.js +6 -1
  65. package/build-module/post-template/edit.js.map +1 -1
  66. package/build-module/post-title/index.js +1 -4
  67. package/build-module/post-title/index.js.map +1 -1
  68. package/build-module/query/edit/inspector-controls/format-controls.js +96 -0
  69. package/build-module/query/edit/inspector-controls/format-controls.js.map +1 -0
  70. package/build-module/query/edit/inspector-controls/index.js +45 -9
  71. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  72. package/build-module/query/edit/query-content.js +27 -11
  73. package/build-module/query/edit/query-content.js.map +1 -1
  74. package/build-module/query/index.js +3 -1
  75. package/build-module/query/index.js.map +1 -1
  76. package/build-module/query/utils.js +12 -1
  77. package/build-module/query/utils.js.map +1 -1
  78. package/build-module/site-title/index.js +1 -4
  79. package/build-module/site-title/index.js.map +1 -1
  80. package/build-module/social-link/edit.js +14 -12
  81. package/build-module/social-link/edit.js.map +1 -1
  82. package/build-style/editor-rtl.css +1 -1
  83. package/build-style/editor.css +1 -1
  84. package/build-style/gallery/editor-rtl.css +1 -1
  85. package/build-style/gallery/editor.css +1 -1
  86. package/build-style/post-title/style-rtl.css +4 -18
  87. package/build-style/post-title/style.css +4 -18
  88. package/build-style/site-title/style-rtl.css +4 -18
  89. package/build-style/site-title/style.css +4 -18
  90. package/build-style/style-rtl.css +8 -36
  91. package/build-style/style.css +8 -36
  92. package/package.json +35 -35
  93. package/src/categories/block.json +7 -2
  94. package/src/categories/edit.js +69 -30
  95. package/src/categories/index.js +2 -0
  96. package/src/categories/index.php +21 -9
  97. package/src/categories/variations.js +40 -0
  98. package/src/comments-pagination-next/index.php +1 -1
  99. package/src/comments-pagination-previous/index.php +2 -1
  100. package/src/embed/embed-preview.js +96 -112
  101. package/src/image/image.js +2 -1
  102. package/src/navigation-submenu/block.json +13 -0
  103. package/src/post-template/edit.js +6 -0
  104. package/src/post-template/index.php +5 -0
  105. package/src/post-title/block.json +1 -4
  106. package/src/post-title/style.scss +4 -21
  107. package/src/query/block.json +3 -1
  108. package/src/query/edit/inspector-controls/format-controls.js +90 -0
  109. package/src/query/edit/inspector-controls/index.js +68 -9
  110. package/src/query/edit/query-content.js +38 -5
  111. package/src/query/utils.js +16 -1
  112. package/src/site-title/block.json +1 -4
  113. package/src/site-title/style.scss +4 -21
  114. package/src/social-link/edit.js +11 -7
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 9.8.0 (2024-09-19)
6
+
5
7
  ## 9.7.0 (2024-09-05)
6
8
 
7
9
  ## 9.6.0 (2024-08-21)
@@ -30,24 +30,32 @@ function CategoriesEdit({
30
30
  showOnlyTopLevel,
31
31
  showEmpty,
32
32
  label,
33
- showLabel
33
+ showLabel,
34
+ taxonomy: taxonomySlug
34
35
  },
35
36
  setAttributes,
36
37
  className
37
38
  }) {
38
39
  const selectId = (0, _compose.useInstanceId)(CategoriesEdit, 'blocks-category-select');
40
+ const {
41
+ records: allTaxonomies,
42
+ isResolvingTaxonomies
43
+ } = (0, _coreData.useEntityRecords)('root', 'taxonomy');
44
+ const taxonomies = allTaxonomies?.filter(t => t.visibility.public);
45
+ const taxonomy = taxonomies?.find(t => t.slug === taxonomySlug);
46
+ const isHierarchicalTaxonomy = !isResolvingTaxonomies && taxonomy?.hierarchical;
39
47
  const query = {
40
48
  per_page: -1,
41
49
  hide_empty: !showEmpty,
42
50
  context: 'view'
43
51
  };
44
- if (showOnlyTopLevel) {
52
+ if (isHierarchicalTaxonomy && showOnlyTopLevel) {
45
53
  query.parent = 0;
46
54
  }
47
55
  const {
48
56
  records: categories,
49
57
  isResolving
50
- } = (0, _coreData.useEntityRecords)('taxonomy', 'category', query);
58
+ } = (0, _coreData.useEntityRecords)('taxonomy', taxonomySlug, query);
51
59
  const getCategoriesList = parentId => {
52
60
  if (!categories?.length) {
53
61
  return [];
@@ -64,7 +72,7 @@ function CategoriesEdit({
64
72
  });
65
73
  const renderCategoryName = name => !name ? (0, _i18n.__)('(Untitled)') : (0, _htmlEntities.decodeEntities)(name).trim();
66
74
  const renderCategoryList = () => {
67
- const parentId = showHierarchy ? 0 : null;
75
+ const parentId = isHierarchicalTaxonomy && showHierarchy ? 0 : null;
68
76
  const categoriesList = getCategoriesList(parentId);
69
77
  return categoriesList.map(category => renderCategoryListItem(category));
70
78
  };
@@ -83,20 +91,20 @@ function CategoriesEdit({
83
91
  target: "_blank",
84
92
  rel: "noreferrer noopener",
85
93
  children: renderCategoryName(name)
86
- }), showPostCounts && ` (${count})`, showHierarchy && !!childCategories.length && /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
94
+ }), showPostCounts && ` (${count})`, isHierarchicalTaxonomy && showHierarchy && !!childCategories.length && /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
87
95
  className: "children",
88
96
  children: childCategories.map(childCategory => renderCategoryListItem(childCategory))
89
97
  })]
90
98
  }, id);
91
99
  };
92
100
  const renderCategoryDropdown = () => {
93
- const parentId = showHierarchy ? 0 : null;
101
+ const parentId = isHierarchicalTaxonomy && showHierarchy ? 0 : null;
94
102
  const categoriesList = getCategoriesList(parentId);
95
103
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
96
104
  children: [showLabel ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichText, {
97
105
  className: "wp-block-categories__label",
98
106
  "aria-label": (0, _i18n.__)('Label text'),
99
- placeholder: (0, _i18n.__)('Categories'),
107
+ placeholder: taxonomy.name,
100
108
  withoutInteractiveFormatting: true,
101
109
  value: label,
102
110
  onChange: html => setAttributes({
@@ -105,11 +113,12 @@ function CategoriesEdit({
105
113
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.VisuallyHidden, {
106
114
  as: "label",
107
115
  htmlFor: selectId,
108
- children: label ? label : (0, _i18n.__)('Categories')
116
+ children: label ? label : taxonomy.name
109
117
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("select", {
110
118
  id: selectId,
111
119
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
112
- children: (0, _i18n.__)('Select Category')
120
+ children: (0, _i18n.sprintf)( /* translators: %s: taxonomy's singular name */
121
+ (0, _i18n.__)('Select %s'), taxonomy.labels.singular_name)
113
122
  }), categoriesList.map(category => renderCategoryDropdownItem(category, 0))]
114
123
  })]
115
124
  });
@@ -126,7 +135,7 @@ function CategoriesEdit({
126
135
  children: [Array.from({
127
136
  length: level * 3
128
137
  }).map(() => '\xa0'), renderCategoryName(name), showPostCounts && ` (${count})`]
129
- }, id), showHierarchy && !!childCategories.length && childCategories.map(childCategory => renderCategoryDropdownItem(childCategory, level + 1))];
138
+ }, id), isHierarchicalTaxonomy && showHierarchy && !!childCategories.length && childCategories.map(childCategory => renderCategoryDropdownItem(childCategory, level + 1))];
130
139
  };
131
140
  const TagName = !!categories?.length && !displayAsDropdown && !isResolving ? 'ul' : 'div';
132
141
  const classes = (0, _clsx.default)(className, {
@@ -141,7 +150,19 @@ function CategoriesEdit({
141
150
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
142
151
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.PanelBody, {
143
152
  title: (0, _i18n.__)('Settings'),
144
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
153
+ children: [Array.isArray(taxonomies) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
154
+ __nextHasNoMarginBottom: true,
155
+ __next40pxDefaultSize: true,
156
+ label: (0, _i18n.__)('Taxonomy'),
157
+ options: taxonomies.map(t => ({
158
+ label: t.name,
159
+ value: t.slug
160
+ })),
161
+ value: taxonomySlug,
162
+ onChange: selectedTaxonomy => setAttributes({
163
+ taxonomy: selectedTaxonomy
164
+ })
165
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
145
166
  __nextHasNoMarginBottom: true,
146
167
  label: (0, _i18n.__)('Display as dropdown'),
147
168
  checked: displayAsDropdown,
@@ -157,17 +178,17 @@ function CategoriesEdit({
157
178
  label: (0, _i18n.__)('Show post counts'),
158
179
  checked: showPostCounts,
159
180
  onChange: toggleAttribute('showPostCounts')
160
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
181
+ }), isHierarchicalTaxonomy && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
161
182
  __nextHasNoMarginBottom: true,
162
- label: (0, _i18n.__)('Show only top level categories'),
183
+ label: (0, _i18n.__)('Show only top level terms'),
163
184
  checked: showOnlyTopLevel,
164
185
  onChange: toggleAttribute('showOnlyTopLevel')
165
186
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
166
187
  __nextHasNoMarginBottom: true,
167
- label: (0, _i18n.__)('Show empty categories'),
188
+ label: (0, _i18n.__)('Show empty terms'),
168
189
  checked: showEmpty,
169
190
  onChange: toggleAttribute('showEmpty')
170
- }), !showOnlyTopLevel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
191
+ }), isHierarchicalTaxonomy && !showOnlyTopLevel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
171
192
  __nextHasNoMarginBottom: true,
172
193
  label: (0, _i18n.__)('Show hierarchy'),
173
194
  checked: showHierarchy,
@@ -176,10 +197,10 @@ function CategoriesEdit({
176
197
  })
177
198
  }), isResolving && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Placeholder, {
178
199
  icon: _icons.pin,
179
- label: (0, _i18n.__)('Categories'),
200
+ label: (0, _i18n.__)('Terms'),
180
201
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {})
181
202
  }), !isResolving && categories?.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
182
- children: (0, _i18n.__)('Your site does not have any posts, so there is nothing to display here at the moment.')
203
+ children: taxonomy.labels.no_terms
183
204
  }), !isResolving && categories?.length > 0 && (displayAsDropdown ? renderCategoryDropdown() : renderCategoryList())]
184
205
  });
185
206
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_compose","_blockEditor","_htmlEntities","_i18n","_icons","_coreData","_jsxRuntime","CategoriesEdit","attributes","displayAsDropdown","showHierarchy","showPostCounts","showOnlyTopLevel","showEmpty","label","showLabel","setAttributes","className","selectId","useInstanceId","query","per_page","hide_empty","context","parent","records","categories","isResolving","useEntityRecords","getCategoriesList","parentId","length","filter","toggleAttribute","attributeName","newValue","renderCategoryName","name","__","decodeEntities","trim","renderCategoryList","categoriesList","map","category","renderCategoryListItem","childCategories","id","link","count","jsxs","children","jsx","href","target","rel","childCategory","renderCategoryDropdown","Fragment","RichText","placeholder","withoutInteractiveFormatting","value","onChange","html","VisuallyHidden","as","htmlFor","renderCategoryDropdownItem","level","Array","from","TagName","classes","clsx","blockProps","useBlockProps","InspectorControls","PanelBody","title","ToggleControl","__nextHasNoMarginBottom","checked","Placeholder","icon","pin","Spinner"],"sources":["@wordpress/block-library/src/categories/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tSpinner,\n\tToggleControl,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\nimport { pin } from '@wordpress/icons';\nimport { useEntityRecords } from '@wordpress/core-data';\n\nexport default function CategoriesEdit( {\n\tattributes: {\n\t\tdisplayAsDropdown,\n\t\tshowHierarchy,\n\t\tshowPostCounts,\n\t\tshowOnlyTopLevel,\n\t\tshowEmpty,\n\t\tlabel,\n\t\tshowLabel,\n\t},\n\tsetAttributes,\n\tclassName,\n} ) {\n\tconst selectId = useInstanceId( CategoriesEdit, 'blocks-category-select' );\n\tconst query = { per_page: -1, hide_empty: ! showEmpty, context: 'view' };\n\tif ( showOnlyTopLevel ) {\n\t\tquery.parent = 0;\n\t}\n\n\tconst { records: categories, isResolving } = useEntityRecords(\n\t\t'taxonomy',\n\t\t'category',\n\t\tquery\n\t);\n\n\tconst getCategoriesList = ( parentId ) => {\n\t\tif ( ! categories?.length ) {\n\t\t\treturn [];\n\t\t}\n\t\tif ( parentId === null ) {\n\t\t\treturn categories;\n\t\t}\n\t\treturn categories.filter( ( { parent } ) => parent === parentId );\n\t};\n\n\tconst toggleAttribute = ( attributeName ) => ( newValue ) =>\n\t\tsetAttributes( { [ attributeName ]: newValue } );\n\n\tconst renderCategoryName = ( name ) =>\n\t\t! name ? __( '(Untitled)' ) : decodeEntities( name ).trim();\n\n\tconst renderCategoryList = () => {\n\t\tconst parentId = showHierarchy ? 0 : null;\n\t\tconst categoriesList = getCategoriesList( parentId );\n\t\treturn categoriesList.map( ( category ) =>\n\t\t\trenderCategoryListItem( category )\n\t\t);\n\t};\n\n\tconst renderCategoryListItem = ( category ) => {\n\t\tconst childCategories = getCategoriesList( category.id );\n\t\tconst { id, link, count, name } = category;\n\t\treturn (\n\t\t\t<li key={ id } className={ `cat-item cat-item-${ id }` }>\n\t\t\t\t<a href={ link } target=\"_blank\" rel=\"noreferrer noopener\">\n\t\t\t\t\t{ renderCategoryName( name ) }\n\t\t\t\t</a>\n\t\t\t\t{ showPostCounts && ` (${ count })` }\n\t\t\t\t{ showHierarchy && !! childCategories.length && (\n\t\t\t\t\t<ul className=\"children\">\n\t\t\t\t\t\t{ childCategories.map( ( childCategory ) =>\n\t\t\t\t\t\t\trenderCategoryListItem( childCategory )\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ul>\n\t\t\t\t) }\n\t\t\t</li>\n\t\t);\n\t};\n\n\tconst renderCategoryDropdown = () => {\n\t\tconst parentId = showHierarchy ? 0 : null;\n\t\tconst categoriesList = getCategoriesList( parentId );\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ showLabel ? (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tclassName=\"wp-block-categories__label\"\n\t\t\t\t\t\taria-label={ __( 'Label text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Categories' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { label: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<VisuallyHidden as=\"label\" htmlFor={ selectId }>\n\t\t\t\t\t\t{ label ? label : __( 'Categories' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t) }\n\t\t\t\t<select id={ selectId }>\n\t\t\t\t\t<option>{ __( 'Select Category' ) }</option>\n\t\t\t\t\t{ categoriesList.map( ( category ) =>\n\t\t\t\t\t\trenderCategoryDropdownItem( category, 0 )\n\t\t\t\t\t) }\n\t\t\t\t</select>\n\t\t\t</>\n\t\t);\n\t};\n\n\tconst renderCategoryDropdownItem = ( category, level ) => {\n\t\tconst { id, count, name } = category;\n\t\tconst childCategories = getCategoriesList( id );\n\t\treturn [\n\t\t\t<option key={ id } className={ `level-${ level }` }>\n\t\t\t\t{ Array.from( { length: level * 3 } ).map( () => '\\xa0' ) }\n\t\t\t\t{ renderCategoryName( name ) }\n\t\t\t\t{ showPostCounts && ` (${ count })` }\n\t\t\t</option>,\n\t\t\tshowHierarchy &&\n\t\t\t\t!! childCategories.length &&\n\t\t\t\tchildCategories.map( ( childCategory ) =>\n\t\t\t\t\trenderCategoryDropdownItem( childCategory, level + 1 )\n\t\t\t\t),\n\t\t];\n\t};\n\n\tconst TagName =\n\t\t!! categories?.length && ! displayAsDropdown && ! isResolving\n\t\t\t? 'ul'\n\t\t\t: 'div';\n\n\tconst classes = clsx( className, {\n\t\t'wp-block-categories-list':\n\t\t\t!! categories?.length && ! displayAsDropdown && ! isResolving,\n\t\t'wp-block-categories-dropdown':\n\t\t\t!! categories?.length && displayAsDropdown && ! isResolving,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\n\treturn (\n\t\t<TagName { ...blockProps }>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Display as dropdown' ) }\n\t\t\t\t\t\tchecked={ displayAsDropdown }\n\t\t\t\t\t\tonChange={ toggleAttribute( 'displayAsDropdown' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ displayAsDropdown && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tclassName=\"wp-block-categories__indentation\"\n\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\tchecked={ showLabel }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'showLabel' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show post counts' ) }\n\t\t\t\t\t\tchecked={ showPostCounts }\n\t\t\t\t\t\tonChange={ toggleAttribute( 'showPostCounts' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show only top level categories' ) }\n\t\t\t\t\t\tchecked={ showOnlyTopLevel }\n\t\t\t\t\t\tonChange={ toggleAttribute( 'showOnlyTopLevel' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show empty categories' ) }\n\t\t\t\t\t\tchecked={ showEmpty }\n\t\t\t\t\t\tonChange={ toggleAttribute( 'showEmpty' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! showOnlyTopLevel && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show hierarchy' ) }\n\t\t\t\t\t\t\tchecked={ showHierarchy }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'showHierarchy' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ isResolving && (\n\t\t\t\t<Placeholder icon={ pin } label={ __( 'Categories' ) }>\n\t\t\t\t\t<Spinner />\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t\t{ ! isResolving && categories?.length === 0 && (\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Your site does not have any posts, so there is nothing to display here at the moment.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t{ ! isResolving &&\n\t\t\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,GAAA,EAACrD,WAAA,CAAAiF,aAAa;UACbC,uBAAuB;UACvBnE,KAAK,EAAG,IAAAwB,QAAE,EAAE,uBAAwB,CAAG;UACvC4C,OAAO,EAAGrE,SAAW;UACrBkD,QAAQ,EAAG9B,eAAe,CAAE,WAAY;QAAG,CAC3C,CAAC,EACA,CAAErB,gBAAgB,iBACnB,IAAAN,WAAA,CAAA8C,GAAA,EAACrD,WAAA,CAAAiF,aAAa;UACbC,uBAAuB;UACvBnE,KAAK,EAAG,IAAAwB,QAAE,EAAE,gBAAiB,CAAG;UAChC4C,OAAO,EAAGxE,aAAe;UACzBqD,QAAQ,EAAG9B,eAAe,CAAE,eAAgB;QAAG,CAC/C,CACD;MAAA,CACS;IAAC,CACM,CAAC,EAClBN,WAAW,iBACZ,IAAArB,WAAA,CAAA8C,GAAA,EAACrD,WAAA,CAAAoF,WAAW;MAACC,IAAI,EAAGC,UAAK;MAACvE,KAAK,EAAG,IAAAwB,QAAE,EAAE,YAAa,CAAG;MAAAa,QAAA,eACrD,IAAA7C,WAAA,CAAA8C,GAAA,EAACrD,WAAA,CAAAuF,OAAO,IAAE;IAAC,CACC,CACb,EACC,CAAE3D,WAAW,IAAID,UAAU,EAAEK,MAAM,KAAK,CAAC,iBAC1C,IAAAzB,WAAA,CAAA8C,GAAA;MAAAD,QAAA,EACG,IAAAb,QAAE,EACH,uFACD;IAAC,CACC,CACH,EACC,CAAEX,WAAW,IACdD,UAAU,EAAEK,MAAM,GAAG,CAAC,KACpBtB,iBAAiB,GAChBgD,sBAAsB,CAAC,CAAC,GACxBhB,kBAAkB,CAAC,CAAC,CAAE;EAAA,CAClB,CAAC;AAEZ","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_compose","_blockEditor","_htmlEntities","_i18n","_icons","_coreData","_jsxRuntime","CategoriesEdit","attributes","displayAsDropdown","showHierarchy","showPostCounts","showOnlyTopLevel","showEmpty","label","showLabel","taxonomy","taxonomySlug","setAttributes","className","selectId","useInstanceId","records","allTaxonomies","isResolvingTaxonomies","useEntityRecords","taxonomies","filter","t","visibility","public","find","slug","isHierarchicalTaxonomy","hierarchical","query","per_page","hide_empty","context","parent","categories","isResolving","getCategoriesList","parentId","length","toggleAttribute","attributeName","newValue","renderCategoryName","name","__","decodeEntities","trim","renderCategoryList","categoriesList","map","category","renderCategoryListItem","childCategories","id","link","count","jsxs","children","jsx","href","target","rel","childCategory","renderCategoryDropdown","Fragment","RichText","placeholder","withoutInteractiveFormatting","value","onChange","html","VisuallyHidden","as","htmlFor","sprintf","labels","singular_name","renderCategoryDropdownItem","level","Array","from","TagName","classes","clsx","blockProps","useBlockProps","InspectorControls","PanelBody","title","isArray","SelectControl","__nextHasNoMarginBottom","__next40pxDefaultSize","options","selectedTaxonomy","ToggleControl","checked","Placeholder","icon","pin","Spinner","no_terms"],"sources":["@wordpress/block-library/src/categories/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tSelectControl,\n\tSpinner,\n\tToggleControl,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { pin } from '@wordpress/icons';\nimport { useEntityRecords } from '@wordpress/core-data';\n\nexport default function CategoriesEdit( {\n\tattributes: {\n\t\tdisplayAsDropdown,\n\t\tshowHierarchy,\n\t\tshowPostCounts,\n\t\tshowOnlyTopLevel,\n\t\tshowEmpty,\n\t\tlabel,\n\t\tshowLabel,\n\t\ttaxonomy: taxonomySlug,\n\t},\n\tsetAttributes,\n\tclassName,\n} ) {\n\tconst selectId = useInstanceId( CategoriesEdit, 'blocks-category-select' );\n\n\tconst { records: allTaxonomies, isResolvingTaxonomies } = useEntityRecords(\n\t\t'root',\n\t\t'taxonomy'\n\t);\n\n\tconst taxonomies = allTaxonomies?.filter( ( t ) => t.visibility.public );\n\n\tconst taxonomy = taxonomies?.find( ( t ) => t.slug === taxonomySlug );\n\n\tconst isHierarchicalTaxonomy =\n\t\t! isResolvingTaxonomies && taxonomy?.hierarchical;\n\n\tconst query = { per_page: -1, hide_empty: ! showEmpty, context: 'view' };\n\tif ( isHierarchicalTaxonomy && showOnlyTopLevel ) {\n\t\tquery.parent = 0;\n\t}\n\n\tconst { records: categories, isResolving } = useEntityRecords(\n\t\t'taxonomy',\n\t\ttaxonomySlug,\n\t\tquery\n\t);\n\n\tconst getCategoriesList = ( parentId ) => {\n\t\tif ( ! categories?.length ) {\n\t\t\treturn [];\n\t\t}\n\t\tif ( parentId === null ) {\n\t\t\treturn categories;\n\t\t}\n\t\treturn categories.filter( ( { parent } ) => parent === parentId );\n\t};\n\n\tconst toggleAttribute = ( attributeName ) => ( newValue ) =>\n\t\tsetAttributes( { [ attributeName ]: newValue } );\n\n\tconst renderCategoryName = ( name ) =>\n\t\t! name ? __( '(Untitled)' ) : decodeEntities( name ).trim();\n\n\tconst renderCategoryList = () => {\n\t\tconst parentId = isHierarchicalTaxonomy && showHierarchy ? 0 : null;\n\t\tconst categoriesList = getCategoriesList( parentId );\n\t\treturn categoriesList.map( ( category ) =>\n\t\t\trenderCategoryListItem( category )\n\t\t);\n\t};\n\n\tconst renderCategoryListItem = ( category ) => {\n\t\tconst childCategories = getCategoriesList( category.id );\n\t\tconst { id, link, count, name } = category;\n\t\treturn (\n\t\t\t<li key={ id } className={ `cat-item cat-item-${ id }` }>\n\t\t\t\t<a href={ link } target=\"_blank\" rel=\"noreferrer noopener\">\n\t\t\t\t\t{ renderCategoryName( name ) }\n\t\t\t\t</a>\n\t\t\t\t{ showPostCounts && ` (${ count })` }\n\t\t\t\t{ isHierarchicalTaxonomy &&\n\t\t\t\t\tshowHierarchy &&\n\t\t\t\t\t!! childCategories.length && (\n\t\t\t\t\t\t<ul className=\"children\">\n\t\t\t\t\t\t\t{ childCategories.map( ( childCategory ) =>\n\t\t\t\t\t\t\t\trenderCategoryListItem( childCategory )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t) }\n\t\t\t</li>\n\t\t);\n\t};\n\n\tconst renderCategoryDropdown = () => {\n\t\tconst parentId = isHierarchicalTaxonomy && showHierarchy ? 0 : null;\n\t\tconst categoriesList = getCategoriesList( parentId );\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ showLabel ? (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tclassName=\"wp-block-categories__label\"\n\t\t\t\t\t\taria-label={ __( 'Label text' ) }\n\t\t\t\t\t\tplaceholder={ taxonomy.name }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { label: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<VisuallyHidden as=\"label\" htmlFor={ selectId }>\n\t\t\t\t\t\t{ label ? label : taxonomy.name }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t) }\n\t\t\t\t<select id={ selectId }>\n\t\t\t\t\t<option>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: taxonomy's singular name */\n\t\t\t\t\t\t\t__( 'Select %s' ),\n\t\t\t\t\t\t\ttaxonomy.labels.singular_name\n\t\t\t\t\t\t) }\n\t\t\t\t\t</option>\n\t\t\t\t\t{ categoriesList.map( ( category ) =>\n\t\t\t\t\t\trenderCategoryDropdownItem( category, 0 )\n\t\t\t\t\t) }\n\t\t\t\t</select>\n\t\t\t</>\n\t\t);\n\t};\n\n\tconst renderCategoryDropdownItem = ( category, level ) => {\n\t\tconst { id, count, name } = category;\n\t\tconst childCategories = getCategoriesList( id );\n\t\treturn [\n\t\t\t<option key={ id } className={ `level-${ level }` }>\n\t\t\t\t{ Array.from( { length: level * 3 } ).map( () => '\\xa0' ) }\n\t\t\t\t{ renderCategoryName( name ) }\n\t\t\t\t{ showPostCounts && ` (${ count })` }\n\t\t\t</option>,\n\t\t\tisHierarchicalTaxonomy &&\n\t\t\t\tshowHierarchy &&\n\t\t\t\t!! childCategories.length &&\n\t\t\t\tchildCategories.map( ( childCategory ) =>\n\t\t\t\t\trenderCategoryDropdownItem( childCategory, level + 1 )\n\t\t\t\t),\n\t\t];\n\t};\n\n\tconst TagName =\n\t\t!! categories?.length && ! displayAsDropdown && ! isResolving\n\t\t\t? 'ul'\n\t\t\t: 'div';\n\n\tconst classes = clsx( className, {\n\t\t'wp-block-categories-list':\n\t\t\t!! categories?.length && ! displayAsDropdown && ! isResolving,\n\t\t'wp-block-categories-dropdown':\n\t\t\t!! categories?.length && displayAsDropdown && ! isResolving,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\n\treturn (\n\t\t<TagName { ...blockProps }>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t{ Array.isArray( taxonomies ) && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Taxonomy' ) }\n\t\t\t\t\t\t\toptions={ taxonomies.map( ( t ) => ( {\n\t\t\t\t\t\t\t\tlabel: t.name,\n\t\t\t\t\t\t\t\tvalue: t.slug,\n\t\t\t\t\t\t\t} ) ) }\n\t\t\t\t\t\t\tvalue={ taxonomySlug }\n\t\t\t\t\t\t\tonChange={ ( selectedTaxonomy ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\ttaxonomy: selectedTaxonomy,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Display as dropdown' ) }\n\t\t\t\t\t\tchecked={ displayAsDropdown }\n\t\t\t\t\t\tonChange={ toggleAttribute( 'displayAsDropdown' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ displayAsDropdown && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tclassName=\"wp-block-categories__indentation\"\n\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\tchecked={ showLabel }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'showLabel' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show post counts' ) }\n\t\t\t\t\t\tchecked={ showPostCounts }\n\t\t\t\t\t\tonChange={ toggleAttribute( 'showPostCounts' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isHierarchicalTaxonomy && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show only top level terms' ) }\n\t\t\t\t\t\t\tchecked={ showOnlyTopLevel }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'showOnlyTopLevel' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show empty terms' ) }\n\t\t\t\t\t\tchecked={ showEmpty }\n\t\t\t\t\t\tonChange={ toggleAttribute( 'showEmpty' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isHierarchicalTaxonomy && ! showOnlyTopLevel && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show hierarchy' ) }\n\t\t\t\t\t\t\tchecked={ showHierarchy }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'showHierarchy' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ isResolving && (\n\t\t\t\t<Placeholder icon={ pin } label={ __( 'Terms' ) }>\n\t\t\t\t\t<Spinner />\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t\t{ ! isResolving && categories?.length === 0 && (\n\t\t\t\t<p>{ taxonomy.labels.no_terms }</p>\n\t\t\t) }\n\t\t\t{ ! isResolving &&\n\t\t\t\tcategories?.length > 0 &&\n\t\t\t\t( displayAsDropdown\n\t\t\t\t\t? renderCategoryDropdown()\n\t\t\t\t\t: renderCategoryList() ) }\n\t\t</TagName>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAQA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAAwD,IAAAQ,WAAA,GAAAR,OAAA;AAzBxD;AACA;AACA;;AAGA;AACA;AACA;;AAoBe,SAASS,cAAcA,CAAE;EACvCC,UAAU,EAAE;IACXC,iBAAiB;IACjBC,aAAa;IACbC,cAAc;IACdC,gBAAgB;IAChBC,SAAS;IACTC,KAAK;IACLC,SAAS;IACTC,QAAQ,EAAEC;EACX,CAAC;EACDC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,MAAMC,QAAQ,GAAG,IAAAC,sBAAa,EAAEd,cAAc,EAAE,wBAAyB,CAAC;EAE1E,MAAM;IAAEe,OAAO,EAAEC,aAAa;IA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B,GAChB4D,sBAAsB,CAAC,CAAC,GACxBhB,kBAAkB,CAAC,CAAC,CAAE;EAAA,CAClB,CAAC;AAEZ","ignoreList":[]}
@@ -8,6 +8,7 @@ exports.settings = exports.name = exports.metadata = exports.init = void 0;
8
8
  var _icons = require("@wordpress/icons");
9
9
  var _initBlock = _interopRequireDefault(require("../utils/init-block"));
10
10
  var _edit = _interopRequireDefault(require("./edit"));
11
+ var _variations = _interopRequireDefault(require("./variations"));
11
12
  /**
12
13
  * WordPress dependencies
13
14
  */
@@ -18,11 +19,16 @@ const metadata = exports.metadata = {
18
19
  $schema: "https://schemas.wp.org/trunk/block.json",
19
20
  apiVersion: 3,
20
21
  name: "core/categories",
21
- title: "Categories List",
22
+ title: "Terms List",
22
23
  category: "widgets",
23
- description: "Display a list of all categories.",
24
+ description: "Display a list of all terms of a given taxonomy.",
25
+ keywords: ["categories"],
24
26
  textdomain: "default",
25
27
  attributes: {
28
+ taxonomy: {
29
+ type: "string",
30
+ "default": "category"
31
+ },
26
32
  displayAsDropdown: {
27
33
  type: "boolean",
28
34
  "default": false
@@ -103,7 +109,8 @@ exports.name = name;
103
109
  const settings = exports.settings = {
104
110
  icon: _icons.category,
105
111
  example: {},
106
- edit: _edit.default
112
+ edit: _edit.default,
113
+ variations: _variations.default
107
114
  };
108
115
  const init = () => (0, _initBlock.default)({
109
116
  name,
@@ -1 +1 @@
1
- {"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_edit","metadata","exports","$schema","apiVersion","name","title","category","description","textdomain","attributes","displayAsDropdown","type","showHierarchy","showPostCounts","showOnlyTopLevel","showEmpty","label","__experimentalRole","showLabel","usesContext","supports","align","html","spacing","margin","padding","__experimentalDefaultControls","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","interactivity","clientNavigation","__experimentalBorder","radius","color","width","style","editorStyle","settings","icon","example","edit","init","initBlock"],"sources":["@wordpress/block-library/src/categories/index.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AAVA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAI,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,iBAAA;MAAAC,IAAA;MAAA;IAAA;IAAAC,aAAA;MAAAD,IAAA;MAAA;IAAA;IAAAE,cAAA;MAAAF,IAAA;MAAA;IAAA;IAAAG,gBAAA;MAAAH,IAAA;MAAA;IAAA;IAAAI,SAAA;MAAAJ,IAAA;MAAA;IAAA;IAAAK,KAAA;MAAAL,IAAA;MAAAM,kBAAA;IAAA;IAAAC,SAAA;MAAAP,IAAA;MAAA;IAAA;EAAA;EAAAQ,WAAA;EAAAC,QAAA;IAAAC,KAAA;IAAAC,IAAA;IAAAC,OAAA;MAAAC,MAAA;MAAAC,OAAA;MAAAC,6BAAA;QAAAF,MAAA;QAAAC,OAAA;MAAA;IAAA;IAAAE,UAAA;MAAAC,QAAA;MAAAC,UAAA;MAAAC,wBAAA;MAAAC,wBAAA;MAAAC,uBAAA;MAAAC,2BAAA;MAAAC,4BAAA;MAAAC,2BAAA;MAAAT,6BAAA;QAAAE,QAAA;MAAA;IAAA;IAAAQ,aAAA;MAAAC,gBAAA;IAAA;IAAAC,oBAAA;MAAAC,MAAA;MAAAC,KAAA;MAAAC,KAAA;MAAAC,KAAA;MAAAhB,6BAAA;QAAAa,MAAA;QAAAC,KAAA;QAAAC,KAAA;QAAAC,KAAA;MAAA;IAAA;EAAA;EAAAC,WAAA;EAAAD,KAAA;AAAA;AAOA,MAAM;EAAEtC;AAAK,CAAC,GAAGJ,QAAQ;AAACC,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAInB,MAAMwC,QAAQ,GAAA3C,OAAA,CAAA2C,QAAA,GAAG;EACvBC,IAAI,EAAJA,eAAI;EACJC,OAAO,EAAE,CAAC,CAAC;EACXC,IAAI,EAAJA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAE7C,IAAI;EAAEJ,QAAQ;EAAE4C;AAAS,CAAE,CAAC;AAAC3C,OAAA,CAAA+C,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_edit","_variations","metadata","exports","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","taxonomy","type","displayAsDropdown","showHierarchy","showPostCounts","showOnlyTopLevel","showEmpty","label","__experimentalRole","showLabel","usesContext","supports","align","html","spacing","margin","padding","__experimentalDefaultControls","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","interactivity","clientNavigation","__experimentalBorder","radius","color","width","style","editorStyle","settings","icon","example","edit","variations","init","initBlock"],"sources":["@wordpress/block-library/src/categories/index.js"],"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';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n\tvariations,\n};\n\nexport const init = () => init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EAAAC,WAAA;EAAAD,KAAA;AAAA;AAQA,MAAM;EAAExC;AAAK,CAAC,GAAGJ,QAAQ;AAACC,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAInB,MAAM0C,QAAQ,GAAA7C,OAAA,CAAA6C,QAAA,GAAG;EACvBC,IAAI,EAAJA,eAAI;EACJC,OAAO,EAAE,CAAC,CAAC;EACXC,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEhD,IAAI;EAAEJ,QAAQ;EAAE8C;AAAS,CAAE,CAAC;AAAC7C,OAAA,CAAAkD,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _i18n = require("@wordpress/i18n");
8
+ var _icons = require("@wordpress/icons");
9
+ /**
10
+ * WordPress dependencies
11
+ */
12
+
13
+ const variations = [{
14
+ name: 'terms',
15
+ title: (0, _i18n.__)('Terms List'),
16
+ icon: _icons.category,
17
+ attributes: {
18
+ // We need to set an attribute here that will be set when inserting the block.
19
+ // We cannot leave this empty, as that would be interpreted as the default value,
20
+ // which is `category` -- for which we're defining a distinct variation below,
21
+ // for backwards compatibility reasons.
22
+ // The logical fallback is thus the only other built-in and public taxonomy: Tags.
23
+ taxonomy: 'post_tag'
24
+ },
25
+ isActive: blockAttributes =>
26
+ // This variation is used for any taxonomy other than `category`.
27
+ blockAttributes.taxonomy !== 'category'
28
+ }, {
29
+ name: 'categories',
30
+ title: (0, _i18n.__)('Categories List'),
31
+ description: (0, _i18n.__)('Display a list of all categories.'),
32
+ icon: _icons.category,
33
+ attributes: {
34
+ taxonomy: 'category'
35
+ },
36
+ isActive: ['taxonomy'],
37
+ // The following is needed to prevent "Terms List" from showing up twice in the inserter
38
+ // (once for the block, once for the variation). Fortunately, it does not collide with
39
+ // `categories` being the default value of the `taxonomy` attribute.
40
+ isDefault: true
41
+ }];
42
+ var _default = exports.default = variations;
43
+ //# sourceMappingURL=variations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_i18n","require","_icons","variations","name","title","__","icon","attributes","taxonomy","isActive","blockAttributes","description","isDefault","_default","exports","default"],"sources":["@wordpress/block-library/src/categories/variations.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { category as icon } from '@wordpress/icons';\n\nconst variations = [\n\t{\n\t\tname: 'terms',\n\t\ttitle: __( 'Terms List' ),\n\t\ticon,\n\t\tattributes: {\n\t\t\t// We need to set an attribute here that will be set when inserting the block.\n\t\t\t// We cannot leave this empty, as that would be interpreted as the default value,\n\t\t\t// which is `category` -- for which we're defining a distinct variation below,\n\t\t\t// for backwards compatibility reasons.\n\t\t\t// The logical fallback is thus the only other built-in and public taxonomy: Tags.\n\t\t\ttaxonomy: 'post_tag',\n\t\t},\n\t\tisActive: ( blockAttributes ) =>\n\t\t\t// This variation is used for any taxonomy other than `category`.\n\t\t\tblockAttributes.taxonomy !== 'category',\n\t},\n\t{\n\t\tname: 'categories',\n\t\ttitle: __( 'Categories List' ),\n\t\tdescription: __( 'Display a list of all categories.' ),\n\t\ticon,\n\t\tattributes: {\n\t\t\ttaxonomy: 'category',\n\t\t},\n\t\tisActive: [ 'taxonomy' ],\n\t\t// The following is needed to prevent \"Terms List\" from showing up twice in the inserter\n\t\t// (once for the block, once for the variation). Fortunately, it does not collide with\n\t\t// `categories` being the default value of the `taxonomy` attribute.\n\t\tisDefault: true,\n\t},\n];\n\nexport default variations;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,MAAME,UAAU,GAAG,CAClB;EACCC,IAAI,EAAE,OAAO;EACbC,KAAK,EAAE,IAAAC,QAAE,EAAE,YAAa,CAAC;EACzBC,IAAI,EAAJA,eAAI;EACJC,UAAU,EAAE;IACX;IACA;IACA;IACA;IACA;IACAC,QAAQ,EAAE;EACX,CAAC;EACDC,QAAQ,EAAIC,eAAe;EAC1B;EACAA,eAAe,CAACF,QAAQ,KAAK;AAC/B,CAAC,EACD;EACCL,IAAI,EAAE,YAAY;EAClBC,KAAK,EAAE,IAAAC,QAAE,EAAE,iBAAkB,CAAC;EAC9BM,WAAW,EAAE,IAAAN,QAAE,EAAE,mCAAoC,CAAC;EACtDC,IAAI,EAAJA,eAAI;EACJC,UAAU,EAAE;IACXC,QAAQ,EAAE;EACX,CAAC;EACDC,QAAQ,EAAE,CAAE,UAAU,CAAE;EACxB;EACA;EACA;EACAG,SAAS,EAAE;AACZ,CAAC,CACD;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEab,UAAU","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1 +1 @@
1
- {"version":3,"names":["_util","require","_embedControls","_interopRequireDefault","_icons","_embedLoading","_embedPlaceholder","_embedPreview","_clsx","_i18n","_element","_data","_blockEditor","_coreData","_primitives","_url","_jsxRuntime","EmbedEdit","props","attributes","providerNameSlug","previewable","responsive","url","attributesUrl","isSelected","onReplace","setAttributes","insertBlocksAfter","onFocus","defaultEmbedInfo","title","_x","icon","embedContentIcon","getEmbedInfoByProvider","setURL","useState","isEditingURL","setIsEditingURL","invalidateResolution","useDispatch","coreStore","preview","fetching","themeSupportsResponsive","cannotEmbed","hasResolved","useSelect","select","getEmbedPreview","isPreviewEmbedFallback","isRequestingEmbedPreview","getThemeSupports","hasFinishedResolution","embedPreview","previewIsFallback","badEmbedProvider","html","type","undefined","wordpressCantEmbed","data","status","validPreview","getMergedAttributes","getMergedAttributesWithPreview","toggleResponsive","allowResponsive","className","newAllowResponsive","getClassNames","useEffect","newURL","replace","getAuthority","URL","host","toString","mergedAttributes","upgradedBlock","createUpgradedEmbedBlock","blockProps","useBlockProps","jsx","View","children","default","label","sprintf","__","showEmbedPlaceholder","onSubmit","event","preventDefault","blockClass","removeAspectRatioClasses","value","onChange","fallback","tryAgain","caption","classFromPreview","clsx","jsxs","Fragment","showEditButton","blockSupportsResponsive","switchBackToURLInput","onCaptionChange","_default","exports"],"sources":["@wordpress/block-library/src/embed/edit.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateUpgradedEmbedBlock,\n\tgetClassNames,\n\tremoveAspectRatioClasses,\n\tfallback,\n\tgetEmbedInfoByProvider,\n\tgetMergedAttributesWithPreview,\n} from './util';\nimport EmbedControls from './embed-controls';\nimport { embedContentIcon } from './icons';\nimport EmbedLoading from './embed-loading';\nimport EmbedPlaceholder from './embed-placeholder';\nimport EmbedPreview from './embed-preview';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { View } from '@wordpress/primitives';\nimport { getAuthority } from '@wordpress/url';\n\nconst EmbedEdit = ( props ) => {\n\tconst {\n\t\tattributes: {\n\t\t\tproviderNameSlug,\n\t\t\tpreviewable,\n\t\t\tresponsive,\n\t\t\turl: attributesUrl,\n\t\t},\n\t\tattributes,\n\t\tisSelected,\n\t\tonReplace,\n\t\tsetAttributes,\n\t\tinsertBlocksAfter,\n\t\tonFocus,\n\t} = props;\n\n\tconst defaultEmbedInfo = {\n\t\ttitle: _x( 'Embed', 'block title' ),\n\t\ticon: embedContentIcon,\n\t};\n\tconst { icon, title } =\n\t\tgetEmbedInfoByProvider( providerNameSlug ) || defaultEmbedInfo;\n\n\tconst [ url, setURL ] = useState( attributesUrl );\n\tconst [ isEditingURL, setIsEditingURL ] = useState( false );\n\tconst { invalidateResolution } = useDispatch( coreStore );\n\n\tconst {\n\t\tpreview,\n\t\tfetching,\n\t\tthemeSupportsResponsive,\n\t\tcannotEmbed,\n\t\thasResolved,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEmbedPreview,\n\t\t\t\tisPreviewEmbedFallback,\n\t\t\t\tisRequestingEmbedPreview,\n\t\t\t\tgetThemeSupports,\n\t\t\t\thasFinishedResolution,\n\t\t\t} = select( coreStore );\n\t\t\tif ( ! attributesUrl ) {\n\t\t\t\treturn { fetching: false, cannotEmbed: false };\n\t\t\t}\n\n\t\t\tconst embedPreview = getEmbedPreview( attributesUrl );\n\t\t\tconst previewIsFallback = isPreviewEmbedFallback( attributesUrl );\n\n\t\t\t// The external oEmbed provider does not exist. We got no type info and no html.\n\t\t\tconst badEmbedProvider =\n\t\t\t\tembedPreview?.html === false &&\n\t\t\t\tembedPreview?.type === undefined;\n\t\t\t// Some WordPress URLs that can't be embedded will cause the API to return\n\t\t\t// a valid JSON response with no HTML and `data.status` set to 404, rather\n\t\t\t// than generating a fallback response as other embeds do.\n\t\t\tconst wordpressCantEmbed = embedPreview?.data?.status === 404;\n\t\t\tconst validPreview =\n\t\t\t\t!! embedPreview && ! badEmbedProvider && ! wordpressCantEmbed;\n\t\t\treturn {\n\t\t\t\tpreview: validPreview ? embedPreview : undefined,\n\t\t\t\tfetching: isRequestingEmbedPreview( attributesUrl ),\n\t\t\t\tthemeSupportsResponsive:\n\t\t\t\t\tgetThemeSupports()[ 'responsive-embeds' ],\n\t\t\t\tcannotEmbed: ! validPreview || previewIsFallback,\n\t\t\t\thasResolved: hasFinishedResolution( 'getEmbedPreview', [\n\t\t\t\t\tattributesUrl,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ attributesUrl ]\n\t);\n\n\t/**\n\t * Returns the attributes derived from the preview, merged with the current attributes.\n\t *\n\t * @return {Object} Merged attributes.\n\t */\n\tconst getMergedAttributes = () =>\n\t\tgetMergedAttributesWithPreview(\n\t\t\tattributes,\n\t\t\tpreview,\n\t\t\ttitle,\n\t\t\tresponsive\n\t\t);\n\n\tconst toggleResponsive = () => {\n\t\tconst { allowResponsive, className } = attributes;\n\t\tconst { html } = preview;\n\t\tconst newAllowResponsive = ! allowResponsive;\n\n\t\tsetAttributes( {\n\t\t\tallowResponsive: newAllowResponsive,\n\t\t\tclassName: getClassNames(\n\t\t\t\thtml,\n\t\t\t\tclassName,\n\t\t\t\tresponsive && newAllowResponsive\n\t\t\t),\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( preview?.html || ! cannotEmbed || ! hasResolved ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// At this stage, we're not fetching the preview and know it can't be embedded,\n\t\t// so try removing any trailing slash, and resubmit.\n\t\tconst newURL = attributesUrl.replace( /\\/$/, '' );\n\t\tsetURL( newURL );\n\t\tsetIsEditingURL( false );\n\t\tsetAttributes( { url: newURL } );\n\t}, [\n\t\tpreview?.html,\n\t\tattributesUrl,\n\t\tcannotEmbed,\n\t\thasResolved,\n\t\tsetAttributes,\n\t] );\n\n\t// Try a different provider in case the embed url is not supported.\n\tuseEffect( () => {\n\t\tif ( ! cannotEmbed || fetching || ! url ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Until X provider is supported in WordPress, as a workaround we use Twitter provider.\n\t\tif ( getAuthority( url ) === 'x.com' ) {\n\t\t\tconst newURL = new URL( url );\n\t\t\tnewURL.host = 'twitter.com';\n\t\t\tsetAttributes( { url: newURL.toString() } );\n\t\t}\n\t}, [ url, cannotEmbed, fetching, setAttributes ] );\n\n\t// Handle incoming preview.\n\tuseEffect( () => {\n\t\tif ( preview && ! isEditingURL ) {\n\t\t\t// When obtaining an incoming preview,\n\t\t\t// we set the attributes derived from the preview data.\n\t\t\tconst mergedAttributes = getMergedAttributes();\n\t\t\tsetAttributes( mergedAttributes );\n\n\t\t\tif ( onReplace ) {\n\t\t\t\tconst upgradedBlock = createUpgradedEmbedBlock(\n\t\t\t\t\tprops,\n\t\t\t\t\tmergedAttributes\n\t\t\t\t);\n\n\t\t\t\tif ( upgradedBlock ) {\n\t\t\t\t\tonReplace( upgradedBlock );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [ preview, isEditingURL ] );\n\n\tconst blockProps = useBlockProps();\n\n\tif ( fetching ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedLoading />\n\t\t\t</View>\n\t\t);\n\t}\n\n\t// translators: %s: type of embed e.g: \"YouTube\", \"Twitter\", etc. \"Embed\" is used when no specific type exists\n\tconst label = sprintf( __( '%s URL' ), title );\n\n\t// No preview, or we can't embed the current URL, or we've clicked the edit button.\n\tconst showEmbedPlaceholder = ! preview || cannotEmbed || isEditingURL;\n\n\tif ( showEmbedPlaceholder ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedPlaceholder\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\tif ( event ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If the embed URL was changed, we need to reset the aspect ratio class.\n\t\t\t\t\t\t// To do this we have to remove the existing ratio class so it can be recalculated.\n\t\t\t\t\t\tconst blockClass = removeAspectRatioClasses(\n\t\t\t\t\t\t\tattributes.className\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tsetIsEditingURL( false );\n\t\t\t\t\t\tsetAttributes( { url, className: blockClass } );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ url }\n\t\t\t\t\tcannotEmbed={ cannotEmbed }\n\t\t\t\t\tonChange={ ( value ) => setURL( value ) }\n\t\t\t\t\tfallback={ () => fallback( url, onReplace ) }\n\t\t\t\t\ttryAgain={ () => {\n\t\t\t\t\t\tinvalidateResolution( 'getEmbedPreview', [ url ] );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t);\n\t}\n\n\t// Even though we set attributes that get derived from the preview,\n\t// we don't access them directly because for the initial render,\n\t// the `setAttributes` call will not have taken effect. If we're\n\t// rendering responsive content, setting the responsive classes\n\t// after the preview has been rendered can result in unwanted\n\t// clipping or scrollbars. The `getAttributesFromPreview` function\n\t// that `getMergedAttributes` uses is memoized so that we're not\n\t// calculating them on every render.\n\tconst {\n\t\tcaption,\n\t\ttype,\n\t\tallowResponsive,\n\t\tclassName: classFromPreview,\n\t} = getMergedAttributes();\n\tconst className = clsx( classFromPreview, props.className );\n\n\treturn (\n\t\t<>\n\t\t\t<EmbedControls\n\t\t\t\tshowEditButton={ preview && ! cannotEmbed }\n\t\t\t\tthemeSupportsResponsive={ themeSupportsResponsive }\n\t\t\t\tblockSupportsResponsive={ responsive }\n\t\t\t\tallowResponsive={ allowResponsive }\n\t\t\t\ttoggleResponsive={ toggleResponsive }\n\t\t\t\tswitchBackToURLInput={ () => setIsEditingURL( true ) }\n\t\t\t/>\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedPreview\n\t\t\t\t\tpreview={ preview }\n\t\t\t\t\tpreviewable={ previewable }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\turl={ url }\n\t\t\t\t\ttype={ type }\n\t\t\t\t\tcaption={ caption }\n\t\t\t\t\tonCaptionChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t}\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</>\n\t);\n};\n\nexport default EmbedEdit;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAQA,IAAAC,cAA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AMrE,eAAe,CAAE,IAAK;IAAG,CACtD,CAAC,eACF,IAAAvB,WAAA,CAAAoE,GAAA,EAACtE,WAAA,CAAAuE,IAAI;MAAA,GAAMH,UAAU;MAAAI,QAAA,eACpB,IAAAtE,WAAA,CAAAoE,GAAA,EAAC7E,aAAA,CAAAgF,OAAY;QACZ5C,OAAO,EAAGA,OAAS;QACnBtB,WAAW,EAAGA,WAAa;QAC3BgD,SAAS,EAAGA,SAAW;QACvB9C,GAAG,EAAGA,GAAK;QACXoC,IAAI,EAAGA,IAAM;QACb0C,OAAO,EAAGA,OAAS;QACnBQ,eAAe,EAAKZ,KAAK,IACxBtE,aAAa,CAAE;UAAE0E,OAAO,EAAEJ;QAAM,CAAE,CAClC;QACDxE,UAAU,EAAGA,UAAY;QACzBQ,IAAI,EAAGA,IAAM;QACbuD,KAAK,EAAGA,KAAO;QACf5D,iBAAiB,EAAGA,iBAAmB;QACvCT,UAAU,EAAGA,UAAY;QACzBQ,aAAa,EAAGA;MAAe,CAC/B;IAAC,CACG,CAAC;EAAA,CACN,CAAC;AAEL,CAAC;AAAC,IAAAmF,QAAA,GAAAC,OAAA,CAAAxB,OAAA,GAEatE,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["_util","require","_embedControls","_interopRequireDefault","_icons","_embedLoading","_embedPlaceholder","_embedPreview","_clsx","_i18n","_element","_data","_blockEditor","_coreData","_primitives","_url","_jsxRuntime","EmbedEdit","props","attributes","providerNameSlug","previewable","responsive","url","attributesUrl","isSelected","onReplace","setAttributes","insertBlocksAfter","onFocus","defaultEmbedInfo","title","_x","icon","embedContentIcon","getEmbedInfoByProvider","setURL","useState","isEditingURL","setIsEditingURL","invalidateResolution","useDispatch","coreStore","preview","fetching","themeSupportsResponsive","cannotEmbed","hasResolved","useSelect","select","getEmbedPreview","isPreviewEmbedFallback","isRequestingEmbedPreview","getThemeSupports","hasFinishedResolution","embedPreview","previewIsFallback","badEmbedProvider","html","type","undefined","wordpressCantEmbed","data","status","validPreview","getMergedAttributes","getMergedAttributesWithPreview","toggleResponsive","allowResponsive","className","newAllowResponsive","getClassNames","useEffect","newURL","replace","getAuthority","URL","host","toString","mergedAttributes","upgradedBlock","createUpgradedEmbedBlock","blockProps","useBlockProps","jsx","View","children","default","label","sprintf","__","showEmbedPlaceholder","onSubmit","event","preventDefault","blockClass","removeAspectRatioClasses","value","onChange","fallback","tryAgain","caption","classFromPreview","clsx","jsxs","Fragment","showEditButton","blockSupportsResponsive","switchBackToURLInput","onCaptionChange","_default","exports"],"sources":["@wordpress/block-library/src/embed/edit.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateUpgradedEmbedBlock,\n\tgetClassNames,\n\tremoveAspectRatioClasses,\n\tfallback,\n\tgetEmbedInfoByProvider,\n\tgetMergedAttributesWithPreview,\n} from './util';\nimport EmbedControls from './embed-controls';\nimport { embedContentIcon } from './icons';\nimport EmbedLoading from './embed-loading';\nimport EmbedPlaceholder from './embed-placeholder';\nimport EmbedPreview from './embed-preview';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { View } from '@wordpress/primitives';\nimport { getAuthority } from '@wordpress/url';\n\nconst EmbedEdit = ( props ) => {\n\tconst {\n\t\tattributes: {\n\t\t\tproviderNameSlug,\n\t\t\tpreviewable,\n\t\t\tresponsive,\n\t\t\turl: attributesUrl,\n\t\t},\n\t\tattributes,\n\t\tisSelected,\n\t\tonReplace,\n\t\tsetAttributes,\n\t\tinsertBlocksAfter,\n\t\tonFocus,\n\t} = props;\n\n\tconst defaultEmbedInfo = {\n\t\ttitle: _x( 'Embed', 'block title' ),\n\t\ticon: embedContentIcon,\n\t};\n\tconst { icon, title } =\n\t\tgetEmbedInfoByProvider( providerNameSlug ) || defaultEmbedInfo;\n\n\tconst [ url, setURL ] = useState( attributesUrl );\n\tconst [ isEditingURL, setIsEditingURL ] = useState( false );\n\tconst { invalidateResolution } = useDispatch( coreStore );\n\n\tconst {\n\t\tpreview,\n\t\tfetching,\n\t\tthemeSupportsResponsive,\n\t\tcannotEmbed,\n\t\thasResolved,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEmbedPreview,\n\t\t\t\tisPreviewEmbedFallback,\n\t\t\t\tisRequestingEmbedPreview,\n\t\t\t\tgetThemeSupports,\n\t\t\t\thasFinishedResolution,\n\t\t\t} = select( coreStore );\n\t\t\tif ( ! attributesUrl ) {\n\t\t\t\treturn { fetching: false, cannotEmbed: false };\n\t\t\t}\n\n\t\t\tconst embedPreview = getEmbedPreview( attributesUrl );\n\t\t\tconst previewIsFallback = isPreviewEmbedFallback( attributesUrl );\n\n\t\t\t// The external oEmbed provider does not exist. We got no type info and no html.\n\t\t\tconst badEmbedProvider =\n\t\t\t\tembedPreview?.html === false &&\n\t\t\t\tembedPreview?.type === undefined;\n\t\t\t// Some WordPress URLs that can't be embedded will cause the API to return\n\t\t\t// a valid JSON response with no HTML and `data.status` set to 404, rather\n\t\t\t// than generating a fallback response as other embeds do.\n\t\t\tconst wordpressCantEmbed = embedPreview?.data?.status === 404;\n\t\t\tconst validPreview =\n\t\t\t\t!! embedPreview && ! badEmbedProvider && ! wordpressCantEmbed;\n\t\t\treturn {\n\t\t\t\tpreview: validPreview ? embedPreview : undefined,\n\t\t\t\tfetching: isRequestingEmbedPreview( attributesUrl ),\n\t\t\t\tthemeSupportsResponsive:\n\t\t\t\t\tgetThemeSupports()[ 'responsive-embeds' ],\n\t\t\t\tcannotEmbed: ! validPreview || previewIsFallback,\n\t\t\t\thasResolved: hasFinishedResolution( 'getEmbedPreview', [\n\t\t\t\t\tattributesUrl,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ attributesUrl ]\n\t);\n\n\t/**\n\t * Returns the attributes derived from the preview, merged with the current attributes.\n\t *\n\t * @return {Object} Merged attributes.\n\t */\n\tconst getMergedAttributes = () =>\n\t\tgetMergedAttributesWithPreview(\n\t\t\tattributes,\n\t\t\tpreview,\n\t\t\ttitle,\n\t\t\tresponsive\n\t\t);\n\n\tconst toggleResponsive = () => {\n\t\tconst { allowResponsive, className } = attributes;\n\t\tconst { html } = preview;\n\t\tconst newAllowResponsive = ! allowResponsive;\n\n\t\tsetAttributes( {\n\t\t\tallowResponsive: newAllowResponsive,\n\t\t\tclassName: getClassNames(\n\t\t\t\thtml,\n\t\t\t\tclassName,\n\t\t\t\tresponsive && newAllowResponsive\n\t\t\t),\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( preview?.html || ! cannotEmbed || ! hasResolved ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// At this stage, we're not fetching the preview and know it can't be embedded,\n\t\t// so try removing any trailing slash, and resubmit.\n\t\tconst newURL = attributesUrl.replace( /\\/$/, '' );\n\t\tsetURL( newURL );\n\t\tsetIsEditingURL( false );\n\t\tsetAttributes( { url: newURL } );\n\t}, [\n\t\tpreview?.html,\n\t\tattributesUrl,\n\t\tcannotEmbed,\n\t\thasResolved,\n\t\tsetAttributes,\n\t] );\n\n\t// Try a different provider in case the embed url is not supported.\n\tuseEffect( () => {\n\t\tif ( ! cannotEmbed || fetching || ! url ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Until X provider is supported in WordPress, as a workaround we use Twitter provider.\n\t\tif ( getAuthority( url ) === 'x.com' ) {\n\t\t\tconst newURL = new URL( url );\n\t\t\tnewURL.host = 'twitter.com';\n\t\t\tsetAttributes( { url: newURL.toString() } );\n\t\t}\n\t}, [ url, cannotEmbed, fetching, setAttributes ] );\n\n\t// Handle incoming preview.\n\tuseEffect( () => {\n\t\tif ( preview && ! isEditingURL ) {\n\t\t\t// When obtaining an incoming preview,\n\t\t\t// we set the attributes derived from the preview data.\n\t\t\tconst mergedAttributes = getMergedAttributes();\n\t\t\tsetAttributes( mergedAttributes );\n\n\t\t\tif ( onReplace ) {\n\t\t\t\tconst upgradedBlock = createUpgradedEmbedBlock(\n\t\t\t\t\tprops,\n\t\t\t\t\tmergedAttributes\n\t\t\t\t);\n\n\t\t\t\tif ( upgradedBlock ) {\n\t\t\t\t\tonReplace( upgradedBlock );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [ preview, isEditingURL ] );\n\n\tconst blockProps = useBlockProps();\n\n\tif ( fetching ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedLoading />\n\t\t\t</View>\n\t\t);\n\t}\n\n\t// translators: %s: type of embed e.g: \"YouTube\", \"Twitter\", etc. \"Embed\" is used when no specific type exists\n\tconst label = sprintf( __( '%s URL' ), title );\n\n\t// No preview, or we can't embed the current URL, or we've clicked the edit button.\n\tconst showEmbedPlaceholder = ! preview || cannotEmbed || isEditingURL;\n\n\tif ( showEmbedPlaceholder ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedPlaceholder\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\tif ( event ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If the embed URL was changed, we need to reset the aspect ratio class.\n\t\t\t\t\t\t// To do this we have to remove the existing ratio class so it can be recalculated.\n\t\t\t\t\t\tconst blockClass = removeAspectRatioClasses(\n\t\t\t\t\t\t\tattributes.className\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tsetIsEditingURL( false );\n\t\t\t\t\t\tsetAttributes( { url, className: blockClass } );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ url }\n\t\t\t\t\tcannotEmbed={ cannotEmbed }\n\t\t\t\t\tonChange={ ( value ) => setURL( value ) }\n\t\t\t\t\tfallback={ () => fallback( url, onReplace ) }\n\t\t\t\t\ttryAgain={ () => {\n\t\t\t\t\t\tinvalidateResolution( 'getEmbedPreview', [ url ] );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t);\n\t}\n\n\t// Even though we set attributes that get derived from the preview,\n\t// we don't access them directly because for the initial render,\n\t// the `setAttributes` call will not have taken effect. If we're\n\t// rendering responsive content, setting the responsive classes\n\t// after the preview has been rendered can result in unwanted\n\t// clipping or scrollbars. The `getAttributesFromPreview` function\n\t// that `getMergedAttributes` uses is memoized so that we're not\n\t// calculating them on every render.\n\tconst {\n\t\tcaption,\n\t\ttype,\n\t\tallowResponsive,\n\t\tclassName: classFromPreview,\n\t} = getMergedAttributes();\n\tconst className = clsx( classFromPreview, props.className );\n\n\treturn (\n\t\t<>\n\t\t\t<EmbedControls\n\t\t\t\tshowEditButton={ preview && ! cannotEmbed }\n\t\t\t\tthemeSupportsResponsive={ themeSupportsResponsive }\n\t\t\t\tblockSupportsResponsive={ responsive }\n\t\t\t\tallowResponsive={ allowResponsive }\n\t\t\t\ttoggleResponsive={ toggleResponsive }\n\t\t\t\tswitchBackToURLInput={ () => setIsEditingURL( true ) }\n\t\t\t/>\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedPreview\n\t\t\t\t\tpreview={ preview }\n\t\t\t\t\tpreviewable={ previewable }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\turl={ url }\n\t\t\t\t\ttype={ type }\n\t\t\t\t\tcaption={ caption }\n\t\t\t\t\tonCaptionChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t}\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</>\n\t);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ACtC8C,eAAe,EAAGA,eAAiB;MACnCD,gBAAgB,EAAGA,gBAAkB;MACrCyC,oBAAoB,EAAGA,CAAA,KAAMrE,eAAe,CAAE,IAAK;IAAG,CACtD,CAAC,eACF,IAAAvB,WAAA,CAAAoE,GAAA,EAACtE,WAAA,CAAAuE,IAAI;MAAA,GAAMH,UAAU;MAAAI,QAAA,eACpB,IAAAtE,WAAA,CAAAoE,GAAA,EAAC7E,aAAA,CAAAgF,OAAY;QACZ5C,OAAO,EAAGA,OAAS;QACnBtB,WAAW,EAAGA,WAAa;QAC3BgD,SAAS,EAAGA,SAAW;QACvB9C,GAAG,EAAGA,GAAK;QACXoC,IAAI,EAAGA,IAAM;QACb0C,OAAO,EAAGA,OAAS;QACnBQ,eAAe,EAAKZ,KAAK,IACxBtE,aAAa,CAAE;UAAE0E,OAAO,EAAEJ;QAAM,CAAE,CAClC;QACDxE,UAAU,EAAGA,UAAY;QACzBQ,IAAI,EAAGA,IAAM;QACbuD,KAAK,EAAGA,KAAO;QACf5D,iBAAiB,EAAGA,iBAAmB;QACvCT,UAAU,EAAGA,UAAY;QACzBQ,aAAa,EAAGA;MAAe,CAC/B;IAAC,CACG,CAAC;EAAA,CACN,CAAC;AAEL,CAAC;AAAC,IAAAmF,QAAA,GAAAC,OAAA,CAAAxB,OAAA,GAEatE,SAAS","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1 +1 @@
1
- {"version":3,"names":["_util","require","_embedControls","_interopRequireDefault","_icons","_embedLoading","_embedPlaceholder","_embedPreview","_embedLinkSettings","_clsx","_i18n","_element","_data","_blockEditor","_coreData","_primitives","_url","_jsxRuntime","PREVIEWABLE_PROVIDERS","NOT_PREVIEWABLE_WP_EMBED_PROVIDERS","WP_EMBED_TYPE","EmbedEdit","props","attributes","align","providerNameSlug","previewable","responsive","url","isSelected","onReplace","setAttributes","insertBlocksAfter","onFocus","clientId","defaultEmbedInfo","title","_x","icon","embedContentIcon","embedInfoByProvider","getEmbedInfoByProvider","wasBlockJustInserted","useSelect","select","blockEditorStore","isEditingURL","setIsEditingURL","useState","showEmbedBottomSheet","setShowEmbedBottomSheet","invalidateResolution","useDispatch","coreStore","preview","fetching","themeSupportsResponsive","cannotEmbed","getEmbedPreview","hasFinishedResolution","isPreviewEmbedFallback","getThemeSupports","embedPreview","hasResolvedEmbedPreview","previewIsFallback","badEmbedProvider","html","type","undefined","wordpressCantEmbed","code","validPreview","getMergedAttributes","getMergedAttributesWithPreview","toggleResponsive","allowResponsive","className","newAllowResponsive","getClassNames","useEffect","newURL","replace","getAuthority","URL","host","toString","mergedAttributes","upgradedBlock","createUpgradedEmbedBlock","onEditURL","useCallback","value","blockClass","removeAspectRatioClasses","blockProps","useBlockProps","jsx","View","children","default","showEmbedPlaceholder","classFromPreview","clsx","isProviderPreviewable","includes","linkLabel","jsxs","Fragment","label","onPress","event","fallback","tryAgain","openEmbedLinkSettings","blockSupportsResponsive","isDefaultEmbedInfo","autoFocus","isVisible","onClose","onSubmit","withBottomSheet","_default","exports"],"sources":["@wordpress/block-library/src/embed/edit.native.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateUpgradedEmbedBlock,\n\tgetClassNames,\n\tremoveAspectRatioClasses,\n\tfallback,\n\tgetEmbedInfoByProvider,\n\tgetMergedAttributesWithPreview,\n} from './util';\nimport EmbedControls from './embed-controls';\nimport { embedContentIcon } from './icons';\nimport EmbedLoading from './embed-loading';\nimport EmbedPlaceholder from './embed-placeholder';\nimport EmbedPreview from './embed-preview';\nimport EmbedLinkSettings from './embed-link-settings';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\nimport { useCallback, useState, useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { View } from '@wordpress/primitives';\nimport { getAuthority } from '@wordpress/url';\n\n// The inline preview feature will be released progressible, for this reason\n// the embed will only be considered previewable for the following providers list.\nconst PREVIEWABLE_PROVIDERS = [ 'youtube', 'twitter', 'instagram', 'vimeo' ];\n// Some providers are rendering the inline preview as a WordPress embed and\n// are not supported yet, so we need to disallow them with a fixed providers list.\nconst NOT_PREVIEWABLE_WP_EMBED_PROVIDERS = [ 'pinterest' ];\n\nconst WP_EMBED_TYPE = 'wp-embed';\n\nconst EmbedEdit = ( props ) => {\n\tconst {\n\t\tattributes: { align, providerNameSlug, previewable, responsive, url },\n\t\tattributes,\n\t\tisSelected,\n\t\tonReplace,\n\t\tsetAttributes,\n\t\tinsertBlocksAfter,\n\t\tonFocus,\n\t\tclientId,\n\t} = props;\n\n\tconst defaultEmbedInfo = {\n\t\ttitle: _x( 'Embed', 'block title' ),\n\t\ticon: embedContentIcon,\n\t};\n\tconst embedInfoByProvider = getEmbedInfoByProvider( providerNameSlug );\n\tconst { icon, title } = embedInfoByProvider || defaultEmbedInfo;\n\n\tconst { wasBlockJustInserted } = useSelect(\n\t\t( select ) => ( {\n\t\t\twasBlockJustInserted: select(\n\t\t\t\tblockEditorStore\n\t\t\t).wasBlockJustInserted( clientId, 'inserter_menu' ),\n\t\t} ),\n\t\t[ clientId ]\n\t);\n\tconst [ isEditingURL, setIsEditingURL ] = useState(\n\t\tisSelected && wasBlockJustInserted && ! url\n\t);\n\tconst [ showEmbedBottomSheet, setShowEmbedBottomSheet ] =\n\t\tuseState( isEditingURL );\n\tconst { invalidateResolution } = useDispatch( coreStore );\n\n\tconst { preview, fetching, themeSupportsResponsive, cannotEmbed } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetEmbedPreview,\n\t\t\t\t\thasFinishedResolution,\n\t\t\t\t\tisPreviewEmbedFallback,\n\t\t\t\t\tgetThemeSupports,\n\t\t\t\t} = select( coreStore );\n\t\t\t\tif ( ! url ) {\n\t\t\t\t\treturn { fetching: false, cannotEmbed: false };\n\t\t\t\t}\n\n\t\t\t\tconst embedPreview = getEmbedPreview( url );\n\t\t\t\tconst hasResolvedEmbedPreview = hasFinishedResolution(\n\t\t\t\t\t'getEmbedPreview',\n\t\t\t\t\t[ url ]\n\t\t\t\t);\n\t\t\t\tconst previewIsFallback = isPreviewEmbedFallback( url );\n\n\t\t\t\t// The external oEmbed provider does not exist. We got no type info and no html.\n\t\t\t\tconst badEmbedProvider =\n\t\t\t\t\tembedPreview?.html === false &&\n\t\t\t\t\tembedPreview?.type === undefined;\n\t\t\t\t// Some WordPress URLs that can't be embedded will cause the API to return\n\t\t\t\t// a valid JSON response with no HTML and `code` set to 404, rather\n\t\t\t\t// than generating a fallback response as other embeds do.\n\t\t\t\tconst wordpressCantEmbed = embedPreview?.code === '404';\n\t\t\t\tconst validPreview =\n\t\t\t\t\t!! embedPreview &&\n\t\t\t\t\t! badEmbedProvider &&\n\t\t\t\t\t! wordpressCantEmbed;\n\n\t\t\t\treturn {\n\t\t\t\t\tpreview: validPreview ? embedPreview : undefined,\n\t\t\t\t\tfetching: ! hasResolvedEmbedPreview,\n\t\t\t\t\tthemeSupportsResponsive:\n\t\t\t\t\t\tgetThemeSupports()[ 'responsive-embeds' ],\n\t\t\t\t\tcannotEmbed: ! validPreview || previewIsFallback,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ url ]\n\t\t);\n\n\t/**\n\t * Returns the attributes derived from the preview, merged with the current attributes.\n\t *\n\t * @return {Object} Merged attributes.\n\t */\n\tconst getMergedAttributes = () =>\n\t\tgetMergedAttributesWithPreview(\n\t\t\tattributes,\n\t\t\tpreview,\n\t\t\ttitle,\n\t\t\tresponsive\n\t\t);\n\n\tconst toggleResponsive = () => {\n\t\tconst { allowResponsive, className } = attributes;\n\t\tconst { html } = preview;\n\t\tconst newAllowResponsive = ! allowResponsive;\n\n\t\tsetAttributes( {\n\t\t\tallowResponsive: newAllowResponsive,\n\t\t\tclassName: getClassNames(\n\t\t\t\thtml,\n\t\t\t\tclassName,\n\t\t\t\tresponsive && newAllowResponsive\n\t\t\t),\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! preview?.html || ! cannotEmbed || fetching ) {\n\t\t\treturn;\n\t\t}\n\t\t// At this stage, we're not fetching the preview and know it can't be embedded,\n\t\t// so try removing any trailing slash, and resubmit.\n\t\tconst newURL = url.replace( /\\/$/, '' );\n\t\tsetIsEditingURL( false );\n\t\tsetAttributes( { url: newURL } );\n\t}, [ preview?.html, url, cannotEmbed, fetching ] );\n\n\t// Try a different provider in case the embed url is not supported.\n\tuseEffect( () => {\n\t\tif ( ! cannotEmbed || fetching || ! url ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Until X provider is supported in WordPress, as a workaround we use Twitter provider.\n\t\tif ( getAuthority( url ) === 'x.com' ) {\n\t\t\tconst newURL = new URL( url );\n\t\t\tnewURL.host = 'twitter.com';\n\t\t\tsetAttributes( { url: newURL.toString() } );\n\t\t}\n\t}, [ url, cannotEmbed, fetching, setAttributes ] );\n\n\t// Handle incoming preview.\n\tuseEffect( () => {\n\t\tif ( preview && ! isEditingURL ) {\n\t\t\t// When obtaining an incoming preview,\n\t\t\t// we set the attributes derived from the preview data.\n\t\t\tconst mergedAttributes = getMergedAttributes();\n\t\t\tsetAttributes( mergedAttributes );\n\n\t\t\tif ( onReplace ) {\n\t\t\t\tconst upgradedBlock = createUpgradedEmbedBlock(\n\t\t\t\t\tprops,\n\t\t\t\t\tmergedAttributes\n\t\t\t\t);\n\n\t\t\t\tif ( upgradedBlock ) {\n\t\t\t\t\tonReplace( upgradedBlock );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [ preview, isEditingURL ] );\n\n\tuseEffect(\n\t\t() => setShowEmbedBottomSheet( isEditingURL ),\n\t\t[ isEditingURL ]\n\t);\n\n\tconst onEditURL = useCallback(\n\t\t( value ) => {\n\t\t\t// If the embed URL was changed, we need to reset the aspect ratio class.\n\t\t\t// To do this we have to remove the existing ratio class so it can be recalculated.\n\t\t\tif ( attributes.url !== value ) {\n\t\t\t\tconst blockClass = removeAspectRatioClasses(\n\t\t\t\t\tattributes.className\n\t\t\t\t);\n\t\t\t\tsetAttributes( { className: blockClass } );\n\t\t\t}\n\n\t\t\t// The order of the following calls is important, we need to update the URL attribute before changing `isEditingURL`,\n\t\t\t// otherwise the side-effect that potentially replaces the block when updating the local state won't use the new URL\n\t\t\t// for creating the new block.\n\t\t\tsetAttributes( { url: value } );\n\t\t\tsetIsEditingURL( false );\n\t\t},\n\t\t[ attributes, setAttributes ]\n\t);\n\n\tconst blockProps = useBlockProps();\n\n\tif ( fetching ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedLoading />\n\t\t\t</View>\n\t\t);\n\t}\n\n\tconst showEmbedPlaceholder = ! preview || cannotEmbed;\n\n\t// Even though we set attributes that get derived from the preview,\n\t// we don't access them directly because for the initial render,\n\t// the `setAttributes` call will not have taken effect. If we're\n\t// rendering responsive content, setting the responsive classes\n\t// after the preview has been rendered can result in unwanted\n\t// clipping or scrollbars. The `getAttributesFromPreview` function\n\t// that `getMergedAttributes` uses is memoized so that we're not\n\t// calculating them on every render.\n\tconst {\n\t\ttype,\n\t\tallowResponsive,\n\t\tclassName: classFromPreview,\n\t} = getMergedAttributes();\n\tconst className = clsx( classFromPreview, props.className );\n\n\tconst isProviderPreviewable =\n\t\tPREVIEWABLE_PROVIDERS.includes( providerNameSlug ) ||\n\t\t// For WordPress embeds, we enable the inline preview for all its providers\n\t\t// except the ones that are not supported yet.\n\t\t( WP_EMBED_TYPE === type &&\n\t\t\t! NOT_PREVIEWABLE_WP_EMBED_PROVIDERS.includes( providerNameSlug ) );\n\n\tconst linkLabel = WP_EMBED_TYPE === type ? 'WordPress' : title;\n\n\treturn (\n\t\t<>\n\t\t\t{ showEmbedPlaceholder ? (\n\t\t\t\t<>\n\t\t\t\t\t<View { ...blockProps }>\n\t\t\t\t\t\t<EmbedPlaceholder\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tlabel={ title }\n\t\t\t\t\t\t\tonPress={ ( event ) => {\n\t\t\t\t\t\t\t\tonFocus( event );\n\t\t\t\t\t\t\t\tsetIsEditingURL( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tcannotEmbed={ cannotEmbed }\n\t\t\t\t\t\t\tfallback={ () => fallback( url, onReplace ) }\n\t\t\t\t\t\t\ttryAgain={ () => {\n\t\t\t\t\t\t\t\tinvalidateResolution( 'getEmbedPreview', [\n\t\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\t] );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\topenEmbedLinkSettings={ () =>\n\t\t\t\t\t\t\t\tsetShowEmbedBottomSheet( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<EmbedControls\n\t\t\t\t\t\tthemeSupportsResponsive={ themeSupportsResponsive }\n\t\t\t\t\t\tblockSupportsResponsive={ responsive }\n\t\t\t\t\t\tallowResponsive={ allowResponsive }\n\t\t\t\t\t\ttoggleResponsive={ toggleResponsive }\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\tlinkLabel={ linkLabel }\n\t\t\t\t\t\tonEditURL={ onEditURL }\n\t\t\t\t\t/>\n\t\t\t\t\t<View { ...blockProps }>\n\t\t\t\t\t\t<EmbedPreview\n\t\t\t\t\t\t\talign={ align }\n\t\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tlabel={ title }\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tpreview={ preview }\n\t\t\t\t\t\t\tisProviderPreviewable={ isProviderPreviewable }\n\t\t\t\t\t\t\tpreviewable={ previewable }\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\tisDefaultEmbedInfo={ ! embedInfoByProvider }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<EmbedLinkSettings\n\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\tautoFocus\n\t\t\t\tvalue={ url }\n\t\t\t\tlabel={ linkLabel }\n\t\t\t\tisVisible={ showEmbedBottomSheet }\n\t\t\t\tonClose={ () => setShowEmbedBottomSheet( false ) }\n\t\t\t\tonSubmit={ onEditURL }\n\t\t\t\twithBottomSheet\n\t\t\t/>\n\t\t</>\n\t);\n};\n\nexport default EmbedEdit;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAQA,IAAAC,cAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,iBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,aAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,kBAAA,GAAAL,sBAAA,CAAAF,OAAA;AAKA,IAAAQ,KAAA,GAAAN,sBAAA,CAAAF,OAAA;AAKA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,KAAA,GAAAX,OAAA;AACA,IAAAY,YAAA,GAAAZ,OAAA;AAIA,IAAAa,SAAA,GAAAb,OAAA;AACA,IAAAc,WAAA,GAAAd,OAAA;AACA,IAAAe,IAAA,GAAAf,OAAA;AAA8C,IAAAgB,WAAA,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AS,EAAGpE,oBAAsB;MAClCqE,OAAO,EAAGA,CAAA,KAAMpE,uBAAuB,CAAE,KAAM,CAAG;MAClDqE,QAAQ,EAAG9B,SAAW;MACtB+B,eAAe;IAAA,CACf,CAAC;EAAA,CACD,CAAC;AAEL,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAvB,OAAA,GAEa9E,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["_util","require","_embedControls","_interopRequireDefault","_icons","_embedLoading","_embedPlaceholder","_embedPreview","_embedLinkSettings","_clsx","_i18n","_element","_data","_blockEditor","_coreData","_primitives","_url","_jsxRuntime","PREVIEWABLE_PROVIDERS","NOT_PREVIEWABLE_WP_EMBED_PROVIDERS","WP_EMBED_TYPE","EmbedEdit","props","attributes","align","providerNameSlug","previewable","responsive","url","isSelected","onReplace","setAttributes","insertBlocksAfter","onFocus","clientId","defaultEmbedInfo","title","_x","icon","embedContentIcon","embedInfoByProvider","getEmbedInfoByProvider","wasBlockJustInserted","useSelect","select","blockEditorStore","isEditingURL","setIsEditingURL","useState","showEmbedBottomSheet","setShowEmbedBottomSheet","invalidateResolution","useDispatch","coreStore","preview","fetching","themeSupportsResponsive","cannotEmbed","getEmbedPreview","hasFinishedResolution","isPreviewEmbedFallback","getThemeSupports","embedPreview","hasResolvedEmbedPreview","previewIsFallback","badEmbedProvider","html","type","undefined","wordpressCantEmbed","code","validPreview","getMergedAttributes","getMergedAttributesWithPreview","toggleResponsive","allowResponsive","className","newAllowResponsive","getClassNames","useEffect","newURL","replace","getAuthority","URL","host","toString","mergedAttributes","upgradedBlock","createUpgradedEmbedBlock","onEditURL","useCallback","value","blockClass","removeAspectRatioClasses","blockProps","useBlockProps","jsx","View","children","default","showEmbedPlaceholder","classFromPreview","clsx","isProviderPreviewable","includes","linkLabel","jsxs","Fragment","label","onPress","event","fallback","tryAgain","openEmbedLinkSettings","blockSupportsResponsive","isDefaultEmbedInfo","autoFocus","isVisible","onClose","onSubmit","withBottomSheet","_default","exports"],"sources":["@wordpress/block-library/src/embed/edit.native.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateUpgradedEmbedBlock,\n\tgetClassNames,\n\tremoveAspectRatioClasses,\n\tfallback,\n\tgetEmbedInfoByProvider,\n\tgetMergedAttributesWithPreview,\n} from './util';\nimport EmbedControls from './embed-controls';\nimport { embedContentIcon } from './icons';\nimport EmbedLoading from './embed-loading';\nimport EmbedPlaceholder from './embed-placeholder';\nimport EmbedPreview from './embed-preview';\nimport EmbedLinkSettings from './embed-link-settings';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\nimport { useCallback, useState, useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { View } from '@wordpress/primitives';\nimport { getAuthority } from '@wordpress/url';\n\n// The inline preview feature will be released progressible, for this reason\n// the embed will only be considered previewable for the following providers list.\nconst PREVIEWABLE_PROVIDERS = [ 'youtube', 'twitter', 'instagram', 'vimeo' ];\n// Some providers are rendering the inline preview as a WordPress embed and\n// are not supported yet, so we need to disallow them with a fixed providers list.\nconst NOT_PREVIEWABLE_WP_EMBED_PROVIDERS = [ 'pinterest' ];\n\nconst WP_EMBED_TYPE = 'wp-embed';\n\nconst EmbedEdit = ( props ) => {\n\tconst {\n\t\tattributes: { align, providerNameSlug, previewable, responsive, url },\n\t\tattributes,\n\t\tisSelected,\n\t\tonReplace,\n\t\tsetAttributes,\n\t\tinsertBlocksAfter,\n\t\tonFocus,\n\t\tclientId,\n\t} = props;\n\n\tconst defaultEmbedInfo = {\n\t\ttitle: _x( 'Embed', 'block title' ),\n\t\ticon: embedContentIcon,\n\t};\n\tconst embedInfoByProvider = getEmbedInfoByProvider( providerNameSlug );\n\tconst { icon, title } = embedInfoByProvider || defaultEmbedInfo;\n\n\tconst { wasBlockJustInserted } = useSelect(\n\t\t( select ) => ( {\n\t\t\twasBlockJustInserted: select(\n\t\t\t\tblockEditorStore\n\t\t\t).wasBlockJustInserted( clientId, 'inserter_menu' ),\n\t\t} ),\n\t\t[ clientId ]\n\t);\n\tconst [ isEditingURL, setIsEditingURL ] = useState(\n\t\tisSelected && wasBlockJustInserted && ! url\n\t);\n\tconst [ showEmbedBottomSheet, setShowEmbedBottomSheet ] =\n\t\tuseState( isEditingURL );\n\tconst { invalidateResolution } = useDispatch( coreStore );\n\n\tconst { preview, fetching, themeSupportsResponsive, cannotEmbed } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetEmbedPreview,\n\t\t\t\t\thasFinishedResolution,\n\t\t\t\t\tisPreviewEmbedFallback,\n\t\t\t\t\tgetThemeSupports,\n\t\t\t\t} = select( coreStore );\n\t\t\t\tif ( ! url ) {\n\t\t\t\t\treturn { fetching: false, cannotEmbed: false };\n\t\t\t\t}\n\n\t\t\t\tconst embedPreview = getEmbedPreview( url );\n\t\t\t\tconst hasResolvedEmbedPreview = hasFinishedResolution(\n\t\t\t\t\t'getEmbedPreview',\n\t\t\t\t\t[ url ]\n\t\t\t\t);\n\t\t\t\tconst previewIsFallback = isPreviewEmbedFallback( url );\n\n\t\t\t\t// The external oEmbed provider does not exist. We got no type info and no html.\n\t\t\t\tconst badEmbedProvider =\n\t\t\t\t\tembedPreview?.html === false &&\n\t\t\t\t\tembedPreview?.type === undefined;\n\t\t\t\t// Some WordPress URLs that can't be embedded will cause the API to return\n\t\t\t\t// a valid JSON response with no HTML and `code` set to 404, rather\n\t\t\t\t// than generating a fallback response as other embeds do.\n\t\t\t\tconst wordpressCantEmbed = embedPreview?.code === '404';\n\t\t\t\tconst validPreview =\n\t\t\t\t\t!! embedPreview &&\n\t\t\t\t\t! badEmbedProvider &&\n\t\t\t\t\t! wordpressCantEmbed;\n\n\t\t\t\treturn {\n\t\t\t\t\tpreview: validPreview ? embedPreview : undefined,\n\t\t\t\t\tfetching: ! hasResolvedEmbedPreview,\n\t\t\t\t\tthemeSupportsResponsive:\n\t\t\t\t\t\tgetThemeSupports()[ 'responsive-embeds' ],\n\t\t\t\t\tcannotEmbed: ! validPreview || previewIsFallback,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ url ]\n\t\t);\n\n\t/**\n\t * Returns the attributes derived from the preview, merged with the current attributes.\n\t *\n\t * @return {Object} Merged attributes.\n\t */\n\tconst getMergedAttributes = () =>\n\t\tgetMergedAttributesWithPreview(\n\t\t\tattributes,\n\t\t\tpreview,\n\t\t\ttitle,\n\t\t\tresponsive\n\t\t);\n\n\tconst toggleResponsive = () => {\n\t\tconst { allowResponsive, className } = attributes;\n\t\tconst { html } = preview;\n\t\tconst newAllowResponsive = ! allowResponsive;\n\n\t\tsetAttributes( {\n\t\t\tallowResponsive: newAllowResponsive,\n\t\t\tclassName: getClassNames(\n\t\t\t\thtml,\n\t\t\t\tclassName,\n\t\t\t\tresponsive && newAllowResponsive\n\t\t\t),\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! preview?.html || ! cannotEmbed || fetching ) {\n\t\t\treturn;\n\t\t}\n\t\t// At this stage, we're not fetching the preview and know it can't be embedded,\n\t\t// so try removing any trailing slash, and resubmit.\n\t\tconst newURL = url.replace( /\\/$/, '' );\n\t\tsetIsEditingURL( false );\n\t\tsetAttributes( { url: newURL } );\n\t}, [ preview?.html, url, cannotEmbed, fetching ] );\n\n\t// Try a different provider in case the embed url is not supported.\n\tuseEffect( () => {\n\t\tif ( ! cannotEmbed || fetching || ! url ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Until X provider is supported in WordPress, as a workaround we use Twitter provider.\n\t\tif ( getAuthority( url ) === 'x.com' ) {\n\t\t\tconst newURL = new URL( url );\n\t\t\tnewURL.host = 'twitter.com';\n\t\t\tsetAttributes( { url: newURL.toString() } );\n\t\t}\n\t}, [ url, cannotEmbed, fetching, setAttributes ] );\n\n\t// Handle incoming preview.\n\tuseEffect( () => {\n\t\tif ( preview && ! isEditingURL ) {\n\t\t\t// When obtaining an incoming preview,\n\t\t\t// we set the attributes derived from the preview data.\n\t\t\tconst mergedAttributes = getMergedAttributes();\n\t\t\tsetAttributes( mergedAttributes );\n\n\t\t\tif ( onReplace ) {\n\t\t\t\tconst upgradedBlock = createUpgradedEmbedBlock(\n\t\t\t\t\tprops,\n\t\t\t\t\tmergedAttributes\n\t\t\t\t);\n\n\t\t\t\tif ( upgradedBlock ) {\n\t\t\t\t\tonReplace( upgradedBlock );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [ preview, isEditingURL ] );\n\n\tuseEffect(\n\t\t() => setShowEmbedBottomSheet( isEditingURL ),\n\t\t[ isEditingURL ]\n\t);\n\n\tconst onEditURL = useCallback(\n\t\t( value ) => {\n\t\t\t// If the embed URL was changed, we need to reset the aspect ratio class.\n\t\t\t// To do this we have to remove the existing ratio class so it can be recalculated.\n\t\t\tif ( attributes.url !== value ) {\n\t\t\t\tconst blockClass = removeAspectRatioClasses(\n\t\t\t\t\tattributes.className\n\t\t\t\t);\n\t\t\t\tsetAttributes( { className: blockClass } );\n\t\t\t}\n\n\t\t\t// The order of the following calls is important, we need to update the URL attribute before changing `isEditingURL`,\n\t\t\t// otherwise the side-effect that potentially replaces the block when updating the local state won't use the new URL\n\t\t\t// for creating the new block.\n\t\t\tsetAttributes( { url: value } );\n\t\t\tsetIsEditingURL( false );\n\t\t},\n\t\t[ attributes, setAttributes ]\n\t);\n\n\tconst blockProps = useBlockProps();\n\n\tif ( fetching ) {\n\t\treturn (\n\t\t\t<View { ...blockProps }>\n\t\t\t\t<EmbedLoading />\n\t\t\t</View>\n\t\t);\n\t}\n\n\tconst showEmbedPlaceholder = ! preview || cannotEmbed;\n\n\t// Even though we set attributes that get derived from the preview,\n\t// we don't access them directly because for the initial render,\n\t// the `setAttributes` call will not have taken effect. If we're\n\t// rendering responsive content, setting the responsive classes\n\t// after the preview has been rendered can result in unwanted\n\t// clipping or scrollbars. The `getAttributesFromPreview` function\n\t// that `getMergedAttributes` uses is memoized so that we're not\n\t// calculating them on every render.\n\tconst {\n\t\ttype,\n\t\tallowResponsive,\n\t\tclassName: classFromPreview,\n\t} = getMergedAttributes();\n\tconst className = clsx( classFromPreview, props.className );\n\n\tconst isProviderPreviewable =\n\t\tPREVIEWABLE_PROVIDERS.includes( providerNameSlug ) ||\n\t\t// For WordPress embeds, we enable the inline preview for all its providers\n\t\t// except the ones that are not supported yet.\n\t\t( WP_EMBED_TYPE === type &&\n\t\t\t! NOT_PREVIEWABLE_WP_EMBED_PROVIDERS.includes( providerNameSlug ) );\n\n\tconst linkLabel = WP_EMBED_TYPE === type ? 'WordPress' : title;\n\n\treturn (\n\t\t<>\n\t\t\t{ showEmbedPlaceholder ? (\n\t\t\t\t<>\n\t\t\t\t\t<View { ...blockProps }>\n\t\t\t\t\t\t<EmbedPlaceholder\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tlabel={ title }\n\t\t\t\t\t\t\tonPress={ ( event ) => {\n\t\t\t\t\t\t\t\tonFocus( event );\n\t\t\t\t\t\t\t\tsetIsEditingURL( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tcannotEmbed={ cannotEmbed }\n\t\t\t\t\t\t\tfallback={ () => fallback( url, onReplace ) }\n\t\t\t\t\t\t\ttryAgain={ () => {\n\t\t\t\t\t\t\t\tinvalidateResolution( 'getEmbedPreview', [\n\t\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\t] );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\topenEmbedLinkSettings={ () =>\n\t\t\t\t\t\t\t\tsetShowEmbedBottomSheet( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<EmbedControls\n\t\t\t\t\t\tthemeSupportsResponsive={ themeSupportsResponsive }\n\t\t\t\t\t\tblockSupportsResponsive={ responsive }\n\t\t\t\t\t\tallowResponsive={ allowResponsive }\n\t\t\t\t\t\ttoggleResponsive={ toggleResponsive }\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\tlinkLabel={ linkLabel }\n\t\t\t\t\t\tonEditURL={ onEditURL }\n\t\t\t\t\t/>\n\t\t\t\t\t<View { ...blockProps }>\n\t\t\t\t\t\t<EmbedPreview\n\t\t\t\t\t\t\talign={ align }\n\t\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tlabel={ title }\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tpreview={ preview }\n\t\t\t\t\t\t\tisProviderPreviewable={ isProviderPreviewable }\n\t\t\t\t\t\t\tpreviewable={ previewable }\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\tisDefaultEmbedInfo={ ! embedInfoByProvider }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<EmbedLinkSettings\n\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\tautoFocus\n\t\t\t\tvalue={ url }\n\t\t\t\tlabel={ linkLabel }\n\t\t\t\tisVisible={ showEmbedBottomSheet }\n\t\t\t\tonClose={ () => setShowEmbedBottomSheet( false ) }\n\t\t\t\tonSubmit={ onEditURL }\n\t\t\t\twithBottomSheet\n\t\t\t/>\n\t\t</>\n\t);\n};\n\nexport default EmbedEdit;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAQA,IAAAC,cAAA,GAAAC,sBAAA,C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