@uniformdev/canvas-react 19.35.1 → 19.35.3-alpha.82

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.
@@ -0,0 +1,396 @@
1
+ import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
2
+ import * as _uniformdev_canvas from '@uniformdev/canvas';
3
+ import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, SubscribeToCompositionOptions } from '@uniformdev/canvas';
4
+ export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
5
+ import { RichTextNode } from '@uniformdev/richtext';
6
+
7
+ /**
8
+ * Props passed to a Canvas component implementation.
9
+ * TProps is the Canvas component's parameters object after
10
+ * all enhancers have been applied.
11
+ */
12
+ type ComponentProps<TProps = unknown> = TProps & {
13
+ component: ComponentInstance;
14
+ };
15
+ /**
16
+ * Function that maps a Canvas component instance to its React component to render it.
17
+ * The resolver would commonly inspect the `type` and possibly `variant` of the component to decide.
18
+ */
19
+ type RenderComponentResolver = (component: ComponentInstance) => React.ComponentType<ComponentProps<any>> | null;
20
+ /** Function that renders Canvas system internals */
21
+ type SystemRenderFunction = (component: ComponentInstance, key: Key, renderChild: (component: ComponentInstance, key: Key) => JSX.Element | null) => JSX.Element | null;
22
+ /** Configures rendering of system components (tests, pz) */
23
+ type SystemRenderConfig = {
24
+ test: SystemRenderFunction;
25
+ personalization: SystemRenderFunction;
26
+ };
27
+ type ComponentStore = {
28
+ register: (options: {
29
+ type: string;
30
+ variantId?: string;
31
+ component: React.ComponentType<ComponentProps<any>>;
32
+ }) => void;
33
+ get: (type: string, variantId?: string) => React.ComponentType<ComponentProps<any>> | undefined;
34
+ };
35
+
36
+ /**
37
+ * A default implementation of a component-not-implemented component.
38
+ * Useful for model-first workflows where frontend dev comes later.
39
+ * To make this work, it needs to be the default returned from the
40
+ * resolveRenderer() function when the component is unknown.
41
+ **/
42
+ declare function DefaultNotImplementedComponent(props: ComponentProps): React$1.JSX.Element | null;
43
+
44
+ type ParameterTextValue = string | undefined;
45
+ type UniformTextProps = {
46
+ /**
47
+ * The name of the HTML tag to render.
48
+ * @default "span"
49
+ */
50
+ as?: React$1.ElementType;
51
+ /** The ID of the parameter. */
52
+ parameterId: string;
53
+ /**
54
+ * When set to true, it adds `whiteSpace: 'pre-wrap'` to the styles of the root element to allow the rendering of line breaks.
55
+ * @default false
56
+ */
57
+ isMultiline?: boolean;
58
+ /**
59
+ * Sets the value to show in Canvas editor when the parameter value is empty.
60
+ * Can be a static string, or a function to generate the placeholder out of parameter info.
61
+ * @default undefined
62
+ */
63
+ placeholder?: string | ((parameter: {
64
+ id: string;
65
+ }) => string | undefined);
66
+ /**
67
+ * A function to customize the rendering of the parameter value. Useful to format the value before rendering it.
68
+ * @default "(value) => value"
69
+ */
70
+ render?: (value: ParameterTextValue) => React$1.ReactNode;
71
+ } & Omit<React$1.HTMLAttributes<HTMLSpanElement>, 'children' | 'placeholder'>;
72
+ /**
73
+ * Adds inline editing capability to text parameters
74
+ * @deprecated This component is unstable, and not ready for production usage.
75
+ **/
76
+ declare const UniformText: ({ as: Tag, parameterId, isMultiline, placeholder, render, ...props }: UniformTextProps) => React$1.JSX.Element | null;
77
+
78
+ type UniformComponentProps<TRenderProps = unknown> = {
79
+ /** The data of the component instance */
80
+ data?: ComponentInstance | RootComponentInstance;
81
+ /** Resolves a React component to render a Canvas component, generally by inspecting type/variant */
82
+ resolveRenderer?: RenderComponentResolver;
83
+ /** Children to render. Can also be a function that takes ComponentProps as argument */
84
+ children?: ReactNode | ((props: ComponentProps<TRenderProps>) => JSX.Element);
85
+ /**
86
+ * When to track behavior from enrichment tags on the current composition
87
+ * onView: adds enrichment score when the visitor views the tagged component in the browser viewport.
88
+ * onLoad: adds enrichment score as soon as the component mounts, regardless of viewport.
89
+ *
90
+ * NOTE: onView renders a `<div>` tag around components that have enrichment tags, to support IntersectionObserver.
91
+ * onLoad does not need to do this, and renders no wrapping tag.
92
+ *
93
+ * Default: onView
94
+ */
95
+ behaviorTracking?: 'onLoad' | 'onView';
96
+ /**
97
+ * The default placeholder to pass to the parameter component that support inline editing (such as UniformText).
98
+ */
99
+ contextualEditingDefaultPlaceholder?: UniformTextProps['placeholder'];
100
+ };
101
+ type UniformComponentContextValue = {
102
+ data?: UniformComponentProps['data'];
103
+ resolveRenderer?: UniformComponentProps['resolveRenderer'];
104
+ behaviorTracking?: UniformComponentProps['behaviorTracking'];
105
+ contextualEditingDefaultPlaceholder?: UniformComponentProps['contextualEditingDefaultPlaceholder'];
106
+ };
107
+ /**
108
+ * Gets the data of the closest `<UniformComponent />` ancestor.
109
+ */
110
+ declare function useUniformCurrentComponent(): UniformComponentContextValue;
111
+ /**
112
+ * Allows the rendering of a Canvas component instance (root or not), and its children if it has any.
113
+ * Note that the actual rendering happens inside `<UniformSlot />`, this component only provides the services needed to achieve that.
114
+ * This component is used internally by `<UniformComposition />`, which you should use in most cases.
115
+ */
116
+ declare function UniformComponent<TRenderProps = unknown>({ data, resolveRenderer, children, behaviorTracking, contextualEditingDefaultPlaceholder, }: UniformComponentProps<TRenderProps>): React$1.JSX.Element | null;
117
+
118
+ type UseUniformContextualEditingProps = {
119
+ initialCompositionValue?: RootComponentInstance;
120
+ /**
121
+ * A function to enhance the composition after receiving it from Canvas editor.
122
+ * WARNING: This enhancer will run on the client side. Make sure you're not exposing any secrets. You can use `createApiEnhancer` to create an enhancer based on an API route.
123
+ */
124
+ enhance?: ({ composition, hash, }: Pick<UpdateCompositionMessage, 'composition' | 'hash'>) => RootComponentInstance | Promise<RootComponentInstance>;
125
+ };
126
+ /**
127
+ * Adds contextual editing capability to a Uniform app.
128
+ * This hook is already integrated in `<UniformComposition />`, you won't need to use it directly, unless you have a custom setup.
129
+ */
130
+ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance, }: UseUniformContextualEditingProps) => {
131
+ composition: {
132
+ type: string;
133
+ parameters?: {
134
+ [key: string]: {
135
+ value: unknown;
136
+ type: string;
137
+ connectedData?: {
138
+ pointer: string;
139
+ syntax: "jptr";
140
+ } | undefined;
141
+ };
142
+ } | undefined;
143
+ variant?: string | undefined;
144
+ projectMapNodes?: {
145
+ id: string;
146
+ path: string;
147
+ projectMapId: string;
148
+ }[] | undefined;
149
+ slots?: {
150
+ [key: string]: {
151
+ type: string;
152
+ parameters?: {
153
+ [key: string]: {
154
+ value: unknown;
155
+ type: string;
156
+ connectedData?: {
157
+ pointer: string;
158
+ syntax: "jptr";
159
+ } | undefined;
160
+ };
161
+ } | undefined;
162
+ variant?: string | undefined;
163
+ slots?: {
164
+ [key: string]: any[];
165
+ } | undefined;
166
+ _id?: string | undefined;
167
+ _pattern?: string | undefined;
168
+ _dataResources?: {
169
+ [key: string]: {
170
+ type: string;
171
+ isPatternParameter?: boolean | undefined;
172
+ ignorePatternParameterDefault?: boolean | undefined;
173
+ variables?: {
174
+ [key: string]: string;
175
+ } | undefined;
176
+ };
177
+ } | undefined;
178
+ _patternDataResources?: {
179
+ [key: string]: {
180
+ type: string;
181
+ isPatternParameter?: boolean | undefined;
182
+ ignorePatternParameterDefault?: boolean | undefined;
183
+ variables?: {
184
+ [key: string]: string;
185
+ } | undefined;
186
+ };
187
+ } | undefined;
188
+ _patternError?: "NOTFOUND" | "CYCLIC" | undefined;
189
+ _overrides?: {
190
+ [key: string]: {
191
+ parameters?: {
192
+ [key: string]: {
193
+ value: unknown;
194
+ type: string;
195
+ connectedData?: {
196
+ pointer: string;
197
+ syntax: "jptr";
198
+ } | undefined;
199
+ };
200
+ } | undefined;
201
+ variant?: string | undefined;
202
+ };
203
+ } | undefined;
204
+ _overridability?: {
205
+ parameters?: {
206
+ [key: string]: "yes" | "no";
207
+ } | undefined;
208
+ variants?: boolean | undefined;
209
+ } | undefined;
210
+ }[];
211
+ } | undefined;
212
+ _id: string;
213
+ _slug?: string | null | undefined;
214
+ _name: string;
215
+ _dataResources?: {
216
+ [key: string]: {
217
+ type: string;
218
+ isPatternParameter?: boolean | undefined;
219
+ ignorePatternParameterDefault?: boolean | undefined;
220
+ variables?: {
221
+ [key: string]: string;
222
+ } | undefined;
223
+ };
224
+ } | undefined;
225
+ _overrides?: {
226
+ [key: string]: {
227
+ parameters?: {
228
+ [key: string]: {
229
+ value: unknown;
230
+ type: string;
231
+ connectedData?: {
232
+ pointer: string;
233
+ syntax: "jptr";
234
+ } | undefined;
235
+ };
236
+ } | undefined;
237
+ variant?: string | undefined;
238
+ };
239
+ } | undefined;
240
+ _overridability?: {
241
+ parameters?: {
242
+ [key: string]: "yes" | "no";
243
+ } | undefined;
244
+ variants?: boolean | undefined;
245
+ } | undefined;
246
+ } | undefined;
247
+ isContextualEditing: boolean;
248
+ };
249
+
250
+ type UniformCompositionProps<TRenderProps = unknown> = UniformComponentProps<TRenderProps> & {
251
+ /** The composition data */
252
+ data?: RootComponentInstance;
253
+ contextualEditingEnhancer?: UseUniformContextualEditingProps['enhance'];
254
+ };
255
+ type UniformCompositionContextValue = {
256
+ data: UniformCompositionProps['data'] | undefined;
257
+ resolveRenderer?: UniformCompositionProps['resolveRenderer'];
258
+ behaviorTracking?: UniformCompositionProps['behaviorTracking'];
259
+ isContextualEditing: boolean;
260
+ };
261
+ /**
262
+ * Gets the data of the closest `<UniformComposition />` ancestor.
263
+ */
264
+ declare function useUniformCurrentComposition(): UniformCompositionContextValue;
265
+ /**
266
+ * The main component to render a Canvas composition.
267
+ * It renders the full tree of components, and provides some services to the children, such as `useUniformCurrentComposition`.
268
+ * It also takes care of enabling [Contextual Editing](https://docs.uniform.app/capabilities/composition/contextual-editing).
269
+ */
270
+ declare function UniformComposition<TRenderProps = unknown>({ data, behaviorTracking, children, resolveRenderer, contextualEditingEnhancer, contextualEditingDefaultPlaceholder, }: UniformCompositionProps<TRenderProps>): React$1.JSX.Element;
271
+
272
+ type RichTextComponentProps<TNode extends RichTextNode = RichTextNode> = {
273
+ node: TNode;
274
+ };
275
+ type RichTextRendererComponent<TNode extends RichTextNode = RichTextNode> = React$1.ComponentType<PropsWithChildren<RichTextComponentProps<TNode>>>;
276
+ /**
277
+ * Function that maps a Rich Text node instance to its React component to render it.
278
+ * The resolver would commonly inspect the `type` of the component to decide.
279
+ */
280
+ type RenderRichTextComponentResolver = (node: RichTextNode) => RichTextRendererComponent | null | undefined;
281
+
282
+ type UniformRichTextProps = {
283
+ /**
284
+ * The name of the HTML tag to render.
285
+ * @default "div"
286
+ */
287
+ as?: React$1.ElementType;
288
+ /** The ID of the parameter. */
289
+ parameterId: string;
290
+ /**
291
+ * A function which can provide a custom react component
292
+ * for rendering a rich text node
293
+ */
294
+ resolveRichTextRenderer?: RenderRichTextComponentResolver;
295
+ } & Omit<React$1.HTMLAttributes<HTMLDivElement>, 'children'>;
296
+ /**
297
+ * Adds rendering support for Uniform Rich Text parameters
298
+ */
299
+ declare const UniformRichText: React$1.ForwardRefExoticComponent<{
300
+ /**
301
+ * The name of the HTML tag to render.
302
+ * @default "div"
303
+ */
304
+ as?: React$1.ElementType<any> | undefined;
305
+ /** The ID of the parameter. */
306
+ parameterId: string;
307
+ /**
308
+ * A function which can provide a custom react component
309
+ * for rendering a rich text node
310
+ */
311
+ resolveRichTextRenderer?: RenderRichTextComponentResolver | undefined;
312
+ } & Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & React$1.RefAttributes<unknown>>;
313
+
314
+ type UniformRichTextNodeProps = {
315
+ node: RichTextNode;
316
+ resolveRichTextRenderer?: RenderRichTextComponentResolver;
317
+ };
318
+ /**
319
+ * Render a single RichText node
320
+ */
321
+ declare function UniformRichTextNode({ node, ...props }: UniformRichTextNodeProps): React$1.JSX.Element | null;
322
+
323
+ type CustomSlotChildRenderFunc = (options: {
324
+ child: ReactNode;
325
+ component: ComponentInstance;
326
+ key: Key;
327
+ }) => JSX.Element;
328
+ type UniformSlotProps<TSlotNames extends string> = {
329
+ /** Name of the slot to render */
330
+ name: TSlotNames;
331
+ /**
332
+ * Function to resolve the React component to render for a given Canvas component type.
333
+ * If not specified, the resolveRenderer function on the nearest Layout will be used, if any.
334
+ */
335
+ resolveRenderer?: RenderComponentResolver;
336
+ /** Optional render props enables wrapping all child components in the slot with some markup */
337
+ children?: CustomSlotChildRenderFunc;
338
+ /**
339
+ * Optional ReactNode to use as a placeholder in Canvas editor when the slot is empty.
340
+ * The node is used to render a placeholder with realistic dimensions and it's never shown to users.
341
+ * Pass `null` to disable the placeholder.
342
+ */
343
+ emptyPlaceholder?: React$1.ReactNode;
344
+ };
345
+ /** Renders a named Slot within a Composition. */
346
+ declare function UniformSlot<TSlotNames extends string = string>({ name, resolveRenderer, children, emptyPlaceholder, }: UniformSlotProps<TSlotNames>): JSX.Element | null;
347
+
348
+ /**
349
+ * Returns the attributes needed to annotate a Uniform parameter for inline editing.
350
+ * Supports only text parameters at the moment.
351
+ * @deprecated Unstable, and not ready for production usage.
352
+ **/
353
+ declare const getParameterAttributes: typeof getParameterAttributes$1;
354
+
355
+ type UseCompositionEventEffectOptions = Omit<Partial<SubscribeToCompositionOptions>, 'callback'> & {
356
+ enabled: boolean;
357
+ effect: () => void;
358
+ };
359
+ /** Hook to manage a subscription to a realtime event on a composition */
360
+ declare function useCompositionEventEffect({ enabled, projectId, compositionId, effect, }: UseCompositionEventEffectOptions): void;
361
+
362
+ type UseUniformContextualEditingStateProps = {
363
+ /**
364
+ * When set to true, the hook will return the global contextual state no matter where its used.
365
+ * When set to false, it will return only the state relevant to the current component (determined using `useUniformCurrentComponent`).
366
+ * @default false
367
+ **/
368
+ global?: boolean;
369
+ };
370
+ /**
371
+ * Returns the state of contextual editing, when the app is open inside Canvas Editor.
372
+ * This hook can be used to improve the editing experience of your team.
373
+ * For example: You can use `selectedComponentReference` to control which element to show inside a carousel or an accordion.
374
+ */
375
+ declare const useUniformContextualEditingState: ({ global, }?: UseUniformContextualEditingStateProps) => {
376
+ isContextualEditing: boolean;
377
+ selectedComponentReference: Omit<_uniformdev_canvas.ContextualEditingComponentReference, "elements"> | undefined;
378
+ };
379
+
380
+ declare const componentStore: ComponentStore;
381
+ declare const registerUniformComponent: ({ type, variantId, component, }: {
382
+ type: string;
383
+ variantId?: string | undefined;
384
+ component: React.ComponentType<ComponentProps<any>>;
385
+ }) => void;
386
+ declare const componentStoreResolver: RenderComponentResolver;
387
+
388
+ /** Can be used to override default component Not Implemented fallback */
389
+ declare const NOT_IMPLEMENTED_COMPONENT = "__not_implemented__";
390
+ declare const createComponentStore: () => ComponentStore;
391
+ declare const createComponentStoreResolver: (options: {
392
+ store: ComponentStore;
393
+ defaultComponent?: React$1.ComponentType<ComponentProps<any>>;
394
+ }) => RenderComponentResolver;
395
+
396
+ export { ComponentProps, ComponentStore, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, RenderComponentResolver, RenderRichTextComponentResolver, RichTextComponentProps, RichTextRendererComponent, SystemRenderConfig, SystemRenderFunction, UniformComponent, UniformComponentContextValue, UniformComponentProps, UniformComposition, UniformCompositionProps, UniformRichText, UniformRichTextNode, UniformRichTextNodeProps, UniformRichTextProps, UniformSlot, UniformSlotProps, UniformText, UniformTextProps, UseCompositionEventEffectOptions, UseUniformContextualEditingProps, UseUniformContextualEditingStateProps, componentStore, componentStoreResolver, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
2
2
  import * as _uniformdev_canvas from '@uniformdev/canvas';
3
- import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, SubscribeToCompositionOptions } from '@uniformdev/canvas';
4
- export { createUniformApiEnhancer } from '@uniformdev/canvas';
3
+ import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, SubscribeToCompositionOptions } from '@uniformdev/canvas';
4
+ export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
5
5
  import { RichTextNode } from '@uniformdev/richtext';
6
6
 
7
7
  /**
@@ -41,6 +41,40 @@ type ComponentStore = {
41
41
  **/
42
42
  declare function DefaultNotImplementedComponent(props: ComponentProps): React$1.JSX.Element | null;
43
43
 
44
+ type ParameterTextValue = string | undefined;
45
+ type UniformTextProps = {
46
+ /**
47
+ * The name of the HTML tag to render.
48
+ * @default "span"
49
+ */
50
+ as?: React$1.ElementType;
51
+ /** The ID of the parameter. */
52
+ parameterId: string;
53
+ /**
54
+ * When set to true, it adds `whiteSpace: 'pre-wrap'` to the styles of the root element to allow the rendering of line breaks.
55
+ * @default false
56
+ */
57
+ isMultiline?: boolean;
58
+ /**
59
+ * Sets the value to show in Canvas editor when the parameter value is empty.
60
+ * Can be a static string, or a function to generate the placeholder out of parameter info.
61
+ * @default undefined
62
+ */
63
+ placeholder?: string | ((parameter: {
64
+ id: string;
65
+ }) => string | undefined);
66
+ /**
67
+ * A function to customize the rendering of the parameter value. Useful to format the value before rendering it.
68
+ * @default "(value) => value"
69
+ */
70
+ render?: (value: ParameterTextValue) => React$1.ReactNode;
71
+ } & Omit<React$1.HTMLAttributes<HTMLSpanElement>, 'children' | 'placeholder'>;
72
+ /**
73
+ * Adds inline editing capability to text parameters
74
+ * @deprecated This component is unstable, and not ready for production usage.
75
+ **/
76
+ declare const UniformText: ({ as: Tag, parameterId, isMultiline, placeholder, render, ...props }: UniformTextProps) => React$1.JSX.Element | null;
77
+
44
78
  type UniformComponentProps<TRenderProps = unknown> = {
45
79
  /** The data of the component instance */
46
80
  data?: ComponentInstance | RootComponentInstance;
@@ -59,11 +93,16 @@ type UniformComponentProps<TRenderProps = unknown> = {
59
93
  * Default: onView
60
94
  */
61
95
  behaviorTracking?: 'onLoad' | 'onView';
96
+ /**
97
+ * The default placeholder to pass to the parameter component that support inline editing (such as UniformText).
98
+ */
99
+ contextualEditingDefaultPlaceholder?: UniformTextProps['placeholder'];
62
100
  };
63
101
  type UniformComponentContextValue = {
64
102
  data?: UniformComponentProps['data'];
65
103
  resolveRenderer?: UniformComponentProps['resolveRenderer'];
66
104
  behaviorTracking?: UniformComponentProps['behaviorTracking'];
105
+ contextualEditingDefaultPlaceholder?: UniformComponentProps['contextualEditingDefaultPlaceholder'];
67
106
  };
68
107
  /**
69
108
  * Gets the data of the closest `<UniformComponent />` ancestor.
@@ -74,7 +113,7 @@ declare function useUniformCurrentComponent(): UniformComponentContextValue;
74
113
  * Note that the actual rendering happens inside `<UniformSlot />`, this component only provides the services needed to achieve that.
75
114
  * This component is used internally by `<UniformComposition />`, which you should use in most cases.
76
115
  */
77
- declare function UniformComponent<TRenderProps = unknown>({ data, resolveRenderer, children, behaviorTracking, }: UniformComponentProps<TRenderProps>): React$1.JSX.Element | null;
116
+ declare function UniformComponent<TRenderProps = unknown>({ data, resolveRenderer, children, behaviorTracking, contextualEditingDefaultPlaceholder, }: UniformComponentProps<TRenderProps>): React$1.JSX.Element | null;
78
117
 
79
118
  type UseUniformContextualEditingProps = {
80
119
  initialCompositionValue?: RootComponentInstance;
@@ -228,7 +267,7 @@ declare function useUniformCurrentComposition(): UniformCompositionContextValue;
228
267
  * It renders the full tree of components, and provides some services to the children, such as `useUniformCurrentComposition`.
229
268
  * It also takes care of enabling [Contextual Editing](https://docs.uniform.app/capabilities/composition/contextual-editing).
230
269
  */
231
- declare function UniformComposition<TRenderProps = unknown>({ data, behaviorTracking, children, resolveRenderer, contextualEditingEnhancer, }: UniformCompositionProps<TRenderProps>): React$1.JSX.Element;
270
+ declare function UniformComposition<TRenderProps = unknown>({ data, behaviorTracking, children, resolveRenderer, contextualEditingEnhancer, contextualEditingDefaultPlaceholder, }: UniformCompositionProps<TRenderProps>): React$1.JSX.Element;
232
271
 
233
272
  type RichTextComponentProps<TNode extends RichTextNode = RichTextNode> = {
234
273
  node: TNode;
@@ -306,62 +345,12 @@ type UniformSlotProps<TSlotNames extends string> = {
306
345
  /** Renders a named Slot within a Composition. */
307
346
  declare function UniformSlot<TSlotNames extends string = string>({ name, resolveRenderer, children, emptyPlaceholder, }: UniformSlotProps<TSlotNames>): JSX.Element | null;
308
347
 
309
- type ParameterTextValue = string | undefined;
310
- type UniformTextProps = {
311
- /**
312
- * The name of the HTML tag to render.
313
- * @default "span"
314
- */
315
- as?: React$1.ElementType;
316
- /** The ID of the parameter. */
317
- parameterId: string;
318
- /**
319
- * When set to true, it adds `whiteSpace: 'pre-wrap'` to the styles of the root element to allow the rendering of line breaks.
320
- * @default false
321
- */
322
- isMultiline?: boolean;
323
- /**
324
- * Sets the value to show in Canvas editor when the parameter value is empty.
325
- * @default undefined
326
- */
327
- placeholder?: string;
328
- /**
329
- * A function to customize the rendering of the parameter value. Useful to format the value before rendering it.
330
- * @default "(value) => value"
331
- */
332
- render?: (value: ParameterTextValue) => React$1.ReactNode;
333
- } & Omit<React$1.HTMLAttributes<HTMLSpanElement>, 'children'>;
334
- /**
335
- * Adds inline editing capability to text parameters
336
- * @deprecated This component is unstable, and not ready for production usage.
337
- **/
338
- declare const UniformText: ({ as: Tag, parameterId, isMultiline, placeholder, render, ...props }: UniformTextProps) => React$1.JSX.Element | null;
339
-
340
- type GetParameterAttributesProps = {
341
- /** The public Id of the parameter */
342
- id: string;
343
- /** The component object where this parameter is used */
344
- component: ComponentInstance;
345
- /**
346
- * Sets the value to show in Canvas editor when the parameter value is empty.
347
- * @default undefined
348
- */
349
- placeholder?: string;
350
- };
351
348
  /**
352
349
  * Returns the attributes needed to annotate a Uniform parameter for inline editing.
353
350
  * Supports only text parameters at the moment.
354
351
  * @deprecated Unstable, and not ready for production usage.
355
352
  **/
356
- declare const getParameterAttributes: ({ id, component, placeholder }: GetParameterAttributesProps) => {
357
- 'data-uniform-component-id': string | undefined;
358
- 'data-uniform-parameter-id': string;
359
- 'data-uniform-parameter-value': {};
360
- 'data-uniform-parameter-type': string | undefined;
361
- 'data-uniform-placeholder': string | undefined;
362
- contentEditable: boolean;
363
- suppressContentEditableWarning: boolean;
364
- };
353
+ declare const getParameterAttributes: typeof getParameterAttributes$1;
365
354
 
366
355
  type UseCompositionEventEffectOptions = Omit<Partial<SubscribeToCompositionOptions>, 'callback'> & {
367
356
  enabled: boolean;
@@ -404,4 +393,4 @@ declare const createComponentStoreResolver: (options: {
404
393
  defaultComponent?: React$1.ComponentType<ComponentProps<any>>;
405
394
  }) => RenderComponentResolver;
406
395
 
407
- export { ComponentProps, ComponentStore, DefaultNotImplementedComponent, GetParameterAttributesProps, NOT_IMPLEMENTED_COMPONENT, RenderComponentResolver, RenderRichTextComponentResolver, RichTextComponentProps, RichTextRendererComponent, SystemRenderConfig, SystemRenderFunction, UniformComponent, UniformComponentContextValue, UniformComponentProps, UniformComposition, UniformCompositionProps, UniformRichText, UniformRichTextNode, UniformRichTextNodeProps, UniformRichTextProps, UniformSlot, UniformSlotProps, UniformText, UniformTextProps, UseCompositionEventEffectOptions, UseUniformContextualEditingProps, UseUniformContextualEditingStateProps, componentStore, componentStoreResolver, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
396
+ export { ComponentProps, ComponentStore, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, RenderComponentResolver, RenderRichTextComponentResolver, RichTextComponentProps, RichTextRendererComponent, SystemRenderConfig, SystemRenderFunction, UniformComponent, UniformComponentContextValue, UniformComponentProps, UniformComposition, UniformCompositionProps, UniformRichText, UniformRichTextNode, UniformRichTextNodeProps, UniformRichTextProps, UniformSlot, UniformSlotProps, UniformText, UniformTextProps, UseCompositionEventEffectOptions, UseUniformContextualEditingProps, UseUniformContextualEditingStateProps, componentStore, componentStoreResolver, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };