@puckeditor/cli 0.24.0-canary.301a0304
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +45 -0
- package/dist/bin.mjs +7304 -0
- package/dist/docs/api-reference/actions.md +63 -0
- package/dist/docs/api-reference/components/action-bar-action.md +35 -0
- package/dist/docs/api-reference/components/action-bar-group.md +24 -0
- package/dist/docs/api-reference/components/action-bar-label.md +25 -0
- package/dist/docs/api-reference/components/action-bar-separator.md +16 -0
- package/dist/docs/api-reference/components/action-bar.md +32 -0
- package/dist/docs/api-reference/components/auto-field.md +63 -0
- package/dist/docs/api-reference/components/drawer-item.md +75 -0
- package/dist/docs/api-reference/components/drawer.md +29 -0
- package/dist/docs/api-reference/components/drop-zone.md +232 -0
- package/dist/docs/api-reference/components/field-label.md +138 -0
- package/dist/docs/api-reference/components/inline-text-field.md +77 -0
- package/dist/docs/api-reference/components/puck-components.md +19 -0
- package/dist/docs/api-reference/components/puck-fields.md +39 -0
- package/dist/docs/api-reference/components/puck-layout.md +27 -0
- package/dist/docs/api-reference/components/puck-outline.md +19 -0
- package/dist/docs/api-reference/components/puck-preview.md +39 -0
- package/dist/docs/api-reference/components/puck.md +561 -0
- package/dist/docs/api-reference/components/render.md +94 -0
- package/dist/docs/api-reference/components/rich-text-menu-control.md +87 -0
- package/dist/docs/api-reference/components/rich-text-menu-group.md +27 -0
- package/dist/docs/api-reference/components/rich-text-menu.md +99 -0
- package/dist/docs/api-reference/components.md +32 -0
- package/dist/docs/api-reference/configuration/component-config.md +569 -0
- package/dist/docs/api-reference/configuration/config.md +108 -0
- package/dist/docs/api-reference/configuration.md +4 -0
- package/dist/docs/api-reference/data-model/app-state.md +168 -0
- package/dist/docs/api-reference/data-model/component-data.md +62 -0
- package/dist/docs/api-reference/data-model/data.md +95 -0
- package/dist/docs/api-reference/data-model/item-selector.md +34 -0
- package/dist/docs/api-reference/data-model/root-data.md +59 -0
- package/dist/docs/api-reference/data-model.md +8 -0
- package/dist/docs/api-reference/dictionary.md +172 -0
- package/dist/docs/api-reference/field-transforms.md +51 -0
- package/dist/docs/api-reference/fields/array.md +211 -0
- package/dist/docs/api-reference/fields/base.md +96 -0
- package/dist/docs/api-reference/fields/custom.md +193 -0
- package/dist/docs/api-reference/fields/external.md +413 -0
- package/dist/docs/api-reference/fields/number.md +132 -0
- package/dist/docs/api-reference/fields/object.md +78 -0
- package/dist/docs/api-reference/fields/radio.md +82 -0
- package/dist/docs/api-reference/fields/richtext.md +422 -0
- package/dist/docs/api-reference/fields/select.md +79 -0
- package/dist/docs/api-reference/fields/slot.md +302 -0
- package/dist/docs/api-reference/fields/text.md +93 -0
- package/dist/docs/api-reference/fields/textarea.md +93 -0
- package/dist/docs/api-reference/fields.md +16 -0
- package/dist/docs/api-reference/functions/migrate.md +204 -0
- package/dist/docs/api-reference/functions/register-overlay-portal.md +45 -0
- package/dist/docs/api-reference/functions/resolve-all-data.md +27 -0
- package/dist/docs/api-reference/functions/set-deep.md +55 -0
- package/dist/docs/api-reference/functions/transform-props.md +51 -0
- package/dist/docs/api-reference/functions/use-get-puck.md +24 -0
- package/dist/docs/api-reference/functions/use-puck.md +43 -0
- package/dist/docs/api-reference/functions/walk-tree.md +88 -0
- package/dist/docs/api-reference/functions.md +8 -0
- package/dist/docs/api-reference/overrides/action-bar.md +35 -0
- package/dist/docs/api-reference/overrides/component-overlay.md +41 -0
- package/dist/docs/api-reference/overrides/drawer-item.md +24 -0
- package/dist/docs/api-reference/overrides/drawer.md +19 -0
- package/dist/docs/api-reference/overrides/field-label.md +18 -0
- package/dist/docs/api-reference/overrides/field-types.md +51 -0
- package/dist/docs/api-reference/overrides/fields.md +19 -0
- package/dist/docs/api-reference/overrides/header-actions.md +24 -0
- package/dist/docs/api-reference/overrides/header.md +29 -0
- package/dist/docs/api-reference/overrides/iframe.md +32 -0
- package/dist/docs/api-reference/overrides/outline.md +19 -0
- package/dist/docs/api-reference/overrides/preview.md +19 -0
- package/dist/docs/api-reference/overrides/puck.md +19 -0
- package/dist/docs/api-reference/overrides.md +28 -0
- package/dist/docs/api-reference/permissions.md +55 -0
- package/dist/docs/api-reference/plugin.md +112 -0
- package/dist/docs/api-reference/plugins/blocks-plugin.md +57 -0
- package/dist/docs/api-reference/plugins/fields-plugin.md +68 -0
- package/dist/docs/api-reference/plugins/legacy-side-bar-plugin.md +54 -0
- package/dist/docs/api-reference/plugins/outline-plugin.md +57 -0
- package/dist/docs/api-reference/puck-api.md +278 -0
- package/dist/docs/api-reference/theming/action-bar.md +32 -0
- package/dist/docs/api-reference/theming/button.md +65 -0
- package/dist/docs/api-reference/theming/canvas.md +20 -0
- package/dist/docs/api-reference/theming/computed-values.md +194 -0
- package/dist/docs/api-reference/theming/drawer.md +34 -0
- package/dist/docs/api-reference/theming/fields.md +70 -0
- package/dist/docs/api-reference/theming/global.md +127 -0
- package/dist/docs/api-reference/theming/header.md +19 -0
- package/dist/docs/api-reference/theming/icon-button.md +28 -0
- package/dist/docs/api-reference/theming/outline.md +35 -0
- package/dist/docs/api-reference/theming/plugin-bar.md +24 -0
- package/dist/docs/api-reference/theming/sidebar.md +19 -0
- package/dist/docs/api-reference/theming/slot.md +27 -0
- package/dist/docs/cli.md +201 -0
- package/dist/docs/extending-puck/composition.md +54 -0
- package/dist/docs/extending-puck/custom-fields.md +133 -0
- package/dist/docs/extending-puck/field-transforms.md +89 -0
- package/dist/docs/extending-puck/internal-puck-api.md +96 -0
- package/dist/docs/extending-puck/plugins.md +159 -0
- package/dist/docs/extending-puck/theming.md +88 -0
- package/dist/docs/extending-puck/ui-overrides.md +134 -0
- package/dist/docs/getting-started.md +68 -0
- package/dist/docs/guides/migrations/dropzones-to-slots.md +138 -0
- package/dist/docs/index.json +466 -0
- package/dist/docs/index.md +37 -0
- package/dist/docs/integrating-puck/categories.md +92 -0
- package/dist/docs/integrating-puck/component-configuration.md +159 -0
- package/dist/docs/integrating-puck/data-migration.md +86 -0
- package/dist/docs/integrating-puck/dynamic-fields.md +86 -0
- package/dist/docs/integrating-puck/dynamic-props.md +137 -0
- package/dist/docs/integrating-puck/external-data-sources.md +149 -0
- package/dist/docs/integrating-puck/feature-toggling.md +121 -0
- package/dist/docs/integrating-puck/localization.md +228 -0
- package/dist/docs/integrating-puck/multi-column-layouts.md +226 -0
- package/dist/docs/integrating-puck/overlay-portals.md +25 -0
- package/dist/docs/integrating-puck/rich-text-editing.md +230 -0
- package/dist/docs/integrating-puck/root-configuration.md +171 -0
- package/dist/docs/integrating-puck/server-components.md +199 -0
- package/dist/docs/integrating-puck/styling.md +117 -0
- package/dist/docs/integrating-puck/viewports.md +75 -0
- package/dist/templates/astro/README.md +52 -0
- package/dist/templates/astro/_gitignore +24 -0
- package/dist/templates/astro/astro.config.mjs +14 -0
- package/dist/templates/astro/database.json +1 -0
- package/dist/templates/astro/package.json +25 -0
- package/dist/templates/astro/public/favicon.svg +9 -0
- package/dist/templates/astro/src/lib/pages.ts +21 -0
- package/dist/templates/astro/src/lib/resolve-puck-path.ts +19 -0
- package/dist/templates/astro/src/pages/[...puckPath].astro +25 -0
- package/dist/templates/astro/src/pages/api/pages.ts +18 -0
- package/dist/templates/astro/src/puck/editor.tsx +32 -0
- package/dist/templates/astro/src/puck/pages.ts +15 -0
- package/dist/templates/astro/src/puck/render.tsx +9 -0
- package/dist/templates/astro/src/puck.config.tsx +23 -0
- package/dist/templates/astro/tsconfig.json +14 -0
- package/dist/templates/astro-ai/README.md +64 -0
- package/dist/templates/astro-ai/_gitignore +24 -0
- package/dist/templates/astro-ai/astro.config.mjs +21 -0
- package/dist/templates/astro-ai/database.json +1 -0
- package/dist/templates/astro-ai/package.json +27 -0
- package/dist/templates/astro-ai/public/favicon.svg +9 -0
- package/dist/templates/astro-ai/src/lib/pages.ts +21 -0
- package/dist/templates/astro-ai/src/lib/resolve-puck-path.ts +19 -0
- package/dist/templates/astro-ai/src/pages/[...puckPath].astro +25 -0
- package/dist/templates/astro-ai/src/pages/api/pages.ts +18 -0
- package/dist/templates/astro-ai/src/pages/api/puck/[...all].ts +36 -0
- package/dist/templates/astro-ai/src/puck/editor.tsx +53 -0
- package/dist/templates/astro-ai/src/puck/pages.ts +15 -0
- package/dist/templates/astro-ai/src/puck/render.tsx +10 -0
- package/dist/templates/astro-ai/src/puck.config.tsx +23 -0
- package/dist/templates/astro-ai/tsconfig.json +14 -0
- package/dist/templates/express/README.md +66 -0
- package/dist/templates/express/_gitignore +16 -0
- package/dist/templates/express/database.json +1 -0
- package/dist/templates/express/package.json +20 -0
- package/dist/templates/express/src/index.ts +15 -0
- package/dist/templates/express/src/puck/pages.ts +39 -0
- package/dist/templates/express/tsconfig.json +12 -0
- package/dist/templates/express-ai/README.md +81 -0
- package/dist/templates/express-ai/_gitignore +16 -0
- package/dist/templates/express-ai/database.json +1 -0
- package/dist/templates/express-ai/package.json +22 -0
- package/dist/templates/express-ai/src/index.ts +17 -0
- package/dist/templates/express-ai/src/puck/cloud.ts +71 -0
- package/dist/templates/express-ai/src/puck/pages.ts +39 -0
- package/dist/templates/express-ai/tsconfig.json +12 -0
- package/dist/templates/hono/README.md +66 -0
- package/dist/templates/hono/_gitignore +32 -0
- package/dist/templates/hono/database.json +1 -0
- package/dist/templates/hono/package.json +20 -0
- package/dist/templates/hono/src/index.ts +21 -0
- package/dist/templates/hono/src/puck/pages.ts +32 -0
- package/dist/templates/hono/tsconfig.json +13 -0
- package/dist/templates/hono-ai/README.md +81 -0
- package/dist/templates/hono-ai/_gitignore +32 -0
- package/dist/templates/hono-ai/database.json +1 -0
- package/dist/templates/hono-ai/package.json +22 -0
- package/dist/templates/hono-ai/src/index.ts +23 -0
- package/dist/templates/hono-ai/src/puck/cloud.ts +30 -0
- package/dist/templates/hono-ai/src/puck/pages.ts +32 -0
- package/dist/templates/hono-ai/tsconfig.json +13 -0
- package/dist/templates/manifest.json +4 -0
- package/dist/templates/next/README.md +112 -0
- package/dist/templates/next/_gitignore +35 -0
- package/dist/templates/next/app/[...puckPath]/client.tsx +9 -0
- package/dist/templates/next/app/[...puckPath]/page.tsx +49 -0
- package/dist/templates/next/app/favicon.ico +0 -0
- package/dist/templates/next/app/layout.tsx +13 -0
- package/dist/templates/next/app/page.tsx +1 -0
- package/dist/templates/next/app/puck/[...puckPath]/client.tsx +20 -0
- package/dist/templates/next/app/puck/[...puckPath]/page.tsx +55 -0
- package/dist/templates/next/app/puck/api/route.ts +25 -0
- package/dist/templates/next/app/puck/page.tsx +3 -0
- package/dist/templates/next/app/styles.css +3 -0
- package/dist/templates/next/database.json +1 -0
- package/dist/templates/next/lib/get-page.ts +11 -0
- package/dist/templates/next/next.config.js +3 -0
- package/dist/templates/next/package.json +25 -0
- package/dist/templates/next/proxy.ts +27 -0
- package/dist/templates/next/puck.config.tsx +25 -0
- package/dist/templates/next/tsconfig/base.json +20 -0
- package/dist/templates/next/tsconfig/nextjs.json +21 -0
- package/dist/templates/next/tsconfig.json +8 -0
- package/dist/templates/next-ai/README.md +169 -0
- package/dist/templates/next-ai/_gitignore +35 -0
- package/dist/templates/next-ai/app/[...puckPath]/client.tsx +12 -0
- package/dist/templates/next-ai/app/[...puckPath]/page.tsx +49 -0
- package/dist/templates/next-ai/app/api/pages/route.ts +26 -0
- package/dist/templates/next-ai/app/api/puck/[...all]/route.ts +31 -0
- package/dist/templates/next-ai/app/layout.tsx +13 -0
- package/dist/templates/next-ai/app/page.tsx +1 -0
- package/dist/templates/next-ai/app/puck/[...puckPath]/client.tsx +38 -0
- package/dist/templates/next-ai/app/puck/[...puckPath]/page.tsx +57 -0
- package/dist/templates/next-ai/app/puck/page.tsx +3 -0
- package/dist/templates/next-ai/app/styles.css +3 -0
- package/dist/templates/next-ai/database.json +1 -0
- package/dist/templates/next-ai/lib/get-page.ts +11 -0
- package/dist/templates/next-ai/next.config.js +3 -0
- package/dist/templates/next-ai/package.json +27 -0
- package/dist/templates/next-ai/proxy.ts +27 -0
- package/dist/templates/next-ai/public/favicon.ico +0 -0
- package/dist/templates/next-ai/puck.config.tsx +25 -0
- package/dist/templates/next-ai/tsconfig/base.json +20 -0
- package/dist/templates/next-ai/tsconfig/nextjs.json +21 -0
- package/dist/templates/next-ai/tsconfig.json +8 -0
- package/dist/templates/react-router/README.md +113 -0
- package/dist/templates/react-router/_gitignore +6 -0
- package/dist/templates/react-router/app/components/puck-render.tsx +8 -0
- package/dist/templates/react-router/app/lib/pages.server.ts +29 -0
- package/dist/templates/react-router/app/lib/resolve-puck-path.server.ts +19 -0
- package/dist/templates/react-router/app/root.tsx +65 -0
- package/dist/templates/react-router/app/routes/_index.tsx +31 -0
- package/dist/templates/react-router/app/routes/puck-splat.tsx +95 -0
- package/dist/templates/react-router/app/routes.ts +7 -0
- package/dist/templates/react-router/database.json +1 -0
- package/dist/templates/react-router/package.json +33 -0
- package/dist/templates/react-router/public/favicon.ico +0 -0
- package/dist/templates/react-router/puck.config.tsx +23 -0
- package/dist/templates/react-router/react-router.config.ts +7 -0
- package/dist/templates/react-router/tsconfig.json +29 -0
- package/dist/templates/react-router/vite.config.ts +10 -0
- package/dist/templates/react-router-ai/README.md +172 -0
- package/dist/templates/react-router-ai/_gitignore +6 -0
- package/dist/templates/react-router-ai/app/components/puck-render.tsx +11 -0
- package/dist/templates/react-router-ai/app/lib/pages.server.ts +29 -0
- package/dist/templates/react-router-ai/app/lib/resolve-puck-path.server.ts +19 -0
- package/dist/templates/react-router-ai/app/root.tsx +65 -0
- package/dist/templates/react-router-ai/app/routes/_index.tsx +31 -0
- package/dist/templates/react-router-ai/app/routes/api.puck.ts +34 -0
- package/dist/templates/react-router-ai/app/routes/puck-splat.tsx +119 -0
- package/dist/templates/react-router-ai/app/routes.ts +8 -0
- package/dist/templates/react-router-ai/database.json +1 -0
- package/dist/templates/react-router-ai/package.json +35 -0
- package/dist/templates/react-router-ai/public/favicon.ico +0 -0
- package/dist/templates/react-router-ai/puck.config.tsx +25 -0
- package/dist/templates/react-router-ai/react-router.config.ts +7 -0
- package/dist/templates/react-router-ai/tsconfig.json +29 -0
- package/dist/templates/react-router-ai/vite.config.ts +10 -0
- package/dist/templates/tanstack-start/README.md +113 -0
- package/dist/templates/tanstack-start/_gitignore +12 -0
- package/dist/templates/tanstack-start/database.json +1 -0
- package/dist/templates/tanstack-start/package.json +26 -0
- package/dist/templates/tanstack-start/puck.config.tsx +23 -0
- package/dist/templates/tanstack-start/src/components/puck-render.tsx +8 -0
- package/dist/templates/tanstack-start/src/lib/pages.server.ts +26 -0
- package/dist/templates/tanstack-start/src/lib/pages.ts +39 -0
- package/dist/templates/tanstack-start/src/lib/resolve-puck-path.ts +19 -0
- package/dist/templates/tanstack-start/src/routeTree.gen.ts +86 -0
- package/dist/templates/tanstack-start/src/router.tsx +19 -0
- package/dist/templates/tanstack-start/src/routes/$.tsx +41 -0
- package/dist/templates/tanstack-start/src/routes/__root.tsx +42 -0
- package/dist/templates/tanstack-start/src/routes/index.tsx +18 -0
- package/dist/templates/tanstack-start/src/styles.css +13 -0
- package/dist/templates/tanstack-start/tsconfig.json +24 -0
- package/dist/templates/tanstack-start/vite.config.ts +15 -0
- package/dist/templates/tanstack-start-ai/README.md +171 -0
- package/dist/templates/tanstack-start-ai/_gitignore +12 -0
- package/dist/templates/tanstack-start-ai/database.json +1 -0
- package/dist/templates/tanstack-start-ai/package.json +28 -0
- package/dist/templates/tanstack-start-ai/puck.config.tsx +23 -0
- package/dist/templates/tanstack-start-ai/src/components/puck-render.tsx +11 -0
- package/dist/templates/tanstack-start-ai/src/lib/pages.server.ts +26 -0
- package/dist/templates/tanstack-start-ai/src/lib/pages.ts +39 -0
- package/dist/templates/tanstack-start-ai/src/lib/resolve-puck-path.ts +19 -0
- package/dist/templates/tanstack-start-ai/src/routeTree.gen.ts +104 -0
- package/dist/templates/tanstack-start-ai/src/router.tsx +19 -0
- package/dist/templates/tanstack-start-ai/src/routes/$.tsx +73 -0
- package/dist/templates/tanstack-start-ai/src/routes/__root.tsx +42 -0
- package/dist/templates/tanstack-start-ai/src/routes/api/puck/$.ts +39 -0
- package/dist/templates/tanstack-start-ai/src/routes/index.tsx +18 -0
- package/dist/templates/tanstack-start-ai/src/styles.css +13 -0
- package/dist/templates/tanstack-start-ai/tsconfig.json +24 -0
- package/dist/templates/tanstack-start-ai/vite.config.ts +15 -0
- package/dist/templates/vinext/README.md +112 -0
- package/dist/templates/vinext/_gitignore +33 -0
- package/dist/templates/vinext/app/[...puckPath]/client.tsx +9 -0
- package/dist/templates/vinext/app/[...puckPath]/page.tsx +49 -0
- package/dist/templates/vinext/app/favicon.ico +0 -0
- package/dist/templates/vinext/app/layout.tsx +13 -0
- package/dist/templates/vinext/app/page.tsx +1 -0
- package/dist/templates/vinext/app/puck/[...puckPath]/client.tsx +20 -0
- package/dist/templates/vinext/app/puck/[...puckPath]/page.tsx +55 -0
- package/dist/templates/vinext/app/puck/api/route.ts +25 -0
- package/dist/templates/vinext/app/puck/page.tsx +3 -0
- package/dist/templates/vinext/app/styles.css +3 -0
- package/dist/templates/vinext/database.json +1 -0
- package/dist/templates/vinext/lib/get-page.ts +11 -0
- package/dist/templates/vinext/package.json +30 -0
- package/dist/templates/vinext/proxy.ts +27 -0
- package/dist/templates/vinext/puck.config.tsx +25 -0
- package/dist/templates/vinext/tsconfig.json +30 -0
- package/dist/templates/vinext/vite.config.ts +6 -0
- package/dist/templates/vinext-ai/README.md +169 -0
- package/dist/templates/vinext-ai/_gitignore +33 -0
- package/dist/templates/vinext-ai/app/[...puckPath]/client.tsx +12 -0
- package/dist/templates/vinext-ai/app/[...puckPath]/page.tsx +49 -0
- package/dist/templates/vinext-ai/app/api/pages/route.ts +26 -0
- package/dist/templates/vinext-ai/app/api/puck/[...all]/route.ts +31 -0
- package/dist/templates/vinext-ai/app/layout.tsx +13 -0
- package/dist/templates/vinext-ai/app/page.tsx +1 -0
- package/dist/templates/vinext-ai/app/puck/[...puckPath]/client.tsx +38 -0
- package/dist/templates/vinext-ai/app/puck/[...puckPath]/page.tsx +57 -0
- package/dist/templates/vinext-ai/app/puck/page.tsx +3 -0
- package/dist/templates/vinext-ai/app/styles.css +3 -0
- package/dist/templates/vinext-ai/database.json +1 -0
- package/dist/templates/vinext-ai/lib/get-page.ts +11 -0
- package/dist/templates/vinext-ai/package.json +32 -0
- package/dist/templates/vinext-ai/proxy.ts +27 -0
- package/dist/templates/vinext-ai/public/favicon.ico +0 -0
- package/dist/templates/vinext-ai/puck.config.tsx +25 -0
- package/dist/templates/vinext-ai/tsconfig.json +30 -0
- package/dist/templates/vinext-ai/vite.config.ts +9 -0
- package/dist/templates/vite/README.md +56 -0
- package/dist/templates/vite/_gitignore +24 -0
- package/dist/templates/vite/database.json +1 -0
- package/dist/templates/vite/index.html +12 -0
- package/dist/templates/vite/package.json +29 -0
- package/dist/templates/vite/server/index.ts +13 -0
- package/dist/templates/vite/server/prod.ts +18 -0
- package/dist/templates/vite/server/puck/pages.ts +32 -0
- package/dist/templates/vite/src/App.tsx +11 -0
- package/dist/templates/vite/src/main.tsx +12 -0
- package/dist/templates/vite/src/puck/editor.tsx +28 -0
- package/dist/templates/vite/src/puck/page.tsx +27 -0
- package/dist/templates/vite/src/puck/pages.ts +15 -0
- package/dist/templates/vite/src/puck/root.tsx +27 -0
- package/dist/templates/vite/src/puck.config.tsx +23 -0
- package/dist/templates/vite/tsconfig.app.json +26 -0
- package/dist/templates/vite/tsconfig.json +7 -0
- package/dist/templates/vite/tsconfig.node.json +23 -0
- package/dist/templates/vite/vite.config.ts +14 -0
- package/dist/templates/vite-ai/README.md +67 -0
- package/dist/templates/vite-ai/_gitignore +24 -0
- package/dist/templates/vite-ai/database.json +1 -0
- package/dist/templates/vite-ai/index.html +12 -0
- package/dist/templates/vite-ai/package.json +31 -0
- package/dist/templates/vite-ai/server/index.ts +15 -0
- package/dist/templates/vite-ai/server/prod.ts +18 -0
- package/dist/templates/vite-ai/server/puck/cloud.ts +30 -0
- package/dist/templates/vite-ai/server/puck/pages.ts +32 -0
- package/dist/templates/vite-ai/src/App.tsx +11 -0
- package/dist/templates/vite-ai/src/main.tsx +12 -0
- package/dist/templates/vite-ai/src/puck/editor.tsx +49 -0
- package/dist/templates/vite-ai/src/puck/page.tsx +28 -0
- package/dist/templates/vite-ai/src/puck/pages.ts +15 -0
- package/dist/templates/vite-ai/src/puck/root.tsx +27 -0
- package/dist/templates/vite-ai/src/puck.config.tsx +23 -0
- package/dist/templates/vite-ai/tsconfig.app.json +26 -0
- package/dist/templates/vite-ai/tsconfig.json +7 -0
- package/dist/templates/vite-ai/tsconfig.node.json +23 -0
- package/dist/templates/vite-ai/vite.config.ts +14 -0
- package/package.json +51 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Actions
|
|
2
|
+
|
|
3
|
+
Actions enable you to make changes to the internal [AppState](/docs/api-reference/data-model/app-state) via the [dispatcher](/docs/api-reference/puck-api#dispatch).
|
|
4
|
+
|
|
5
|
+
This is a partial reference of the most useful actions. A full reference is available in [the codebase](https://github.com/puckeditor/puck/blob/main/packages/core/reducer/actions.tsx).
|
|
6
|
+
|
|
7
|
+
## Types
|
|
8
|
+
|
|
9
|
+
### `setData`
|
|
10
|
+
|
|
11
|
+
Modify the [data payload](/docs/api-reference/data-model/data) currently managed by Puck.
|
|
12
|
+
|
|
13
|
+
| Param | Example | Type | Status |
|
|
14
|
+
| ------ | ----------------- | ------------------------------------------- | -------- |
|
|
15
|
+
| `type` | `type: "setData"` | "setData" | Required |
|
|
16
|
+
| `data` | `data: {}` | [Data](/docs/api-reference/data-model/data) | Required |
|
|
17
|
+
|
|
18
|
+
#### Example
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
dispatch({
|
|
22
|
+
type: "setData",
|
|
23
|
+
data: {},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### `setUi`
|
|
28
|
+
|
|
29
|
+
Change a value on Puck's [UI state](/docs/api-reference/data-model/app-state#ui).
|
|
30
|
+
|
|
31
|
+
| Param | Example | Type | Status |
|
|
32
|
+
| ------ | ----------------------------------- | -------------------------------------------- | -------- |
|
|
33
|
+
| `type` | `type: "setUi"` | "setUi" | Required |
|
|
34
|
+
| `ui` | `ui: { leftSideBarVisible: false }` | [UiState](/docs/api-reference/app-state/#ui) | Required |
|
|
35
|
+
|
|
36
|
+
#### Example
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
dispatch({
|
|
40
|
+
type: "setUi",
|
|
41
|
+
ui: {
|
|
42
|
+
leftSideBarVisible: false,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### `set`
|
|
48
|
+
|
|
49
|
+
Change the entire [AppState](/docs/api-reference/data-model/app-state) in a single action.
|
|
50
|
+
|
|
51
|
+
| Param | Example | Type | Status |
|
|
52
|
+
| ------- | ----------------------------- | ---------------------------------------------------- | -------- |
|
|
53
|
+
| `type` | `type: "set"` | "set" | Required |
|
|
54
|
+
| `state` | `state: { data: {}, ui: {} }` | [AppState](/docs/api-reference/data-model/app-state) | Required |
|
|
55
|
+
|
|
56
|
+
#### Example
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
dispatch({
|
|
60
|
+
type: "set",
|
|
61
|
+
state: { data: {}, ui: {} },
|
|
62
|
+
});
|
|
63
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# \<ActionBar.Action\>
|
|
2
|
+
|
|
3
|
+
Render an action button in the [`<ActionBar>`](/docs/api-reference/components/action-bar). Often used inside an [`<ActionBar.Group>`](/docs/api-reference/components/action-bar-group).
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<ActionBar>
|
|
7
|
+
<ActionBar.Action onClick={() => console.log("Clicked!")}>★</ActionBar.Action>
|
|
8
|
+
</ActionBar>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Example | Type | Status |
|
|
14
|
+
| ----------------------- | ------------ | --------- | -------- |
|
|
15
|
+
| [`children`](#children) | `<svg />` | ReactNode | Required |
|
|
16
|
+
| [`onClick`](#on-clicke) | `() => void` | Function | - |
|
|
17
|
+
| [`label`](#label) | `"Label"` | String | - |
|
|
18
|
+
|
|
19
|
+
## Required Props
|
|
20
|
+
|
|
21
|
+
### `children`
|
|
22
|
+
|
|
23
|
+
A node to render as the children of the action. Should be a string or an icon.
|
|
24
|
+
|
|
25
|
+
Puck uses [Lucide icons](https://lucide.dev/icons/). You can use [lucide-react](https://lucide.dev/guide/packages/lucide-react) to choose a similar icon, if desired.
|
|
26
|
+
|
|
27
|
+
### `onClick(e)`
|
|
28
|
+
|
|
29
|
+
An [onClick callback](https://react.dev/learn/responding-to-events) triggered when the user clicks the action.
|
|
30
|
+
|
|
31
|
+
## Optional Props
|
|
32
|
+
|
|
33
|
+
### `label`
|
|
34
|
+
|
|
35
|
+
A label to provide an accessible label when using icon.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# \<ActionBar.Group\>
|
|
2
|
+
|
|
3
|
+
Render an action group in the [`<ActionBar>`](/docs/api-reference/components/action-bar). Use [`<ActionBar.Separator>`](/docs/api-reference/components/action-bar-separator) instead to avoid wrapping elements.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<ActionBar label="Actions">
|
|
7
|
+
<ActionBar.Group>Group 1</ActionBar.Group>
|
|
8
|
+
<ActionBar.Group>Group 2</ActionBar.Group>
|
|
9
|
+
</ActionBar>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Props
|
|
13
|
+
|
|
14
|
+
| Prop | Example | Type | Status |
|
|
15
|
+
| ----------------------- | --------- | --------- | -------- |
|
|
16
|
+
| [`children`](#children) | `<div />` | ReactNode | Required |
|
|
17
|
+
|
|
18
|
+
## Required Props
|
|
19
|
+
|
|
20
|
+
### `children`
|
|
21
|
+
|
|
22
|
+
A node to render as the children of the action. If a fragment, the items will be rendered in a flex row.
|
|
23
|
+
|
|
24
|
+
Normally contains [`<ActionBar.Action>`](/docs/api-reference/components/action-bar-action)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# \<ActionBar.Label\>
|
|
2
|
+
|
|
3
|
+
Render a label in the [`<ActionBar>`](/docs/api-reference/components/action-bar) or an [`<ActionBar.Group>`](/docs/api-reference/components/action-bar-group).
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<ActionBar>
|
|
7
|
+
<ActionBar.Label label="Label 1" />
|
|
8
|
+
<ActionBar.Group>
|
|
9
|
+
<ActionBar.Label label="Label 2" />
|
|
10
|
+
<ActionBar.Action>★</ActionBar.Action>
|
|
11
|
+
</ActionBar.Group>
|
|
12
|
+
</ActionBar>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Props
|
|
16
|
+
|
|
17
|
+
| Prop | Example | Type | Status |
|
|
18
|
+
| ----------------- | --------- | ------ | -------- |
|
|
19
|
+
| [`label`](#label) | `"Label"` | String | Required |
|
|
20
|
+
|
|
21
|
+
## Required Props
|
|
22
|
+
|
|
23
|
+
### `label`
|
|
24
|
+
|
|
25
|
+
The label text.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# \<ActionBar.Separator\>
|
|
2
|
+
|
|
3
|
+
Render a separator in the [`<ActionBar>`](/docs/api-reference/components/action-bar). An alternative to [`<ActionBar.Group>`](/docs/api-reference/components/action-bar-group) that avoids wrapping elements.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<ActionBar>
|
|
7
|
+
<ActionBar.Label label="Label 1" />
|
|
8
|
+
<ActionBar.Separator />
|
|
9
|
+
<ActionBar.Label label="Label 2" />
|
|
10
|
+
<ActionBar.Action>★</ActionBar.Action>
|
|
11
|
+
</ActionBar>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Props
|
|
15
|
+
|
|
16
|
+
This component doesn't accept any props.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# \<ActionBar\>
|
|
2
|
+
|
|
3
|
+
Render the Puck ActionBar. Use this when overriding the [actionBar](/docs/api-reference/overrides/action-bar).
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<ActionBar label="Actions">
|
|
7
|
+
<ActionBar.Group>
|
|
8
|
+
<ActionBar.Action onClick={() => console.log("Clicked!")}>
|
|
9
|
+
★
|
|
10
|
+
</ActionBar.Action>
|
|
11
|
+
</ActionBar.Group>
|
|
12
|
+
</ActionBar>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Props
|
|
16
|
+
|
|
17
|
+
| Prop | Example | Type | Status |
|
|
18
|
+
| ----------------------- | --------- | --------- | -------- |
|
|
19
|
+
| [`children`](#children) | `<div />` | ReactNode | Required |
|
|
20
|
+
| [`label`](#label) | `"Label"` | String | Required |
|
|
21
|
+
|
|
22
|
+
## Required Props
|
|
23
|
+
|
|
24
|
+
### `children`
|
|
25
|
+
|
|
26
|
+
The children for the ActionBar. Normally a fragment of [`<ActionBar.Action>` components](/docs/api-reference/components/action-bar-action).
|
|
27
|
+
|
|
28
|
+
If this is a fragment, it will be rendered in a flex row.
|
|
29
|
+
|
|
30
|
+
### `label`
|
|
31
|
+
|
|
32
|
+
The label for the ActionBar.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# \<AutoField\>
|
|
2
|
+
|
|
3
|
+
Render a Puck field based on a [Field](/docs/api-reference/fields) object. Use this when building [custom fields](/docs/extending-puck/custom-fields) that need to use Puck-style fields internally.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { Autofield } from "@puckeditor/core";
|
|
7
|
+
|
|
8
|
+
const CustomField = ({ onChange, value }) => (
|
|
9
|
+
<AutoField field={{ type: "text" }} onChange={onChange} value={value} />
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
const config = {
|
|
13
|
+
components: {
|
|
14
|
+
Example: {
|
|
15
|
+
fields: {
|
|
16
|
+
title: {
|
|
17
|
+
type: "custom",
|
|
18
|
+
render: MyCustomField,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Props
|
|
27
|
+
|
|
28
|
+
| Prop | Example | Type | Status |
|
|
29
|
+
| ----------------------- | ---------------------------- | ----------------------------------- | -------- |
|
|
30
|
+
| [`field`](#field) | `{ type: "text" }` | [Field](/docs/api-reference/fields) | Required |
|
|
31
|
+
| [`onChange`](#onchange) | `onChange("Goodbye, world")` | Function | Required |
|
|
32
|
+
| [`value`](#value) | `"Hello, world"` | Any | Required |
|
|
33
|
+
| [`id`](#id) | `"my-input"` | String | - |
|
|
34
|
+
| [`readOnly`](#readonly) | `true` | Boolean | - |
|
|
35
|
+
|
|
36
|
+
## Required Props
|
|
37
|
+
|
|
38
|
+
### `field`
|
|
39
|
+
|
|
40
|
+
An object containing the user defined [Field](/docs/api-reference/fields) configuration.
|
|
41
|
+
|
|
42
|
+
### `onChange`
|
|
43
|
+
|
|
44
|
+
A callback that triggers when the value changes.
|
|
45
|
+
|
|
46
|
+
### `value`
|
|
47
|
+
|
|
48
|
+
The current value for the field.
|
|
49
|
+
|
|
50
|
+
## Optional Props
|
|
51
|
+
|
|
52
|
+
### `id`
|
|
53
|
+
|
|
54
|
+
An optional ID for this field. Will be generated if not specified.
|
|
55
|
+
|
|
56
|
+
### `readOnly`
|
|
57
|
+
|
|
58
|
+
A boolean describing whether or not this field is `readOnly`.
|
|
59
|
+
|
|
60
|
+
## Further reading
|
|
61
|
+
|
|
62
|
+
- [Custom fields](/docs/extending-puck/custom-fields)
|
|
63
|
+
- [The `<FieldLabel>` API reference](/docs/api-reference/components/field-label)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# \<Drawer.Item\>
|
|
2
|
+
|
|
3
|
+
An item that can be dragged from a [`<Drawer>`](/docs/api-reference/components/drawer).
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { Puck, Drawer } from "@puckeditor/core";
|
|
7
|
+
|
|
8
|
+
export function Editor() {
|
|
9
|
+
return (
|
|
10
|
+
<Puck>
|
|
11
|
+
<Drawer>
|
|
12
|
+
<Drawer.Item name="Orange" />
|
|
13
|
+
</Drawer>
|
|
14
|
+
</Puck>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| Prop | Example | Type | Status |
|
|
22
|
+
| ----------------------------------- | ------------------------- | -------- | -------- |
|
|
23
|
+
| [`name`](#name) | `name: "Orange"` | String | Required |
|
|
24
|
+
| [`children`](#children) | `children: () => <div />` | Function | - |
|
|
25
|
+
| [`id`](#id) | `id: "OrangeComponent"` | String | - |
|
|
26
|
+
| [`isDragDisabled`](#isdragdisabled) | `isDragDisabled: false` | Boolean | - |
|
|
27
|
+
|
|
28
|
+
## Required props
|
|
29
|
+
|
|
30
|
+
### `name`
|
|
31
|
+
|
|
32
|
+
The name of this drawer item.
|
|
33
|
+
|
|
34
|
+
- This will be rendered on the item by default.
|
|
35
|
+
- Will be used as the `id`, unless otherwise specified
|
|
36
|
+
|
|
37
|
+
## Optional props
|
|
38
|
+
|
|
39
|
+
### `children`
|
|
40
|
+
|
|
41
|
+
A custom render function to render inside the component.
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { Puck, Drawer } from "@puckeditor/core";
|
|
45
|
+
|
|
46
|
+
export function Editor() {
|
|
47
|
+
return (
|
|
48
|
+
<Puck>
|
|
49
|
+
<Drawer>
|
|
50
|
+
<Drawer.Item name="Orange">{() => <div>Orange 🍊</div>}</Drawer.Item>
|
|
51
|
+
</Drawer>
|
|
52
|
+
</Puck>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### Render Props
|
|
58
|
+
|
|
59
|
+
| Prop | Example | Type |
|
|
60
|
+
| ------------------------- | ------------------- | ------ |
|
|
61
|
+
| [`children`](#children-1) | `children: <div />` | String |
|
|
62
|
+
|
|
63
|
+
##### `children`
|
|
64
|
+
|
|
65
|
+
The original node for the drawer item.
|
|
66
|
+
|
|
67
|
+
### `id`
|
|
68
|
+
|
|
69
|
+
A unique id for this drawer item. Defaults to the value of [`name`](#name).
|
|
70
|
+
|
|
71
|
+
If using the `<Drawer>` as a component list to be dragged into `<Puck.Preview>`, this should be the key of a component defined in the [Config](/docs/api-reference/configuration/config).
|
|
72
|
+
|
|
73
|
+
### `isDragDisabled`
|
|
74
|
+
|
|
75
|
+
Whether or not this item is disabled.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# \<Drawer\>
|
|
2
|
+
|
|
3
|
+
A list of items that can be dragged into a [`<Puck.Preview>`](/docs/api-reference/components/puck-preview). Used for composing custom Puck UIs.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { Puck, Drawer } from "@puckeditor/core";
|
|
7
|
+
|
|
8
|
+
export function Editor() {
|
|
9
|
+
return (
|
|
10
|
+
<Puck>
|
|
11
|
+
<Drawer>
|
|
12
|
+
<Drawer.Item name="Orange" />
|
|
13
|
+
</Drawer>
|
|
14
|
+
</Puck>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| Param | Example | Type | Status |
|
|
22
|
+
| ----------------------- | --------------------------- | --------- | -------- |
|
|
23
|
+
| [`children`](#children) | `children: <Drawer.Item />` | ReactNode | Required |
|
|
24
|
+
|
|
25
|
+
## Required props
|
|
26
|
+
|
|
27
|
+
### `children`
|
|
28
|
+
|
|
29
|
+
A React node representing the contents of the `<Drawer>`. Will likely contain [`<Drawer.Item>`](/docs/api-reference/components/drawer-item) nodes.
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# \<DropZone\>
|
|
2
|
+
|
|
3
|
+
> **Note:** The [`<DropZone>` component](/docs/api-reference/components/drop-zone) component is being replaced by the [`slot` field](/docs/api-reference/fields/slot), and will soon be deprecated and removed. For migration notes, see [these docs](/docs/guides/migrations/dropzones-to-slots).
|
|
4
|
+
|
|
5
|
+
Place droppable regions (zones) inside other components to enable nested components.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { DropZone } from "@puckeditor/core";
|
|
9
|
+
|
|
10
|
+
const config = {
|
|
11
|
+
components: {
|
|
12
|
+
Example: {
|
|
13
|
+
render: () => {
|
|
14
|
+
return (
|
|
15
|
+
<div>
|
|
16
|
+
<DropZone zone="my-content" />
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Props
|
|
26
|
+
|
|
27
|
+
| Param | Example | Type | Status |
|
|
28
|
+
| ----------------------------------- | ---------------------------- | ------------------------------------ | -------- |
|
|
29
|
+
| [`zone`](#zone) | `zone: "my-zone"` | String | Required |
|
|
30
|
+
| [`allow`](#allow) | `allow: ["HeadingBlock"]` | Array | - |
|
|
31
|
+
| [`className`](#classname) | `className: "MyClass"` | String | - |
|
|
32
|
+
| [`collisionAxis`](#collisionaxis) | `collisionAxis: "x"` | String | - |
|
|
33
|
+
| [`disallow`](#disallow) | `disallow: ["HeadingBlock"]` | Array | - |
|
|
34
|
+
| [`minEmptyHeight`](#minemptyheight) | `minEmptyHeight: "256px"` | CSSProperties["minHeight"] \| number | - |
|
|
35
|
+
| [`ref`](#ref) | `ref: ref` | Ref | - |
|
|
36
|
+
| [`style`](#style) | `style: {display: "flex"}` | CSSProperties | - |
|
|
37
|
+
|
|
38
|
+
## Required props
|
|
39
|
+
|
|
40
|
+
### `zone`
|
|
41
|
+
|
|
42
|
+
Set the zone identifier for the given DropZone.
|
|
43
|
+
|
|
44
|
+
Must be unique within this component, but two different components can both define DropZones with the same `zone` value.
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
const config = {
|
|
48
|
+
components: {
|
|
49
|
+
Example: {
|
|
50
|
+
render: () => {
|
|
51
|
+
return (
|
|
52
|
+
<div>
|
|
53
|
+
<DropZone zone="my-content" />
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Optional props
|
|
63
|
+
|
|
64
|
+
### `allow`
|
|
65
|
+
|
|
66
|
+
Only allow specific components to be dragged into the DropZone:
|
|
67
|
+
|
|
68
|
+
> **Note:** Drag-and-drop in the outline does not respect this prop. Prefer the [`allow`
|
|
69
|
+
> parameter on the slot field](/docs/api-reference/fields/slot#allow), which is
|
|
70
|
+
> enforced everywhere.
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
const config = {
|
|
74
|
+
components: {
|
|
75
|
+
Example: {
|
|
76
|
+
render: () => {
|
|
77
|
+
return (
|
|
78
|
+
<div>
|
|
79
|
+
<DropZone zone="my-content" allow={["HeadingBlock"]} />
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### `className`
|
|
89
|
+
|
|
90
|
+
Provide a className to the DropZone component. The default DropZone styles will still be applied.
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
const config = {
|
|
94
|
+
components: {
|
|
95
|
+
Example: {
|
|
96
|
+
render: () => {
|
|
97
|
+
return (
|
|
98
|
+
<div>
|
|
99
|
+
<DropZone zone="my-content" className="MyComponent" />
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### `collisionAxis`
|
|
109
|
+
|
|
110
|
+
Configure which axis Puck will use for overlap collision detection.
|
|
111
|
+
|
|
112
|
+
Options:
|
|
113
|
+
|
|
114
|
+
- `x` - detect collisions based their x-axis overlap
|
|
115
|
+
- `y` - detect collisions based their y-axis overlap
|
|
116
|
+
- `dynamic` - automatically choose an axis based on the direction of travel
|
|
117
|
+
|
|
118
|
+
The defaults are set based on the CSS layout of the parent:
|
|
119
|
+
|
|
120
|
+
- grid: `dynamic`
|
|
121
|
+
- flex (row): `x`
|
|
122
|
+
- inline/inline-block: `x`
|
|
123
|
+
- Everything else: `y`
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
const config = {
|
|
127
|
+
components: {
|
|
128
|
+
Example: {
|
|
129
|
+
render: () => {
|
|
130
|
+
return (
|
|
131
|
+
<div>
|
|
132
|
+
<DropZone zone="my-content" collisionAxis="dynamic" />
|
|
133
|
+
</div>
|
|
134
|
+
);
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### `disallow`
|
|
142
|
+
|
|
143
|
+
Allow all but specific components to be dragged into the DropZone. Any items in `allow` will override `disallow`.
|
|
144
|
+
|
|
145
|
+
> **Note:** Drag-and-drop in the outline does not respect this prop. Prefer the
|
|
146
|
+
> [`disallow` parameter on the slot
|
|
147
|
+
> field](/docs/api-reference/fields/slot#disallow), which is enforced
|
|
148
|
+
> everywhere.
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
const config = {
|
|
152
|
+
components: {
|
|
153
|
+
Example: {
|
|
154
|
+
render: () => {
|
|
155
|
+
return (
|
|
156
|
+
<div>
|
|
157
|
+
<DropZone zone="my-content" disallow={["HeadingBlock"]} />
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### `minEmptyHeight`
|
|
167
|
+
|
|
168
|
+
The minimum height of the DropZone when empty. Defaults to `128px`.
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
const config = {
|
|
172
|
+
components: {
|
|
173
|
+
Example: {
|
|
174
|
+
render: () => {
|
|
175
|
+
return (
|
|
176
|
+
<div>
|
|
177
|
+
<DropZone zone="my-content" minEmptyHeight="256px" />
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### `ref`
|
|
187
|
+
|
|
188
|
+
A [React ref](https://react.dev/learn/manipulating-the-dom-with-refs), assigned to the root node of the DropZone.
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
const config = {
|
|
192
|
+
components: {
|
|
193
|
+
Example: {
|
|
194
|
+
render: () => {
|
|
195
|
+
const ref = useRef();
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<div>
|
|
199
|
+
<DropZone zone="my-content" ref={ref} />
|
|
200
|
+
</div>
|
|
201
|
+
);
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### `style`
|
|
209
|
+
|
|
210
|
+
Provide a style attribute to the DropZone. The default DropZone styles will still be applied.
|
|
211
|
+
|
|
212
|
+
```tsx
|
|
213
|
+
const config = {
|
|
214
|
+
components: {
|
|
215
|
+
Example: {
|
|
216
|
+
render: () => {
|
|
217
|
+
return (
|
|
218
|
+
<div>
|
|
219
|
+
<DropZone zone="my-content" style={{ display: "flex" }} />
|
|
220
|
+
</div>
|
|
221
|
+
);
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## React server components
|
|
229
|
+
|
|
230
|
+
By default, DropZones don't work with React server components as they rely on context.
|
|
231
|
+
|
|
232
|
+
Instead, you can use the [`renderDropZone` method](/docs/api-reference/configuration/component-config#propspuckrenderdropzone) passed to your component render function.
|