@wordpress/block-library 9.30.1-next.6870dfe5b.0 → 9.30.1-next.6f42e1382.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/buttons/index.js +2 -1
- package/build/buttons/index.js.map +1 -1
- package/build/categories/edit.js +3 -1
- package/build/categories/edit.js.map +1 -1
- package/build/index.js +4 -0
- package/build/index.js.map +1 -1
- package/build/social-links/index.js +2 -1
- package/build/social-links/index.js.map +1 -1
- package/build/table-of-contents/edit.js +33 -9
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/index.js +4 -0
- package/build/table-of-contents/index.js.map +1 -1
- package/build/table-of-contents/list.js +6 -3
- package/build/table-of-contents/list.js.map +1 -1
- package/build/table-of-contents/save.js +6 -3
- package/build/table-of-contents/save.js.map +1 -1
- package/build/term-template/edit.js +318 -0
- package/build/term-template/edit.js.map +1 -0
- package/build/term-template/index.js +109 -0
- package/build/term-template/index.js.map +1 -0
- package/build/term-template/save.js +16 -0
- package/build/term-template/save.js.map +1 -0
- package/build/term-template/variations.js +83 -0
- package/build/term-template/variations.js.map +1 -0
- package/build/terms-query/edit.js +20 -0
- package/build/terms-query/edit.js.map +1 -0
- package/build/terms-query/index.js +83 -0
- package/build/terms-query/index.js.map +1 -0
- package/build/terms-query/inspector-controls.js +246 -0
- package/build/terms-query/inspector-controls.js.map +1 -0
- package/build/terms-query/save.js +24 -0
- package/build/terms-query/save.js.map +1 -0
- package/build/terms-query/terms-query-content.js +71 -0
- package/build/terms-query/terms-query-content.js.map +1 -0
- package/build-module/buttons/index.js +2 -1
- package/build-module/buttons/index.js.map +1 -1
- package/build-module/categories/edit.js +3 -1
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/index.js +4 -0
- package/build-module/index.js.map +1 -1
- package/build-module/social-links/index.js +2 -1
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/table-of-contents/edit.js +35 -11
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/index.js +4 -0
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-module/table-of-contents/list.js +6 -3
- package/build-module/table-of-contents/list.js.map +1 -1
- package/build-module/table-of-contents/save.js +6 -3
- package/build-module/table-of-contents/save.js.map +1 -1
- package/build-module/term-template/edit.js +310 -0
- package/build-module/term-template/edit.js.map +1 -0
- package/build-module/term-template/index.js +102 -0
- package/build-module/term-template/index.js.map +1 -0
- package/build-module/term-template/save.js +9 -0
- package/build-module/term-template/save.js.map +1 -0
- package/build-module/term-template/variations.js +76 -0
- package/build-module/term-template/variations.js.map +1 -0
- package/build-module/terms-query/edit.js +12 -0
- package/build-module/terms-query/edit.js.map +1 -0
- package/build-module/terms-query/index.js +76 -0
- package/build-module/terms-query/index.js.map +1 -0
- package/build-module/terms-query/inspector-controls.js +239 -0
- package/build-module/terms-query/inspector-controls.js.map +1 -0
- package/build-module/terms-query/save.js +17 -0
- package/build-module/terms-query/save.js.map +1 -0
- package/build-module/terms-query/terms-query-content.js +63 -0
- package/build-module/terms-query/terms-query-content.js.map +1 -0
- package/build-style/editor-rtl.css +24 -0
- package/build-style/editor.css +24 -0
- package/build-style/style-rtl.css +16 -0
- package/build-style/style.css +16 -0
- package/build-style/term-template/editor-rtl.css +160 -0
- package/build-style/term-template/editor.css +160 -0
- package/build-style/term-template/style-rtl.css +146 -0
- package/build-style/term-template/style.css +146 -0
- package/build-style/terms-query/style-rtl.css +140 -0
- package/build-style/terms-query/style.css +140 -0
- package/build-types/table-of-contents/list.d.ts +2 -1
- package/build-types/table-of-contents/list.d.ts.map +1 -1
- package/package.json +35 -35
- package/src/buttons/block.json +2 -1
- package/src/categories/edit.js +2 -1
- package/src/editor.scss +1 -0
- package/src/index.js +4 -0
- package/src/post-date/index.php +18 -13
- package/src/social-links/block.json +2 -1
- package/src/style.scss +2 -0
- package/src/table-of-contents/block.json +4 -0
- package/src/table-of-contents/edit.js +58 -21
- package/src/table-of-contents/list.tsx +7 -2
- package/src/table-of-contents/save.js +7 -3
- package/src/term-template/block.json +73 -0
- package/src/term-template/edit.js +391 -0
- package/src/term-template/editor.scss +26 -0
- package/src/term-template/index.js +26 -0
- package/src/term-template/index.php +224 -0
- package/src/term-template/save.js +8 -0
- package/src/term-template/style.scss +12 -0
- package/src/term-template/variations.js +87 -0
- package/src/terms-query/block.json +49 -0
- package/src/terms-query/edit.js +10 -0
- package/src/terms-query/index.js +24 -0
- package/src/terms-query/index.php +44 -0
- package/src/terms-query/inspector-controls.js +233 -0
- package/src/terms-query/save.js +10 -0
- package/src/terms-query/style.scss +6 -0
- package/src/terms-query/terms-query-content.js +74 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, RangeControl, SelectControl, ToggleControl } from '@wordpress/components';
|
|
6
|
+
import { InspectorControls, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
7
|
+
import { useSelect } from '@wordpress/data';
|
|
8
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
14
|
+
import { unlock } from '../lock-unlock';
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
16
|
+
const {
|
|
17
|
+
HTMLElementControl
|
|
18
|
+
} = unlock(blockEditorPrivateApis);
|
|
19
|
+
export default function TermsQueryInspectorControls({
|
|
20
|
+
attributes,
|
|
21
|
+
setQuery,
|
|
22
|
+
setAttributes,
|
|
23
|
+
TagName,
|
|
24
|
+
clientId
|
|
25
|
+
}) {
|
|
26
|
+
const {
|
|
27
|
+
termQuery
|
|
28
|
+
} = attributes;
|
|
29
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
30
|
+
const {
|
|
31
|
+
taxonomies
|
|
32
|
+
} = useSelect(select => {
|
|
33
|
+
const {
|
|
34
|
+
getEntityRecords
|
|
35
|
+
} = select(coreStore);
|
|
36
|
+
const allTaxonomies = getEntityRecords('root', 'taxonomy');
|
|
37
|
+
return {
|
|
38
|
+
taxonomies: allTaxonomies?.filter(t => t.visibility.public) || []
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
const taxonomyOptions = taxonomies.map(taxonomy => ({
|
|
42
|
+
label: taxonomy.name,
|
|
43
|
+
value: taxonomy.slug
|
|
44
|
+
}));
|
|
45
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
46
|
+
children: [/*#__PURE__*/_jsx(InspectorControls, {
|
|
47
|
+
children: /*#__PURE__*/_jsxs(ToolsPanel, {
|
|
48
|
+
label: __('Terms Query Settings'),
|
|
49
|
+
resetAll: () => {
|
|
50
|
+
setAttributes({
|
|
51
|
+
termQuery: {
|
|
52
|
+
taxonomy: 'category',
|
|
53
|
+
order: 'asc',
|
|
54
|
+
orderBy: 'name',
|
|
55
|
+
hideEmpty: true,
|
|
56
|
+
hierarchical: false,
|
|
57
|
+
parent: 0,
|
|
58
|
+
perPage: 10
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
dropdownMenuProps: dropdownMenuProps,
|
|
63
|
+
children: [/*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
64
|
+
hasValue: () => termQuery.taxonomy !== 'category',
|
|
65
|
+
label: __('Taxonomy'),
|
|
66
|
+
onDeselect: () => setQuery({
|
|
67
|
+
taxonomy: 'category'
|
|
68
|
+
}),
|
|
69
|
+
isShownByDefault: true,
|
|
70
|
+
children: /*#__PURE__*/_jsx(SelectControl, {
|
|
71
|
+
__nextHasNoMarginBottom: true,
|
|
72
|
+
__next40pxDefaultSize: true,
|
|
73
|
+
label: __('Taxonomy'),
|
|
74
|
+
options: taxonomyOptions,
|
|
75
|
+
value: termQuery.taxonomy,
|
|
76
|
+
onChange: selectedTaxonomy => setQuery({
|
|
77
|
+
taxonomy: selectedTaxonomy
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
}), /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
81
|
+
hasValue: () => termQuery.order !== 'asc',
|
|
82
|
+
label: __('Order'),
|
|
83
|
+
onDeselect: () => setQuery({
|
|
84
|
+
order: 'asc'
|
|
85
|
+
}),
|
|
86
|
+
isShownByDefault: true,
|
|
87
|
+
children: /*#__PURE__*/_jsx(SelectControl, {
|
|
88
|
+
__nextHasNoMarginBottom: true,
|
|
89
|
+
__next40pxDefaultSize: true,
|
|
90
|
+
label: __('Order'),
|
|
91
|
+
options: [{
|
|
92
|
+
label: __('Ascending'),
|
|
93
|
+
value: 'asc'
|
|
94
|
+
}, {
|
|
95
|
+
label: __('Descending'),
|
|
96
|
+
value: 'desc'
|
|
97
|
+
}],
|
|
98
|
+
value: termQuery.order,
|
|
99
|
+
onChange: order => setQuery({
|
|
100
|
+
order
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
}), /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
104
|
+
hasValue: () => termQuery.orderBy !== 'name',
|
|
105
|
+
label: __('Order by'),
|
|
106
|
+
onDeselect: () => setQuery({
|
|
107
|
+
orderBy: 'name'
|
|
108
|
+
}),
|
|
109
|
+
isShownByDefault: true,
|
|
110
|
+
children: /*#__PURE__*/_jsx(SelectControl, {
|
|
111
|
+
__nextHasNoMarginBottom: true,
|
|
112
|
+
__next40pxDefaultSize: true,
|
|
113
|
+
label: __('Order by'),
|
|
114
|
+
options: [{
|
|
115
|
+
label: __('Name'),
|
|
116
|
+
value: 'name'
|
|
117
|
+
}, {
|
|
118
|
+
label: __('Slug'),
|
|
119
|
+
value: 'slug'
|
|
120
|
+
}, {
|
|
121
|
+
label: __('Count'),
|
|
122
|
+
value: 'count'
|
|
123
|
+
}],
|
|
124
|
+
value: termQuery.orderBy,
|
|
125
|
+
onChange: orderBy => setQuery({
|
|
126
|
+
orderBy
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
}), /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
130
|
+
hasValue: () => termQuery.parent !== 0,
|
|
131
|
+
label: __('Show only top level terms'),
|
|
132
|
+
onDeselect: () => setQuery({
|
|
133
|
+
parent: 0
|
|
134
|
+
}),
|
|
135
|
+
isShownByDefault: true,
|
|
136
|
+
children: /*#__PURE__*/_jsx(ToggleControl, {
|
|
137
|
+
__nextHasNoMarginBottom: true,
|
|
138
|
+
label: __('Show only top level terms'),
|
|
139
|
+
checked: termQuery.parent === 0,
|
|
140
|
+
onChange: showTopLevel => {
|
|
141
|
+
setQuery({
|
|
142
|
+
parent: showTopLevel ? 0 : undefined
|
|
143
|
+
});
|
|
144
|
+
if (showTopLevel && termQuery.hierarchical) {
|
|
145
|
+
setQuery({
|
|
146
|
+
hierarchical: false
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
disabled: !!termQuery.hierarchical
|
|
151
|
+
})
|
|
152
|
+
}), /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
153
|
+
hasValue: () => termQuery.hideEmpty !== true,
|
|
154
|
+
label: __('Show empty terms'),
|
|
155
|
+
onDeselect: () => setQuery({
|
|
156
|
+
hideEmpty: true
|
|
157
|
+
}),
|
|
158
|
+
isShownByDefault: true,
|
|
159
|
+
children: /*#__PURE__*/_jsx(ToggleControl, {
|
|
160
|
+
__nextHasNoMarginBottom: true,
|
|
161
|
+
label: __('Show empty terms'),
|
|
162
|
+
checked: !termQuery.hideEmpty,
|
|
163
|
+
onChange: showEmpty => setQuery({
|
|
164
|
+
hideEmpty: !showEmpty
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
}), /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
168
|
+
hasValue: () => termQuery.hierarchical !== false,
|
|
169
|
+
label: __('Show hierarchy'),
|
|
170
|
+
onDeselect: () => setQuery({
|
|
171
|
+
hierarchical: false
|
|
172
|
+
}),
|
|
173
|
+
isShownByDefault: true,
|
|
174
|
+
children: /*#__PURE__*/_jsx(ToggleControl, {
|
|
175
|
+
__nextHasNoMarginBottom: true,
|
|
176
|
+
label: __('Show hierarchy'),
|
|
177
|
+
checked: termQuery.hierarchical,
|
|
178
|
+
onChange: hierarchical => {
|
|
179
|
+
setQuery({
|
|
180
|
+
hierarchical
|
|
181
|
+
});
|
|
182
|
+
if (hierarchical && termQuery.parent) {
|
|
183
|
+
setQuery({
|
|
184
|
+
parent: 0
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
disabled: termQuery.parent === 0
|
|
189
|
+
})
|
|
190
|
+
}), !termQuery.hierarchical && /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
191
|
+
hasValue: () => termQuery.perPage !== 10,
|
|
192
|
+
label: __('Max terms'),
|
|
193
|
+
onDeselect: () => setQuery({
|
|
194
|
+
perPage: 10
|
|
195
|
+
}),
|
|
196
|
+
isShownByDefault: true,
|
|
197
|
+
children: /*#__PURE__*/_jsx(RangeControl, {
|
|
198
|
+
__nextHasNoMarginBottom: true,
|
|
199
|
+
__next40pxDefaultSize: true,
|
|
200
|
+
label: __('Max terms'),
|
|
201
|
+
value: termQuery.perPage,
|
|
202
|
+
min: 0,
|
|
203
|
+
max: 100,
|
|
204
|
+
onChange: perPage => {
|
|
205
|
+
// Show all terms (-1) when 0 is selected.
|
|
206
|
+
setQuery({
|
|
207
|
+
perPage: perPage === 0 ? -1 : perPage
|
|
208
|
+
});
|
|
209
|
+
},
|
|
210
|
+
help: __('Limit the number of terms you want to show. To show all terms, use 0 (zero).')
|
|
211
|
+
})
|
|
212
|
+
})]
|
|
213
|
+
})
|
|
214
|
+
}), /*#__PURE__*/_jsx(InspectorControls, {
|
|
215
|
+
group: "advanced",
|
|
216
|
+
children: /*#__PURE__*/_jsx(HTMLElementControl, {
|
|
217
|
+
tagName: TagName,
|
|
218
|
+
onChange: value => setAttributes({
|
|
219
|
+
tagName: value
|
|
220
|
+
}),
|
|
221
|
+
clientId: clientId,
|
|
222
|
+
options: [{
|
|
223
|
+
label: __('Default (<div>)'),
|
|
224
|
+
value: 'div'
|
|
225
|
+
}, {
|
|
226
|
+
label: '<main>',
|
|
227
|
+
value: 'main'
|
|
228
|
+
}, {
|
|
229
|
+
label: '<section>',
|
|
230
|
+
value: 'section'
|
|
231
|
+
}, {
|
|
232
|
+
label: '<aside>',
|
|
233
|
+
value: 'aside'
|
|
234
|
+
}]
|
|
235
|
+
})
|
|
236
|
+
})]
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=inspector-controls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","RangeControl","SelectControl","ToggleControl","InspectorControls","privateApis","blockEditorPrivateApis","useSelect","store","coreStore","useToolsPanelDropdownMenuProps","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","HTMLElementControl","TermsQueryInspectorControls","attributes","setQuery","setAttributes","TagName","clientId","termQuery","dropdownMenuProps","taxonomies","select","getEntityRecords","allTaxonomies","filter","t","visibility","public","taxonomyOptions","map","taxonomy","label","name","value","slug","children","resetAll","order","orderBy","hideEmpty","hierarchical","parent","perPage","hasValue","onDeselect","isShownByDefault","__nextHasNoMarginBottom","__next40pxDefaultSize","options","onChange","selectedTaxonomy","checked","showTopLevel","undefined","disabled","showEmpty","min","max","help","group","tagName"],"sources":["@wordpress/block-library/src/terms-query/inspector-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tRangeControl,\n\tSelectControl,\n\tToggleControl,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport { unlock } from '../lock-unlock';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\nexport default function TermsQueryInspectorControls( {\n\tattributes,\n\tsetQuery,\n\tsetAttributes,\n\tTagName,\n\tclientId,\n} ) {\n\tconst { termQuery } = attributes;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst { taxonomies } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords } = select( coreStore );\n\t\tconst allTaxonomies = getEntityRecords( 'root', 'taxonomy' );\n\t\treturn {\n\t\t\ttaxonomies:\n\t\t\t\tallTaxonomies?.filter( ( t ) => t.visibility.public ) || [],\n\t\t};\n\t}, [] );\n\n\tconst taxonomyOptions = taxonomies.map( ( taxonomy ) => ( {\n\t\tlabel: taxonomy.name,\n\t\tvalue: taxonomy.slug,\n\t} ) );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Terms Query Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\ttermQuery: {\n\t\t\t\t\t\t\t\ttaxonomy: 'category',\n\t\t\t\t\t\t\t\torder: 'asc',\n\t\t\t\t\t\t\t\torderBy: 'name',\n\t\t\t\t\t\t\t\thideEmpty: true,\n\t\t\t\t\t\t\t\thierarchical: false,\n\t\t\t\t\t\t\t\tparent: 0,\n\t\t\t\t\t\t\t\tperPage: 10,\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\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => termQuery.taxonomy !== 'category' }\n\t\t\t\t\t\tlabel={ __( 'Taxonomy' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetQuery( { taxonomy: 'category' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\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={ taxonomyOptions }\n\t\t\t\t\t\t\tvalue={ termQuery.taxonomy }\n\t\t\t\t\t\t\tonChange={ ( selectedTaxonomy ) =>\n\t\t\t\t\t\t\t\tsetQuery( { taxonomy: selectedTaxonomy } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => termQuery.order !== 'asc' }\n\t\t\t\t\t\tlabel={ __( 'Order' ) }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { order: 'asc' } ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\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={ __( 'Order' ) }\n\t\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t\t{ label: __( 'Ascending' ), value: 'asc' },\n\t\t\t\t\t\t\t\t{ label: __( 'Descending' ), value: 'desc' },\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tvalue={ termQuery.order }\n\t\t\t\t\t\t\tonChange={ ( order ) => setQuery( { order } ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => termQuery.orderBy !== 'name' }\n\t\t\t\t\t\tlabel={ __( 'Order by' ) }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { orderBy: 'name' } ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\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={ __( 'Order by' ) }\n\t\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t\t{ label: __( 'Name' ), value: 'name' },\n\t\t\t\t\t\t\t\t{ label: __( 'Slug' ), value: 'slug' },\n\t\t\t\t\t\t\t\t{ label: __( 'Count' ), value: 'count' },\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tvalue={ termQuery.orderBy }\n\t\t\t\t\t\t\tonChange={ ( orderBy ) => setQuery( { orderBy } ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => termQuery.parent !== 0 }\n\t\t\t\t\t\tlabel={ __( 'Show only top level terms' ) }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { parent: 0 } ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\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={ termQuery.parent === 0 }\n\t\t\t\t\t\t\tonChange={ ( showTopLevel ) => {\n\t\t\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\t\t\tparent: showTopLevel ? 0 : undefined,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\tif ( showTopLevel && termQuery.hierarchical ) {\n\t\t\t\t\t\t\t\t\tsetQuery( { hierarchical: false } );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdisabled={ !! termQuery.hierarchical }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => termQuery.hideEmpty !== true }\n\t\t\t\t\t\tlabel={ __( 'Show empty terms' ) }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { hideEmpty: true } ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\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 empty terms' ) }\n\t\t\t\t\t\t\tchecked={ ! termQuery.hideEmpty }\n\t\t\t\t\t\t\tonChange={ ( showEmpty ) =>\n\t\t\t\t\t\t\t\tsetQuery( { hideEmpty: ! showEmpty } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => termQuery.hierarchical !== false }\n\t\t\t\t\t\tlabel={ __( 'Show hierarchy' ) }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { hierarchical: false } ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\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={ termQuery.hierarchical }\n\t\t\t\t\t\t\tonChange={ ( hierarchical ) => {\n\t\t\t\t\t\t\t\tsetQuery( { hierarchical } );\n\t\t\t\t\t\t\t\tif ( hierarchical && termQuery.parent ) {\n\t\t\t\t\t\t\t\t\tsetQuery( { parent: 0 } );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdisabled={ termQuery.parent === 0 }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t{ ! termQuery.hierarchical && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => termQuery.perPage !== 10 }\n\t\t\t\t\t\t\tlabel={ __( 'Max terms' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { perPage: 10 } ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Max terms' ) }\n\t\t\t\t\t\t\t\tvalue={ termQuery.perPage }\n\t\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\t\tonChange={ ( perPage ) => {\n\t\t\t\t\t\t\t\t\t// Show all terms (-1) when 0 is selected.\n\t\t\t\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\t\t\t\tperPage: perPage === 0 ? -1 : perPage,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Limit the number of terms you want to show. To show all terms, use 0 (zero).'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main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wordpress/block-editor';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
export default function save({
|
|
7
|
+
attributes: {
|
|
8
|
+
tagName: Tag = 'div'
|
|
9
|
+
}
|
|
10
|
+
}) {
|
|
11
|
+
const blockProps = useBlockProps.save();
|
|
12
|
+
const innerBlocksProps = useInnerBlocksProps.save(blockProps);
|
|
13
|
+
return /*#__PURE__*/_jsx(Tag, {
|
|
14
|
+
...innerBlocksProps
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=save.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useInnerBlocksProps","useBlockProps","jsx","_jsx","save","attributes","tagName","Tag","blockProps","innerBlocksProps"],"sources":["@wordpress/block-library/src/terms-query/save.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes: { tagName: Tag = 'div' } } ) {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\treturn <Tag { ...innerBlocksProps } />;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,mBAAmB,EAAEC,aAAa,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE7E,eAAe,SAASC,IAAIA,CAAE;EAAEC,UAAU,EAAE;IAAEC,OAAO,EAAEC,GAAG,GAAG;EAAM;AAAE,CAAC,EAAG;EACxE,MAAMC,UAAU,GAAGP,aAAa,CAACG,IAAI,CAAC,CAAC;EACvC,MAAMK,gBAAgB,GAAGT,mBAAmB,CAACI,IAAI,CAAEI,UAAW,CAAC;EAC/D,oBAAOL,IAAA,CAACI,GAAG;IAAA,GAAME;EAAgB,CAAI,CAAC;AACvC","ignoreList":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useDispatch } from '@wordpress/data';
|
|
5
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
6
|
+
import { useEffect } from '@wordpress/element';
|
|
7
|
+
import { useBlockProps, store as blockEditorStore, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import TermsQueryInspectorControls from './inspector-controls';
|
|
13
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
const TEMPLATE = [['core/term-template']];
|
|
15
|
+
export default function TermsQueryContent({
|
|
16
|
+
attributes,
|
|
17
|
+
setAttributes,
|
|
18
|
+
clientId,
|
|
19
|
+
name
|
|
20
|
+
}) {
|
|
21
|
+
const {
|
|
22
|
+
termQueryId,
|
|
23
|
+
termQuery = {},
|
|
24
|
+
tagName: TagName = 'div'
|
|
25
|
+
} = attributes;
|
|
26
|
+
const {
|
|
27
|
+
__unstableMarkNextChangeAsNotPersistent
|
|
28
|
+
} = useDispatch(blockEditorStore);
|
|
29
|
+
const instanceId = useInstanceId(TermsQueryContent);
|
|
30
|
+
const blockProps = useBlockProps();
|
|
31
|
+
const innerBlocksProps = useInnerBlocksProps(blockProps, {
|
|
32
|
+
template: TEMPLATE
|
|
33
|
+
});
|
|
34
|
+
const setQuery = newQuery => {
|
|
35
|
+
setAttributes({
|
|
36
|
+
termQuery: {
|
|
37
|
+
...termQuery,
|
|
38
|
+
...newQuery
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!termQueryId) {
|
|
44
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
45
|
+
setAttributes({
|
|
46
|
+
termQueryId: instanceId
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}, [termQueryId, instanceId, setAttributes, __unstableMarkNextChangeAsNotPersistent]);
|
|
50
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
51
|
+
children: [/*#__PURE__*/_jsx(TermsQueryInspectorControls, {
|
|
52
|
+
name: name,
|
|
53
|
+
attributes: attributes,
|
|
54
|
+
setQuery: setQuery,
|
|
55
|
+
setAttributes: setAttributes,
|
|
56
|
+
clientId: clientId,
|
|
57
|
+
tagName: TagName
|
|
58
|
+
}), /*#__PURE__*/_jsx(TagName, {
|
|
59
|
+
...innerBlocksProps
|
|
60
|
+
})]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=terms-query-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useDispatch","useInstanceId","useEffect","useBlockProps","store","blockEditorStore","useInnerBlocksProps","TermsQueryInspectorControls","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","TEMPLATE","TermsQueryContent","attributes","setAttributes","clientId","name","termQueryId","termQuery","tagName","TagName","__unstableMarkNextChangeAsNotPersistent","instanceId","blockProps","innerBlocksProps","template","setQuery","newQuery","children"],"sources":["@wordpress/block-library/src/terms-query/terms-query-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport TermsQueryInspectorControls from './inspector-controls';\n\nconst TEMPLATE = [ [ 'core/term-template' ] ];\n\nexport default function TermsQueryContent( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tname,\n} ) {\n\tconst {\n\t\ttermQueryId,\n\t\ttermQuery = {},\n\t\ttagName: TagName = 'div',\n\t} = attributes;\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst instanceId = useInstanceId( TermsQueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\n\tconst setQuery = ( newQuery ) => {\n\t\tsetAttributes( {\n\t\t\ttermQuery: {\n\t\t\t\t...termQuery,\n\t\t\t\t...newQuery,\n\t\t\t},\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! termQueryId ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { termQueryId: instanceId } );\n\t\t}\n\t}, [\n\t\ttermQueryId,\n\t\tinstanceId,\n\t\tsetAttributes,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t] );\n\n\treturn (\n\t\t<>\n\t\t\t<TermsQueryInspectorControls\n\t\t\t\tname={ name }\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetQuery={ setQuery }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tclientId={ clientId }\n\t\t\t\ttagName={ TagName }\n\t\t\t/>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SACCC,aAAa,EACbC,KAAK,IAAIC,gBAAgB,EACzBC,mBAAmB,QACb,yBAAyB;;AAEhC;AACA;AACA;AACA,OAAOC,2BAA2B,MAAM,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAE/D,MAAMC,QAAQ,GAAG,CAAE,CAAE,oBAAoB,CAAE,CAAE;AAE7C,eAAe,SAASC,iBAAiBA,CAAE;EAC1CC,UAAU;EACVC,aAAa;EACbC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,MAAM;IACLC,WAAW;IACXC,SAAS,GAAG,CAAC,CAAC;IACdC,OAAO,EAAEC,OAAO,GAAG;EACpB,CAAC,GAAGP,UAAU;EAEd,MAAM;IAAEQ;EAAwC,CAAC,GAChDxB,WAAW,CAAEK,gBAAiB,CAAC;EAChC,MAAMoB,UAAU,GAAGxB,aAAa,CAAEc,iBAAkB,CAAC;EACrD,MAAMW,UAAU,GAAGvB,aAAa,CAAC,CAAC;EAClC,MAAMwB,gBAAgB,GAAGrB,mBAAmB,CAAEoB,UAAU,EAAE;IACzDE,QAAQ,EAAEd;EACX,CAAE,CAAC;EAEH,MAAMe,QAAQ,GAAKC,QAAQ,IAAM;IAChCb,aAAa,CAAE;MACdI,SAAS,EAAE;QACV,GAAGA,SAAS;QACZ,GAAGS;MACJ;IACD,CAAE,CAAC;EACJ,CAAC;EAED5B,SAAS,CAAE,MAAM;IAChB,IAAK,CAAEkB,WAAW,EAAG;MACpBI,uCAAuC,CAAC,CAAC;MACzCP,aAAa,CAAE;QAAEG,WAAW,EAAEK;MAAW,CAAE,CAAC;IAC7C;EACD,CAAC,EAAE,CACFL,WAAW,EACXK,UAAU,EACVR,aAAa,EACbO,uCAAuC,CACtC,CAAC;EAEH,oBACCX,KAAA,CAAAF,SAAA;IAAAoB,QAAA,gBACCtB,IAAA,CAACF,2BAA2B;MAC3BY,IAAI,EAAGA,IAAM;MACbH,UAAU,EAAGA,UAAY;MACzBa,QAAQ,EAAGA,QAAU;MACrBZ,aAAa,EAAGA,aAAe;MAC/BC,QAAQ,EAAGA,QAAU;MACrBI,OAAO,EAAGC;IAAS,CACnB,CAAC,eACFd,IAAA,CAACc,OAAO;MAAA,GAAMI;IAAgB,CAAI,CAAC;EAAA,CAClC,CAAC;AAEL","ignoreList":[]}
|
|
@@ -2560,6 +2560,30 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
|
|
2560
2560
|
border: none;
|
|
2561
2561
|
}
|
|
2562
2562
|
|
|
2563
|
+
.wp-block-term-template .term-loading .term-loading-placeholder {
|
|
2564
|
+
width: 100%;
|
|
2565
|
+
height: 1.5em;
|
|
2566
|
+
margin-bottom: 0.25em;
|
|
2567
|
+
background-color: #f0f0f0;
|
|
2568
|
+
border-radius: 2px;
|
|
2569
|
+
}
|
|
2570
|
+
@media not (prefers-reduced-motion) {
|
|
2571
|
+
.wp-block-term-template .term-loading .term-loading-placeholder {
|
|
2572
|
+
animation: loadingpulse 1.5s ease-in-out infinite;
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
@keyframes loadingpulse {
|
|
2577
|
+
0% {
|
|
2578
|
+
opacity: 1;
|
|
2579
|
+
}
|
|
2580
|
+
50% {
|
|
2581
|
+
opacity: 0.5;
|
|
2582
|
+
}
|
|
2583
|
+
100% {
|
|
2584
|
+
opacity: 1;
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2563
2587
|
.wp-block-text-columns .block-editor-rich-text__editable:focus {
|
|
2564
2588
|
outline: 1px solid #ddd;
|
|
2565
2589
|
}
|
package/build-style/editor.css
CHANGED
|
@@ -2567,6 +2567,30 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
|
|
2567
2567
|
border: none;
|
|
2568
2568
|
}
|
|
2569
2569
|
|
|
2570
|
+
.wp-block-term-template .term-loading .term-loading-placeholder {
|
|
2571
|
+
width: 100%;
|
|
2572
|
+
height: 1.5em;
|
|
2573
|
+
margin-bottom: 0.25em;
|
|
2574
|
+
background-color: #f0f0f0;
|
|
2575
|
+
border-radius: 2px;
|
|
2576
|
+
}
|
|
2577
|
+
@media not (prefers-reduced-motion) {
|
|
2578
|
+
.wp-block-term-template .term-loading .term-loading-placeholder {
|
|
2579
|
+
animation: loadingpulse 1.5s ease-in-out infinite;
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
@keyframes loadingpulse {
|
|
2584
|
+
0% {
|
|
2585
|
+
opacity: 1;
|
|
2586
|
+
}
|
|
2587
|
+
50% {
|
|
2588
|
+
opacity: 0.5;
|
|
2589
|
+
}
|
|
2590
|
+
100% {
|
|
2591
|
+
opacity: 1;
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2570
2594
|
.wp-block-text-columns .block-editor-rich-text__editable:focus {
|
|
2571
2595
|
outline: 1px solid #ddd;
|
|
2572
2596
|
}
|
|
@@ -4235,6 +4235,22 @@ ul.wp-block-rss.is-grid li {
|
|
|
4235
4235
|
margin-bottom: 0;
|
|
4236
4236
|
}
|
|
4237
4237
|
|
|
4238
|
+
.wp-block-term-template {
|
|
4239
|
+
margin-top: 0;
|
|
4240
|
+
margin-bottom: 0;
|
|
4241
|
+
max-width: 100%;
|
|
4242
|
+
box-sizing: border-box;
|
|
4243
|
+
}
|
|
4244
|
+
.wp-block-term-template.is-layout-grid, .wp-block-term-template.is-layout-flex {
|
|
4245
|
+
list-style: none;
|
|
4246
|
+
padding: 0;
|
|
4247
|
+
}
|
|
4248
|
+
|
|
4249
|
+
.wp-block-terms-query .wp-block-term {
|
|
4250
|
+
margin-block-start: 0;
|
|
4251
|
+
margin-block-end: 0;
|
|
4252
|
+
}
|
|
4253
|
+
|
|
4238
4254
|
.wp-block-text-columns {
|
|
4239
4255
|
display: flex;
|
|
4240
4256
|
}
|
package/build-style/style.css
CHANGED
|
@@ -4268,6 +4268,22 @@ ul.wp-block-rss.is-grid li {
|
|
|
4268
4268
|
margin-bottom: 0;
|
|
4269
4269
|
}
|
|
4270
4270
|
|
|
4271
|
+
.wp-block-term-template {
|
|
4272
|
+
margin-top: 0;
|
|
4273
|
+
margin-bottom: 0;
|
|
4274
|
+
max-width: 100%;
|
|
4275
|
+
box-sizing: border-box;
|
|
4276
|
+
}
|
|
4277
|
+
.wp-block-term-template.is-layout-grid, .wp-block-term-template.is-layout-flex {
|
|
4278
|
+
list-style: none;
|
|
4279
|
+
padding: 0;
|
|
4280
|
+
}
|
|
4281
|
+
|
|
4282
|
+
.wp-block-terms-query .wp-block-term {
|
|
4283
|
+
margin-block-start: 0;
|
|
4284
|
+
margin-block-end: 0;
|
|
4285
|
+
}
|
|
4286
|
+
|
|
4271
4287
|
.wp-block-text-columns {
|
|
4272
4288
|
display: flex;
|
|
4273
4289
|
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colors
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Breakpoints & Media Queries
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Colors
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* SCSS Variables.
|
|
12
|
+
*
|
|
13
|
+
* Please use variables from this sheet to ensure consistency across the UI.
|
|
14
|
+
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
|
15
|
+
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Fonts & basic variables.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Typography
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Grid System.
|
|
25
|
+
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Radius scale.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Elevation scale.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Dimensions.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Mobile specific styles
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* Editor styles.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* Block & Editor UI.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* Block paddings.
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* React Native specific.
|
|
50
|
+
* These variables do not appear to be used anywhere else.
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* Colors
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* SCSS Variables.
|
|
57
|
+
*
|
|
58
|
+
* Please use variables from this sheet to ensure consistency across the UI.
|
|
59
|
+
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
|
60
|
+
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
|
61
|
+
*/
|
|
62
|
+
/**
|
|
63
|
+
* Fonts & basic variables.
|
|
64
|
+
*/
|
|
65
|
+
/**
|
|
66
|
+
* Typography
|
|
67
|
+
*/
|
|
68
|
+
/**
|
|
69
|
+
* Grid System.
|
|
70
|
+
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
|
71
|
+
*/
|
|
72
|
+
/**
|
|
73
|
+
* Radius scale.
|
|
74
|
+
*/
|
|
75
|
+
/**
|
|
76
|
+
* Elevation scale.
|
|
77
|
+
*/
|
|
78
|
+
/**
|
|
79
|
+
* Dimensions.
|
|
80
|
+
*/
|
|
81
|
+
/**
|
|
82
|
+
* Mobile specific styles
|
|
83
|
+
*/
|
|
84
|
+
/**
|
|
85
|
+
* Editor styles.
|
|
86
|
+
*/
|
|
87
|
+
/**
|
|
88
|
+
* Block & Editor UI.
|
|
89
|
+
*/
|
|
90
|
+
/**
|
|
91
|
+
* Block paddings.
|
|
92
|
+
*/
|
|
93
|
+
/**
|
|
94
|
+
* React Native specific.
|
|
95
|
+
* These variables do not appear to be used anywhere else.
|
|
96
|
+
*/
|
|
97
|
+
/**
|
|
98
|
+
* Breakpoints & Media Queries
|
|
99
|
+
*/
|
|
100
|
+
/**
|
|
101
|
+
* Converts a hex value into the rgb equivalent.
|
|
102
|
+
*
|
|
103
|
+
* @param {string} hex - the hexadecimal value to convert
|
|
104
|
+
* @return {string} comma separated rgb values
|
|
105
|
+
*/
|
|
106
|
+
/**
|
|
107
|
+
* Long content fade mixin
|
|
108
|
+
*
|
|
109
|
+
* Creates a fading overlay to signify that the content is longer
|
|
110
|
+
* than the space allows.
|
|
111
|
+
*/
|
|
112
|
+
/**
|
|
113
|
+
* Typography
|
|
114
|
+
*/
|
|
115
|
+
/**
|
|
116
|
+
* Breakpoint mixins
|
|
117
|
+
*/
|
|
118
|
+
/**
|
|
119
|
+
* Focus styles.
|
|
120
|
+
*/
|
|
121
|
+
/**
|
|
122
|
+
* Applies editor left position to the selector passed as argument
|
|
123
|
+
*/
|
|
124
|
+
/**
|
|
125
|
+
* Styles that are reused verbatim in a few places
|
|
126
|
+
*/
|
|
127
|
+
/**
|
|
128
|
+
* Allows users to opt-out of animations via OS-level preferences.
|
|
129
|
+
*/
|
|
130
|
+
/**
|
|
131
|
+
* Reset default styles for JavaScript UI based pages.
|
|
132
|
+
* This is a WP-admin agnostic reset
|
|
133
|
+
*/
|
|
134
|
+
/**
|
|
135
|
+
* Reset the WP Admin page styles for Gutenberg-like pages.
|
|
136
|
+
*/
|
|
137
|
+
.wp-block-term-template .term-loading .term-loading-placeholder {
|
|
138
|
+
width: 100%;
|
|
139
|
+
height: 1.5em;
|
|
140
|
+
margin-bottom: 0.25em;
|
|
141
|
+
background-color: #f0f0f0;
|
|
142
|
+
border-radius: 2px;
|
|
143
|
+
}
|
|
144
|
+
@media not (prefers-reduced-motion) {
|
|
145
|
+
.wp-block-term-template .term-loading .term-loading-placeholder {
|
|
146
|
+
animation: loadingpulse 1.5s ease-in-out infinite;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@keyframes loadingpulse {
|
|
151
|
+
0% {
|
|
152
|
+
opacity: 1;
|
|
153
|
+
}
|
|
154
|
+
50% {
|
|
155
|
+
opacity: 0.5;
|
|
156
|
+
}
|
|
157
|
+
100% {
|
|
158
|
+
opacity: 1;
|
|
159
|
+
}
|
|
160
|
+
}
|