| 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 __experimentalColorGradientSettingsDropdown { |
| 130 |
interface Props { |
| 131 |
children?: never | undefined; |
| 132 |
enableAlpha?: boolean; |
| 133 |
panelId?: string; |
| 134 |
title?: string; |
| 135 |
popoverProps?: Record<string, any>; |
| 136 |
settings?: Record<string, any>; |
| 137 |
} |
| 138 |
} |
| 139 |
|
| 140 |
const __experimentalColorGradientSettingsDropdown: ComponentType<__experimentalColorGradientSettingsDropdown.Props>; |
| 141 |
|
| 142 |
namespace __experimentalColorGradientControl { |
| 143 |
interface Props { |
| 144 |
children?: never | undefined; |
| 145 |
clearable?: boolean; |
| 146 |
colorValue?: string | null; |
| 147 |
colors?: Record<string, any>[]; |
| 148 |
disableCustomColors?: boolean; |
| 149 |
disableCustomGradients?: boolean; |
| 150 |
enableAlpha?: boolean; |
| 151 |
gradientValue?: string | null; |
| 152 |
gradients?: Record<string, any>[]; |
| 153 |
hasColorsOrGradients?: boolean; |
| 154 |
label?: string; |
| 155 |
onColorChange?: (newValue: string | undefined) => void; |
| 156 |
onGradientChange?: (newValue: string | undefined) => void; |
| 157 |
showTitle?: boolean; |
| 158 |
__experimentalIsRenderedInSidebar?: boolean; |
| 159 |
} |
| 160 |
} |
| 161 |
|
| 162 |
const __experimentalColorGradientControl: ComponentType<__experimentalColorGradientControl.Props>; |
| 163 |
|
| 164 |
namespace MediaReplaceFlow { |
| 165 |
interface Props { |
| 166 |
mediaURL: string; |
| 167 |
mediaId: number; |
| 168 |
onSelect: (newMedia: any) => void; |
| 169 |
name?: string; |
| 170 |
} |
| 171 |
} |
| 172 |
|
| 173 |
const MediaReplaceFlow: ComponentType<MediaReplaceFlow.Props>; |
| 174 |
|
| 175 |
namespace __experimentalImageURLInputUI { |
| 176 |
interface Props { |
| 177 |
url: string; |
| 178 |
onChangeUrl: (props: any) => void; |
| 179 |
linkDestination: string; |
| 180 |
mediaUrl: string; |
| 181 |
mediaLink: string; |
| 182 |
linkTarget: string; |
| 183 |
linkClass: string; |
| 184 |
rel: string; |
| 185 |
} |
| 186 |
} |
| 187 |
|
| 188 |
const __experimentalImageURLInputUI: ComponentType<__experimentalImageURLInputUI.Props>; |
| 189 |
|
| 190 |
namespace __experimentalImageEditor { |
| 191 |
interface Props { |
| 192 |
id: number | string; |
| 193 |
url: string; |
| 194 |
width?: number; |
| 195 |
height?: number; |
| 196 |
clientWidth?: number; |
| 197 |
naturalHeight?: number; |
| 198 |
naturalWidth?: number; |
| 199 |
onSaveImage: (imageAttributes: { id: number; url: string }) => void; |
| 200 |
onFinishEditing: () => void; |
| 201 |
} |
| 202 |
} |
| 203 |
|
| 204 |
const __experimentalImageEditor: ComponentType<__experimentalImageEditor.Props>; |
| 205 |
|
| 206 |
namespace MediaPlaceholder { |
| 207 |
interface Props<T extends boolean> { |
| 208 |
placeholder: (content: ReactNode) => JSX.Element; |
| 209 |
} |
| 210 |
} |
| 211 |
|
| 212 |
namespace RichText { |
| 213 |
interface Props<T extends keyof HTMLElementTagNameMap> |
| 214 |
extends Omit<HTMLProps<T>, "onChange"> { |
| 215 |
allowedFormats?: string[]; |
| 216 |
autocompleters?: any[]; |
| 217 |
identifier?: string; |
| 218 |
inlineToolbar?: boolean; |
| 219 |
keepPlaceholderOnFocus?: boolean; |
| 220 |
multiline?: boolean | keyof HTMLElementTagNameMap; |
| 221 |
onChange(value: string): void; |
| 222 |
onMerge?(forward: boolean): void; |
| 223 |
onRemove?(forward: boolean): void; |
| 224 |
/** |
| 225 |
* Called when the `RichText` instance can be replaced. |
| 226 |
* Relaxed to accept any[] to support custom autocompleters |
| 227 |
* that pass non-BlockInstance values through the "replace" action. |
| 228 |
*/ |
| 229 |
onReplace?(values: any[]): void; |
| 230 |
onSplit?(value: string, isOriginal?: boolean): void; |
| 231 |
onTagNameChange?(tagName: keyof HTMLElementTagNameMap): void; |
| 232 |
placeholder?: string; |
| 233 |
tagName?: T; |
| 234 |
value: string; |
| 235 |
wrapperClassName?: string; |
| 236 |
withoutInteractiveFormatting?: boolean; |
| 237 |
} |
| 238 |
} |
| 239 |
|
| 240 |
const RichText: { |
| 241 |
<T extends keyof HTMLElementTagNameMap = "div">( |
| 242 |
props: RichText.Props<T> |
| 243 |
): JSX.Element; |
| 244 |
Content<T extends keyof HTMLElementTagNameMap = "div">(props: { |
| 245 |
value: string; |
| 246 |
tagName?: T; |
| 247 |
multiline?: boolean | "p" | "li"; |
| 248 |
}): JSX.Element; |
| 249 |
isEmpty(value: string | string[]): boolean; |
| 250 |
}; |
| 251 |
|
| 252 |
namespace BlockControls { |
| 253 |
interface Props { |
| 254 |
__experimentalShareWithChildBlocks?: boolean; |
| 255 |
} |
| 256 |
} |
| 257 |
|
| 258 |
const useBlockEditContext: () => { |
| 259 |
name: string; |
| 260 |
isSelected: boolean; |
| 261 |
clientId: string; |
| 262 |
}; |
| 263 |
|
| 264 |
const __experimentalUseBorderProps: (attributes: BlockAttributes) => { |
| 265 |
className: string; |
| 266 |
style: { |
| 267 |
[key: string]: string; |
| 268 |
}; |
| 269 |
}; |
| 270 |
|
| 271 |
const __experimentalUseMultipleOriginColorsAndGradients: () => { |
| 272 |
colors: { |
| 273 |
name: string; |
| 274 |
colors: { |
| 275 |
name: string; |
| 276 |
slug: string; |
| 277 |
color: string; |
| 278 |
}[]; |
| 279 |
}[]; |
| 280 |
disableCustomColors: boolean; |
| 281 |
disableCustomGradients: boolean; |
| 282 |
gradients: { |
| 283 |
name: string; |
| 284 |
gradients: { |
| 285 |
gradient: string; |
| 286 |
name: string; |
| 287 |
slug: string; |
| 288 |
}[]; |
| 289 |
}[]; |
| 290 |
hasColorsOrGradients: boolean; |
| 291 |
}; |
| 292 |
|
| 293 |
const __experimentalGetElementClassName: (element: string) => string; |
| 294 |
|
| 295 |
/** |
| 296 |
* Type may be incomplete or incorrect |
| 297 |
*/ |
| 298 |
interface EditorSettings { |
| 299 |
__experimentalFeatures: { |
| 300 |
appearanceTools: boolean; |
| 301 |
useRootPaddingAwareAlignments: boolean; |
| 302 |
border: { |
| 303 |
color: boolean; |
| 304 |
radius: boolean; |
| 305 |
style: boolean; |
| 306 |
width: boolean; |
| 307 |
}; |
| 308 |
color: { |
| 309 |
background: boolean; |
| 310 |
button: boolean; |
| 311 |
caption: boolean; |
| 312 |
customDuotone: boolean; |
| 313 |
defaultDuotone: boolean; |
| 314 |
defaultGradients: boolean; |
| 315 |
defaultPalette: boolean; |
| 316 |
duotone: { |
| 317 |
default: { |
| 318 |
name: string; |
| 319 |
colors: string[]; |
| 320 |
slug: string; |
| 321 |
}[]; |
| 322 |
}; |
| 323 |
gradients: { |
| 324 |
default: { |
| 325 |
name: string; |
| 326 |
gradient: string; |
| 327 |
slug: string; |
| 328 |
}[]; |
| 329 |
theme: { |
| 330 |
name: string; |
| 331 |
gradient: string; |
| 332 |
slug: string; |
| 333 |
}[]; |
| 334 |
}; |
| 335 |
heading: boolean; |
| 336 |
link: boolean; |
| 337 |
palette: { |
| 338 |
default: { |
| 339 |
name: string; |
| 340 |
slug: string; |
| 341 |
color: string; |
| 342 |
}[]; |
| 343 |
theme: { |
| 344 |
name: string; |
| 345 |
slug: string; |
| 346 |
color: string; |
| 347 |
}[]; |
| 348 |
}; |
| 349 |
text: boolean; |
| 350 |
}; |
| 351 |
shadow: { |
| 352 |
defaultPresets: boolean; |
| 353 |
presets: { |
| 354 |
default: { |
| 355 |
name: string; |
| 356 |
slug: string; |
| 357 |
shadow: string; |
| 358 |
}[]; |
| 359 |
}; |
| 360 |
}; |
| 361 |
spacing: { |
| 362 |
blockGap: boolean; |
| 363 |
margin: boolean; |
| 364 |
spacingScale: { |
| 365 |
operator: string; |
| 366 |
increment: number; |
| 367 |
steps: number; |
| 368 |
mediumStep: number; |
| 369 |
unit: string; |
| 370 |
}; |
| 371 |
spacingSizes: { |
| 372 |
theme: { |
| 373 |
name: string; |
| 374 |
size: string; |
| 375 |
slug: string; |
| 376 |
}[]; |
| 377 |
default: { |
| 378 |
name: string; |
| 379 |
slug: string; |
| 380 |
size: string; |
| 381 |
}[]; |
| 382 |
}; |
| 383 |
}; |
| 384 |
typography: { |
| 385 |
dropCap: boolean; |
| 386 |
fontSizes: { |
| 387 |
default: { |
| 388 |
name: string; |
| 389 |
slug: string; |
| 390 |
size: string; |
| 391 |
}[]; |
| 392 |
theme: { |
| 393 |
name: string; |
| 394 |
size: string; |
| 395 |
slug: string; |
| 396 |
fluid: { |
| 397 |
min: string; |
| 398 |
max: string; |
| 399 |
}; |
| 400 |
}[]; |
| 401 |
}; |
| 402 |
fontStyle: boolean; |
| 403 |
fontWeight: boolean; |
| 404 |
letterSpacing: boolean; |
| 405 |
textDecoration: boolean; |
| 406 |
textTransform: boolean; |
| 407 |
writingMode: boolean; |
| 408 |
fluid: boolean; |
| 409 |
fontFamilies: { |
| 410 |
theme: { |
| 411 |
fontFamily: string; |
| 412 |
name: string; |
| 413 |
slug: string; |
| 414 |
fontFace?: { |
| 415 |
fontFamily: string; |
| 416 |
fontStretch: string; |
| 417 |
fontStyle: string; |
| 418 |
fontWeight: string; |
| 419 |
src: [string]; |
| 420 |
}[]; |
| 421 |
}[]; |
| 422 |
}; |
| 423 |
}; |
| 424 |
blocks: Record<string, any>; |
| 425 |
custom: { |
| 426 |
fontWeight: { |
| 427 |
"light": number; |
| 428 |
"regular": number; |
| 429 |
"medium": number; |
| 430 |
"semi-bold": number; |
| 431 |
"bold": number; |
| 432 |
"extra-bold": number; |
| 433 |
"black": number; |
| 434 |
}; |
| 435 |
lineHeight: { |
| 436 |
body: number; |
| 437 |
heading: number; |
| 438 |
medium: number; |
| 439 |
one: number; |
| 440 |
}; |
| 441 |
spacing: { |
| 442 |
gap: string; |
| 443 |
}; |
| 444 |
}; |
| 445 |
layout: { |
| 446 |
contentSize: string; |
| 447 |
wideSize: string; |
| 448 |
}; |
| 449 |
background: { |
| 450 |
backgroundImage: boolean; |
| 451 |
}; |
| 452 |
dimensions: { |
| 453 |
minHeight: boolean; |
| 454 |
}; |
| 455 |
position: { |
| 456 |
sticky: boolean; |
| 457 |
}; |
| 458 |
}; |
| 459 |
} |
| 460 |
} |
| 461 |
|