eddev 2.0.0-beta.137 → 2.0.0-beta.138
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/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 +13 -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 +9 -0
- package/dist/app/entry/ssr-root.d.ts.map +1 -0
- package/dist/app/entry/ssr-root.js +21 -0
- package/dist/app/lib/admin/defineField.d.ts +15 -0
- package/dist/app/lib/admin/defineField.d.ts.map +1 -0
- package/dist/app/lib/admin/defineField.js +3 -0
- package/dist/app/lib/admin/defineWidget.d.ts +11 -0
- package/dist/app/lib/admin/defineWidget.d.ts.map +1 -0
- package/dist/app/lib/admin/defineWidget.js +6 -0
- package/dist/app/lib/admin/index.d.ts +3 -0
- package/dist/app/lib/admin/index.d.ts.map +1 -0
- package/dist/app/lib/admin/index.js +2 -0
- package/dist/app/lib/admin/installFieldTypes.d.ts +2 -0
- package/dist/app/lib/admin/installFieldTypes.d.ts.map +1 -0
- package/dist/app/lib/admin/installFieldTypes.js +94 -0
- package/dist/app/lib/admin/runWidgets.d.ts +2 -0
- package/dist/app/lib/admin/runWidgets.d.ts.map +1 -0
- package/dist/app/lib/admin/runWidgets.js +43 -0
- package/dist/app/lib/blocks/ContentBlocks.d.ts +86 -0
- package/dist/app/lib/blocks/ContentBlocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/ContentBlocks.js +93 -0
- package/dist/app/lib/blocks/EditableText.d.ts +55 -0
- package/dist/app/lib/blocks/EditableText.d.ts.map +1 -0
- package/dist/app/lib/blocks/EditableText.js +57 -0
- package/dist/app/lib/blocks/InnerBlocks.d.ts +57 -0
- package/dist/app/lib/blocks/InnerBlocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/InnerBlocks.js +102 -0
- package/dist/app/lib/blocks/block-utils.d.ts +25 -0
- package/dist/app/lib/blocks/block-utils.d.ts.map +1 -0
- package/dist/app/lib/blocks/block-utils.js +41 -0
- package/dist/app/lib/blocks/defineBlock.d.ts +6 -0
- package/dist/app/lib/blocks/defineBlock.d.ts.map +1 -0
- package/dist/app/lib/blocks/defineBlock.js +12 -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 +6 -0
- package/dist/app/lib/blocks/editor/EditorSupport.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/EditorSupport.js +24 -0
- package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.d.ts +16 -0
- package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.js +28 -0
- package/dist/app/lib/blocks/editor/block-templates.d.ts +10 -0
- package/dist/app/lib/blocks/editor/block-templates.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/block-templates.js +73 -0
- package/dist/app/lib/blocks/editor/blocks-by-tag.d.ts +8 -0
- package/dist/app/lib/blocks/editor/blocks-by-tag.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/blocks-by-tag.js +42 -0
- package/dist/app/lib/blocks/editor/controls.d.ts +11 -0
- package/dist/app/lib/blocks/editor/controls.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/controls.js +20 -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 +122 -0
- package/dist/app/lib/blocks/editor/editor-config.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/editor-config.js +158 -0
- package/dist/app/lib/blocks/editor/installGutenbergHooks.d.ts +6 -0
- package/dist/app/lib/blocks/editor/installGutenbergHooks.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/installGutenbergHooks.js +209 -0
- 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 +38 -0
- package/dist/app/lib/blocks/editor/usePostEditor.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/usePostEditor.js +94 -0
- package/dist/app/lib/blocks/index.d.ts +11 -0
- package/dist/app/lib/blocks/index.d.ts.map +1 -0
- package/dist/app/lib/blocks/index.js +10 -0
- package/dist/app/lib/blocks/inline-editing.d.ts +64 -0
- package/dist/app/lib/blocks/inline-editing.d.ts.map +1 -0
- package/dist/app/lib/blocks/inline-editing.js +124 -0
- package/dist/app/lib/devtools/components/BreakpointIndicator.d.ts +2 -0
- package/dist/app/lib/devtools/components/BreakpointIndicator.d.ts.map +1 -0
- package/dist/app/lib/devtools/components/BreakpointIndicator.js +81 -0
- package/dist/app/lib/devtools/components/DevUI.d.ts +3 -0
- package/dist/app/lib/devtools/components/DevUI.d.ts.map +1 -0
- package/dist/app/lib/devtools/components/DevUI.js +7 -0
- 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 -0
- package/dist/app/lib/devtools/hooks/usePersistState.d.ts.map +1 -0
- package/dist/app/lib/devtools/hooks/usePersistState.js +40 -0
- package/dist/app/lib/devtools/hooks/useTailwind.d.ts +4184 -0
- package/dist/app/lib/devtools/hooks/useTailwind.d.ts.map +1 -0
- package/dist/app/lib/devtools/hooks/useTailwind.js +9 -0
- 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 -0
- package/dist/app/lib/devtools/loader.d.ts +2 -0
- package/dist/app/lib/devtools/loader.d.ts.map +1 -0
- package/dist/app/lib/devtools/loader.js +24 -0
- package/dist/app/lib/devtools/tailwind.config.d.ts +24 -0
- package/dist/app/lib/devtools/tailwind.config.d.ts.map +1 -0
- package/dist/app/lib/devtools/tailwind.config.js +24 -0
- package/dist/app/lib/devtools/useQueryDebug.d.ts +16 -0
- package/dist/app/lib/devtools/useQueryDebug.d.ts.map +1 -0
- package/dist/app/lib/devtools/useQueryDebug.js +10 -0
- package/dist/app/lib/dynamic/index.d.ts +2 -0
- package/dist/app/lib/dynamic/index.d.ts.map +1 -0
- package/dist/app/lib/dynamic/index.js +1 -0
- package/dist/app/lib/hooks/index.d.ts +5 -0
- package/dist/app/lib/hooks/index.d.ts.map +1 -0
- package/dist/app/lib/hooks/index.js +4 -0
- package/dist/app/lib/hooks/queryUtils.d.ts +84 -0
- package/dist/app/lib/hooks/queryUtils.d.ts.map +1 -0
- package/dist/app/lib/hooks/queryUtils.js +220 -0
- package/dist/app/lib/hooks/useAppData.d.ts +5 -0
- package/dist/app/lib/hooks/useAppData.d.ts.map +1 -0
- package/dist/app/lib/hooks/useAppData.js +22 -0
- package/dist/app/lib/hooks/useRPC.d.ts +6 -0
- package/dist/app/lib/hooks/useRPC.d.ts.map +1 -0
- package/dist/app/lib/hooks/useRPC.js +2 -0
- 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 +141 -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 +285 -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 -0
- package/dist/app/lib/internal/index.d.ts.map +1 -0
- package/dist/app/lib/internal/index.js +5 -0
- package/dist/app/lib/internal/internal-store.d.ts +10 -0
- package/dist/app/lib/internal/internal-store.d.ts.map +1 -0
- package/dist/app/lib/internal/internal-store.js +7 -0
- package/dist/app/lib/internal/read-admin-manifest.d.ts +20 -0
- package/dist/app/lib/internal/read-admin-manifest.d.ts.map +1 -0
- package/dist/app/lib/internal/read-admin-manifest.js +17 -0
- package/dist/app/lib/internal/read-block-manifest.d.ts +16 -0
- package/dist/app/lib/internal/read-block-manifest.d.ts.map +1 -0
- package/dist/app/lib/internal/read-block-manifest.js +16 -0
- package/dist/app/lib/legacy-stitches/createStitches.d.ts +616 -0
- package/dist/app/lib/legacy-stitches/createStitches.d.ts.map +1 -0
- package/dist/app/lib/legacy-stitches/createStitches.js +439 -0
- package/dist/app/lib/legacy-stitches/index.d.ts +2 -0
- package/dist/app/lib/legacy-stitches/index.d.ts.map +1 -0
- package/dist/app/lib/legacy-stitches/index.js +1 -0
- 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 +9 -0
- package/dist/app/lib/routing/components/BrowserRouter.d.ts.map +1 -0
- package/dist/app/lib/routing/components/BrowserRouter.js +430 -0
- package/dist/app/lib/routing/components/ClientOnly.d.ts +13 -0
- package/dist/app/lib/routing/components/ClientOnly.d.ts.map +1 -0
- package/dist/app/lib/routing/components/ClientOnly.js +14 -0
- package/dist/app/lib/routing/components/Link.d.ts +28 -0
- package/dist/app/lib/routing/components/Link.d.ts.map +1 -0
- package/dist/app/lib/routing/components/Link.js +92 -0
- package/dist/app/lib/routing/components/RouteRenderer.d.ts +10 -0
- package/dist/app/lib/routing/components/RouteRenderer.d.ts.map +1 -0
- package/dist/app/lib/routing/components/RouteRenderer.js +29 -0
- package/dist/app/lib/routing/components/SSRRouter.d.ts +10 -0
- package/dist/app/lib/routing/components/SSRRouter.d.ts.map +1 -0
- package/dist/app/lib/routing/components/SSRRouter.js +13 -0
- package/dist/app/lib/routing/components/ScrollRestoration.d.ts +16 -0
- package/dist/app/lib/routing/components/ScrollRestoration.d.ts.map +1 -0
- package/dist/app/lib/routing/components/ScrollRestoration.js +35 -0
- package/dist/app/lib/routing/context.d.ts +9 -0
- package/dist/app/lib/routing/context.d.ts.map +1 -0
- package/dist/app/lib/routing/context.js +46 -0
- package/dist/app/lib/routing/hooks/useIsSSR.d.ts +9 -0
- package/dist/app/lib/routing/hooks/useIsSSR.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useIsSSR.js +22 -0
- package/dist/app/lib/routing/hooks/useRestorableState.d.ts +7 -0
- package/dist/app/lib/routing/hooks/useRestorableState.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRestorableState.js +18 -0
- package/dist/app/lib/routing/hooks/useRoute.d.ts +18 -0
- package/dist/app/lib/routing/hooks/useRoute.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRoute.js +26 -0
- 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 +5 -0
- package/dist/app/lib/routing/hooks/useRouteTransition.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouteTransition.js +12 -0
- package/dist/app/lib/routing/hooks/useRouter.d.ts +3 -0
- package/dist/app/lib/routing/hooks/useRouter.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouter.js +11 -0
- package/dist/app/lib/routing/hooks/useRouterEvents.d.ts +3 -0
- package/dist/app/lib/routing/hooks/useRouterEvents.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouterEvents.js +10 -0
- package/dist/app/lib/routing/hooks/useRouterState.d.ts +3 -0
- package/dist/app/lib/routing/hooks/useRouterState.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouterState.js +8 -0
- package/dist/app/lib/routing/hooks/useSearchParams.d.ts +82 -0
- package/dist/app/lib/routing/hooks/useSearchParams.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useSearchParams.js +89 -0
- package/dist/app/lib/routing/index.d.ts +15 -0
- package/dist/app/lib/routing/index.d.ts.map +1 -0
- package/dist/app/lib/routing/index.js +14 -0
- package/dist/app/lib/routing/types.d.ts +179 -0
- package/dist/app/lib/routing/types.d.ts.map +1 -0
- package/dist/app/lib/routing/types.js +1 -0
- package/dist/app/lib/routing/utils.d.ts +19 -0
- package/dist/app/lib/routing/utils.d.ts.map +1 -0
- package/dist/app/lib/runtime/apiConfig.d.ts +23 -0
- 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 +5 -0
- package/dist/app/lib/views/defineView.d.ts.map +1 -0
- package/dist/app/lib/views/defineView.js +3 -0
- package/dist/app/lib/views/index.d.ts +2 -0
- package/dist/app/lib/views/index.d.ts.map +1 -0
- package/dist/app/lib/views/index.js +1 -0
- package/dist/app/server/index.d.ts +5 -0
- package/dist/app/server/index.d.ts.map +1 -0
- package/dist/app/server/index.js +4 -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 +135 -0
- package/dist/app/server/render-ssr-page.d.ts +27 -0
- package/dist/app/server/render-ssr-page.d.ts.map +1 -0
- package/dist/app/server/render-ssr-page.js +224 -0
- package/dist/app/server/rpc.d.ts +57 -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 +78 -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/utils/headers.d.ts +6 -0
- package/dist/app/server/utils/headers.d.ts.map +1 -0
- package/dist/app/server/utils/headers.js +28 -0
- package/dist/app/server/utils/replace-host.d.ts +11 -0
- package/dist/app/server/utils/replace-host.d.ts.map +1 -0
- package/dist/app/server/utils/replace-host.js +69 -0
- 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 +19 -0
- package/dist/app/utils/RouteErrorBoundary.d.ts.map +1 -0
- package/dist/app/utils/RouteErrorBoundary.js +38 -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 +5 -0
- package/dist/app/utils/query-client.d.ts.map +1 -0
- package/dist/app/utils/query-client.js +20 -0
- 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 +27 -0
- package/dist/app/utils/wp.d.ts.map +1 -0
- package/dist/app/utils/wp.js +1 -0
- package/dist/node/cli/version.d.ts +1 -1
- package/dist/node/cli/version.js +1 -1
- package/dist/node/project/config.d.ts +54 -54
- package/dist/node/types/block-type.d.ts +16 -16
- package/dist/node/types/view-type.d.ts +7 -7
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetaTags.d.ts","sourceRoot":"","sources":["../../../src/app/entry/MetaTags.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,YAAY,EAAE,CAAA;CACrB,CAAA;AAiBD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,2CAqBpC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
const REACT_ATTRIBUTES = {
|
|
4
|
+
class: "className",
|
|
5
|
+
"http-equiv": "httpEquiv",
|
|
6
|
+
"accept-charset": "acceptCharset",
|
|
7
|
+
};
|
|
8
|
+
function toReactAttributes(attributes) {
|
|
9
|
+
return Object.fromEntries(Object.entries(attributes).map(([key, value]) => {
|
|
10
|
+
if (key in REACT_ATTRIBUTES)
|
|
11
|
+
key = REACT_ATTRIBUTES[key];
|
|
12
|
+
return [key, value === "" ? true : value];
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
export function MetaTags(props) {
|
|
16
|
+
return useMemo(() => (_jsx(_Fragment, { children: props.tags?.map((tag, i) => {
|
|
17
|
+
const Tag = tag.tagName;
|
|
18
|
+
const tagProps = Array.isArray(tag.attributes) ? {} : toReactAttributes(tag.attributes);
|
|
19
|
+
if (tag.tagName === "title") {
|
|
20
|
+
tagProps.children = tag.inner ?? "";
|
|
21
|
+
}
|
|
22
|
+
else if (tag.tagName === "script" || !!tag.inner) {
|
|
23
|
+
tagProps.dangerouslySetInnerHTML = { __html: tag.inner ?? "" };
|
|
24
|
+
}
|
|
25
|
+
if (tagProps.async === "") {
|
|
26
|
+
tagProps.async = true;
|
|
27
|
+
}
|
|
28
|
+
return _jsx(Tag, { ...tagProps }, i);
|
|
29
|
+
}) })), [props.tags]);
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot-admin.d.ts","sourceRoot":"","sources":["../../../src/app/entry/boot-admin.tsx"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,UAAU,SAAS,SAQhC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { installFieldTypes } from "../lib/admin/installFieldTypes.js";
|
|
2
|
+
import { runWidgets } from "../lib/admin/runWidgets.js";
|
|
3
|
+
import { installEDGutenbergHooks } from "../lib/blocks/editor/installGutenbergHooks.js";
|
|
4
|
+
export default function bootAdmin() {
|
|
5
|
+
if (window.name === "editor-canvas") {
|
|
6
|
+
console.log("Running in the editor canvas");
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
installEDGutenbergHooks();
|
|
10
|
+
installFieldTypes();
|
|
11
|
+
runWidgets();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydration-script.d.ts","sourceRoot":"","sources":["../../../src/app/entry/hydration-script.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { hydrationDebug } from "../utils/hydration-debugger";
|
|
2
|
+
//@ts-nocheck
|
|
3
|
+
// window.addEventListener("error", (event) => {
|
|
4
|
+
// const msg = event.message.toLowerCase()
|
|
5
|
+
// const isHydrationMsg = msg.includes("hydration") || msg.includes("hydrating")
|
|
6
|
+
// if (isHydrationMsg) {
|
|
7
|
+
// hydrationDebug.add({
|
|
8
|
+
// error: event.error,
|
|
9
|
+
// info: null,
|
|
10
|
+
// })
|
|
11
|
+
// }
|
|
12
|
+
// })
|
|
13
|
+
const root = document.getElementById("_app");
|
|
14
|
+
if (root) {
|
|
15
|
+
hydrationDebug.initialHTML = root.innerHTML;
|
|
16
|
+
}
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
window.hydrationDebug = hydrationDebug;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spa-root.d.ts","sourceRoot":"","sources":["../../../src/app/entry/spa-root.tsx"],"names":[],"mappings":"AAIA,wBAAgB,OAAO,4CAOtB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DevUILoader } from "../lib/devtools/loader.js";
|
|
3
|
+
import { BrowserRouter } from "../lib/routing/components/BrowserRouter.js";
|
|
4
|
+
import { APIProvider } from "../utils/APIProvider.js";
|
|
5
|
+
export function SPARoot() {
|
|
6
|
+
return (_jsxs(APIProvider, { children: [_jsx(BrowserRouter, {}), _jsx(DevUILoader, {})] }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { RouteMetaTag } from "../lib/routing/types.js";
|
|
3
|
+
export declare function SSRClientRoot(props: {
|
|
4
|
+
assets: ReactNode;
|
|
5
|
+
metaTags: RouteMetaTag[];
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=ssr-root-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr-root-client.d.ts","sourceRoot":"","sources":["../../../src/app/entry/ssr-root-client.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAiC,MAAM,OAAO,CAAA;AAIhE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAItD,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,2CAYnF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { useSnapshot } from "valtio";
|
|
4
|
+
import { BrowserRouter } from "../lib/routing/components/BrowserRouter.js";
|
|
5
|
+
import { clientMetaTags } from "../lib/routing/context.js";
|
|
6
|
+
import { APIProvider } from "../utils/APIProvider.js";
|
|
7
|
+
import { DevUILoader } from "../lib/devtools/loader.js";
|
|
8
|
+
export function SSRClientRoot(props) {
|
|
9
|
+
return (_jsxs(APIProvider, { children: [_jsx(BrowserRouter, {}), _jsxs(_Fragment, { children: [_jsx(DynamicMetaTags, {}), _jsx(DevUILoader, {})] })] }));
|
|
10
|
+
}
|
|
11
|
+
function DynamicMetaTags() {
|
|
12
|
+
const dynamicTags = useSnapshot(clientMetaTags).tags;
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
dynamicTags?.forEach((tag) => {
|
|
15
|
+
if (tag.tagName === "title") {
|
|
16
|
+
document.title = tag.inner ?? "";
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RouteLoader } from "../lib/routing/loader.js";
|
|
2
|
+
import type { RouteData, RouteMetaTag } from "../lib/routing/types.js";
|
|
3
|
+
export declare function SSRRoot(props: {
|
|
4
|
+
pathname: string;
|
|
5
|
+
initialData: RouteData;
|
|
6
|
+
loader: RouteLoader;
|
|
7
|
+
metaTags: RouteMetaTag[];
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=ssr-root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr-root.d.ts","sourceRoot":"","sources":["../../../src/app/entry/ssr-root.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAKtE,wBAAgB,OAAO,CAAC,KAAK,EAAE;IAC7B,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,SAAS,CAAA;IACtB,MAAM,EAAE,WAAW,CAAA;IACnB,QAAQ,EAAE,YAAY,EAAE,CAAA;CACzB,2CAyBA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SSRRouter } from "../lib/routing/components/SSRRouter.js";
|
|
3
|
+
import { getRouteMeta, normalizeRoute } from "../lib/routing/utils.js";
|
|
4
|
+
import { APIProvider } from "../utils/APIProvider.js";
|
|
5
|
+
export function SSRRoot(props) {
|
|
6
|
+
const loader = props.loader;
|
|
7
|
+
loader.setAppData(props.initialData.appData.data);
|
|
8
|
+
loader.populateRouteData(props.pathname, props.initialData);
|
|
9
|
+
return (_jsxs(APIProvider, { children: [_jsx(SSRRouter, { loader: loader, route: normalizeRoute({
|
|
10
|
+
id: "initial",
|
|
11
|
+
component: loader.getRouteComponent(props.initialData.view),
|
|
12
|
+
key: "",
|
|
13
|
+
props: props.initialData.viewData.data,
|
|
14
|
+
view: props.initialData.view,
|
|
15
|
+
search: "",
|
|
16
|
+
pathname: props.pathname,
|
|
17
|
+
query: {},
|
|
18
|
+
hash: "",
|
|
19
|
+
meta: getRouteMeta(props.initialData),
|
|
20
|
+
}) }), _jsx(_Fragment, {})] }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
export type FieldProps<T> = {
|
|
3
|
+
value: T;
|
|
4
|
+
onChange: (value: T) => void;
|
|
5
|
+
settings: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export type FieldTypeDefinition<T> = {
|
|
10
|
+
render: (props: FieldProps<T>) => ReactElement;
|
|
11
|
+
defaultValue?: T;
|
|
12
|
+
validate?: (value: T) => boolean | string;
|
|
13
|
+
};
|
|
14
|
+
export declare function defineField<T>(args: FieldTypeDefinition<T>): FieldTypeDefinition<T>;
|
|
15
|
+
//# sourceMappingURL=defineField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineField.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/admin/defineField.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAC1B,KAAK,EAAE,CAAC,CAAA;IACR,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;IAC5B,QAAQ,EAAE;QACR,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACnB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI;IACnC,MAAM,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,YAAY,CAAA;IAC9C,YAAY,CAAC,EAAE,CAAC,CAAA;IAChB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,GAAG,MAAM,CAAA;CAC1C,CAAA;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,0BAE1D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentType } from "react";
|
|
2
|
+
type WidgetProps = {
|
|
3
|
+
element: HTMLElement;
|
|
4
|
+
dataset: DOMStringMap;
|
|
5
|
+
};
|
|
6
|
+
export declare function defineWidget(name: string, component: ComponentType<WidgetProps>): {
|
|
7
|
+
name: string;
|
|
8
|
+
component: ComponentType<WidgetProps>;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=defineWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineWidget.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/admin/defineWidget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,aAAa,EAAE,MAAM,OAAO,CAAA;AAEnD,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,WAAW,CAAA;IACpB,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC;;;EAK/E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/admin/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installFieldTypes.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/admin/installFieldTypes.tsx"],"names":[],"mappings":"AAKA,wBAAgB,iBAAiB,SAwChC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import * as ReactDOM from "react-dom/client";
|
|
4
|
+
import { adminManifestReader } from "../internal/read-admin-manifest.js";
|
|
5
|
+
export function installFieldTypes() {
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
const acf = window.acf;
|
|
8
|
+
// Track which fields have been installed
|
|
9
|
+
const fieldInstalled = new Set();
|
|
10
|
+
function installAll() {
|
|
11
|
+
const manifest = adminManifestReader.value;
|
|
12
|
+
for (const name in manifest.fields) {
|
|
13
|
+
if (!fieldInstalled.has(name)) {
|
|
14
|
+
installField(name);
|
|
15
|
+
fieldInstalled.add(name);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// Install all fields, and install any new fields which are added later
|
|
20
|
+
installAll();
|
|
21
|
+
adminManifestReader.subscribe((manifest) => {
|
|
22
|
+
installAll();
|
|
23
|
+
});
|
|
24
|
+
function installField(name) {
|
|
25
|
+
const init = (field) => {
|
|
26
|
+
const { $el, cid, data } = field;
|
|
27
|
+
const input = $el.find("input[type='hidden']");
|
|
28
|
+
const container = document.createElement("div");
|
|
29
|
+
$el.append(container);
|
|
30
|
+
$el.find(".ed-acf-field").remove();
|
|
31
|
+
container.classList.add("ed-acf-field");
|
|
32
|
+
ReactDOM.createRoot(container).render(_jsx(FieldInstance, { field: data, input: input[0], settings: input.data("settings") }));
|
|
33
|
+
};
|
|
34
|
+
// Register with ACF
|
|
35
|
+
acf.addAction("ready_field/type=" + name, init);
|
|
36
|
+
acf.addAction("append_field/type=" + name, init);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* React instance of the field
|
|
41
|
+
*/
|
|
42
|
+
function FieldInstance({ input, field, settings }) {
|
|
43
|
+
const [meta, setMeta] = useState(null);
|
|
44
|
+
const [loadError, setLoadError] = useState(null);
|
|
45
|
+
const [value, setValue] = useState(() => (input.value ? JSON.parse(input.value) : null));
|
|
46
|
+
const [valueChanged, setValueChanged] = useState(false);
|
|
47
|
+
// Load the field type, and reload whenever the admin manifest changes
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
function load() {
|
|
50
|
+
adminManifestReader.value.fields[settings.type]()
|
|
51
|
+
.then((meta) => {
|
|
52
|
+
if (!meta.render) {
|
|
53
|
+
setLoadError({ error: `Field type '${settings.type}' does not have a render method` });
|
|
54
|
+
setMeta(null);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
setMeta(meta);
|
|
58
|
+
if (meta.defaultValue && value === null) {
|
|
59
|
+
setValue(meta.defaultValue);
|
|
60
|
+
setValueChanged(true);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
.catch((err) => {
|
|
65
|
+
setMeta(null);
|
|
66
|
+
setLoadError({ error: err.message });
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
load();
|
|
70
|
+
return adminManifestReader.subscribe(load);
|
|
71
|
+
}, [settings.type]);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
input.value = JSON.stringify(value);
|
|
74
|
+
if (valueChanged) {
|
|
75
|
+
try {
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
window.jQuery(input).change();
|
|
78
|
+
}
|
|
79
|
+
catch (err) { }
|
|
80
|
+
setValueChanged(false);
|
|
81
|
+
}
|
|
82
|
+
}, [value, valueChanged, !!meta]);
|
|
83
|
+
if (loadError) {
|
|
84
|
+
return _jsxs("div", { children: ["Error: ", loadError.error] });
|
|
85
|
+
}
|
|
86
|
+
if (!meta) {
|
|
87
|
+
return _jsx("div", { children: "Loading..." });
|
|
88
|
+
}
|
|
89
|
+
const Component = meta.render;
|
|
90
|
+
return (_jsx(Component, { value: value, onChange: (value) => {
|
|
91
|
+
setValue(value);
|
|
92
|
+
setValueChanged(true);
|
|
93
|
+
}, settings: settings }));
|
|
94
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runWidgets.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/admin/runWidgets.tsx"],"names":[],"mappings":"AAIA,wBAAgB,UAAU,SAiBzB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import * as ReactDOM from "react-dom/client";
|
|
4
|
+
import { adminManifestReader } from "../internal/read-admin-manifest.js";
|
|
5
|
+
export function runWidgets() {
|
|
6
|
+
setTimeout(() => {
|
|
7
|
+
const elements = document.querySelectorAll("[data-widget]");
|
|
8
|
+
elements.forEach((el) => {
|
|
9
|
+
if (el instanceof HTMLElement) {
|
|
10
|
+
const data = el.dataset;
|
|
11
|
+
const name = data["widget"];
|
|
12
|
+
const root = ReactDOM.createRoot(el);
|
|
13
|
+
root.render(_jsx("div", { children: _jsx(WidgetInstance, { widget: name, element: el, dataset: data }) }));
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}, 10);
|
|
17
|
+
}
|
|
18
|
+
function WidgetInstance(props) {
|
|
19
|
+
const [widget, setComponent] = useState(null);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
function loadComponent() {
|
|
22
|
+
if (props.widget in adminManifestReader.value.widgets === false) {
|
|
23
|
+
console.warn(`Unknown widget '${props.widget}', initialized via data-widget="${props.widget}".\n - Did you mean one of: ${JSON.stringify(Object.keys(adminManifestReader.value.widgets))}`);
|
|
24
|
+
setComponent(null);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
adminManifestReader.value.widgets[props.widget]().then((widget) => {
|
|
28
|
+
const Component = widget.component;
|
|
29
|
+
if (Component) {
|
|
30
|
+
setComponent(_jsx(Component, { ...props }));
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
setComponent(null);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
loadComponent();
|
|
38
|
+
return adminManifestReader.subscribe((manifest) => {
|
|
39
|
+
loadComponent();
|
|
40
|
+
});
|
|
41
|
+
}, []);
|
|
42
|
+
return _jsx("div", { children: widget });
|
|
43
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
type TypedContentBlock<TName, TProps> = {
|
|
3
|
+
grouped?: boolean;
|
|
4
|
+
blockName: string;
|
|
5
|
+
slug: TName;
|
|
6
|
+
props: TProps;
|
|
7
|
+
attrs: any;
|
|
8
|
+
innerBlocks: ContentBlock[];
|
|
9
|
+
innerHTML?: string;
|
|
10
|
+
innerContent?: string[];
|
|
11
|
+
rule: string;
|
|
12
|
+
inline: any;
|
|
13
|
+
} & Partial<PublicBlockMeta>;
|
|
14
|
+
/**
|
|
15
|
+
* An instance of a block.
|
|
16
|
+
*/
|
|
17
|
+
export type ContentBlock = {
|
|
18
|
+
[K in keyof BlockProps]: TypedContentBlock<K, BlockProps[K]>;
|
|
19
|
+
}[keyof BlockProps];
|
|
20
|
+
/**
|
|
21
|
+
* Represents a block instance's position in the hierarchy via relationships with other blocks.
|
|
22
|
+
*/
|
|
23
|
+
export type BlocksContext = {
|
|
24
|
+
ancestors: ContentBlock[];
|
|
25
|
+
parent?: ContentBlock;
|
|
26
|
+
prev?: ContentBlock;
|
|
27
|
+
next?: ContentBlock;
|
|
28
|
+
current: ContentBlock;
|
|
29
|
+
readonly?: boolean;
|
|
30
|
+
index: number;
|
|
31
|
+
};
|
|
32
|
+
export declare const BlocksContext: import("react").Context<BlocksContext | undefined>;
|
|
33
|
+
export type ContentBlockLayoutProps = {
|
|
34
|
+
/**
|
|
35
|
+
* Provide a custom wrapping function for each block. eg.
|
|
36
|
+
*
|
|
37
|
+
* ```tsx
|
|
38
|
+
* wrapBlock={(children, ctx) => {
|
|
39
|
+
* return <div data-block-name={ctx.current.blockName}>
|
|
40
|
+
* {children}</div>}
|
|
41
|
+
* </div>
|
|
42
|
+
* }}
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @param children - The React element, which will render the block
|
|
46
|
+
* @param ctx - An object containing information about the current, previous, and next block and parent blocks.
|
|
47
|
+
* @returns Return the `children` parameter, optionally wrapped by another element.
|
|
48
|
+
*/
|
|
49
|
+
wrapBlock?: (children: ReactElement, ctx: BlocksContext) => ReactElement;
|
|
50
|
+
/**
|
|
51
|
+
* Insert a custom spacer between blocks. This is useful for adding spacers or anchor points. eg
|
|
52
|
+
*
|
|
53
|
+
* ```tsx
|
|
54
|
+
* spacer={(ctx) => {
|
|
55
|
+
* if (ctx.next && ctx.prev) {
|
|
56
|
+
* return <div style={{height: "20px"}} />
|
|
57
|
+
* }
|
|
58
|
+
* return null
|
|
59
|
+
* }}
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @param ctx - An object containing information about the current, previous, and next block and parent blocks.
|
|
63
|
+
*/
|
|
64
|
+
spacer?: (ctx: {
|
|
65
|
+
ancestors: ContentBlock[];
|
|
66
|
+
parent?: ContentBlock;
|
|
67
|
+
prev: ContentBlock | null;
|
|
68
|
+
next: ContentBlock | null;
|
|
69
|
+
index: number;
|
|
70
|
+
}) => ReactElement | null;
|
|
71
|
+
};
|
|
72
|
+
type Props = {
|
|
73
|
+
/** Block data to render, obtained from GraphQL */
|
|
74
|
+
blocks?: ContentBlock[];
|
|
75
|
+
} & ContentBlockLayoutProps;
|
|
76
|
+
/**
|
|
77
|
+
* Render a set of Gutenberg blocks
|
|
78
|
+
*/
|
|
79
|
+
export declare const ContentBlocks: import("react").MemoExoticComponent<(props: Props) => import("react/jsx-runtime").JSX.Element | null>;
|
|
80
|
+
type SingleProps = {
|
|
81
|
+
block: ContentBlock;
|
|
82
|
+
index?: number;
|
|
83
|
+
};
|
|
84
|
+
export declare function SingleContentBlock(props: SingleProps): import("react/jsx-runtime").JSX.Element | null;
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=ContentBlocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentBlocks.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/blocks/ContentBlocks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,YAAY,EAA4C,MAAM,OAAO,CAAA;AAM3G,KAAK,iBAAiB,CAAC,KAAK,EAAE,MAAM,IAAI;IACtC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,KAAK,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,GAAG,CAAA;IACV,WAAW,EAAE,YAAY,EAAE,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,GAAG,CAAA;CACZ,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;AAE5B;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;KACxB,CAAC,IAAI,MAAM,UAAU,GAAG,iBAAiB,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;CAC7D,CAAC,MAAM,UAAU,CAAC,CAAA;AAEnB;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,YAAY,EAAE,CAAA;IACzB,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,OAAO,EAAE,YAAY,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,aAAa,oDAAsD,CAAA;AAEhF,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,KAAK,YAAY,CAAA;IACxE;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE;QACb,SAAS,EAAE,YAAY,EAAE,CAAA;QACzB,MAAM,CAAC,EAAE,YAAY,CAAA;QACrB,IAAI,EAAE,YAAY,GAAG,IAAI,CAAA;QACzB,IAAI,EAAE,YAAY,GAAG,IAAI,CAAA;QACzB,KAAK,EAAE,MAAM,CAAA;KACd,KAAK,YAAY,GAAG,IAAI,CAAA;CAC1B,CAAA;AAED,KAAK,KAAK,GAAG;IACX,kDAAkD;IAClD,MAAM,CAAC,EAAE,YAAY,EAAE,CAAA;CACxB,GAAG,uBAAuB,CAAA;AAS3B;;GAEG;AACH,eAAO,MAAM,aAAa,8CAAgB,KAAK,oDA8E7C,CAAA;AAIF,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,YAAY,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,kDAgCpD"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, createContext, memo, useContext, useMemo } from "react";
|
|
3
|
+
import { blockManifestReader } from "../internal/read-block-manifest.js";
|
|
4
|
+
import { BlockErrorBoundary } from "../../utils/BlockErrorBoundary.js";
|
|
5
|
+
import { InlineEditingContextProvider, ReadonlyInlineEditingProvider } from "./inline-editing.js";
|
|
6
|
+
import { addBlockMetadata } from "./block-utils.js";
|
|
7
|
+
export const BlocksContext = createContext(undefined);
|
|
8
|
+
/**
|
|
9
|
+
* Render a set of Gutenberg blocks
|
|
10
|
+
*/
|
|
11
|
+
export const ContentBlocks = memo((props) => {
|
|
12
|
+
const blockData = props.blocks;
|
|
13
|
+
if (!Array.isArray(blockData))
|
|
14
|
+
return null;
|
|
15
|
+
const parentContext = useContext(BlocksContext);
|
|
16
|
+
const blocks = useMemo(() => {
|
|
17
|
+
addBlockMetadata(blockData);
|
|
18
|
+
return blockData.map((block, index) => {
|
|
19
|
+
// Create a context object for the current block
|
|
20
|
+
const ctx = {
|
|
21
|
+
...parentContext,
|
|
22
|
+
ancestors: [...(parentContext?.ancestors || []), parentContext?.current].filter(Boolean),
|
|
23
|
+
parent: parentContext?.current,
|
|
24
|
+
current: block,
|
|
25
|
+
prev: blockData[index - 1],
|
|
26
|
+
next: blockData[index + 1],
|
|
27
|
+
readonly: env.admin,
|
|
28
|
+
index: index,
|
|
29
|
+
};
|
|
30
|
+
// Figure out the
|
|
31
|
+
let blockNode;
|
|
32
|
+
blockNode = _jsx(SingleContentBlock, { block: block, index: index });
|
|
33
|
+
return [ctx, block, blockNode];
|
|
34
|
+
});
|
|
35
|
+
}, [blockData]);
|
|
36
|
+
const layout = useMemo(() => {
|
|
37
|
+
return blocks.filter(Boolean).map(([ctx, block, blockNode], index) => {
|
|
38
|
+
// Exit early if the block is null
|
|
39
|
+
if (blockNode === null)
|
|
40
|
+
return _jsx(Fragment, {}, index);
|
|
41
|
+
// Custom wrap function?
|
|
42
|
+
if (props.wrapBlock) {
|
|
43
|
+
blockNode = props.wrapBlock(blockNode, ctx);
|
|
44
|
+
}
|
|
45
|
+
// Wrap the block in a context provider
|
|
46
|
+
blockNode = _jsx(BlocksContext.Provider, { value: ctx, children: blockNode });
|
|
47
|
+
// Custom spacer function?
|
|
48
|
+
let spaceBefore = null;
|
|
49
|
+
let spaceAfter = null;
|
|
50
|
+
if (props.spacer) {
|
|
51
|
+
// Before block
|
|
52
|
+
spaceBefore = props.spacer({
|
|
53
|
+
...ctx,
|
|
54
|
+
prev: ctx.prev || null,
|
|
55
|
+
next: ctx.current || null,
|
|
56
|
+
});
|
|
57
|
+
// After block (last block only)
|
|
58
|
+
if (index === blockData.length - 1) {
|
|
59
|
+
spaceAfter = props.spacer({
|
|
60
|
+
...ctx,
|
|
61
|
+
prev: block,
|
|
62
|
+
next: null,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Attempt to wrap the block
|
|
67
|
+
return (_jsxs(Fragment, { children: [spaceBefore, _jsx(BlockErrorBoundary, { block: block, blockContext: ctx, children: blockNode }), spaceAfter] }, block.slug + "_" + index));
|
|
68
|
+
});
|
|
69
|
+
}, [blocks, props.wrapBlock, props.spacer]);
|
|
70
|
+
if (env.admin) {
|
|
71
|
+
return _jsx(ReadonlyInlineEditingProvider, { children: layout });
|
|
72
|
+
}
|
|
73
|
+
return _jsx(Fragment, { children: layout });
|
|
74
|
+
});
|
|
75
|
+
ContentBlocks.displayName = "ContentBlocks";
|
|
76
|
+
export function SingleContentBlock(props) {
|
|
77
|
+
const { block } = props;
|
|
78
|
+
const Component = useBlockComponent(block);
|
|
79
|
+
if (!Component) {
|
|
80
|
+
if (block.innerHTML) {
|
|
81
|
+
return _jsx("span", { style: { display: "contents" }, dangerouslySetInnerHTML: { __html: block.innerHTML } });
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return (_jsx(InlineEditingContextProvider, { block: [block.blockName, block.props], values: block.inline, innerBlocks: block.innerBlocks, index: props.index ?? 0, children: _jsx(Component, { ...block.props, innerHTML: block.innerHTML,
|
|
88
|
+
// innerBlocks={block.innerBlocks}
|
|
89
|
+
children: Array.isArray(block.innerBlocks) && block.innerBlocks.length ? (_jsx(ContentBlocks, { blocks: block.innerBlocks })) : null }) }));
|
|
90
|
+
}
|
|
91
|
+
function useBlockComponent(block) {
|
|
92
|
+
return blockManifestReader.value[block.blockName];
|
|
93
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ElementType } from "react";
|
|
2
|
+
import { InlineValueStore } from "./inline-editing.js";
|
|
3
|
+
export type InlineTextValueStore = InlineValueStore<string>;
|
|
4
|
+
type BuiltinFormats = "core/bold" | "core/code" | "core/italic" | "core/link" | "core/strikethrough" | "core/underline" | "core/subscript" | "core/superscript" | "core/unknown" | "core/non-breaking-space" | "core/footnote";
|
|
5
|
+
type Props<T extends ElementType> = {
|
|
6
|
+
/** Specify a tag name or React component */
|
|
7
|
+
as?: T;
|
|
8
|
+
/** Prevents this text element from being multi-line */
|
|
9
|
+
disableLineBreaks?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Specify which formatting options are allowed in this text element (bold, italics etc).
|
|
12
|
+
*
|
|
13
|
+
* By default, all options are enabled.
|
|
14
|
+
*
|
|
15
|
+
* Set to an empty array to disable formatting options.
|
|
16
|
+
*
|
|
17
|
+
* You can register new formats in `_editor.tsx` using the `defineEditorConfig` function.
|
|
18
|
+
**/
|
|
19
|
+
allowedFormats?: (BuiltinFormats | (string & {}))[];
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated use `allowedFormats` instead
|
|
22
|
+
*/
|
|
23
|
+
inlineToolbar?: boolean;
|
|
24
|
+
/** Specify default content to use on the frontend if nothing has been entered */
|
|
25
|
+
defaultValue?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Append a new block when the user hits 'Enter' while editing this text.
|
|
28
|
+
* Specify 'true' to append a new paragraph block, or a string to specify a different block type.
|
|
29
|
+
**/
|
|
30
|
+
appendOnEnter?: boolean | string;
|
|
31
|
+
/** An optional placeholder to indicate a typable area */
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
} & {
|
|
34
|
+
/**
|
|
35
|
+
* The 'key' of this editable text value.
|
|
36
|
+
*
|
|
37
|
+
* @deprecated use the `store` prop instead
|
|
38
|
+
**/
|
|
39
|
+
id?: string;
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* Instead of an `id`, you can provide a tuple of `[value, setValue]` to store the value elsewhere.
|
|
43
|
+
*
|
|
44
|
+
* This can be combined with `useInlineEditableValue()`, `usePostTitleEditor()` or even `useState()`
|
|
45
|
+
**/
|
|
46
|
+
store: InlineTextValueStore | string;
|
|
47
|
+
} & Omit<React.ComponentPropsWithoutRef<T>, "id"> & MaybeAsProp<React.ComponentPropsWithoutRef<T>>;
|
|
48
|
+
type MaybeAsProp<T> = T extends {
|
|
49
|
+
as?: infer U;
|
|
50
|
+
} ? (U extends unknown ? {} : {
|
|
51
|
+
asProp?: U;
|
|
52
|
+
}) : {};
|
|
53
|
+
export declare function EditableText<T extends ElementType>({ id, as, appendOnEnter, store, ...props }: Props<T>): import("react/jsx-runtime").JSX.Element | null;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=EditableText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditableText.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/blocks/EditableText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,OAAO,CAAA;AAE/C,OAAO,EAAE,gBAAgB,EAAoD,MAAM,qBAAqB,CAAA;AAExG,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAA;AAE3D,KAAK,cAAc,GACf,WAAW,GACX,WAAW,GACX,aAAa,GACb,WAAW,GACX,oBAAoB,GACpB,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,cAAc,GACd,yBAAyB,GACzB,eAAe,CAAA;AAEnB,KAAK,KAAK,CAAC,CAAC,SAAS,WAAW,IAAI;IAClC,4CAA4C;IAC5C,EAAE,CAAC,EAAE,CAAC,CAAA;IACN,uDAAuD;IACvD,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B;;;;;;;;QAQI;IACJ,cAAc,CAAC,EAAE,CAAC,cAAc,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,EAAE,CAAA;IACnD;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,iFAAiF;IACjF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;QAGI;IACJ,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAChC,yDAAyD;IACzD,WAAW,CAAC,EAAE,MAAM,CAAA;CAErB,GAAG;IACF;;;;QAII;IACJ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;;;;QAKI;IACJ,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAAA;CACrC,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAC/C,WAAW,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAA;AAEhD,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,CAAC,CAAC,SAAS,OAAO,GAAG,EAAE,GAAG;IAAE,MAAM,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC,GAAG,EAAE,CAAA;AAEjG,wBAAgB,YAAY,CAAC,CAAC,SAAS,WAAW,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,kDA0EvG"}
|