@wordpress/block-library 9.40.1 → 9.40.2-next.v.202602271551.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/accordion/view.cjs +0 -34
- package/build/accordion/view.cjs.map +2 -2
- package/build/icon/block.json +9 -1
- package/build/icon/components/custom-inserter/icon-grid.cjs +1 -1
- package/build/icon/components/custom-inserter/icon-grid.cjs.map +2 -2
- package/build/icon/components/custom-inserter/index.cjs +1 -1
- package/build/icon/components/custom-inserter/index.cjs.map +2 -2
- package/build/icon/edit.cjs +15 -7
- package/build/icon/edit.cjs.map +2 -2
- package/build/image/edit.cjs +1 -1
- package/build/image/edit.cjs.map +2 -2
- package/build/navigation/edit/index.cjs +4 -2
- package/build/navigation/edit/index.cjs.map +3 -3
- package/build/navigation/edit/leaf-more-menu.cjs +68 -6
- package/build/navigation/edit/leaf-more-menu.cjs.map +3 -3
- package/build/navigation/edit/menu-inspector-controls.cjs +20 -91
- package/build/navigation/edit/menu-inspector-controls.cjs.map +3 -3
- package/build/navigation/edit/navigation-link-ui.cjs +97 -0
- package/build/navigation/edit/navigation-link-ui.cjs.map +7 -0
- package/build/navigation/edit/navigation-list-view-header.cjs +86 -0
- package/build/navigation/edit/navigation-list-view-header.cjs.map +7 -0
- package/build/navigation/edit/navigation-menu-selector.cjs +4 -2
- package/build/navigation/edit/navigation-menu-selector.cjs.map +3 -3
- package/build/navigation/edit/placeholder/index.cjs +2 -2
- package/build/navigation/edit/placeholder/index.cjs.map +3 -3
- package/build/navigation-link/shared/controls.cjs +29 -52
- package/build/navigation-link/shared/controls.cjs.map +3 -3
- package/build/navigation-link/shared/use-link-preview.cjs +7 -8
- package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
- package/build/navigation-overlay-close/edit.cjs +2 -3
- package/build/navigation-overlay-close/edit.cjs.map +2 -2
- package/build/page-list-item/edit.cjs +6 -3
- package/build/page-list-item/edit.cjs.map +2 -2
- package/build/post-navigation-link/block.json +1 -3
- package/build/post-navigation-link/deprecated.cjs +100 -0
- package/build/post-navigation-link/deprecated.cjs.map +7 -0
- package/build/post-navigation-link/edit.cjs +2 -36
- package/build/post-navigation-link/edit.cjs.map +3 -3
- package/build/post-navigation-link/index.cjs +2 -0
- package/build/post-navigation-link/index.cjs.map +3 -3
- package/build/post-title/block.json +1 -3
- package/build/post-title/deprecated.cjs +82 -1
- package/build/post-title/deprecated.cjs.map +3 -3
- package/build/post-title/edit.cjs +10 -36
- package/build/post-title/edit.cjs.map +3 -3
- package/build/pullquote/deprecated.cjs +6 -6
- package/build/pullquote/deprecated.cjs.map +2 -2
- package/build/query/block.json +1 -2
- package/build/query-title/block.json +1 -3
- package/build/query-title/deprecated.cjs +70 -1
- package/build/query-title/deprecated.cjs.map +3 -3
- package/build/query-title/edit.cjs +17 -35
- package/build/query-title/edit.cjs.map +3 -3
- package/build/site-tagline/block.json +6 -4
- package/build/site-tagline/deprecated.cjs +66 -1
- package/build/site-tagline/deprecated.cjs.map +3 -3
- package/build/site-tagline/edit.cjs +14 -28
- package/build/site-tagline/edit.cjs.map +3 -3
- package/build/site-title/block.json +1 -3
- package/build/site-title/deprecated.cjs +79 -1
- package/build/site-title/deprecated.cjs.map +3 -3
- package/build/site-title/edit.cjs +14 -30
- package/build/site-title/edit.cjs.map +3 -3
- package/build/tabs-menu-item/block.json +1 -26
- package/build/tabs-menu-item/controls.cjs +2 -100
- package/build/tabs-menu-item/controls.cjs.map +3 -3
- package/build/tabs-menu-item/edit.cjs +6 -65
- package/build/tabs-menu-item/edit.cjs.map +2 -2
- package/build/tabs-menu-item/save.cjs +1 -15
- package/build/tabs-menu-item/save.cjs.map +2 -2
- package/build-module/accordion/view.mjs +1 -35
- package/build-module/accordion/view.mjs.map +2 -2
- package/build-module/icon/block.json +9 -1
- package/build-module/icon/components/custom-inserter/icon-grid.mjs +1 -1
- package/build-module/icon/components/custom-inserter/icon-grid.mjs.map +2 -2
- package/build-module/icon/components/custom-inserter/index.mjs +1 -1
- package/build-module/icon/components/custom-inserter/index.mjs.map +2 -2
- package/build-module/icon/edit.mjs +15 -7
- package/build-module/icon/edit.mjs.map +2 -2
- package/build-module/image/edit.mjs +1 -1
- package/build-module/image/edit.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs +4 -2
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/leaf-more-menu.mjs +73 -7
- package/build-module/navigation/edit/leaf-more-menu.mjs.map +2 -2
- package/build-module/navigation/edit/menu-inspector-controls.mjs +21 -101
- package/build-module/navigation/edit/menu-inspector-controls.mjs.map +2 -2
- package/build-module/navigation/edit/navigation-link-ui.mjs +76 -0
- package/build-module/navigation/edit/navigation-link-ui.mjs.map +7 -0
- package/build-module/navigation/edit/navigation-list-view-header.mjs +58 -0
- package/build-module/navigation/edit/navigation-list-view-header.mjs.map +7 -0
- package/build-module/navigation/edit/navigation-menu-selector.mjs +5 -3
- package/build-module/navigation/edit/navigation-menu-selector.mjs.map +2 -2
- package/build-module/navigation/edit/placeholder/index.mjs +2 -2
- package/build-module/navigation/edit/placeholder/index.mjs.map +2 -2
- package/build-module/navigation-link/shared/controls.mjs +29 -53
- package/build-module/navigation-link/shared/controls.mjs.map +2 -2
- package/build-module/navigation-link/shared/use-link-preview.mjs +7 -8
- package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
- package/build-module/navigation-overlay-close/edit.mjs +2 -3
- package/build-module/navigation-overlay-close/edit.mjs.map +2 -2
- package/build-module/page-list-item/edit.mjs +6 -3
- package/build-module/page-list-item/edit.mjs.map +2 -2
- package/build-module/post-navigation-link/block.json +1 -3
- package/build-module/post-navigation-link/deprecated.mjs +69 -0
- package/build-module/post-navigation-link/deprecated.mjs.map +7 -0
- package/build-module/post-navigation-link/edit.mjs +3 -30
- package/build-module/post-navigation-link/edit.mjs.map +2 -2
- package/build-module/post-navigation-link/index.mjs +2 -0
- package/build-module/post-navigation-link/index.mjs.map +2 -2
- package/build-module/post-title/block.json +1 -3
- package/build-module/post-title/deprecated.mjs +82 -1
- package/build-module/post-title/deprecated.mjs.map +2 -2
- package/build-module/post-title/edit.mjs +10 -27
- package/build-module/post-title/edit.mjs.map +2 -2
- package/build-module/pullquote/deprecated.mjs +6 -6
- package/build-module/pullquote/deprecated.mjs.map +2 -2
- package/build-module/query/block.json +1 -2
- package/build-module/query-title/block.json +1 -3
- package/build-module/query-title/deprecated.mjs +70 -1
- package/build-module/query-title/deprecated.mjs.map +2 -2
- package/build-module/query-title/edit.mjs +17 -36
- package/build-module/query-title/edit.mjs.map +2 -2
- package/build-module/site-tagline/block.json +6 -4
- package/build-module/site-tagline/deprecated.mjs +66 -1
- package/build-module/site-tagline/deprecated.mjs.map +2 -2
- package/build-module/site-tagline/edit.mjs +14 -29
- package/build-module/site-tagline/edit.mjs.map +2 -2
- package/build-module/site-title/block.json +1 -3
- package/build-module/site-title/deprecated.mjs +79 -1
- package/build-module/site-title/deprecated.mjs.map +2 -2
- package/build-module/site-title/edit.mjs +14 -31
- package/build-module/site-title/edit.mjs.map +2 -2
- package/build-module/tabs-menu-item/block.json +1 -26
- package/build-module/tabs-menu-item/controls.mjs +3 -104
- package/build-module/tabs-menu-item/controls.mjs.map +2 -2
- package/build-module/tabs-menu-item/edit.mjs +6 -66
- package/build-module/tabs-menu-item/edit.mjs.map +2 -2
- package/build-module/tabs-menu-item/save.mjs +1 -15
- package/build-module/tabs-menu-item/save.mjs.map +2 -2
- package/build-style/editor-rtl.css +10 -5
- package/build-style/editor.css +10 -5
- package/build-style/navigation-link/editor-rtl.css +10 -0
- package/build-style/navigation-link/editor.css +10 -0
- package/build-style/style-rtl.css +3 -12
- package/build-style/style.css +3 -12
- package/build-style/tabs-menu-item/editor-rtl.css +0 -5
- package/build-style/tabs-menu-item/editor.css +0 -5
- package/build-style/tabs-menu-item/style-rtl.css +3 -12
- package/build-style/tabs-menu-item/style.css +3 -12
- package/package.json +38 -38
- package/src/accordion/view.js +1 -44
- package/src/accordion-item/index.php +0 -1
- package/src/cover/index.php +4 -4
- package/src/icon/block.json +9 -1
- package/src/icon/components/custom-inserter/icon-grid.js +1 -1
- package/src/icon/components/custom-inserter/index.js +1 -1
- package/src/icon/edit.js +20 -10
- package/src/icon/index.php +1 -3
- package/src/image/edit.js +1 -1
- package/src/image/index.php +1 -4
- package/src/navigation/edit/index.js +4 -2
- package/src/navigation/edit/leaf-more-menu.js +86 -11
- package/src/navigation/edit/menu-inspector-controls.js +23 -142
- package/src/navigation/edit/navigation-link-ui.js +115 -0
- package/src/navigation/edit/navigation-list-view-header.js +62 -0
- package/src/navigation/edit/navigation-menu-selector.js +5 -3
- package/src/navigation/edit/placeholder/index.js +3 -2
- package/src/navigation/edit/test/navigation-menu-selector.js +23 -20
- package/src/navigation-link/editor.scss +18 -0
- package/src/navigation-link/shared/controls.js +35 -62
- package/src/navigation-link/shared/test/controls.js +5 -5
- package/src/navigation-link/shared/test/use-link-preview.test.js +10 -1
- package/src/navigation-link/shared/use-link-preview.js +13 -11
- package/src/navigation-overlay-close/edit.js +4 -3
- package/src/page-list/index.php +1 -1
- package/src/page-list-item/edit.js +8 -7
- package/src/post-featured-image/index.php +2 -4
- package/src/post-navigation-link/block.json +1 -3
- package/src/post-navigation-link/deprecated.js +72 -0
- package/src/post-navigation-link/edit.js +2 -35
- package/src/post-navigation-link/index.js +2 -0
- package/src/post-title/block.json +1 -3
- package/src/post-title/deprecated.js +86 -1
- package/src/post-title/edit.js +2 -18
- package/src/pullquote/deprecated.js +3 -3
- package/src/query/block.json +1 -2
- package/src/query-title/block.json +1 -3
- package/src/query-title/deprecated.js +74 -1
- package/src/query-title/edit.js +11 -27
- package/src/query-title/index.php +1 -1
- package/src/site-tagline/block.json +6 -4
- package/src/site-tagline/deprecated.js +70 -1
- package/src/site-tagline/edit.js +9 -22
- package/src/site-title/block.json +1 -3
- package/src/site-title/deprecated.js +83 -1
- package/src/site-title/edit.js +9 -22
- package/src/tabs-menu-item/block.json +1 -26
- package/src/tabs-menu-item/controls.js +0 -108
- package/src/tabs-menu-item/edit.js +6 -79
- package/src/tabs-menu-item/editor.scss +0 -6
- package/src/tabs-menu-item/save.js +1 -26
- package/src/tabs-menu-item/style.scss +3 -14
- package/build/navigation/use-navigation-entities.cjs +0 -67
- package/build/navigation/use-navigation-entities.cjs.map +0 -7
- package/build-module/navigation/use-navigation-entities.mjs +0 -46
- package/build-module/navigation/use-navigation-entities.mjs.map +0 -7
- package/src/navigation/use-navigation-entities.js +0 -72
|
@@ -9,7 +9,6 @@ import clsx from 'clsx';
|
|
|
9
9
|
import { __, sprintf } from '@wordpress/i18n';
|
|
10
10
|
import {
|
|
11
11
|
useBlockProps,
|
|
12
|
-
withColors,
|
|
13
12
|
store as blockEditorStore,
|
|
14
13
|
RichText,
|
|
15
14
|
} from '@wordpress/block-editor';
|
|
@@ -22,19 +21,9 @@ import { useCallback, useMemo } from '@wordpress/element';
|
|
|
22
21
|
import slugFromLabel from '../tab/slug-from-label';
|
|
23
22
|
import Controls from './controls';
|
|
24
23
|
|
|
25
|
-
function Edit( {
|
|
26
|
-
attributes,
|
|
27
|
-
setAttributes,
|
|
24
|
+
export default function Edit( {
|
|
28
25
|
context,
|
|
29
26
|
clientId,
|
|
30
|
-
activeBackgroundColor,
|
|
31
|
-
setActiveBackgroundColor,
|
|
32
|
-
activeTextColor,
|
|
33
|
-
setActiveTextColor,
|
|
34
|
-
hoverBackgroundColor,
|
|
35
|
-
setHoverBackgroundColor,
|
|
36
|
-
hoverTextColor,
|
|
37
|
-
setHoverTextColor,
|
|
38
27
|
__unstableLayoutClassNames: layoutClassNames,
|
|
39
28
|
} ) {
|
|
40
29
|
// Context from tabs-menu (per-item context via BlockContextProvider)
|
|
@@ -138,47 +127,6 @@ function Edit( {
|
|
|
138
127
|
]
|
|
139
128
|
);
|
|
140
129
|
|
|
141
|
-
// Build CSS custom properties for active/hover color states
|
|
142
|
-
const customColorStyles = useMemo( () => {
|
|
143
|
-
const styles = {};
|
|
144
|
-
|
|
145
|
-
// Active/hover colors from custom attributes
|
|
146
|
-
const activeBg =
|
|
147
|
-
activeBackgroundColor?.color ||
|
|
148
|
-
attributes.customActiveBackgroundColor;
|
|
149
|
-
const activeText =
|
|
150
|
-
activeTextColor?.color || attributes.customActiveTextColor;
|
|
151
|
-
const hoverBg =
|
|
152
|
-
hoverBackgroundColor?.color ||
|
|
153
|
-
attributes.customHoverBackgroundColor;
|
|
154
|
-
const hoverText =
|
|
155
|
-
hoverTextColor?.color || attributes.customHoverTextColor;
|
|
156
|
-
|
|
157
|
-
if ( activeBg ) {
|
|
158
|
-
styles[ '--custom-tab-active-color' ] = activeBg;
|
|
159
|
-
}
|
|
160
|
-
if ( activeText ) {
|
|
161
|
-
styles[ '--custom-tab-active-text-color' ] = activeText;
|
|
162
|
-
}
|
|
163
|
-
if ( hoverBg ) {
|
|
164
|
-
styles[ '--custom-tab-hover-color' ] = hoverBg;
|
|
165
|
-
}
|
|
166
|
-
if ( hoverText ) {
|
|
167
|
-
styles[ '--custom-tab-hover-text-color' ] = hoverText;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return styles;
|
|
171
|
-
}, [
|
|
172
|
-
activeBackgroundColor?.color,
|
|
173
|
-
attributes.customActiveBackgroundColor,
|
|
174
|
-
activeTextColor?.color,
|
|
175
|
-
attributes.customActiveTextColor,
|
|
176
|
-
hoverBackgroundColor?.color,
|
|
177
|
-
attributes.customHoverBackgroundColor,
|
|
178
|
-
hoverTextColor?.color,
|
|
179
|
-
attributes.customHoverTextColor,
|
|
180
|
-
] );
|
|
181
|
-
|
|
182
130
|
const tabPanelId = tabId || `tab-${ tabIndex }`;
|
|
183
131
|
const tabLabelId = `${ tabPanelId }--tab`;
|
|
184
132
|
|
|
@@ -188,7 +136,6 @@ function Edit( {
|
|
|
188
136
|
'is-active': isActiveTab,
|
|
189
137
|
'is-selected': isSelectedTab,
|
|
190
138
|
} ),
|
|
191
|
-
style: customColorStyles,
|
|
192
139
|
'aria-controls': tabPanelId,
|
|
193
140
|
'aria-selected': isActiveTab,
|
|
194
141
|
id: tabLabelId,
|
|
@@ -200,24 +147,11 @@ function Edit( {
|
|
|
200
147
|
return (
|
|
201
148
|
<>
|
|
202
149
|
<Controls
|
|
203
|
-
{
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
tabClientId,
|
|
209
|
-
tabIndex,
|
|
210
|
-
tabsCount: tabsList.length,
|
|
211
|
-
tabsMenuClientId,
|
|
212
|
-
activeBackgroundColor,
|
|
213
|
-
setActiveBackgroundColor,
|
|
214
|
-
activeTextColor,
|
|
215
|
-
setActiveTextColor,
|
|
216
|
-
hoverBackgroundColor,
|
|
217
|
-
setHoverBackgroundColor,
|
|
218
|
-
hoverTextColor,
|
|
219
|
-
setHoverTextColor,
|
|
220
|
-
} }
|
|
150
|
+
tabsClientId={ tabsClientId }
|
|
151
|
+
tabClientId={ tabClientId }
|
|
152
|
+
tabIndex={ tabIndex }
|
|
153
|
+
tabsCount={ tabsList.length }
|
|
154
|
+
tabsMenuClientId={ tabsMenuClientId }
|
|
221
155
|
/>
|
|
222
156
|
<div { ...blockProps }>
|
|
223
157
|
<RichText
|
|
@@ -235,10 +169,3 @@ function Edit( {
|
|
|
235
169
|
</>
|
|
236
170
|
);
|
|
237
171
|
}
|
|
238
|
-
|
|
239
|
-
export default withColors(
|
|
240
|
-
'activeBackgroundColor',
|
|
241
|
-
'activeTextColor',
|
|
242
|
-
'hoverBackgroundColor',
|
|
243
|
-
'hoverTextColor'
|
|
244
|
-
)( Edit );
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
.wp-block-tabs-menu-item {
|
|
2
2
|
&.is-selected {
|
|
3
|
-
outline: 2px solid var(--wp-admin-theme-color, #007cba);
|
|
4
3
|
outline-offset: 2px;
|
|
5
4
|
}
|
|
6
5
|
}
|
|
@@ -12,9 +11,4 @@
|
|
|
12
11
|
.wp-block-tabs-menu-item {
|
|
13
12
|
flex-basis: 100% !important;
|
|
14
13
|
}
|
|
15
|
-
|
|
16
|
-
&:hover > .wp-block-tabs-menu-item {
|
|
17
|
-
background-color: var(--custom-tab-hover-color, #eaeaea) !important;
|
|
18
|
-
color: var(--custom-tab-hover-text-color, #000) !important;
|
|
19
|
-
}
|
|
20
14
|
}
|
|
@@ -3,34 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useBlockProps } from '@wordpress/block-editor';
|
|
5
5
|
|
|
6
|
-
export default function save(
|
|
7
|
-
// Build CSS custom properties for active/hover colors
|
|
8
|
-
const customColorStyles = {};
|
|
9
|
-
|
|
10
|
-
// Active/hover colors from custom attributes
|
|
11
|
-
if ( attributes.customActiveBackgroundColor ) {
|
|
12
|
-
customColorStyles[ '--custom-tab-active-color' ] =
|
|
13
|
-
attributes.customActiveBackgroundColor;
|
|
14
|
-
}
|
|
15
|
-
if ( attributes.customActiveTextColor ) {
|
|
16
|
-
customColorStyles[ '--custom-tab-active-text-color' ] =
|
|
17
|
-
attributes.customActiveTextColor;
|
|
18
|
-
}
|
|
19
|
-
if ( attributes.customHoverBackgroundColor ) {
|
|
20
|
-
customColorStyles[ '--custom-tab-hover-color' ] =
|
|
21
|
-
attributes.customHoverBackgroundColor;
|
|
22
|
-
}
|
|
23
|
-
if ( attributes.customHoverTextColor ) {
|
|
24
|
-
customColorStyles[ '--custom-tab-hover-text-color' ] =
|
|
25
|
-
attributes.customHoverTextColor;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// useBlockProps.save includes all core style engine classes and styles
|
|
29
|
-
// The button content is replaced by PHP during rendering, so we output
|
|
30
|
-
// an empty button as a template.
|
|
6
|
+
export default function save() {
|
|
31
7
|
const blockProps = useBlockProps.save( {
|
|
32
8
|
className: 'wp-block-tabs-menu-item__template',
|
|
33
|
-
style: customColorStyles,
|
|
34
9
|
type: 'button',
|
|
35
10
|
role: 'tab',
|
|
36
11
|
} );
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
-webkit-appearance: none;
|
|
16
16
|
|
|
17
17
|
margin: 0;
|
|
18
|
-
padding
|
|
19
|
-
padding-inline: var(--tab-padding-inline, var(--wp--preset--spacing--30, 1em));
|
|
18
|
+
padding: var(--wp--preset--spacing--20, 0.5em) var(--wp--preset--spacing--30, 1em);
|
|
20
19
|
|
|
21
20
|
// Inherit typography from parent
|
|
22
21
|
font-size: inherit;
|
|
@@ -27,23 +26,13 @@
|
|
|
27
26
|
text-transform: inherit;
|
|
28
27
|
text-align: inherit;
|
|
29
28
|
|
|
30
|
-
&:focus {
|
|
31
|
-
outline: none;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
29
|
&:focus-visible {
|
|
35
|
-
outline: 2px solid var(--tab-border-color-active, #000);
|
|
36
30
|
outline-offset: 2px;
|
|
37
31
|
}
|
|
38
32
|
|
|
39
|
-
&:hover {
|
|
40
|
-
background-color: var(--custom-tab-hover-color, #eaeaea) !important;
|
|
41
|
-
color: var(--custom-tab-hover-text-color, #000) !important;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
33
|
&[aria-selected="true"],
|
|
45
34
|
&.is-active {
|
|
46
|
-
background-color:
|
|
47
|
-
color:
|
|
35
|
+
background-color: #000;
|
|
36
|
+
color: #fff;
|
|
48
37
|
}
|
|
49
38
|
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/block-library/src/navigation/use-navigation-entities.js
|
|
21
|
-
var use_navigation_entities_exports = {};
|
|
22
|
-
__export(use_navigation_entities_exports, {
|
|
23
|
-
default: () => useNavigationEntities
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(use_navigation_entities_exports);
|
|
26
|
-
var import_core_data = require("@wordpress/core-data");
|
|
27
|
-
function useNavigationEntities(menuId) {
|
|
28
|
-
const {
|
|
29
|
-
records: menus,
|
|
30
|
-
isResolving: isResolvingMenus,
|
|
31
|
-
hasResolved: hasResolvedMenus
|
|
32
|
-
} = (0, import_core_data.useEntityRecords)("root", "menu", { per_page: -1, context: "view" });
|
|
33
|
-
const {
|
|
34
|
-
records: pages,
|
|
35
|
-
isResolving: isResolvingPages,
|
|
36
|
-
hasResolved: hasResolvedPages
|
|
37
|
-
} = (0, import_core_data.useEntityRecords)("postType", "page", {
|
|
38
|
-
parent: 0,
|
|
39
|
-
order: "asc",
|
|
40
|
-
orderby: "id",
|
|
41
|
-
per_page: -1,
|
|
42
|
-
context: "view"
|
|
43
|
-
});
|
|
44
|
-
const { records: menuItems, hasResolved: hasResolvedMenuItems } = (0, import_core_data.useEntityRecords)(
|
|
45
|
-
"root",
|
|
46
|
-
"menuItem",
|
|
47
|
-
{
|
|
48
|
-
menus: menuId,
|
|
49
|
-
per_page: -1,
|
|
50
|
-
context: "view"
|
|
51
|
-
},
|
|
52
|
-
{ enabled: !!menuId }
|
|
53
|
-
);
|
|
54
|
-
return {
|
|
55
|
-
pages,
|
|
56
|
-
isResolvingPages,
|
|
57
|
-
hasResolvedPages,
|
|
58
|
-
hasPages: !!(hasResolvedPages && pages?.length),
|
|
59
|
-
menus,
|
|
60
|
-
isResolvingMenus,
|
|
61
|
-
hasResolvedMenus,
|
|
62
|
-
hasMenus: !!(hasResolvedMenus && menus?.length),
|
|
63
|
-
menuItems,
|
|
64
|
-
hasResolvedMenuItems
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=use-navigation-entities.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/navigation/use-navigation-entities.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\n\n/**\n * @typedef {Object} NavigationEntitiesData\n * @property {Array|undefined} pages - a collection of WP Post entity objects of post type \"Page\".\n * @property {boolean} isResolvingPages - indicates whether the request to fetch pages is currently resolving.\n * @property {boolean} hasResolvedPages - indicates whether the request to fetch pages has finished resolving.\n * @property {Array|undefined} menus - a collection of Menu entity objects.\n * @property {boolean} isResolvingMenus - indicates whether the request to fetch menus is currently resolving.\n * @property {boolean} hasResolvedMenus - indicates whether the request to fetch menus has finished resolving.\n * @property {Array|undefined} menusItems - a collection of Menu Item entity objects for the current menuId.\n * @property {boolean} hasResolvedMenuItems - indicates whether the request to fetch menuItems has finished resolving.\n * @property {boolean} hasPages - indicates whether there is currently any data for pages.\n * @property {boolean} hasMenus - indicates whether there is currently any data for menus.\n */\n\n/**\n * Manages fetching and resolution state for all entities required\n * for the Navigation block.\n *\n * @param {number} menuId the menu for which to retrieve menuItem data.\n * @return { NavigationEntitiesData } the entity data.\n */\nexport default function useNavigationEntities( menuId ) {\n\tconst {\n\t\trecords: menus,\n\t\tisResolving: isResolvingMenus,\n\t\thasResolved: hasResolvedMenus,\n\t} = useEntityRecords( 'root', 'menu', { per_page: -1, context: 'view' } );\n\n\tconst {\n\t\trecords: pages,\n\t\tisResolving: isResolvingPages,\n\t\thasResolved: hasResolvedPages,\n\t} = useEntityRecords( 'postType', 'page', {\n\t\tparent: 0,\n\t\torder: 'asc',\n\t\torderby: 'id',\n\t\tper_page: -1,\n\t\tcontext: 'view',\n\t} );\n\n\tconst { records: menuItems, hasResolved: hasResolvedMenuItems } =\n\t\tuseEntityRecords(\n\t\t\t'root',\n\t\t\t'menuItem',\n\t\t\t{\n\t\t\t\tmenus: menuId,\n\t\t\t\tper_page: -1,\n\t\t\t\tcontext: 'view',\n\t\t\t},\n\t\t\t{ enabled: !! menuId }\n\t\t);\n\n\treturn {\n\t\tpages,\n\t\tisResolvingPages,\n\t\thasResolvedPages,\n\t\thasPages: !! ( hasResolvedPages && pages?.length ),\n\n\t\tmenus,\n\t\tisResolvingMenus,\n\t\thasResolvedMenus,\n\t\thasMenus: !! ( hasResolvedMenus && menus?.length ),\n\n\t\tmenuItems,\n\t\thasResolvedMenuItems,\n\t};\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAiC;AAuBlB,SAAR,sBAAwC,QAAS;AACvD,QAAM;AAAA,IACL,SAAS;AAAA,IACT,aAAa;AAAA,IACb,aAAa;AAAA,EACd,QAAI,mCAAkB,QAAQ,QAAQ,EAAE,UAAU,IAAI,SAAS,OAAO,CAAE;AAExE,QAAM;AAAA,IACL,SAAS;AAAA,IACT,aAAa;AAAA,IACb,aAAa;AAAA,EACd,QAAI,mCAAkB,YAAY,QAAQ;AAAA,IACzC,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA,IACV,SAAS;AAAA,EACV,CAAE;AAEF,QAAM,EAAE,SAAS,WAAW,aAAa,qBAAqB,QAC7D;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,MACC,OAAO;AAAA,MACP,UAAU;AAAA,MACV,SAAS;AAAA,IACV;AAAA,IACA,EAAE,SAAS,CAAC,CAAE,OAAO;AAAA,EACtB;AAED,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,CAAC,EAAI,oBAAoB,OAAO;AAAA,IAE1C;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,CAAC,EAAI,oBAAoB,OAAO;AAAA,IAE1C;AAAA,IACA;AAAA,EACD;AACD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// packages/block-library/src/navigation/use-navigation-entities.js
|
|
2
|
-
import { useEntityRecords } from "@wordpress/core-data";
|
|
3
|
-
function useNavigationEntities(menuId) {
|
|
4
|
-
const {
|
|
5
|
-
records: menus,
|
|
6
|
-
isResolving: isResolvingMenus,
|
|
7
|
-
hasResolved: hasResolvedMenus
|
|
8
|
-
} = useEntityRecords("root", "menu", { per_page: -1, context: "view" });
|
|
9
|
-
const {
|
|
10
|
-
records: pages,
|
|
11
|
-
isResolving: isResolvingPages,
|
|
12
|
-
hasResolved: hasResolvedPages
|
|
13
|
-
} = useEntityRecords("postType", "page", {
|
|
14
|
-
parent: 0,
|
|
15
|
-
order: "asc",
|
|
16
|
-
orderby: "id",
|
|
17
|
-
per_page: -1,
|
|
18
|
-
context: "view"
|
|
19
|
-
});
|
|
20
|
-
const { records: menuItems, hasResolved: hasResolvedMenuItems } = useEntityRecords(
|
|
21
|
-
"root",
|
|
22
|
-
"menuItem",
|
|
23
|
-
{
|
|
24
|
-
menus: menuId,
|
|
25
|
-
per_page: -1,
|
|
26
|
-
context: "view"
|
|
27
|
-
},
|
|
28
|
-
{ enabled: !!menuId }
|
|
29
|
-
);
|
|
30
|
-
return {
|
|
31
|
-
pages,
|
|
32
|
-
isResolvingPages,
|
|
33
|
-
hasResolvedPages,
|
|
34
|
-
hasPages: !!(hasResolvedPages && pages?.length),
|
|
35
|
-
menus,
|
|
36
|
-
isResolvingMenus,
|
|
37
|
-
hasResolvedMenus,
|
|
38
|
-
hasMenus: !!(hasResolvedMenus && menus?.length),
|
|
39
|
-
menuItems,
|
|
40
|
-
hasResolvedMenuItems
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
export {
|
|
44
|
-
useNavigationEntities as default
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=use-navigation-entities.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/navigation/use-navigation-entities.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\n\n/**\n * @typedef {Object} NavigationEntitiesData\n * @property {Array|undefined} pages - a collection of WP Post entity objects of post type \"Page\".\n * @property {boolean} isResolvingPages - indicates whether the request to fetch pages is currently resolving.\n * @property {boolean} hasResolvedPages - indicates whether the request to fetch pages has finished resolving.\n * @property {Array|undefined} menus - a collection of Menu entity objects.\n * @property {boolean} isResolvingMenus - indicates whether the request to fetch menus is currently resolving.\n * @property {boolean} hasResolvedMenus - indicates whether the request to fetch menus has finished resolving.\n * @property {Array|undefined} menusItems - a collection of Menu Item entity objects for the current menuId.\n * @property {boolean} hasResolvedMenuItems - indicates whether the request to fetch menuItems has finished resolving.\n * @property {boolean} hasPages - indicates whether there is currently any data for pages.\n * @property {boolean} hasMenus - indicates whether there is currently any data for menus.\n */\n\n/**\n * Manages fetching and resolution state for all entities required\n * for the Navigation block.\n *\n * @param {number} menuId the menu for which to retrieve menuItem data.\n * @return { NavigationEntitiesData } the entity data.\n */\nexport default function useNavigationEntities( menuId ) {\n\tconst {\n\t\trecords: menus,\n\t\tisResolving: isResolvingMenus,\n\t\thasResolved: hasResolvedMenus,\n\t} = useEntityRecords( 'root', 'menu', { per_page: -1, context: 'view' } );\n\n\tconst {\n\t\trecords: pages,\n\t\tisResolving: isResolvingPages,\n\t\thasResolved: hasResolvedPages,\n\t} = useEntityRecords( 'postType', 'page', {\n\t\tparent: 0,\n\t\torder: 'asc',\n\t\torderby: 'id',\n\t\tper_page: -1,\n\t\tcontext: 'view',\n\t} );\n\n\tconst { records: menuItems, hasResolved: hasResolvedMenuItems } =\n\t\tuseEntityRecords(\n\t\t\t'root',\n\t\t\t'menuItem',\n\t\t\t{\n\t\t\t\tmenus: menuId,\n\t\t\t\tper_page: -1,\n\t\t\t\tcontext: 'view',\n\t\t\t},\n\t\t\t{ enabled: !! menuId }\n\t\t);\n\n\treturn {\n\t\tpages,\n\t\tisResolvingPages,\n\t\thasResolvedPages,\n\t\thasPages: !! ( hasResolvedPages && pages?.length ),\n\n\t\tmenus,\n\t\tisResolvingMenus,\n\t\thasResolvedMenus,\n\t\thasMenus: !! ( hasResolvedMenus && menus?.length ),\n\n\t\tmenuItems,\n\t\thasResolvedMenuItems,\n\t};\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,wBAAwB;AAuBlB,SAAR,sBAAwC,QAAS;AACvD,QAAM;AAAA,IACL,SAAS;AAAA,IACT,aAAa;AAAA,IACb,aAAa;AAAA,EACd,IAAI,iBAAkB,QAAQ,QAAQ,EAAE,UAAU,IAAI,SAAS,OAAO,CAAE;AAExE,QAAM;AAAA,IACL,SAAS;AAAA,IACT,aAAa;AAAA,IACb,aAAa;AAAA,EACd,IAAI,iBAAkB,YAAY,QAAQ;AAAA,IACzC,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA,IACV,SAAS;AAAA,EACV,CAAE;AAEF,QAAM,EAAE,SAAS,WAAW,aAAa,qBAAqB,IAC7D;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,MACC,OAAO;AAAA,MACP,UAAU;AAAA,MACV,SAAS;AAAA,IACV;AAAA,IACA,EAAE,SAAS,CAAC,CAAE,OAAO;AAAA,EACtB;AAED,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,CAAC,EAAI,oBAAoB,OAAO;AAAA,IAE1C;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,CAAC,EAAI,oBAAoB,OAAO;AAAA,IAE1C;AAAA,IACA;AAAA,EACD;AACD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useEntityRecords } from '@wordpress/core-data';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @typedef {Object} NavigationEntitiesData
|
|
8
|
-
* @property {Array|undefined} pages - a collection of WP Post entity objects of post type "Page".
|
|
9
|
-
* @property {boolean} isResolvingPages - indicates whether the request to fetch pages is currently resolving.
|
|
10
|
-
* @property {boolean} hasResolvedPages - indicates whether the request to fetch pages has finished resolving.
|
|
11
|
-
* @property {Array|undefined} menus - a collection of Menu entity objects.
|
|
12
|
-
* @property {boolean} isResolvingMenus - indicates whether the request to fetch menus is currently resolving.
|
|
13
|
-
* @property {boolean} hasResolvedMenus - indicates whether the request to fetch menus has finished resolving.
|
|
14
|
-
* @property {Array|undefined} menusItems - a collection of Menu Item entity objects for the current menuId.
|
|
15
|
-
* @property {boolean} hasResolvedMenuItems - indicates whether the request to fetch menuItems has finished resolving.
|
|
16
|
-
* @property {boolean} hasPages - indicates whether there is currently any data for pages.
|
|
17
|
-
* @property {boolean} hasMenus - indicates whether there is currently any data for menus.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Manages fetching and resolution state for all entities required
|
|
22
|
-
* for the Navigation block.
|
|
23
|
-
*
|
|
24
|
-
* @param {number} menuId the menu for which to retrieve menuItem data.
|
|
25
|
-
* @return { NavigationEntitiesData } the entity data.
|
|
26
|
-
*/
|
|
27
|
-
export default function useNavigationEntities( menuId ) {
|
|
28
|
-
const {
|
|
29
|
-
records: menus,
|
|
30
|
-
isResolving: isResolvingMenus,
|
|
31
|
-
hasResolved: hasResolvedMenus,
|
|
32
|
-
} = useEntityRecords( 'root', 'menu', { per_page: -1, context: 'view' } );
|
|
33
|
-
|
|
34
|
-
const {
|
|
35
|
-
records: pages,
|
|
36
|
-
isResolving: isResolvingPages,
|
|
37
|
-
hasResolved: hasResolvedPages,
|
|
38
|
-
} = useEntityRecords( 'postType', 'page', {
|
|
39
|
-
parent: 0,
|
|
40
|
-
order: 'asc',
|
|
41
|
-
orderby: 'id',
|
|
42
|
-
per_page: -1,
|
|
43
|
-
context: 'view',
|
|
44
|
-
} );
|
|
45
|
-
|
|
46
|
-
const { records: menuItems, hasResolved: hasResolvedMenuItems } =
|
|
47
|
-
useEntityRecords(
|
|
48
|
-
'root',
|
|
49
|
-
'menuItem',
|
|
50
|
-
{
|
|
51
|
-
menus: menuId,
|
|
52
|
-
per_page: -1,
|
|
53
|
-
context: 'view',
|
|
54
|
-
},
|
|
55
|
-
{ enabled: !! menuId }
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
pages,
|
|
60
|
-
isResolvingPages,
|
|
61
|
-
hasResolvedPages,
|
|
62
|
-
hasPages: !! ( hasResolvedPages && pages?.length ),
|
|
63
|
-
|
|
64
|
-
menus,
|
|
65
|
-
isResolvingMenus,
|
|
66
|
-
hasResolvedMenus,
|
|
67
|
-
hasMenus: !! ( hasResolvedMenus && menus?.length ),
|
|
68
|
-
|
|
69
|
-
menuItems,
|
|
70
|
-
hasResolvedMenuItems,
|
|
71
|
-
};
|
|
72
|
-
}
|