eddev 2.0.0-beta.2 → 2.0.0-beta.200
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/css/editor-styles.css +4 -0
- package/dist/app/entry/HydrationOverlay.d.ts +2 -0
- package/dist/app/entry/HydrationOverlay.d.ts.map +1 -0
- package/dist/app/entry/HydrationOverlay.js +2 -0
- package/dist/app/entry/MetaTags.d.ts +8 -0
- package/dist/app/entry/MetaTags.d.ts.map +1 -0
- package/dist/app/entry/MetaTags.js +30 -0
- package/dist/app/entry/boot-admin.d.ts +2 -0
- package/dist/app/entry/boot-admin.d.ts.map +1 -0
- package/dist/app/entry/boot-admin.js +12 -0
- package/dist/app/entry/hydration-script.d.ts +2 -0
- package/dist/app/entry/hydration-script.d.ts.map +1 -0
- package/dist/app/entry/hydration-script.js +18 -0
- package/dist/app/entry/spa-root.d.ts +2 -0
- package/dist/app/entry/spa-root.d.ts.map +1 -0
- package/dist/app/entry/spa-root.js +7 -0
- package/dist/app/entry/ssr-root-client.d.ts +7 -0
- package/dist/app/entry/ssr-root-client.d.ts.map +1 -0
- package/dist/app/entry/ssr-root-client.js +21 -0
- package/dist/app/entry/ssr-root.d.ts +11 -0
- package/dist/app/entry/ssr-root.d.ts.map +1 -0
- package/dist/app/entry/ssr-root.js +22 -0
- package/dist/app/lib/admin/defineField.d.ts +1 -0
- package/dist/app/lib/admin/defineField.d.ts.map +1 -0
- package/dist/app/lib/admin/defineWidget.d.ts +1 -0
- package/dist/app/lib/admin/defineWidget.d.ts.map +1 -0
- package/dist/app/lib/admin/index.d.ts +3 -2
- package/dist/app/lib/admin/index.d.ts.map +1 -0
- package/dist/app/lib/admin/index.js +2 -2
- package/dist/app/lib/admin/installFieldTypes.d.ts +1 -0
- package/dist/app/lib/admin/installFieldTypes.d.ts.map +1 -0
- package/dist/app/lib/admin/installFieldTypes.js +3 -1
- package/dist/app/lib/admin/runWidgets.d.ts +1 -0
- package/dist/app/lib/admin/runWidgets.d.ts.map +1 -0
- package/dist/app/lib/admin/runWidgets.js +8 -3
- package/dist/app/lib/blocks/ContentBlocks.d.ts +7 -4
- package/dist/app/lib/blocks/ContentBlocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/ContentBlocks.js +19 -6
- package/dist/app/lib/blocks/EditableText.d.ts +31 -6
- package/dist/app/lib/blocks/EditableText.d.ts.map +1 -0
- package/dist/app/lib/blocks/EditableText.js +36 -7
- package/dist/app/lib/blocks/InnerBlocks.d.ts +23 -8
- package/dist/app/lib/blocks/InnerBlocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/InnerBlocks.js +76 -28
- package/dist/app/lib/blocks/SlotBlocks.d.ts +8 -0
- package/dist/app/lib/blocks/SlotBlocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/SlotBlocks.js +46 -0
- package/dist/app/lib/blocks/block-utils.d.ts +3 -2
- package/dist/app/lib/blocks/block-utils.d.ts.map +1 -0
- package/dist/app/lib/blocks/block-utils.js +4 -2
- package/dist/app/lib/blocks/builtin-blocks.d.ts +2 -0
- package/dist/app/lib/blocks/builtin-blocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/builtin-blocks.js +55 -0
- package/dist/app/lib/blocks/defineBlock.d.ts +4 -0
- package/dist/app/lib/blocks/defineBlock.d.ts.map +1 -0
- package/dist/app/lib/blocks/defineBlock.js +9 -0
- package/dist/app/lib/blocks/editor/EditorHighlights.d.ts +8 -0
- package/dist/app/lib/blocks/editor/EditorHighlights.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/EditorHighlights.js +164 -0
- package/dist/app/lib/blocks/editor/EditorSupport.d.ts +1 -0
- package/dist/app/lib/blocks/editor/EditorSupport.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/EditorSupport.js +19 -12
- package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.d.ts +1 -0
- package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/block-templates.d.ts +8 -1
- package/dist/app/lib/blocks/editor/block-templates.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/block-templates.js +71 -2
- package/dist/app/lib/blocks/editor/blocks-by-tag.d.ts +1 -0
- package/dist/app/lib/blocks/editor/blocks-by-tag.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/controls.d.ts +1 -0
- package/dist/app/lib/blocks/editor/controls.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/create-block.d.ts +10 -0
- package/dist/app/lib/blocks/editor/create-block.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/create-block.js +13 -0
- package/dist/app/lib/blocks/editor/editor-config.d.ts +78 -9
- package/dist/app/lib/blocks/editor/editor-config.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/editor-config.js +29 -62
- package/dist/app/lib/blocks/editor/installGutenbergHooks.d.ts +4 -0
- package/dist/app/lib/blocks/editor/installGutenbergHooks.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/installGutenbergHooks.js +130 -25
- package/dist/app/lib/blocks/editor/root-blocks.d.ts +7 -0
- package/dist/app/lib/blocks/editor/root-blocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/root-blocks.js +30 -0
- package/dist/app/lib/blocks/editor/usePostEditor.d.ts +13 -2
- package/dist/app/lib/blocks/editor/usePostEditor.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/usePostEditor.js +28 -13
- package/dist/app/lib/blocks/index.d.ts +12 -9
- package/dist/app/lib/blocks/index.d.ts.map +1 -0
- package/dist/app/lib/blocks/index.js +11 -9
- package/dist/app/lib/blocks/inline-editing.d.ts +11 -1
- package/dist/app/lib/blocks/inline-editing.d.ts.map +1 -0
- package/dist/app/lib/blocks/inline-editing.js +15 -5
- package/dist/app/lib/devtools/components/BreakpointIndicator.d.ts +1 -0
- package/dist/app/lib/devtools/components/BreakpointIndicator.d.ts.map +1 -0
- package/dist/app/lib/devtools/components/BreakpointIndicator.js +7 -5
- package/dist/app/lib/devtools/components/DevUI.d.ts +1 -0
- package/dist/app/lib/devtools/components/DevUI.d.ts.map +1 -0
- package/dist/app/lib/devtools/components/DevUI.js +4 -3
- package/dist/app/lib/devtools/components/GridIndicator.d.ts +2 -0
- package/dist/app/lib/devtools/components/GridIndicator.d.ts.map +1 -0
- package/dist/app/lib/devtools/components/GridIndicator.js +29 -0
- package/dist/app/lib/devtools/dev-tools-store.d.ts +10 -0
- package/dist/app/lib/devtools/dev-tools-store.d.ts.map +1 -0
- package/dist/app/lib/devtools/dev-tools-store.js +8 -0
- package/dist/app/lib/devtools/hooks/usePersistState.d.ts +2 -1
- package/dist/app/lib/devtools/hooks/usePersistState.d.ts.map +1 -0
- package/dist/app/lib/devtools/hooks/usePersistState.js +11 -2
- package/dist/app/lib/devtools/hooks/useTailwind.d.ts +2311 -1267
- package/dist/app/lib/devtools/hooks/useTailwind.d.ts.map +1 -0
- package/dist/app/lib/devtools/hooks/useTailwind.js +6 -3
- package/dist/app/lib/devtools/index.d.ts +2 -0
- package/dist/app/lib/devtools/index.d.ts.map +1 -0
- package/dist/app/lib/devtools/index.js +1 -1
- package/dist/app/lib/devtools/loader.d.ts +1 -0
- package/dist/app/lib/devtools/loader.d.ts.map +1 -0
- package/dist/app/lib/devtools/loader.js +8 -7
- package/dist/app/lib/devtools/tailwind.config.d.ts +1 -0
- package/dist/app/lib/devtools/tailwind.config.d.ts.map +1 -0
- package/dist/app/lib/devtools/useQueryDebug.d.ts +8 -1
- package/dist/app/lib/devtools/useQueryDebug.d.ts.map +1 -0
- package/dist/app/lib/devtools/useQueryDebug.js +5 -8
- package/dist/app/lib/dynamic/dynamic.d.ts +2 -1
- package/dist/app/lib/dynamic/dynamic.d.ts.map +1 -0
- package/dist/app/lib/dynamic/dynamic.js +5 -1
- package/dist/app/lib/dynamic/index.d.ts +2 -1
- package/dist/app/lib/dynamic/index.d.ts.map +1 -0
- package/dist/app/lib/dynamic/index.js +1 -1
- package/dist/app/lib/hooks/index.d.ts +5 -5
- package/dist/app/lib/hooks/index.d.ts.map +1 -0
- package/dist/app/lib/hooks/index.js +4 -5
- package/dist/app/lib/hooks/{queryUtils.d.ts → query-hooks.d.ts} +46 -4
- package/dist/app/lib/hooks/query-hooks.d.ts.map +1 -0
- package/dist/app/lib/hooks/{queryUtils.js → query-hooks.js} +99 -40
- package/dist/app/lib/hooks/useAppData.d.ts +1 -0
- package/dist/app/lib/hooks/useAppData.d.ts.map +1 -0
- package/dist/app/lib/hooks/useAppData.js +12 -1
- package/dist/app/lib/hooks/useRPC.d.ts +1 -4
- package/dist/app/lib/hooks/useRPC.d.ts.map +1 -0
- package/dist/app/lib/hooks/useRPC.js +0 -8
- package/dist/app/lib/integrations/gravityforms/index.d.ts +3 -0
- package/dist/app/lib/integrations/gravityforms/index.d.ts.map +1 -0
- package/dist/app/lib/integrations/gravityforms/index.js +2 -0
- package/dist/app/lib/integrations/gravityforms/types.d.ts +145 -0
- package/dist/app/lib/integrations/gravityforms/types.d.ts.map +1 -0
- package/dist/app/lib/integrations/gravityforms/types.js +1 -0
- package/dist/app/lib/integrations/gravityforms/useGravityForm.d.ts +31 -0
- package/dist/app/lib/integrations/gravityforms/useGravityForm.d.ts.map +1 -0
- package/dist/app/lib/integrations/gravityforms/useGravityForm.js +295 -0
- package/dist/app/lib/internal/finalize-rpc.d.ts +18 -0
- package/dist/app/lib/internal/finalize-rpc.d.ts.map +1 -0
- package/dist/app/lib/internal/finalize-rpc.js +3 -0
- package/dist/app/lib/internal/index.d.ts +6 -4
- package/dist/app/lib/internal/index.d.ts.map +1 -0
- package/dist/app/lib/internal/index.js +5 -4
- package/dist/app/lib/internal/internal-store.d.ts +1 -2
- package/dist/app/lib/internal/internal-store.d.ts.map +1 -0
- package/dist/app/lib/internal/internal-store.js +1 -3
- package/dist/app/lib/internal/read-admin-manifest.d.ts +2 -1
- package/dist/app/lib/internal/read-admin-manifest.d.ts.map +1 -0
- package/dist/app/lib/internal/read-block-manifest.d.ts +1 -0
- package/dist/app/lib/internal/read-block-manifest.d.ts.map +1 -0
- package/dist/app/lib/internal/read-view-manifest.d.ts +1 -0
- package/dist/app/lib/internal/read-view-manifest.d.ts.map +1 -0
- package/dist/app/lib/legacy-stitches/createStitches.d.ts +22 -21
- package/dist/app/lib/legacy-stitches/createStitches.d.ts.map +1 -0
- package/dist/app/lib/legacy-stitches/createStitches.js +1 -1
- package/dist/app/lib/legacy-stitches/index.d.ts +2 -1
- package/dist/app/lib/legacy-stitches/index.d.ts.map +1 -0
- package/dist/app/lib/legacy-stitches/index.js +1 -1
- package/dist/app/lib/routing/components/BackButton.d.ts +50 -0
- package/dist/app/lib/routing/components/BackButton.d.ts.map +1 -0
- package/dist/app/lib/routing/components/BackButton.js +47 -0
- package/dist/app/lib/routing/components/BrowserRouter.d.ts +10 -1
- package/dist/app/lib/routing/components/BrowserRouter.d.ts.map +1 -0
- package/dist/app/lib/routing/components/BrowserRouter.js +138 -23
- package/dist/app/lib/routing/components/ClientOnly.d.ts +1 -0
- package/dist/app/lib/routing/components/ClientOnly.d.ts.map +1 -0
- package/dist/app/lib/routing/components/ClientOnly.js +2 -2
- package/dist/app/lib/routing/components/Link.d.ts +19 -2
- package/dist/app/lib/routing/components/Link.d.ts.map +1 -0
- package/dist/app/lib/routing/components/Link.js +47 -27
- package/dist/app/lib/routing/components/NativeLinkHandler.d.ts +10 -0
- package/dist/app/lib/routing/components/NativeLinkHandler.d.ts.map +1 -0
- package/dist/app/lib/routing/components/NativeLinkHandler.js +23 -0
- package/dist/app/lib/routing/components/RouteRenderer.d.ts +2 -1
- package/dist/app/lib/routing/components/RouteRenderer.d.ts.map +1 -0
- package/dist/app/lib/routing/components/RouteRenderer.js +20 -6
- package/dist/app/lib/routing/components/SSRRouter.d.ts +5 -2
- package/dist/app/lib/routing/components/SSRRouter.d.ts.map +1 -0
- package/dist/app/lib/routing/components/SSRRouter.js +7 -6
- package/dist/app/lib/routing/components/ScrollRestoration.d.ts +1 -0
- package/dist/app/lib/routing/components/ScrollRestoration.d.ts.map +1 -0
- package/dist/app/lib/routing/components/ScrollRestoration.js +5 -2
- package/dist/app/lib/routing/context.d.ts +9 -5
- package/dist/app/lib/routing/context.d.ts.map +1 -0
- package/dist/app/lib/routing/context.js +13 -96
- package/dist/app/lib/routing/hooks/useIsSSR.d.ts +1 -0
- package/dist/app/lib/routing/hooks/useIsSSR.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRestorableState.d.ts +3 -1
- package/dist/app/lib/routing/hooks/useRestorableState.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRestorableState.js +2 -1
- package/dist/app/lib/routing/hooks/useRoute.d.ts +17 -1
- package/dist/app/lib/routing/hooks/useRoute.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRoute.js +22 -1
- package/dist/app/lib/routing/hooks/useRouteMeta.d.ts +6 -0
- package/dist/app/lib/routing/hooks/useRouteMeta.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouteMeta.js +9 -0
- package/dist/app/lib/routing/hooks/useRouteTransition.d.ts +2 -1
- package/dist/app/lib/routing/hooks/useRouteTransition.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouteTransition.js +1 -1
- package/dist/app/lib/routing/hooks/useRouter.d.ts +2 -1
- package/dist/app/lib/routing/hooks/useRouter.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouter.js +1 -1
- package/dist/app/lib/routing/hooks/useRouterEvents.d.ts +2 -1
- package/dist/app/lib/routing/hooks/useRouterEvents.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouterEvents.js +1 -1
- package/dist/app/lib/routing/hooks/useRouterState.d.ts +2 -1
- package/dist/app/lib/routing/hooks/useRouterState.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouterState.js +1 -1
- package/dist/app/lib/routing/hooks/useSearchParams.d.ts +78 -6
- package/dist/app/lib/routing/hooks/useSearchParams.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useSearchParams.js +77 -17
- package/dist/app/lib/routing/index.d.ts +16 -13
- package/dist/app/lib/routing/index.d.ts.map +1 -0
- package/dist/app/lib/routing/index.js +15 -13
- package/dist/app/lib/routing/loader.d.ts +3 -2
- package/dist/app/lib/routing/loader.d.ts.map +1 -0
- package/dist/app/lib/routing/loader.js +26 -15
- package/dist/app/lib/routing/types.d.ts +62 -14
- package/dist/app/lib/routing/types.d.ts.map +1 -0
- package/dist/app/lib/routing/utils.d.ts +7 -2
- package/dist/app/lib/routing/utils.d.ts.map +1 -0
- package/dist/app/lib/routing/utils.js +41 -4
- package/dist/app/lib/{hooks → runtime}/apiConfig.d.ts +11 -2
- package/dist/app/lib/runtime/apiConfig.d.ts.map +1 -0
- package/dist/app/lib/runtime/apiConfig.js +6 -0
- package/dist/app/lib/runtime/errorHandling.d.ts +40 -0
- package/dist/app/lib/runtime/errorHandling.d.ts.map +1 -0
- package/dist/app/lib/runtime/errorHandling.js +6 -0
- package/dist/app/lib/runtime/index.d.ts +3 -0
- package/dist/app/lib/runtime/index.d.ts.map +1 -0
- package/dist/app/lib/runtime/index.js +2 -0
- package/dist/app/lib/views/defineView.d.ts +2 -1
- package/dist/app/lib/views/defineView.d.ts.map +1 -0
- package/dist/app/lib/views/index.d.ts +2 -1
- package/dist/app/lib/views/index.d.ts.map +1 -0
- package/dist/app/lib/views/index.js +1 -1
- package/dist/app/server/index.d.ts +6 -0
- package/dist/app/server/index.d.ts.map +1 -0
- package/dist/app/server/index.js +5 -0
- package/dist/app/server/proxy-wp-admin.d.ts +3 -0
- package/dist/app/server/proxy-wp-admin.d.ts.map +1 -0
- package/dist/app/server/proxy-wp-admin.js +138 -0
- package/dist/app/server/render-ai-page.d.ts +13 -0
- package/dist/app/server/render-ai-page.d.ts.map +1 -0
- package/dist/app/server/render-ai-page.js +100 -0
- package/dist/app/server/render-ssr-page.d.ts +31 -0
- package/dist/app/server/render-ssr-page.d.ts.map +1 -0
- package/dist/app/server/render-ssr-page.js +237 -0
- package/dist/app/server/rpc.d.ts +52 -0
- package/dist/app/server/rpc.d.ts.map +1 -0
- package/dist/app/server/rpc.js +18 -0
- package/dist/app/server/server-context.d.ts +75 -0
- package/dist/app/server/server-context.d.ts.map +1 -0
- package/dist/app/server/server-context.js +417 -0
- package/dist/app/server/server-custom-config.d.ts +3 -0
- package/dist/app/server/server-custom-config.d.ts.map +1 -0
- package/dist/app/server/server-custom-config.js +1 -0
- package/dist/app/server/utils/content-security.d.ts +26 -0
- package/dist/app/server/utils/content-security.d.ts.map +1 -0
- package/dist/app/server/utils/content-security.js +124 -0
- package/dist/app/server/utils/headers.d.ts +2 -0
- package/dist/app/server/utils/headers.d.ts.map +1 -0
- package/dist/app/server/utils/headers.js +17 -0
- package/dist/app/server/utils/replace-host.d.ts +7 -4
- package/dist/app/server/utils/replace-host.d.ts.map +1 -0
- package/dist/app/server/utils/replace-host.js +66 -11
- package/dist/app/server/utils/swr-cache.d.ts +5 -0
- package/dist/app/server/utils/swr-cache.d.ts.map +1 -0
- package/dist/app/server/utils/swr-cache.js +31 -0
- package/dist/app/utils/APIProvider.d.ts +3 -0
- package/dist/app/utils/APIProvider.d.ts.map +1 -0
- package/dist/app/utils/APIProvider.js +5 -0
- package/dist/app/utils/BlockErrorBoundary.d.ts +20 -0
- package/dist/app/utils/BlockErrorBoundary.d.ts.map +1 -0
- package/dist/app/utils/BlockErrorBoundary.js +38 -0
- package/dist/app/utils/ErrorMessage.d.ts +6 -0
- package/dist/app/utils/ErrorMessage.d.ts.map +1 -0
- package/dist/app/utils/ErrorMessage.js +14 -0
- package/dist/app/utils/RouteErrorBoundary.d.ts +20 -0
- package/dist/app/utils/RouteErrorBoundary.d.ts.map +1 -0
- package/dist/app/utils/RouteErrorBoundary.js +41 -0
- package/dist/app/utils/asset-capture.d.ts +3 -0
- package/dist/app/utils/asset-capture.d.ts.map +1 -0
- package/dist/app/utils/asset-capture.js +5 -0
- package/dist/app/utils/hydration-debugger.d.ts +14 -0
- package/dist/app/utils/hydration-debugger.d.ts.map +1 -0
- package/dist/app/utils/hydration-debugger.js +11 -0
- package/dist/app/utils/query-client.d.ts +3 -0
- package/dist/app/utils/query-client.d.ts.map +1 -0
- package/dist/app/utils/query-client.js +5 -1
- package/dist/app/utils/query-monitor.d.ts +27 -0
- package/dist/app/utils/query-monitor.d.ts.map +1 -0
- package/dist/app/utils/query-monitor.js +7 -0
- package/dist/app/utils/trpc-client.d.ts +3 -0
- package/dist/app/utils/trpc-client.d.ts.map +1 -0
- package/dist/app/utils/trpc-client.js +39 -0
- package/dist/app/utils/wp.d.ts +11 -10
- package/dist/app/utils/wp.d.ts.map +1 -0
- package/dist/node/cli/cli-mode.d.ts +1 -0
- package/dist/node/cli/cli-mode.d.ts.map +1 -0
- package/dist/node/cli/cli-worker.d.ts +2 -1
- package/dist/node/cli/cli-worker.d.ts.map +1 -0
- package/dist/node/cli/cli-worker.js +12 -3
- package/dist/node/cli/cli.d.ts +1 -0
- package/dist/node/cli/cli.d.ts.map +1 -0
- package/dist/node/cli/cli.js +195 -11
- package/dist/node/cli/display/CLIApp.d.ts +2 -1
- package/dist/node/cli/display/CLIApp.d.ts.map +1 -0
- package/dist/node/cli/display/CLIApp.js +4 -7
- package/dist/node/cli/display/boot-cli-app.d.ts +1 -0
- package/dist/node/cli/display/boot-cli-app.d.ts.map +1 -0
- package/dist/node/cli/display/boot-cli-app.js +1 -1
- package/dist/node/cli/display/components/Fullscreen.d.ts +1 -0
- package/dist/node/cli/display/components/Fullscreen.d.ts.map +1 -0
- package/dist/node/cli/display/components/LogEntries.d.ts +2 -1
- package/dist/node/cli/display/components/LogEntries.d.ts.map +1 -0
- package/dist/node/cli/display/components/MenuItem.d.ts +1 -0
- package/dist/node/cli/display/components/MenuItem.d.ts.map +1 -0
- package/dist/node/cli/display/components/TextInput.d.ts +1 -0
- package/dist/node/cli/display/components/TextInput.d.ts.map +1 -0
- package/dist/node/cli/display/hooks/useManifest.d.ts +1 -0
- package/dist/node/cli/display/hooks/useManifest.d.ts.map +1 -0
- package/dist/node/cli/display/hooks/useStatefulLog.d.ts +2 -1
- package/dist/node/cli/display/hooks/useStatefulLog.d.ts.map +1 -0
- package/dist/node/cli/display/tools/BlockList.d.ts +1 -0
- package/dist/node/cli/display/tools/BlockList.d.ts.map +1 -0
- package/dist/node/cli/display/tools/CreateBlock.d.ts +2 -1
- package/dist/node/cli/display/tools/CreateBlock.d.ts.map +1 -0
- package/dist/node/cli/display/tools/cli-tool-list.d.ts +1 -0
- package/dist/node/cli/display/tools/cli-tool-list.d.ts.map +1 -0
- package/dist/node/cli/display/tools/cli-tools.d.ts +2 -11
- package/dist/node/cli/display/tools/cli-tools.d.ts.map +1 -0
- package/dist/node/cli/display/tools/cli-tools.js +9 -9
- package/dist/node/cli/display/util/colors.d.ts +3 -2
- package/dist/node/cli/display/util/colors.d.ts.map +1 -0
- package/dist/node/cli/version.d.ts +2 -1
- package/dist/node/cli/version.d.ts.map +1 -0
- package/dist/node/cli/version.js +1 -1
- package/dist/node/compiler/build-vinxi.d.ts +9 -0
- package/dist/node/compiler/build-vinxi.d.ts.map +1 -0
- package/dist/node/compiler/build-vinxi.js +38 -0
- package/dist/node/compiler/bundler.admin.d.ts +3 -2
- package/dist/node/compiler/bundler.admin.d.ts.map +1 -0
- package/dist/node/compiler/bundler.admin.js +4 -4
- package/dist/node/compiler/bundler.frontend.d.ts +3 -1
- package/dist/node/compiler/bundler.frontend.d.ts.map +1 -0
- package/dist/node/compiler/bundler.frontend.js +29 -15
- package/dist/node/compiler/dev-server.d.ts +19 -0
- package/dist/node/compiler/dev-server.d.ts.map +1 -0
- package/dist/node/compiler/dev-server.js +113 -0
- package/dist/node/compiler/get-vite-config.d.ts +30 -0
- package/dist/node/compiler/get-vite-config.d.ts.map +1 -0
- package/dist/node/compiler/get-vite-config.js +332 -0
- package/dist/node/compiler/vinxi-app.d.ts +23 -0
- package/dist/node/compiler/vinxi-app.d.ts.map +1 -0
- package/dist/node/compiler/vinxi-app.js +230 -0
- package/dist/node/compiler/vinxi-codegen.d.ts +13 -0
- package/dist/node/compiler/vinxi-codegen.d.ts.map +1 -0
- package/dist/node/compiler/vinxi-codegen.js +731 -0
- package/dist/node/graphql/graphql-codegen.d.ts +13 -2
- package/dist/node/graphql/graphql-codegen.d.ts.map +1 -0
- package/dist/node/graphql/graphql-codegen.js +242 -40
- package/dist/node/graphql/graphql-schema-loader.d.ts +3 -1
- package/dist/node/graphql/graphql-schema-loader.d.ts.map +1 -0
- package/dist/node/graphql/graphql-schema-loader.js +5 -19
- package/dist/node/graphql/plugins/gql-plugin-files.d.ts +3 -1
- package/dist/node/graphql/plugins/gql-plugin-files.d.ts.map +1 -0
- package/dist/node/graphql/plugins/gql-plugin-files.js +3 -2
- package/dist/node/graphql/plugins/gql-plugin-no-duplicates.d.ts +1 -0
- package/dist/node/graphql/plugins/gql-plugin-no-duplicates.d.ts.map +1 -0
- package/dist/node/graphql/plugins/gql-plugin-queries.d.ts +1 -0
- package/dist/node/graphql/plugins/gql-plugin-queries.d.ts.map +1 -0
- package/dist/node/graphql/plugins/gql-plugin-queries.js +2 -2
- package/dist/node/graphql/query-files-loader.d.ts +4 -0
- package/dist/node/graphql/query-files-loader.d.ts.map +1 -0
- package/dist/node/graphql/query-files-loader.js +5 -0
- package/dist/node/graphql/wp-info-query.d.ts +1 -0
- package/dist/node/graphql/wp-info-query.d.ts.map +1 -0
- package/dist/node/project/config.d.ts +207 -73
- package/dist/node/project/config.d.ts.map +1 -0
- package/dist/node/project/config.js +95 -21
- package/dist/node/project/eddev-build-file.d.ts +1 -0
- package/dist/node/project/eddev-build-file.d.ts.map +1 -0
- package/dist/node/project/eddev-build-file.js +4 -2
- package/dist/node/project/env.d.ts +6 -1
- package/dist/node/project/env.d.ts.map +1 -0
- package/dist/node/project/env.js +2 -1
- package/dist/node/project/favicons.d.ts +1 -0
- package/dist/node/project/favicons.d.ts.map +1 -0
- package/dist/node/project/manifest/block-manifest.d.ts +1 -0
- package/dist/node/project/manifest/block-manifest.d.ts.map +1 -0
- package/dist/node/project/manifest/block-manifest.js +8 -4
- package/dist/node/project/manifest/field-manifest.d.ts +1 -0
- package/dist/node/project/manifest/field-manifest.d.ts.map +1 -0
- package/dist/node/project/manifest/manifest.d.ts +3 -1
- package/dist/node/project/manifest/manifest.d.ts.map +1 -0
- package/dist/node/project/manifest/manifest.js +15 -11
- package/dist/node/project/manifest/routes-manifest.d.ts +21 -0
- package/dist/node/project/manifest/routes-manifest.d.ts.map +1 -0
- package/dist/node/project/manifest/routes-manifest.js +74 -0
- package/dist/node/project/manifest/view-manifest.d.ts +1 -0
- package/dist/node/project/manifest/view-manifest.d.ts.map +1 -0
- package/dist/node/project/manifest/view-manifest.js +2 -2
- package/dist/node/project/manifest/widget-manifest.d.ts +1 -0
- package/dist/node/project/manifest/widget-manifest.d.ts.map +1 -0
- package/dist/node/project/project.d.ts +15 -2
- package/dist/node/project/project.d.ts.map +1 -0
- package/dist/node/project/project.js +73 -21
- package/dist/node/project/wp-info.d.ts +3 -0
- package/dist/node/project/wp-info.d.ts.map +1 -0
- package/dist/node/project/wp-info.js +13 -3
- package/dist/node/storybook/index.d.ts +3 -0
- package/dist/node/storybook/index.d.ts.map +1 -0
- package/dist/node/storybook/index.js +13 -0
- package/dist/node/types/block-type.d.ts +57 -25
- package/dist/node/types/block-type.d.ts.map +1 -0
- package/dist/node/types/block-type.js +4 -1
- package/dist/node/types/view-type.d.ts +8 -7
- package/dist/node/types/view-type.d.ts.map +1 -0
- package/dist/node/types/view-type.js +3 -4
- package/dist/node/utils/fetch-wp.d.ts +2 -0
- package/dist/node/utils/fetch-wp.d.ts.map +1 -0
- package/dist/node/utils/fetch-wp.js +28 -0
- package/dist/node/utils/{formatZodError.d.ts → format-zod-error.d.ts} +1 -0
- package/dist/node/utils/format-zod-error.d.ts.map +1 -0
- package/dist/node/utils/fs-codegen.d.ts +44 -0
- package/dist/node/utils/fs-codegen.d.ts.map +1 -0
- package/dist/node/utils/fs-codegen.js +105 -0
- package/dist/node/utils/fs.d.ts +5 -0
- package/dist/node/utils/fs.d.ts.map +1 -0
- package/dist/node/utils/fs.js +2 -0
- package/dist/node/utils/{getRepoInfo.d.ts → get-repo-info.d.ts} +1 -0
- package/dist/node/utils/get-repo-info.d.ts.map +1 -0
- package/dist/node/utils/helpers.d.ts +1 -0
- package/dist/node/utils/helpers.d.ts.map +1 -0
- package/dist/node/utils/{highlightCode.d.ts → highlight-code.d.ts} +1 -0
- package/dist/node/utils/highlight-code.d.ts.map +1 -0
- package/dist/node/utils/{isDeploying.d.ts → is-deploying.d.ts} +1 -0
- package/dist/node/utils/is-deploying.d.ts.map +1 -0
- package/dist/node/utils/{isDeploying.js → is-deploying.js} +1 -1
- package/dist/node/utils/report-builder.d.ts +7 -6
- package/dist/node/utils/report-builder.d.ts.map +1 -0
- package/dist/node/utils/self-signed-cert.d.ts +9 -0
- package/dist/node/utils/self-signed-cert.d.ts.map +1 -0
- package/dist/node/utils/{selfSignedCert.js → self-signed-cert.js} +29 -5
- package/dist/node/utils/{statefulLog.d.ts → stateful-log.d.ts} +1 -0
- package/dist/node/utils/stateful-log.d.ts.map +1 -0
- package/dist/node/utils/{statefulLog.js → stateful-log.js} +3 -1
- package/dist/node/utils/{export-extractor.d.ts → ts-export-extractor.d.ts} +1 -0
- package/dist/node/utils/ts-export-extractor.d.ts.map +1 -0
- package/dist/node/utils/watch-file-tree.d.ts +26 -0
- package/dist/node/utils/watch-file-tree.d.ts.map +1 -0
- package/dist/node/utils/{watchFileTree.js → watch-file-tree.js} +12 -5
- package/package.json +62 -47
- package/tsconfig.app.json +8 -3
- package/tsconfig.node.json +1 -0
- package/types.app.d.ts +4 -2
- package/types.app.internal.d.ts +2 -2
- package/types.meta.d.ts +449 -136
- package/types.node.d.ts +3 -3
- package/dist/app/entry/Root.d.ts +0 -1
- package/dist/app/entry/Root.js +0 -9
- package/dist/app/entry/main.admin.d.ts +0 -3
- package/dist/app/entry/main.admin.js +0 -10
- package/dist/app/entry/main.frontend.spa.d.ts +0 -3
- package/dist/app/entry/main.frontend.spa.js +0 -13
- package/dist/app/entry/main.frontend.ssr.d.ts +0 -21
- package/dist/app/entry/main.frontend.ssr.js +0 -79
- package/dist/app/entry/main.serverless.dev.d.ts +0 -4
- package/dist/app/entry/main.serverless.dev.js +0 -21
- package/dist/app/lib/blocks/ErrorBoundaryFrontend.d.ts +0 -15
- package/dist/app/lib/blocks/ErrorBoundaryFrontend.js +0 -35
- package/dist/app/lib/hooks/apiConfig.js +0 -4
- package/dist/app/lib/hooks/usePageLoad.d.ts +0 -6
- package/dist/app/lib/hooks/usePageLoad.js +0 -5
- package/dist/app/server/create-api-builtin-hono.d.ts +0 -8
- package/dist/app/server/create-api-builtin-hono.js +0 -80
- package/dist/app/server/create-ssr-hono.d.ts +0 -18
- package/dist/app/server/create-ssr-hono.js +0 -104
- package/dist/app/server/utils/index.html.d.ts +0 -2
- package/dist/app/server/utils/index.html.js +0 -14
- package/dist/node/compiler/index.html.d.ts +0 -2
- package/dist/node/compiler/index.html.js +0 -15
- package/dist/node/compiler/serverless.dev.d.ts +0 -16
- package/dist/node/compiler/serverless.dev.js +0 -215
- package/dist/node/compiler/vite/get-vite-config.d.ts +0 -13
- package/dist/node/compiler/vite/get-vite-config.js +0 -315
- package/dist/node/compiler/vite/plugin-admin.d.ts +0 -4
- package/dist/node/compiler/vite/plugin-admin.js +0 -67
- package/dist/node/compiler/vite/plugin-blocks.d.ts +0 -4
- package/dist/node/compiler/vite/plugin-blocks.js +0 -73
- package/dist/node/compiler/vite/plugin-entry.d.ts +0 -6
- package/dist/node/compiler/vite/plugin-entry.js +0 -16
- package/dist/node/compiler/vite/plugin-resolved-tailwind.d.ts +0 -4
- package/dist/node/compiler/vite/plugin-resolved-tailwind.js +0 -29
- package/dist/node/compiler/vite/plugin-theme.d.ts +0 -4
- package/dist/node/compiler/vite/plugin-theme.js +0 -40
- package/dist/node/compiler/vite/plugin-views.d.ts +0 -4
- package/dist/node/compiler/vite/plugin-views.js +0 -51
- package/dist/node/utils/console.d.ts +0 -21
- package/dist/node/utils/console.js +0 -28
- package/dist/node/utils/selfSignedCert.d.ts +0 -4
- package/dist/node/utils/unsafe-fetch.d.ts +0 -2
- package/dist/node/utils/unsafe-fetch.js +0 -19
- package/dist/node/utils/watchFileTree.d.ts +0 -11
- package/tsup.config.ts +0 -40
- package/types.manifests.d.ts +0 -22
- /package/dist/node/utils/{formatZodError.js → format-zod-error.js} +0 -0
- /package/dist/node/utils/{getRepoInfo.js → get-repo-info.js} +0 -0
- /package/dist/node/utils/{highlightCode.js → highlight-code.js} +0 -0
- /package/dist/node/utils/{export-extractor.js → ts-export-extractor.js} +0 -0
|
@@ -1,9 +1,78 @@
|
|
|
1
|
-
export function resolveAcfBlockName(name) {
|
|
1
|
+
export function resolveAcfBlockName(name, check = true) {
|
|
2
2
|
const acfName = "acf/" + name.replace("/", "-").replace("_", "");
|
|
3
|
-
|
|
3
|
+
if (check) {
|
|
4
|
+
return wp.blocks.getBlockType(acfName) ? acfName : name;
|
|
5
|
+
}
|
|
6
|
+
else {
|
|
7
|
+
return acfName;
|
|
8
|
+
}
|
|
4
9
|
}
|
|
5
10
|
export function transformBlockTemplate(template) {
|
|
6
11
|
return template.map(([name, props, children]) => {
|
|
7
12
|
return [resolveAcfBlockName(name), props, children ? transformBlockTemplate(children) : undefined];
|
|
8
13
|
});
|
|
9
14
|
}
|
|
15
|
+
export function applyTemplateBlocks(currentBlocks, config) {
|
|
16
|
+
const templateBlocks = currentBlocks.filter((block) => block.attributes.isFromTemplate);
|
|
17
|
+
let header = config.headerTemplate ? syncBlocks(transformTemplateToBlocks(config.headerTemplate)) : [];
|
|
18
|
+
let footer = config.footerTemplate ? syncBlocks(transformTemplateToBlocks(config.footerTemplate)) : [];
|
|
19
|
+
let blocks = currentBlocks.filter((block) => !header.includes(block) && !footer.includes(block));
|
|
20
|
+
blocks.forEach((block) => {
|
|
21
|
+
delete block.attributes.lock;
|
|
22
|
+
delete block.isFromTemplate;
|
|
23
|
+
});
|
|
24
|
+
// const blocksToDelete = currentBlocks.filter((block: any) => {
|
|
25
|
+
// return !header.includes(block) && !footer.includes(block) && !blocks.includes(block)
|
|
26
|
+
// })
|
|
27
|
+
// blocksToDelete.forEach((block: any) => {
|
|
28
|
+
// delete block.attributes.lock
|
|
29
|
+
// delete block.isFromTemplate
|
|
30
|
+
// })
|
|
31
|
+
// blocks = [...blocks, ...blocksToDelete]
|
|
32
|
+
// console.log("blocks", blocks)
|
|
33
|
+
// console.log("blocksToDelete", blocksToDelete)
|
|
34
|
+
if (!blocks.length && config.defaultBlocks) {
|
|
35
|
+
blocks = transformTemplateToBlocks(config.defaultBlocks, false, false);
|
|
36
|
+
}
|
|
37
|
+
let newBlocks = [...header, ...blocks, ...footer];
|
|
38
|
+
function syncBlocks(blocks) {
|
|
39
|
+
return blocks.map((block) => {
|
|
40
|
+
const matched = templateBlocks.find((templateBlock) => templateBlock.name === block.name);
|
|
41
|
+
templateBlocks.splice(templateBlocks.indexOf(matched), 1);
|
|
42
|
+
if (matched) {
|
|
43
|
+
matched.attributes.lock = block.attributes.lock;
|
|
44
|
+
return matched;
|
|
45
|
+
}
|
|
46
|
+
return block;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return newBlocks;
|
|
50
|
+
}
|
|
51
|
+
export function transformTemplateToBlocks(template, locked = true, isFromTemplate = true) {
|
|
52
|
+
return template.map(([name, props, children]) => {
|
|
53
|
+
const attributes = {
|
|
54
|
+
data: {},
|
|
55
|
+
inline: {},
|
|
56
|
+
isFromTemplate: isFromTemplate,
|
|
57
|
+
lock: undefined,
|
|
58
|
+
};
|
|
59
|
+
if (props.locked === false) {
|
|
60
|
+
attributes.lock = { move: false, remove: false };
|
|
61
|
+
}
|
|
62
|
+
else if (locked || props.locked === true || props.locked === "all") {
|
|
63
|
+
attributes.lock = { move: true, remove: true };
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
attributes.lock = props.lock;
|
|
67
|
+
}
|
|
68
|
+
Object.assign(attributes, props);
|
|
69
|
+
return {
|
|
70
|
+
clientId: "block-" + Math.random().toString(36),
|
|
71
|
+
name: resolveAcfBlockName(name),
|
|
72
|
+
attributes: attributes,
|
|
73
|
+
innerBlocks: children ? transformTemplateToBlocks(children, false, isFromTemplate) : [],
|
|
74
|
+
isValid: true,
|
|
75
|
+
validationIssues: [],
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocks-by-tag.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/blocks/editor/blocks-by-tag.tsx"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,WAAW;eACX,MAAM,QAAQ,MAAM,EAAE;mBAYlB,MAAM,EAAE;CAuBxB,CAAA"}
|
|
@@ -8,3 +8,4 @@ import { PropsWithChildren } from "react";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function InspectorControls(props: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element | null;
|
|
10
10
|
export declare function BlockControls(props: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
//# sourceMappingURL=controls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/blocks/editor/controls.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAEzC;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,CAAC,EAAE,CAAC,kDAK7D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,iBAAiB,CAAC,EAAE,CAAC,kDAKzD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BlockInstance } from "../inline-editing";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a block instance for the editor. This doesn't add the block to the editor on it's own.
|
|
4
|
+
* @param name The name of the block
|
|
5
|
+
* @param attributes
|
|
6
|
+
* @param innerBlocks
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function createBlock(name: ChildBlockTypeName, attributes?: Record<string, any>, innerBlocks?: BlockInstance[]): BlockInstance;
|
|
10
|
+
//# sourceMappingURL=create-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-block.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/blocks/editor/create-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,kBAAkB,EACxB,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EACpC,WAAW,GAAE,aAAa,EAAO,GAChC,aAAa,CAKf"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a block instance for the editor. This doesn't add the block to the editor on it's own.
|
|
3
|
+
* @param name The name of the block
|
|
4
|
+
* @param attributes
|
|
5
|
+
* @param innerBlocks
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export function createBlock(name, attributes = {}, innerBlocks = []) {
|
|
9
|
+
if (!env.admin) {
|
|
10
|
+
throw new Error("`createBlock` can only be used in the admin environment");
|
|
11
|
+
}
|
|
12
|
+
return wp.blocks.createBlock(name, attributes, innerBlocks);
|
|
13
|
+
}
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
import { BlockTemplate } from "./block-templates";
|
|
1
|
+
import { BlockTemplate } from "./block-templates.js";
|
|
2
2
|
export type EditorConfigItem = {
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Optionally indicate that the post title field should be hidden. Use then when your header template includes a post title editor already.
|
|
5
|
+
* @default false
|
|
6
|
+
**/
|
|
4
7
|
hideTitle?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Override the blocks which are allowed to be added to the root of this post-type/template combination.
|
|
10
|
+
*
|
|
11
|
+
* You can specify one or more block names, or block tags.
|
|
12
|
+
*
|
|
13
|
+
* The default is "root".
|
|
14
|
+
*
|
|
15
|
+
* @default ["root"]
|
|
16
|
+
**/
|
|
17
|
+
rootBlocks?: (ChildBlockTypeName | BlockTagName)[];
|
|
5
18
|
/** Allows you to add additional class names to blocks, depending on their type and state */
|
|
6
19
|
generateBlockClassName?: BlockWrapperClassGenerator;
|
|
7
20
|
/** The default blocks to insert when there are no (non-templated) blocks */
|
|
@@ -13,29 +26,48 @@ export type EditorConfigItem = {
|
|
|
13
26
|
/** A full-page block template */
|
|
14
27
|
template?: BlockTemplate;
|
|
15
28
|
};
|
|
16
|
-
type
|
|
29
|
+
type EditorBlock = {
|
|
17
30
|
name: string;
|
|
18
31
|
slug: BlockTypeName | (string & {});
|
|
19
32
|
attributes: any;
|
|
20
33
|
clientId: string;
|
|
21
34
|
rootClientId: string;
|
|
35
|
+
isRootBlock: string;
|
|
22
36
|
canMove: boolean;
|
|
23
37
|
canRemove: boolean;
|
|
24
38
|
isSelected: boolean;
|
|
25
39
|
isSelectionEnabled: boolean;
|
|
26
40
|
tags?: DefinedBlockTags;
|
|
27
41
|
flags?: DefinedBlockFlags;
|
|
28
|
-
}
|
|
42
|
+
};
|
|
43
|
+
export type BlockWrapperClassGenerator = (block: EditorBlock, post: PostInfo) => string | void;
|
|
29
44
|
export declare const editorConfigStore: {
|
|
30
45
|
config: EditorConfig | null;
|
|
31
|
-
currentBlocksConfig: EditorConfigItem
|
|
46
|
+
currentBlocksConfig: EditorConfigItem;
|
|
32
47
|
};
|
|
33
48
|
export declare function configureEditorBlocks(config: EditorConfigItem): void;
|
|
34
|
-
export declare function transformTemplateToBlocks(template: BlockTemplate, locked?: boolean): any;
|
|
35
49
|
type PostInfo = {
|
|
36
|
-
template: TemplateName | "default";
|
|
37
50
|
type: PostTypeName;
|
|
51
|
+
isPattern: false;
|
|
52
|
+
isTemplatePart: false;
|
|
53
|
+
template: TemplateName | "default";
|
|
38
54
|
slug: string;
|
|
55
|
+
parent: number;
|
|
56
|
+
title: string;
|
|
57
|
+
link: string;
|
|
58
|
+
} | {
|
|
59
|
+
type: "wp_block";
|
|
60
|
+
isPattern: true;
|
|
61
|
+
isTemplatePart: false;
|
|
62
|
+
title: string;
|
|
63
|
+
} | {
|
|
64
|
+
type: "wp_template_part";
|
|
65
|
+
isPattern: false;
|
|
66
|
+
isTemplatePart: true;
|
|
67
|
+
area: string;
|
|
68
|
+
title: string;
|
|
69
|
+
slug: string;
|
|
70
|
+
wp_pattern_category?: number[];
|
|
39
71
|
};
|
|
40
72
|
type MatcherFunction = (post: PostInfo) => boolean | void;
|
|
41
73
|
type Matcher = {
|
|
@@ -44,9 +76,45 @@ type Matcher = {
|
|
|
44
76
|
/** Configuration for the editor, when the post type and template match */
|
|
45
77
|
config: EditorConfigItem | ((post: PostInfo) => EditorConfigItem);
|
|
46
78
|
};
|
|
79
|
+
export type BlockTransform = {
|
|
80
|
+
from: ChildBlockTypeName[];
|
|
81
|
+
to: ChildBlockTypeName;
|
|
82
|
+
};
|
|
83
|
+
export type CustomRichTextFormat = {
|
|
84
|
+
/** The ID of the format, eg. `"custom/fancy"` */
|
|
85
|
+
id: string;
|
|
86
|
+
/** The title of the format, shown on the tooltip */
|
|
87
|
+
title: string;
|
|
88
|
+
/**
|
|
89
|
+
* The HTML tag name to use.
|
|
90
|
+
* @default `"span"`
|
|
91
|
+
**/
|
|
92
|
+
tagName?: string;
|
|
93
|
+
/**
|
|
94
|
+
* The class name to apply to the element.
|
|
95
|
+
* @default `undefined`
|
|
96
|
+
**/
|
|
97
|
+
className?: string;
|
|
98
|
+
/**
|
|
99
|
+
* The icon to use in the toolbar.
|
|
100
|
+
*/
|
|
101
|
+
icon?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Whether format makes content interactive or not.
|
|
104
|
+
* @default `false`
|
|
105
|
+
*/
|
|
106
|
+
interactive?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Whether to disable this format by default. If `true`, you must pass the format ID to `allowedFormats` on a `EditableText` component.
|
|
109
|
+
*
|
|
110
|
+
* @default `false`
|
|
111
|
+
*/
|
|
112
|
+
disabledByDefault?: boolean;
|
|
113
|
+
};
|
|
47
114
|
type EditorConfig = {
|
|
48
|
-
|
|
49
|
-
matchers
|
|
115
|
+
customRichTextFormats?: CustomRichTextFormat[];
|
|
116
|
+
/** A list of template/post type matchers, and resulting editor config that they will apply */
|
|
117
|
+
matchers?: Matcher[];
|
|
50
118
|
};
|
|
51
119
|
/**
|
|
52
120
|
* This call should be placed in blocks/_editor.tsx
|
|
@@ -56,3 +124,4 @@ export declare function getEditingPostInfo(): PostInfo;
|
|
|
56
124
|
export declare function updateTemplateConfig(): void;
|
|
57
125
|
export declare function watchEditorTemplate(): void;
|
|
58
126
|
export {};
|
|
127
|
+
//# sourceMappingURL=editor-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-config.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/blocks/editor/editor-config.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { proxy } from "valtio";
|
|
2
|
-
import { resolveAcfBlockName, transformBlockTemplate } from "./block-templates";
|
|
2
|
+
import { applyTemplateBlocks, resolveAcfBlockName, transformBlockTemplate, transformTemplateToBlocks, } from "./block-templates.js";
|
|
3
3
|
export const editorConfigStore = proxy({
|
|
4
4
|
config: null,
|
|
5
|
-
currentBlocksConfig:
|
|
5
|
+
currentBlocksConfig: {},
|
|
6
6
|
});
|
|
7
7
|
export function configureEditorBlocks(config) {
|
|
8
8
|
const wp = window.wp;
|
|
@@ -21,60 +21,13 @@ export function configureEditorBlocks(config) {
|
|
|
21
21
|
if (config.template) {
|
|
22
22
|
setTemplate(config.template);
|
|
23
23
|
if (config.headerTemplate || config.footerTemplate) {
|
|
24
|
-
console.error("You cannot use both a template
|
|
24
|
+
console.error("You cannot use both a 'template' alongside 'headerBlock'/'footerBlock'. Did you mean to use 'defaultBlocks' instead?");
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
const currentBlocks = wp.data.select("core/block-editor").getBlocks();
|
|
29
|
-
const
|
|
30
|
-
let blocks = currentBlocks.filter((block) => !block.attributes.isFromTemplate);
|
|
31
|
-
let header = config.headerTemplate ? syncBlocks(transformTemplateToBlocks(config.headerTemplate)) : [];
|
|
32
|
-
let footer = config.footerTemplate ? syncBlocks(transformTemplateToBlocks(config.footerTemplate)) : [];
|
|
33
|
-
if (!blocks.length && config.defaultBlocks) {
|
|
34
|
-
blocks = transformTemplateToBlocks(config.defaultBlocks, false);
|
|
35
|
-
}
|
|
36
|
-
let newBlocks = [...header, ...blocks, ...footer];
|
|
37
|
-
// console.log("Configuring", newBlocks)
|
|
29
|
+
const newBlocks = applyTemplateBlocks(currentBlocks, config);
|
|
38
30
|
wp.data.dispatch("core/block-editor").resetBlocks(newBlocks);
|
|
39
|
-
function syncBlocks(blocks) {
|
|
40
|
-
return blocks.map((block) => {
|
|
41
|
-
const matched = templateBlocks.find((templateBlock) => templateBlock.name === block.name);
|
|
42
|
-
templateBlocks.splice(templateBlocks.indexOf(matched), 1);
|
|
43
|
-
if (matched) {
|
|
44
|
-
matched.attributes.lock = block.attributes.lock;
|
|
45
|
-
return matched;
|
|
46
|
-
}
|
|
47
|
-
return block;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
export function transformTemplateToBlocks(template, locked = true) {
|
|
52
|
-
return template.map(([name, props, children]) => {
|
|
53
|
-
const attributes = {
|
|
54
|
-
data: {},
|
|
55
|
-
inline: {},
|
|
56
|
-
isFromTemplate: true,
|
|
57
|
-
lock: undefined,
|
|
58
|
-
};
|
|
59
|
-
if (props.locked === false) {
|
|
60
|
-
attributes.lock = { move: false, remove: false };
|
|
61
|
-
}
|
|
62
|
-
else if (locked || props.locked === true || props.locked === "all") {
|
|
63
|
-
attributes.lock = { move: true, remove: true };
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
attributes.lock = props.lock;
|
|
67
|
-
}
|
|
68
|
-
Object.assign(attributes, props);
|
|
69
|
-
return {
|
|
70
|
-
clientId: "block-" + Math.random().toString(36),
|
|
71
|
-
name: resolveAcfBlockName(name),
|
|
72
|
-
attributes: attributes,
|
|
73
|
-
innerBlocks: children ? transformTemplateToBlocks(children, false) : [],
|
|
74
|
-
isValid: true,
|
|
75
|
-
validationIssues: [],
|
|
76
|
-
};
|
|
77
|
-
});
|
|
78
31
|
}
|
|
79
32
|
/**
|
|
80
33
|
* This call should be placed in blocks/_editor.tsx
|
|
@@ -92,10 +45,18 @@ export function getEditingPostInfo() {
|
|
|
92
45
|
const postInfo = {
|
|
93
46
|
...post,
|
|
94
47
|
...edits,
|
|
48
|
+
isTemplatePart: false,
|
|
49
|
+
isPattern: false,
|
|
95
50
|
};
|
|
96
51
|
if (!postInfo.template)
|
|
97
52
|
postInfo.template = "default";
|
|
98
53
|
postInfo.template = postInfo.template.replace(/(^views\/|\.tsx?$)/g, "");
|
|
54
|
+
if (postInfo.type === "wp_template_part") {
|
|
55
|
+
postInfo.isTemplatePart = true;
|
|
56
|
+
}
|
|
57
|
+
if (postInfo.type === "wp_block") {
|
|
58
|
+
postInfo.isPattern = true;
|
|
59
|
+
}
|
|
99
60
|
return postInfo;
|
|
100
61
|
}
|
|
101
62
|
export function updateTemplateConfig() {
|
|
@@ -104,7 +65,7 @@ export function updateTemplateConfig() {
|
|
|
104
65
|
const editorConfig = editorConfigStore.config;
|
|
105
66
|
if (!editorConfig)
|
|
106
67
|
return;
|
|
107
|
-
const matched = editorConfig.matchers
|
|
68
|
+
const matched = editorConfig.matchers?.find((matcher) => {
|
|
108
69
|
return matcher.match(postInfo);
|
|
109
70
|
});
|
|
110
71
|
if (matched) {
|
|
@@ -118,17 +79,24 @@ export function updateTemplateConfig() {
|
|
|
118
79
|
}
|
|
119
80
|
}
|
|
120
81
|
export function watchEditorTemplate() {
|
|
121
|
-
let
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
82
|
+
let lastKey = "unknown";
|
|
83
|
+
let timer = 0;
|
|
84
|
+
const update = () => {
|
|
85
|
+
const post = wp.data.select("core/editor").getCurrentPost();
|
|
86
|
+
const template = wp.data.select("core/editor").getPostEdits()?.template ?? post?.template ?? "";
|
|
87
|
+
const key = [post.type, template, post.slug, post.title].join(";");
|
|
88
|
+
if (key !== lastKey) {
|
|
89
|
+
lastKey = key;
|
|
90
|
+
clearTimeout(timer);
|
|
91
|
+
timer = setTimeout(() => {
|
|
128
92
|
updateTemplateConfig();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
93
|
+
}, 20);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
wp.data.subscribe(() => {
|
|
97
|
+
update();
|
|
131
98
|
});
|
|
99
|
+
update();
|
|
132
100
|
}
|
|
133
101
|
function setWrapperBlock(blockName, blocks) {
|
|
134
102
|
const wp = window.wp;
|
|
@@ -174,7 +142,6 @@ function setWrapperBlock(blockName, blocks) {
|
|
|
174
142
|
}
|
|
175
143
|
function setTemplate(template) {
|
|
176
144
|
const wp = window.wp;
|
|
177
|
-
// console.log("Setting template", template)
|
|
178
145
|
let currentBlocks = wp.data.select("core/block-editor").getBlocks();
|
|
179
146
|
wp.data.dispatch("core/block-editor").updateSettings({
|
|
180
147
|
templateLock: "all",
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
export declare const blockMetaDescriptors: Map<string, BlockMeta> & {
|
|
2
|
+
$$valtioSnapshot: Omit<Map<string, BlockMeta>, "set" | "clear" | "delete">;
|
|
3
|
+
};
|
|
1
4
|
export declare function whenEditorIsReady(): Promise<void>;
|
|
2
5
|
export declare function installEDGutenbergHooks(): void;
|
|
6
|
+
//# sourceMappingURL=installGutenbergHooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installGutenbergHooks.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/blocks/editor/installGutenbergHooks.tsx"],"names":[],"mappings":"AA4BA,eAAO,MAAM,oBAAoB;;CAAgC,CAAA;AAEjE,wBAAgB,iBAAiB,kBAsBhC;AAED,wBAAgB,uBAAuB,SA4OtC"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { subscribe, useSnapshot } from "valtio";
|
|
4
|
+
import { proxyMap } from "valtio/utils";
|
|
5
|
+
import { getBlockMetadata } from "../block-utils.js";
|
|
6
|
+
import { registerBuiltinBlocks } from "../builtin-blocks.js";
|
|
7
|
+
import { InlineEditingContextProvider } from "../inline-editing.js";
|
|
8
|
+
import { EditorHighlights } from "./EditorHighlights.js";
|
|
9
|
+
import { BlockContext, EditableBlock } from "./EditorSupport.js";
|
|
10
|
+
import { resolveAcfBlockName } from "./block-templates.js";
|
|
11
|
+
import { blocksByTag } from "./blocks-by-tag.js";
|
|
12
|
+
import { editorConfigStore, getEditingPostInfo, watchEditorTemplate } from "./editor-config.js";
|
|
13
|
+
import { rootBlocks } from "./root-blocks.js";
|
|
9
14
|
function listenForHandleResize() {
|
|
10
15
|
let interval = setInterval(() => {
|
|
11
16
|
let viewportTarget = document.querySelector(".interface-interface-skeleton__content");
|
|
@@ -19,16 +24,28 @@ function listenForHandleResize() {
|
|
|
19
24
|
}
|
|
20
25
|
}, 100);
|
|
21
26
|
}
|
|
27
|
+
export const blockMetaDescriptors = proxyMap();
|
|
22
28
|
export function whenEditorIsReady() {
|
|
23
29
|
return new Promise((resolve) => {
|
|
30
|
+
let ready = false;
|
|
24
31
|
const unsubscribe = wp.data.subscribe(() => {
|
|
25
32
|
// This will trigger after the initial render blocking, before the window load event
|
|
26
33
|
// This seems currently more reliable than using __unstableIsEditorReady
|
|
27
|
-
if (wp.data.select("core/editor").isCleanNewPost() ||
|
|
34
|
+
if (wp.data.select("core/editor").isCleanNewPost(undefined) ||
|
|
35
|
+
wp.data.select("core/block-editor").getBlockCount() > 0) {
|
|
36
|
+
if (ready)
|
|
37
|
+
return;
|
|
38
|
+
ready = true;
|
|
28
39
|
unsubscribe();
|
|
29
40
|
resolve();
|
|
30
41
|
}
|
|
31
42
|
});
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
if (ready)
|
|
45
|
+
return;
|
|
46
|
+
unsubscribe();
|
|
47
|
+
resolve();
|
|
48
|
+
}, 1000);
|
|
32
49
|
});
|
|
33
50
|
}
|
|
34
51
|
export function installEDGutenbergHooks() {
|
|
@@ -40,19 +57,66 @@ export function installEDGutenbergHooks() {
|
|
|
40
57
|
return (props) => {
|
|
41
58
|
const generateClass = useSnapshot(editorConfigStore).currentBlocksConfig?.generateBlockClassName;
|
|
42
59
|
Object.assign(props, getBlockMetadata(props.name));
|
|
60
|
+
props.isRootBlock = !props.rootClientId;
|
|
43
61
|
let className = generateClass ? generateClass(props, getEditingPostInfo()) : "";
|
|
44
62
|
return _jsx(BlockListBlock, { ...props, className: className });
|
|
45
63
|
};
|
|
46
64
|
}, "withClientIdClassName");
|
|
47
65
|
wp.hooks.addFilter("editor.BlockListBlock", "ed", withClientIdClassName);
|
|
66
|
+
// if (wp.blocks) {
|
|
67
|
+
// }
|
|
68
|
+
// Manage custom rich text formats
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
subscribe(editorConfigStore, () => {
|
|
71
|
+
const formats = editorConfigStore.config?.customRichTextFormats;
|
|
72
|
+
if (formats) {
|
|
73
|
+
const activeFormats = wp.data.select("core/rich-text").getFormatTypes();
|
|
74
|
+
formats.forEach((format) => {
|
|
75
|
+
if (activeFormats.some((f) => f.name === format.id)) {
|
|
76
|
+
wp.richText.unregisterFormatType(format.id);
|
|
77
|
+
}
|
|
78
|
+
const EditComponent = (props) => {
|
|
79
|
+
if (format.disabledByDefault) {
|
|
80
|
+
const explicitlyEnabled = props.contentRef.current
|
|
81
|
+
?.getAttribute("data-allowed-formats")
|
|
82
|
+
?.includes(format.id);
|
|
83
|
+
if (!explicitlyEnabled) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return (_jsx(wp.components.Fill, { name: "BlockFormatControls", children: _jsx(wp.components.ToolbarButton, { icon: format.icon, title: format.title, onClick: () => {
|
|
88
|
+
props.onChange(wp.richText.toggleFormat(props.value, {
|
|
89
|
+
type: format.id,
|
|
90
|
+
}));
|
|
91
|
+
}, isActive: props.isActive }) }));
|
|
92
|
+
};
|
|
93
|
+
wp.richText.registerFormatType(format.id, {
|
|
94
|
+
name: format.id,
|
|
95
|
+
title: format.title,
|
|
96
|
+
tagName: format.tagName ?? "span",
|
|
97
|
+
className: format.className,
|
|
98
|
+
interactive: false,
|
|
99
|
+
edit: EditComponent,
|
|
100
|
+
// @ts-ignore
|
|
101
|
+
disabledByDefault: format.disabledByDefault,
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
48
107
|
listenForHandleResize();
|
|
49
108
|
// Remove unwanted formatting options
|
|
50
109
|
// https://developer.wordpress.org/block-editor/how-to-guides/format-api/
|
|
51
|
-
wp.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
110
|
+
const { removeFormatTypes } = wp.data.dispatch("core/rich-text");
|
|
111
|
+
removeFormatTypes("core/image");
|
|
112
|
+
removeFormatTypes("core/language");
|
|
113
|
+
removeFormatTypes("core/keyboard");
|
|
114
|
+
removeFormatTypes("core/text-color");
|
|
115
|
+
whenEditorIsReady().then(() => {
|
|
116
|
+
watchEditorTemplate();
|
|
117
|
+
});
|
|
118
|
+
// Recalculate registered blocks when rootBlocks change
|
|
119
|
+
rootBlocks.listen();
|
|
56
120
|
wp.hooks.addFilter("blocks.registerBlockType", "ed", (item, name) => {
|
|
57
121
|
// Hook into ACF blocks, customising the edit mode.
|
|
58
122
|
if (name.startsWith("acf/")) {
|
|
@@ -63,6 +127,13 @@ export function installEDGutenbergHooks() {
|
|
|
63
127
|
};
|
|
64
128
|
// Add an 'inline' object attribute, which will hold all inline contents
|
|
65
129
|
item.attributes.inline = { type: "object" };
|
|
130
|
+
item.attributes.values = { type: "object" };
|
|
131
|
+
// Add className support to all ACF blocks
|
|
132
|
+
const defaultStyleName = item.styles?.find((s) => s.isDefault)?.name;
|
|
133
|
+
item.attributes.className = {
|
|
134
|
+
type: "string",
|
|
135
|
+
default: item.attributes?.className?.default ?? (defaultStyleName ? "is-style-" + defaultStyleName : undefined),
|
|
136
|
+
};
|
|
66
137
|
item.attributes.isFromTemplate = { type: "boolean" };
|
|
67
138
|
item.supports.customClassName = false;
|
|
68
139
|
item.edit = function (props) {
|
|
@@ -71,17 +142,34 @@ export function installEDGutenbergHooks() {
|
|
|
71
142
|
;
|
|
72
143
|
wp.data.dispatch("core/block-editor").setTemplateValidity(true);
|
|
73
144
|
}, []);
|
|
74
|
-
|
|
75
|
-
const {
|
|
145
|
+
function getIndex() {
|
|
146
|
+
const { getBlockIndex } = wp.data.select("core/block-editor");
|
|
147
|
+
return getBlockIndex(props.clientId);
|
|
148
|
+
}
|
|
149
|
+
function getChildren() {
|
|
150
|
+
const { getBlock, getBlockOrder } = wp.data.select("core/block-editor");
|
|
76
151
|
const innerBlockIDs = getBlockOrder(props.clientId);
|
|
77
152
|
const children = innerBlockIDs.map((id) => {
|
|
78
153
|
return getBlock(id);
|
|
79
154
|
});
|
|
80
155
|
return children;
|
|
81
|
-
}
|
|
82
|
-
|
|
156
|
+
}
|
|
157
|
+
const [index, setIndex] = useState(getIndex);
|
|
158
|
+
const [children, setChildren] = useState(getChildren);
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
return wp.data.subscribe(() => {
|
|
161
|
+
setIndex(getIndex());
|
|
162
|
+
const children = getChildren();
|
|
163
|
+
setChildren((current) => current.length === children.length
|
|
164
|
+
? current.every((item, i) => item === children[i])
|
|
165
|
+
? current
|
|
166
|
+
: children
|
|
167
|
+
: children);
|
|
168
|
+
}, []);
|
|
169
|
+
}, [props.clientId, props.attributes]);
|
|
170
|
+
return (_jsx(BlockContext.Provider, { value: { name, props }, children: _jsx(InlineEditingContextProvider, { values: props.attributes.inline || {}, innerBlocks: children, block: [name, props], index: index ?? -1, onChange: (attrs) => {
|
|
83
171
|
props.setAttributes({ ...props.attributes, inline: attrs });
|
|
84
|
-
}, insertBlocksAfter: props.insertBlocksAfter, children: edit.call(self, props) }) }));
|
|
172
|
+
}, insertBlocksAfter: props.insertBlocksAfter, children: _jsx(EditorHighlights, { enabled: true, clientId: props.clientId, children: edit.call(self, props) }) }) }));
|
|
85
173
|
};
|
|
86
174
|
}
|
|
87
175
|
// Find PHP-defined 'tags' for core blocks.
|
|
@@ -99,24 +187,41 @@ export function installEDGutenbergHooks() {
|
|
|
99
187
|
item.tags = [];
|
|
100
188
|
}
|
|
101
189
|
blocksByTag.add(item.name, item.tags);
|
|
190
|
+
const isRootBlock = rootBlocks.isRootBlock(name, item.tags);
|
|
102
191
|
return {
|
|
103
192
|
...item,
|
|
104
193
|
get parent() {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
194
|
+
if (name === "core/block" || name === "core/slot-group")
|
|
195
|
+
return undefined;
|
|
196
|
+
return blocksByTag.expand([...(item.parent ?? []), ...(isRootBlock ? ["core/post-content"] : [])]);
|
|
197
|
+
},
|
|
198
|
+
get transforms() {
|
|
199
|
+
const result = {
|
|
200
|
+
from: item.transforms?.from ?? [],
|
|
201
|
+
to: item.transforms?.to ?? [],
|
|
202
|
+
ungroup: item.transforms?.ungroup,
|
|
203
|
+
};
|
|
204
|
+
const meta = blockMetaDescriptors.get(resolveAcfBlockName(name, false));
|
|
205
|
+
if (meta?.transforms) {
|
|
206
|
+
result.from = [...(result.from ?? []), ...(meta.transforms.from ?? [])];
|
|
207
|
+
result.to = [...(result.to ?? []), ...(meta.transforms.to ?? [])];
|
|
208
|
+
}
|
|
209
|
+
return result;
|
|
109
210
|
},
|
|
110
211
|
get ancestor() {
|
|
212
|
+
if (name === "core/block" || name === "core/slot-group")
|
|
213
|
+
return undefined;
|
|
111
214
|
return item.ancestor ? blocksByTag.expand(item.ancestor) : undefined;
|
|
112
215
|
},
|
|
113
216
|
get allowedBlocks() {
|
|
114
|
-
return item.allowedBlocks ? blocksByTag.expand(item.allowedBlocks) : undefined;
|
|
217
|
+
return item.allowedBlocks ? [...blocksByTag.expand(item.allowedBlocks), "core/slot-group"] : undefined;
|
|
115
218
|
},
|
|
116
219
|
};
|
|
117
220
|
});
|
|
221
|
+
if (wp.blocks) {
|
|
222
|
+
registerBuiltinBlocks();
|
|
223
|
+
}
|
|
118
224
|
const acf = "acf" in window ? window.acf : {};
|
|
119
|
-
const parseJSX = acf.parseJSX;
|
|
120
225
|
acf.parseJSX = (html) => {
|
|
121
226
|
let payload;
|
|
122
227
|
try {
|
|
@@ -126,6 +231,6 @@ export function installEDGutenbergHooks() {
|
|
|
126
231
|
console.error(err);
|
|
127
232
|
throw new Error("eddev: Error parsing block data from: \n" + html);
|
|
128
233
|
}
|
|
129
|
-
return _jsx(EditableBlock, { payload: payload });
|
|
234
|
+
return _jsx(EditableBlock, { payload: payload ?? {} });
|
|
130
235
|
};
|
|
131
236
|
}
|