Skip to content

Commit 27a330d

Browse files
authored
Merge pull request #3712 from udecode/feat/block
Blocks
2 parents dddfa49 + 9f7d52f commit 27a330d

File tree

394 files changed

+13020
-4230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

394 files changed

+13020
-4230
lines changed

apps/www/content/docs/components/cli.mdx

+29-23
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,10 @@ description: Use the CLI to add Plate UI components to your project.
77

88
Use the `init` command to initialize configuration and dependencies for a new project with Plate UI.
99

10-
The `init` command installs dependencies, adds the `cn` util, configures `tailwind.config.js`, and CSS variables for the project.
10+
The `init` command installs dependencies, configures `tailwind.config.js`, and CSS variables for the project.
1111

1212
```bash
13-
npx shadcx@latest init -u https://platejs.org/r -n plate
14-
```
15-
16-
If you also want to use [shadcn/ui](https://ui.shadcn.com/) in your project, you can use the following command:
17-
18-
```bash
19-
npx shadcx@latest init
20-
npx shadcx@latest init -u https://platejs.org/r -n plate
13+
npx shadcx@latest init plate
2114
```
2215

2316
You will be asked a few questions to configure `components.json`:
@@ -30,7 +23,7 @@ Do you want to use CSS variables for colors? › yes
3023
### Options
3124

3225
```txt
33-
Usage: shadcx init [options]
26+
Usage: shadcx init [options] [registry]
3427
3528
initialize your project and install dependencies
3629
@@ -39,10 +32,10 @@ Options:
3932
-f, --force force overwrite of existing components.json. (default: false)
4033
-y, --yes skip confirmation prompt. (default: false)
4134
-c, --cwd <cwd> the working directory. defaults to the current directory.
42-
-u, --url <url> custom registry URL. (default: https://platejs.org/r)
4335
-n, --name <name> registry name. (default: plate)
4436
-s, --silent mute output (default: false)
4537
--src-dir use the src directory when creating a new project (default: false)
38+
--pm <pm> package manager to use (npm, pnpm, yarn, bun)
4639
-h, --help display help for command
4740
```
4841

@@ -51,7 +44,14 @@ Options:
5144
Use the `add` command to add Plate UI components and dependencies to your project.
5245

5346
```bash
54-
npx shadcx@latest add [component] -r plate
47+
# Using prefix syntax
48+
npx shadcx@latest add plate/editor plate/toolbar
49+
50+
# Or mixed usage (registry will be from the first prefix found)
51+
npx shadcx@latest add plate/editor toolbar
52+
53+
# Or using registry option
54+
npx shadcx@latest add editor toolbar -r plate
5555
```
5656

5757
You will be presented with a list of components to choose from:
@@ -99,13 +99,13 @@ Options:
9999
In a monorepo, you can specify the path to your workspace with the `-c` or `--cwd` option.
100100

101101
```bash
102-
npx shadcx@latest init -u https://platejs.org/r -n plate -c ./apps/www
102+
npx shadcx@latest init plate -c ./apps/www
103103
```
104104

105105
or
106106

107107
```bash
108-
npx shadcx@latest add align-dropdown-menu -r plate -c ./apps/www
108+
npx shadcx@latest add plate/editor -c ./apps/www
109109
```
110110

111111
## Example components.json
@@ -114,24 +114,30 @@ Here's an example `components.json` file configured for [shadcn/ui](https://ui.s
114114

115115
```json
116116
{
117+
"$schema": "https://ui.shadcn.com/schema.json",
117118
"style": "default",
118-
"tailwind": {
119-
"config": "tailwind.config.js",
120-
"css": "app/globals.css",
121-
"baseColor": "slate",
122-
"cssVariables": true
123-
},
119+
"rsc": true,
120+
"tsx": true,
124121
"aliases": {
125122
"components": "@/components",
123+
"hooks": "@/hooks",
124+
"lib": "@/lib",
125+
"ui": "@/components/ui",
126126
"utils": "@/lib/utils"
127127
},
128+
"tailwind": {
129+
"baseColor": "slate",
130+
"config": "tailwind.config.ts",
131+
"css": "src/app/globals.css",
132+
"cssVariables": true,
133+
"prefix": ""
134+
},
128135
"registries": {
129136
"plate": {
130-
"url": "https://platejs.org/r",
131-
"style": "default",
132137
"aliases": {
133138
"ui": "@/components/plate-ui"
134-
}
139+
},
140+
"url": "https://platejs.org/r"
135141
}
136142
}
137143
}

apps/www/content/docs/components/components-json.mdx

+8-18
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,9 @@ We use it to understand how your project is set up and how to generate component
1616
You can create a `components.json` file in your project by running the following command:
1717

1818
```bash
19-
npx shadcx@latest init
19+
npx shadcx@latest init plate
2020
```
2121

22-
For Plate UI components, you have two options:
23-
24-
1. Initialize both [shadcn/ui](https://ui.shadcn.com/) and Plate UI:
25-
```bash
26-
npx shadcx@latest init
27-
npx shadcx@latest init -u https://platejs.org/r -n plate
28-
```
29-
30-
2. Initialize only Plate UI:
31-
```bash
32-
npx shadcx@latest init -u https://platejs.org/r -n plate
33-
```
34-
3522
See the [CLI section](/docs/cli) for more information.
3623

3724
## $schema
@@ -220,8 +207,11 @@ The style to use for components from this registry. Plate UI has only one style:
220207
Custom aliases for this registry. This allows you to specify a different location for UI components from this registry.
221208

222209
<Callout>
223-
When using multiple registries, you can use the `-r` or `--registry` option with the `add` command to specify which registry to use:
224-
```bash
225-
npx shadcx@latest add button -r plate
226-
```
210+
211+
When working with multiple registries, you can use the prefix syntax to specify which registry to use for each component:
212+
213+
```bash
214+
npx shadcx@latest add plate/button
215+
```
216+
227217
</Callout>

apps/www/content/docs/components/installation/manual.mdx

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Components are styled using Tailwind CSS. You need to install Tailwind CSS in yo
1616
Add the following dependencies to your project:
1717

1818
```bash
19-
npm install @udecode/cn tailwindcss-animate class-variance-authority tailwind-merge lucide-react
19+
npm install @udecode/plate-common slate slate-react slate-history slate-hyperscript @udecode/cn tailwindcss-animate class-variance-authority tailwind-merge lucide-react
2020
```
2121

2222
We use icons from [Lucide](https://lucide.dev). You can use any icon library you want.
@@ -26,7 +26,7 @@ We use icons from [Lucide](https://lucide.dev). You can use any icon library you
2626
Here's what demo `tailwind.config.js` looks like:
2727

2828
<ComponentSource
29-
src="../../templates/plate-playground-template/tailwind.config.js"
29+
src="../../templates/plate-playground-template/tailwind.config.ts"
3030
open
3131
/>
3232

@@ -35,7 +35,7 @@ Here's what demo `tailwind.config.js` looks like:
3535
Add the following to your `styles/globals.css` file. You can learn more about using CSS variables for theming in the [theming section](/docs/components/theming).
3636

3737
<ComponentSource
38-
src="../../templates/plate-playground-template/src/styles/globals.css"
38+
src="../../templates/plate-playground-template/src/app/globals.css"
3939
open
4040
/>
4141

@@ -44,7 +44,7 @@ Add the following to your `styles/globals.css` file. You can learn more about us
4444
You can now start adding components to your project.
4545

4646
```bash
47-
npx shadcx@latest add paragraph-element -r plate
47+
npx shadcx@latest add plate/paragraph-element
4848
```
4949

5050
</Steps>

apps/www/content/docs/components/installation/next.mdx

+2-11
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ description: Install and configure Next.js.
77

88
A [template](https://github.com/udecode/plate/tree/main/templates/plate-template) is available to help you get started quickly.
99

10-
<Callout>
1110
**If you're using Next.js 15, see the [Next.js 15 + React 19](https://ui.shadcn.com/docs/installation/react-19) guide.**
12-
</Callout>
1311

1412
</Callout>
1513

@@ -20,14 +18,7 @@ A [template](https://github.com/udecode/plate/tree/main/templates/plate-template
2018
Run the `init` command to create a new Next.js project or to setup an existing one:
2119

2220
```bash
23-
npx shadcx@latest init -u https://platejs.org/r -n plate
24-
```
25-
26-
If you want to use [shadcn/ui](https://ui.shadcn.com/) combined with Plate UI, run instead:
27-
28-
```bash
29-
npx shadcx@latest init
30-
npx shadcx@latest init -u https://platejs.org/r -n plate
21+
npx shadcx@latest init plate
3122
```
3223

3324
### Configure components.json
@@ -44,7 +35,7 @@ Do you want to use CSS variables for colors? › no / yes
4435
You can now start adding components to your project.
4536

4637
```bash
47-
npx shadcx@latest add paragraph-element -r plate
38+
npx shadcx@latest add plate/paragraph-element
4839
```
4940

5041
The command above will add the `ParagraphElement` component to your project.

apps/www/content/docs/components/installation/vite.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default defineConfig({
119119
Run `shadcx` init command to setup your project:
120120

121121
```bash
122-
npx shadcx@latest init -u https://platejs.org/r -n plate
122+
npx shadcx@latest init plate
123123
```
124124

125125
### Configure components.json
@@ -136,7 +136,7 @@ Do you want to use CSS variables for colors? › no / yes
136136
You can now start adding components to your project.
137137

138138
```bash
139-
npx shadcx@latest add paragraph-element
139+
npx shadcx@latest add plate/paragraph-element
140140
```
141141

142142
### Register components

apps/www/public/r/config.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"name": "plate",
23
"style": "default",
34
"tailwind": {
45
"baseColor": "slate"

apps/www/public/r/index.json

+57-2
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,35 @@
478478
],
479479
"type": "registry:ui"
480480
},
481+
{
482+
"dependencies": [
483+
"@udecode/plate-media"
484+
],
485+
"doc": {
486+
"description": "A modal component for previewing and manipulating images.",
487+
"docs": [
488+
{
489+
"route": "/docs/media"
490+
},
491+
{
492+
"route": "https://pro.platejs.org/docs/components/image-preview"
493+
}
494+
],
495+
"examples": [
496+
"media-demo",
497+
"media-toolbar-pro"
498+
]
499+
},
500+
"files": [
501+
{
502+
"path": "plate-ui/image-preview.tsx",
503+
"type": "registry:ui"
504+
}
505+
],
506+
"name": "image-preview",
507+
"registryDependencies": [],
508+
"type": "registry:ui"
509+
},
481510
{
482511
"dependencies": [
483512
"@udecode/plate-kbd"
@@ -984,6 +1013,26 @@
9841013
],
9851014
"type": "registry:ui"
9861015
},
1016+
{
1017+
"dependencies": [
1018+
"@radix-ui/react-context-menu"
1019+
],
1020+
"doc": {
1021+
"description": "Displays a menu to the user — such as a set of actions or functions — triggered by a button.",
1022+
"links": {
1023+
"doc": "https://ui.shadcn.com/docs/components/context-menu"
1024+
}
1025+
},
1026+
"files": [
1027+
{
1028+
"path": "plate-ui/context-menu.tsx",
1029+
"type": "registry:ui"
1030+
}
1031+
],
1032+
"name": "context-menu",
1033+
"registryDependencies": [],
1034+
"type": "registry:ui"
1035+
},
9871036
{
9881037
"dependencies": [
9891038
"@radix-ui/react-dialog"
@@ -1147,6 +1196,7 @@
11471196
],
11481197
"name": "ai-menu",
11491198
"registryDependencies": [
1199+
"use-chat",
11501200
"command",
11511201
"popover",
11521202
"editor"
@@ -1248,7 +1298,8 @@
12481298
"name": "block-context-menu",
12491299
"registryDependencies": [
12501300
"calendar",
1251-
"plate-element"
1301+
"plate-element",
1302+
"context-menu"
12521303
],
12531304
"type": "registry:ui"
12541305
},
@@ -1463,7 +1514,11 @@
14631514
"type": "registry:ui"
14641515
},
14651516
{
1466-
"dependencies": [],
1517+
"dependencies": [
1518+
"@udecode/plate-cursor",
1519+
"@udecode/plate-dnd",
1520+
"@udecode/plate-selection"
1521+
],
14671522
"doc": {
14681523
"description": "A visual overlay for collaborative cursors and selections.",
14691524
"docs": [

0 commit comments

Comments
 (0)