Repository navigation
Block Editor: PR 14: Convert InspectorControls to TypeScript #84725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f1d5a92
5de39ee
dce76e4
fd344eb
11d0eaf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import type { ElementType, ReactNode, RefObject } from 'react'; | ||
| import type { createSlotFill } from '@wordpress/components'; | ||
| import type { ResetAllContext, ResetAllFilter } from '../../hooks/types'; | ||
|
|
||
| /** | ||
| * A slot and fill pair. | ||
| */ | ||
| export type SlotFill = ReturnType< typeof createSlotFill >; | ||
|
|
||
| /** | ||
| * Props of `InspectorControls`. | ||
| */ | ||
| export interface InspectorControlsFillProps { | ||
| children?: ReactNode; | ||
| group?: string; | ||
| resetAllFilter?: ResetAllFilter; | ||
| } | ||
|
|
||
| /** | ||
| * Props of `InspectorControls.Slot`. | ||
| */ | ||
| export interface InspectorControlsSlotProps { | ||
| group?: string; | ||
| label?: string; | ||
| fillProps?: Record< string, unknown >; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, thanks. Fixed in 11d0eaf |
||
| [ prop: string ]: unknown; | ||
| } | ||
|
|
||
| /** | ||
| * Context providers, with their props, that a slot forwards to its fills. | ||
| */ | ||
| export type ForwardedContext = Array< | ||
| [ ElementType, Record< string, unknown > ] | ||
| >; | ||
|
|
||
| /** | ||
| * Props of the slot that forwards the tools panel context to its fills. | ||
| */ | ||
| export interface BlockSupportSlotContainerProps { | ||
| Slot: SlotFill[ 'Slot' ]; | ||
| fillProps?: { | ||
| forwardedContext?: ForwardedContext; | ||
| [ prop: string ]: unknown; | ||
| }; | ||
| [ prop: string ]: unknown; | ||
| } | ||
|
|
||
| /** | ||
| * A reset-all filter the block support tools panel runs for each block. | ||
| */ | ||
| export type BlockSupportResetAllFilter = ( | ||
| attributes: Record< string, unknown >, | ||
| context: ResetAllContext | ||
| ) => Record< string, unknown > | undefined; | ||
|
|
||
| /** | ||
| * Props of the component that registers a fill's reset-all filter. | ||
| */ | ||
| export interface RegisterResetAllProps { | ||
| resetAllFilter?: ResetAllFilter; | ||
| children?: ReactNode; | ||
| } | ||
|
|
||
| /** | ||
| * Props of the fill content rendered inside a block support tools panel. | ||
| */ | ||
| export interface ToolsPanelInspectorControlProps { | ||
| children?: ReactNode; | ||
| resetAllFilter?: ResetAllFilter; | ||
| fillProps: { forwardedContext?: ForwardedContext }; | ||
| } | ||
|
|
||
| /** | ||
| * Props of the tools panel that wraps a labelled InspectorControls slot. | ||
| */ | ||
| export interface BlockSupportToolsPanelProps { | ||
| children?: ReactNode; | ||
| group: string; | ||
| label: string; | ||
| } | ||
|
|
||
| /** | ||
| * Props of the List View content popover. | ||
| */ | ||
| export interface ListViewContentPopoverProps { | ||
| listViewRef: RefObject< HTMLElement >; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.