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
12 changes: 12 additions & 0 deletions notNeededPackages.json
Original file line number Diff line number Diff line change
Expand Up @@ -8279,6 +8279,10 @@
"libraryName": "@wordpress/block-serialization-default-parser",
"asOfVersion": "4.17.0"
},
"wordpress__blocks": {
"libraryName": "@wordpress/blocks",
"asOfVersion": "15.17.0"
},
"wordpress__components": {
"libraryName": "@wordpress/components",
"asOfVersion": "23.8.0"
Expand Down Expand Up @@ -8391,6 +8395,14 @@
"libraryName": "@wordpress/url",
"asOfVersion": "2.14.0"
},
"wordpress__viewport": {
"libraryName": "@wordpress/viewport",
"asOfVersion": "6.44.0"
},
"wordpress__wordcount": {
"libraryName": "@wordpress/wordcount",
"asOfVersion": "4.32.0"
},
"words-to-numbers": {
"libraryName": "words-to-numbers",
"asOfVersion": "1.3.0"
Expand Down
12 changes: 12 additions & 0 deletions types/mapbox__geojson-rewind/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { Feature, FeatureCollection, Geometry } from "geojson";

/**
* The GeoJSON specification is [picky about winding order](https://tools.ietf.org/html/rfc7946#section-3.1.6).
* This function helps you generate compliant Polygon and MultiPolygon geometries.
*
* @param feature GeoJSON {@link FeatureCollection}, {@link Feature}, or {@link Geometry}. ⚠️**This object is mutated.**⚠️
* @param clockwise if true, the outer ring is clockwise, otherwise it is counterclockwise.
*/
declare function rewind<T extends Feature | FeatureCollection | Geometry>(feature: T, clockwise?: boolean): T;

export = rewind;
16 changes: 16 additions & 0 deletions types/mapbox__geojson-rewind/mapbox__geojson-rewind-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import geojsonRewind from "@mapbox/geojson-rewind";
import type { Feature, MultiPolygon, Polygon } from "geojson";

let mp!: MultiPolygon;
let lineFeature!: Feature<Polygon>;

// $ExpectType MultiPolygon
const mp_output = geojsonRewind(mp, true);

// $ExpectType Feature<Polygon, GeoJsonProperties>
const lineFeature_output = geojsonRewind(lineFeature, true);

const myLine: Polygon = { type: "Polygon", coordinates: [[[-36, 174], [-36, 175]]] };

// $ExpectType Polygon
geojsonRewind(myLine);
20 changes: 20 additions & 0 deletions types/mapbox__geojson-rewind/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"private": true,
"name": "@types/mapbox__geojson-rewind",
"version": "0.5.9999",
"projects": [
"https://github.com/mapbox/geojson-rewind"
],
"dependencies": {
"@types/geojson": "*"
},
"devDependencies": {
"@types/mapbox__geojson-rewind": "workspace:."
},
"owners": [
{
"name": "Kyle Hensel",
"githubUsername": "k-yle"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"wordpress__wordcount-tests.ts"
"mapbox__geojson-rewind-tests.ts"
]
}
7 changes: 5 additions & 2 deletions types/wordpress__block-editor/components/inner-blocks.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { BlockAttributes, TemplateArray } from "@wordpress/blocks";
import { Block } from "@wordpress/blocks";
import { ComponentType, JSX, ReactElement, Ref } from "react";

import { EditorTemplateLock } from "../";

import { Merged, Reserved } from "./use-block-props";

type Template = readonly [string, Readonly<Record<string, unknown>>?, TemplateArray?];
type TemplateArray = ReadonlyArray<Template>;

declare namespace InnerBlocks {
interface Props {
allowedBlocks?: string[] | boolean | undefined;
Expand Down Expand Up @@ -63,7 +66,7 @@ declare namespace InnerBlocks {
*/
defaultBlock?: {
name: string;
attributes?: BlockAttributes;
attributes?: Block["attributes"];
} | undefined;

/**
Expand Down
8 changes: 4 additions & 4 deletions types/wordpress__block-editor/components/provider.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BlockInstance } from "@wordpress/blocks";
import { Block } from "@wordpress/blocks";
import { ComponentType, ReactNode } from "react";

import { EditorBlockListSettings, EditorSettings } from "../";
Expand Down Expand Up @@ -27,20 +27,20 @@ declare namespace BlockEditorProvider {
* be reflected immediately (`onInput`), you may only want history entries to reflect change
* milestones (`onChange`).
*/
onChange?(blocks: BlockInstance[]): void;
onChange?(blocks: Block[]): void;
/**
* A callback invoked when the blocks have been modified in a non-persistent manner.
* Contrasted with `onChange`, a "non-persistent" change is one which is part of a composed
* input. Any sequence of updates to the same block attribute are treated as non-persistent,
* except for the first.
*/
onInput?(blocks: BlockInstance[]): void;
onInput?(blocks: Block[]): void;
settings?: Partial<EditorSettings & EditorBlockListSettings> | undefined;
useSubRegistry?: boolean | undefined;
/**
* The current array of blocks.
*/
value?: BlockInstance[] | undefined;
value?: Block[] | undefined;
}
}
declare const BlockEditorProvider: ComponentType<BlockEditorProvider.Props>;
Expand Down
4 changes: 2 additions & 2 deletions types/wordpress__block-editor/components/rich-text.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @definitelytyped/no-unnecessary-generics */
import { BlockInstance } from "@wordpress/blocks";
import { Block } from "@wordpress/blocks";
import { Autocomplete, ToolbarButton } from "@wordpress/components";
import { displayShortcut, rawShortcut } from "@wordpress/keycodes";
import { ComponentProps, ComponentType, HTMLProps, JSX } from "react";
Expand Down Expand Up @@ -46,7 +46,7 @@ declare namespace RichText {
/**
* Called when the `RichText` instance can be replaced with the given blocks.
*/
onReplace?(blocks: BlockInstance[]): void;
onReplace?(blocks: Block[]): void;
/**
* Called when the content can be split, where `value` is a piece of content being split
* off. Here you should create a new block with that content and return it. Note that you
Expand Down
4 changes: 2 additions & 2 deletions types/wordpress__block-editor/hooks/use-typography-props.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BlockAttributes } from "@wordpress/blocks";
import { Block } from "@wordpress/blocks";
import { GlobalStylesSettings } from "@wordpress/global-styles-engine";

/**
Expand All @@ -12,6 +12,6 @@ import { GlobalStylesSettings } from "@wordpress/global-styles-engine";
* @return Typography block support derived CSS classes & styles.
*/
export function getTypographyClassesAndStyles(
attributes: BlockAttributes,
attributes: Block["attributes"],
fluidTypographySettings?: { minFontSize?: string } | GlobalStylesSettings | boolean,
): { className: string; style: Record<string, string> };
4 changes: 2 additions & 2 deletions types/wordpress__block-editor/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BlockIconNormalized } from "@wordpress/blocks";
import { BlockTypeIconDescriptor } from "@wordpress/blocks";
import { ReduxStoreConfig, StoreDescriptor } from "@wordpress/data";

export * from "./components";
Expand Down Expand Up @@ -75,7 +75,7 @@ export interface EditorInserterItem {
/**
* Icon for the item, as it appears in the inserter.
*/
icon: BlockIconNormalized;
icon: BlockTypeIconDescriptor;
/**
* Block category that the item is associated with.
*/
Expand Down
2 changes: 1 addition & 1 deletion types/wordpress__block-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"dependencies": {
"@types/react": "^18",
"@types/wordpress__blocks": "*",
"@wordpress/blocks": "^15.17.0",
"@wordpress/components": "^30.9.0",
"@wordpress/data": "^10.36.0",
"@wordpress/element": "^6.36.0",
Expand Down
18 changes: 9 additions & 9 deletions types/wordpress__block-editor/store/actions.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BlockInstance } from "@wordpress/blocks";
import { Block } from "@wordpress/blocks";

import { EditorBlockListSettings, EditorSettings } from "../";

Expand Down Expand Up @@ -33,7 +33,7 @@ export function hideInsertionPoint(): void;
* will not change. Defaults to true.
*/
export function insertBlock(
block: BlockInstance,
block: Block,
index?: number,
rootClientId?: string,
updateSelection?: boolean,
Expand All @@ -50,7 +50,7 @@ export function insertBlock(
* not change. Defaults to `true`.
*/
export function insertBlocks(
blocks: BlockInstance[],
blocks: Block[],
index?: number,
rootClientId?: string,
updateSelection?: boolean,
Expand Down Expand Up @@ -107,7 +107,7 @@ export function multiSelect(start: string, end: string): void;
*
* @param blocks - Array of block instances.
*/
export function receiveBlocks(blocks: BlockInstance[]): void;
export function receiveBlocks(blocks: Block[]): void;

/**
* Signals that the block with the specified client ID is to be removed.
Expand All @@ -133,7 +133,7 @@ export function removeBlocks(clientIds: string | string[], selectPrevious?: bool
* @param clientId - Block client ID to replace.
* @param block - Replacement block(s).
*/
export function replaceBlock(clientId: string | string[], block: BlockInstance | BlockInstance[]): void;
export function replaceBlock(clientId: string | string[], block: Block | Block[]): void;

/**
* Signals that a blocks should be replaced with one or more replacement blocks.
Expand All @@ -144,7 +144,7 @@ export function replaceBlock(clientId: string | string[], block: BlockInstance |
*/
export function replaceBlocks(
clientIds: string | string[],
blocks: BlockInstance | BlockInstance[],
blocks: Block | Block[],
indexToSelect?: number,
): IterableIterator<void>;

Expand All @@ -156,15 +156,15 @@ export function replaceBlocks(
* @param updateSelection - If `true` block selection will be updated. If `false`, block selection
* will not change. Defaults to `true`.
*/
export function replaceInnerBlocks(rootClientId: string, blocks: BlockInstance[], updateSelection?: boolean): void;
export function replaceInnerBlocks(rootClientId: string, blocks: Block[], updateSelection?: boolean): void;

/**
* Returns an action object used in signalling that blocks state should be reset to the specified
* array of blocks, taking precedence over any other content reflected as an edit in state.
*
* @param blocks - Array of blocks.
*/
export function resetBlocks(blocks: BlockInstance[]): void;
export function resetBlocks(blocks: Block[]): void;

/**
* Signals that the block with the specified client ID has been selected, optionally accepting a
Expand Down Expand Up @@ -262,7 +262,7 @@ export function toggleSelection(isSelectionEnabled?: boolean): void;
* @param clientId - Block client ID.
* @param updates - Block attributes to be merged.
*/
export function updateBlock(clientId: string, updates: Partial<BlockInstance>): void;
export function updateBlock(clientId: string, updates: Partial<Block>): void;

/**
* Signals that the block attributes with the specified client ID has been updated.
Expand Down
12 changes: 6 additions & 6 deletions types/wordpress__block-editor/store/selectors.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BlockInstance } from "@wordpress/blocks";
import { Block } from "@wordpress/blocks";

import { EditorBlockListSettings, EditorBlockMode, EditorInserterItem, EditorSelection, EditorSettings } from "../";

Expand Down Expand Up @@ -33,7 +33,7 @@ export function getAdjacentBlockClientId(startClientId?: string, modifier?: 1 |
*
* @returns Parsed block object.
*/
export function getBlock(clientId: string): BlockInstance | null;
export function getBlock(clientId: string): Block | null;

/**
* Returns a block's attributes given its client ID, or null if no block exists with the client ID.
Expand Down Expand Up @@ -182,14 +182,14 @@ export function getBlockSelectionStart(): string | undefined;
*
* @returns Post blocks.
*/
export function getBlocks(rootClientId?: string): BlockInstance[];
export function getBlocks(rootClientId?: string): Block[];

/**
* Given an array of block client IDs, returns the corresponding array of block objects or `null`.
*
* @param clientIds - Client IDs for which blocks are to be returned.
*/
export function getBlocksByClientId(clientIds: string | string[]): Array<BlockInstance | null>;
export function getBlocksByClientId(clientIds: string | string[]): Array<Block | null>;

/**
* Returns all blocks that match a blockName. Results include nested blocks.
Expand Down Expand Up @@ -284,7 +284,7 @@ export function getMultiSelectedBlockClientIds(): string[];
*
* @returns Multi-selected block objects.
*/
export function getMultiSelectedBlocks(): BlockInstance[];
export function getMultiSelectedBlocks(): Block[];

/**
* Returns the client ID of the block which ends the multi-selection set, or `null` if there is no
Expand Down Expand Up @@ -335,7 +335,7 @@ export function getPreviousBlockClientId(startClientId?: string): string | null;
*
* @returns Selected block.
*/
export function getSelectedBlock(): BlockInstance | null;
export function getSelectedBlock(): Block | null;

/**
* Returns the currently selected block client ID, or `null` if there is no selected block.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import be from "@wordpress/block-editor";
import * as UseBlockProps from "@wordpress/block-editor/components/use-block-props";
import { BlockInstance, createBlock } from "@wordpress/blocks";
import { Block, createBlock } from "@wordpress/blocks";
import { dispatch, select, useDispatch, useSelect } from "@wordpress/data";
import { useRef } from "react";

declare const BLOCK_INSTANCE: BlockInstance;
declare const BLOCK_INSTANCE: Block;

const COLORS = [{ name: "Red", slug: "red", color: "#ff0000" }, { name: "Blue", slug: "blue", color: "#0000ff" }];
const FONT_SIZES = [{ name: "Small", slug: "small", size: 12 }, { name: "Large", slug: "large", size: 18 }];
Expand Down
5 changes: 0 additions & 5 deletions types/wordpress__blocks/.eslintrc.json

This file was deleted.

24 changes: 0 additions & 24 deletions types/wordpress__blocks/api/categories.d.ts

This file was deleted.

Loading