Commit Graph

485 Commits

Author SHA1 Message Date
Alessio Gravili
aef2a52cea fix: fix all ui imports in our plugins, and get rid of ui subpath exports within monorepo (#6854) 2024-06-19 14:16:31 -04:00
Alessio Gravili
bc98567f41 feat!: rename @payloadcms/ui/client to @payloadcms/ui, and other auto-suggestion & exports improvements (#6848)
**BREAKING:** All `@payloadcms/ui/client` exports have been renamed to
`@payloadcms/ui`. A simple find & replace across your entire project
will be enough to migrate. This change greatly improves import
auto-completions in IDEs which lack proper support for package.json
exports, like Webstorm.
2024-06-19 16:36:00 +00:00
Elliot DeNolf
2c4da93b28 chore(release): v3.0.0-beta.52 [skip ci] 2024-06-18 18:18:10 -04:00
Elliot DeNolf
a680e687b5 chore(release): v3.0.0-beta.51 [skip ci] 2024-06-18 12:25:56 -04:00
Elliot DeNolf
45871489d0 chore(release): v3.0.0-beta.50 [skip ci] 2024-06-17 18:30:17 -04:00
Alessio Gravili
35a5d0cb3c fix(richtext-*): do not use different version of faceless-ui by importing prebundled faceless-ui from ui (#6816)
Fixes editor crashing when opening admin panel
2024-06-17 16:23:24 -04:00
Elliot DeNolf
25968d43c2 chore(release): v3.0.0-beta.49 [skip ci] 2024-06-17 14:32:33 -04:00
Jacob Fletcher
9e76c8f4e3 feat!: prebundle payload, ui, richtext-lexical (#6579)
# Breaking Changes

### New file import locations

Exports from the `payload` package have been _significantly_ cleaned up.
Now, just about everything is able to be imported from `payload`
directly, rather than an assortment of subpath exports. This means that
things like `import { buildConfig } from 'payload/config'` are now just
imported via `import { buildConfig } from 'payload'`. The mental model
is significantly simpler for developers, but you might need to update
some of your imports.

Payload now exposes only three exports:

1. `payload` - all types and server-only Payload code
2. `payload/shared` - utilities that can be used in either the browser
or in Node environments
3. `payload/node` - heavy utilities that should only be imported in Node
scripts and never be imported into bundled code like Next.js

### UI library pre-bundling

With this release, we've dramatically sped up the compile time for
Payload by pre-bundling our entire UI package for use inside of the
Payload admin itself. There are new exports that should be used within
Payload custom components:

1. `@payloadcms/ui/client` - all client components 
2. `@payloadcms/ui/server` - all server components

For all of your custom Payload admin UI components, you should be
importing from one of these two pre-compiled barrel files rather than
importing from the more deeply nested exports directly. That will keep
compile times nice and speedy, and will also make sure that the bundled
JS for your admin UI is kept small.

For example, whereas before, if you imported the Payload `Button`, you
would have imported it like this:

```ts
import { Button } from '@payloadcms/ui/elements/Button'
```

Now, you would import it like this:

```ts
import { Button } from '@payloadcms/ui/client'
```

This is a significant DX / performance optimization that we're pretty
pumped about.

However, if you are importing or re-using Payload UI components
_outside_ of the Payload admin UI, for example in your own frontend
apps, you can import from the individual component exports which will
make sure that the bundled JS is kept to a minimum in your frontend
apps. So in your own frontend, you can continue to import directly to
the components that you want to consume rather than importing from the
pre-compiled barrel files.

Individual component exports will now come with their corresponding CSS
and everything will work perfectly as-expected.

### Specific exports have changed

- `'@payloadcms/ui/templates/Default'` and
`'@payloadcms/ui/templates/Minimal`' are now exported from
`'@payloadcms/next/templates'`
- Old: `import { LogOut } from '@payloadcms/ui/icons/LogOut'` new:
`import { LogOutIcon } from '@payloadcms/ui/icons/LogOut'`

## Background info

In effort to make local dev as fast as possible, we need to import as
few files as possible so that the compiler has less to process. One way
we've achieved this in the Admin Panel was to _remove_ all .scss imports
from all components in the `@payloadcms/ui` module using a build
process. This stripped all `import './index.scss'` statements out of
each component before injecting them into `dist`. Instead, it bundles
all of the CSS into a single `main.css` file, and we import _that_ at
the root of the app.

While this concept is _still_ the right solution to the problem, this
particular approach is not viable when using these components outside
the Admin Panel, where not only does this root stylesheet not exist, but
where it would also bloat your app with unused styles. Instead, we need
to _keep_ these .scss imports in place so they are imported directly
alongside your components, as expected. Then, we need create a _new_
build step that _separately_ compiles the components _without_ their
stylesheets—this way your app can consume either as needed from the new
`client` and `server` barrel files within `@payloadcms/ui`, i.e. from
within `@payloadcms/next` and all other admin-specific packages and
plugins.

This way, all other applications will simply import using the direct
file paths, just as they did before. Except now they come with
stylesheets.

And we've gotten a pretty awesome initial compilation performance boost.

---------

Co-authored-by: James <james@trbl.design>
Co-authored-by: Alessio Gravili <alessio@gravili.de>
2024-06-17 14:25:36 -04:00
Elliot DeNolf
3b3b1cecc5 chore(release): v3.0.0-beta.48 [skip ci] 2024-06-17 12:55:08 -04:00
Alessio Gravili
e7159c033e fix(ui,richtext-*): path from context should always have precedence over path from props, even if it's an empty string (#6782) 2024-06-15 05:42:16 +00:00
Elliot DeNolf
8f6cedf67a chore(release): v3.0.0-beta.47 [skip ci] 2024-06-13 15:36:34 -04:00
Jacob Fletcher
019677b7e6 chore(eslint): consolidates and prevents duplicate imports (#6756)
## Description

Adds ESLint rule to consolidate duplicate imports using the
`import/no-duplicates` rule of the `eslint-plugin-import` plugin. More
here:
https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-duplicates.md.
This was needed as opposed to `no-duplicate-imports` because of the
auto-fix feature.
2024-06-12 16:45:43 -04:00
Elliot DeNolf
0d31021c25 chore(release): v3.0.0-beta.46 [skip ci] 2024-06-12 16:21:26 -04:00
Alessio Gravili
4e127054ca feat(richtext-lexical)!: sub-field hooks and localization support (#6591)
## BREAKING
- Our internal field hook methods now have new required `schemaPath` and
path `props`. This affects the following functions, if you are using
those: `afterChangeTraverseFields`, `afterReadTraverseFields`,
`beforeChangeTraverseFields`, `beforeValidateTraverseFields`,
`afterReadPromise`
- The afterChange field hook's `value` is now the value AFTER the
previous hooks were run. Previously, this was the original value, which
I believe is a bug
- Only relevant if you have built your own richText adapter: the
richText adapter `populationPromises` property has been renamed to
`graphQLPopulationPromises` and is now only run for graphQL. Previously,
it was run for graphQL AND the rest API. To migrate, use
`hooks.afterRead` to run population for the rest API
- Only relevant if you have built your own lexical features: The
`populationPromises` server feature property has been renamed to
`graphQLPopulationPromises` and is now only run for graphQL. Previously,
it was run for graphQL AND the rest API. To migrate, use
`hooks.afterRead` to run population for the rest API
- Serialized lexical link and upload nodes now have a new `id` property.
While not breaking, localization / hooks will not work for their fields
until you have migrated to that. Re-saving the old document on the new
version will automatically add the `id` property for you. You will also
get a bunch of console logs for every lexical node which is not migrated
2024-06-12 13:33:08 -04:00
Patryk Kowalczyk
74159de1ec fix: add missing export for useLeaf hook (#6693) 2024-06-11 16:12:25 -04:00
Elliot DeNolf
0fb14cfebe chore(release): v3.0.0-beta.45 [skip ci] 2024-06-11 15:09:41 -04:00
Paul
2ada6fc58d fix: toasts padding and button placement by 1px (#6730)
## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
2024-06-11 18:42:17 +00:00
Alessio Gravili
cb3355b30f feat!: move from react-toastify to sonner (#6682)
**BREAKING:** We now export toast from `sonner` instead of
`react-toastify`. If you send out toasts from your own projects, make
sure to use our `toast` export, or install `sonner`. React-toastify
toasts will no longer work anymore. The Toast APIs are mostly similar,
but there are some differences if you provide options to your toast

CSS styles have been changed from Toastify

```css
/* before */
.Toastify


/* current */
.payload-toast-container
.payload-toast-item
.payload-toast-close-button

/* individual toast items will also have these classes depending on the state */
.toast-info
.toast-warning
.toast-success
.toast-error
```


https://github.com/payloadcms/payload/assets/70709113/da3e732e-aafc-4008-9469-b10f4eb06b35

---------

Co-authored-by: Paul Popus <paul@nouance.io>
2024-06-11 14:12:59 -04:00
Elliot DeNolf
36f4f23463 chore(release): v3.0.0-beta.44 [skip ci] 2024-06-11 09:46:31 -04:00
Jacob Fletcher
17707852e0 chore: migrates @faceless-ui imports to esm (#6681) 2024-06-07 22:59:39 -04:00
Elliot DeNolf
8b95218577 chore(release): v3.0.0-beta.43 [skip ci] 2024-06-07 17:45:28 -04:00
Alessio Gravili
9bd9e7a986 feat!: upgrade minimum node 20 version from 20.6.0 to 20.9.0 (#6659)
**BREAKING**:
- This bumps the minimum required node version from node 20.6.0 to node
20.9.0. This is because 20.6.0 breaks type generation due to a CJS node
bug, and 20.9.0 is the next v20 LTS version. The minimum node 18 version
stays the same (18.20.2)
2024-06-06 17:15:21 +00:00
Elliot DeNolf
66e00f8172 chore(release): v3.0.0-beta.42 [skip ci] 2024-06-06 12:21:02 -04:00
Elliot DeNolf
aee3ee21d1 chore(release): v3.0.0-beta.41 [skip ci] 2024-06-05 16:25:52 -04:00
Jacob Fletcher
f91c19e1fd chore(deps): bumps faceless pkgs to react 19-rc (#6622) 2024-06-04 14:05:07 -04:00
Elliot DeNolf
6659fd1b97 chore(release): v3.0.0-beta.40 [skip ci] 2024-06-03 22:37:24 -04:00
Alessio Gravili
5cb49c3307 fix(richtext-*): fix client features were not loaded properly, improve performance of LexicalProvider, slate cell component was non-functional, support richtext adapter Cell RSCs (#6573) 2024-05-30 16:26:06 -04:00
Elliot DeNolf
c68189788c chore(release): v3.0.0-beta.39 [skip ci] 2024-05-30 14:26:03 -04:00
Elliot DeNolf
b86d4c647f chore(release): v3.0.0-beta.38 [skip ci] 2024-05-30 11:24:12 -04:00
Jacob Fletcher
92f458dad2 feat(next,ui): improves loading states (#6434) 2024-05-29 14:01:13 -04:00
Elliot DeNolf
4e0dfd410d chore(release): v3.0.0-beta.37 [skip ci] 2024-05-29 10:54:45 -04:00
Elliot DeNolf
e3222f2ac3 chore(release): v3.0.0-beta.36 [skip ci] 2024-05-23 13:35:19 -04:00
Alessio Gravili
35f961fecb feat!: next.js 15, react 19, react compiler support (#6429)
**BREAKING:**
- bumps minimum required next.js version from `14.3.0-canary.68` to
`15.0.0-rc.0`
- bumps minimum required react and react-dom versions to `19.0.0
`(`19.0.0-rc-f994737d14-20240522` should be used)
- `@types/react` and `@types/react-dom` have to be bumped to
`npm:types-react@19.0.0-beta.2` using overrides and pnpm overrides, if
you want correct types. You can find an example of this here:
https://github.com/payloadcms/payload/pull/6429/files#diff-10cb9e57a77733f174ee2888587281e94c31f79e434aa3f932a8ec72fa7a5121L32

## Issues

- Bunch of todos for our react-select package which is having type
issues. Works fine, just type issues. Their type defs are importing JSX
in a weird way, we likely just have to wait until they fix them in a
future update.
2024-05-23 13:30:12 -04:00
Elliot DeNolf
73d0b209d7 fix: isHotkey webpack error (#6466)
Fixes webpack issue with isHotkey: `TypeError:
is_hotkey__WEBPACK_IMPORTED_MODULE_9__ is not a function`

Changing this from a default import to a named export, and it appears to
resolve the issue.

Fixes #6421
2024-05-22 17:41:15 +00:00
Elliot DeNolf
3d7c8277d7 chore(release): v3.0.0-beta.35 [skip ci] 2024-05-21 10:51:19 -04:00
Alessio Gravili
77528a1e7d chore(richtext-slate): fix richtext container elements direction 2024-05-21 09:40:17 -04:00
Alessio Gravili
ed4766188d fix(ui): tooltip positioning issues (#6439) 2024-05-20 20:37:53 +00:00
Elliot DeNolf
0d544dacdb chore(release): v3.0.0-beta.34 [skip ci] 2024-05-17 16:12:46 -04:00
Elliot DeNolf
eeb689dd55 chore(release): v3.0.0-beta.33 [skip ci] 2024-05-17 14:59:23 -04:00
Alessio Gravili
9d5c0d350c feat!: upgrade minimum next version to 14.3.0-canary.68 & upgrade react packages, react-toastify (#6387)
**BREAKING:**
- The minimum required next version is now 14.3.0-canary.68. This is
because we are migrating away from the deprecated
experimental.serverComponentsExternalPackages next config key to
experimental.serverExternalPackages, which is not available in older
next canaries
- The minimum `react` and `react-dom` versions have been bumped to
^18.2.0 or ^19.0.0. This matches the minimum react version recommended
by next
2024-05-17 12:48:37 -04:00
Elliot DeNolf
0e9bbecbee chore(release): v3.0.0-beta.32 [skip ci] 2024-05-14 17:33:28 -04:00
Elliot DeNolf
f52607f3b5 chore(release): v3.0.0-beta.31 [skip ci] 2024-05-14 12:37:38 -04:00
Elliot DeNolf
a70bcf81c0 chore(release): v3.0.0-beta.30 [skip ci] 2024-05-10 17:10:18 -04:00
Patrik
4216d69ccb fix(richtext-slate): list item values returning null (#6291) 2024-05-10 15:42:37 -04:00
Elliot DeNolf
ffa20aa7d0 chore(release): v3.0.0-beta.29 [skip ci] 2024-05-09 17:19:54 -04:00
Alessio Gravili
cfeac79b99 feat!: fix non-functional custom RSC component handling, separate label and description props, fix non-functional label function handling (#6264)
Breaking Changes:

- Globals config: `admin.description` no longer accepts a custom component. You will have to move it to `admin.components.elements.Description`
- Collections config: `admin.description` no longer accepts a custom component. You will have to move it to `admin.components.edit.Description`
- All Fields: `field.admin.description` no longer accepts a custom component. You will have to move it to `field.admin.components.Description`
- Collapsible Field: `field.label` no longer accepts a custom component. You will have to move it to `field.admin.components.RowLabel`
- Array Field: `field.admin.components.RowLabel` no longer accepts strings or records
- If you are using our exported field components in your own app, their `labelProps` property has been stripped down and no longer contains the `label` and `required` prop. Those can now only be configured at the top-level
2024-05-09 17:12:01 -04:00
Elliot DeNolf
ec556360b6 chore(release): v3.0.0-beta.28 [skip ci] 2024-05-08 14:08:09 -04:00
Elliot DeNolf
e95eea694c chore(release): v3.0.0-beta.27 [skip ci] 2024-05-08 13:33:55 -04:00
Elliot DeNolf
259ae674a1 chore(release): v3.0.0-beta.26 [skip ci] 2024-05-08 11:18:39 -04:00
Elliot DeNolf
892b884745 chore(release): v3.0.0-beta.25 [skip ci] 2024-05-06 13:02:08 -04:00