Skip to content

Commit 1ce4126

Browse files
authored
Merge pull request #3643 from udecode/sync-shadcn
Sync shadcn
2 parents 688d84f + 27dddce commit 1ce4126

File tree

140 files changed

+1454
-1684
lines changed

Some content is hidden

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

140 files changed

+1454
-1684
lines changed

.eslintrc.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = {
3434
'.out',
3535
'**/*.mdx',
3636
'**/__registry__',
37-
'**/scripts/build-registry.mts',
37+
'**/scripts/*.mts',
3838
],
3939
overrides: [
4040
{

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

-108
This file was deleted.

apps/www/content/docs/components/code-block-element.mdx

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ Copy and paste the following code into your project.
4545
</Step>
4646

4747
<ComponentSource name="code-block-element" />
48-
<ComponentSource src="../../templates/plate-playground-template/src/components/plate-ui/code-block-element.css" />
48+
<ComponentSource name="code-block-element.css" src="src/registry/default/plate-ui/code-block-element.css" />
49+
<ComponentSource name="code-block-combobox.tsx" src="src/registry/default/plate-ui/code-block-combobox.tsx" />
4950

5051
<Step>
5152

apps/www/content/docs/components/color-dropdown-menu.mdx

+5-5
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ Copy and paste the following code into your project.
5656
</Step>
5757

5858
<ComponentSource name="color-dropdown-menu" />
59-
<ComponentSource name="color-dropdown-menu-items" />
60-
<ComponentSource name="color-constants" />
61-
<ComponentSource name="color-input" />
62-
<ComponentSource name="color-picker" />
63-
<ComponentSource name="colors-custom" />
59+
<ComponentSource name="color-dropdown-menu-items" src="src/registry/default/plate-ui/color-dropdown-menu-items.tsx" />
60+
<ComponentSource name="color-constants" src="src/registry/default/plate-ui/color-constants.ts" />
61+
<ComponentSource name="color-input" src="src/registry/default/plate-ui/color-input.tsx" />
62+
<ComponentSource name="color-picker" src="src/registry/default/plate-ui/color-picker.tsx" />
63+
<ComponentSource name="colors-custom" src="src/registry/default/plate-ui/colors-custom.tsx" />
6464

6565
<Step>
6666

apps/www/content/docs/components/comments-popover.mdx

+8-7
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,15 @@ Copy and paste the following code into your project.
5151

5252
</Step>
5353

54-
<ComponentSource name="comment-avatar" />
55-
<ComponentSource name="comment-create-form" />
56-
<ComponentSource name="comment-item" />
57-
<ComponentSource name="comment-more-dropdown" />
58-
<ComponentSource name="comment-reply-items" />
59-
<ComponentSource name="comment-resolve-button" />
60-
<ComponentSource name="comment-value" />
6154
<ComponentSource name="comments-popover" />
55+
<ComponentSource name="comment-avatar" src="src/registry/default/plate-ui/comment-avatar.tsx" />
56+
<ComponentSource name="comment-create-form" src="src/registry/default/plate-ui/comment-create-form.tsx" />
57+
<ComponentSource name="comment-item" src="src/registry/default/plate-ui/comment-item.tsx" />
58+
<ComponentSource name="comment-more-dropdown" src="src/registry/default/plate-ui/comment-more-dropdown.tsx" />
59+
<ComponentSource name="comment-reply-items" src="src/registry/default/plate-ui/comment-reply-items.tsx" />
60+
<ComponentSource name="comment-resolve-button" src="src/registry/default/plate-ui/comment-resolve-button.tsx" />
61+
<ComponentSource name="comment-value" src="src/registry/default/plate-ui/comment-value.tsx" />
62+
6263

6364
<Step>
6465

apps/www/content/docs/components/emoji-dropdown-menu.mdx

+7-7
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ Copy and paste the following code into your project.
4949
</Step>
5050

5151
<ComponentSource name="emoji-dropdown-menu" />
52-
<ComponentSource src="src/registry/default/plate-ui/emoji-icons.tsx" />
53-
<ComponentSource src="src/registry/default/plate-ui/emoji-picker.tsx" />
54-
<ComponentSource src="src/registry/default/plate-ui/emoji-picker-content.tsx" />
55-
<ComponentSource src="src/registry/default/plate-ui/emoji-picker-navigation.tsx" />
56-
<ComponentSource src="src/registry/default/plate-ui/emoji-picker-preview.tsx" />
57-
<ComponentSource src="src/registry/default/plate-ui/emoji-picker-search-and-clear.tsx" />
58-
<ComponentSource src="src/registry/default/plate-ui/emoji-picker-search-bar.tsx" />
52+
<ComponentSource name="emoji-icons" src="src/registry/default/plate-ui/emoji-icons.tsx" />
53+
<ComponentSource name="emoji-picker" src="src/registry/default/plate-ui/emoji-picker.tsx" />
54+
<ComponentSource name="emoji-picker-content" src="src/registry/default/plate-ui/emoji-picker-content.tsx" />
55+
<ComponentSource name="emoji-picker-navigation" src="src/registry/default/plate-ui/emoji-picker-navigation.tsx" />
56+
<ComponentSource name="emoji-picker-preview" src="src/registry/default/plate-ui/emoji-picker-preview.tsx" />
57+
<ComponentSource name="emoji-picker-search-and-clear" src="src/registry/default/plate-ui/emoji-picker-search-and-clear.tsx" />
58+
<ComponentSource name="emoji-picker-search-bar" src="src/registry/default/plate-ui/emoji-picker-search-bar.tsx" />
5959

6060
<Step>
6161

apps/www/content/docs/components/emoji-toolbar-dropdown.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Copy and paste the following code into your project.
4040

4141
</Step>
4242

43-
<ComponentSource name="emoji-toolbar-dropdown" />
43+
<ComponentSource name="emoji-toolbar-dropdown" src="src/registry/default/plate-ui/emoji-toolbar-dropdown.tsx" />
4444

4545
<Step>
4646

apps/www/contentlayer.config.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import { getHighlighter, loadTheme } from '@shikijs/compat';
1+
import { getHighlighter } from '@shikijs/compat';
22
import {
33
defineDocumentType,
44
defineNestedType,
55
makeSource,
66
} from 'contentlayer2/source-files';
7-
import path from 'node:path';
87
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
98
import rehypePrettyCode from 'rehype-pretty-code';
109
import rehypeSlug from 'rehype-slug';
@@ -130,13 +129,8 @@ export default makeSource({
130129
[
131130
rehypePrettyCode,
132131
{
133-
getHighlighter: async () => {
134-
const theme = await loadTheme(
135-
path.join(process.cwd(), '/src/lib/highlighter-theme.json')
136-
);
137-
138-
return await getHighlighter({ theme });
139-
},
132+
getHighlighter,
133+
theme: 'github-dark',
140134
onVisitHighlightedLine(node) {
141135
node.properties.className.push('line--highlighted');
142136
},

apps/www/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
"glob": "^11.0.0",
179179
"mdast-util-toc": "^7.1.0",
180180
"postcss": "^8.4.45",
181+
"puppeteer": "^23.6.0",
181182
"rehype": "^12.0.1",
182183
"rehype-autolink-headings": "^6.1.1",
183184
"rehype-pretty-code": "^0.6.0",

apps/www/public/r/index.json

-34
Original file line numberDiff line numberDiff line change
@@ -39,40 +39,6 @@
3939
],
4040
"type": "registry:ui"
4141
},
42-
{
43-
"dependencies": [
44-
"@udecode/plate-cloud"
45-
],
46-
"files": [
47-
{
48-
"path": "plate-ui/cloud.tsx",
49-
"type": "registry:ui"
50-
},
51-
{
52-
"path": "plate-ui/cloud-attachment-element.tsx",
53-
"type": "registry:ui"
54-
},
55-
{
56-
"path": "plate-ui/cloud-image-element.tsx",
57-
"type": "registry:ui"
58-
},
59-
{
60-
"path": "plate-ui/cloud-resize-controls.tsx",
61-
"type": "registry:ui"
62-
},
63-
{
64-
"path": "plate-ui/cloud-status-bar.tsx",
65-
"type": "registry:ui"
66-
},
67-
{
68-
"path": "plate-ui/cloud-toolbar-buttons.tsx",
69-
"type": "registry:ui"
70-
}
71-
],
72-
"name": "cloud",
73-
"registryDependencies": [],
74-
"type": "registry:ui"
75-
},
7642
{
7743
"dependencies": [
7844
"@udecode/plate-code-block"

apps/www/public/r/styles/default/align-dropdown-menu.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{
77
"content": "'use client';\n\nimport React from 'react';\n\nimport type { DropdownMenuProps } from '@radix-ui/react-dropdown-menu';\n\nimport {\n useAlignDropdownMenu,\n useAlignDropdownMenuState,\n} from '@udecode/plate-alignment/react';\n\nimport { Icons, iconVariants } from '@/components/icons';\n\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuTrigger,\n useOpenState,\n} from './dropdown-menu';\nimport { ToolbarButton } from './toolbar';\n\nconst items = [\n {\n icon: Icons.alignLeft,\n value: 'left',\n },\n {\n icon: Icons.alignCenter,\n value: 'center',\n },\n {\n icon: Icons.alignRight,\n value: 'right',\n },\n {\n icon: Icons.alignJustify,\n value: 'justify',\n },\n];\n\nexport function AlignDropdownMenu({ children, ...props }: DropdownMenuProps) {\n const state = useAlignDropdownMenuState();\n const { radioGroupProps } = useAlignDropdownMenu(state);\n\n const openState = useOpenState();\n const IconValue =\n items.find((item) => item.value === radioGroupProps.value)?.icon ??\n Icons.alignLeft;\n\n return (\n <DropdownMenu modal={false} {...openState} {...props}>\n <DropdownMenuTrigger asChild>\n <ToolbarButton pressed={openState.open} tooltip=\"Align\" isDropdown>\n <IconValue />\n </ToolbarButton>\n </DropdownMenuTrigger>\n\n <DropdownMenuContent className=\"min-w-0\" align=\"start\">\n <DropdownMenuRadioGroup\n className=\"flex flex-col gap-0.5\"\n {...radioGroupProps}\n >\n {items.map(({ icon: Icon, value: itemValue }) => (\n <DropdownMenuRadioItem key={itemValue} value={itemValue} hideIcon>\n <Icon className={iconVariants({ variant: 'toolbar' })} />\n </DropdownMenuRadioItem>\n ))}\n </DropdownMenuRadioGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n",
88
"path": "plate-ui/align-dropdown-menu.tsx",
9-
"target": "",
9+
"target": "components/plate-ui/align-dropdown-menu.tsx",
1010
"type": "registry:ui"
1111
}
1212
],

apps/www/public/r/styles/default/avatar.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{
77
"content": "'use client';\n\nimport * as AvatarPrimitive from '@radix-ui/react-avatar';\nimport { withCn } from '@udecode/cn';\n\nexport const Avatar = withCn(\n AvatarPrimitive.Root,\n 'relative flex size-10 shrink-0 overflow-hidden rounded-full'\n);\n\nexport const AvatarImage = withCn(\n AvatarPrimitive.Image,\n 'aspect-square size-full'\n);\n\nexport const AvatarFallback = withCn(\n AvatarPrimitive.Fallback,\n 'flex size-full items-center justify-center rounded-full bg-muted'\n);\n",
88
"path": "plate-ui/avatar.tsx",
9-
"target": "",
9+
"target": "components/plate-ui/avatar.tsx",
1010
"type": "registry:ui"
1111
}
1212
],
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"files": [
3+
{
4+
"content": "import React from 'react';\n\nimport {\n Plate,\n PlateContent,\n usePlateEditor,\n} from '@udecode/plate-common/react';\n\nexport default function BasicEditorDefaultDemo() {\n const editor = usePlateEditor();\n\n return (\n <Plate editor={editor}>\n <PlateContent placeholder=\"Type...\" />\n </Plate>\n );\n}\n",
5+
"path": "example/basic-editor-default-demo.tsx",
6+
"target": "components/basic-editor-default-demo.tsx",
7+
"type": "registry:example"
8+
}
9+
],
10+
"name": "basic-editor-default-demo",
11+
"registryDependencies": [],
12+
"type": "registry:example"
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"files": [
3+
{
4+
"content": "import React, { useState } from 'react';\n\nimport type { Value } from '@udecode/plate-common';\n\nimport { Plate, usePlateEditor } from '@udecode/plate-common/react';\n\nimport {\n Accordion,\n AccordionContent,\n AccordionItem,\n AccordionTrigger,\n} from '@/components/ui/accordion';\nimport { editableProps } from '@/plate/demo/editableProps';\nimport { Editor } from '@/components/plate-ui/editor';\n\nconst value = [\n {\n children: [\n {\n text: 'This is editable plain text with react and history plugins, just like a textarea!',\n },\n ],\n type: 'p',\n },\n];\n\nexport default function BasicEditorHandlerDemo() {\n const [debugValue, setDebugValue] = useState<Value>(value);\n\n const localValue =\n typeof window !== 'undefined' && localStorage.getItem('editorContent');\n\n const editor = usePlateEditor({\n value: localValue ? JSON.parse(localValue) : value,\n });\n\n return (\n <Plate\n onChange={({ value }) => {\n localStorage.setItem('editorContent', JSON.stringify(value));\n setDebugValue(value);\n }}\n editor={editor}\n >\n <Editor {...editableProps} />\n\n <Accordion type=\"single\" collapsible>\n <AccordionItem value=\"manual-installation\">\n <AccordionTrigger>Debug Value</AccordionTrigger>\n <AccordionContent>{JSON.stringify(debugValue)}</AccordionContent>\n </AccordionItem>\n </Accordion>\n </Plate>\n );\n}\n",
5+
"path": "example/basic-editor-handler-demo.tsx",
6+
"target": "components/basic-editor-handler-demo.tsx",
7+
"type": "registry:example"
8+
}
9+
],
10+
"name": "basic-editor-handler-demo",
11+
"registryDependencies": [],
12+
"type": "registry:example"
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"files": [
3+
{
4+
"content": "import React from 'react';\n\nimport { Plate, usePlateEditor } from '@udecode/plate-common/react';\n\nimport { Editor } from '@/components/plate-ui/editor';\n\nexport default function BasicEditorStylingDemo() {\n const editor = usePlateEditor();\n\n return (\n <Plate editor={editor}>\n <Editor placeholder=\"Type...\" />\n </Plate>\n );\n}\n",
5+
"path": "example/basic-editor-styling-demo.tsx",
6+
"target": "components/basic-editor-styling-demo.tsx",
7+
"type": "registry:example"
8+
}
9+
],
10+
"name": "basic-editor-styling-demo",
11+
"registryDependencies": [],
12+
"type": "registry:example"
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"files": [
3+
{
4+
"content": "import React from 'react';\n\nimport { Plate, usePlateEditor } from '@udecode/plate-common/react';\n\nimport { editableProps } from '@/plate/demo/editableProps';\nimport { Editor } from '@/components/plate-ui/editor';\n\nconst value = [\n {\n children: [\n {\n text: 'This is editable plain text with react and history plugins, just like a <textarea>!',\n },\n ],\n type: 'p',\n },\n];\n\nexport default function BasicEditorValueDemo() {\n const editor = usePlateEditor({ value });\n\n return (\n <Plate editor={editor}>\n <Editor {...editableProps} />\n </Plate>\n );\n}\n",
5+
"path": "example/basic-editor-value-demo.tsx",
6+
"target": "components/basic-editor-value-demo.tsx",
7+
"type": "registry:example"
8+
}
9+
],
10+
"name": "basic-editor-value-demo",
11+
"registryDependencies": [],
12+
"type": "registry:example"
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"files": [
3+
{
4+
"content": "import {\n BoldPlugin,\n CodePlugin,\n ItalicPlugin,\n StrikethroughPlugin,\n UnderlinePlugin,\n} from '@udecode/plate-basic-marks/react';\nimport { BlockquotePlugin } from '@udecode/plate-block-quote/react';\nimport { CodeBlockPlugin } from '@udecode/plate-code-block/react';\nimport { Plate, usePlateEditor } from '@udecode/plate-common/react';\nimport { HeadingPlugin } from '@udecode/plate-heading/react';\nimport Prism from 'prismjs';\n\nimport { createPlateUI } from '@/lib/plate/create-plate-ui';\nimport { Editor } from '@/components/plate-ui/editor';\n\nexport default function BasicPluginsComponentsDemo() {\n const editor = usePlateEditor({\n override: { components: createPlateUI() },\n plugins: [\n BlockquotePlugin,\n CodeBlockPlugin.configure({ options: { prism: Prism } }),\n HeadingPlugin,\n BoldPlugin,\n ItalicPlugin,\n UnderlinePlugin,\n StrikethroughPlugin,\n CodePlugin,\n ],\n value: basicEditorValue,\n });\n\n return (\n <Plate editor={editor}>\n <Editor placeholder=\"Type...\" autoFocus={false} spellCheck={false} />\n </Plate>\n );\n}\n\nexport const basicEditorValue = [\n {\n id: '1',\n children: [\n {\n text: '🌳 Blocks',\n },\n ],\n type: 'h1',\n },\n {\n id: '2',\n children: [\n {\n text: 'Easily create headings of various levels, from H1 to H6, to structure your content and make it more organized.',\n },\n ],\n type: 'p',\n },\n {\n id: '3',\n children: [\n {\n text: 'Create blockquotes to emphasize important information or highlight quotes from external sources.',\n },\n ],\n type: 'blockquote',\n },\n {\n id: '4',\n children: [\n {\n children: [\n {\n text: '// Use code blocks to showcase code snippets',\n },\n ],\n type: 'code_line',\n },\n {\n children: [\n {\n text: 'function greet() {',\n },\n ],\n type: 'code_line',\n },\n {\n children: [\n {\n text: \" console.info('Hello World!');\",\n },\n ],\n type: 'code_line',\n },\n {\n children: [\n {\n text: '}',\n },\n ],\n type: 'code_line',\n },\n ],\n lang: 'javascript',\n type: 'code_block',\n },\n {\n id: '1',\n children: [\n {\n text: '🌱 Marks',\n },\n ],\n type: 'h1',\n },\n {\n id: '2',\n children: [\n {\n text: 'Add style and emphasis to your text using the mark plugins, which offers a variety of formatting options.',\n },\n ],\n type: 'p',\n },\n {\n id: '3',\n children: [\n {\n text: 'Make text ',\n },\n {\n bold: true,\n text: 'bold',\n },\n {\n text: ', ',\n },\n {\n italic: true,\n text: 'italic',\n },\n {\n text: ', ',\n },\n {\n text: 'underlined',\n underline: true,\n },\n {\n text: ', or apply a ',\n },\n {\n bold: true,\n italic: true,\n text: 'combination',\n underline: true,\n },\n {\n text: ' of these styles for a visually striking effect.',\n },\n ],\n type: 'p',\n },\n {\n id: '4',\n children: [\n {\n text: 'Add ',\n },\n {\n strikethrough: true,\n text: 'strikethrough',\n },\n {\n text: ' to indicate deleted or outdated content.',\n },\n ],\n type: 'p',\n },\n {\n id: '5',\n children: [\n {\n text: 'Write code snippets with inline ',\n },\n {\n code: true,\n text: 'code',\n },\n {\n text: ' formatting for easy readability.',\n },\n ],\n type: 'p',\n },\n {\n id: '6',\n children: [\n {\n text: 'Press ',\n },\n {\n kbd: true,\n text: '⌘+B',\n },\n {\n text: ' to apply bold mark or ',\n },\n {\n kbd: true,\n text: '⌘+I',\n },\n {\n text: ' for italic mark.',\n },\n ],\n type: 'p',\n },\n];\n",
5+
"path": "example/basic-plugins-components-demo.tsx",
6+
"target": "components/basic-plugins-components-demo.tsx",
7+
"type": "registry:example"
8+
}
9+
],
10+
"name": "basic-plugins-components-demo",
11+
"registryDependencies": [],
12+
"type": "registry:example"
13+
}

0 commit comments

Comments
 (0)