@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,45 @@
|
|
|
1
|
+
# registerOverlayPortal
|
|
2
|
+
|
|
3
|
+
Register a node as an [Overlay Portal](/docs/integrating-puck/overlay-portals), enabling interaction beneath the Puck overlay.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { registerOverlayPortal } from "@puckeditor/core";
|
|
7
|
+
|
|
8
|
+
const MyComponent = () => {
|
|
9
|
+
const ref = useRef(null);
|
|
10
|
+
|
|
11
|
+
useEffect(() => registerOverlayPortal(ref.current), [ref.current]);
|
|
12
|
+
|
|
13
|
+
return <button ref={ref}>Clickable</button>;
|
|
14
|
+
};
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Args
|
|
18
|
+
|
|
19
|
+
| Param | Example | Type | Status |
|
|
20
|
+
| --------------- | ------- | --------------------------------------------------------------------------- | ------ |
|
|
21
|
+
| [`el`](#el) | `div` | [HTMLElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement) | - |
|
|
22
|
+
| [`opts`](#opts) | `{}` | [Config](/docs/api-reference/configuration/config) | - |
|
|
23
|
+
|
|
24
|
+
### `el`
|
|
25
|
+
|
|
26
|
+
The element to turn into a portal. Will do nothing if `null` or `undefined`.
|
|
27
|
+
|
|
28
|
+
### `opts`
|
|
29
|
+
|
|
30
|
+
| Param | Example | Type | Status |
|
|
31
|
+
| -------------------- | ------- | ------- | ------ |
|
|
32
|
+
| `disableDrag` | `false` | boolean | - |
|
|
33
|
+
| `disableDragOnFocus` | `false` | boolean | - |
|
|
34
|
+
|
|
35
|
+
#### `opts.disableDrag`
|
|
36
|
+
|
|
37
|
+
Disable triggering a drag of the parent component when interacting with this element. Defaults to `false`.
|
|
38
|
+
|
|
39
|
+
#### `opts.disableDragOnFocus`
|
|
40
|
+
|
|
41
|
+
Disable triggering a drag of the parent component when interacting with this element once it is focused. Drag is disabled following a short delay after focusing. Defaults to `true`.
|
|
42
|
+
|
|
43
|
+
## Returns
|
|
44
|
+
|
|
45
|
+
A function to clean-up the portal.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# resolveAllData
|
|
2
|
+
|
|
3
|
+
Utility function to execute all [`resolveData` methods](/docs/api-reference/configuration/component-config#resolvedatadata-params) on a data payload outside of the [`<Puck>`](/docs/api-reference/components/puck) editor, returning the updated value.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { resolveAllData } from "@puckeditor/core";
|
|
7
|
+
|
|
8
|
+
const updatedData = await resolveAllData(data, config);
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This is useful if you need to run your resolvers before passing your data to [`<Render>`](/docs/api-reference/components/render).
|
|
12
|
+
|
|
13
|
+
## Args
|
|
14
|
+
|
|
15
|
+
| Param | Example | Type |
|
|
16
|
+
| ----------------------- | -------------------- | -------------------------------------------------- |
|
|
17
|
+
| `data` | `{}` | [Data](/docs/api-reference/data-model/data) |
|
|
18
|
+
| `config` | `{ components: {} }` | [Config](/docs/api-reference/configuration/config) |
|
|
19
|
+
| [`metadata`](#metadata) | `{}` | Object |
|
|
20
|
+
|
|
21
|
+
### metadata
|
|
22
|
+
|
|
23
|
+
An object containing additional data provided to each component's [resolveData](/docs/api-reference/configuration/component-config#resolvedatadata-params) functions.
|
|
24
|
+
|
|
25
|
+
## Returns
|
|
26
|
+
|
|
27
|
+
The updated [Data](/docs/api-reference/data-model/data) object.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# setDeep
|
|
2
|
+
|
|
3
|
+
A convenience utility for setting the value of a key deep within an object.
|
|
4
|
+
|
|
5
|
+
Useful when implementing [field transforms](/docs/api-reference/field-transforms).
|
|
6
|
+
|
|
7
|
+
This function only duplicates the objects and arrays along the path to the key being set, leaving the rest of the input object or array unchanged.
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { setDeep } from "@puckeditor/core";
|
|
11
|
+
|
|
12
|
+
const newData = setDeep(
|
|
13
|
+
{
|
|
14
|
+
object: {
|
|
15
|
+
array: [{ key: "Hello, world" }],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
"object.array[0].key",
|
|
19
|
+
"Goodbye, world"
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
console.log(newData);
|
|
23
|
+
// {
|
|
24
|
+
// object: {
|
|
25
|
+
// array: [{ key: "Goodbye, world" }],
|
|
26
|
+
// },
|
|
27
|
+
// }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Args
|
|
31
|
+
|
|
32
|
+
| Param | Example | Type |
|
|
33
|
+
| ----------------- | ----------------------- | --------------- |
|
|
34
|
+
| [`input`](#input) | `{}` | Object \| Array |
|
|
35
|
+
| [`path`](#path) | `"object.array[0].key"` | String |
|
|
36
|
+
| [`value`](#value) | `"Hello, world"` | Any |
|
|
37
|
+
|
|
38
|
+
### `input`
|
|
39
|
+
|
|
40
|
+
The input object or array that contains the key to be updated.
|
|
41
|
+
|
|
42
|
+
### `path`
|
|
43
|
+
|
|
44
|
+
A dot-notated path that describes a key deep within an object or array.
|
|
45
|
+
|
|
46
|
+
Uses dot-notation and square brackets:
|
|
47
|
+
|
|
48
|
+
- `.` deliminates sub-props in an [object field](/docs/api-reference/fields/object) (i.e. `a.b` represents `b` where `a` is `{b: "Value"}`)
|
|
49
|
+
- `[*]` which donate an index in an [array field](/docs/api-reference/fields/array) where `*` is an integer (i.e. `a[0].b` represents `b` in the first item in array `a` with the value `[{b: "Value"}]`)
|
|
50
|
+
|
|
51
|
+
Commonly provided by the [propPath parameter](/docs/api-reference/field-transforms#proppath) for field transforms.
|
|
52
|
+
|
|
53
|
+
### `value`
|
|
54
|
+
|
|
55
|
+
The value to set the key to.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# transformProps
|
|
2
|
+
|
|
3
|
+
Transform component props stored in a [Data payload](/docs/api-reference/data-model/data). This convenience method can be used for [prop renames and other data migrations](/docs/integrating-puck/data-migration).
|
|
4
|
+
|
|
5
|
+
This method will modify all data in [`content`](/docs/api-reference/data-model/data#content) and [`zones`](/docs/api-reference/data-model/data#zones).
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { transformProps } from "@puckeditor/core";
|
|
9
|
+
|
|
10
|
+
const data = {
|
|
11
|
+
content: [{ type: "HeadingBlock", props: { title: "Hello, world" } }],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const updatedData = transformProps(data, {
|
|
15
|
+
// Rename `title` to `heading`
|
|
16
|
+
HeadingBlock: ({ title, ...props }) => ({ heading: title, ...props }),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
console.log(updatedData);
|
|
20
|
+
// { content: [{ type: "HeadingBlock", props: { heading: "Hello, world" } }] };
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Args
|
|
24
|
+
|
|
25
|
+
| Param | Example | Type | Status |
|
|
26
|
+
| --------------------------- | -------------------------------------- | -------------------------------------------------- | -------- |
|
|
27
|
+
| [`data`](#data) | `{}` | [Data](/docs/api-reference/data-model/data) | Required |
|
|
28
|
+
| [`transforms`](#transforms) | `{ HeadingBlock: (props) => (props) }` | Object | Required |
|
|
29
|
+
| [`config`](#config) | `{ components: {} }` | [Config](/docs/api-reference/configuration/config) | - |
|
|
30
|
+
|
|
31
|
+
### `data`
|
|
32
|
+
|
|
33
|
+
The [Data payload](/docs/api-reference/data-model/data) to be transformed.
|
|
34
|
+
|
|
35
|
+
### `transforms`
|
|
36
|
+
|
|
37
|
+
An object describing the transform functions for each component defined in your [`config`](/docs/api-reference/configuration/config).
|
|
38
|
+
|
|
39
|
+
- `root` is a reserved property, and can be used to update the [`root` component](/docs/api-reference/configuration/config#root) props.
|
|
40
|
+
|
|
41
|
+
### `config`
|
|
42
|
+
|
|
43
|
+
A [config](/docs/api-reference/configuration/config) object. Required if transforming data within [slots](/docs/api-reference/fields/slot).
|
|
44
|
+
|
|
45
|
+
## Returns
|
|
46
|
+
|
|
47
|
+
The updated [Data](/docs/api-reference/data-model/data) object.
|
|
48
|
+
|
|
49
|
+
## Notes
|
|
50
|
+
|
|
51
|
+
- It's important to consider that data may include both components with old data and new data, and write your transform accordingly.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# useGetPuck
|
|
2
|
+
|
|
3
|
+
A hook that returns a function that retrieves the latest [`PuckApi`](/docs/api-reference/puck-api) at call time. This is useful in callbacks, effects, or any logic that runs outside the component render lifecycle.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { useGetPuck } from "@puckeditor/core";
|
|
7
|
+
|
|
8
|
+
const Example = () => {
|
|
9
|
+
const getPuck = useGetPuck();
|
|
10
|
+
|
|
11
|
+
const handleClick = useCallback(() => {
|
|
12
|
+
// Current PuckApi is always provided
|
|
13
|
+
const { appState } = getPuck();
|
|
14
|
+
}, [getPuck]);
|
|
15
|
+
|
|
16
|
+
return <button onClick={handleClick}>Click me</button>;
|
|
17
|
+
};
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If you need to react to changes to `PuckApi`, try the [`usePuck` hook](/docs/api-reference/functions/use-puck).
|
|
21
|
+
|
|
22
|
+
## Returns
|
|
23
|
+
|
|
24
|
+
A function to retrieve the latest [`PuckApi`](/docs/api-reference/puck-api) data at call time.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# usePuck
|
|
2
|
+
|
|
3
|
+
A hook for accessing the [`PuckApi`](/docs/api-reference/puck-api) as part of your React render lifecycle.. The best way to access `usePuck` is via the `createUsePuck()` factory.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { createUsePuck } from "@puckeditor/core";
|
|
7
|
+
|
|
8
|
+
const usePuck = createUsePuck();
|
|
9
|
+
|
|
10
|
+
const Example = () => {
|
|
11
|
+
const type = usePuck((s) => s.selectedItem?.type || "Nothing");
|
|
12
|
+
|
|
13
|
+
return <h2>{type} selected</h2>;
|
|
14
|
+
};
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
You can also access `usePuck` as a direct export, but you won't be able to use [selectors](#selectordata), resulting in unwanted re-renders and degraded performance.
|
|
18
|
+
|
|
19
|
+
## Args
|
|
20
|
+
|
|
21
|
+
| Param | Example | Type |
|
|
22
|
+
| --------------------------------- | ---------------------------- | -------- |
|
|
23
|
+
| [`selector(data)`](#selectordata) | `(s: PuckApi) => s.appState` | Function |
|
|
24
|
+
|
|
25
|
+
### `selector(data)`
|
|
26
|
+
|
|
27
|
+
A selector function that describes what `usePuck` returns. Receives [`PuckApi`](/docs/api-reference/puck-api) and returns anything. Be as granular as possible to minimize re-renders.
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
// Good: only re-render when the `selectedItem` changes
|
|
31
|
+
const selectedItem = usePuck((s) => s.selectedItem);
|
|
32
|
+
|
|
33
|
+
// Bad: re-render when anything changes
|
|
34
|
+
const { selectedItem } = usePuck();
|
|
35
|
+
const { selectedItem } = usePuck((s) => s);
|
|
36
|
+
|
|
37
|
+
// Bad: selector creates a new object reference, causing an infinite comparison loop
|
|
38
|
+
const { selectedItem } = usePuck((s) => ({ ...s.selectedItem }));
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Returns
|
|
42
|
+
|
|
43
|
+
Whatever is returned by the [`selector`](#selectordata).
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# walkTree
|
|
2
|
+
|
|
3
|
+
Recursively walk the entire tree for the [`Data`](/docs/api-reference/data-model/data) or a single [`ComponentData`](/docs/api-reference/data-model/component-data) node, using a depth-first approach where the deepest [slots](/docs/api-reference/fields/slot) are processed first.
|
|
4
|
+
|
|
5
|
+
Receives a callback function that is called once for each slot. You can optionally return a value to update the slot.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { walkTree } from "@puckeditor/core";
|
|
9
|
+
|
|
10
|
+
// Add the example prop to all children in the data
|
|
11
|
+
const newData = walkTree(data, config, (content) =>
|
|
12
|
+
content.map((child) => ({
|
|
13
|
+
...child,
|
|
14
|
+
props: { ...child.props, example: "Hello, world" },
|
|
15
|
+
}))
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
console.log(newData);
|
|
19
|
+
// {
|
|
20
|
+
// "root": {},
|
|
21
|
+
// "content": [
|
|
22
|
+
// {
|
|
23
|
+
// "type": "Component",
|
|
24
|
+
// "props": {
|
|
25
|
+
// "id": "1234",
|
|
26
|
+
// "content": [
|
|
27
|
+
// {
|
|
28
|
+
// "type": "Child",
|
|
29
|
+
// "props": { "id": "5678", "example": "Hello, world" }
|
|
30
|
+
// }
|
|
31
|
+
// ],
|
|
32
|
+
// "example": "Hello, world"
|
|
33
|
+
// }
|
|
34
|
+
// }
|
|
35
|
+
// ]
|
|
36
|
+
// }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Args
|
|
40
|
+
|
|
41
|
+
| Param | Example | Type |
|
|
42
|
+
| -------------------------------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
43
|
+
| [`data`](#data) | `{ root: {}, content: [] }` | [Data](/docs/api-reference/data-model/data) \| [ComponentData](/docs/api-reference/data-model/component-data) |
|
|
44
|
+
| [`config`](#config) | `{ components: {} }` | [Config](/docs/api-reference/configuration/config) |
|
|
45
|
+
| [`callbackFn()`](#callbackfncontent-options) | `(content) => content.slice(0, 1)` | Function |
|
|
46
|
+
|
|
47
|
+
### `data`
|
|
48
|
+
|
|
49
|
+
The [`Data`](/docs/api-reference/data-model/data) or [`ComponentData`](/docs/api-reference/data-model/component-data) to traverse.
|
|
50
|
+
|
|
51
|
+
### `config`
|
|
52
|
+
|
|
53
|
+
A Puck [config](/docs/api-reference/configuration/config) object, used to determine which components contain slots.
|
|
54
|
+
|
|
55
|
+
### `callbackFn(content, options)`
|
|
56
|
+
|
|
57
|
+
A callback function called for each slot. Receives an array of [`ComponentData`](/docs/api-reference/data-model/component-data). Optionally returns an updated array of [`ComponentData`](/docs/api-reference/data-model/component-data) to update the content for this slot.
|
|
58
|
+
|
|
59
|
+
#### Args
|
|
60
|
+
|
|
61
|
+
| Param | Example | Type |
|
|
62
|
+
| --------------------- | ----------------------------------------------- | ------------------------------------------------------------------ |
|
|
63
|
+
| [`content`](#content) | `[{ type: "Heading", props: {} }]` | [`ComponentData[]`](/docs/api-reference/data-model/component-data) |
|
|
64
|
+
| [`options`](#options) | `{ parentId: "Flex-123", propName: "Content" }` | object |
|
|
65
|
+
|
|
66
|
+
##### `content`
|
|
67
|
+
|
|
68
|
+
An array of [`ComponentData`](/docs/api-reference/data-model/component-data), containing all the nodes for this slot.
|
|
69
|
+
|
|
70
|
+
##### `options`
|
|
71
|
+
|
|
72
|
+
An object containing additional options
|
|
73
|
+
|
|
74
|
+
##### `options.parentId`
|
|
75
|
+
|
|
76
|
+
The id of the parent component that defines this slot.
|
|
77
|
+
|
|
78
|
+
##### `options.propName`
|
|
79
|
+
|
|
80
|
+
The name of the slot field.
|
|
81
|
+
|
|
82
|
+
#### Returns
|
|
83
|
+
|
|
84
|
+
Optionally return an updated array of [`ComponentData`](/docs/api-reference/data-model/component-data) objects.
|
|
85
|
+
|
|
86
|
+
## Returns
|
|
87
|
+
|
|
88
|
+
A new [`Data`](/docs/api-reference/data-model/data) or [`ComponentData`](/docs/api-reference/data-model/component-data) object populated with any values returned by the callbackFn.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Functions
|
|
2
|
+
|
|
3
|
+
- [migrate](/docs/api-reference/functions/migrate) - Migrate a legacy [data payload](/docs/api-reference/data-model/data) to the latest shape.
|
|
4
|
+
- [resolveAllData](/docs/api-reference/functions/resolve-all-data) - Utility function to execute all [`resolveData` methods](/docs/api-reference/configuration/component-config#resolvedatadata-params) on a data payload.
|
|
5
|
+
- [transformProps](/docs/api-reference/functions/transform-props) - Transform component props stored in the [data payload](/docs/api-reference/data-model/data). Use this for migrations, like prop renames.
|
|
6
|
+
- [useGetPuck](/docs/api-reference/functions/use-get-puck) - A hook for accessing the latest [PuckApi](/docs/api-reference/puck-api) outside of the React render lifecycle.
|
|
7
|
+
- [usePuck](/docs/api-reference/functions/use-puck) - A hook for accessing the [PuckApi](/docs/api-reference/puck-api) inside your components.
|
|
8
|
+
- [walkTree](/docs/api-reference/functions/walk-tree) - Walk the tree recursively, modifying it if necessary.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# actionBar
|
|
2
|
+
|
|
3
|
+
Override the action bar. Use the [`<ActionBar>` component](/docs/api-reference/components/action-bar) to extend the default ActionBar UI.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { ActionBar } from "@puckeditor/core";
|
|
7
|
+
|
|
8
|
+
const overrides = {
|
|
9
|
+
actionBar: ({ children, label }) => (
|
|
10
|
+
<ActionBar label={label}>
|
|
11
|
+
<ActionBar.Group>{children}</ActionBar.Group>
|
|
12
|
+
</ActionBar>
|
|
13
|
+
),
|
|
14
|
+
};
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
| Prop | Example | Type |
|
|
20
|
+
| ------------------------------- | ---------------- | --------- |
|
|
21
|
+
| [`children`](#children) | `<div />` | ReactNode |
|
|
22
|
+
| [`label`](#label) | `"HeadingBlock"` | String |
|
|
23
|
+
| [`parentAction`](#parentAction) | `<div />` | ReactNode |
|
|
24
|
+
|
|
25
|
+
### `children`
|
|
26
|
+
|
|
27
|
+
A fragment containing the default [actions](/docs/api-reference/components/action-bar-action). This should normally be rendered inside an [`<ActionBar.Group>`](/docs/api-reference/components/action-bar-group).
|
|
28
|
+
|
|
29
|
+
### `label`
|
|
30
|
+
|
|
31
|
+
The default label for the action bar.
|
|
32
|
+
|
|
33
|
+
### `parentAction`
|
|
34
|
+
|
|
35
|
+
A single [`<ActionBar.Action>`](/docs/api-reference/components/action-bar-action) to select the current component's parent.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# componentOverlay
|
|
2
|
+
|
|
3
|
+
Override the overlay shown on hover or selection of a component.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const overrides = {
|
|
7
|
+
overlay: ({ children }) => <div>{children}</div>,
|
|
8
|
+
};
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Example | Type |
|
|
14
|
+
| --------------------------------- | -------------- | --------- |
|
|
15
|
+
| [`children`](#children) | `<div />` | ReactNode |
|
|
16
|
+
| [`componentId`](#componentid) | `Heading-1234` | string |
|
|
17
|
+
| [`componentType`](#componenttype) | `Heading` | string |
|
|
18
|
+
| [`hover`](#hover) | `false` | boolean |
|
|
19
|
+
| [`isSelected`](#isselected) | `false` | boolean |
|
|
20
|
+
|
|
21
|
+
### `children`
|
|
22
|
+
|
|
23
|
+
The default node for the overlay.
|
|
24
|
+
|
|
25
|
+
### `componentId`
|
|
26
|
+
|
|
27
|
+
The [id](/docs/api-reference/overrides/component-overlay) for the component underneath the overlay.
|
|
28
|
+
|
|
29
|
+
### `componentType`
|
|
30
|
+
|
|
31
|
+
The [type](/docs/api-reference/overrides/component-overlay) for the component underneath the overlay.
|
|
32
|
+
|
|
33
|
+
### `hover`
|
|
34
|
+
|
|
35
|
+
Whether or not the the component for this overlay is hovered over.
|
|
36
|
+
|
|
37
|
+
A parent will not be `true` if a child node is `true`.
|
|
38
|
+
|
|
39
|
+
### `isSelected`
|
|
40
|
+
|
|
41
|
+
Whether or not the the component for this overlay is selected.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# drawerItem
|
|
2
|
+
|
|
3
|
+
Override an item within the component drawer.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const overrides = {
|
|
7
|
+
drawerItem: ({ name }) => <div>{name}</div>,
|
|
8
|
+
};
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Example | Type |
|
|
14
|
+
| ----------------------- | ---------- | --------- |
|
|
15
|
+
| [`children`](#children) | `<div />` | ReactNode |
|
|
16
|
+
| [`name`](#name) | `"Button"` | ReactNode |
|
|
17
|
+
|
|
18
|
+
### `children`
|
|
19
|
+
|
|
20
|
+
The default node for the drawer item.
|
|
21
|
+
|
|
22
|
+
### `name`
|
|
23
|
+
|
|
24
|
+
The name of the drawer item.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# drawer
|
|
2
|
+
|
|
3
|
+
Override the component drawer.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const overrides = {
|
|
7
|
+
drawer: ({ children }) => <div>{children}</div>,
|
|
8
|
+
};
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Example | Type |
|
|
14
|
+
| ----------------------- | --------- | --------- |
|
|
15
|
+
| [`children`](#children) | `<div />` | ReactNode |
|
|
16
|
+
|
|
17
|
+
### `children`
|
|
18
|
+
|
|
19
|
+
The default node for the component list.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# fieldLabel
|
|
2
|
+
|
|
3
|
+
Override the label for all internal fields.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const overrides = {
|
|
7
|
+
fieldLabel: ({ children, label }) => (
|
|
8
|
+
<label>
|
|
9
|
+
<div>{label}</div>
|
|
10
|
+
{children}
|
|
11
|
+
</label>
|
|
12
|
+
),
|
|
13
|
+
};
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Props
|
|
17
|
+
|
|
18
|
+
See [FieldLabel](/docs/api-reference/components/field-label) component.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# fieldTypes
|
|
2
|
+
|
|
3
|
+
Override or hide each [field type](/docs/api-reference/fields).
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const overrides = {
|
|
7
|
+
fieldTypes: {
|
|
8
|
+
number: ({ onChange }) => (
|
|
9
|
+
<input type="number" onChange={(e) => onChange(e.currentTarget.value)} />
|
|
10
|
+
),
|
|
11
|
+
text: ({ onChange }) => (
|
|
12
|
+
<input type="text" onChange={(e) => onChange(e.currentTarget.value)} />
|
|
13
|
+
),
|
|
14
|
+
// ...
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
You can specify a custom render method for each known [field type](/docs/api-reference/fields), or introduce completely new ones.
|
|
20
|
+
|
|
21
|
+
## Hiding field types
|
|
22
|
+
|
|
23
|
+
Set a field type to `null` to hide every field of that type from the fields sidebar.
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
const overrides = {
|
|
27
|
+
fieldTypes: {
|
|
28
|
+
text: null,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
[Plugins](/docs/api-reference/plugins) can override this behavior, showing hidden field types if necessary.
|
|
34
|
+
|
|
35
|
+
## Render Props
|
|
36
|
+
|
|
37
|
+
Extends the [`<AutoField>` API](/docs/api-reference/components/auto-field).
|
|
38
|
+
|
|
39
|
+
| Prop | Example | Type |
|
|
40
|
+
| ----------------------- | ----------- | -------------------------------------------------------------- |
|
|
41
|
+
| [`children`](#children) | `<input />` | ReactNode |
|
|
42
|
+
| [`name`](#name) | `"title"` | string |
|
|
43
|
+
| `...` | `{}` | [`<AutoField>` API](/docs/api-reference/components/auto-field) |
|
|
44
|
+
|
|
45
|
+
### `children`
|
|
46
|
+
|
|
47
|
+
The default node for this field type.
|
|
48
|
+
|
|
49
|
+
### `name`
|
|
50
|
+
|
|
51
|
+
The name of the prop this field is rendering for.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# fields
|
|
2
|
+
|
|
3
|
+
Override the fields wrapper.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const overrides = {
|
|
7
|
+
fields: ({ children }) => <div>{children}</div>,
|
|
8
|
+
};
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Example | Type |
|
|
14
|
+
| ----------------------- | --------- | --------- |
|
|
15
|
+
| [`children`](#children) | `<div />` | ReactNode |
|
|
16
|
+
|
|
17
|
+
### `children`
|
|
18
|
+
|
|
19
|
+
The default node for the fields.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# headerActions
|
|
2
|
+
|
|
3
|
+
Override the header actions. Return a fragment so your items appear inline.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const overrides = {
|
|
7
|
+
headerActions: ({ children }) => (
|
|
8
|
+
<>
|
|
9
|
+
{children}
|
|
10
|
+
<button>Click me</button>
|
|
11
|
+
</>
|
|
12
|
+
),
|
|
13
|
+
};
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Props
|
|
17
|
+
|
|
18
|
+
| Prop | Example | Type |
|
|
19
|
+
| ----------------------- | --------- | --------- |
|
|
20
|
+
| [`children`](#children) | `<div />` | ReactNode |
|
|
21
|
+
|
|
22
|
+
### `children`
|
|
23
|
+
|
|
24
|
+
The default node for the header actions, which includes the default publish button.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# header
|
|
2
|
+
|
|
3
|
+
Override the header.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const overrides = {
|
|
7
|
+
header: ({ actions }) => (
|
|
8
|
+
<header>
|
|
9
|
+
<span>My header</span>
|
|
10
|
+
<div>{actions}</div>
|
|
11
|
+
</header>
|
|
12
|
+
),
|
|
13
|
+
};
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Props
|
|
17
|
+
|
|
18
|
+
| Prop | Example | Type |
|
|
19
|
+
| ----------------------- | --------- | --------- |
|
|
20
|
+
| [`actions`](#actions) | `<div />` | ReactNode |
|
|
21
|
+
| [`children`](#children) | `<div />` | ReactNode |
|
|
22
|
+
|
|
23
|
+
### `actions`
|
|
24
|
+
|
|
25
|
+
A node containing the [`headerActions`](/docs/api-reference/overrides/header-actions).
|
|
26
|
+
|
|
27
|
+
### `children`
|
|
28
|
+
|
|
29
|
+
The default node for the header.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# iframe
|
|
2
|
+
|
|
3
|
+
Override the root of the iframe.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const overrides = {
|
|
7
|
+
iframe: ({ children, document }) => {
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (document) {
|
|
10
|
+
document.body.setAttribute("style", "background: hotpink;");
|
|
11
|
+
}
|
|
12
|
+
}, [document]);
|
|
13
|
+
|
|
14
|
+
return <>{children}</>;
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| Prop | Example | Type |
|
|
22
|
+
| ----------------------- | --------- | --------- |
|
|
23
|
+
| [`document`](#document) | `{}` | Document |
|
|
24
|
+
| [`children`](#children) | `<div />` | ReactNode |
|
|
25
|
+
|
|
26
|
+
### `document`
|
|
27
|
+
|
|
28
|
+
The document of the iframe window.
|
|
29
|
+
|
|
30
|
+
### `children`
|
|
31
|
+
|
|
32
|
+
The default node for the iframe.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# outline
|
|
2
|
+
|
|
3
|
+
Override the outline.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
const overrides = {
|
|
7
|
+
outline: ({ children }) => <div>{children}</div>,
|
|
8
|
+
};
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Example | Type |
|
|
14
|
+
| ----------------------- | --------- | --------- |
|
|
15
|
+
| [`children`](#children) | `<div />` | ReactNode |
|
|
16
|
+
|
|
17
|
+
### `children`
|
|
18
|
+
|
|
19
|
+
The default node for the outline.
|