Skip to content
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

Audit Experimental APIs WP 5.8 #31416

Closed
youknowriad opened this issue May 3, 2021 · 17 comments
Closed

Audit Experimental APIs WP 5.8 #31416

youknowriad opened this issue May 3, 2021 · 17 comments
Labels
[Status] In Progress Tracking issues with work in progress [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.

Comments

@youknowriad
Copy link
Contributor

youknowriad commented May 3, 2021

This is the list of experimental APIs we have generated by the @noisysocks's script from #28157

The list is long and we doesn't have to go through the entire list but I suggest that If you introduced/used one of these APIs, to follow the following steps: cc @WordPress/gutenberg-core

  • If it's an API that is never meant to be made available to third-party developpers as is, rename it to __unstable instead
  • If you think it's time to consider making the API stable, open a PR to rename it.
  • If you think it's an API worth-having but you're still uncertain whether future changes might impact it, consider asking for help to make the right call, ping me or comment here.
  • if you want to give the API more time to mature, just ignore it for now.

Our goal after a couple weeks should be to change the status of a dozen of APIs (whether it's marking them unstable or stable).

packages/annotations

__experimentalAddAnnotation
__experimentalCreateOnChangeEditableValue
__experimentalCreatePrepareEditableTree
__experimentalGetAllAnnotationsForBlock
__experimentalGetAnnotations
__experimentalGetAnnotationsForBlock
__experimentalGetAnnotationsForRichText
__experimentalGetPropsForEditableTreeChangeHandler
__experimentalGetPropsForEditableTreePreparation
__experimentalRemoveAnnotation
__experimentalRemoveAnnotationsBySource
__experimentalUpdateAnnotationRange

packages/block-directory

__experimentalInserterMenuExtension #31417

packages/block-editor

__experimentalAlignmentMatrixControl
__experimentalAppenderTagName
__experimentalBlock #31419
__experimentalBlockAlignmentMatrixControl
__experimentalBlockDirectory
__experimentalBlockFullHeightAligmentControl
__experimentalBlockNavigationBlockFill
__experimentalBlockNavigationEditor
__experimentalBlockNavigationTree
__experimentalBlockPatternCategories
__experimentalBlockPatternSetup
__experimentalBlockPatterns
__experimentalBlockSettingsMenuFirstItem #31420
__experimentalBlockVariationPicker
__experimentalBlockVariationTransforms
__experimentalBorder
__experimentalBorderStyleControl
__experimentalBoxControl
__experimentalCanUserUseUnfilteredHTML
__experimentalCaptureToolbars
__experimentalCloneSanitizedBlock
__experimentalColorGradientControl
__experimentalConvertBlockToStatic
__experimentalDragComponent
__experimentalDuotone
__experimentalDuotoneControl
__experimentalFeatures
__experimentalFetchLinkSuggestions
__experimentalFontAppearanceControl
__experimentalFontFamily
__experimentalFontFamilyControl
__experimentalFontStyle
__experimentalFontWeight
__experimentalGetAccessibleBlockLabel
__experimentalGetActiveBlockIdByBlockNames
__experimentalGetAllowedBlocks
__experimentalGetAllowedPatterns
__experimentalGetBlockLabel
__experimentalGetBlockListSettingsForBlocks
__experimentalGetBorderClassesAndStyles
__experimentalGetColorClassesAndStyles
__experimentalGetGradientClass
__experimentalGetGradientObjectByGradientValue
__experimentalGetLastBlockAttributeChanges
__experimentalGetMatchingVariation
__experimentalGetParsedPattern
__experimentalGetParsedReusableBlock
__experimentalGetPatternTransformItems
__experimentalGetPatternsByBlockTypes
__experimentalGetReusableBlockTitle
__experimentalGradientPicker
__experimentalGradientPickerControl
__experimentalGradientPickerPanel
__experimentalHandleURLSuggestions
__experimentalImageSizeControl
__experimentalImageURLInputUI
__experimentalInitialIndex
__experimentalInserterMenuExtension
__experimentalInsertionIndex
__experimentalIsQuick
__experimentalLayout
__experimentalLayoutStyle
__experimentalLibrary
__experimentalLinkControl
__experimentalLinkControlSearchInput
__experimentalLinkControlSearchItem
__experimentalLinkControlSearchResults
__experimentalLive
__experimentalNoWrapper
__experimentalOnClick
__experimentalOnIndexChange
__experimentalOnlyMediaLibrary
__experimentalPadding
__experimentalPanelColorGradientSettings
__experimentalParentSelector
__experimentalPersistentListViewFeatures
__experimentalPreferredStyleVariations
__experimentalPreviewOptions
__experimentalRenderControl
__experimentalRenderSuggestions
__experimentalResponsiveBlockControl
__experimentalReusableBlocks
__experimentalRichText
__experimentalRole
__experimentalSearchForm
__experimentalSelectBlock
__experimentalSelector
__experimentalSetIsInserterOpened
__experimentalShouldInsertAtTheTop
__experimentalShowInitialSuggestions
__experimentalSkipFontSizeSerialization
__experimentalSkipSerialization
__experimentalSpotlightEntityBlocks
__experimentalStyleProvider
__experimentalTextDecoration
__experimentalTextTransform
__experimentalToolbar
__experimentalToolbarContext
__experimentalTransferDataType
__experimentalTreeGrid
__experimentalTreeGridCell
__experimentalTreeGridItem
__experimentalTreeGridRow
__experimentalUndo
__experimentalUnitControl
__experimentalUpdateSelection
__experimentalUseBorderProps
__experimentalUseColorProps
__experimentalUseColors
__experimentalUseCustomSides
__experimentalUseDropZone
__experimentalUseEditorFeature
__experimentalUseGradient
__experimentalUseInnerBlocksProps
__experimentalUseNoRecursiveRenders
__experimentalUseResizeCanvas
__experimentalUseSimulatedMediaQuery
__experimentalUseSlot
__experimentalVersion

packages/block-library

__experimentalAppenderTagName
__experimentalBlockAlignmentMatrixControl
__experimentalBlockFullHeightAligmentControl
__experimentalBlockNavigationTree
__experimentalBlockVariationPicker
__experimentalBorder
__experimentalBoxControl
__experimentalCaptureToolbars
__experimentalConvert
__experimentalConvertBlockToStatic
__experimentalDuotone
__experimentalFeatures
__experimentalFontFamily
__experimentalFontStyle
__experimentalFontWeight
__experimentalGetBorderClassesAndStyles
__experimentalGetColorClassesAndStyles
__experimentalGetCoreBlocks
__experimentalGetDefaultTemplatePartAreas
__experimentalGetGradientClass
__experimentalGetSettings
__experimentalImageSizeControl
__experimentalImageURLInputUI
__experimentalIsEditingReusableBlock
__experimentalLabel
__experimentalLayout
__experimentalLinkControl
__experimentalLive
__experimentalNumberControl
__experimentalOnClick
__experimentalPanelColorGradientSettings
__experimentalRegisterExperimentalCoreBlocks
__experimentalRole
__experimentalSearchForm
__experimentalSelector
__experimentalShowTooltip
__experimentalSkipSerialization
__experimentalTextDecoration
__experimentalTextTransform
__experimentalTooltipProps
__experimentalUnitControl
__experimentalUseBorderProps
__experimentalUseColorProps
__experimentalUseEditorFeature
__experimentalUseGradient
__experimentalUseInnerBlocksProps
__experimentalUseNoRecursiveRenders
__experimentalVersion

packages/blocks

__experimentalBorder
__experimentalCloneSanitizedBlock
__experimentalConvert
__experimentalFontFamily
__experimentalFontStyle
__experimentalFontWeight
__experimentalGetAccessibleBlockLabel
__experimentalGetBlockAttributesNamesByRole
__experimentalGetBlockLabel
__experimentalLabel
__experimentalRole
__experimentalSanitizeBlockAttributes
__experimentalTextDecoration
__experimentalTextTransform

packages/components

__experimentalAlignmentMatrixControl
__experimentalBoxControl
__experimentalColorEdit
__experimentalCustomGradientPicker
__experimentalDimensionControl
__experimentalDragComponent
__experimentalExpandOnFocus
__experimentalFetchLinkSuggestions
__experimentalFlex
__experimentalFlexBlock
__experimentalFlexItem
__experimentalGetSettings
__experimentalGradientPicker
__experimentalHeading
__experimentalInputControl
__experimentalInvalid
__experimentalIsFocusable
__experimentalNavigation
__experimentalNavigationBackButton
__experimentalNavigationGroup
__experimentalNavigationItem
__experimentalNavigationMenu
__experimentalNumberControl
__experimentalRadio
__experimentalRadioGroup
__experimentalShowHowTo
__experimentalShowTooltip
__experimentalStyleProvider
__experimentalText
__experimentalToolbarContext
__experimentalTooltipProps
__experimentalTransferDataType
__experimentalTreeGrid
__experimentalTreeGridCell
__experimentalTreeGridItem
__experimentalTreeGridRow
__experimentalTruncate
__experimentalUnitControl
__experimentalUseDragging
__experimentalUseDropZone
__experimentalUseFocusOutside
__experimentalUseSlot
__experimentalValidateInput

packages/compose

__experimentalUseDialog
__experimentalUseDragging
__experimentalUseDropZone
__experimentalUseFocusOutside
__experimentalWidthProvider

packages/core-data

__experimentalBatch
__experimentalFetchLinkSuggestions
__experimentalGetDirtyEntityRecords
__experimentalGetEntityRecordNoResolver
__experimentalGetTemplateForLink
__experimentalSaveSpecifiedEntityEdits

packages/customize-widgets

__experimentalBlockSettingsMenuFirstItem
__experimentalGetCoreBlocks
__experimentalLibrary
__experimentalRegisterExperimentalCoreBlocks
__experimentalSetIsInserterOpened

packages/data

__experimentalListeningStores
__experimentalMarkListeningStores
__experimentalSubscribeStore
__experimentalUseThunks

packages/date

__experimentalGetSettings

packages/e2e-tests

__experimentalAddAnnotation
__experimentalConvert
__experimentalRemoveAnnotationsBySource
__experimentalUpdateLocalAutosaveInterval

packages/edit-navigation

__experimentalFetchLinkSuggestions
__experimentalIsFocusable
__experimentalRegisterExperimentalCoreBlocks

packages/edit-post

__experimentalBlockSettingsMenuFirstItem
__experimentalFullscreenModeClose
__experimentalGetInsertionPoint
__experimentalGetPreviewDeviceType
__experimentalGetTemplateForLink
__experimentalInsertionIndex
__experimentalLayout
__experimentalLayoutStyle
__experimentalLibrary
__experimentalLocalAutosaveInterval
__experimentalMainDashboardButton
__experimentalNavigation
__experimentalNavigationItem
__experimentalNavigationMenu
__experimentalPreferredStyleVariations
__experimentalPreviewOptions
__experimentalRegisterExperimentalCoreBlocks
__experimentalSetIsInserterOpened
__experimentalSetPreviewDeviceType
__experimentalUpdateLocalAutosaveInterval
__experimentalUseDialog
__experimentalUseEditorFeature
__experimentalUseResizeCanvas
__experimentalUseSlot

packages/edit-site

__experimentalBlockNavigationTree
__experimentalBlockSettingsMenuFirstItem
__experimentalBorderStyleControl
__experimentalBoxControl
__experimentalColorEdit
__experimentalColorGradientControl
__experimentalFeatures
__experimentalFetchLinkSuggestions
__experimentalFontAppearanceControl
__experimentalFontFamilyControl
__experimentalGetActiveBlockIdByBlockNames
__experimentalGetBlockLabel
__experimentalGetDefaultTemplatePartAreas
__experimentalGetDefaultTemplateTypes
__experimentalGetDirtyEntityRecords
__experimentalGetInsertionPoint
__experimentalGetPreviewDeviceType
__experimentalGetTemplateForLink
__experimentalGetTemplateInfo
__experimentalGlobalStylesBaseStyles
__experimentalGlobalStylesUserEntityId
__experimentalInsertionIndex
__experimentalLayout
__experimentalLibrary
__experimentalLinkControl
__experimentalMainDashboardButton
__experimentalNavigation
__experimentalNavigationBackButton
__experimentalNavigationGroup
__experimentalNavigationItem
__experimentalNavigationMenu
__experimentalNavigationToggle
__experimentalNoWrapper
__experimentalPanelColorGradientSettings
__experimentalPersistentListViewFeatures
__experimentalPreviewOptions
__experimentalRadio
__experimentalRadioGroup
__experimentalRegisterExperimentalCoreBlocks
__experimentalSelector
__experimentalSetIsInserterOpened
__experimentalSetPreviewDeviceType
__experimentalSpotlightEntityBlocks
__experimentalText
__experimentalUseCustomSides
__experimentalUseDialog
__experimentalUseResizeCanvas
__experimentalUseSlot

packages/edit-widgets

__experimentalBatch
__experimentalFetchLinkSuggestions
__experimentalGetCoreBlocks
__experimentalGetDirtyEntityRecords
__experimentalInsertionIndex
__experimentalLabel
__experimentalLibrary
__experimentalParentSelector
__experimentalRegisterExperimentalCoreBlocks
__experimentalReusableBlocks
__experimentalSetIsInserterOpened
__experimentalToolbar
__experimentalUseDialog

packages/editor

__experimentalBlockDirectory
__experimentalBlockPatternCategories
__experimentalBlockPatterns
__experimentalCanUserUseUnfilteredHTML
__experimentalFeatures
__experimentalFetchLinkSuggestions
__experimentalGetDefaultTemplatePartAreas
__experimentalGetDefaultTemplateType
__experimentalGetDefaultTemplateTypes
__experimentalGetDirtyEntityRecords
__experimentalGetSettings
__experimentalGetTemplateInfo
__experimentalGlobalStylesBaseStyles
__experimentalGlobalStylesUserEntityId
__experimentalLocalAutosaveInterval
__experimentalPreferredStyleVariations
__experimentalRequestPostUpdateFinish
__experimentalRequestPostUpdateStart
__experimentalReusableBlocks
__experimentalRichText
__experimentalSaveSpecifiedEntityEdits
__experimentalSetIsInserterOpened
__experimentalShouldInsertAtTheTop
__experimentalTearDownEditor
__experimentalUndo
__experimentalUseDialog

packages/eslint-plugin

__experimentalFoo
__experimentalSafe
__experimentalUnsafe

packages/format-library

__experimentalLinkControl
__experimentalUseEditorFeature

packages/reusable-blocks

__experimentalConvertBlockToStatic
__experimentalConvertBlocksToReusable
__experimentalDeleteReusableBlock
__experimentalIsEditingReusableBlock
__experimentalSetEditingReusableBlock

packages/rich-text

__experimentalCreateOnChangeEditableValue
__experimentalCreatePrepareEditableTree
__experimentalGetPropsForEditableTreeChangeHandler
__experimentalGetPropsForEditableTreePreparation
__experimentalRichText

packages/server-side-render

__experimentalSanitizeBlockAttributes

lib

__experimentalBlockPatternCategories
__experimentalBlockPatterns
__experimentalBorder
__experimentalDuotone
__experimentalFeatures
__experimentalFontFamily
__experimentalFontStyle
__experimentalFontWeight
__experimentalGlobalStylesBaseStyles
__experimentalGlobalStylesUserEntityId
__experimentalLayout
__experimentalNoWrapper
__experimentalSelector
__experimentalSkipFontSizeSerialization
__experimentalSkipSerialization
__experimentalTextDecoration
__experimentalTextTransform

@youknowriad youknowriad added [Status] In Progress Tracking issues with work in progress [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues. labels May 3, 2021
@nerrad
Copy link
Contributor

nerrad commented May 3, 2021

@youknowriad I'm not sure if this list is up to date? For example __experimentalCreateInterpolateElement has been stable for a relatively long time now.

I think I see what's happening, the script might be picking up changelog notes. Maybe exclude *.md files from the script search?

@youknowriad
Copy link
Contributor Author

@nerrad good catch, I updated the list by excluding markdown files, how does it look now?

@nerrad
Copy link
Contributor

nerrad commented May 3, 2021

I can't speak to everything but __experimentalCreateInterpolateElement isn't in there so it at least helped remove that one 😄

@ntsekouras
Copy link
Contributor

ntsekouras commented May 4, 2021

I did a quick first pass..

I believe these should remain __experimental as they are relatively new and susceptible to changes:

__experimentalBlockPatternSetup
__experimentalBlockVariationTransforms
__experimentalGetMatchingVariation
__experimentalGetAllowedPatterns
__experimentalGetParsedPattern
__experimentalGetPatternsByBlockTypes
__experimentalGetPatternTransformItems
__experimentalRole
__experimentalGetBlockAttributesNamesByRole

These feel like they could become stable:
__experimentalBlockPatternCategories
__experimentalBlockPatterns

@youknowriad
Copy link
Contributor Author

__experimentalBlockPatternCategories
__experimentalBlockPatterns

If these are the ones in the block-editor package, I think they should remain experimental because the patterns directory could have an impact there.

@oandregal
Copy link
Member

  • __experimentalSkipSerialization, __experimentalSelector => I think these could be kept as experimental.

  • __experimentalBorder, __experimentalFontStyle, __experimentalFontWeight, __experimentalTextTransform,__experimentalTextDecoration => these can be made stable but would welcome design feedback. The infrastructure/underlying mechanism works fine, if we aren't sure about the UI controls these generate, we could disable them unless a theme opts in via theme.json. cc @aaronrobertshaw @mtias @jasmussen

  • __experimentalFontFamily => similar UI concerns as above + we need to make this one work like the other presets (at the moment, it's using a CSS Custom Property): cc @jorgefilipecosta

@youknowriad
Copy link
Contributor Author

youknowriad commented May 4, 2021

__experimentalBorder, __experimentalFontStyle, __experimentalFontWeight, __experimentalTextTransform,__experimentalTextDecoration

I think I saw some discussion about grouping some of these under "typography" ? it would make sense to be but I agree that we can probably stabilize these now, they are a good complement to theme.json for block authors. UI is not a blocker to stabilize things though for me, it can be iterated on.

@jasmussen
Copy link
Contributor

I think I saw some discussion about grouping some of these under "typography" ?

Screenshot 2021-05-04 at 15 16 01

That might be what you're thinking of, from #27331. Part of it is to group tools logically, part of it is to avoid a proliferation of panels.

@youknowriad
Copy link
Contributor Author

@nosolosw I think useEditorFeature is something we should stabilize, though I don't like the naming of the hook, maybe more useThemeSetting

@gziolo
Copy link
Member

gziolo commented May 5, 2021

I think useEditorFeature is something we should stabilize, though I don't like the naming of the hook, maybe more useThemeSetting

Oh, this would be very different to what was implemented at first. Does it mean that it no longer checks the settings in block supports and only uses theme.json? Looking at how typography.dropCap is handled, it looks like all the logic that processed also block type definition was removed. Example:

const isDropCapFeatureEnabled = useEditorFeature( 'typography.dropCap' );

This one is hardcoded to always return true when not set in theme.json:

return featurePath === 'typography.dropCap' ? true : undefined;

It makes me wonder, how block authors can opt in for the feautes like typography.customLineHeight that are disabled by default in theme.json?

"customLineHeight": false,

Will they need to define the hook that updates all settings? I see an override for the Button block in theme.json:

"blocks": {
"core/button": {
"border": {
"customRadius": true
}
}
}

What is the story for custom block creators?

@youknowriad
Copy link
Contributor Author

It makes me wonder, how block authors can opt in for the feautes like typography.customLineHeight that are disabled by default in theme.json?

It's the other way around:

  • Block authors can say that their blocks do support something by using the block-supports for instance or implementing it adhoc
  • Theme authors can decide to hide these customization options. (control what their users can do)

So ultimately, the final decision belongs to the theme author. My post also explains this a bit https://riad.blog/2021/05/05/introduction-to-wordpresss-global-styles-and-global-settings/

@gziolo
Copy link
Member

gziolo commented May 5, 2021

So ultimately, the final decision belongs to the theme author. My post also explains this a bit https://riad.blog/2021/05/05/introduction-to-wordpresss-global-styles-and-global-settings/

From the post:

In most situations though, support for these customizations in the UI can be added quickly to any block, static or dynamic, thanks to the Block Supports API.

Thank you for sharing this post. It clarified all misconceptions I had based on the initial development efforts I was involved in. useThemeSetting seems to be a perfect match then 👍🏻

@getdave
Copy link
Contributor

getdave commented May 7, 2021

__experimentalFetchLinkSuggestions is heavily in use throughout the codebase in order to deliver search suggestions in the interface when you are adding a link.

Screen Capture on 2021-05-07 at 14-28-33

This is used not only in richtext but also in the Navigation editor and block.

It is slightly unorthodox because it lives in Core Data but is not using the @wordpress/data mechanics. Rather it utilises apiFetch directly.

@gziolo
Copy link
Member

gziolo commented May 7, 2021

__experimentalFetchLinkSuggestions is heavily in use throughout the codebase in order to deliver search suggestions in the interface when you are adding a link.

Right, the idea was to move into the place where it can be shared between all those places. The plan is to find it a better home in the future. @gwwar might have better insights on how to move forward with making it stable.

@getdave
Copy link
Contributor

getdave commented May 10, 2021

Right, the idea was to move into the place where it can be shared between all those places.

Not sure if this is what you mean but it is already in @wordpress/core-data and all the places it is used shared that single reference. For example

import { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';

Currently, the __experimentalFetchLinkSuggestions function makes requests to the v2/search endpoint using apiFetch. This search endpoint is not currently an entity and from what I can see nor should it be.

apiFetch( {
path: addQueryArgs( '/wp/v2/search', {
search,
page,
per_page: perPage,
type: 'post',
subtype,
} ),
} )

I'm not sure what criteria are required to consider this API stable? Do we need to migrate the format to utilise the generator based data fetching mechanics of @wordpress/data (eg: controls, resolvers...etc)? Or is it ok to simply remove the __experimental given that it is already used widely and doesn't seem to have any issues?

@gwwar might have better insights on how to move forward with making it stable.

Definitely, a good idea to have Kerry's input 👍 Also @talldan if he has a moment.

@gwwar
Copy link
Contributor

gwwar commented May 10, 2021

For __experimental-fetch-link-suggestions.js the core/data package is just a holding place, since there were no other packages that made sense at the time.

This function is a default implementation specific to WP, and passed through to editor settings on init (post/site/widget/navigation). Folks can currently override this in their custom editor instance, by passing through a different function.

Is it worth making these specific default implementations public? (This one is specific to WP).

If the answer is yes, I'd prefer not removing the experimental prefix until the function is moved to a better package. I personally think core data isn't a good fit.

If we don't think there's value to exposing the default implementations, we could perhaps change the prefix to unstable.

Note that we can probably stabilize the left side of this for editor settings: settings. __experimentalFetchLinkSuggestions to settings.fetchLinkSuggestions ahead of whatever our decisions are for exposing default implementations.

settings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>
fetchLinkSuggestions( search, searchOptions, settings );

@youknowriad
Copy link
Contributor Author

I'm going to close this now as we're passed feature freeze. I think I expected a bit more updates here. Anyway, let's continue doing non stop (and not wait for the last moment in the release cycle). Thanks folks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] In Progress Tracking issues with work in progress [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Projects
None yet
Development

No branches or pull requests

8 participants