@uniformdev/next-app-router 20.7.1-alpha.118
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 +2 -0
- package/dist/UniformComposition-Bekn8k24.d.mts +74 -0
- package/dist/UniformComposition-CdXfLiaB.d.ts +74 -0
- package/dist/UniformText-ChMwHBw4.d.mts +10 -0
- package/dist/UniformText-ChMwHBw4.d.ts +10 -0
- package/dist/cache.d.mts +9 -0
- package/dist/cache.d.ts +9 -0
- package/dist/cache.js +1915 -0
- package/dist/cache.mjs +1903 -0
- package/dist/client-BCGVjYM-.d.mts +779 -0
- package/dist/client-BCGVjYM-.d.ts +779 -0
- package/dist/compat.d.mts +36 -0
- package/dist/compat.d.ts +36 -0
- package/dist/compat.js +120 -0
- package/dist/compat.mjs +89 -0
- package/dist/component.d.mts +61 -0
- package/dist/component.d.ts +61 -0
- package/dist/component.js +1397 -0
- package/dist/component.mjs +1384 -0
- package/dist/config.d.mts +13 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.js +80 -0
- package/dist/config.mjs +55 -0
- package/dist/handler.d.mts +29 -0
- package/dist/handler.d.ts +29 -0
- package/dist/handler.js +2664 -0
- package/dist/handler.mjs +2648 -0
- package/dist/index.d.mts +264 -0
- package/dist/index.d.ts +264 -0
- package/dist/index.esm.js +3935 -0
- package/dist/index.js +3953 -0
- package/dist/index.mjs +3935 -0
- package/dist/middleware.d.mts +70 -0
- package/dist/middleware.d.ts +70 -0
- package/dist/middleware.js +5873 -0
- package/dist/middleware.mjs +5867 -0
- package/dist/resolveRouteFromCode-B2rqnHgJ.d.ts +26 -0
- package/dist/resolveRouteFromCode-CA63-EPp.d.mts +26 -0
- package/package.json +112 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { ComponentType } from 'react';
|
|
2
|
+
import { ComponentProps as ComponentProps$1, ComponentParameter } from '@uniformdev/next-app-router-shared';
|
|
3
|
+
import { U as UniformTextProps$1 } from './UniformText-ChMwHBw4.mjs';
|
|
4
|
+
import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-Bekn8k24.mjs';
|
|
5
|
+
import '@uniformdev/next-app-router-client';
|
|
6
|
+
import '@uniformdev/canvas';
|
|
7
|
+
import './resolveRouteFromCode-CA63-EPp.mjs';
|
|
8
|
+
import './client-BCGVjYM-.mjs';
|
|
9
|
+
import '@uniformdev/context';
|
|
10
|
+
|
|
11
|
+
type ComponentContext = ComponentProps$1['component'] & {
|
|
12
|
+
parameters: Record<string, ComponentParameter>;
|
|
13
|
+
};
|
|
14
|
+
type ComponentProps<TParameters = unknown, TSlotNames extends string = string> = TParameters & Omit<ComponentProps$1<TParameters, TSlotNames>, 'parameters' | 'component'> & {
|
|
15
|
+
component: ComponentContext;
|
|
16
|
+
};
|
|
17
|
+
type UniformTextProps = Omit<UniformTextProps$1, 'component' | 'parameter'> & {
|
|
18
|
+
component: ComponentContext;
|
|
19
|
+
parameterId: string;
|
|
20
|
+
};
|
|
21
|
+
declare const UniformText: ({ component, parameterId, ...rest }: UniformTextProps) => React.JSX.Element;
|
|
22
|
+
type AdaptedResolveComponentResultWithType = Omit<ResolveComponentResult, 'component'> & {
|
|
23
|
+
mode: 'adapted';
|
|
24
|
+
type: string;
|
|
25
|
+
component: ComponentType<ComponentProps<any, any>>;
|
|
26
|
+
};
|
|
27
|
+
type NonAdaptedResolveComponentResultWithType = ResolveComponentResult & {
|
|
28
|
+
type: string;
|
|
29
|
+
};
|
|
30
|
+
type ResolveComponentResultWithType = AdaptedResolveComponentResultWithType | NonAdaptedResolveComponentResultWithType;
|
|
31
|
+
declare const isAdaptedResolveComponentResultWithType: (result: ResolveComponentResultWithType) => result is AdaptedResolveComponentResultWithType;
|
|
32
|
+
declare const createAdapterResolveComponentFunction: ({ mappings, }: {
|
|
33
|
+
mappings: Record<string, ResolveComponentResultWithType>;
|
|
34
|
+
}) => ResolveComponentFunction;
|
|
35
|
+
|
|
36
|
+
export { type AdaptedResolveComponentResultWithType, type ComponentContext, type ComponentProps, type NonAdaptedResolveComponentResultWithType, type ResolveComponentResultWithType, UniformText, type UniformTextProps, createAdapterResolveComponentFunction, isAdaptedResolveComponentResultWithType };
|
package/dist/compat.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { ComponentType } from 'react';
|
|
2
|
+
import { ComponentProps as ComponentProps$1, ComponentParameter } from '@uniformdev/next-app-router-shared';
|
|
3
|
+
import { U as UniformTextProps$1 } from './UniformText-ChMwHBw4.js';
|
|
4
|
+
import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-CdXfLiaB.js';
|
|
5
|
+
import '@uniformdev/next-app-router-client';
|
|
6
|
+
import '@uniformdev/canvas';
|
|
7
|
+
import './resolveRouteFromCode-B2rqnHgJ.js';
|
|
8
|
+
import './client-BCGVjYM-.js';
|
|
9
|
+
import '@uniformdev/context';
|
|
10
|
+
|
|
11
|
+
type ComponentContext = ComponentProps$1['component'] & {
|
|
12
|
+
parameters: Record<string, ComponentParameter>;
|
|
13
|
+
};
|
|
14
|
+
type ComponentProps<TParameters = unknown, TSlotNames extends string = string> = TParameters & Omit<ComponentProps$1<TParameters, TSlotNames>, 'parameters' | 'component'> & {
|
|
15
|
+
component: ComponentContext;
|
|
16
|
+
};
|
|
17
|
+
type UniformTextProps = Omit<UniformTextProps$1, 'component' | 'parameter'> & {
|
|
18
|
+
component: ComponentContext;
|
|
19
|
+
parameterId: string;
|
|
20
|
+
};
|
|
21
|
+
declare const UniformText: ({ component, parameterId, ...rest }: UniformTextProps) => React.JSX.Element;
|
|
22
|
+
type AdaptedResolveComponentResultWithType = Omit<ResolveComponentResult, 'component'> & {
|
|
23
|
+
mode: 'adapted';
|
|
24
|
+
type: string;
|
|
25
|
+
component: ComponentType<ComponentProps<any, any>>;
|
|
26
|
+
};
|
|
27
|
+
type NonAdaptedResolveComponentResultWithType = ResolveComponentResult & {
|
|
28
|
+
type: string;
|
|
29
|
+
};
|
|
30
|
+
type ResolveComponentResultWithType = AdaptedResolveComponentResultWithType | NonAdaptedResolveComponentResultWithType;
|
|
31
|
+
declare const isAdaptedResolveComponentResultWithType: (result: ResolveComponentResultWithType) => result is AdaptedResolveComponentResultWithType;
|
|
32
|
+
declare const createAdapterResolveComponentFunction: ({ mappings, }: {
|
|
33
|
+
mappings: Record<string, ResolveComponentResultWithType>;
|
|
34
|
+
}) => ResolveComponentFunction;
|
|
35
|
+
|
|
36
|
+
export { type AdaptedResolveComponentResultWithType, type ComponentContext, type ComponentProps, type NonAdaptedResolveComponentResultWithType, type ResolveComponentResultWithType, UniformText, type UniformTextProps, createAdapterResolveComponentFunction, isAdaptedResolveComponentResultWithType };
|
package/dist/compat.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/compat.tsx
|
|
31
|
+
var compat_exports = {};
|
|
32
|
+
__export(compat_exports, {
|
|
33
|
+
UniformText: () => UniformText2,
|
|
34
|
+
createAdapterResolveComponentFunction: () => createAdapterResolveComponentFunction,
|
|
35
|
+
isAdaptedResolveComponentResultWithType: () => isAdaptedResolveComponentResultWithType
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(compat_exports);
|
|
38
|
+
var import_react2 = __toESM(require("react"));
|
|
39
|
+
|
|
40
|
+
// src/component.ts
|
|
41
|
+
var import_next_app_router_client2 = require("@uniformdev/next-app-router-client");
|
|
42
|
+
|
|
43
|
+
// src/components/UniformText.tsx
|
|
44
|
+
var import_next_app_router_client = require("@uniformdev/next-app-router-client");
|
|
45
|
+
var import_react = __toESM(require("react"));
|
|
46
|
+
var UniformText = (props) => {
|
|
47
|
+
return /* @__PURE__ */ import_react.default.createElement(import_next_app_router_client.ClientUniformText, { ...props });
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// src/compat.tsx
|
|
51
|
+
var wrapComponentWithAdapter = (componentType) => {
|
|
52
|
+
return (props) => {
|
|
53
|
+
const { parameters, component, ...rest } = props;
|
|
54
|
+
const adaptedComponentProps = {
|
|
55
|
+
...Object.keys(parameters).reduce((acc, cur) => {
|
|
56
|
+
acc[cur] = parameters[cur].value;
|
|
57
|
+
return acc;
|
|
58
|
+
}, {}),
|
|
59
|
+
component: {
|
|
60
|
+
...component,
|
|
61
|
+
parameters
|
|
62
|
+
},
|
|
63
|
+
...rest
|
|
64
|
+
};
|
|
65
|
+
const Component = componentType;
|
|
66
|
+
return /* @__PURE__ */ import_react2.default.createElement(Component, { ...adaptedComponentProps });
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
var UniformText2 = ({ component, parameterId, ...rest }) => {
|
|
70
|
+
var _a;
|
|
71
|
+
const resolvedParameter = (_a = component.parameters) == null ? void 0 : _a[parameterId];
|
|
72
|
+
return /* @__PURE__ */ import_react2.default.createElement(
|
|
73
|
+
UniformText,
|
|
74
|
+
{
|
|
75
|
+
component,
|
|
76
|
+
parameter: resolvedParameter,
|
|
77
|
+
...rest
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
var isAdaptedResolveComponentResultWithType = (result) => {
|
|
82
|
+
return "mode" in result && result.mode === "adapted";
|
|
83
|
+
};
|
|
84
|
+
var createAdapterResolveComponentFunction = ({
|
|
85
|
+
mappings
|
|
86
|
+
}) => {
|
|
87
|
+
return ({ component }) => {
|
|
88
|
+
let result = {
|
|
89
|
+
component: ({ type }) => {
|
|
90
|
+
return /* @__PURE__ */ import_react2.default.createElement("div", null, "Not implemented: ", type);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const keys = Object.keys(mappings);
|
|
94
|
+
for (let i = 0; i < keys.length; i++) {
|
|
95
|
+
const key = keys[i];
|
|
96
|
+
if (!key) continue;
|
|
97
|
+
const mapping = mappings[key];
|
|
98
|
+
if ((mapping == null ? void 0 : mapping.type) === component.type) {
|
|
99
|
+
if (isAdaptedResolveComponentResultWithType(mapping)) {
|
|
100
|
+
if (mapping.component) {
|
|
101
|
+
result = {
|
|
102
|
+
...mapping,
|
|
103
|
+
component: wrapComponentWithAdapter(mapping.component)
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
result = mapping;
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return result;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
116
|
+
0 && (module.exports = {
|
|
117
|
+
UniformText,
|
|
118
|
+
createAdapterResolveComponentFunction,
|
|
119
|
+
isAdaptedResolveComponentResultWithType
|
|
120
|
+
});
|
package/dist/compat.mjs
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// src/compat.tsx
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
|
|
4
|
+
// src/component.ts
|
|
5
|
+
import {
|
|
6
|
+
createClientUniformContext,
|
|
7
|
+
useInitUniformContext,
|
|
8
|
+
useQuirks,
|
|
9
|
+
useScores,
|
|
10
|
+
useUniformContext
|
|
11
|
+
} from "@uniformdev/next-app-router-client";
|
|
12
|
+
|
|
13
|
+
// src/components/UniformText.tsx
|
|
14
|
+
import { ClientUniformText } from "@uniformdev/next-app-router-client";
|
|
15
|
+
import React from "react";
|
|
16
|
+
var UniformText = (props) => {
|
|
17
|
+
return /* @__PURE__ */ React.createElement(ClientUniformText, { ...props });
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// src/compat.tsx
|
|
21
|
+
var wrapComponentWithAdapter = (componentType) => {
|
|
22
|
+
return (props) => {
|
|
23
|
+
const { parameters, component, ...rest } = props;
|
|
24
|
+
const adaptedComponentProps = {
|
|
25
|
+
...Object.keys(parameters).reduce((acc, cur) => {
|
|
26
|
+
acc[cur] = parameters[cur].value;
|
|
27
|
+
return acc;
|
|
28
|
+
}, {}),
|
|
29
|
+
component: {
|
|
30
|
+
...component,
|
|
31
|
+
parameters
|
|
32
|
+
},
|
|
33
|
+
...rest
|
|
34
|
+
};
|
|
35
|
+
const Component = componentType;
|
|
36
|
+
return /* @__PURE__ */ React2.createElement(Component, { ...adaptedComponentProps });
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
var UniformText2 = ({ component, parameterId, ...rest }) => {
|
|
40
|
+
var _a;
|
|
41
|
+
const resolvedParameter = (_a = component.parameters) == null ? void 0 : _a[parameterId];
|
|
42
|
+
return /* @__PURE__ */ React2.createElement(
|
|
43
|
+
UniformText,
|
|
44
|
+
{
|
|
45
|
+
component,
|
|
46
|
+
parameter: resolvedParameter,
|
|
47
|
+
...rest
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
var isAdaptedResolveComponentResultWithType = (result) => {
|
|
52
|
+
return "mode" in result && result.mode === "adapted";
|
|
53
|
+
};
|
|
54
|
+
var createAdapterResolveComponentFunction = ({
|
|
55
|
+
mappings
|
|
56
|
+
}) => {
|
|
57
|
+
return ({ component }) => {
|
|
58
|
+
let result = {
|
|
59
|
+
component: ({ type }) => {
|
|
60
|
+
return /* @__PURE__ */ React2.createElement("div", null, "Not implemented: ", type);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const keys = Object.keys(mappings);
|
|
64
|
+
for (let i = 0; i < keys.length; i++) {
|
|
65
|
+
const key = keys[i];
|
|
66
|
+
if (!key) continue;
|
|
67
|
+
const mapping = mappings[key];
|
|
68
|
+
if ((mapping == null ? void 0 : mapping.type) === component.type) {
|
|
69
|
+
if (isAdaptedResolveComponentResultWithType(mapping)) {
|
|
70
|
+
if (mapping.component) {
|
|
71
|
+
result = {
|
|
72
|
+
...mapping,
|
|
73
|
+
component: wrapComponentWithAdapter(mapping.component)
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
result = mapping;
|
|
78
|
+
}
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return result;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export {
|
|
86
|
+
UniformText2 as UniformText,
|
|
87
|
+
createAdapterResolveComponentFunction,
|
|
88
|
+
isAdaptedResolveComponentResultWithType
|
|
89
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { ReactNode, Key, PropsWithChildren } from 'react';
|
|
2
|
+
import { SlotDefinition, ComponentContext, ComponentParameter } from '@uniformdev/next-app-router-shared';
|
|
3
|
+
export { ComponentContext, ComponentParameter, ComponentProps } from '@uniformdev/next-app-router-shared';
|
|
4
|
+
export { ClientContextComponent, createClientUniformContext, useInitUniformContext, useQuirks, useScores, useUniformContext } from '@uniformdev/next-app-router-client';
|
|
5
|
+
import { RichTextNode, ParameterRichTextValue } from '@uniformdev/richtext';
|
|
6
|
+
export { a as UniformText, U as UniformTextProps } from './UniformText-ChMwHBw4.mjs';
|
|
7
|
+
|
|
8
|
+
declare const getUniformSlot: ({ slot, children }: UniformSlotProps) => ReactNode[] | undefined;
|
|
9
|
+
|
|
10
|
+
type CustomSlotChildRenderFunc = (options: {
|
|
11
|
+
child: ReactNode;
|
|
12
|
+
_id: string;
|
|
13
|
+
key: Key;
|
|
14
|
+
slotName: string;
|
|
15
|
+
slotIndex: number;
|
|
16
|
+
}) => ReactNode;
|
|
17
|
+
type UniformSlotProps = {
|
|
18
|
+
slot: SlotDefinition | undefined;
|
|
19
|
+
children?: CustomSlotChildRenderFunc;
|
|
20
|
+
};
|
|
21
|
+
declare const UniformSlot: ({ slot, children }: UniformSlotProps) => ReactNode[] | null;
|
|
22
|
+
|
|
23
|
+
type RichTextComponentProps<TNode extends RichTextNode = RichTextNode> = {
|
|
24
|
+
node: TNode;
|
|
25
|
+
};
|
|
26
|
+
type RichTextRendererComponent<TNode extends RichTextNode = RichTextNode> = React.ComponentType<PropsWithChildren<RichTextComponentProps<TNode>>>;
|
|
27
|
+
/**
|
|
28
|
+
* Function that maps a Rich Text node instance to its React component to render it.
|
|
29
|
+
* The resolver would commonly inspect the `type` of the component to decide.
|
|
30
|
+
*/
|
|
31
|
+
type RenderRichTextComponentResolver = (node: RichTextNode) => RichTextRendererComponent | null | undefined;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Adds rendering support for Uniform Rich Text parameters
|
|
35
|
+
*/
|
|
36
|
+
declare const UniformRichText: React.ForwardRefExoticComponent<{
|
|
37
|
+
/**
|
|
38
|
+
* The name of the HTML tag to render.
|
|
39
|
+
* @default "div"
|
|
40
|
+
*/
|
|
41
|
+
as?: React.ElementType;
|
|
42
|
+
/**
|
|
43
|
+
* A function which can provide a custom react component
|
|
44
|
+
* for rendering a rich text node
|
|
45
|
+
*/
|
|
46
|
+
resolveRichTextRenderer?: RenderRichTextComponentResolver;
|
|
47
|
+
/** The ID of the component. */
|
|
48
|
+
component: Pick<ComponentContext, "_id">;
|
|
49
|
+
/** The ID of the parameter. */
|
|
50
|
+
parameter: ComponentParameter<ParameterRichTextValue>;
|
|
51
|
+
/**
|
|
52
|
+
* Sets the value to show in Canvas editor when the parameter value is empty.
|
|
53
|
+
* Can be a static string, or a function to generate the placeholder out of parameter info.
|
|
54
|
+
* @default undefined
|
|
55
|
+
*/
|
|
56
|
+
placeholder?: string | ((parameter: {
|
|
57
|
+
id: string;
|
|
58
|
+
}) => string | undefined);
|
|
59
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "placeholder"> & React.RefAttributes<unknown>>;
|
|
60
|
+
|
|
61
|
+
export { UniformRichText, UniformSlot, type UniformSlotProps, getUniformSlot };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { ReactNode, Key, PropsWithChildren } from 'react';
|
|
2
|
+
import { SlotDefinition, ComponentContext, ComponentParameter } from '@uniformdev/next-app-router-shared';
|
|
3
|
+
export { ComponentContext, ComponentParameter, ComponentProps } from '@uniformdev/next-app-router-shared';
|
|
4
|
+
export { ClientContextComponent, createClientUniformContext, useInitUniformContext, useQuirks, useScores, useUniformContext } from '@uniformdev/next-app-router-client';
|
|
5
|
+
import { RichTextNode, ParameterRichTextValue } from '@uniformdev/richtext';
|
|
6
|
+
export { a as UniformText, U as UniformTextProps } from './UniformText-ChMwHBw4.js';
|
|
7
|
+
|
|
8
|
+
declare const getUniformSlot: ({ slot, children }: UniformSlotProps) => ReactNode[] | undefined;
|
|
9
|
+
|
|
10
|
+
type CustomSlotChildRenderFunc = (options: {
|
|
11
|
+
child: ReactNode;
|
|
12
|
+
_id: string;
|
|
13
|
+
key: Key;
|
|
14
|
+
slotName: string;
|
|
15
|
+
slotIndex: number;
|
|
16
|
+
}) => ReactNode;
|
|
17
|
+
type UniformSlotProps = {
|
|
18
|
+
slot: SlotDefinition | undefined;
|
|
19
|
+
children?: CustomSlotChildRenderFunc;
|
|
20
|
+
};
|
|
21
|
+
declare const UniformSlot: ({ slot, children }: UniformSlotProps) => ReactNode[] | null;
|
|
22
|
+
|
|
23
|
+
type RichTextComponentProps<TNode extends RichTextNode = RichTextNode> = {
|
|
24
|
+
node: TNode;
|
|
25
|
+
};
|
|
26
|
+
type RichTextRendererComponent<TNode extends RichTextNode = RichTextNode> = React.ComponentType<PropsWithChildren<RichTextComponentProps<TNode>>>;
|
|
27
|
+
/**
|
|
28
|
+
* Function that maps a Rich Text node instance to its React component to render it.
|
|
29
|
+
* The resolver would commonly inspect the `type` of the component to decide.
|
|
30
|
+
*/
|
|
31
|
+
type RenderRichTextComponentResolver = (node: RichTextNode) => RichTextRendererComponent | null | undefined;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Adds rendering support for Uniform Rich Text parameters
|
|
35
|
+
*/
|
|
36
|
+
declare const UniformRichText: React.ForwardRefExoticComponent<{
|
|
37
|
+
/**
|
|
38
|
+
* The name of the HTML tag to render.
|
|
39
|
+
* @default "div"
|
|
40
|
+
*/
|
|
41
|
+
as?: React.ElementType;
|
|
42
|
+
/**
|
|
43
|
+
* A function which can provide a custom react component
|
|
44
|
+
* for rendering a rich text node
|
|
45
|
+
*/
|
|
46
|
+
resolveRichTextRenderer?: RenderRichTextComponentResolver;
|
|
47
|
+
/** The ID of the component. */
|
|
48
|
+
component: Pick<ComponentContext, "_id">;
|
|
49
|
+
/** The ID of the parameter. */
|
|
50
|
+
parameter: ComponentParameter<ParameterRichTextValue>;
|
|
51
|
+
/**
|
|
52
|
+
* Sets the value to show in Canvas editor when the parameter value is empty.
|
|
53
|
+
* Can be a static string, or a function to generate the placeholder out of parameter info.
|
|
54
|
+
* @default undefined
|
|
55
|
+
*/
|
|
56
|
+
placeholder?: string | ((parameter: {
|
|
57
|
+
id: string;
|
|
58
|
+
}) => string | undefined);
|
|
59
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "placeholder"> & React.RefAttributes<unknown>>;
|
|
60
|
+
|
|
61
|
+
export { UniformRichText, UniformSlot, type UniformSlotProps, getUniformSlot };
|