Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions notNeededPackages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6495,6 +6495,14 @@
"libraryName": "@wordpress/blob",
"asOfVersion": "2.8.0"
},
"wordpress__block-serialization-default-parser": {
"libraryName": "@wordpress/block-serialization-default-parser",
"asOfVersion": "4.17.0"
},
"wordpress__components": {
"libraryName": "@wordpress/components",
"asOfVersion": "23.8.0"
},
"wordpress__compose": {
"libraryName": "@wordpress/compose",
"asOfVersion": "6.1.0"
Expand All @@ -6511,10 +6519,22 @@
"libraryName": "@wordpress/data-controls",
"asOfVersion": "3.0.0"
},
"wordpress__date": {
"libraryName": "@wordpress/date",
"asOfVersion": "3.15.0"
},
"wordpress__dependency-extraction-webpack-plugin": {
"libraryName": "@wordpress/dependency-extraction-webpack-plugin",
"asOfVersion": "2.7.0"
},
"wordpress__deprecated": {
"libraryName": "@wordpress/deprecated",
"asOfVersion": "2.11.0"
},
"wordpress__dom": {
"libraryName": "@wordpress/dom",
"asOfVersion": "2.18.0"
},
"wordpress__dom-ready": {
"libraryName": "@wordpress/dom-ready",
"asOfVersion": "2.9.0"
Expand Down Expand Up @@ -6547,10 +6567,30 @@
"libraryName": "@wordpress/jest-console",
"asOfVersion": "5.2.0"
},
"wordpress__keycodes": {
"libraryName": "@wordpress/keycodes",
"asOfVersion": "2.18.0"
},
"wordpress__notices": {
"libraryName": "@wordpress/notices",
"asOfVersion": "4.0.0"
},
"wordpress__plugins": {
"libraryName": "@wordpress/plugins",
"asOfVersion": "6.0.0"
},
"wordpress__priority-queue": {
"libraryName": "@wordpress/priority-queue",
"asOfVersion": "1.6.0"
},
"wordpress__redux-routine": {
"libraryName": "@wordpress/redux-routine",
"asOfVersion": "4.2.0"
},
"wordpress__rich-text": {
"libraryName": "@wordpress/rich-text",
"asOfVersion": "6.10.0"
},
"wordpress__token-list": {
"libraryName": "@wordpress/token-list",
"asOfVersion": "1.10.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Dashicon } from "@wordpress/components";
import { ComponentType, JSX } from "react";
import { IconType } from "@wordpress/components";
import { ComponentType } from "react";

declare namespace AlignmentToolbar {
interface Props {
alignmentControls?:
| Array<{
align: string;
icon: Dashicon.Icon | JSX.Element;
icon: IconType;
title: string;
}>
| undefined;
Expand Down
15 changes: 11 additions & 4 deletions types/wordpress__block-editor/components/block-controls.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { Slot, Toolbar } from "@wordpress/components";
import { FC, JSX, ReactNode } from "react";
import { Slot, ToolbarGroup } from "@wordpress/components";
import { ComponentProps, FC, JSX, ReactNode } from "react";

type GetArrayTypeFromPossibleNestedArray<TestType extends Record<string, unknown> | Array<Record<string, unknown>>> =
TestType extends Array<Record<string, unknown>> ? TestType[number] : TestType;
type BlockControlControlsType = GetArrayTypeFromPossibleNestedArray<
NonNullable<Parameters<typeof ToolbarGroup>[0]["controls"]>[number]
>;

declare namespace BlockControls {
type BlockControlGroup =
Expand All @@ -9,14 +15,15 @@ declare namespace BlockControls {
| "other"
| "parent";

interface Props extends Pick<Toolbar.Props, "controls"> {
interface Props {
controls?: Array<BlockControlControlsType | BlockControlControlsType[]>;
children: ReactNode;
group?: BlockControlGroup | undefined;
}
}
declare const BlockControls: {
(props: BlockControls.Props): JSX.Element;
Slot: FC<Omit<Slot.Props, "name">>;
Slot: FC<Omit<ComponentProps<typeof Slot>, "name">>;
};

export default BlockControls;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Slot } from "@wordpress/components";
import { FC, JSX, ReactNode } from "react";
import { ComponentProps, FC, JSX, ReactNode } from "react";

declare namespace BlockFormatControls {
interface Props {
Expand All @@ -8,7 +8,7 @@ declare namespace BlockFormatControls {
}
declare const BlockFormatControls: {
(props: BlockFormatControls.Props): JSX.Element;
Slot: FC<Omit<Slot.Props, "name">>;
Slot: FC<Omit<ComponentProps<typeof Slot>, "name">>;
};

export default BlockFormatControls;
4 changes: 2 additions & 2 deletions types/wordpress__block-editor/components/block-icon.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Icon } from "@wordpress/components";
import { IconType } from "@wordpress/components";
import { ComponentType } from "react";

declare namespace BlockIcon {
interface Props {
className?: string | undefined;
icon: Icon.Props<any>["icon"];
icon: IconType | null;
showColors?: boolean | undefined;
}
}
Expand Down
6 changes: 3 additions & 3 deletions types/wordpress__block-editor/components/font-sizes.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { FontSizePicker as FSP } from "@wordpress/components";
import { ComponentType } from "react";
import { FontSizePicker as FSP } from "@wordpress/components/";
import { ComponentProps, ComponentType } from "react";

import { EditorFontSize } from "../";

export namespace FontSizePicker {
type Props = Omit<FSP.Props, "disableCustomFontSizes" | "fontSizes">;
type Props = Omit<ComponentProps<typeof FSP>, "disableCustomFontSizes" | "fontSizes">;
}
export const FontSizePicker: ComponentType<FontSizePicker.Props>;

Expand Down
4 changes: 2 additions & 2 deletions types/wordpress__block-editor/components/inserter.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Dropdown } from "@wordpress/components";
import { ComponentType } from "react";
import { ComponentProps, ComponentType } from "react";

declare namespace Inserter {
interface Props extends Partial<Pick<Dropdown.Props, "position" | "renderToggle">> {
interface Props extends Partial<Pick<ComponentProps<typeof Dropdown>, "position" | "renderToggle">> {
clientId?: string | undefined;
disabled?: boolean | undefined;
isAppender?: boolean | undefined;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Slot } from "@wordpress/components";
import { FC, JSX, ReactNode } from "react";
import { ComponentProps, FC, JSX, ReactNode } from "react";

declare namespace InspectorAdvancedControls {
interface Props {
Expand All @@ -8,7 +8,7 @@ declare namespace InspectorAdvancedControls {
}
declare const InspectorAdvancedControls: {
(props: InspectorAdvancedControls.Props): JSX.Element;
Slot: FC<Omit<Slot.Props, "name">>;
Slot: FC<Omit<ComponentProps<typeof Slot>, "name">>;
};

export default InspectorAdvancedControls;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Slot } from "@wordpress/components";
import { FC, JSX, ReactNode } from "react";
import { ComponentProps, FC, JSX, ReactNode } from "react";

declare namespace InspectorControls {
interface Props {
Expand All @@ -9,7 +9,7 @@ declare namespace InspectorControls {
}
declare const InspectorControls: {
(props: InspectorControls.Props): JSX.Element;
Slot: FC<Omit<Slot.Props, "name">>;
Slot: FC<Omit<ComponentProps<typeof Slot>, "name">>;
};

export default InspectorControls;
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint-disable @definitelytyped/no-unnecessary-generics */
import { Dashicon, DropZone } from "@wordpress/components";
import { ComponentType, JSX, MouseEventHandler } from "react";
import { DropZone, IconType } from "@wordpress/components";
import { ComponentProps, JSX, MouseEventHandler } from "react";

declare namespace MediaPlaceholder {
type MediaPlaceholderMultipleAction = "add";

interface Props<T extends boolean> extends Pick<DropZone.Props, "onHTMLDrop"> {
interface Props<T extends boolean> extends Pick<ComponentProps<typeof DropZone>, "onHTMLDrop"> {
/**
* A string passed to `FormFileUpload` that tells the browser which file types can be uploaded
* to the upload window the browser use e.g: `image#<{(|,video#<{(|`.
Expand Down Expand Up @@ -47,7 +47,7 @@ declare namespace MediaPlaceholder {
/**
* Icon to display left of the title.
*/
icon?: Dashicon.Icon | JSX.Element | undefined;
icon?: IconType | undefined;
/**
* If `true`, the property changes the look of the placeholder to be adequate to scenarios
* where new files are added to an already existing set of files, e.g., adding files to a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { NavigableMenu } from "@wordpress/components";
import { ComponentType } from "react";
import { ComponentProps, ComponentType } from "react";

declare namespace NavigableToolbar {
interface Props extends NavigableMenu.Props {
interface Props extends ComponentProps<typeof NavigableMenu> {
focusOnMount?: boolean | undefined;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ColorPalette, PanelBody } from "@wordpress/components";
import { ComponentType } from "react";
import { ComponentProps, ComponentType } from "react";

declare namespace PanelColorSettings {
type ColorSetting =
& Partial<ColorPalette.Props>
& Pick<ColorPalette.Props, "onChange" | "value">
& Partial<ComponentProps<typeof ColorPalette>>
& Pick<ComponentProps<typeof ColorPalette>, "onChange" | "value">
& { label: string };
interface Props extends Omit<PanelBody.Props, "children"> {
interface Props extends Omit<ComponentProps<typeof PanelBody>, "children"> {
colorSettings: ColorSetting[];
disableCustomColors?: boolean | undefined;
}
Expand Down
6 changes: 3 additions & 3 deletions types/wordpress__block-editor/components/rich-text.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { BlockInstance } from "@wordpress/blocks";
import { Autocomplete, ToolbarButton } from "@wordpress/components";
import { displayShortcut, rawShortcut } from "@wordpress/keycodes";
import { ComponentType, HTMLProps, JSX, ReactNode } from "react";
import { ComponentProps, ComponentType, HTMLProps, JSX } from "react";

declare namespace RichText {
interface Props<T extends keyof HTMLElementTagNameMap> extends Omit<HTMLProps<T>, "onChange"> {
Expand All @@ -14,7 +14,7 @@ declare namespace RichText {
/**
* A list of autocompleters to use instead of the default.
*/
autocompleters?: Array<Autocomplete.Completer<any>> | undefined;
autocompleters?: ComponentProps<typeof Autocomplete>["completers"] | undefined;
children?: never | undefined;
className?: string | undefined;
identifier?: string | undefined;
Expand Down Expand Up @@ -94,7 +94,7 @@ export namespace RichTextShortcut {
export const RichTextShortcut: ComponentType<RichTextShortcut.Props>;

export namespace RichTextToolbarButton {
interface Props extends ToolbarButton.Props {
interface Props extends ComponentProps<typeof ToolbarButton> {
name?: string | undefined;
shortcutType?: keyof typeof displayShortcut | undefined;
shortcutCharacter?: string | undefined;
Expand Down
6 changes: 3 additions & 3 deletions types/wordpress__block-editor/components/url-popover.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Popover } from "@wordpress/components";
import { ComponentType, JSX, ReactNode } from "react";
import { ComponentProps, ComponentType, JSX, ReactNode } from "react";

declare namespace URLPopover {
interface Props extends Popover.Props {
type Props = ComponentProps<typeof Popover> & {
Comment thread
rafaucau marked this conversation as resolved.
additionalControls?: ReactNode | undefined;
/**
* Callback used to return the React Elements that will be rendered inside the settings
* drawer. When this function is provided, a toggle button will be rendered in the popover
* that allows the user to open and close the settings drawer.
*/
renderSettings?(): JSX.Element;
}
};
}
declare const URLPopover: ComponentType<URLPopover.Props>;

Expand Down
4 changes: 2 additions & 2 deletions types/wordpress__block-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"dependencies": {
"@types/react": "*",
"@types/wordpress__blocks": "*",
"@types/wordpress__components": "*",
"@types/wordpress__keycodes": "*",
"@wordpress/data": "^9.13.0",
"@wordpress/components": "^27.2.0",
"@wordpress/element": "^5.0.0",
"@wordpress/keycodes": "^3.54.0",
"react-autosize-textarea": "^7.1.0"
},
"devDependencies": {
Expand Down
35 changes: 29 additions & 6 deletions types/wordpress__block-editor/wordpress__block-editor-tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,18 @@ const STYLES = [{ css: ".foo { color: red; }" }, { css: ".bar { color: blue; }",
<be.BlockControls
controls={[
{
icon: "yes",
icon: "admin-appearance",
title: "Yes",
onClick() {},
shortcut: {
display: "Yes",
},
isDisabled: false,
},
{
icon: "no",
icon: null,
title: "No",
onClick() {},
subscript: "no",
isActive: false,
shortcut: "No",
isDisabled: false,
},
]}
>
Expand All @@ -67,6 +64,29 @@ const STYLES = [{ css: ".foo { color: red; }" }, { css: ".bar { color: blue; }",
<be.BlockControls group="block">Hello World</be.BlockControls>;
<be.BlockControls.Slot />;

<be.BlockControls
controls={[[
{
icon: "admin-appearance",
title: "Yes",
subscript: "Yes",
onClick() {},
isActive: false,
isDisabled: false,
},
{
icon: null,
title: "No",
onClick() {},
subscript: "no",
isActive: false,
isDisabled: false,
},
]]}
>
Hello World
</be.BlockControls>;

//
// BlockEditorProvider
//
Expand Down Expand Up @@ -344,6 +364,9 @@ be.withFontSizes("fontSize")(() => <h1>Hello World</h1>);
shortcutType="primary"
shortcutCharacter="b"
onClick={() => console.log("Hello World")}
placeholder="Hello World"
onPointerEnterCapture={() => console.log("Hello World")}
onPointerLeaveCapture={() => console.log("Hello World")}
/>;

//
Expand Down

This file was deleted.

This file was deleted.

Loading