Skip to content

Commit

Permalink
move to a flat structure
Browse files Browse the repository at this point in the history
  • Loading branch information
gigitux committed Sep 18, 2024
1 parent 485237f commit 5a4fb59
Show file tree
Hide file tree
Showing 23 changed files with 50 additions and 54 deletions.
4 changes: 2 additions & 2 deletions packages/editor/src/dataviews/store/private-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
restorePost,
trashPost,
renamePost,
resetTemplateAction,
resetPost,
deletePost,
} from '@wordpress/fields';
import duplicateTemplatePart from '../actions/duplicate-template-part';
Expand Down Expand Up @@ -118,7 +118,7 @@ export const registerPostTypeActions =
: undefined,
postTypeConfig.slug === 'wp_block' ? exportPattern : undefined,
restorePost,
resetTemplateAction,
resetPost,
deletePost,
trashPost,
permanentlyDeletePost,
Expand Down
2 changes: 1 addition & 1 deletion packages/fields/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Undocumented declaration.

Undocumented declaration.

### resetTemplateAction
### resetPost

Undocumented declaration.

Expand Down
6 changes: 0 additions & 6 deletions packages/fields/src/actions/base-post/index.ts

This file was deleted.

5 changes: 0 additions & 5 deletions packages/fields/src/actions/common/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import {
getItemTitle,
isTemplateOrTemplatePart,
isTemplateRemovable,
} from '../utils';
import type { Pattern, Template, TemplatePart } from '../../types';
import type { NoticeSettings } from '../../mutation';
import { deletePostWithNotices } from '../../mutation';
import { unlock } from '../../lock-unlock';
} from './utils';
import type { Pattern, Template, TemplatePart } from '../types';
import type { NoticeSettings } from '../mutation';
import { deletePostWithNotices } from '../mutation';
import { unlock } from '../lock-unlock';

const { PATTERN_TYPES } = unlock( patternsPrivateApis );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import type { Action } from '@wordpress/dataviews';
/**
* Internal dependencies
*/
import { unlock } from '../../lock-unlock';
import type { Pattern } from '../../types';
import { unlock } from '../lock-unlock';
import type { Pattern } from '../types';

// Patterns.
const { CreatePatternModalContents, useDuplicatePatternProps } =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import type { Action } from '@wordpress/dataviews';
/**
* Internal dependencies
*/
import { titleField } from '../../fields';
import type { BasePost, CoreDataError } from '../../types';
import { getItemTitle } from '../utils';
import { titleField } from '../fields';
import type { BasePost, CoreDataError } from '../types';
import { getItemTitle } from './utils';

const fields = [ titleField ];
const formDuplicateAction = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import type { Action } from '@wordpress/dataviews';
/**
* Internal dependencies
*/
import type { Pattern } from '../../types';
import { getItemTitle } from '../utils';
import type { Pattern } from '../types';
import { getItemTitle } from './utils';

function getJsonFromItem( item: Pattern ) {
return JSON.stringify(
Expand Down
19 changes: 15 additions & 4 deletions packages/fields/src/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
export * from './base-post';
export * from './common';
export * from './pattern';
export * from './template';
export { default as viewPost } from './view-post';
export { default as reorderPage } from './reorder-page';
export { default as reorderPageNative } from './reorder-page.native';
export { default as duplicatePost } from './duplicate-post';
export { default as duplicatePostNative } from './duplicate-post.native';
export { default as renamePost } from './rename-post';
export { default as resetPost } from './reset-post';
export { default as duplicatePattern } from './duplicate-pattern';
export { default as exportPattern } from './export-pattern';
export { default as exportPatternNative } from './export-pattern.native';
export { default as viewPostRevisions } from './view-post-revisions';
export { default as permanentlyDeletePost } from './permanently-delete-post';
export { default as restorePost } from './restore-post';
export { default as trashPost } from './trash-post';
export { default as deletePost } from './delete-post';
3 changes: 0 additions & 3 deletions packages/fields/src/actions/pattern/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { trash } from '@wordpress/icons';
/**
* Internal dependencies
*/
import { getItemTitle, isTemplateOrTemplatePart } from '../utils';
import type { CoreDataError, PostWithPermissions } from '../../types';
import { getItemTitle, isTemplateOrTemplatePart } from './utils';
import type { CoreDataError, PostWithPermissions } from '../types';

const permanentlyDeletePost: Action< PostWithPermissions > = {
id: 'permanently-delete',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { store as noticesStore } from '@wordpress/notices';
* Internal dependencies
*/

import { unlock } from '../../lock-unlock';
import { unlock } from '../lock-unlock';
import {
getItemTitle,
isTemplateRemovable,
Expand All @@ -29,8 +29,8 @@ import {
TEMPLATE_ORIGINS,
TEMPLATE_PART_POST_TYPE,
TEMPLATE_POST_TYPE,
} from '../utils';
import type { CoreDataError, PostWithPermissions } from '../../types';
} from './utils';
import type { CoreDataError, PostWithPermissions } from '../types';

// Patterns.
const { PATTERN_TYPES } = unlock( patternsPrivateApis );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import type { Action, RenderModalProps } from '@wordpress/dataviews';
/**
* Internal dependencies
*/
import type { CoreDataError, BasePost } from '../../types';
import { orderField } from '../../fields';
import type { CoreDataError, BasePost } from '../types';
import { orderField } from '../fields';

const fields = [ orderField ];
const formOrderAction = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import {
isTemplateOrTemplatePart,
TEMPLATE_ORIGINS,
TEMPLATE_POST_TYPE,
} from '../utils';
import type { CoreDataError, Template, TemplatePart } from '../../types';
} from './utils';
import type { CoreDataError, Template, TemplatePart } from '../types';

const isTemplateRevertable = (
templateOrTemplatePart: Template | TemplatePart
Expand Down Expand Up @@ -180,8 +180,8 @@ const revertTemplate = async (
}
};

const resetTemplateAction: Action< Template | TemplatePart > = {
id: 'reset-template',
const resetPostAction: Action< Template | TemplatePart > = {
id: 'reset-post',
label: __( 'Reset' ),
isEligible: ( item ) => {
return (
Expand Down Expand Up @@ -297,4 +297,4 @@ const resetTemplateAction: Action< Template | TemplatePart > = {
},
};

export default resetTemplateAction;
export default resetPostAction;
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import type { Action } from '@wordpress/dataviews';
/**
* Internal dependencies
*/
import { getItemTitle, isTemplateOrTemplatePart } from '../utils';
import type { CoreDataError, PostWithPermissions } from '../../types';
import { getItemTitle, isTemplateOrTemplatePart } from './utils';
import type { CoreDataError, PostWithPermissions } from '../types';

const restorePost: Action< PostWithPermissions > = {
id: 'restore',
Expand Down
1 change: 0 additions & 1 deletion packages/fields/src/actions/template/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import type { Action } from '@wordpress/dataviews';
/**
* Internal dependencies
*/
import { getItemTitle, isTemplateOrTemplatePart } from '../utils';
import type { CoreDataError, PostWithPermissions } from '../../types';
import { getItemTitle, isTemplateOrTemplatePart } from './utils';
import type { CoreDataError, PostWithPermissions } from '../types';

const trashPost: Action< PostWithPermissions > = {
id: 'move-to-trash',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { Action } from '@wordpress/dataviews';
/**
* Internal dependencies
*/
import type { Post } from '../../types';
import type { Post } from '../types';

const viewPostRevisions: Action< Post > = {
id: 'view-post-revisions',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { Action } from '@wordpress/dataviews';
/**
* Internal dependencies
*/
import type { BasePost } from '../../types';
import type { BasePost } from '../types';

const viewPost: Action< BasePost > = {
id: 'view-post',
Expand Down
4 changes: 2 additions & 2 deletions packages/fields/src/index.native.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './actions/base-post/duplicate-post.native';
export * from './actions/base-post/reorder-page.native';
export * from './actions/duplicate-post.native';
export * from './actions/reorder-page.native';

0 comments on commit 5a4fb59

Please sign in to comment.