Skip to content

Commit 25a8e82

Browse files
nosoloswdesrosj
authored andcommitted
Fix API docs generation (#33384)
1 parent 7fc3aa4 commit 25a8e82

File tree

11 files changed

+200
-82
lines changed

11 files changed

+200
-82
lines changed

bin/api-docs/update-api-docs.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ const PACKAGES_DIR = resolve( ROOT_DIR, 'packages' );
3838
*
3939
* @type {string}
4040
*/
41-
const DATA_DOCS_DIR = resolve(
42-
ROOT_DIR,
43-
'docs/designers-developers/developers/data'
44-
);
41+
const DATA_DOCS_DIR = resolve( ROOT_DIR, 'docs/reference-guides/data' );
4542

4643
/**
4744
* Pattern matching start token of a README file.

docs/reference-guides/data/data-core-annotations.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ Namespace: `core/annotations`.
44

55
## Selectors
66

7-
<!-- START TOKEN(Autogenerated selectors|../../../../packages/annotations/src/store/selectors.js) -->
7+
<!-- START TOKEN(Autogenerated selectors|../../../packages/annotations/src/store/selectors.js) -->
88

99
Nothing to document.
1010

11-
<!-- END TOKEN(Autogenerated selectors|../../../../packages/annotations/src/store/selectors.js) -->
11+
<!-- END TOKEN(Autogenerated selectors|../../../packages/annotations/src/store/selectors.js) -->
1212

1313
## Actions
1414

15-
<!-- START TOKEN(Autogenerated actions|../../../../packages/annotations/src/store/actions.js) -->
15+
<!-- START TOKEN(Autogenerated actions|../../../packages/annotations/src/store/actions.js) -->
1616

1717
Nothing to document.
1818

19-
<!-- END TOKEN(Autogenerated actions|../../../../packages/annotations/src/store/actions.js) -->
19+
20+
<!-- END TOKEN(Autogenerated actions|../../../packages/annotations/src/store/actions.js) -->

docs/reference-guides/data/data-core-block-editor.md

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Namespace: `core/block-editor`.
44

55
## Selectors
66

7-
<!-- START TOKEN(Autogenerated selectors|../../../../packages/block-editor/src/store/selectors.js) -->
7+
<!-- START TOKEN(Autogenerated selectors|../../../packages/block-editor/src/store/selectors.js) -->
88

99
<a name="areInnerBlocksControlled" href="#areInnerBlocksControlled">#</a> **areInnerBlocksControlled**
1010

@@ -705,11 +705,11 @@ Returns the defined block template
705705

706706
_Parameters_
707707

708-
- _state_ `boolean`:
708+
- _state_ `boolean`:
709709

710710
_Returns_
711711

712-
- `?Array`: Block Template
712+
- `?Array`: Block Template.
713713

714714
<a name="getTemplateLock" href="#getTemplateLock">#</a> **getTemplateLock**
715715

@@ -1027,17 +1027,31 @@ Returns whether the blocks matches the template or not.
10271027

10281028
_Parameters_
10291029

1030-
- _state_ `boolean`:
1030+
- _state_ `boolean`:
10311031

10321032
_Returns_
10331033

10341034
- `?boolean`: Whether the template is valid or not.
10351035

1036-
<!-- END TOKEN(Autogenerated selectors|../../../../packages/block-editor/src/store/selectors.js) -->
1036+
<a name="wasBlockJustInserted" href="#wasBlockJustInserted">#</a> **wasBlockJustInserted**
1037+
1038+
Tells if the block with the passed clientId was just inserted.
1039+
1040+
_Parameters_
1041+
1042+
- _state_ `Object`: Global application state.
1043+
- _clientId_ `Object`: Client Id of the block.
1044+
- _source_ `?string`: Optional insertion source of the block.
1045+
1046+
_Returns_
1047+
1048+
- `boolean`: True if the block matches the last block inserted from the specified source.
1049+
1050+
<!-- END TOKEN(Autogenerated selectors|../../../packages/block-editor/src/store/selectors.js) -->
10371051

10381052
## Actions
10391053

1040-
<!-- START TOKEN(Autogenerated actions|../../../../packages/block-editor/src/store/actions.js) -->
1054+
<!-- START TOKEN(Autogenerated actions|../../../packages/block-editor/src/store/actions.js) -->
10411055

10421056
<a name="clearSelectedBlock" href="#clearSelectedBlock">#</a> **clearSelectedBlock**
10431057

@@ -1053,8 +1067,8 @@ Generator that triggers an action used to duplicate a list of blocks.
10531067

10541068
_Parameters_
10551069

1056-
- _clientIds_ `string[]`:
1057-
- _updateSelection_ `boolean`:
1070+
- _clientIds_ `string[]`:
1071+
- _updateSelection_ `boolean`:
10581072

10591073
<a name="enterFormattedText" href="#enterFormattedText">#</a> **enterFormattedText**
10601074

@@ -1095,15 +1109,15 @@ Generator used to insert an empty block before a given block.
10951109

10961110
_Parameters_
10971111

1098-
- _clientId_ `string`:
1112+
- _clientId_ `string`:
10991113

11001114
<a name="insertBeforeBlock" href="#insertBeforeBlock">#</a> **insertBeforeBlock**
11011115

11021116
Generator used to insert an empty block after a given block.
11031117

11041118
_Parameters_
11051119

1106-
- _clientId_ `string`:
1120+
- _clientId_ `string`:
11071121

11081122
<a name="insertBlock" href="#insertBlock">#</a> **insertBlock**
11091123

@@ -1116,6 +1130,7 @@ _Parameters_
11161130
- _index_ `?number`: Index at which block should be inserted.
11171131
- _rootClientId_ `?string`: Optional root client ID of block list on which to insert.
11181132
- _updateSelection_ `?boolean`: If true block selection will be updated. If false, block selection will not change. Defaults to true.
1133+
- _meta_ `?Object`: Optional Meta values to be passed to the action object.
11191134

11201135
_Returns_
11211136

@@ -1131,7 +1146,7 @@ _Parameters_
11311146
- _blocks_ `Object[]`: Block objects to insert.
11321147
- _index_ `?number`: Index at which block should be inserted.
11331148
- _rootClientId_ `?string`: Optional root client ID of block list on which to insert.
1134-
- _updateSelection_ `?boolean`: If true block selection will be updated. If false, block selection will not change. Defaults to true.
1149+
- _updateSelection_ `?boolean`: If true block selection will be updated. If false, block selection will not change. Defaults to true.
11351150
- _initialPosition_ `0|-1|null`: Initial focus position. Setting it to null prevent focusing the inserted block.
11361151
- _meta_ `?Object`: Optional Meta values to be passed to the action object.
11371152

@@ -1406,6 +1421,7 @@ _Parameters_
14061421

14071422
- _rootClientId_ `?string`: Optional root client ID of block list on which to insert.
14081423
- _index_ `?number`: Index at which block should be inserted.
1424+
- _\_\_unstableOptions_ `Object`: Wether or not to show an inserter button.
14091425

14101426
_Returns_
14111427

@@ -1570,4 +1586,5 @@ _Parameters_
15701586

15711587
- _blocks_ `Array`: Array of blocks.
15721588

1573-
<!-- END TOKEN(Autogenerated actions|../../../../packages/block-editor/src/store/actions.js) -->
1589+
1590+
<!-- END TOKEN(Autogenerated actions|../../../packages/block-editor/src/store/actions.js) -->

docs/reference-guides/data/data-core-blocks.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,31 @@ Namespace: `core/blocks`.
44

55
## Selectors
66

7-
<!-- START TOKEN(Autogenerated selectors|../../../../packages/blocks/src/store/selectors.js) -->
7+
<!-- START TOKEN(Autogenerated selectors|../../../packages/blocks/src/store/selectors.js) -->
8+
9+
<a name="getActiveBlockVariation" href="#getActiveBlockVariation">#</a> **getActiveBlockVariation**
10+
11+
Returns the active block variation for a given block based on its attributes.
12+
Variations are determined by their `isActive` property.
13+
Which is either an array of block attribute keys or a function.
14+
15+
In case of an array of block attribute keys, the `attributes` are compared
16+
to the variation's attributes using strict equality check.
17+
18+
In case of function type, the function should accept a block's attributes
19+
and the variation's attributes and determines if a variation is active.
20+
A function that accepts a block's attributes and the variation's attributes and determines if a variation is active.
21+
22+
_Parameters_
23+
24+
- _state_ `Object`: Data state.
25+
- _blockName_ `string`: Name of block (example: “core/columns”).
26+
- _attributes_ `Object`: Block attributes used to determine active variation.
27+
- _scope_ `[WPBlockVariationScope]`: Block variation scope name.
28+
29+
_Returns_
30+
31+
- `(WPBlockVariation|undefined)`: Active block variation.
832

933
<a name="getBlockStyles" href="#getBlockStyles">#</a> **getBlockStyles**
1034

@@ -27,7 +51,7 @@ _Parameters_
2751

2852
- _state_ `Object`: Data state.
2953
- _nameOrType_ `(string|Object)`: Block name or type object
30-
- _feature_ `string`: Feature to retrieve
54+
- _feature_ `Array|string`: Feature to retrieve
3155
- _defaultSupports_ `*`: Default value to return if not explicitly defined
3256

3357
_Returns_
@@ -231,11 +255,11 @@ _Returns_
231255

232256
- `Object[]`: Whether block type matches search term.
233257

234-
<!-- END TOKEN(Autogenerated selectors|../../../../packages/blocks/src/store/selectors.js) -->
258+
<!-- END TOKEN(Autogenerated selectors|../../../packages/blocks/src/store/selectors.js) -->
235259

236260
## Actions
237261

238-
<!-- START TOKEN(Autogenerated actions|../../../../packages/blocks/src/store/actions.js) -->
262+
<!-- START TOKEN(Autogenerated actions|../../../packages/blocks/src/store/actions.js) -->
239263

240264
<a name="addBlockCollection" href="#addBlockCollection">#</a> **addBlockCollection**
241265

@@ -416,4 +440,5 @@ _Returns_
416440

417441
- `Object`: Action object.
418442

419-
<!-- END TOKEN(Autogenerated actions|../../../../packages/blocks/src/store/actions.js) -->
443+
444+
<!-- END TOKEN(Autogenerated actions|../../../packages/blocks/src/store/actions.js) -->

docs/reference-guides/data/data-core-edit-post.md

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Namespace: `core/edit-post`.
44

55
## Selectors
66

7-
<!-- START TOKEN(Autogenerated selectors|../../../../packages/edit-post/src/store/selectors.js) -->
7+
<!-- START TOKEN(Autogenerated selectors|../../../packages/edit-post/src/store/selectors.js) -->
88

99
<a name="getActiveGeneralSidebarName" href="#getActiveGeneralSidebarName">#</a> **getActiveGeneralSidebarName**
1010

@@ -49,6 +49,14 @@ _Returns_
4949

5050
- `Array`: List of meta boxes.
5151

52+
<a name="getEditedPostTemplate" href="#getEditedPostTemplate">#</a> **getEditedPostTemplate**
53+
54+
Retrieves the template of the currently edited post.
55+
56+
_Returns_
57+
58+
- `Object?`: Post Template.
59+
5260
<a name="getEditorMode" href="#getEditorMode">#</a> **getEditorMode**
5361

5462
Returns the current editing mode.
@@ -201,6 +209,18 @@ _Returns_
201209

202210
- `boolean`: Whether the inserter is opened.
203211

212+
<a name="isListViewOpened" href="#isListViewOpened">#</a> **isListViewOpened**
213+
214+
Returns true if the list view is opened.
215+
216+
_Parameters_
217+
218+
- _state_ `Object`: Global application state.
219+
220+
_Returns_
221+
222+
- `boolean`: Whether the list view is opened.
223+
204224
<a name="isMetaBoxLocationActive" href="#isMetaBoxLocationActive">#</a> **isMetaBoxLocationActive**
205225

206226
Returns true if there is an active meta box in the given location, or false
@@ -261,7 +281,7 @@ Returns true if the plugin sidebar is opened.
261281

262282
_Parameters_
263283

264-
- _state_ `Object`: Global application state
284+
- _state_ `Object`: Global application state.
265285

266286
_Returns_
267287

@@ -291,11 +311,11 @@ _Returns_
291311

292312
- `boolean`: Whether the metaboxes are being saved.
293313

294-
<!-- END TOKEN(Autogenerated selectors|../../../../packages/edit-post/src/store/selectors.js) -->
314+
<!-- END TOKEN(Autogenerated selectors|../../../packages/edit-post/src/store/selectors.js) -->
295315

296316
## Actions
297317

298-
<!-- START TOKEN(Autogenerated actions|../../../../packages/edit-post/src/store/actions.js) -->
318+
<!-- START TOKEN(Autogenerated actions|../../../packages/edit-post/src/store/actions.js) -->
299319

300320
<a name="closeGeneralSidebar" href="#closeGeneralSidebar">#</a> **closeGeneralSidebar**
301321

@@ -331,9 +351,17 @@ _Returns_
331351

332352
- `Object`: Action object.
333353

354+
<a name="metaBoxUpdatesFailure" href="#metaBoxUpdatesFailure">#</a> **metaBoxUpdatesFailure**
355+
356+
Returns an action object used to signal a failed meta box update.
357+
358+
_Returns_
359+
360+
- `Object`: Action object.
361+
334362
<a name="metaBoxUpdatesSuccess" href="#metaBoxUpdatesSuccess">#</a> **metaBoxUpdatesSuccess**
335363

336-
Returns an action object used signal a successful meta box update.
364+
Returns an action object used to signal a successful meta box update.
337365

338366
_Returns_
339367

@@ -411,7 +439,21 @@ Returns an action object used to open/close the inserter.
411439

412440
_Parameters_
413441

414-
- _value_ `boolean`: A boolean representing whether the inserter should be opened or closed.
442+
- _value_ `boolean|Object`: Whether the inserter should be opened (true) or closed (false). To specify an insertion point, use an object.
443+
- _value.rootClientId_ `string`: The root client ID to insert at.
444+
- _value.insertionIndex_ `number`: The index to insert at.
445+
446+
_Returns_
447+
448+
- `Object`: Action object.
449+
450+
<a name="setIsListViewOpened" href="#setIsListViewOpened">#</a> **setIsListViewOpened**
451+
452+
Returns an action object used to open/close the list view.
453+
454+
_Parameters_
455+
456+
- _isOpen_ `boolean`: A boolean representing whether the list view should be opened or closed.
415457

416458
_Returns_
417459

@@ -503,4 +545,5 @@ _Returns_
503545

504546
- `Object`: Action object.
505547

506-
<!-- END TOKEN(Autogenerated actions|../../../../packages/edit-post/src/store/actions.js) -->
548+
549+
<!-- END TOKEN(Autogenerated actions|../../../packages/edit-post/src/store/actions.js) -->

0 commit comments

Comments
 (0)