eddev 2.0.0-beta.6 → 2.0.0-beta.61
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 +7 -0
- package/dist/app/entry/MetaTags.js +17 -0
- package/dist/app/entry/boot-admin.d.ts +1 -0
- package/dist/app/entry/boot-admin.js +14 -0
- package/dist/app/entry/spa-root.d.ts +1 -0
- package/dist/app/entry/spa-root.js +8 -0
- package/dist/app/entry/ssr-root-client.d.ts +6 -0
- package/dist/app/entry/ssr-root-client.js +26 -0
- package/dist/app/entry/ssr-root.d.ts +10 -0
- package/dist/app/entry/ssr-root.js +23 -0
- package/dist/app/lib/admin/index.d.ts +2 -2
- package/dist/app/lib/admin/index.js +2 -2
- package/dist/app/lib/admin/installFieldTypes.js +1 -1
- package/dist/app/lib/admin/runWidgets.js +1 -1
- package/dist/app/lib/blocks/ContentBlocks.d.ts +1 -1
- package/dist/app/lib/blocks/ContentBlocks.js +5 -5
- package/dist/app/lib/blocks/EditableText.d.ts +1 -1
- package/dist/app/lib/blocks/EditableText.js +3 -3
- package/dist/app/lib/blocks/InnerBlocks.d.ts +13 -3
- package/dist/app/lib/blocks/InnerBlocks.js +13 -5
- package/dist/app/lib/blocks/block-utils.d.ts +2 -2
- package/dist/app/lib/blocks/block-utils.js +2 -2
- package/dist/app/lib/blocks/editor/EditorSupport.js +4 -5
- package/dist/app/lib/blocks/editor/editor-config.d.ts +16 -3
- package/dist/app/lib/blocks/editor/editor-config.js +2 -4
- package/dist/app/lib/blocks/editor/installGutenbergHooks.js +17 -13
- package/dist/app/lib/blocks/editor/root-blocks.d.ts +6 -0
- package/dist/app/lib/blocks/editor/root-blocks.js +30 -0
- package/dist/app/lib/blocks/editor/usePostEditor.d.ts +1 -1
- package/dist/app/lib/blocks/index.d.ts +9 -9
- package/dist/app/lib/blocks/index.js +9 -9
- package/dist/app/lib/blocks/inline-editing.d.ts +1 -1
- package/dist/app/lib/blocks/inline-editing.js +7 -5
- package/dist/app/lib/devtools/components/BreakpointIndicator.js +6 -4
- package/dist/app/lib/devtools/components/DevUI.js +4 -3
- package/dist/app/lib/devtools/components/GridIndicator.d.ts +1 -0
- package/dist/app/lib/devtools/components/GridIndicator.js +24 -0
- package/dist/app/lib/devtools/dev-tools-store.d.ts +9 -0
- package/dist/app/lib/devtools/dev-tools-store.js +8 -0
- package/dist/app/lib/devtools/hooks/usePersistState.d.ts +1 -1
- package/dist/app/lib/devtools/hooks/usePersistState.js +11 -2
- package/dist/app/lib/devtools/hooks/useTailwind.d.ts +1094 -1095
- package/dist/app/lib/devtools/hooks/useTailwind.js +6 -3
- package/dist/app/lib/devtools/index.d.ts +1 -0
- package/dist/app/lib/devtools/index.js +1 -1
- package/dist/app/lib/devtools/loader.js +8 -7
- package/dist/app/lib/devtools/useQueryDebug.d.ts +7 -1
- package/dist/app/lib/devtools/useQueryDebug.js +5 -8
- package/dist/app/lib/dynamic/index.d.ts +1 -1
- package/dist/app/lib/dynamic/index.js +1 -1
- package/dist/app/lib/hooks/index.d.ts +4 -5
- package/dist/app/lib/hooks/index.js +4 -5
- package/dist/app/lib/hooks/queryUtils.d.ts +37 -3
- package/dist/app/lib/hooks/queryUtils.js +63 -26
- package/dist/app/lib/hooks/useAppData.js +1 -1
- package/dist/app/lib/hooks/useRPC.d.ts +0 -4
- package/dist/app/lib/hooks/useRPC.js +1 -8
- package/dist/app/lib/internal/finalize-rpc.d.ts +17 -0
- package/dist/app/lib/internal/finalize-rpc.js +3 -0
- package/dist/app/lib/internal/index.d.ts +5 -4
- package/dist/app/lib/internal/index.js +5 -4
- package/dist/app/lib/internal/internal-store.d.ts +0 -2
- package/dist/app/lib/internal/internal-store.js +1 -3
- package/dist/app/lib/internal/read-admin-manifest.d.ts +1 -1
- package/dist/app/lib/legacy-stitches/createStitches.d.ts +21 -21
- package/dist/app/lib/legacy-stitches/createStitches.js +1 -1
- package/dist/app/lib/legacy-stitches/index.d.ts +1 -1
- package/dist/app/lib/legacy-stitches/index.js +1 -1
- package/dist/app/lib/routing/components/BackButton.d.ts +49 -0
- package/dist/app/lib/routing/components/BackButton.js +47 -0
- package/dist/app/lib/routing/components/BrowserRouter.d.ts +4 -1
- package/dist/app/lib/routing/components/BrowserRouter.js +79 -11
- package/dist/app/lib/routing/components/ClientOnly.js +1 -1
- package/dist/app/lib/routing/components/Link.d.ts +1 -0
- package/dist/app/lib/routing/components/Link.js +9 -10
- package/dist/app/lib/routing/components/RouteRenderer.d.ts +1 -1
- package/dist/app/lib/routing/components/RouteRenderer.js +7 -6
- package/dist/app/lib/routing/components/SSRRouter.d.ts +2 -2
- package/dist/app/lib/routing/components/SSRRouter.js +5 -6
- package/dist/app/lib/routing/components/ScrollRestoration.js +1 -1
- package/dist/app/lib/routing/context.d.ts +8 -5
- package/dist/app/lib/routing/context.js +13 -96
- package/dist/app/lib/routing/hooks/useRestorableState.d.ts +2 -1
- package/dist/app/lib/routing/hooks/useRestorableState.js +2 -1
- package/dist/app/lib/routing/hooks/useRoute.d.ts +16 -1
- package/dist/app/lib/routing/hooks/useRoute.js +22 -1
- package/dist/app/lib/routing/hooks/useRouteMeta.d.ts +5 -0
- package/dist/app/lib/routing/hooks/useRouteMeta.js +9 -0
- package/dist/app/lib/routing/hooks/useRouteTransition.d.ts +1 -1
- package/dist/app/lib/routing/hooks/useRouteTransition.js +1 -1
- package/dist/app/lib/routing/hooks/useRouter.d.ts +1 -1
- package/dist/app/lib/routing/hooks/useRouter.js +1 -1
- package/dist/app/lib/routing/hooks/useRouterEvents.d.ts +1 -1
- package/dist/app/lib/routing/hooks/useRouterEvents.js +1 -1
- package/dist/app/lib/routing/hooks/useRouterState.d.ts +1 -1
- package/dist/app/lib/routing/hooks/useRouterState.js +1 -1
- package/dist/app/lib/routing/hooks/useSearchParams.js +2 -2
- package/dist/app/lib/routing/index.d.ts +14 -13
- package/dist/app/lib/routing/index.js +14 -13
- package/dist/app/lib/routing/loader.d.ts +2 -2
- package/dist/app/lib/routing/loader.js +7 -5
- package/dist/app/lib/routing/types.d.ts +35 -9
- package/dist/app/lib/routing/utils.d.ts +3 -1
- package/dist/app/lib/routing/utils.js +12 -1
- package/dist/app/lib/{hooks → runtime}/apiConfig.d.ts +6 -2
- package/dist/app/lib/runtime/apiConfig.js +6 -0
- package/dist/app/lib/runtime/errorHandling.d.ts +39 -0
- package/dist/app/lib/runtime/errorHandling.js +6 -0
- package/dist/app/lib/runtime/index.d.ts +2 -0
- package/dist/app/lib/runtime/index.js +2 -0
- package/dist/app/lib/views/index.d.ts +1 -1
- package/dist/app/lib/views/index.js +1 -1
- package/dist/app/server/defineRouter.d.ts +2 -0
- package/dist/app/server/defineRouter.js +4 -0
- package/dist/app/server/index.d.ts +5 -0
- package/dist/app/server/index.js +5 -0
- package/dist/app/server/proxy-wp-admin.d.ts +2 -0
- package/dist/app/server/proxy-wp-admin.js +112 -0
- package/dist/app/server/render-ssr-page.d.ts +11 -0
- package/dist/app/server/render-ssr-page.js +100 -0
- package/dist/app/server/rpc.d.ts +56 -0
- package/dist/app/server/rpc.js +18 -0
- package/dist/app/server/server-context.d.ts +53 -0
- package/dist/app/server/server-context.js +149 -0
- package/dist/app/server/utils/headers.d.ts +1 -0
- package/dist/app/server/utils/headers.js +17 -0
- package/dist/app/server/utils/replace-host.d.ts +6 -4
- package/dist/app/server/utils/replace-host.js +58 -11
- package/dist/app/utils/APIProvider.d.ts +2 -0
- package/dist/app/utils/APIProvider.js +5 -0
- package/dist/app/utils/BlockErrorBoundary.d.ts +19 -0
- package/dist/app/utils/BlockErrorBoundary.js +38 -0
- package/dist/app/utils/ErrorMessage.d.ts +5 -0
- package/dist/app/utils/ErrorMessage.js +14 -0
- package/dist/app/utils/RouteErrorBoundary.d.ts +18 -0
- package/dist/app/utils/RouteErrorBoundary.js +38 -0
- package/dist/app/utils/query-client.d.ts +2 -0
- package/dist/app/utils/query-client.js +5 -1
- package/dist/app/utils/trpc-client.d.ts +2 -0
- package/dist/app/utils/trpc-client.js +34 -0
- package/dist/node/cli/cli-worker.d.ts +1 -1
- package/dist/node/cli/cli-worker.js +12 -3
- package/dist/node/cli/cli.js +91 -13
- package/dist/node/cli/display/CLIApp.d.ts +1 -1
- package/dist/node/cli/display/CLIApp.js +4 -7
- package/dist/node/cli/display/components/LogEntries.d.ts +1 -1
- package/dist/node/cli/display/hooks/useStatefulLog.d.ts +1 -1
- package/dist/node/cli/display/tools/CreateBlock.d.ts +1 -1
- package/dist/node/cli/display/tools/cli-tools.d.ts +1 -11
- package/dist/node/cli/display/tools/cli-tools.js +9 -9
- package/dist/node/cli/display/util/colors.d.ts +2 -2
- package/dist/node/cli/version.d.ts +1 -1
- package/dist/node/cli/version.js +1 -1
- package/dist/node/compiler/build-vinxi.d.ts +8 -0
- package/dist/node/compiler/build-vinxi.js +38 -0
- package/dist/node/compiler/bundler.admin.d.ts +2 -2
- package/dist/node/compiler/bundler.admin.js +3 -4
- package/dist/node/compiler/bundler.frontend.d.ts +1 -1
- package/dist/node/compiler/bundler.frontend.js +3 -4
- package/dist/node/compiler/{serverless.dev.d.ts → dev-server.d.ts} +7 -5
- package/dist/node/compiler/dev-server.js +106 -0
- package/dist/node/compiler/get-vite-config.d.ts +19 -0
- package/dist/node/compiler/get-vite-config.js +200 -0
- package/dist/node/compiler/vinxi-app.d.ts +20 -0
- package/dist/node/compiler/vinxi-app.js +186 -0
- package/dist/node/compiler/vinxi-codegen.d.ts +12 -0
- package/dist/node/compiler/vinxi-codegen.js +515 -0
- package/dist/node/graphql/graphql-codegen.d.ts +12 -2
- package/dist/node/graphql/graphql-codegen.js +213 -36
- package/dist/node/graphql/graphql-schema-loader.js +15 -18
- package/dist/node/graphql/plugins/gql-plugin-queries.js +1 -1
- package/dist/node/graphql/query-files-loader.d.ts +3 -0
- package/dist/node/graphql/query-files-loader.js +5 -0
- package/dist/node/project/config.d.ts +31 -37
- package/dist/node/project/config.js +13 -11
- package/dist/node/project/env.d.ts +1 -1
- package/dist/node/project/env.js +1 -1
- package/dist/node/project/manifest/block-manifest.js +3 -2
- package/dist/node/project/manifest/manifest.d.ts +2 -1
- package/dist/node/project/manifest/manifest.js +15 -11
- package/dist/node/project/manifest/routes-manifest.d.ts +20 -0
- package/dist/node/project/manifest/routes-manifest.js +74 -0
- package/dist/node/project/manifest/view-manifest.js +2 -2
- package/dist/node/project/project.d.ts +5 -2
- package/dist/node/project/project.js +21 -20
- package/dist/node/project/wp-info.js +3 -2
- package/dist/node/types/block-type.d.ts +5 -0
- package/dist/node/types/block-type.js +1 -0
- package/dist/node/types/view-type.js +3 -4
- package/dist/node/utils/fs-codegen.d.ts +42 -0
- package/dist/node/utils/fs-codegen.js +98 -0
- package/dist/node/utils/fs.js +2 -0
- package/dist/node/utils/{selfSignedCert.js → self-signed-cert.js} +1 -1
- package/dist/node/utils/{statefulLog.js → stateful-log.js} +1 -1
- package/dist/node/utils/watch-file-tree.d.ts +25 -0
- package/dist/node/utils/{watchFileTree.js → watch-file-tree.js} +12 -5
- package/package.json +39 -32
- package/types.app.d.ts +4 -2
- package/types.app.internal.d.ts +2 -2
- 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.js +0 -222
- 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/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.d.ts → format-zod-error.d.ts} +0 -0
- /package/dist/node/utils/{formatZodError.js → format-zod-error.js} +0 -0
- /package/dist/node/utils/{getRepoInfo.d.ts → get-repo-info.d.ts} +0 -0
- /package/dist/node/utils/{getRepoInfo.js → get-repo-info.js} +0 -0
- /package/dist/node/utils/{highlightCode.d.ts → highlight-code.d.ts} +0 -0
- /package/dist/node/utils/{highlightCode.js → highlight-code.js} +0 -0
- /package/dist/node/utils/{isDeploying.d.ts → is-deploying.d.ts} +0 -0
- /package/dist/node/utils/{isDeploying.js → is-deploying.js} +0 -0
- /package/dist/node/utils/{selfSignedCert.d.ts → self-signed-cert.d.ts} +0 -0
- /package/dist/node/utils/{statefulLog.d.ts → stateful-log.d.ts} +0 -0
- /package/dist/node/utils/{export-extractor.d.ts → ts-export-extractor.d.ts} +0 -0
- /package/dist/node/utils/{export-extractor.js → ts-export-extractor.js} +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
export function MetaTags(props) {
|
|
3
|
+
return (_jsx(_Fragment, { children: props.tags?.map((tag, i) => {
|
|
4
|
+
const Tag = tag.tagName;
|
|
5
|
+
const tagProps = Array.isArray(tag.attributes) ? {} : { ...tag.attributes };
|
|
6
|
+
if (tag.tagName === "title") {
|
|
7
|
+
tagProps.children = tag.inner ?? "";
|
|
8
|
+
}
|
|
9
|
+
else if (tag.tagName === "script" || !!tag.inner) {
|
|
10
|
+
tagProps.dangerouslySetInnerHTML = { __html: tag.inner ?? "" };
|
|
11
|
+
}
|
|
12
|
+
if (tagProps.async === "") {
|
|
13
|
+
tagProps.async = true;
|
|
14
|
+
}
|
|
15
|
+
return _jsx(Tag, { ...tagProps }, i);
|
|
16
|
+
}) }));
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function bootAdmin(): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
console.log("Booting admin");
|
|
6
|
+
if (window.name === "editor-canvas") {
|
|
7
|
+
console.log("In canvas");
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
installEDGutenbergHooks();
|
|
11
|
+
installFieldTypes();
|
|
12
|
+
runWidgets();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SPARoot(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense } from "react";
|
|
3
|
+
import { DevUILoader } from "../lib/devtools/loader.js";
|
|
4
|
+
import { BrowserRouter } from "../lib/routing/components/BrowserRouter.js";
|
|
5
|
+
import { APIProvider } from "../utils/APIProvider.js";
|
|
6
|
+
export function SPARoot() {
|
|
7
|
+
return (_jsxs(APIProvider, { children: [_jsx(Suspense, { children: _jsx(BrowserRouter, {}) }), _jsx(DevUILoader, {})] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense, useEffect, useState } from "react";
|
|
3
|
+
import { useSnapshot } from "valtio";
|
|
4
|
+
import { DevUILoader } from "../lib/devtools/loader.js";
|
|
5
|
+
import { BrowserRouter } from "../lib/routing/components/BrowserRouter.js";
|
|
6
|
+
import { clientMetaTags } from "../lib/routing/context.js";
|
|
7
|
+
import { APIProvider } from "../utils/APIProvider.js";
|
|
8
|
+
import { MetaTags } from "./MetaTags.js";
|
|
9
|
+
export function SSRClientRoot(props) {
|
|
10
|
+
return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx(DynamicMetaTags, { tags: props.metaTags }), _jsx(Trackers, { position: "head" }), props.assets] }), _jsxs("body", { children: [_jsx(Trackers, { position: "body" }), _jsxs(APIProvider, { children: [_jsx(Suspense, { children: _jsx(BrowserRouter, {}) }), _jsx(DevUILoader, {})] }), _jsx(Trackers, { position: "footer" })] })] }));
|
|
11
|
+
}
|
|
12
|
+
function DynamicMetaTags(props) {
|
|
13
|
+
const dynamicTags = useSnapshot(clientMetaTags).tags;
|
|
14
|
+
return _jsx(MetaTags, { tags: dynamicTags ?? props.tags ?? [] });
|
|
15
|
+
}
|
|
16
|
+
function Trackers(props) {
|
|
17
|
+
const [render, setRender] = useState(false);
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
const trackers = window._TRACKERS;
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
setRender(true);
|
|
22
|
+
}, []);
|
|
23
|
+
if (!render || !trackers || typeof trackers !== "object")
|
|
24
|
+
return null;
|
|
25
|
+
return (_jsx(_Fragment, { children: _jsx(MetaTags, { tags: trackers[props.position] ?? [] }) }));
|
|
26
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { RouteLoader } from "../lib/routing/loader.js";
|
|
3
|
+
import type { RouteData, RouteMetaTag } from "../lib/routing/types.js";
|
|
4
|
+
export declare function SSRRoot(props: {
|
|
5
|
+
pathname: string;
|
|
6
|
+
initialData: RouteData;
|
|
7
|
+
assets: ReactNode;
|
|
8
|
+
loader: RouteLoader;
|
|
9
|
+
metaTags: RouteMetaTag[];
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense } from "react";
|
|
3
|
+
import { SSRRouter } from "../lib/routing/components/SSRRouter.js";
|
|
4
|
+
import { getRouteMeta, normalizeRoute } from "../lib/routing/utils.js";
|
|
5
|
+
import { APIProvider } from "../utils/APIProvider.js";
|
|
6
|
+
import { MetaTags } from "./MetaTags.js";
|
|
7
|
+
export function SSRRoot(props) {
|
|
8
|
+
const loader = props.loader;
|
|
9
|
+
loader.setAppData(props.initialData.appData.data);
|
|
10
|
+
loader.populateRouteData(props.pathname, props.initialData);
|
|
11
|
+
return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx(MetaTags, { tags: props.metaTags }), props.assets] }), _jsx("body", { children: _jsx(APIProvider, { children: _jsx(Suspense, { children: _jsx(SSRRouter, { loader: loader, route: normalizeRoute({
|
|
12
|
+
id: "initial",
|
|
13
|
+
component: loader.getRouteComponent(props.initialData.view),
|
|
14
|
+
key: "",
|
|
15
|
+
props: props.initialData.viewData.data,
|
|
16
|
+
view: props.initialData.view,
|
|
17
|
+
search: "",
|
|
18
|
+
pathname: props.pathname,
|
|
19
|
+
query: {},
|
|
20
|
+
hash: "",
|
|
21
|
+
meta: getRouteMeta(props.initialData),
|
|
22
|
+
}) }) }) }) })] }));
|
|
23
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./defineField";
|
|
2
|
-
export * from "./defineWidget";
|
|
1
|
+
export * from "./defineField.js";
|
|
2
|
+
export * from "./defineWidget.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./defineField";
|
|
2
|
-
export * from "./defineWidget";
|
|
1
|
+
export * from "./defineField.js";
|
|
2
|
+
export * from "./defineWidget.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import * as ReactDOM from "react-dom/client";
|
|
4
|
-
import { adminManifestReader } from "../internal";
|
|
4
|
+
import { adminManifestReader } from "../internal/read-admin-manifest.js";
|
|
5
5
|
export function installFieldTypes() {
|
|
6
6
|
// @ts-ignore
|
|
7
7
|
const acf = window.acf;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import * as ReactDOM from "react-dom/client";
|
|
4
|
-
import { adminManifestReader } from "../internal";
|
|
4
|
+
import { adminManifestReader } from "../internal/read-admin-manifest.js";
|
|
5
5
|
export function runWidgets() {
|
|
6
6
|
const elements = document.querySelectorAll("[data-widget]");
|
|
7
7
|
setTimeout(() => {
|
|
@@ -20,7 +20,7 @@ export type ContentBlock = {
|
|
|
20
20
|
/**
|
|
21
21
|
* Represents a block instance's position in the hierarchy via relationships with other blocks.
|
|
22
22
|
*/
|
|
23
|
-
type BlocksContext = {
|
|
23
|
+
export type BlocksContext = {
|
|
24
24
|
ancestors: ContentBlock[];
|
|
25
25
|
parent?: ContentBlock;
|
|
26
26
|
prev?: ContentBlock;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment, createContext, memo, useContext, useMemo } from "react";
|
|
3
|
-
import { blockManifestReader } from "../internal/read-block-manifest";
|
|
4
|
-
import {
|
|
5
|
-
import { InlineEditingContextProvider, ReadonlyInlineEditingProvider } from "./inline-editing";
|
|
6
|
-
import { addBlockMetadata } from "./block-utils";
|
|
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
7
|
export const BlocksContext = createContext(undefined);
|
|
8
8
|
/**
|
|
9
9
|
* Render a set of Gutenberg blocks
|
|
@@ -63,7 +63,7 @@ export const ContentBlocks = memo((props) => {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
// Attempt to wrap the block
|
|
66
|
-
return (_jsxs(Fragment, { children: [spaceBefore, _jsx(
|
|
66
|
+
return (_jsxs(Fragment, { children: [spaceBefore, _jsx(BlockErrorBoundary, { block: block, blockContext: ctx, children: blockNode }), spaceAfter] }, index));
|
|
67
67
|
});
|
|
68
68
|
}, [blocks, props.wrapBlock, props.spacer]);
|
|
69
69
|
if (env.admin) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ElementType } from "react";
|
|
2
|
-
import { InlineValueStore } from "./inline-editing";
|
|
2
|
+
import { InlineValueStore } from "./inline-editing.js";
|
|
3
3
|
export type InlineTextValueStore = InlineValueStore<string>;
|
|
4
4
|
type Props<T extends ElementType> = {
|
|
5
5
|
/** Specify a tag name or React component */
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useRouter } from "../routing";
|
|
3
|
-
import { useBlockAppender, useBlockContext, useValueStore } from "./inline-editing";
|
|
2
|
+
import { useRouter } from "../routing/hooks/useRouter.js";
|
|
3
|
+
import { useBlockAppender, useBlockContext, useValueStore } from "./inline-editing.js";
|
|
4
4
|
export function EditableText({ id, as, appendOnEnter, store, ...props }) {
|
|
5
5
|
if (env.admin) {
|
|
6
6
|
const readOnly = useBlockContext()?.readonly;
|
|
7
7
|
if (!readOnly) {
|
|
8
8
|
const [value, setValue] = useValueStore(store ?? id);
|
|
9
9
|
const appendBlocks = useBlockAppender();
|
|
10
|
-
return (_jsx(wp.blockEditor.RichText, { ...props, tagName: as, value: value || "", onChange: setValue, disableLineBreaks: props.disableLineBreaks, onKeyDownCapture: (e) => {
|
|
10
|
+
return (_jsx(wp.blockEditor.RichText, { ...props, tagName: as, value: value || "", onChange: setValue, inlineToolbar: props.inlineToolbar, disableLineBreaks: props.disableLineBreaks, onKeyDownCapture: (e) => {
|
|
11
11
|
if (e.key === "Enter" && appendOnEnter && appendBlocks) {
|
|
12
12
|
appendBlocks([
|
|
13
13
|
wp.blocks.createBlock(typeof appendOnEnter === "string" ? appendOnEnter : "core/paragraph"),
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { FunctionComponent } from "react";
|
|
2
|
-
import { ContentBlockLayoutProps } from "./ContentBlocks";
|
|
3
|
-
import { BlockTemplate } from "./editor/block-templates";
|
|
2
|
+
import { ContentBlockLayoutProps } from "./ContentBlocks.js";
|
|
3
|
+
import { BlockTemplate } from "./editor/block-templates.js";
|
|
4
4
|
type AppenderConfig = {
|
|
5
|
-
type: "default" | "button" |
|
|
5
|
+
type: "default" | "button" | CustomBlockAppender;
|
|
6
6
|
className?: string;
|
|
7
7
|
};
|
|
8
|
+
export type CustomBlockAppender = FunctionComponent<{
|
|
9
|
+
onToggle: () => void;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
blockTitle: string;
|
|
13
|
+
hasSingleBlockType: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function createAppender(comp: CustomBlockAppender): {
|
|
16
|
+
type: CustomBlockAppender;
|
|
17
|
+
};
|
|
8
18
|
type InnerBlocksProps = {
|
|
9
19
|
/** A list of allowed blocks, and/or block tags. */
|
|
10
20
|
allowedBlocks?: (ChildBlockTypeName | BlockTagName)[];
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ContentBlocks } from "./ContentBlocks";
|
|
3
|
-
import { transformBlockTemplate } from "./editor/block-templates";
|
|
4
|
-
import { blocksByTag } from "./editor/blocks-by-tag";
|
|
5
|
-
import { useBlockContext, useInnerBlocks } from "./inline-editing";
|
|
2
|
+
import { ContentBlocks } from "./ContentBlocks.js";
|
|
3
|
+
import { transformBlockTemplate } from "./editor/block-templates.js";
|
|
4
|
+
import { blocksByTag } from "./editor/blocks-by-tag.js";
|
|
5
|
+
import { useBlockContext, useInnerBlocks } from "./inline-editing.js";
|
|
6
6
|
const Appender = (props) => {
|
|
7
7
|
const clientId = useBlockContext()?.block[1].clientId;
|
|
8
8
|
if (props.type === "button") {
|
|
9
9
|
return _jsx(wp.blockEditor.ButtonBlockAppender, { className: props.className, rootClientId: clientId });
|
|
10
10
|
}
|
|
11
11
|
else if (typeof props.type === "function") {
|
|
12
|
-
|
|
12
|
+
const Type = props.type;
|
|
13
|
+
return (_jsx(wp.blockEditor.Inserter, { renderToggle: (p) => {
|
|
14
|
+
return _jsx(Type, { ...p });
|
|
15
|
+
}, rootClientId: clientId }));
|
|
13
16
|
}
|
|
14
17
|
else {
|
|
15
18
|
return (_jsx(wp.blockEditor.DefaultBlockAppender
|
|
@@ -19,6 +22,11 @@ const Appender = (props) => {
|
|
|
19
22
|
className: props.className, rootClientId: clientId, lastBlockClientId: clientId }));
|
|
20
23
|
}
|
|
21
24
|
};
|
|
25
|
+
export function createAppender(comp) {
|
|
26
|
+
return {
|
|
27
|
+
type: comp,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
22
30
|
/**
|
|
23
31
|
* Allows child blocks to be added to the current block context.
|
|
24
32
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContentBlock } from "./ContentBlocks";
|
|
1
|
+
import { ContentBlock } from "./ContentBlocks.js";
|
|
2
2
|
/**
|
|
3
3
|
* Returns some very basic info about blocks in the project.
|
|
4
4
|
* This is purposely lean, to avoid bloated info.
|
|
@@ -12,7 +12,7 @@ export declare function getPublicBlockInfo(): {
|
|
|
12
12
|
*
|
|
13
13
|
* Note that this function mutates the existing block, adding new properties.
|
|
14
14
|
*/
|
|
15
|
-
export declare function addBlockMetadata(blocks: ContentBlock[]): ContentBlock[];
|
|
15
|
+
export declare function addBlockMetadata(blocks: ContentBlock[] | null | undefined): ContentBlock[];
|
|
16
16
|
export declare function getBlockMetadata(blockName: string): {
|
|
17
17
|
slug: string;
|
|
18
18
|
tags?: undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { blockManifestReader } from "../internal";
|
|
1
|
+
import { blockManifestReader } from "../internal/read-block-manifest.js";
|
|
2
2
|
/**
|
|
3
3
|
* Returns some very basic info about blocks in the project.
|
|
4
4
|
* This is purposely lean, to avoid bloated info.
|
|
@@ -13,7 +13,7 @@ export function getPublicBlockInfo() {
|
|
|
13
13
|
* Note that this function mutates the existing block, adding new properties.
|
|
14
14
|
*/
|
|
15
15
|
export function addBlockMetadata(blocks) {
|
|
16
|
-
const out = blocks;
|
|
16
|
+
const out = (blocks ?? []);
|
|
17
17
|
const infos = getPublicBlockInfo();
|
|
18
18
|
for (let block of out) {
|
|
19
19
|
const info = infos[block.blockName];
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { QueryClientProvider } from "@tanstack/react-query";
|
|
3
2
|
import { createContext, Suspense, useContext } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { ErrorBoundaryEditor } from "./ErrorBoundaryEditor";
|
|
3
|
+
import { blockManifestReader } from "../../internal/read-block-manifest.js";
|
|
4
|
+
import { APIProvider } from "../../../utils/APIProvider.js";
|
|
5
|
+
import { ErrorBoundaryEditor } from "./ErrorBoundaryEditor.js";
|
|
7
6
|
export const BlockContext = createContext(undefined);
|
|
8
7
|
export function EditableBlock({ payload }) {
|
|
9
8
|
const block = useContext(BlockContext);
|
|
@@ -15,5 +14,5 @@ export function EditableBlock({ payload }) {
|
|
|
15
14
|
const BlockComponent = getBlock();
|
|
16
15
|
if (!BlockComponent)
|
|
17
16
|
return _jsx("div", { children: "Unable to load block component" });
|
|
18
|
-
return (_jsx(ErrorBoundaryEditor, { children: _jsx(
|
|
17
|
+
return (_jsx(ErrorBoundaryEditor, { children: _jsx(APIProvider, { children: _jsx(Suspense, { children: _jsx(BlockComponent, { ...payload }) }) }) }));
|
|
19
18
|
}
|
|
@@ -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 */
|
|
@@ -28,7 +41,7 @@ type BlockWrapperClassGenerator = (block: {
|
|
|
28
41
|
}, post: PostInfo) => string | void;
|
|
29
42
|
export declare const editorConfigStore: {
|
|
30
43
|
config: EditorConfig | null;
|
|
31
|
-
currentBlocksConfig: EditorConfigItem
|
|
44
|
+
currentBlocksConfig: EditorConfigItem;
|
|
32
45
|
};
|
|
33
46
|
export declare function configureEditorBlocks(config: EditorConfigItem): void;
|
|
34
47
|
export declare function transformTemplateToBlocks(template: BlockTemplate, locked?: boolean): any;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { proxy } from "valtio";
|
|
2
|
-
import { resolveAcfBlockName, transformBlockTemplate } from "./block-templates";
|
|
2
|
+
import { resolveAcfBlockName, transformBlockTemplate } 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;
|
|
@@ -34,7 +34,6 @@ export function configureEditorBlocks(config) {
|
|
|
34
34
|
blocks = transformTemplateToBlocks(config.defaultBlocks, false);
|
|
35
35
|
}
|
|
36
36
|
let newBlocks = [...header, ...blocks, ...footer];
|
|
37
|
-
// console.log("Configuring", newBlocks)
|
|
38
37
|
wp.data.dispatch("core/block-editor").resetBlocks(newBlocks);
|
|
39
38
|
function syncBlocks(blocks) {
|
|
40
39
|
return blocks.map((block) => {
|
|
@@ -174,7 +173,6 @@ function setWrapperBlock(blockName, blocks) {
|
|
|
174
173
|
}
|
|
175
174
|
function setTemplate(template) {
|
|
176
175
|
const wp = window.wp;
|
|
177
|
-
// console.log("Setting template", template)
|
|
178
176
|
let currentBlocks = wp.data.select("core/block-editor").getBlocks();
|
|
179
177
|
wp.data.dispatch("core/block-editor").updateSettings({
|
|
180
178
|
templateLock: "all",
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
|
-
import { InlineEditingContextProvider } from "../inline-editing";
|
|
4
|
-
import { BlockContext, EditableBlock } from "./EditorSupport";
|
|
5
|
-
import { blocksByTag } from "./blocks-by-tag";
|
|
6
|
-
import { editorConfigStore, getEditingPostInfo, watchEditorTemplate } from "./editor-config";
|
|
7
3
|
import { useSnapshot } from "valtio";
|
|
8
|
-
import { getBlockMetadata } from "../block-utils";
|
|
4
|
+
import { getBlockMetadata } from "../block-utils.js";
|
|
5
|
+
import { InlineEditingContextProvider } from "../inline-editing.js";
|
|
6
|
+
import { BlockContext, EditableBlock } from "./EditorSupport.js";
|
|
7
|
+
import { blocksByTag } from "./blocks-by-tag.js";
|
|
8
|
+
import { editorConfigStore, getEditingPostInfo, watchEditorTemplate } from "./editor-config.js";
|
|
9
|
+
import { rootBlocks } from "./root-blocks.js";
|
|
9
10
|
function listenForHandleResize() {
|
|
10
11
|
let interval = setInterval(() => {
|
|
11
12
|
let viewportTarget = document.querySelector(".interface-interface-skeleton__content");
|
|
@@ -53,6 +54,8 @@ export function installEDGutenbergHooks() {
|
|
|
53
54
|
wp.richText.unregisterFormatType("core/keyboard");
|
|
54
55
|
wp.richText.unregisterFormatType("core/text-color");
|
|
55
56
|
whenEditorIsReady().then(() => watchEditorTemplate());
|
|
57
|
+
// Recalculate registered blocks when rootBlocks change
|
|
58
|
+
rootBlocks.listen();
|
|
56
59
|
wp.hooks.addFilter("blocks.registerBlockType", "ed", (item, name) => {
|
|
57
60
|
// Hook into ACF blocks, customising the edit mode.
|
|
58
61
|
if (name.startsWith("acf/")) {
|
|
@@ -71,15 +74,18 @@ export function installEDGutenbergHooks() {
|
|
|
71
74
|
;
|
|
72
75
|
wp.data.dispatch("core/block-editor").setTemplateValidity(true);
|
|
73
76
|
}, []);
|
|
74
|
-
const children = wp.data.useSelect((select) => {
|
|
75
|
-
const { getBlock, getBlockOrder } = select("core/block-editor");
|
|
77
|
+
const { children, index } = wp.data.useSelect((select) => {
|
|
78
|
+
const { getBlock, getBlockOrder, getBlockIndex } = select("core/block-editor");
|
|
76
79
|
const innerBlockIDs = getBlockOrder(props.clientId);
|
|
77
80
|
const children = innerBlockIDs.map((id) => {
|
|
78
81
|
return getBlock(id);
|
|
79
82
|
});
|
|
80
|
-
return
|
|
83
|
+
return {
|
|
84
|
+
children,
|
|
85
|
+
index: getBlockIndex(props.clientId),
|
|
86
|
+
};
|
|
81
87
|
}, []);
|
|
82
|
-
return (_jsx(BlockContext.Provider, { value: { name, props }, children: _jsx(InlineEditingContextProvider, { values: props.attributes.inline || {}, innerBlocks: children, block: [name, props], index: -1, onChange: (attrs) => {
|
|
88
|
+
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
89
|
props.setAttributes({ ...props.attributes, inline: attrs });
|
|
84
90
|
}, insertBlocksAfter: props.insertBlocksAfter, children: edit.call(self, props) }) }));
|
|
85
91
|
};
|
|
@@ -99,13 +105,11 @@ export function installEDGutenbergHooks() {
|
|
|
99
105
|
item.tags = [];
|
|
100
106
|
}
|
|
101
107
|
blocksByTag.add(item.name, item.tags);
|
|
108
|
+
const isRootBlock = rootBlocks.isRootBlock(name, item.tags);
|
|
102
109
|
return {
|
|
103
110
|
...item,
|
|
104
111
|
get parent() {
|
|
105
|
-
return blocksByTag.expand([
|
|
106
|
-
...(item.parent ?? []),
|
|
107
|
-
...(item.tags.includes("root") ? ["core/post-content"] : []),
|
|
108
|
-
]);
|
|
112
|
+
return blocksByTag.expand([...(item.parent ?? []), ...(isRootBlock ? ["core/post-content"] : [])]);
|
|
109
113
|
},
|
|
110
114
|
get ancestor() {
|
|
111
115
|
return item.ancestor ? blocksByTag.expand(item.ancestor) : undefined;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { hash } from "object-code";
|
|
2
|
+
import { subscribe, snapshot } from "valtio";
|
|
3
|
+
import { editorConfigStore } from "./editor-config";
|
|
4
|
+
import { blocksByTag } from "./blocks-by-tag";
|
|
5
|
+
let constraint = ["root"];
|
|
6
|
+
let rootBlockList = new Set(["root"]);
|
|
7
|
+
export const rootBlocks = {
|
|
8
|
+
listen() {
|
|
9
|
+
let key = hash(rootBlocks);
|
|
10
|
+
subscribe(editorConfigStore, () => {
|
|
11
|
+
constraint = snapshot(editorConfigStore.currentBlocksConfig).rootBlocks ?? ["root"];
|
|
12
|
+
let newKey = hash(constraint);
|
|
13
|
+
if (key === newKey)
|
|
14
|
+
return;
|
|
15
|
+
// The root blocks config have changed, so we need to recalculate the registered blocks
|
|
16
|
+
key = newKey;
|
|
17
|
+
rootBlocks.update();
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
update() {
|
|
21
|
+
rootBlockList = new Set(blocksByTag.expand(constraint));
|
|
22
|
+
wp.data.dispatch("core/blocks").reapplyBlockTypeFilters();
|
|
23
|
+
},
|
|
24
|
+
getRootBlocks() {
|
|
25
|
+
return rootBlockList;
|
|
26
|
+
},
|
|
27
|
+
isRootBlock(blockName, tags) {
|
|
28
|
+
return rootBlockList.has(blockName) || (tags && tags.some((tag) => rootBlockList.has(tag)));
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from "./ContentBlocks";
|
|
2
|
-
export * from "./EditableText";
|
|
3
|
-
export * from "./InnerBlocks";
|
|
4
|
-
export * from "./defineBlock";
|
|
5
|
-
export * from "./editor/controls";
|
|
6
|
-
export * from "./editor/usePostEditor";
|
|
7
|
-
export * from "./block-utils";
|
|
8
|
-
export { defineEditorConfig } from "./editor/editor-config";
|
|
9
|
-
export { useBlockContext, useInlineEditableValue, useInnerBlocks, useTemplate } from "./inline-editing";
|
|
1
|
+
export * from "./ContentBlocks.js";
|
|
2
|
+
export * from "./EditableText.js";
|
|
3
|
+
export * from "./InnerBlocks.js";
|
|
4
|
+
export * from "./defineBlock.js";
|
|
5
|
+
export * from "./editor/controls.js";
|
|
6
|
+
export * from "./editor/usePostEditor.js";
|
|
7
|
+
export * from "./block-utils.js";
|
|
8
|
+
export { defineEditorConfig } from "./editor/editor-config.js";
|
|
9
|
+
export { useBlockContext, useInlineEditableValue, useInnerBlocks, useTemplate } from "./inline-editing.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from "./ContentBlocks";
|
|
2
|
-
export * from "./EditableText";
|
|
3
|
-
export * from "./InnerBlocks";
|
|
4
|
-
export * from "./defineBlock";
|
|
5
|
-
export * from "./editor/controls";
|
|
6
|
-
export * from "./editor/usePostEditor";
|
|
7
|
-
export * from "./block-utils";
|
|
8
|
-
export { defineEditorConfig } from "./editor/editor-config";
|
|
9
|
-
export { useBlockContext, useInlineEditableValue, useInnerBlocks, useTemplate } from "./inline-editing";
|
|
1
|
+
export * from "./ContentBlocks.js";
|
|
2
|
+
export * from "./EditableText.js";
|
|
3
|
+
export * from "./InnerBlocks.js";
|
|
4
|
+
export * from "./defineBlock.js";
|
|
5
|
+
export * from "./editor/controls.js";
|
|
6
|
+
export * from "./editor/usePostEditor.js";
|
|
7
|
+
export * from "./block-utils.js";
|
|
8
|
+
export { defineEditorConfig } from "./editor/editor-config.js";
|
|
9
|
+
export { useBlockContext, useInlineEditableValue, useInnerBlocks, useTemplate } from "./inline-editing.js";
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext } from "react";
|
|
3
|
-
import { usePostEditor } from "./editor/usePostEditor";
|
|
4
|
-
import { useRoute } from "../routing";
|
|
5
|
-
import { addBlockMetadata } from "./block-utils";
|
|
2
|
+
import { createContext, useContext, useMemo } from "react";
|
|
3
|
+
import { usePostEditor } from "./editor/usePostEditor.js";
|
|
4
|
+
import { useRoute } from "../routing/index.js";
|
|
5
|
+
import { addBlockMetadata } from "./block-utils.js";
|
|
6
6
|
const InlineEditingContext = createContext(undefined);
|
|
7
7
|
export function InlineEditingContextProvider(props) {
|
|
8
8
|
const parentContext = useContext(InlineEditingContext);
|
|
9
|
-
|
|
9
|
+
useMemo(() => {
|
|
10
|
+
addBlockMetadata(props.innerBlocks ?? []);
|
|
11
|
+
}, [props.innerBlocks]);
|
|
10
12
|
return (_jsx(InlineEditingContext.Provider, { value: {
|
|
11
13
|
values: props.values,
|
|
12
14
|
innerBlocks: props.innerBlocks,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
-
import { useTailwindConfig } from "../hooks/useTailwind.js";
|
|
4
3
|
import { usePersistState } from "../hooks/usePersistState.js";
|
|
4
|
+
import { useTailwindConfig } from "../hooks/useTailwind.js";
|
|
5
5
|
function parseBreakpointMin(breakpoint) {
|
|
6
6
|
return parseInt(breakpoint);
|
|
7
7
|
}
|
|
@@ -48,9 +48,10 @@ export function BreakpointIndicator() {
|
|
|
48
48
|
...screen,
|
|
49
49
|
max: arr[i + 1] ? arr[i + 1].min - 1 : undefined,
|
|
50
50
|
}));
|
|
51
|
-
}, [tw?.theme?.screens]);
|
|
52
|
-
const maxSize = screens[screens.length - 1].min;
|
|
51
|
+
}, [tw?.theme?.screens, !!tw]);
|
|
53
52
|
useEffect(() => {
|
|
53
|
+
if (!tw)
|
|
54
|
+
return;
|
|
54
55
|
const update = () => {
|
|
55
56
|
setWidth(window.innerWidth);
|
|
56
57
|
setActiveSize(screens.findLastIndex((screen) => window.innerWidth >= screen.min));
|
|
@@ -58,7 +59,8 @@ export function BreakpointIndicator() {
|
|
|
58
59
|
update();
|
|
59
60
|
window.addEventListener("resize", update);
|
|
60
61
|
return () => window.removeEventListener("resize", update);
|
|
61
|
-
}, [screens]);
|
|
62
|
+
}, [screens, !!tw]);
|
|
63
|
+
const maxSize = screens[screens.length - 1]?.min;
|
|
62
64
|
const screen = screens[activeSize];
|
|
63
65
|
const globalProgress = width / maxSize;
|
|
64
66
|
return (_jsx("div", { ref: ref, "data-breakpoint": true, className: "fixed left-2 bottom-2 z-[999999999999999]", onClick: () => setExpanded(!expanded), children: !!screens && !!screen && (_jsx(_Fragment, { children: expanded ? (_jsx("div", { className: "btn w-[400px] bg-black px-2", children: _jsxs("div", { className: "relative w-full h-full cursor-pointer", children: [_jsxs("div", { className: "absolute bottom-[-3px] -translate-x-1/2 -translate-y-1/2 leading-none text-[8px] text-white", style: { left: `calc(min(${globalProgress},1) * 100%)` }, children: ["\u23F6 ", _jsxs("span", { className: globalProgress < 0.85 ? `absolute left-2` : `absolute right-2`, children: [width, "px"] })] }), screens.map((screen, i) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "../../../../../css/devtools.css";
|
|
3
|
-
import { BreakpointIndicator } from "./BreakpointIndicator";
|
|
3
|
+
import { BreakpointIndicator } from "./BreakpointIndicator.js";
|
|
4
|
+
import { GridIndicator } from "./GridIndicator";
|
|
4
5
|
export default function DevUI() {
|
|
5
|
-
return (
|
|
6
|
+
return (_jsxs("div", { className: "eddev-ui", children: [_jsx(BreakpointIndicator, {}), _jsx(GridIndicator, {})] }));
|
|
6
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function GridIndicator(): import("react/jsx-runtime").JSX.Element | null;
|