@uniformdev/canvas-next-rsc 19.214.1-alpha.17 → 19.214.1-alpha.33
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/{UniformComposition-IWWzoI_H.d.mts → UniformComposition-D_HC6rSo.d.mts} +2 -3
- package/dist/{UniformComposition-IWWzoI_H.d.ts → UniformComposition-D_HC6rSo.d.ts} +2 -3
- package/dist/component.d.mts +11 -11
- package/dist/component.d.ts +11 -11
- package/dist/config.js +43 -16
- package/dist/config.mjs +43 -16
- package/dist/handler.js +2 -2
- package/dist/handler.mjs +2 -2
- package/dist/index.d.mts +16 -28
- package/dist/index.d.ts +16 -28
- package/dist/index.esm.js +62 -65
- package/dist/index.js +52 -58
- package/dist/index.mjs +62 -65
- package/package.json +16 -16
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as React$1 from 'react';
|
|
2
|
-
import { ComponentType, ReactNode } from 'react';
|
|
3
1
|
import { ResolvedRouteGetResponse, ComponentInstance } from '@uniformdev/canvas';
|
|
4
2
|
import { PageParameters, ComponentProps, CompositionContext, AppDirectoryServerContext } from '@uniformdev/canvas-next-rsc-shared';
|
|
3
|
+
import React, { ComponentType, ReactNode } from 'react';
|
|
5
4
|
|
|
6
5
|
type UniformStaticCompositionProps = {
|
|
7
6
|
/**
|
|
@@ -57,7 +56,7 @@ type ResolveEmptyPlaceholderResult = {
|
|
|
57
56
|
declare const resolveComposition: (props: Omit<ResolveComponentsOptions, "slotName" | "slotIndex" | "target"> & {
|
|
58
57
|
composition: ComponentInstance;
|
|
59
58
|
compositionContext: CompositionContext;
|
|
60
|
-
}) => React
|
|
59
|
+
}) => React.FunctionComponentElement<{
|
|
61
60
|
children?: ReactNode | undefined;
|
|
62
61
|
}> | null;
|
|
63
62
|
type ResolveComponentsOptions = {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as React$1 from 'react';
|
|
2
|
-
import { ComponentType, ReactNode } from 'react';
|
|
3
1
|
import { ResolvedRouteGetResponse, ComponentInstance } from '@uniformdev/canvas';
|
|
4
2
|
import { PageParameters, ComponentProps, CompositionContext, AppDirectoryServerContext } from '@uniformdev/canvas-next-rsc-shared';
|
|
3
|
+
import React, { ComponentType, ReactNode } from 'react';
|
|
5
4
|
|
|
6
5
|
type UniformStaticCompositionProps = {
|
|
7
6
|
/**
|
|
@@ -57,7 +56,7 @@ type ResolveEmptyPlaceholderResult = {
|
|
|
57
56
|
declare const resolveComposition: (props: Omit<ResolveComponentsOptions, "slotName" | "slotIndex" | "target"> & {
|
|
58
57
|
composition: ComponentInstance;
|
|
59
58
|
compositionContext: CompositionContext;
|
|
60
|
-
}) => React
|
|
59
|
+
}) => React.FunctionComponentElement<{
|
|
61
60
|
children?: ReactNode | undefined;
|
|
62
61
|
}> | null;
|
|
63
62
|
type ResolveComponentsOptions = {
|
package/dist/component.d.mts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ComponentProps, CompositionContext, SlotDefinition } from '@uniformdev/canvas-next-rsc-shared';
|
|
2
2
|
export { ComponentProps, CompositionContext } from '@uniformdev/canvas-next-rsc-shared';
|
|
3
|
-
import
|
|
4
|
-
export { R as ResolveComponentFunction, a as ResolveComponentResult } from './UniformComposition-
|
|
3
|
+
import React, { PropsWithChildren, ReactNode, Key, JSX } from 'react';
|
|
4
|
+
export { R as ResolveComponentFunction, a as ResolveComponentResult } from './UniformComposition-D_HC6rSo.mjs';
|
|
5
5
|
import { ComponentInstance } from '@uniformdev/canvas';
|
|
6
6
|
import { RichTextNode } from '@uniformdev/richtext';
|
|
7
7
|
import { PureUniformTextProps } from '@uniformdev/canvas-react/core';
|
|
8
8
|
export { ClientContextComponent, createClientUniformContext, useInitUniformContext, useUniformContext } from '@uniformdev/canvas-next-rsc-client';
|
|
9
9
|
|
|
10
|
-
declare const DefaultNotImplementedComponent: ({ component }: ComponentProps) =>
|
|
10
|
+
declare const DefaultNotImplementedComponent: ({ component }: ComponentProps) => React.JSX.Element | null;
|
|
11
11
|
|
|
12
12
|
type RichTextComponentProps<TNode extends RichTextNode = RichTextNode> = {
|
|
13
13
|
node: TNode;
|
|
14
14
|
};
|
|
15
|
-
type RichTextRendererComponent<TNode extends RichTextNode = RichTextNode> =
|
|
15
|
+
type RichTextRendererComponent<TNode extends RichTextNode = RichTextNode> = React.ComponentType<PropsWithChildren<RichTextComponentProps<TNode>>>;
|
|
16
16
|
/**
|
|
17
17
|
* Function that maps a Rich Text node instance to its React component to render it.
|
|
18
18
|
* The resolver would commonly inspect the `type` of the component to decide.
|
|
@@ -24,7 +24,7 @@ type UniformRichTextProps = {
|
|
|
24
24
|
* The name of the HTML tag to render.
|
|
25
25
|
* @default "div"
|
|
26
26
|
*/
|
|
27
|
-
as?:
|
|
27
|
+
as?: React.ElementType;
|
|
28
28
|
/** The ID of the parameter. */
|
|
29
29
|
parameterId: string;
|
|
30
30
|
/**
|
|
@@ -43,16 +43,16 @@ type UniformRichTextProps = {
|
|
|
43
43
|
placeholder?: string | ((parameter: {
|
|
44
44
|
id: string;
|
|
45
45
|
}) => string | undefined);
|
|
46
|
-
} & Omit<
|
|
46
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'placeholder'>;
|
|
47
47
|
/**
|
|
48
48
|
* Adds rendering support for Uniform Rich Text parameters
|
|
49
49
|
*/
|
|
50
|
-
declare const UniformRichText:
|
|
50
|
+
declare const UniformRichText: React.ForwardRefExoticComponent<{
|
|
51
51
|
/**
|
|
52
52
|
* The name of the HTML tag to render.
|
|
53
53
|
* @default "div"
|
|
54
54
|
*/
|
|
55
|
-
as?:
|
|
55
|
+
as?: React.ElementType;
|
|
56
56
|
/** The ID of the parameter. */
|
|
57
57
|
parameterId: string;
|
|
58
58
|
/**
|
|
@@ -71,7 +71,7 @@ declare const UniformRichText: React__default.ForwardRefExoticComponent<{
|
|
|
71
71
|
placeholder?: string | ((parameter: {
|
|
72
72
|
id: string;
|
|
73
73
|
}) => string | undefined);
|
|
74
|
-
} & Omit<
|
|
74
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "placeholder"> & React.RefAttributes<unknown>>;
|
|
75
75
|
|
|
76
76
|
type UniformRichTextNodeProps = {
|
|
77
77
|
node: RichTextNode;
|
|
@@ -80,7 +80,7 @@ type UniformRichTextNodeProps = {
|
|
|
80
80
|
/**
|
|
81
81
|
* Render a single RichText node
|
|
82
82
|
*/
|
|
83
|
-
declare function UniformRichTextNode({ node, ...props }: UniformRichTextNodeProps):
|
|
83
|
+
declare function UniformRichTextNode({ node, ...props }: UniformRichTextNodeProps): React.JSX.Element | null;
|
|
84
84
|
|
|
85
85
|
type CustomSlotChildRenderFunc = (options: {
|
|
86
86
|
child: ReactNode;
|
|
@@ -100,6 +100,6 @@ declare const UniformSlot: ({ data, slot, children }: UniformSlotProps) => React
|
|
|
100
100
|
type UniformTextProps = {
|
|
101
101
|
context: Pick<CompositionContext, 'isContextualEditing'>;
|
|
102
102
|
} & Omit<PureUniformTextProps, 'skipCustomRendering' | 'isContextualEditing'>;
|
|
103
|
-
declare const UniformText: ({ context, ...rest }: UniformTextProps) =>
|
|
103
|
+
declare const UniformText: ({ context, ...rest }: UniformTextProps) => React.JSX.Element;
|
|
104
104
|
|
|
105
105
|
export { type CustomSlotChildRenderFunc, DefaultNotImplementedComponent, UniformRichText, UniformRichTextNode, type UniformRichTextNodeProps, type UniformRichTextProps, UniformSlot, type UniformSlotProps, UniformText, type UniformTextProps };
|
package/dist/component.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ComponentProps, CompositionContext, SlotDefinition } from '@uniformdev/canvas-next-rsc-shared';
|
|
2
2
|
export { ComponentProps, CompositionContext } from '@uniformdev/canvas-next-rsc-shared';
|
|
3
|
-
import
|
|
4
|
-
export { R as ResolveComponentFunction, a as ResolveComponentResult } from './UniformComposition-
|
|
3
|
+
import React, { PropsWithChildren, ReactNode, Key, JSX } from 'react';
|
|
4
|
+
export { R as ResolveComponentFunction, a as ResolveComponentResult } from './UniformComposition-D_HC6rSo.js';
|
|
5
5
|
import { ComponentInstance } from '@uniformdev/canvas';
|
|
6
6
|
import { RichTextNode } from '@uniformdev/richtext';
|
|
7
7
|
import { PureUniformTextProps } from '@uniformdev/canvas-react/core';
|
|
8
8
|
export { ClientContextComponent, createClientUniformContext, useInitUniformContext, useUniformContext } from '@uniformdev/canvas-next-rsc-client';
|
|
9
9
|
|
|
10
|
-
declare const DefaultNotImplementedComponent: ({ component }: ComponentProps) =>
|
|
10
|
+
declare const DefaultNotImplementedComponent: ({ component }: ComponentProps) => React.JSX.Element | null;
|
|
11
11
|
|
|
12
12
|
type RichTextComponentProps<TNode extends RichTextNode = RichTextNode> = {
|
|
13
13
|
node: TNode;
|
|
14
14
|
};
|
|
15
|
-
type RichTextRendererComponent<TNode extends RichTextNode = RichTextNode> =
|
|
15
|
+
type RichTextRendererComponent<TNode extends RichTextNode = RichTextNode> = React.ComponentType<PropsWithChildren<RichTextComponentProps<TNode>>>;
|
|
16
16
|
/**
|
|
17
17
|
* Function that maps a Rich Text node instance to its React component to render it.
|
|
18
18
|
* The resolver would commonly inspect the `type` of the component to decide.
|
|
@@ -24,7 +24,7 @@ type UniformRichTextProps = {
|
|
|
24
24
|
* The name of the HTML tag to render.
|
|
25
25
|
* @default "div"
|
|
26
26
|
*/
|
|
27
|
-
as?:
|
|
27
|
+
as?: React.ElementType;
|
|
28
28
|
/** The ID of the parameter. */
|
|
29
29
|
parameterId: string;
|
|
30
30
|
/**
|
|
@@ -43,16 +43,16 @@ type UniformRichTextProps = {
|
|
|
43
43
|
placeholder?: string | ((parameter: {
|
|
44
44
|
id: string;
|
|
45
45
|
}) => string | undefined);
|
|
46
|
-
} & Omit<
|
|
46
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'placeholder'>;
|
|
47
47
|
/**
|
|
48
48
|
* Adds rendering support for Uniform Rich Text parameters
|
|
49
49
|
*/
|
|
50
|
-
declare const UniformRichText:
|
|
50
|
+
declare const UniformRichText: React.ForwardRefExoticComponent<{
|
|
51
51
|
/**
|
|
52
52
|
* The name of the HTML tag to render.
|
|
53
53
|
* @default "div"
|
|
54
54
|
*/
|
|
55
|
-
as?:
|
|
55
|
+
as?: React.ElementType;
|
|
56
56
|
/** The ID of the parameter. */
|
|
57
57
|
parameterId: string;
|
|
58
58
|
/**
|
|
@@ -71,7 +71,7 @@ declare const UniformRichText: React__default.ForwardRefExoticComponent<{
|
|
|
71
71
|
placeholder?: string | ((parameter: {
|
|
72
72
|
id: string;
|
|
73
73
|
}) => string | undefined);
|
|
74
|
-
} & Omit<
|
|
74
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "placeholder"> & React.RefAttributes<unknown>>;
|
|
75
75
|
|
|
76
76
|
type UniformRichTextNodeProps = {
|
|
77
77
|
node: RichTextNode;
|
|
@@ -80,7 +80,7 @@ type UniformRichTextNodeProps = {
|
|
|
80
80
|
/**
|
|
81
81
|
* Render a single RichText node
|
|
82
82
|
*/
|
|
83
|
-
declare function UniformRichTextNode({ node, ...props }: UniformRichTextNodeProps):
|
|
83
|
+
declare function UniformRichTextNode({ node, ...props }: UniformRichTextNodeProps): React.JSX.Element | null;
|
|
84
84
|
|
|
85
85
|
type CustomSlotChildRenderFunc = (options: {
|
|
86
86
|
child: ReactNode;
|
|
@@ -100,6 +100,6 @@ declare const UniformSlot: ({ data, slot, children }: UniformSlotProps) => React
|
|
|
100
100
|
type UniformTextProps = {
|
|
101
101
|
context: Pick<CompositionContext, 'isContextualEditing'>;
|
|
102
102
|
} & Omit<PureUniformTextProps, 'skipCustomRendering' | 'isContextualEditing'>;
|
|
103
|
-
declare const UniformText: ({ context, ...rest }: UniformTextProps) =>
|
|
103
|
+
declare const UniformText: ({ context, ...rest }: UniformTextProps) => React.JSX.Element;
|
|
104
104
|
|
|
105
105
|
export { type CustomSlotChildRenderFunc, DefaultNotImplementedComponent, UniformRichText, UniformRichTextNode, type UniformRichTextNodeProps, type UniformRichTextProps, UniformSlot, type UniformSlotProps, UniformText, type UniformTextProps };
|
package/dist/config.js
CHANGED
|
@@ -28,31 +28,58 @@ var import_path = require("path");
|
|
|
28
28
|
var getConfigPath = () => {
|
|
29
29
|
const possibleExtensions = [".js", ".cjs", ".mjs", ".ts"];
|
|
30
30
|
let configFilePath;
|
|
31
|
+
let configFileName;
|
|
31
32
|
for (const extension of possibleExtensions) {
|
|
32
|
-
const
|
|
33
|
+
const fileName = `uniform.server.config${extension}`;
|
|
34
|
+
const filePath = (0, import_path.join)(process.cwd(), fileName);
|
|
33
35
|
if ((0, import_fs.existsSync)(filePath)) {
|
|
34
36
|
configFilePath = filePath;
|
|
37
|
+
configFileName = fileName;
|
|
35
38
|
break;
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
|
-
|
|
41
|
+
if (!configFilePath) {
|
|
42
|
+
return void 0;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
filePath: configFilePath,
|
|
46
|
+
fileName: configFileName
|
|
47
|
+
};
|
|
39
48
|
};
|
|
40
|
-
var withUniformConfig = (nextConfig) =>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
var withUniformConfig = (nextConfig) => {
|
|
50
|
+
var _a, _b, _c;
|
|
51
|
+
const { fileName: uniformConfigFileName } = getConfigPath() || {};
|
|
52
|
+
const turboResolveAliases = {
|
|
53
|
+
...((_b = (_a = nextConfig.experimental) == null ? void 0 : _a.turbo) == null ? void 0 : _b.resolveAlias) || {}
|
|
54
|
+
};
|
|
55
|
+
if (uniformConfigFileName) {
|
|
56
|
+
console.log("(Turbo) Using Uniform config from", uniformConfigFileName);
|
|
57
|
+
turboResolveAliases["uniform.server.config"] = `./${uniformConfigFileName}`;
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
...nextConfig,
|
|
61
|
+
experimental: {
|
|
62
|
+
...nextConfig.experimental || {},
|
|
63
|
+
turbo: {
|
|
64
|
+
...((_c = nextConfig.experimental) == null ? void 0 : _c.turbo) || {},
|
|
65
|
+
resolveAlias: turboResolveAliases
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
webpack: (config, context) => {
|
|
69
|
+
if (nextConfig.webpack) {
|
|
70
|
+
nextConfig.webpack(config, context);
|
|
51
71
|
}
|
|
72
|
+
if (context.isServer) {
|
|
73
|
+
const { filePath: uniformConfigPath } = getConfigPath() || {};
|
|
74
|
+
if (uniformConfigPath) {
|
|
75
|
+
console.log("Using Uniform config from", uniformConfigPath);
|
|
76
|
+
config.resolve.alias["uniform.server.config"] = (0, import_path.resolve)(config.context, uniformConfigPath);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return config;
|
|
52
80
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
81
|
+
};
|
|
82
|
+
};
|
|
56
83
|
// Annotate the CommonJS export names for ESM import in node:
|
|
57
84
|
0 && (module.exports = {
|
|
58
85
|
withUniformConfig
|
package/dist/config.mjs
CHANGED
|
@@ -4,31 +4,58 @@ import { join, resolve } from "path";
|
|
|
4
4
|
var getConfigPath = () => {
|
|
5
5
|
const possibleExtensions = [".js", ".cjs", ".mjs", ".ts"];
|
|
6
6
|
let configFilePath;
|
|
7
|
+
let configFileName;
|
|
7
8
|
for (const extension of possibleExtensions) {
|
|
8
|
-
const
|
|
9
|
+
const fileName = `uniform.server.config${extension}`;
|
|
10
|
+
const filePath = join(process.cwd(), fileName);
|
|
9
11
|
if (existsSync(filePath)) {
|
|
10
12
|
configFilePath = filePath;
|
|
13
|
+
configFileName = fileName;
|
|
11
14
|
break;
|
|
12
15
|
}
|
|
13
16
|
}
|
|
14
|
-
|
|
17
|
+
if (!configFilePath) {
|
|
18
|
+
return void 0;
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
filePath: configFilePath,
|
|
22
|
+
fileName: configFileName
|
|
23
|
+
};
|
|
15
24
|
};
|
|
16
|
-
var withUniformConfig = (nextConfig) =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
var withUniformConfig = (nextConfig) => {
|
|
26
|
+
var _a, _b, _c;
|
|
27
|
+
const { fileName: uniformConfigFileName } = getConfigPath() || {};
|
|
28
|
+
const turboResolveAliases = {
|
|
29
|
+
...((_b = (_a = nextConfig.experimental) == null ? void 0 : _a.turbo) == null ? void 0 : _b.resolveAlias) || {}
|
|
30
|
+
};
|
|
31
|
+
if (uniformConfigFileName) {
|
|
32
|
+
console.log("(Turbo) Using Uniform config from", uniformConfigFileName);
|
|
33
|
+
turboResolveAliases["uniform.server.config"] = `./${uniformConfigFileName}`;
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
...nextConfig,
|
|
37
|
+
experimental: {
|
|
38
|
+
...nextConfig.experimental || {},
|
|
39
|
+
turbo: {
|
|
40
|
+
...((_c = nextConfig.experimental) == null ? void 0 : _c.turbo) || {},
|
|
41
|
+
resolveAlias: turboResolveAliases
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
webpack: (config, context) => {
|
|
45
|
+
if (nextConfig.webpack) {
|
|
46
|
+
nextConfig.webpack(config, context);
|
|
27
47
|
}
|
|
48
|
+
if (context.isServer) {
|
|
49
|
+
const { filePath: uniformConfigPath } = getConfigPath() || {};
|
|
50
|
+
if (uniformConfigPath) {
|
|
51
|
+
console.log("Using Uniform config from", uniformConfigPath);
|
|
52
|
+
config.resolve.alias["uniform.server.config"] = resolve(config.context, uniformConfigPath);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return config;
|
|
28
56
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
57
|
+
};
|
|
58
|
+
};
|
|
32
59
|
export {
|
|
33
60
|
withUniformConfig
|
|
34
61
|
};
|
package/dist/handler.js
CHANGED
|
@@ -101,14 +101,14 @@ var createPreviewGETRouteHandler = (options) => {
|
|
|
101
101
|
return new Response("Could not resolve the full path of the preview page", { status: 400 });
|
|
102
102
|
}
|
|
103
103
|
if (disable) {
|
|
104
|
-
(0, import_headers.draftMode)().disable();
|
|
104
|
+
(await (0, import_headers.draftMode)()).disable();
|
|
105
105
|
(0, import_navigation.redirect)(pathToRedirectTo);
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
if (secret !== process.env.UNIFORM_PREVIEW_SECRET) {
|
|
109
109
|
return new Response("Invalid preview secret", { status: 401 });
|
|
110
110
|
}
|
|
111
|
-
(0, import_headers.draftMode)().enable();
|
|
111
|
+
(await (0, import_headers.draftMode)()).enable();
|
|
112
112
|
const redirectionUrl = new URL(pathToRedirectTo, BASE_URL_EXAMPLE);
|
|
113
113
|
assignRequestQueryToSearchParams(redirectionUrl.searchParams, searchParams);
|
|
114
114
|
if (isPlayground || (options == null ? void 0 : options.playgroundPath) && pathToRedirectTo === options.playgroundPath) {
|
package/dist/handler.mjs
CHANGED
|
@@ -68,14 +68,14 @@ var createPreviewGETRouteHandler = (options) => {
|
|
|
68
68
|
return new Response("Could not resolve the full path of the preview page", { status: 400 });
|
|
69
69
|
}
|
|
70
70
|
if (disable) {
|
|
71
|
-
draftMode().disable();
|
|
71
|
+
(await draftMode()).disable();
|
|
72
72
|
redirect(pathToRedirectTo);
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
if (secret !== process.env.UNIFORM_PREVIEW_SECRET) {
|
|
76
76
|
return new Response("Invalid preview secret", { status: 401 });
|
|
77
77
|
}
|
|
78
|
-
draftMode().enable();
|
|
78
|
+
(await draftMode()).enable();
|
|
79
79
|
const redirectionUrl = new URL(pathToRedirectTo, BASE_URL_EXAMPLE);
|
|
80
80
|
assignRequestQueryToSearchParams(redirectionUrl.searchParams, searchParams);
|
|
81
81
|
if (isPlayground || (options == null ? void 0 : options.playgroundPath) && pathToRedirectTo === options.playgroundPath) {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
import { CanvasClient, RouteClient, ResolvedRouteGetResponse, CompositionGetBySlugParameters, RouteGetParameters } from '@uniformdev/canvas';
|
|
2
|
-
import { UniformServerConfig,
|
|
2
|
+
import { UniformServerConfig, CompositionContext, AppDirectoryContextState, AppDirectoryServerContext, PlaygroundParameters, AwaitedPageParameters, PageParameters } from '@uniformdev/canvas-next-rsc-shared';
|
|
3
3
|
export { PageParameters, PlaygroundParameters } from '@uniformdev/canvas-next-rsc-shared';
|
|
4
4
|
import { ManifestClient } from '@uniformdev/context/api';
|
|
5
5
|
import { ProjectMapClient, ProjectMapNode } from '@uniformdev/project-map';
|
|
6
6
|
import { ContextState, ContextOptions } from '@uniformdev/context';
|
|
7
|
-
import
|
|
8
|
-
import { U as UniformCompositionProps } from './UniformComposition-
|
|
9
|
-
export { b as UniformComposition, r as resolveComposition } from './UniformComposition-
|
|
7
|
+
import React, { PropsWithChildren } from 'react';
|
|
8
|
+
import { U as UniformCompositionProps } from './UniformComposition-D_HC6rSo.mjs';
|
|
9
|
+
export { b as UniformComposition, r as resolveComposition } from './UniformComposition-D_HC6rSo.mjs';
|
|
10
10
|
import { ClientContextComponent } from '@uniformdev/canvas-next-rsc-client';
|
|
11
11
|
|
|
12
12
|
type GetCanvasClientOptions = {
|
|
13
13
|
cache: NonNullable<UniformServerConfig['canvasCache']>;
|
|
14
14
|
};
|
|
15
15
|
declare const getCanvasClient: (options: GetCanvasClientOptions) => CanvasClient;
|
|
16
|
-
declare const getDefaultCanvasClient: (
|
|
17
|
-
searchParams: PageParameters["searchParams"];
|
|
18
|
-
}) => CanvasClient;
|
|
16
|
+
declare const getDefaultCanvasClient: (options: Pick<CompositionContext, "searchParams">) => Promise<CanvasClient>;
|
|
19
17
|
|
|
20
18
|
type GetManifestClientOptions = {
|
|
21
19
|
cache: NonNullable<UniformServerConfig['manifestCache']>;
|
|
22
20
|
};
|
|
23
21
|
declare const getManifestClient: (options: GetManifestClientOptions) => ManifestClient;
|
|
24
|
-
declare const getDefaultManifestClient: (
|
|
25
|
-
|
|
26
|
-
}) => ManifestClient;
|
|
27
|
-
declare const getManifest: ({ searchParams }: {
|
|
28
|
-
searchParams: PageParameters["searchParams"];
|
|
29
|
-
}) => Promise<{
|
|
22
|
+
declare const getDefaultManifestClient: (options: Pick<CompositionContext, "searchParams">) => Promise<ManifestClient>;
|
|
23
|
+
declare const getManifest: (options: Pick<CompositionContext, "searchParams">) => Promise<{
|
|
30
24
|
project: {
|
|
31
25
|
id?: string;
|
|
32
26
|
name?: string;
|
|
@@ -186,23 +180,19 @@ type GetProjectMapClientOptions = {
|
|
|
186
180
|
cache: NonNullable<UniformServerConfig['projectMapCache']>;
|
|
187
181
|
};
|
|
188
182
|
declare const getProjectMapClient: (options: GetProjectMapClientOptions) => ProjectMapClient;
|
|
189
|
-
declare const getDefaultProjectMapClient: (
|
|
190
|
-
searchParams: PageParameters["searchParams"];
|
|
191
|
-
}) => ProjectMapClient;
|
|
183
|
+
declare const getDefaultProjectMapClient: (options: Pick<CompositionContext, "searchParams">) => Promise<ProjectMapClient>;
|
|
192
184
|
|
|
193
185
|
type GetRouteClientOptions = {
|
|
194
186
|
cache: NonNullable<UniformServerConfig['canvasCache']>;
|
|
195
187
|
};
|
|
196
188
|
declare const getRouteClient: (options: GetRouteClientOptions) => RouteClient;
|
|
197
|
-
declare const getDefaultRouteClient: (
|
|
198
|
-
searchParams: PageParameters["searchParams"];
|
|
199
|
-
}) => RouteClient;
|
|
189
|
+
declare const getDefaultRouteClient: (options: Pick<CompositionContext, "searchParams">) => Promise<RouteClient>;
|
|
200
190
|
|
|
201
191
|
type ContextUpdateTransferProps = {
|
|
202
192
|
update: Partial<AppDirectoryContextState> | (() => Promise<Partial<ContextState> | undefined>);
|
|
203
193
|
serverContext: AppDirectoryServerContext | undefined;
|
|
204
194
|
};
|
|
205
|
-
declare const ContextUpdateTransfer:
|
|
195
|
+
declare const ContextUpdateTransfer: React.FC<ContextUpdateTransferProps>;
|
|
206
196
|
|
|
207
197
|
type CreateStaticParamsOptions = {
|
|
208
198
|
expand?: (node: ProjectMapNode) => Promise<string[] | undefined> | string[] | undefined;
|
|
@@ -220,21 +210,19 @@ type UniformContextProps = {
|
|
|
220
210
|
*/
|
|
221
211
|
clientContextComponent?: ClientContextComponent;
|
|
222
212
|
};
|
|
223
|
-
declare const UniformContext:
|
|
213
|
+
declare const UniformContext: React.FC<PropsWithChildren<UniformContextProps>>;
|
|
224
214
|
|
|
225
215
|
type UniformPlaygroundProps = PlaygroundParameters & Omit<UniformCompositionProps, 'params' | 'searchParams' | 'route' | 'mode'>;
|
|
226
|
-
declare const UniformPlayground:
|
|
216
|
+
declare const UniformPlayground: React.FC<UniformPlaygroundProps>;
|
|
227
217
|
|
|
228
218
|
type CreateServerUniformContextProps = Omit<ContextOptions, 'transitionStore' | 'manifest'> & {
|
|
229
|
-
searchParams:
|
|
219
|
+
searchParams: AwaitedPageParameters['searchParams'];
|
|
230
220
|
};
|
|
231
221
|
declare const createServerUniformContext: (options: CreateServerUniformContextProps) => Promise<AppDirectoryServerContext>;
|
|
232
222
|
|
|
233
223
|
declare const isDraftModeEnabled: ({ searchParams, }: {
|
|
234
|
-
searchParams:
|
|
235
|
-
|
|
236
|
-
} | undefined;
|
|
237
|
-
}) => boolean;
|
|
224
|
+
searchParams: AwaitedPageParameters["searchParams"];
|
|
225
|
+
}) => Promise<boolean>;
|
|
238
226
|
declare const isIncontextEditingEnabled: ({ searchParams, }: {
|
|
239
227
|
searchParams: {
|
|
240
228
|
[key: string]: string | undefined;
|
|
@@ -262,6 +250,6 @@ type RetrieveSlugOptions = Pick<CompositionGetBySlugParameters, 'slug' | 'locale
|
|
|
262
250
|
} & RetrieveCommonOptions;
|
|
263
251
|
type RetrieveRouteFetchOptions = Omit<RouteGetParameters, 'projectId' | 'path' | 'withComponentIDs' | 'withContentSourceMap' | 'state'>;
|
|
264
252
|
declare const retrieveCompositionBySlug: ({ slug, searchParams, skipPrefetch, locale, releaseId, versionId, }: RetrieveSlugOptions) => Promise<ResolvedRouteGetResponse>;
|
|
265
|
-
declare const retrieveRoute: ({ params, searchParams, skipPrefetch }: RetrieveRouteOptions, fetchOptions?: RetrieveRouteFetchOptions) => Promise<ResolvedRouteGetResponse>;
|
|
253
|
+
declare const retrieveRoute: ({ params, searchParams: providedSearchParams, skipPrefetch }: RetrieveRouteOptions, fetchOptions?: RetrieveRouteFetchOptions) => Promise<ResolvedRouteGetResponse>;
|
|
266
254
|
|
|
267
255
|
export { ContextUpdateTransfer, type ContextUpdateTransferProps, type CreateServerUniformContextProps, type CreateStaticParamsOptions, type GetCanvasClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, UniformCompositionProps, UniformContext, type UniformContextProps, UniformPlayground, type UniformPlaygroundProps, createServerUniformContext, createStaticParams, generateStaticParams, getCanvasClient, getDefaultCanvasClient, getDefaultManifestClient, getDefaultProjectMapClient, getDefaultRouteClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, isDevelopmentEnvironment, isDraftModeEnabled, isIncontextEditingEnabled, isOnVercelPreviewEnvironment, retrieveCompositionBySlug, retrieveRoute };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
import { CanvasClient, RouteClient, ResolvedRouteGetResponse, CompositionGetBySlugParameters, RouteGetParameters } from '@uniformdev/canvas';
|
|
2
|
-
import { UniformServerConfig,
|
|
2
|
+
import { UniformServerConfig, CompositionContext, AppDirectoryContextState, AppDirectoryServerContext, PlaygroundParameters, AwaitedPageParameters, PageParameters } from '@uniformdev/canvas-next-rsc-shared';
|
|
3
3
|
export { PageParameters, PlaygroundParameters } from '@uniformdev/canvas-next-rsc-shared';
|
|
4
4
|
import { ManifestClient } from '@uniformdev/context/api';
|
|
5
5
|
import { ProjectMapClient, ProjectMapNode } from '@uniformdev/project-map';
|
|
6
6
|
import { ContextState, ContextOptions } from '@uniformdev/context';
|
|
7
|
-
import
|
|
8
|
-
import { U as UniformCompositionProps } from './UniformComposition-
|
|
9
|
-
export { b as UniformComposition, r as resolveComposition } from './UniformComposition-
|
|
7
|
+
import React, { PropsWithChildren } from 'react';
|
|
8
|
+
import { U as UniformCompositionProps } from './UniformComposition-D_HC6rSo.js';
|
|
9
|
+
export { b as UniformComposition, r as resolveComposition } from './UniformComposition-D_HC6rSo.js';
|
|
10
10
|
import { ClientContextComponent } from '@uniformdev/canvas-next-rsc-client';
|
|
11
11
|
|
|
12
12
|
type GetCanvasClientOptions = {
|
|
13
13
|
cache: NonNullable<UniformServerConfig['canvasCache']>;
|
|
14
14
|
};
|
|
15
15
|
declare const getCanvasClient: (options: GetCanvasClientOptions) => CanvasClient;
|
|
16
|
-
declare const getDefaultCanvasClient: (
|
|
17
|
-
searchParams: PageParameters["searchParams"];
|
|
18
|
-
}) => CanvasClient;
|
|
16
|
+
declare const getDefaultCanvasClient: (options: Pick<CompositionContext, "searchParams">) => Promise<CanvasClient>;
|
|
19
17
|
|
|
20
18
|
type GetManifestClientOptions = {
|
|
21
19
|
cache: NonNullable<UniformServerConfig['manifestCache']>;
|
|
22
20
|
};
|
|
23
21
|
declare const getManifestClient: (options: GetManifestClientOptions) => ManifestClient;
|
|
24
|
-
declare const getDefaultManifestClient: (
|
|
25
|
-
|
|
26
|
-
}) => ManifestClient;
|
|
27
|
-
declare const getManifest: ({ searchParams }: {
|
|
28
|
-
searchParams: PageParameters["searchParams"];
|
|
29
|
-
}) => Promise<{
|
|
22
|
+
declare const getDefaultManifestClient: (options: Pick<CompositionContext, "searchParams">) => Promise<ManifestClient>;
|
|
23
|
+
declare const getManifest: (options: Pick<CompositionContext, "searchParams">) => Promise<{
|
|
30
24
|
project: {
|
|
31
25
|
id?: string;
|
|
32
26
|
name?: string;
|
|
@@ -186,23 +180,19 @@ type GetProjectMapClientOptions = {
|
|
|
186
180
|
cache: NonNullable<UniformServerConfig['projectMapCache']>;
|
|
187
181
|
};
|
|
188
182
|
declare const getProjectMapClient: (options: GetProjectMapClientOptions) => ProjectMapClient;
|
|
189
|
-
declare const getDefaultProjectMapClient: (
|
|
190
|
-
searchParams: PageParameters["searchParams"];
|
|
191
|
-
}) => ProjectMapClient;
|
|
183
|
+
declare const getDefaultProjectMapClient: (options: Pick<CompositionContext, "searchParams">) => Promise<ProjectMapClient>;
|
|
192
184
|
|
|
193
185
|
type GetRouteClientOptions = {
|
|
194
186
|
cache: NonNullable<UniformServerConfig['canvasCache']>;
|
|
195
187
|
};
|
|
196
188
|
declare const getRouteClient: (options: GetRouteClientOptions) => RouteClient;
|
|
197
|
-
declare const getDefaultRouteClient: (
|
|
198
|
-
searchParams: PageParameters["searchParams"];
|
|
199
|
-
}) => RouteClient;
|
|
189
|
+
declare const getDefaultRouteClient: (options: Pick<CompositionContext, "searchParams">) => Promise<RouteClient>;
|
|
200
190
|
|
|
201
191
|
type ContextUpdateTransferProps = {
|
|
202
192
|
update: Partial<AppDirectoryContextState> | (() => Promise<Partial<ContextState> | undefined>);
|
|
203
193
|
serverContext: AppDirectoryServerContext | undefined;
|
|
204
194
|
};
|
|
205
|
-
declare const ContextUpdateTransfer:
|
|
195
|
+
declare const ContextUpdateTransfer: React.FC<ContextUpdateTransferProps>;
|
|
206
196
|
|
|
207
197
|
type CreateStaticParamsOptions = {
|
|
208
198
|
expand?: (node: ProjectMapNode) => Promise<string[] | undefined> | string[] | undefined;
|
|
@@ -220,21 +210,19 @@ type UniformContextProps = {
|
|
|
220
210
|
*/
|
|
221
211
|
clientContextComponent?: ClientContextComponent;
|
|
222
212
|
};
|
|
223
|
-
declare const UniformContext:
|
|
213
|
+
declare const UniformContext: React.FC<PropsWithChildren<UniformContextProps>>;
|
|
224
214
|
|
|
225
215
|
type UniformPlaygroundProps = PlaygroundParameters & Omit<UniformCompositionProps, 'params' | 'searchParams' | 'route' | 'mode'>;
|
|
226
|
-
declare const UniformPlayground:
|
|
216
|
+
declare const UniformPlayground: React.FC<UniformPlaygroundProps>;
|
|
227
217
|
|
|
228
218
|
type CreateServerUniformContextProps = Omit<ContextOptions, 'transitionStore' | 'manifest'> & {
|
|
229
|
-
searchParams:
|
|
219
|
+
searchParams: AwaitedPageParameters['searchParams'];
|
|
230
220
|
};
|
|
231
221
|
declare const createServerUniformContext: (options: CreateServerUniformContextProps) => Promise<AppDirectoryServerContext>;
|
|
232
222
|
|
|
233
223
|
declare const isDraftModeEnabled: ({ searchParams, }: {
|
|
234
|
-
searchParams:
|
|
235
|
-
|
|
236
|
-
} | undefined;
|
|
237
|
-
}) => boolean;
|
|
224
|
+
searchParams: AwaitedPageParameters["searchParams"];
|
|
225
|
+
}) => Promise<boolean>;
|
|
238
226
|
declare const isIncontextEditingEnabled: ({ searchParams, }: {
|
|
239
227
|
searchParams: {
|
|
240
228
|
[key: string]: string | undefined;
|
|
@@ -262,6 +250,6 @@ type RetrieveSlugOptions = Pick<CompositionGetBySlugParameters, 'slug' | 'locale
|
|
|
262
250
|
} & RetrieveCommonOptions;
|
|
263
251
|
type RetrieveRouteFetchOptions = Omit<RouteGetParameters, 'projectId' | 'path' | 'withComponentIDs' | 'withContentSourceMap' | 'state'>;
|
|
264
252
|
declare const retrieveCompositionBySlug: ({ slug, searchParams, skipPrefetch, locale, releaseId, versionId, }: RetrieveSlugOptions) => Promise<ResolvedRouteGetResponse>;
|
|
265
|
-
declare const retrieveRoute: ({ params, searchParams, skipPrefetch }: RetrieveRouteOptions, fetchOptions?: RetrieveRouteFetchOptions) => Promise<ResolvedRouteGetResponse>;
|
|
253
|
+
declare const retrieveRoute: ({ params, searchParams: providedSearchParams, skipPrefetch }: RetrieveRouteOptions, fetchOptions?: RetrieveRouteFetchOptions) => Promise<ResolvedRouteGetResponse>;
|
|
266
254
|
|
|
267
255
|
export { ContextUpdateTransfer, type ContextUpdateTransferProps, type CreateServerUniformContextProps, type CreateStaticParamsOptions, type GetCanvasClientOptions, type GetManifestClientOptions, type GetProjectMapClientOptions, type GetRouteClientOptions, UniformCompositionProps, UniformContext, type UniformContextProps, UniformPlayground, type UniformPlaygroundProps, createServerUniformContext, createStaticParams, generateStaticParams, getCanvasClient, getDefaultCanvasClient, getDefaultManifestClient, getDefaultProjectMapClient, getDefaultRouteClient, getManifest, getManifestClient, getProjectMapClient, getRouteClient, isDevelopmentEnvironment, isDraftModeEnabled, isIncontextEditingEnabled, isOnVercelPreviewEnvironment, retrieveCompositionBySlug, retrieveRoute };
|