eddev 2.0.0-beta.38 → 2.0.0-beta.39
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/ssr-root-client.d.ts +6 -0
- package/dist/app/entry/ssr-root.d.ts +10 -0
- package/dist/app/entry/ssr-root.js +24 -0
- package/dist/app/lib/blocks/EditableText.d.ts +41 -0
- package/dist/app/lib/blocks/EditableText.js +50 -0
- package/dist/app/lib/blocks/InnerBlocks.d.ts +52 -0
- package/dist/app/lib/blocks/InnerBlocks.js +63 -0
- package/dist/app/lib/blocks/defineBlock.d.ts +2 -0
- package/dist/app/lib/blocks/defineBlock.js +3 -0
- package/dist/app/lib/blocks/editor/controls.d.ts +10 -0
- package/dist/app/lib/blocks/editor/controls.js +20 -0
- package/dist/app/lib/blocks/index.d.ts +9 -0
- package/dist/app/lib/blocks/index.js +9 -0
- package/dist/app/lib/devtools/index.d.ts +1 -0
- package/dist/app/lib/devtools/index.js +1 -0
- package/dist/app/lib/devtools/tailwind.config.d.ts +23 -0
- package/dist/app/lib/devtools/tailwind.config.js +24 -0
- package/dist/app/lib/devtools/useQueryDebug.d.ts +15 -0
- package/dist/app/lib/devtools/useQueryDebug.js +10 -0
- package/dist/app/lib/dynamic/index.d.ts +1 -0
- package/dist/app/lib/dynamic/index.js +1 -0
- package/dist/app/lib/hooks/apiConfig.d.ts +20 -0
- package/dist/app/lib/hooks/apiConfig.js +9 -0
- package/dist/app/lib/hooks/index.d.ts +4 -0
- package/dist/app/lib/hooks/index.js +4 -0
- package/dist/app/lib/hooks/queryUtils.d.ts +49 -0
- package/dist/app/lib/hooks/queryUtils.js +182 -0
- package/dist/app/lib/hooks/useAppData.d.ts +4 -0
- package/dist/app/lib/hooks/useAppData.js +11 -0
- package/dist/app/lib/hooks/useRPC.d.ts +9 -0
- package/dist/app/lib/hooks/useRPC.js +9 -0
- package/dist/app/lib/internal/index.d.ts +4 -0
- package/dist/app/lib/internal/index.js +4 -0
- package/dist/app/lib/internal/internal-store.d.ts +9 -0
- package/dist/app/lib/internal/internal-store.js +7 -0
- package/dist/app/lib/legacy-stitches/createStitches.d.ts +615 -0
- package/dist/app/lib/legacy-stitches/createStitches.js +439 -0
- package/dist/app/lib/legacy-stitches/index.d.ts +1 -0
- package/dist/app/lib/legacy-stitches/index.js +1 -0
- package/dist/app/lib/routing/components/SSRRouter.d.ts +9 -0
- package/dist/app/lib/routing/components/SSRRouter.js +13 -0
- package/dist/app/lib/views/defineView.d.ts +4 -0
- package/dist/app/lib/views/defineView.js +3 -0
- package/dist/app/lib/views/index.d.ts +1 -0
- package/dist/app/lib/views/index.js +1 -0
- package/dist/app/server/defineRouter.d.ts +2 -0
- package/dist/app/server/defineRouter.js +4 -0
- package/dist/app/server/index.d.ts +4 -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.js +105 -0
- package/dist/app/server/render-ssr-page.d.ts +5 -0
- package/dist/app/server/render-ssr-page.js +31 -0
- package/dist/app/server/server-context.d.ts +50 -0
- package/dist/app/server/server-context.js +145 -0
- package/dist/app/server/utils/headers.d.ts +5 -0
- package/dist/app/server/utils/headers.js +28 -0
- package/dist/app/server/utils/replace-host.d.ts +10 -0
- package/dist/app/server/utils/replace-host.js +61 -0
- package/dist/app/utils/wp.d.ts +26 -0
- package/dist/app/utils/wp.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { RouteData, RouteMetaTag } from "../lib/routing/types.js";
|
|
3
|
+
import type { RouteLoader } from "../lib/routing/loader.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,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense } from "react";
|
|
3
|
+
import { QueryClientProvider } from "@tanstack/react-query";
|
|
4
|
+
import { getQueryClient } from "../utils/query-client.js";
|
|
5
|
+
import { SSRRouter } from "../lib/routing/components/SSRRouter.js";
|
|
6
|
+
import { getRouteMeta, normalizeRoute } from "../lib/routing/utils.js";
|
|
7
|
+
import { MetaTags } from "./MetaTags.js";
|
|
8
|
+
export function SSRRoot(props) {
|
|
9
|
+
const loader = props.loader;
|
|
10
|
+
loader.setAppData(props.initialData.appData.data);
|
|
11
|
+
loader.populateRouteData(props.pathname, props.initialData);
|
|
12
|
+
return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx("link", { rel: "icon", href: "/favicon.ico" }), _jsx(MetaTags, { tags: props.metaTags }), props.assets] }), _jsx("body", { children: _jsx(QueryClientProvider, { client: getQueryClient(), children: _jsx(Suspense, { children: _jsx(SSRRouter, { loader: loader, route: normalizeRoute({
|
|
13
|
+
id: "initial",
|
|
14
|
+
component: loader.getRouteComponent(props.initialData.view),
|
|
15
|
+
key: "",
|
|
16
|
+
props: props.initialData.viewData.data,
|
|
17
|
+
view: props.initialData.view,
|
|
18
|
+
search: "",
|
|
19
|
+
pathname: props.pathname,
|
|
20
|
+
query: {},
|
|
21
|
+
hash: "",
|
|
22
|
+
meta: getRouteMeta(props.initialData),
|
|
23
|
+
}) }) }) }) })] }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ElementType } from "react";
|
|
2
|
+
import { InlineValueStore } from "./inline-editing.js";
|
|
3
|
+
export type InlineTextValueStore = InlineValueStore<string>;
|
|
4
|
+
type Props<T extends ElementType> = {
|
|
5
|
+
/** Specify a tag name or React component */
|
|
6
|
+
as?: T;
|
|
7
|
+
/** Prevents this text element from being multi-line */
|
|
8
|
+
disableLineBreaks?: boolean;
|
|
9
|
+
/** Enables the rich text toolbar */
|
|
10
|
+
inlineToolbar?: boolean;
|
|
11
|
+
/** Specify default content to use on the frontend if nothing has been entered */
|
|
12
|
+
defaultValue?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Append a new block when the user hits 'Enter' while editing this text.
|
|
15
|
+
* Specify 'true' to append a new paragraph block, or a string to specify a different block type.
|
|
16
|
+
**/
|
|
17
|
+
appendOnEnter?: boolean | string;
|
|
18
|
+
/** An optional placeholder to indicate a typable area */
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
} & {
|
|
21
|
+
/**
|
|
22
|
+
* The 'key' of this editable text value.
|
|
23
|
+
*
|
|
24
|
+
* @deprecated use the `store` prop instead
|
|
25
|
+
**/
|
|
26
|
+
id?: string;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* Instead of an `id`, you can provide a tuple of `[value, setValue]` to store the value elsewhere.
|
|
30
|
+
*
|
|
31
|
+
* This can be combined with `useInlineEditableValue()`, `usePostTitleEditor()` or even `useState()`
|
|
32
|
+
**/
|
|
33
|
+
store: InlineTextValueStore | string;
|
|
34
|
+
} & Omit<React.ComponentPropsWithoutRef<T>, "id"> & MaybeAsProp<React.ComponentPropsWithoutRef<T>>;
|
|
35
|
+
type MaybeAsProp<T> = T extends {
|
|
36
|
+
as?: infer U;
|
|
37
|
+
} ? (U extends unknown ? {} : {
|
|
38
|
+
asProp?: U;
|
|
39
|
+
}) : {};
|
|
40
|
+
export declare function EditableText<T extends ElementType>({ id, as, appendOnEnter, store, ...props }: Props<T>): import("react/jsx-runtime").JSX.Element | null;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRouter } from "../routing/hooks/useRouter.js";
|
|
3
|
+
import { useBlockAppender, useBlockContext, useValueStore } from "./inline-editing.js";
|
|
4
|
+
export function EditableText({ id, as, appendOnEnter, store, ...props }) {
|
|
5
|
+
if (env.admin) {
|
|
6
|
+
const readOnly = useBlockContext()?.readonly;
|
|
7
|
+
if (!readOnly) {
|
|
8
|
+
const [value, setValue] = useValueStore(store ?? id);
|
|
9
|
+
const appendBlocks = useBlockAppender();
|
|
10
|
+
return (_jsx(wp.blockEditor.RichText, { ...props, tagName: as, value: value || "", onChange: setValue, inlineToolbar: props.inlineToolbar, disableLineBreaks: props.disableLineBreaks, onKeyDownCapture: (e) => {
|
|
11
|
+
if (e.key === "Enter" && appendOnEnter && appendBlocks) {
|
|
12
|
+
appendBlocks([
|
|
13
|
+
wp.blocks.createBlock(typeof appendOnEnter === "string" ? appendOnEnter : "core/paragraph"),
|
|
14
|
+
]);
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
e.stopPropagation();
|
|
17
|
+
}
|
|
18
|
+
} }));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
let [value] = useValueStore(store ?? id);
|
|
22
|
+
const handleClickEvent = useRouter((r) => r.handleClickEvent);
|
|
23
|
+
const otherProps = { ...props };
|
|
24
|
+
delete otherProps.inlineToolbar;
|
|
25
|
+
delete otherProps.disableLineBreaks;
|
|
26
|
+
delete otherProps.id;
|
|
27
|
+
otherProps.as = otherProps.asProp ?? undefined;
|
|
28
|
+
delete otherProps.asProp;
|
|
29
|
+
delete otherProps.placeholder;
|
|
30
|
+
if (value === "" || typeof value !== "string") {
|
|
31
|
+
if (props.defaultValue) {
|
|
32
|
+
value = props.defaultValue;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const Element = as || "div";
|
|
39
|
+
return (_jsx(Element, { dangerouslySetInnerHTML: { __html: value },
|
|
40
|
+
/**
|
|
41
|
+
* Allow the router to handle link clicks, passing all clicks to the router.
|
|
42
|
+
* We allow onClick on the current element to occur first, so that preventDefault can be called.
|
|
43
|
+
* The router will filter out clicks where appropriate.
|
|
44
|
+
*/
|
|
45
|
+
onClick: (e) => {
|
|
46
|
+
if (props.onClick)
|
|
47
|
+
props.onClick(e);
|
|
48
|
+
handleClickEvent?.(e);
|
|
49
|
+
}, ...otherProps }));
|
|
50
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { FunctionComponent } from "react";
|
|
2
|
+
import { ContentBlockLayoutProps } from "./ContentBlocks.js";
|
|
3
|
+
import { BlockTemplate } from "./editor/block-templates.js";
|
|
4
|
+
type AppenderConfig = {
|
|
5
|
+
type: "default" | "button" | CustomBlockAppender;
|
|
6
|
+
className?: string;
|
|
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
|
+
};
|
|
18
|
+
type InnerBlocksProps = {
|
|
19
|
+
/** A list of allowed blocks, and/or block tags. */
|
|
20
|
+
allowedBlocks?: (ChildBlockTypeName | BlockTagName)[];
|
|
21
|
+
/** Specify the block list as either horizontal or vertical */
|
|
22
|
+
orientation?: "horizontal" | "vertical";
|
|
23
|
+
/**
|
|
24
|
+
* An optional extra className to apply to the wrapper div, in the Gutenberg editor.
|
|
25
|
+
*
|
|
26
|
+
* NOTE: This will have no effect on the frontend, since no wrapper div is created on the frontend.
|
|
27
|
+
**/
|
|
28
|
+
adminClassName?: string;
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
template?: BlockTemplate;
|
|
33
|
+
/**
|
|
34
|
+
* `false` allows all operations
|
|
35
|
+
* `"all"` prevents all operations. It is not possible to insert new blocks, move existing blocks, or delete blocks
|
|
36
|
+
* `"insert"` prevents inserting or removing blocks, but allows moving existing blocks
|
|
37
|
+
* `"contentOnly"` — prevents all operations, but allows rich text editing. Additionally, the block types that don’t have content are hidden from the list view and can’t gain focus within the block list. Unlike the other lock types, this is not overridable by children.
|
|
38
|
+
*
|
|
39
|
+
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-templates/#locking
|
|
40
|
+
*
|
|
41
|
+
* @default false
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
templateLock?: "all" | "insert" | "contentOnly" | false;
|
|
45
|
+
appender?: AppenderConfig;
|
|
46
|
+
prioritizedInserterBlocks?: ChildBlockTypeName[];
|
|
47
|
+
} & ContentBlockLayoutProps;
|
|
48
|
+
/**
|
|
49
|
+
* Allows child blocks to be added to the current block context.
|
|
50
|
+
*/
|
|
51
|
+
export declare function InnerBlocks(props: InnerBlocksProps): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
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
|
+
const Appender = (props) => {
|
|
7
|
+
const clientId = useBlockContext()?.block[1].clientId;
|
|
8
|
+
if (props.type === "button") {
|
|
9
|
+
return _jsx(wp.blockEditor.ButtonBlockAppender, { className: props.className, rootClientId: clientId });
|
|
10
|
+
}
|
|
11
|
+
else if (typeof props.type === "function") {
|
|
12
|
+
const Type = props.type;
|
|
13
|
+
return (_jsx(wp.blockEditor.Inserter, { renderToggle: (p) => {
|
|
14
|
+
return _jsx(Type, { ...p });
|
|
15
|
+
}, rootClientId: clientId }));
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return (_jsx(wp.blockEditor.DefaultBlockAppender
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
, {
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
className: props.className, rootClientId: clientId, lastBlockClientId: clientId }));
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export function createAppender(comp) {
|
|
26
|
+
return {
|
|
27
|
+
type: comp,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Allows child blocks to be added to the current block context.
|
|
32
|
+
*/
|
|
33
|
+
export function InnerBlocks(props) {
|
|
34
|
+
if (env.admin) {
|
|
35
|
+
const inlineContext = useBlockContext();
|
|
36
|
+
if (!inlineContext?.readonly) {
|
|
37
|
+
const innerBlocksProps = wp.blockEditor.useInnerBlocksProps({}, {
|
|
38
|
+
orientation: props.orientation ?? "vertical",
|
|
39
|
+
allowedBlocks: props.allowedBlocks ? blocksByTag.expand(props.allowedBlocks) : undefined,
|
|
40
|
+
prioritizedInserterBlocks: props.prioritizedInserterBlocks,
|
|
41
|
+
renderAppender: props.appender
|
|
42
|
+
? () => _jsx(Appender, { ...props.appender })
|
|
43
|
+
: wp.blockEditor.InnerBlocks.ButtonBlockAppender,
|
|
44
|
+
templateLock: props.templateLock ?? false,
|
|
45
|
+
template: props.template ? transformBlockTemplate(props.template) : undefined,
|
|
46
|
+
});
|
|
47
|
+
return (_jsx("div", { ...innerBlocksProps, className: [innerBlocksProps.className, props.adminClassName].filter(Boolean).join(" ") }));
|
|
48
|
+
// return (
|
|
49
|
+
// <wp.blockEditor.InnerBlocks
|
|
50
|
+
// // @ts-ignore
|
|
51
|
+
// orientation={props.orientation}
|
|
52
|
+
// prioritizedInserterBlocks={props.prioritizedInserterBlocks}
|
|
53
|
+
// allowedBlocks={props.allowedBlocks ? blocksByTag.expand(props.allowedBlocks) : undefined}
|
|
54
|
+
// renderAppender={props.appender ? () => <Appender {...props.appender!} /> : undefined}
|
|
55
|
+
// templateLock={(props.templateLock as any) ?? false}
|
|
56
|
+
// template={props.template ? transformBlockTemplate(props.template) : undefined}
|
|
57
|
+
// />
|
|
58
|
+
// )
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const blocks = useInnerBlocks();
|
|
62
|
+
return _jsx(ContentBlocks, { blocks: blocks, spacer: props.spacer, wrapBlock: props.wrapBlock });
|
|
63
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Allows you to render arbitrary sidebar content when this block is selected.
|
|
4
|
+
*
|
|
5
|
+
* You can use this in cases where ACF is overkill.
|
|
6
|
+
*
|
|
7
|
+
* @see https://developer.wordpress.org/block-editor/getting-started/fundamentals/block-in-the-editor/#settings-sidebar
|
|
8
|
+
*/
|
|
9
|
+
export declare function InspectorControls(props: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export declare function BlockControls(props: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Allows you to render arbitrary sidebar content when this block is selected.
|
|
4
|
+
*
|
|
5
|
+
* You can use this in cases where ACF is overkill.
|
|
6
|
+
*
|
|
7
|
+
* @see https://developer.wordpress.org/block-editor/getting-started/fundamentals/block-in-the-editor/#settings-sidebar
|
|
8
|
+
*/
|
|
9
|
+
export function InspectorControls(props) {
|
|
10
|
+
if (env.admin) {
|
|
11
|
+
return _jsx(wp.blockEditor.InspectorControls, { children: props.children });
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
export function BlockControls(props) {
|
|
16
|
+
if (env.admin) {
|
|
17
|
+
return _jsx(wp.blockEditor.BlockControls, { controls: undefined, children: props.children });
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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";
|
|
@@ -0,0 +1,9 @@
|
|
|
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";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dev-tools-store.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dev-tools-store.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
darkMode: [];
|
|
3
|
+
important: string;
|
|
4
|
+
content: string[];
|
|
5
|
+
theme: {
|
|
6
|
+
fontFamily: {
|
|
7
|
+
mono: [string, string, string];
|
|
8
|
+
body: [string, string, string];
|
|
9
|
+
};
|
|
10
|
+
fontSize: {
|
|
11
|
+
ui: [string, string];
|
|
12
|
+
};
|
|
13
|
+
extend: {
|
|
14
|
+
height: {
|
|
15
|
+
button: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
corePlugins: {
|
|
20
|
+
preflight: false;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
export default {
|
|
3
|
+
darkMode: [],
|
|
4
|
+
important: ".eddev-ui",
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
content: [__dirname + "/**/*.{js,jsx,ts,tsx}"],
|
|
7
|
+
theme: {
|
|
8
|
+
fontFamily: {
|
|
9
|
+
mono: ["Roboto Mono", "menlo", "monospace"],
|
|
10
|
+
body: ["Inter", "Roboto", "sans-serif"],
|
|
11
|
+
},
|
|
12
|
+
fontSize: {
|
|
13
|
+
ui: ["12px", "16px"],
|
|
14
|
+
},
|
|
15
|
+
extend: {
|
|
16
|
+
height: {
|
|
17
|
+
button: "22px",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
corePlugins: {
|
|
22
|
+
preflight: false,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type QueryDebugItem = {
|
|
2
|
+
file: string;
|
|
3
|
+
errors: string[];
|
|
4
|
+
duration: number;
|
|
5
|
+
label: string;
|
|
6
|
+
children: QueryDebugItem[];
|
|
7
|
+
};
|
|
8
|
+
export declare function setQueryDebug(value: QueryDebugItem | undefined): void;
|
|
9
|
+
export declare function useQueryDebugData(): {
|
|
10
|
+
readonly file: string;
|
|
11
|
+
readonly errors: readonly string[];
|
|
12
|
+
readonly duration: number;
|
|
13
|
+
readonly label: string;
|
|
14
|
+
readonly children: readonly any[];
|
|
15
|
+
} | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { dynamic, DynamicComponent } from "./dynamic.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { dynamic } from "./dynamic.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type APIConfigStore = {
|
|
2
|
+
/**
|
|
3
|
+
* Any value, which will be used as part of the cache key for each query.
|
|
4
|
+
*
|
|
5
|
+
* Changing this value at runtime will invalidate any cached queries, and re-execute them if needed.
|
|
6
|
+
**/
|
|
7
|
+
customQueryKey?: any;
|
|
8
|
+
/**
|
|
9
|
+
* Allows you to override the fetch options used when calling a query or mutation.
|
|
10
|
+
* This can be used for adding things like Authorization headers to every (or certain) requests.
|
|
11
|
+
*/
|
|
12
|
+
customQueryFetchOptions?: (type: "query" | "mutation", queryName: string, queryArgs: any, url: string, opts: RequestInit) => RequestInit | Promise<RequestInit>;
|
|
13
|
+
/**
|
|
14
|
+
* Update aspects of the API client
|
|
15
|
+
*/
|
|
16
|
+
onResponse?: (response: Response) => void;
|
|
17
|
+
set: (config: Partial<APIConfigStore>) => void;
|
|
18
|
+
};
|
|
19
|
+
export declare const apiConfig: APIConfigStore;
|
|
20
|
+
export declare function useAPIConfig(): APIConfigStore;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { FetchQueryOptions, UndefinedInitialDataInfiniteOptions, UndefinedInitialDataOptions, UseInfiniteQueryResult, UseMutationOptions, UseMutationResult, UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
type OptionalMaybes<T> = T extends any[] ? T : T extends {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
} ? {
|
|
5
|
+
[K in keyof T]: T[K] extends null ? T[K] | undefined : T[K];
|
|
6
|
+
} : T;
|
|
7
|
+
type MaybeVars = {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
} | undefined;
|
|
10
|
+
export type QueryError = Error & {
|
|
11
|
+
messages: string[];
|
|
12
|
+
statusCode: number;
|
|
13
|
+
};
|
|
14
|
+
/** Regular queries */
|
|
15
|
+
type CreateUseQueryOptions = {
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
export type UseQueryFunction<TData, TVars> = ((args: OptionalMaybes<TVars>, options?: Omit<UndefinedInitialDataOptions<TData, QueryError, TData>, "queryKey" | "queryFn"> & {
|
|
19
|
+
headers?: Record<string, string>;
|
|
20
|
+
}) => UseQueryResult<TData, QueryError>) & {
|
|
21
|
+
fetch: (args: OptionalMaybes<TVars>, options?: Omit<FetchQueryOptions<TData, QueryError, TData>, "queryKey" | "queryFn"> & {
|
|
22
|
+
headers?: Record<string, string>;
|
|
23
|
+
}) => Promise<TData>;
|
|
24
|
+
};
|
|
25
|
+
export declare function createUseQuery<TData extends any, TVars extends MaybeVars>(init: CreateUseQueryOptions): UseQueryFunction<TData, TVars>;
|
|
26
|
+
/** Regular queries */
|
|
27
|
+
type CreateUseInfiniteQueryOptions = {
|
|
28
|
+
name: string;
|
|
29
|
+
defaultLimit: number;
|
|
30
|
+
paths: Record<"nodesPath" | "pageInfoPath" | "endCursorPath" | "hasNextPagePath", string[]>;
|
|
31
|
+
};
|
|
32
|
+
export type UseInfiniteQueryFunction<TData, TVars> = (args: OptionalMaybes<Omit<TVars, "cursor">>, options?: Omit<UndefinedInitialDataInfiniteOptions<TData, QueryError, TData, any[]>, "queryKey" | "queryFn" | "initialData" | "initialPageParam" | "getNextPageParam" | "select"> & {
|
|
33
|
+
headers?: Record<string, string>;
|
|
34
|
+
/** Initial data can be passed in, but should match the original GraphQL query in structure (including nodes/hasNextPage/endCursor) */
|
|
35
|
+
initialData?: any;
|
|
36
|
+
}) => UseInfiniteQueryResult<{
|
|
37
|
+
nodes: TData;
|
|
38
|
+
total?: number | null;
|
|
39
|
+
}, QueryError>;
|
|
40
|
+
export declare function createUseInfiniteQuery<TData extends any, TVars extends MaybeVars>(init: CreateUseInfiniteQueryOptions): UseInfiniteQueryFunction<TData, TVars>;
|
|
41
|
+
export type UseMutationFunction<TData, TArgs> = ((options?: Omit<UseMutationOptions<TData, QueryError, TArgs>, "mutationFn"> & {
|
|
42
|
+
headers?: Record<string, string>;
|
|
43
|
+
}) => UseMutationResult<TData, QueryError, TArgs>) & {
|
|
44
|
+
mutate: (args: OptionalMaybes<TArgs>, options?: Omit<FetchQueryOptions<TData, QueryError, TData>, "queryKey" | "queryFn"> & {
|
|
45
|
+
headers?: Record<string, string>;
|
|
46
|
+
}) => Promise<TData>;
|
|
47
|
+
};
|
|
48
|
+
export declare function createUseMutation<TData extends any, TArgs extends MaybeVars>(init: CreateUseQueryOptions): UseMutationFunction<TData, TArgs>;
|
|
49
|
+
export {};
|