@uniformdev/canvas-react 19.135.1-alpha.10 → 19.135.1-alpha.11

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/index.d.mts CHANGED
@@ -10,7 +10,7 @@ import { RichTextNode } from '@uniformdev/richtext';
10
10
  * all enhancers have been applied.
11
11
  */
12
12
  type ComponentProps<TProps = unknown> = TProps & {
13
- component: ComponentInstance;
13
+ component: ComponentInstance | RootComponentInstance;
14
14
  };
15
15
  /**
16
16
  * Function that maps a Canvas component instance to its React component to render it.
@@ -110,36 +110,64 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
110
110
  connectedData?: {
111
111
  pointer: string;
112
112
  syntax: "jptr";
113
- failureAction?: "a" | "p" | "t" | "c" | undefined;
114
- failureLogLevel?: "i" | "e" | "w" | undefined;
115
- failureDefault?: string | undefined;
116
- } | undefined;
113
+ failureAction?: "t" | "p" | "c" | "a";
114
+ failureLogLevel?: "e" | "w" | "i";
115
+ failureDefault?: string;
116
+ };
117
117
  locales?: {
118
118
  [key: string]: unknown;
119
- } | undefined;
119
+ };
120
+ conditions?: {
121
+ when: {
122
+ op?: "&" | "|";
123
+ clauses: ({
124
+ rule: string;
125
+ source?: string;
126
+ op: string;
127
+ value: string | string[];
128
+ } | any)[];
129
+ };
130
+ value: unknown;
131
+ id: number;
132
+ }[];
133
+ localesConditions?: {
134
+ [key: string]: {
135
+ when: {
136
+ op?: "&" | "|";
137
+ clauses: ({
138
+ rule: string;
139
+ source?: string;
140
+ op: string;
141
+ value: string | string[];
142
+ } | any)[];
143
+ };
144
+ value: unknown;
145
+ id: number;
146
+ }[];
147
+ };
120
148
  };
121
- } | undefined;
122
- variant?: string | undefined;
149
+ };
150
+ variant?: string;
123
151
  projectMapNodes?: {
124
152
  id: string;
125
153
  path: string;
126
154
  projectMapId: string;
127
155
  data?: {
128
- isSearchHit?: boolean | undefined;
156
+ isSearchHit?: boolean;
129
157
  queryStrings?: {
130
158
  name: string;
131
- value?: string | undefined;
132
- helpText?: string | undefined;
133
- }[] | undefined;
134
- previewValue?: string | undefined;
135
- } | undefined;
159
+ value?: string;
160
+ helpText?: string;
161
+ }[];
162
+ previewValue?: string;
163
+ };
136
164
  locales?: {
137
165
  [key: string]: {
138
166
  path: string;
139
167
  inherited: boolean;
140
168
  };
141
- } | undefined;
142
- }[] | undefined;
169
+ };
170
+ }[];
143
171
  slots?: {
144
172
  [key: string]: {
145
173
  type: string;
@@ -150,42 +178,72 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
150
178
  connectedData?: {
151
179
  pointer: string;
152
180
  syntax: "jptr";
153
- failureAction?: "a" | "p" | "t" | "c" | undefined;
154
- failureLogLevel?: "i" | "e" | "w" | undefined;
155
- failureDefault?: string | undefined;
156
- } | undefined;
181
+ failureAction?: "t" | "p" | "c" | "a";
182
+ failureLogLevel?: "e" | "w" | "i";
183
+ failureDefault?: string;
184
+ };
157
185
  locales?: {
158
186
  [key: string]: unknown;
159
- } | undefined;
187
+ };
188
+ conditions?: {
189
+ when: {
190
+ op?: "&" | "|";
191
+ clauses: ({
192
+ rule: string;
193
+ source?: string;
194
+ op: string;
195
+ value: string | string[];
196
+ } | any)[];
197
+ };
198
+ value: unknown;
199
+ id: number;
200
+ }[];
201
+ localesConditions?: {
202
+ [key: string]: {
203
+ when: {
204
+ op?: "&" | "|";
205
+ clauses: ({
206
+ rule: string;
207
+ source?: string;
208
+ op: string;
209
+ value: string | string[];
210
+ } | any)[];
211
+ };
212
+ value: unknown;
213
+ id: number;
214
+ }[];
215
+ };
160
216
  };
161
- } | undefined;
162
- variant?: string | undefined;
217
+ };
218
+ variant?: string;
163
219
  slots?: {
164
220
  [key: string]: any[];
165
- } | undefined;
166
- _id?: string | undefined;
167
- _pattern?: string | undefined;
221
+ };
222
+ _id?: string;
223
+ _pattern?: string;
168
224
  _dataResources?: {
169
225
  [key: string]: {
170
226
  type: string;
171
- isPatternParameter?: boolean | undefined;
172
- ignorePatternParameterDefault?: boolean | undefined;
227
+ isPatternParameter?: boolean;
228
+ ignorePatternParameterDefault?: boolean;
229
+ optionalPatternParameter?: boolean;
173
230
  variables?: {
174
231
  [key: string]: string;
175
- } | undefined;
232
+ };
176
233
  };
177
- } | undefined;
234
+ };
178
235
  _patternDataResources?: {
179
236
  [key: string]: {
180
237
  type: string;
181
- isPatternParameter?: boolean | undefined;
182
- ignorePatternParameterDefault?: boolean | undefined;
238
+ isPatternParameter?: boolean;
239
+ ignorePatternParameterDefault?: boolean;
240
+ optionalPatternParameter?: boolean;
183
241
  variables?: {
184
242
  [key: string]: string;
185
- } | undefined;
243
+ };
186
244
  };
187
- } | undefined;
188
- _patternError?: "NOTFOUND" | "CYCLIC" | undefined;
245
+ };
246
+ _patternError?: "NOTFOUND" | "CYCLIC";
189
247
  _overrides?: {
190
248
  [key: string]: {
191
249
  parameters?: {
@@ -195,60 +253,90 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
195
253
  connectedData?: {
196
254
  pointer: string;
197
255
  syntax: "jptr";
198
- failureAction?: "a" | "p" | "t" | "c" | undefined;
199
- failureLogLevel?: "i" | "e" | "w" | undefined;
200
- failureDefault?: string | undefined;
201
- } | undefined;
256
+ failureAction?: "t" | "p" | "c" | "a";
257
+ failureLogLevel?: "e" | "w" | "i";
258
+ failureDefault?: string;
259
+ };
202
260
  locales?: {
203
261
  [key: string]: unknown;
204
- } | undefined;
262
+ };
263
+ conditions?: {
264
+ when: {
265
+ op?: "&" | "|";
266
+ clauses: ({
267
+ rule: string;
268
+ source?: string;
269
+ op: string;
270
+ value: string | string[];
271
+ } | any)[];
272
+ };
273
+ value: unknown;
274
+ id: number;
275
+ }[];
276
+ localesConditions?: {
277
+ [key: string]: {
278
+ when: {
279
+ op?: "&" | "|";
280
+ clauses: ({
281
+ rule: string;
282
+ source?: string;
283
+ op: string;
284
+ value: string | string[];
285
+ } | any)[];
286
+ };
287
+ value: unknown;
288
+ id: number;
289
+ }[];
290
+ };
205
291
  };
206
- } | undefined;
292
+ };
207
293
  slots?: {
208
294
  [key: string]: any[];
209
- } | undefined;
210
- variant?: string | undefined;
295
+ };
296
+ variant?: string;
211
297
  };
212
- } | undefined;
298
+ };
213
299
  _overridability?: {
214
300
  parameters?: {
215
301
  [key: string]: "yes" | "no";
216
- } | undefined;
217
- variants?: boolean | undefined;
218
- hideLockedParameters?: boolean | undefined;
219
- } | undefined;
220
- _locales?: string[] | undefined;
302
+ };
303
+ variants?: boolean;
304
+ hideLockedParameters?: boolean;
305
+ };
306
+ _locales?: string[];
221
307
  }[];
222
- } | undefined;
308
+ };
223
309
  _id: string;
224
- _slug?: string | null | undefined;
310
+ _slug?: string | null;
225
311
  _name: string;
226
- _author?: string | undefined;
227
- _authorSubject?: string | undefined;
228
- _creator?: string | undefined;
229
- _creatorSubject?: string | undefined;
230
- _pattern?: string | undefined;
312
+ _author?: string;
313
+ _authorSubject?: string;
314
+ _creator?: string;
315
+ _creatorSubject?: string;
316
+ _pattern?: string;
231
317
  _patternDataResources?: {
232
318
  [key: string]: {
233
319
  type: string;
234
- isPatternParameter?: boolean | undefined;
235
- ignorePatternParameterDefault?: boolean | undefined;
320
+ isPatternParameter?: boolean;
321
+ ignorePatternParameterDefault?: boolean;
322
+ optionalPatternParameter?: boolean;
236
323
  variables?: {
237
324
  [key: string]: string;
238
- } | undefined;
325
+ };
239
326
  };
240
- } | undefined;
327
+ };
241
328
  _dataResources?: {
242
329
  [key: string]: {
243
330
  type: string;
244
- isPatternParameter?: boolean | undefined;
245
- ignorePatternParameterDefault?: boolean | undefined;
331
+ isPatternParameter?: boolean;
332
+ ignorePatternParameterDefault?: boolean;
333
+ optionalPatternParameter?: boolean;
246
334
  variables?: {
247
335
  [key: string]: string;
248
- } | undefined;
336
+ };
249
337
  };
250
- } | undefined;
251
- _patternError?: "NOTFOUND" | "CYCLIC" | undefined;
338
+ };
339
+ _patternError?: "NOTFOUND" | "CYCLIC";
252
340
  _overrides?: {
253
341
  [key: string]: {
254
342
  parameters?: {
@@ -258,29 +346,57 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
258
346
  connectedData?: {
259
347
  pointer: string;
260
348
  syntax: "jptr";
261
- failureAction?: "a" | "p" | "t" | "c" | undefined;
262
- failureLogLevel?: "i" | "e" | "w" | undefined;
263
- failureDefault?: string | undefined;
264
- } | undefined;
349
+ failureAction?: "t" | "p" | "c" | "a";
350
+ failureLogLevel?: "e" | "w" | "i";
351
+ failureDefault?: string;
352
+ };
265
353
  locales?: {
266
354
  [key: string]: unknown;
267
- } | undefined;
355
+ };
356
+ conditions?: {
357
+ when: {
358
+ op?: "&" | "|";
359
+ clauses: ({
360
+ rule: string;
361
+ source?: string;
362
+ op: string;
363
+ value: string | string[];
364
+ } | any)[];
365
+ };
366
+ value: unknown;
367
+ id: number;
368
+ }[];
369
+ localesConditions?: {
370
+ [key: string]: {
371
+ when: {
372
+ op?: "&" | "|";
373
+ clauses: ({
374
+ rule: string;
375
+ source?: string;
376
+ op: string;
377
+ value: string | string[];
378
+ } | any)[];
379
+ };
380
+ value: unknown;
381
+ id: number;
382
+ }[];
383
+ };
268
384
  };
269
- } | undefined;
385
+ };
270
386
  slots?: {
271
387
  [key: string]: any[];
272
- } | undefined;
273
- variant?: string | undefined;
388
+ };
389
+ variant?: string;
274
390
  };
275
- } | undefined;
391
+ };
276
392
  _overridability?: {
277
393
  parameters?: {
278
394
  [key: string]: "yes" | "no";
279
- } | undefined;
280
- variants?: boolean | undefined;
281
- hideLockedParameters?: boolean | undefined;
282
- } | undefined;
283
- _locales?: string[] | undefined;
395
+ };
396
+ variants?: boolean;
397
+ hideLockedParameters?: boolean;
398
+ };
399
+ _locales?: string[];
284
400
  } | undefined;
285
401
  isContextualEditing: boolean;
286
402
  };
@@ -309,24 +425,26 @@ declare function useUniformCurrentComposition(): UniformCompositionContextValue;
309
425
  declare function UniformComposition<TRenderProps = unknown>({ data, behaviorTracking, children, resolveRenderer, contextualEditingEnhancer, contextualEditingDefaultPlaceholder, }: UniformCompositionProps<TRenderProps>): React$1.JSX.Element;
310
426
 
311
427
  type UniformPlaygroundDecorator = (props: {
312
- /** The rendered component instance, needs to wrapped and rendered by the decorator */
428
+ /** The rendered component instance, needs to be wrapped and rendered by the decorator */
313
429
  children: React$1.ReactNode;
314
430
  /** The component instance data */
315
431
  data: ComponentInstance | RootComponentInstance;
316
432
  }) => React$1.ReactElement;
317
433
  type UniformPlaygroundProps = {
318
434
  /**
319
- * Allows wrapping the playground in custom components.
320
- * Useful to customize the playground to allow previewing the components in realistic scenarios
321
- * (e.g. different background color, different parent size)
435
+ * Allows wrapping the playground in custom layouts.
436
+ * Useful to customize the playground to allow previewing the patterns in realistic scenarios
437
+ * (e.g. wrap the pattern in a specific layout, show a background color selector, parent size selector, etc.)
322
438
  * @deprecated This feature is not stable yet and might be changed or removed in a minor release. Do not use it in production environments.
323
439
  */
324
440
  decorators?: UniformPlaygroundDecorator[];
325
- } & Omit<UniformCompositionProps, 'data'>;
441
+ /** @deprecated This prop is not supported anymore. */
442
+ children?: ReactNode;
443
+ } & Omit<UniformCompositionProps, 'data' | 'children'>;
326
444
  /**
327
- * Playground where you can freely live preview your components and pattern.
445
+ * Playground where you can freely live preview your components and patterns.
328
446
  */
329
- declare const UniformPlayground: ({ resolveRenderer, decorators, contextualEditingEnhancer, behaviorTracking, contextualEditingDefaultPlaceholder, children, }: UniformPlaygroundProps) => React$1.JSX.Element;
447
+ declare const UniformPlayground: ({ resolveRenderer, decorators, contextualEditingEnhancer, behaviorTracking, contextualEditingDefaultPlaceholder, }: UniformPlaygroundProps) => React$1.JSX.Element;
330
448
 
331
449
  type RichTextComponentProps<TNode extends RichTextNode = RichTextNode> = {
332
450
  node: TNode;
@@ -351,6 +469,14 @@ type UniformRichTextProps = {
351
469
  * for rendering a rich text node
352
470
  */
353
471
  resolveRichTextRenderer?: RenderRichTextComponentResolver;
472
+ /**
473
+ * Sets the value to show in Canvas editor when the parameter value is empty.
474
+ * Can be a static string, or a function to generate the placeholder out of parameter info.
475
+ * @default undefined
476
+ */
477
+ placeholder?: string | ((parameter: {
478
+ id: string;
479
+ }) => string | undefined);
354
480
  } & Omit<React$1.HTMLAttributes<HTMLDivElement>, 'children'>;
355
481
  /**
356
482
  * Adds rendering support for Uniform Rich Text parameters
@@ -360,14 +486,22 @@ declare const UniformRichText: React$1.ForwardRefExoticComponent<{
360
486
  * The name of the HTML tag to render.
361
487
  * @default "div"
362
488
  */
363
- as?: React$1.ElementType<any> | undefined;
489
+ as?: React$1.ElementType;
364
490
  /** The ID of the parameter. */
365
491
  parameterId: string;
366
492
  /**
367
493
  * A function which can provide a custom react component
368
494
  * for rendering a rich text node
369
495
  */
370
- resolveRichTextRenderer?: RenderRichTextComponentResolver | undefined;
496
+ resolveRichTextRenderer?: RenderRichTextComponentResolver;
497
+ /**
498
+ * Sets the value to show in Canvas editor when the parameter value is empty.
499
+ * Can be a static string, or a function to generate the placeholder out of parameter info.
500
+ * @default undefined
501
+ */
502
+ placeholder?: string | ((parameter: {
503
+ id: string;
504
+ }) => string | undefined);
371
505
  } & Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & React$1.RefAttributes<unknown>>;
372
506
 
373
507
  type UniformRichTextNodeProps = {
@@ -475,7 +609,7 @@ declare const useUniformContextualEditingState: ({ global, }?: UseUniformContext
475
609
  declare const componentStore: ComponentStore;
476
610
  declare const registerUniformComponent: ({ type, variantId, component, }: {
477
611
  type: string;
478
- variantId?: string | undefined;
612
+ variantId?: string;
479
613
  component: React.ComponentType<ComponentProps<any>>;
480
614
  }) => void;
481
615
  declare const componentStoreResolver: RenderComponentResolver;