Skip to content

Commit

Permalink
prep build 09/26
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Sep 26, 2024
2 parents fffa736 + 427a8d0 commit 435d075
Show file tree
Hide file tree
Showing 108 changed files with 1,615 additions and 1,009 deletions.
8 changes: 6 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions packages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ When creating a new package, you need to provide at least the following:
Initial release.
```

To ensure your package is recognised, you should also _manually_ add your new package to the root `package.json` file and then run `npm install` to update the dependencies.
To ensure your package is recognized, you should also _manually_ add your new package to the root `package.json` file and then run `npm install` to update the dependencies.

## Managing Dependencies

Expand Down Expand Up @@ -104,7 +104,7 @@ Next, you need to run `npm install` in the root of the project to ensure that `p
This is the most confusing part of working with [monorepo] which causes a lot of hassles for contributors. The most successful strategy so far is to do the following:

1. First, remove the existing dependency as described in the previous section.
2. Next, add the same dependency back as described in the first section of this chapter. This time it wil get the latest version applied unless you enforce a different version explicitly.
2. Next, add the same dependency back as described in the first section of this chapter. This time it will get the latest version applied unless you enforce a different version explicitly.

### Development Dependencies

Expand Down Expand Up @@ -152,9 +152,9 @@ It's very important to have a good plan for what a new package will include. All

## Maintaining Changelogs

In maintaining dozens of npm packages, it can be tough to keep track of changes. To simplify the release process, each package includes a `CHANGELOG.md` file which details all published releases and the unreleased ("Unreleased") changes, if any exist.
When maintaining dozens of npm packages, it can be tough to keep track of changes. To simplify the release process, each package includes a `CHANGELOG.md` file which details all published releases and the unreleased ("Unreleased") changes, if any exist.

For each pull request, you should always include relevant changes in a "Unreleased" heading at the top of the file. You should add the heading if it doesn't already exist.
For each pull request, you should always include relevant changes under an "Unreleased" heading at the top of the file. You should add the heading if it doesn't already exist.

_Example:_

Expand Down Expand Up @@ -200,7 +200,7 @@ Gutenberg uses TypeScript by running the TypeScript compiler (`tsc`) on select p
These packages benefit from type checking and produced type declarations in the published packages.

To opt-in to TypeScript tooling, packages should include a `tsconfig.json` file in the package root and add an entry to the root `tsconfig.json` references.
The changes will indicate that the package has opted-in and will be included in the TypeScript build process.
The changes will indicate that the package has opted in and will be included in the TypeScript build process.

A `tsconfig.json` file should look like the following (comments are not necessary):

Expand Down
3 changes: 2 additions & 1 deletion packages/block-directory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"@wordpress/plugins": "file:../plugins",
"@wordpress/private-apis": "file:../private-apis",
"@wordpress/url": "file:../url",
"change-case": "^4.1.2"
"change-case": "^4.1.2",
"clsx": "^2.1.1"
},
"peerDependencies": {
"react": "^18.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
/**
* External dependencies
*/
import clsx from 'clsx';

/**
* WordPress dependencies
*/
import { __, _n, sprintf } from '@wordpress/i18n';
import {
Button,
Tooltip,
Spinner,
VisuallyHidden,
Composite,
Expand Down Expand Up @@ -89,77 +94,75 @@ function DownloadableBlockListItem( { item, onClick } ) {
statusText = __( 'Installing…' );
}

const itemLabel = getDownloadableBlockLabel( item, {
hasNotice,
isInstalled,
isInstalling,
} );

return (
<Composite.Item
render={
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
accessibleWhenDisabled
type="button"
role="option"
className="block-directory-downloadable-block-list-item"
isBusy={ isInstalling }
onClick={ ( event ) => {
event.preventDefault();
onClick();
} }
label={ getDownloadableBlockLabel( item, {
hasNotice,
isInstalled,
isInstalling,
} ) }
showTooltip
tooltipPosition="top center"
/>
}
disabled={ isInstalling || ! isInstallable }
>
<div className="block-directory-downloadable-block-list-item__icon">
<DownloadableBlockIcon icon={ icon } title={ title } />
{ isInstalling ? (
<span className="block-directory-downloadable-block-list-item__spinner">
<Spinner />
</span>
) : (
<BlockRatings rating={ rating } />
<Tooltip placement="top" text={ itemLabel }>
<Composite.Item
className={ clsx(
'block-directory-downloadable-block-list-item',
isInstalling && 'is-installing'
) }
</div>
<span className="block-directory-downloadable-block-list-item__details">
<span className="block-directory-downloadable-block-list-item__title">
{ createInterpolateElement(
sprintf(
/* translators: %1$s: block title, %2$s: author name. */
__( '%1$s <span>by %2$s</span>' ),
decodeEntities( title ),
author
),
{
span: (
<span className="block-directory-downloadable-block-list-item__author" />
accessibleWhenDisabled
disabled={ isInstalling || ! isInstallable }
onClick={ ( event ) => {
event.preventDefault();
onClick();
} }
aria-label={ itemLabel }
type="button"
role="option"
>
<div className="block-directory-downloadable-block-list-item__icon">
<DownloadableBlockIcon icon={ icon } title={ title } />
{ isInstalling ? (
<span className="block-directory-downloadable-block-list-item__spinner">
<Spinner />
</span>
) : (
<BlockRatings rating={ rating } />
) }
</div>
<span className="block-directory-downloadable-block-list-item__details">
<span className="block-directory-downloadable-block-list-item__title">
{ createInterpolateElement(
sprintf(
/* translators: %1$s: block title, %2$s: author name. */
__( '%1$s <span>by %2$s</span>' ),
decodeEntities( title ),
author
),
}
{
span: (
<span className="block-directory-downloadable-block-list-item__author" />
),
}
) }
</span>
{ hasNotice ? (
<DownloadableBlockNotice block={ item } />
) : (
<>
<span className="block-directory-downloadable-block-list-item__desc">
{ !! statusText
? statusText
: decodeEntities( description ) }
</span>
{ isInstallable &&
! ( isInstalled || isInstalling ) && (
<VisuallyHidden>
{ __( 'Install block' ) }
</VisuallyHidden>
) }
</>
) }
</span>
{ hasNotice ? (
<DownloadableBlockNotice block={ item } />
) : (
<>
<span className="block-directory-downloadable-block-list-item__desc">
{ !! statusText
? statusText
: decodeEntities( description ) }
</span>
{ isInstallable &&
! ( isInstalled || isInstalling ) && (
<VisuallyHidden>
{ __( 'Install block' ) }
</VisuallyHidden>
) }
</>
) }
</span>
</Composite.Item>
</Composite.Item>
</Tooltip>
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
.block-directory-downloadable-block-list-item {
padding: $grid-unit-15;
& + & {
margin-top: $grid-unit-05;
}

display: grid;
grid-template-columns: auto 1fr;

width: 100%;
height: auto;
padding: $grid-unit-15;
margin: 0;

appearance: none;
background: none;
border: 0;
text-align: left;
display: grid;
grid-template-columns: auto 1fr;
transition: box-shadow 0.1s linear;

// The item contains absolutely positioned items.
// Set `position: relative` on the parent to prevent overflow issues
// in scroll containers.
// See: https://github.com/WordPress/gutenberg/issues/63384
position: relative;


&:not([aria-disabled="true"]) {
cursor: pointer;
}

&:hover {
@include button-style__focus();
}

&.is-busy {
background: transparent;
&[data-focus-visible] {
@include button-style__focus();
}

&.is-installing {
.block-directory-downloadable-block-list-item__author {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
Expand All @@ -33,11 +51,6 @@
word-wrap: normal !important;
}
}

&:disabled,
&[aria-disabled] {
opacity: 1;
}
}

.block-directory-downloadable-block-list-item__icon {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,3 @@
margin-top: 0;
}

.block-directory-downloadable-blocks-panel button {
margin-top: $grid-unit-05;
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ const ModifiedWarning = ( { originalBlock, ...props } ) => {
);
actions.push(
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
key="convert"
onClick={ convertToHTML }
variant="tertiary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ export default function InstallButton( { attributes, block, clientId } ) {

return (
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
onClick={ () =>
installBlockType( block ).then( ( success ) => {
if ( success ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@

.block-editor-block-inspector__tab-item {
flex: 1 1 0px;
display: flex;
justify-content: center;
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export function useFocusFirstElement( { clientId, initialPosition } ) {
textInputs[ isReverse ? textInputs.length - 1 : 0 ] || ref.current;

if ( ! isInsideRootBlock( ref.current, target ) ) {
ownerDocument.defaultView.getSelection().removeAllRanges();
ref.current.focus();
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* WordPress dependencies
*/
import {
__experimentalBorderBoxControl as BorderBoxControl,
BorderBoxControl,
__experimentalHasSplitBorders as hasSplitBorders,
__experimentalIsDefinedBorder as isDefinedBorder,
__experimentalToolsPanel as ToolsPanel,
Expand Down
Loading

0 comments on commit 435d075

Please sign in to comment.