Skip to content

Commit

Permalink
Split into private and public selectors/actions (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy authored Jul 30, 2024
1 parent 26fa199 commit 616b4a9
Show file tree
Hide file tree
Showing 19 changed files with 2,588 additions and 2,564 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,22 @@
"build:docs": "npm-run-all --parallel build:docs:*",
"build:docs:ffmpeg": "docgen packages/ffmpeg/src/index.ts --output packages/ffmpeg/README.md --to-token --use-token \"Autogenerated API docs\"",
"build:docs:heif": "docgen packages/heif/src/index.ts --output packages/heif/README.md --to-token --use-token \"Autogenerated API docs\"",
"build:docs:interface-actions": "docgen packages/interface/src/store/actions.ts --output packages/interface/README.md --to-token --use-token \"Autogenerated actions|src/store/actions.ts\"",
"build:docs:interface-selectors": "docgen packages/interface/src/store/selectors.ts --output packages/interface/README.md --to-token --use-token \"Autogenerated selectors|src/store/selectors.ts\"",
"build:docs:interface": "npm-run-all build:docs:interface:*",
"build:docs:interface:actions": "docgen packages/interface/src/store/actions.ts --output packages/interface/README.md --to-token --use-token \"Autogenerated actions|src/store/actions.ts\"",
"build:docs:interface:selectors": "docgen packages/interface/src/store/selectors.ts --output packages/interface/README.md --to-token --use-token \"Autogenerated selectors|src/store/selectors.ts\"",
"build:docs:log": "docgen packages/log/src/index.ts --output packages/log/README.md --to-token --use-token \"Autogenerated API docs\"",
"build:docs:media-recording-actions": "docgen packages/media-recording/src/store/actions.ts --output packages/media-recording/README.md --to-token --use-token \"Autogenerated actions|src/store/actions.ts\"",
"build:docs:media-recording-selectors": "docgen packages/media-recording/src/store/selectors.ts --output packages/media-recording/README.md --to-token --use-token \"Autogenerated selectors|src/store/selectors.ts\"",
"build:docs:media-recording": "npm-run-all build:docs:media-recording:*",
"build:docs:media-recording:actions": "docgen packages/media-recording/src/store/actions.ts --output packages/media-recording/README.md --to-token --use-token \"Autogenerated actions|src/store/actions.ts\"",
"build:docs:media-recording:selectors": "docgen packages/media-recording/src/store/selectors.ts --output packages/media-recording/README.md --to-token --use-token \"Autogenerated selectors|src/store/selectors.ts\"",
"build:docs:media-utils": "docgen packages/media-utils/src/index.ts --output packages/media-utils/README.md --to-token --use-token \"Autogenerated API docs\"",
"build:docs:mime": "docgen packages/mime/src/index.ts --output packages/mime/README.md --to-token --use-token \"Autogenerated API docs\"",
"build:docs:pdf": "docgen packages/pdf/src/index.ts --output packages/pdf/README.md --to-token --use-token \"Autogenerated API docs\"",
"build:docs:subtitles": "docgen packages/subtitles/src/index.ts --output packages/subtitles/README.md --to-token --use-token \"Autogenerated API docs\"",
"build:docs:upload-media-actions": "docgen packages/upload-media/src/store/actions.ts --output packages/upload-media/README.md --to-token --use-token \"Autogenerated actions|src/store/actions.ts\"",
"build:docs:upload-media-selectors": "docgen packages/upload-media/src/store/selectors.ts --output packages/upload-media/README.md --to-token --use-token \"Autogenerated selectors|src/store/selectors.ts\"",
"build:docs:upload-media": "npm-run-all build:docs:upload-media:*",
"build:docs:upload-media:actions": "docgen packages/upload-media/src/store/actions.ts --output packages/upload-media/README.md --to-token --use-token \"Autogenerated actions|src/store/actions.ts\"",
"build:docs:upload-media:private-actions": "docgen packages/upload-media/src/store/private-actions.ts --output packages/upload-media/README.md --to-token --use-token \"Autogenerated actions|src/store/private-actions.ts\"",
"build:docs:upload-media:selectors": "docgen packages/upload-media/src/store/selectors.ts --output packages/upload-media/README.md --to-token --use-token \"Autogenerated selectors|src/store/selectors.ts\"",
"build:docs:upload-media:private-selectors": "docgen packages/upload-media/src/store/private-selectors.ts --output packages/upload-media/README.md --to-token --use-token \"Autogenerated selectors|src/store/private-selectors.ts\"",
"build:docs:vips": "docgen packages/vips/src/index.ts --output packages/vips/README.md --to-token --use-token \"Autogenerated API docs\"",
"format": "wp-scripts format",
"lint:css": "wp-scripts lint-style",
Expand Down
13 changes: 2 additions & 11 deletions packages/editor/src/uploadQueue/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,14 @@ export default function blockEditorUploadMedia( {
}

/*
Make the upload queue aware of the function for uploading to the server.
The list of available image sizes is passed via an inline script
and needs to be saved in the store first.
*/
void dispatch( uploadStore ).setImageSizes(
window.mediaExperiments.availableImageSizes
);

// Make the upload queue aware of the function for uploading to the server.
void dispatch( uploadStore ).updateSettings( {
mediaUpload: editorUploadMedia,
mediaSideload: originalSideloadMedia,
imageSizes: window.mediaExperiments.availableImageSizes,
} );

// Subscribe to state updates so that we can override the mediaUpload() function at the right time.
Expand All @@ -208,10 +205,4 @@ subscribe( () => {
void dispatch( blockEditorStore ).updateSettings( {
mediaUpload: blockEditorUploadMedia,
} );

// addFilter(
// 'editor.MediaUpload',
// 'media-experiments/replace-media-upload',
// replaceMediaUpload
// );
}, blockEditorStore );
4 changes: 1 addition & 3 deletions packages/editor/src/uploadStatus/indicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ export function UploadStatusIndicator() {
const { cancelItem } = useDispatch( uploadStore );
const { isUploading, items } = useSelect(
( select ) => {
const queueItems = select( uploadStore )
.getItems()
.filter( ( item ) => ! item.parentId );
const queueItems = select( uploadStore ).getItems();

return {
isUploading: select( uploadStore ).isUploading(),
Expand Down
2 changes: 0 additions & 2 deletions packages/ffmpeg/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ async function runFFmpegWithConfig(
fileName,
{ type: mimeType }
);
} catch ( err ) {
throw err;
} finally {
try {
// Also removes MEMFS to free memory.
Expand Down
2 changes: 1 addition & 1 deletion packages/interface/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ _Returns_

- `OpenModalAction`: Action object.


<!-- END TOKEN(Autogenerated actions|src/store/actions.ts) -->

### Selectors
Expand All @@ -52,4 +51,5 @@ _Returns_

- `boolean`: Whether the modal is active.


<!-- END TOKEN(Autogenerated selectors|src/store/selectors.ts) -->
8 changes: 4 additions & 4 deletions packages/media-recording/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Enters recording mode for a given block and recording type.
_Parameters_

- _clientId_ `string`: Block client ID.
- _recordingType_ Recording type.
- _recordingTypes_ Recording types.

#### leaveRecordingMode

Expand Down Expand Up @@ -109,7 +109,6 @@ Returns an action object signalling that audio mode should be toggled.

Updates the list of available media devices.


<!-- END TOKEN(Autogenerated actions|src/store/actions.ts) -->

### Selectors
Expand Down Expand Up @@ -224,9 +223,9 @@ _Parameters_

- _state_ `State`: Recording state.

#### getRecordingType
#### getRecordingTypes

Returns the current recording media type.
Returns the current recording media types.

_Parameters_

Expand Down Expand Up @@ -297,4 +296,5 @@ _Parameters_

- _state_ `State`: Recording state.


<!-- END TOKEN(Autogenerated selectors|src/store/selectors.ts) -->
Loading

0 comments on commit 616b4a9

Please sign in to comment.