| 1 |
import "@wordpress/block-editor"; |
| 2 |
import { BlockAttributes } from "@wordpress/blocks"; |
| 3 |
import { WPUnitControlUnit } from "@wordpress/components/build-types/unit-control/types"; |
| 4 |
import { ComponentType, HTMLProps, ReactNode } from "react"; |
| 5 |
|
| 6 |
declare module "@wordpress/block-editor" { |
| 7 |
namespace InspectorControls { |
| 8 |
interface Props { |
| 9 |
group?: |
| 10 |
| "default" |
| 11 |
| "settings" |
| 12 |
| "advanced" |
| 13 |
| "position" |
| 14 |
| "border" |
| 15 |
| "color" |
| 16 |
| "dimensions" |
| 17 |
| "typography" |
| 18 |
| "styles" |
| 19 |
| "list"; |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
namespace BlockControls { |
| 24 |
interface Props { |
| 25 |
group?: "block" | "other"; |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
namespace HeightControl { |
| 30 |
interface Props { |
| 31 |
children?: never | undefined; |
| 32 |
onChange(newValue: string | undefined): void; |
| 33 |
value: string | undefined; |
| 34 |
label?: string; |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
const HeightControl: ComponentType<HeightControl.Props>; |
| 39 |
|
| 40 |
namespace AlignmentControl { |
| 41 |
interface Props { |
| 42 |
children?: never | undefined; |
| 43 |
onChange(newValue: string | undefined): void; |
| 44 |
value: string | undefined; |
| 45 |
label?: string; |
| 46 |
alignmentControls?: { |
| 47 |
align: string; |
| 48 |
icon: JSX.Element; |
| 49 |
title: string; |
| 50 |
}[]; |
| 51 |
describedBy?: string; |
| 52 |
isCollapsed?: boolean; |
| 53 |
isToolbar?: boolean; |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
const AlignmentControl: ComponentType<AlignmentControl.Props>; |
| 58 |
|
| 59 |
namespace __experimentalLinkControl { |
| 60 |
interface LinkControlValue { |
| 61 |
url?: string; |
| 62 |
opensInNewTab?: boolean; |
| 63 |
} |
| 64 |
interface Props { |
| 65 |
children?: never | undefined; |
| 66 |
searchInputPlaceholder?: string; |
| 67 |
value: LinkControlValue; |
| 68 |
settings?: { |
| 69 |
id: string; |
| 70 |
title: string; |
| 71 |
}; |
| 72 |
onChange?: (newValue: LinkControlValue) => void; |
| 73 |
onRemove?: () => void; |
| 74 |
onCancel?: () => void; |
| 75 |
noDirectEntry?: boolean; |
| 76 |
showSuggestions?: boolean; |
| 77 |
showInitialSuggestions?: boolean; |
| 78 |
forceIsEditingLink?: boolean; |
| 79 |
createSuggestion?: boolean; |
| 80 |
withCreateSuggestion?: boolean; |
| 81 |
inputValue?: string; |
| 82 |
suggestionsQuery?: object; |
| 83 |
noURLSuggestion?: boolean; |
| 84 |
createSuggestionButtonText?: string | (() => string); |
| 85 |
hasRichPreviews?: boolean; |
| 86 |
hasTextControl?: boolean; |
| 87 |
renderControlBottom?: any; |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
const __experimentalLinkControl: ComponentType<__experimentalLinkControl.Props>; |
| 92 |
|
| 93 |
namespace __experimentalBorderRadiusControl { |
| 94 |
interface Props { |
| 95 |
children?: never | undefined; |
| 96 |
values: |
| 97 |
| string |
| 98 |
| { |
| 99 |
topLeft: string; |
| 100 |
topRight: string; |
| 101 |
bottomLeft: string; |
| 102 |
bottomRight: string; |
| 103 |
}; |
| 104 |
onChange: (newValue: object) => void; |
| 105 |
} |
| 106 |
} |
| 107 |
|
| 108 |
const __experimentalBorderRadiusControl: ComponentType<__experimentalBorderRadiusControl.Props>; |
| 109 |
|
| 110 |
namespace __experimentalSpacingSizesControl { |
| 111 |
interface Props { |
| 112 |
children?: never | undefined; |
| 113 |
label: string; |
| 114 |
onMouseOver?: () => void; |
| 115 |
onMouseOut?: () => void; |
| 116 |
onChange: (newValue: any) => void; |
| 117 |
allowReset?: boolean; |
| 118 |
min?: number; |
| 119 |
splitOnAxis?: boolean; |
| 120 |
showSideInLabel?: boolean; |
| 121 |
units?: WPUnitControlUnit[]; |
| 122 |
values: Record<string, any>; |
| 123 |
sides?: string[]; |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
const __experimentalSpacingSizesControl: ComponentType<__experimentalSpacingSizesControl.Props>; |
| 128 |
|
| 129 |
namespace __experimentalFontFamilyControl { |
| 130 |
interface Props { |
| 131 |
children?: never | undefined; |
| 132 |
value?: string; |
| 133 |
onChange: (newValue?: string) => void; |
| 134 |
fontFamilies?: { |
| 135 |
fontFamily: string; |
| 136 |
name?: string; |
| 137 |
fontFace?: Record<string, any>[]; |
| 138 |
}[]; |
| 139 |
className?: string; |
| 140 |
size?: string; |
| 141 |
__next40pxDefaultSize?: boolean; |
| 142 |
__nextHasNoMarginBottom?: boolean; |
| 143 |
} |
| 144 |
} |
| 145 |
|
| 146 |
const __experimentalFontFamilyControl: ComponentType<__experimentalFontFamilyControl.Props>; |
| 147 |
|
| 148 |
namespace __experimentalFontAppearanceControl { |
| 149 |
interface Props { |
| 150 |
children?: never | undefined; |
| 151 |
value: { |
| 152 |
fontStyle?: string; |
| 153 |
fontWeight?: string; |
| 154 |
}; |
| 155 |
onChange: (newValue?: { |
| 156 |
fontStyle?: string; |
| 157 |
fontWeight?: string; |
| 158 |
}) => void; |
| 159 |
hasFontStyles?: boolean; |
| 160 |
hasFontWeights?: boolean; |
| 161 |
fontFamilyFaces?: Record<string, any>[]; |
| 162 |
size?: string; |
| 163 |
__next40pxDefaultSize?: boolean; |
| 164 |
} |
| 165 |
} |
| 166 |
|
| 167 |
const __experimentalFontAppearanceControl: ComponentType<__experimentalFontAppearanceControl.Props>; |
| 168 |
|
| 169 |
namespace __experimentalLetterSpacingControl { |
| 170 |
interface Props { |
| 171 |
children?: never | undefined; |
| 172 |
value?: string; |
| 173 |
onChange: (newValue?: string) => void; |
| 174 |
__unstableInputWidth?: string | number; |
| 175 |
size?: string; |
| 176 |
__next40pxDefaultSize?: boolean; |
| 177 |
} |
| 178 |
} |
| 179 |
|
| 180 |
const __experimentalLetterSpacingControl: ComponentType<__experimentalLetterSpacingControl.Props>; |
| 181 |
|
| 182 |
namespace __experimentalTextDecorationControl { |
| 183 |
interface Props { |
| 184 |
children?: never | undefined; |
| 185 |
value?: string; |
| 186 |
onChange: (newValue?: string) => void; |
| 187 |
className?: string; |
| 188 |
} |
| 189 |
} |
| 190 |
|
| 191 |
const __experimentalTextDecorationControl: ComponentType<__experimentalTextDecorationControl.Props>; |
| 192 |
|
| 193 |
namespace __experimentalTextTransformControl { |
| 194 |
interface Props { |
| 195 |
children?: never | undefined; |
| 196 |
value?: string; |
| 197 |
onChange: (newValue?: string) => void; |
| 198 |
className?: string; |
| 199 |
} |
| 200 |
} |
| 201 |
|
| 202 |
const __experimentalTextTransformControl: ComponentType<__experimentalTextTransformControl.Props>; |
| 203 |
|
| 204 |
namespace LineHeightControl { |
| 205 |
interface Props { |
| 206 |
children?: never | undefined; |
| 207 |
value?: string; |
| 208 |
onChange: (newValue?: string) => void; |
| 209 |
__unstableInputWidth?: string | number; |
| 210 |
size?: string; |
| 211 |
__next40pxDefaultSize?: boolean; |
| 212 |
} |
| 213 |
} |
| 214 |
|
| 215 |
const LineHeightControl: ComponentType<LineHeightControl.Props>; |
| 216 |
|
| 217 |
namespace __experimentalColorGradientSettingsDropdown { |
| 218 |
interface Props { |
| 219 |
children?: never | undefined; |
| 220 |
enableAlpha?: boolean; |
| 221 |
panelId?: string; |
| 222 |
title?: string; |
| 223 |
popoverProps?: Record<string, any>; |
| 224 |
settings?: Record<string, any>; |
| 225 |
} |
| 226 |
} |
| 227 |
|
| 228 |
const __experimentalColorGradientSettingsDropdown: ComponentType<__experimentalColorGradientSettingsDropdown.Props>; |
| 229 |
|
| 230 |
namespace __experimentalColorGradientControl { |
| 231 |
interface Props { |
| 232 |
children?: never | undefined; |
| 233 |
clearable?: boolean; |
| 234 |
colorValue?: string | null; |
| 235 |
colors?: Record<string, any>[]; |
| 236 |
disableCustomColors?: boolean; |
| 237 |
disableCustomGradients?: boolean; |
| 238 |
enableAlpha?: boolean; |
| 239 |
gradientValue?: string | null; |
| 240 |
gradients?: Record<string, any>[]; |
| 241 |
hasColorsOrGradients?: boolean; |
| 242 |
label?: string; |
| 243 |
onColorChange?: (newValue: string | undefined) => void; |
| 244 |
onGradientChange?: (newValue: string | undefined) => void; |
| 245 |
showTitle?: boolean; |
| 246 |
__experimentalIsRenderedInSidebar?: boolean; |
| 247 |
} |
| 248 |
} |
| 249 |
|
| 250 |
const __experimentalColorGradientControl: ComponentType<__experimentalColorGradientControl.Props>; |
| 251 |
|
| 252 |
namespace MediaReplaceFlow { |
| 253 |
interface Props { |
| 254 |
mediaURL: string; |
| 255 |
mediaId: number; |
| 256 |
onSelect: (newMedia: any) => void; |
| 257 |
name?: string; |
| 258 |
} |
| 259 |
} |
| 260 |
|
| 261 |
const MediaReplaceFlow: ComponentType<MediaReplaceFlow.Props>; |
| 262 |
|
| 263 |
namespace __experimentalImageURLInputUI { |
| 264 |
interface Props { |
| 265 |
url: string; |
| 266 |
onChangeUrl: (props: any) => void; |
| 267 |
linkDestination: string; |
| 268 |
mediaUrl: string; |
| 269 |
mediaLink: string; |
| 270 |
linkTarget: string; |
| 271 |
linkClass: string; |
| 272 |
rel: string; |
| 273 |
} |
| 274 |
} |
| 275 |
|
| 276 |
const __experimentalImageURLInputUI: ComponentType<__experimentalImageURLInputUI.Props>; |
| 277 |
|
| 278 |
namespace __experimentalImageEditor { |
| 279 |
interface Props { |
| 280 |
id: number | string; |
| 281 |
url: string; |
| 282 |
width?: number; |
| 283 |
height?: number; |
| 284 |
clientWidth?: number; |
| 285 |
naturalHeight?: number; |
| 286 |
naturalWidth?: number; |
| 287 |
onSaveImage: (imageAttributes: { id: number; url: string }) => void; |
| 288 |
onFinishEditing: () => void; |
| 289 |
} |
| 290 |
} |
| 291 |
|
| 292 |
const __experimentalImageEditor: ComponentType<__experimentalImageEditor.Props>; |
| 293 |
|
| 294 |
namespace MediaPlaceholder { |
| 295 |
interface Props<T extends boolean> { |
| 296 |
placeholder: (content: ReactNode) => JSX.Element; |
| 297 |
} |
| 298 |
} |
| 299 |
|
| 300 |
namespace RichText { |
| 301 |
interface Props<T extends keyof HTMLElementTagNameMap> |
| 302 |
extends Omit<HTMLProps<T>, "onChange"> { |
| 303 |
allowedFormats?: string[]; |
| 304 |
autocompleters?: any[]; |
| 305 |
identifier?: string; |
| 306 |
inlineToolbar?: boolean; |
| 307 |
keepPlaceholderOnFocus?: boolean; |
| 308 |
multiline?: boolean | keyof HTMLElementTagNameMap; |
| 309 |
onChange(value: string): void; |
| 310 |
onMerge?(forward: boolean): void; |
| 311 |
onRemove?(forward: boolean): void; |
| 312 |
/** |
| 313 |
* Called when the `RichText` instance can be replaced. |
| 314 |
* Relaxed to accept any[] to support custom autocompleters |
| 315 |
* that pass non-BlockInstance values through the "replace" action. |
| 316 |
*/ |
| 317 |
onReplace?(values: any[]): void; |
| 318 |
onSplit?(value: string, isOriginal?: boolean): void; |
| 319 |
onTagNameChange?(tagName: keyof HTMLElementTagNameMap): void; |
| 320 |
placeholder?: string; |
| 321 |
tagName?: T; |
| 322 |
value: string; |
| 323 |
wrapperClassName?: string; |
| 324 |
withoutInteractiveFormatting?: boolean; |
| 325 |
} |
| 326 |
} |
| 327 |
|
| 328 |
const RichText: { |
| 329 |
<T extends keyof HTMLElementTagNameMap = "div">( |
| 330 |
props: RichText.Props<T> |
| 331 |
): JSX.Element; |
| 332 |
Content<T extends keyof HTMLElementTagNameMap = "div">(props: { |
| 333 |
value: string; |
| 334 |
tagName?: T; |
| 335 |
multiline?: boolean | "p" | "li"; |
| 336 |
}): JSX.Element; |
| 337 |
isEmpty(value: string | string[]): boolean; |
| 338 |
}; |
| 339 |
|
| 340 |
namespace BlockControls { |
| 341 |
interface Props { |
| 342 |
__experimentalShareWithChildBlocks?: boolean; |
| 343 |
} |
| 344 |
} |
| 345 |
|
| 346 |
const useBlockEditContext: () => { |
| 347 |
name: string; |
| 348 |
isSelected: boolean; |
| 349 |
clientId: string; |
| 350 |
}; |
| 351 |
|
| 352 |
const __experimentalUseBorderProps: (attributes: BlockAttributes) => { |
| 353 |
className: string; |
| 354 |
style: { |
| 355 |
[key: string]: string; |
| 356 |
}; |
| 357 |
}; |
| 358 |
|
| 359 |
const __experimentalUseMultipleOriginColorsAndGradients: () => { |
| 360 |
colors: { |
| 361 |
name: string; |
| 362 |
colors: { |
| 363 |
name: string; |
| 364 |
slug: string; |
| 365 |
color: string; |
| 366 |
}[]; |
| 367 |
}[]; |
| 368 |
disableCustomColors: boolean; |
| 369 |
disableCustomGradients: boolean; |
| 370 |
gradients: { |
| 371 |
name: string; |
| 372 |
gradients: { |
| 373 |
gradient: string; |
| 374 |
name: string; |
| 375 |
slug: string; |
| 376 |
}[]; |
| 377 |
}[]; |
| 378 |
hasColorsOrGradients: boolean; |
| 379 |
}; |
| 380 |
|
| 381 |
const __experimentalGetElementClassName: (element: string) => string; |
| 382 |
|
| 383 |
/** |
| 384 |
* Type may be incomplete or incorrect |
| 385 |
*/ |
| 386 |
interface EditorSettings { |
| 387 |
__experimentalFeatures: { |
| 388 |
appearanceTools: boolean; |
| 389 |
useRootPaddingAwareAlignments: boolean; |
| 390 |
border: { |
| 391 |
color: boolean; |
| 392 |
radius: boolean; |
| 393 |
style: boolean; |
| 394 |
width: boolean; |
| 395 |
}; |
| 396 |
color: { |
| 397 |
background: boolean; |
| 398 |
button: boolean; |
| 399 |
caption: boolean; |
| 400 |
customDuotone: boolean; |
| 401 |
defaultDuotone: boolean; |
| 402 |
defaultGradients: boolean; |
| 403 |
defaultPalette: boolean; |
| 404 |
duotone: { |
| 405 |
default: { |
| 406 |
name: string; |
| 407 |
colors: string[]; |
| 408 |
slug: string; |
| 409 |
}[]; |
| 410 |
}; |
| 411 |
gradients: { |
| 412 |
default: { |
| 413 |
name: string; |
| 414 |
gradient: string; |
| 415 |
slug: string; |
| 416 |
}[]; |
| 417 |
theme: { |
| 418 |
name: string; |
| 419 |
gradient: string; |
| 420 |
slug: string; |
| 421 |
}[]; |
| 422 |
}; |
| 423 |
heading: boolean; |
| 424 |
link: boolean; |
| 425 |
palette: { |
| 426 |
default: { |
| 427 |
name: string; |
| 428 |
slug: string; |
| 429 |
color: string; |
| 430 |
}[]; |
| 431 |
theme: { |
| 432 |
name: string; |
| 433 |
slug: string; |
| 434 |
color: string; |
| 435 |
}[]; |
| 436 |
}; |
| 437 |
text: boolean; |
| 438 |
}; |
| 439 |
shadow: { |
| 440 |
defaultPresets: boolean; |
| 441 |
presets: { |
| 442 |
default: { |
| 443 |
name: string; |
| 444 |
slug: string; |
| 445 |
shadow: string; |
| 446 |
}[]; |
| 447 |
}; |
| 448 |
}; |
| 449 |
spacing: { |
| 450 |
blockGap: boolean; |
| 451 |
margin: boolean; |
| 452 |
spacingScale: { |
| 453 |
operator: string; |
| 454 |
increment: number; |
| 455 |
steps: number; |
| 456 |
mediumStep: number; |
| 457 |
unit: string; |
| 458 |
}; |
| 459 |
spacingSizes: { |
| 460 |
theme: { |
| 461 |
name: string; |
| 462 |
size: string; |
| 463 |
slug: string; |
| 464 |
}[]; |
| 465 |
default: { |
| 466 |
name: string; |
| 467 |
slug: string; |
| 468 |
size: string; |
| 469 |
}[]; |
| 470 |
}; |
| 471 |
}; |
| 472 |
typography: { |
| 473 |
dropCap: boolean; |
| 474 |
fontSizes: { |
| 475 |
default: { |
| 476 |
name: string; |
| 477 |
slug: string; |
| 478 |
size: string; |
| 479 |
}[]; |
| 480 |
theme: { |
| 481 |
name: string; |
| 482 |
size: string; |
| 483 |
slug: string; |
| 484 |
fluid: { |
| 485 |
min: string; |
| 486 |
max: string; |
| 487 |
}; |
| 488 |
}[]; |
| 489 |
}; |
| 490 |
fontStyle: boolean; |
| 491 |
fontWeight: boolean; |
| 492 |
letterSpacing: boolean; |
| 493 |
textDecoration: boolean; |
| 494 |
textTransform: boolean; |
| 495 |
writingMode: boolean; |
| 496 |
fluid: boolean; |
| 497 |
fontFamilies: { |
| 498 |
theme: { |
| 499 |
fontFamily: string; |
| 500 |
name: string; |
| 501 |
slug: string; |
| 502 |
fontFace?: { |
| 503 |
fontFamily: string; |
| 504 |
fontStretch: string; |
| 505 |
fontStyle: string; |
| 506 |
fontWeight: string; |
| 507 |
src: [string]; |
| 508 |
}[]; |
| 509 |
}[]; |
| 510 |
}; |
| 511 |
}; |
| 512 |
blocks: Record<string, any>; |
| 513 |
custom: { |
| 514 |
fontWeight: { |
| 515 |
"light": number; |
| 516 |
"regular": number; |
| 517 |
"medium": number; |
| 518 |
"semi-bold": number; |
| 519 |
"bold": number; |
| 520 |
"extra-bold": number; |
| 521 |
"black": number; |
| 522 |
}; |
| 523 |
lineHeight: { |
| 524 |
body: number; |
| 525 |
heading: number; |
| 526 |
medium: number; |
| 527 |
one: number; |
| 528 |
}; |
| 529 |
spacing: { |
| 530 |
gap: string; |
| 531 |
}; |
| 532 |
}; |
| 533 |
layout: { |
| 534 |
contentSize: string; |
| 535 |
wideSize: string; |
| 536 |
}; |
| 537 |
background: { |
| 538 |
backgroundImage: boolean; |
| 539 |
}; |
| 540 |
dimensions: { |
| 541 |
minHeight: boolean; |
| 542 |
}; |
| 543 |
position: { |
| 544 |
sticky: boolean; |
| 545 |
}; |
| 546 |
}; |
| 547 |
} |
| 548 |
} |
| 549 |
|