@uniformdev/canvas-next-rsc 19.79.1-alpha.11 → 19.79.1-alpha.18
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/LICENSE.txt +1 -1
- package/dist/{UniformComposition-d178d865.d.ts → UniformComposition-0pvEHduc.d.mts} +1 -1
- package/dist/UniformComposition-0pvEHduc.d.ts +64 -0
- package/dist/component.d.mts +4 -2
- package/dist/component.d.ts +4 -2
- package/dist/component.js +3 -1
- package/dist/component.mjs +3 -1
- package/dist/handler.d.mts +14 -3
- package/dist/handler.d.ts +14 -3
- package/dist/handler.js +260 -230
- package/dist/handler.mjs +263 -236
- package/dist/index.d.mts +26 -5
- package/dist/index.d.ts +26 -5
- package/dist/index.esm.js +75 -46
- package/dist/index.js +95 -69
- package/dist/index.mjs +75 -46
- package/package.json +14 -14
package/LICENSE.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
©
|
|
1
|
+
© 2024 Uniform Systems, Inc. All Rights Reserved.
|
|
2
2
|
See details of Uniform Systems, Inc. Master Subscription Agreement here: https://uniform.dev/eula
|
|
@@ -61,4 +61,4 @@ type ResolveComponentsOptions = {
|
|
|
61
61
|
mode: UniformCompositionProps['mode'];
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
export { ResolveComponentFunction as R, UniformCompositionProps as U, UniformComposition as a, ResolveComponentResult as b, resolveComposition as r };
|
|
64
|
+
export { type ResolveComponentFunction as R, type UniformCompositionProps as U, UniformComposition as a, type ResolveComponentResult as b, resolveComposition as r };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import { ComponentType, ReactNode } from 'react';
|
|
3
|
+
import { ResolvedRouteGetResponse, ComponentInstance } from '@uniformdev/canvas';
|
|
4
|
+
import { PageParameters, ComponentProps, CompositionContext, AppDirectoryServerContext } from '@uniformdev/canvas-next-rsc-shared';
|
|
5
|
+
|
|
6
|
+
type UniformStaticCompositionProps = {
|
|
7
|
+
/**
|
|
8
|
+
* How to render the composition.
|
|
9
|
+
*/
|
|
10
|
+
mode: 'static';
|
|
11
|
+
};
|
|
12
|
+
type UniformServerCompositionProps = {
|
|
13
|
+
/**
|
|
14
|
+
* How to render the composition.
|
|
15
|
+
*/
|
|
16
|
+
mode: 'server';
|
|
17
|
+
/**
|
|
18
|
+
* The Context instance to use for server-side rendering.
|
|
19
|
+
*/
|
|
20
|
+
serverContext?: AppDirectoryServerContext;
|
|
21
|
+
};
|
|
22
|
+
type UniformCompositionProps = PageParameters & {
|
|
23
|
+
/**
|
|
24
|
+
* The route data to render.
|
|
25
|
+
*/
|
|
26
|
+
route: ResolvedRouteGetResponse | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Function to map composition components to React components.
|
|
29
|
+
*/
|
|
30
|
+
resolveComponent: ResolveComponentFunction;
|
|
31
|
+
} & (UniformStaticCompositionProps | UniformServerCompositionProps);
|
|
32
|
+
declare const UniformComposition: React.FC<UniformCompositionProps>;
|
|
33
|
+
type ResolveComponentFunction = (options: {
|
|
34
|
+
component: ComponentInstance;
|
|
35
|
+
}) => ResolveComponentResult;
|
|
36
|
+
type ResolveComponentResult = {
|
|
37
|
+
component: ComponentType<ComponentProps<any, any>> | null;
|
|
38
|
+
includeContext?: boolean;
|
|
39
|
+
};
|
|
40
|
+
declare const resolveComposition: (props: Omit<ResolveComponentsOptions, 'slotName' | 'slotIndex' | 'target'> & {
|
|
41
|
+
composition: ComponentInstance;
|
|
42
|
+
compositionContext: CompositionContext;
|
|
43
|
+
}) => React$1.FunctionComponentElement<{
|
|
44
|
+
children?: ReactNode;
|
|
45
|
+
}> | null;
|
|
46
|
+
type ResolveComponentsOptions = {
|
|
47
|
+
serverContext?: AppDirectoryServerContext;
|
|
48
|
+
target: {
|
|
49
|
+
type: 'root';
|
|
50
|
+
composition: ComponentInstance;
|
|
51
|
+
} | {
|
|
52
|
+
type: 'slot';
|
|
53
|
+
components: ComponentInstance[];
|
|
54
|
+
parent: ComponentInstance;
|
|
55
|
+
root: ComponentInstance;
|
|
56
|
+
};
|
|
57
|
+
slotName: string | undefined;
|
|
58
|
+
slotIndex: number | undefined;
|
|
59
|
+
resolveComponent: ResolveComponentFunction;
|
|
60
|
+
compositionContext: CompositionContext;
|
|
61
|
+
mode: UniformCompositionProps['mode'];
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export { type ResolveComponentFunction as R, type UniformCompositionProps as U, UniformComposition as a, type ResolveComponentResult as b, resolveComposition as r };
|
package/dist/component.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentProps, CompositionContext, SlotDefinition } from '@uniformdev/canvas-next-rsc-shared';
|
|
2
2
|
export { ComponentProps, CompositionContext } from '@uniformdev/canvas-next-rsc-shared';
|
|
3
3
|
import React__default, { PropsWithChildren, ReactNode, Key } from 'react';
|
|
4
|
-
export { R as ResolveComponentFunction, b as ResolveComponentResult } from './UniformComposition-
|
|
4
|
+
export { R as ResolveComponentFunction, b as ResolveComponentResult } from './UniformComposition-0pvEHduc.mjs';
|
|
5
5
|
import { ComponentInstance } from '@uniformdev/canvas';
|
|
6
6
|
import { RichTextNode } from '@uniformdev/richtext';
|
|
7
7
|
import { PureUniformTextProps } from '@uniformdev/canvas-react/core';
|
|
@@ -59,6 +59,8 @@ type CustomSlotChildRenderFunc = (options: {
|
|
|
59
59
|
child: ReactNode;
|
|
60
60
|
component: ComponentInstance;
|
|
61
61
|
key: Key;
|
|
62
|
+
slotName: string;
|
|
63
|
+
slotIndex: number;
|
|
62
64
|
}) => JSX.Element;
|
|
63
65
|
type UniformSlotProps = {
|
|
64
66
|
data: ComponentInstance;
|
|
@@ -73,4 +75,4 @@ type UniformTextProps = {
|
|
|
73
75
|
} & Omit<PureUniformTextProps, 'skipCustomRendering' | 'isContextualEditing'>;
|
|
74
76
|
declare const UniformText: ({ context, ...rest }: UniformTextProps) => React__default.JSX.Element;
|
|
75
77
|
|
|
76
|
-
export { CustomSlotChildRenderFunc, DefaultNotImplementedComponent, UniformRichText, UniformRichTextProps, UniformSlot, UniformSlotProps, UniformText, UniformTextProps };
|
|
78
|
+
export { type CustomSlotChildRenderFunc, DefaultNotImplementedComponent, UniformRichText, type UniformRichTextProps, UniformSlot, type UniformSlotProps, UniformText, type UniformTextProps };
|
package/dist/component.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentProps, CompositionContext, SlotDefinition } from '@uniformdev/canvas-next-rsc-shared';
|
|
2
2
|
export { ComponentProps, CompositionContext } from '@uniformdev/canvas-next-rsc-shared';
|
|
3
3
|
import React__default, { PropsWithChildren, ReactNode, Key } from 'react';
|
|
4
|
-
export { R as ResolveComponentFunction, b as ResolveComponentResult } from './UniformComposition-
|
|
4
|
+
export { R as ResolveComponentFunction, b as ResolveComponentResult } from './UniformComposition-0pvEHduc.js';
|
|
5
5
|
import { ComponentInstance } from '@uniformdev/canvas';
|
|
6
6
|
import { RichTextNode } from '@uniformdev/richtext';
|
|
7
7
|
import { PureUniformTextProps } from '@uniformdev/canvas-react/core';
|
|
@@ -59,6 +59,8 @@ type CustomSlotChildRenderFunc = (options: {
|
|
|
59
59
|
child: ReactNode;
|
|
60
60
|
component: ComponentInstance;
|
|
61
61
|
key: Key;
|
|
62
|
+
slotName: string;
|
|
63
|
+
slotIndex: number;
|
|
62
64
|
}) => JSX.Element;
|
|
63
65
|
type UniformSlotProps = {
|
|
64
66
|
data: ComponentInstance;
|
|
@@ -73,4 +75,4 @@ type UniformTextProps = {
|
|
|
73
75
|
} & Omit<PureUniformTextProps, 'skipCustomRendering' | 'isContextualEditing'>;
|
|
74
76
|
declare const UniformText: ({ context, ...rest }: UniformTextProps) => React__default.JSX.Element;
|
|
75
77
|
|
|
76
|
-
export { CustomSlotChildRenderFunc, DefaultNotImplementedComponent, UniformRichText, UniformRichTextProps, UniformSlot, UniformSlotProps, UniformText, UniformTextProps };
|
|
78
|
+
export { type CustomSlotChildRenderFunc, DefaultNotImplementedComponent, UniformRichText, type UniformRichTextProps, UniformSlot, type UniformSlotProps, UniformText, type UniformTextProps };
|
package/dist/component.js
CHANGED
|
@@ -181,7 +181,9 @@ var UniformSlot = ({ data, slot, children }) => {
|
|
|
181
181
|
const result = children({
|
|
182
182
|
child,
|
|
183
183
|
component: targetSlotData[i],
|
|
184
|
-
key: `inner-${i}
|
|
184
|
+
key: `inner-${i}`,
|
|
185
|
+
slotName: slot.name,
|
|
186
|
+
slotIndex: i
|
|
185
187
|
});
|
|
186
188
|
resolved.push(result);
|
|
187
189
|
}
|
package/dist/component.mjs
CHANGED
|
@@ -142,7 +142,9 @@ var UniformSlot = ({ data, slot, children }) => {
|
|
|
142
142
|
const result = children({
|
|
143
143
|
child,
|
|
144
144
|
component: targetSlotData[i],
|
|
145
|
-
key: `inner-${i}
|
|
145
|
+
key: `inner-${i}`,
|
|
146
|
+
slotName: slot.name,
|
|
147
|
+
slotIndex: i
|
|
146
148
|
});
|
|
147
149
|
resolved.push(result);
|
|
148
150
|
}
|
package/dist/handler.d.mts
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { NextRequest } from 'next/server';
|
|
2
2
|
|
|
3
|
+
type ResolveFullPath = (options: {
|
|
4
|
+
/** The ID of the composition */
|
|
5
|
+
id?: string;
|
|
6
|
+
/** The slug of the composition */
|
|
7
|
+
slug?: string;
|
|
8
|
+
/** The path of the project map node attached to the composition, if there is one */
|
|
9
|
+
path?: string;
|
|
10
|
+
/** The preview locale selected in Visual Canvas, available only if Localization is set up */
|
|
11
|
+
locale?: string;
|
|
12
|
+
}) => string | undefined;
|
|
3
13
|
type CreatePreviewGETRouteHandlerOptions = {
|
|
14
|
+
resolveFullPath?: ResolveFullPath;
|
|
4
15
|
playgroundPath?: string;
|
|
5
16
|
};
|
|
6
|
-
declare const createPreviewGETRouteHandler: (options?: CreatePreviewGETRouteHandlerOptions) => (request: NextRequest) => Promise<Response>;
|
|
17
|
+
declare const createPreviewGETRouteHandler: (options?: CreatePreviewGETRouteHandlerOptions) => (request: NextRequest) => Promise<Response | undefined>;
|
|
7
18
|
|
|
8
19
|
declare const createPreviewOPTIONSRouteHandler: () => () => Promise<Response>;
|
|
9
20
|
|
|
10
|
-
declare const createPreviewPOSTRouteHandler: () => (request:
|
|
21
|
+
declare const createPreviewPOSTRouteHandler: () => (request: NextRequest) => Promise<Response>;
|
|
11
22
|
|
|
12
|
-
export { CreatePreviewGETRouteHandlerOptions, createPreviewGETRouteHandler, createPreviewOPTIONSRouteHandler, createPreviewPOSTRouteHandler };
|
|
23
|
+
export { type CreatePreviewGETRouteHandlerOptions, createPreviewGETRouteHandler, createPreviewOPTIONSRouteHandler, createPreviewPOSTRouteHandler };
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { NextRequest } from 'next/server';
|
|
2
2
|
|
|
3
|
+
type ResolveFullPath = (options: {
|
|
4
|
+
/** The ID of the composition */
|
|
5
|
+
id?: string;
|
|
6
|
+
/** The slug of the composition */
|
|
7
|
+
slug?: string;
|
|
8
|
+
/** The path of the project map node attached to the composition, if there is one */
|
|
9
|
+
path?: string;
|
|
10
|
+
/** The preview locale selected in Visual Canvas, available only if Localization is set up */
|
|
11
|
+
locale?: string;
|
|
12
|
+
}) => string | undefined;
|
|
3
13
|
type CreatePreviewGETRouteHandlerOptions = {
|
|
14
|
+
resolveFullPath?: ResolveFullPath;
|
|
4
15
|
playgroundPath?: string;
|
|
5
16
|
};
|
|
6
|
-
declare const createPreviewGETRouteHandler: (options?: CreatePreviewGETRouteHandlerOptions) => (request: NextRequest) => Promise<Response>;
|
|
17
|
+
declare const createPreviewGETRouteHandler: (options?: CreatePreviewGETRouteHandlerOptions) => (request: NextRequest) => Promise<Response | undefined>;
|
|
7
18
|
|
|
8
19
|
declare const createPreviewOPTIONSRouteHandler: () => () => Promise<Response>;
|
|
9
20
|
|
|
10
|
-
declare const createPreviewPOSTRouteHandler: () => (request:
|
|
21
|
+
declare const createPreviewPOSTRouteHandler: () => (request: NextRequest) => Promise<Response>;
|
|
11
22
|
|
|
12
|
-
export { CreatePreviewGETRouteHandlerOptions, createPreviewGETRouteHandler, createPreviewOPTIONSRouteHandler, createPreviewPOSTRouteHandler };
|
|
23
|
+
export { type CreatePreviewGETRouteHandlerOptions, createPreviewGETRouteHandler, createPreviewOPTIONSRouteHandler, createPreviewPOSTRouteHandler };
|