@uniformdev/canvas-react 18.33.1-alpha.7 → 18.34.0

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.ts CHANGED
@@ -69,11 +69,130 @@ type UniformComponentContextValue = {
69
69
  declare function useUniformCurrentComponent(): UniformComponentContextValue;
70
70
  /**
71
71
  * Allows the rendering of a Canvas component instance (root or not), and its children if it has any.
72
- * Note that the actual rendering happens inside `<UniformSlot />`, this component only provides the services needed to achieve that.
72
+ * Note that the actual rendering happens inside `<Slot />`, this component only provides the services needed to achieve that.
73
73
  * This component is used internally by `<UniformComposition />`, which you should use in most cases.
74
74
  */
75
75
  declare function UniformComponent<TRenderProps = unknown>({ data, resolveRenderer, children, behaviorTracking, }: UniformComponentProps<TRenderProps>): JSX.Element | null;
76
76
 
77
+ /** @deprecated use `createUniformApiEnhancer` instead */
78
+ declare const createApiEnhancer: ({ apiUrl }: {
79
+ apiUrl: string;
80
+ }) => (message: UpdateCompositionMessage) => Promise<{
81
+ type: string;
82
+ parameters?: {
83
+ [key: string]: {
84
+ value: unknown;
85
+ type: string;
86
+ connectedData?: {
87
+ pointer: string;
88
+ syntax: "jptr";
89
+ } | undefined;
90
+ };
91
+ } | undefined;
92
+ variant?: string | undefined;
93
+ projectMapNodes?: {
94
+ id: string;
95
+ path: string;
96
+ projectMapId: string;
97
+ }[] | undefined;
98
+ slots?: {
99
+ [key: string]: {
100
+ type: string;
101
+ parameters?: {
102
+ [key: string]: {
103
+ value: unknown;
104
+ type: string;
105
+ connectedData?: {
106
+ pointer: string;
107
+ syntax: "jptr";
108
+ } | undefined;
109
+ };
110
+ } | undefined;
111
+ variant?: string | undefined;
112
+ slots?: {
113
+ [key: string]: any[];
114
+ } | undefined;
115
+ _id?: string | undefined;
116
+ _pattern?: string | undefined;
117
+ _dataResources?: {
118
+ [key: string]: {
119
+ type: string;
120
+ isPatternParameter?: boolean | undefined;
121
+ ignorePatternParameterDefault?: boolean | undefined;
122
+ variables?: {
123
+ [key: string]: string;
124
+ } | undefined;
125
+ };
126
+ } | undefined;
127
+ _patternDataResources?: {
128
+ [key: string]: {
129
+ type: string;
130
+ isPatternParameter?: boolean | undefined;
131
+ ignorePatternParameterDefault?: boolean | undefined;
132
+ variables?: {
133
+ [key: string]: string;
134
+ } | undefined;
135
+ };
136
+ } | undefined;
137
+ _patternError?: "NOTFOUND" | "CYCLIC" | undefined;
138
+ _overrides?: {
139
+ [key: string]: {
140
+ parameters?: {
141
+ [key: string]: {
142
+ value: unknown;
143
+ type: string;
144
+ connectedData?: {
145
+ pointer: string;
146
+ syntax: "jptr";
147
+ } | undefined;
148
+ };
149
+ } | undefined;
150
+ variant?: string | undefined;
151
+ };
152
+ } | undefined;
153
+ _overridability?: {
154
+ parameters?: {
155
+ [key: string]: "yes" | "no";
156
+ } | undefined;
157
+ variants?: boolean | undefined;
158
+ } | undefined;
159
+ }[];
160
+ } | undefined;
161
+ _id: string;
162
+ _slug?: string | null | undefined;
163
+ _name: string;
164
+ _dataResources?: {
165
+ [key: string]: {
166
+ type: string;
167
+ isPatternParameter?: boolean | undefined;
168
+ ignorePatternParameterDefault?: boolean | undefined;
169
+ variables?: {
170
+ [key: string]: string;
171
+ } | undefined;
172
+ };
173
+ } | undefined;
174
+ _overrides?: {
175
+ [key: string]: {
176
+ parameters?: {
177
+ [key: string]: {
178
+ value: unknown;
179
+ type: string;
180
+ connectedData?: {
181
+ pointer: string;
182
+ syntax: "jptr";
183
+ } | undefined;
184
+ };
185
+ } | undefined;
186
+ variant?: string | undefined;
187
+ };
188
+ } | undefined;
189
+ _overridability?: {
190
+ parameters?: {
191
+ [key: string]: "yes" | "no";
192
+ } | undefined;
193
+ variants?: boolean | undefined;
194
+ } | undefined;
195
+ }>;
77
196
  type UseUniformContextualEditingProps = {
78
197
  initialCompositionValue?: RootComponentInstance;
79
198
  /**
@@ -96,7 +215,6 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
96
215
  connectedData?: {
97
216
  pointer: string;
98
217
  syntax: "jptr";
99
- required?: boolean | undefined;
100
218
  } | undefined;
101
219
  };
102
220
  } | undefined;
@@ -116,7 +234,6 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
116
234
  connectedData?: {
117
235
  pointer: string;
118
236
  syntax: "jptr";
119
- required?: boolean | undefined;
120
237
  } | undefined;
121
238
  };
122
239
  } | undefined;
@@ -156,7 +273,6 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
156
273
  connectedData?: {
157
274
  pointer: string;
158
275
  syntax: "jptr";
159
- required?: boolean | undefined;
160
276
  } | undefined;
161
277
  };
162
278
  } | undefined;
@@ -193,7 +309,6 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
193
309
  connectedData?: {
194
310
  pointer: string;
195
311
  syntax: "jptr";
196
- required?: boolean | undefined;
197
312
  } | undefined;
198
313
  };
199
314
  } | undefined;
@@ -207,7 +322,130 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
207
322
  variants?: boolean | undefined;
208
323
  } | undefined;
209
324
  } | undefined;
325
+ isContextualEditing: boolean;
326
+ };
327
+ /** @deprecated use useUniformContextualEditing instead */
328
+ declare const useContextualEditing: ({ initialCompositionValue, enhance, }: UseUniformContextualEditingProps) => {
329
+ composition: {
330
+ type: string;
331
+ parameters?: {
332
+ [key: string]: {
333
+ value: unknown;
334
+ type: string;
335
+ connectedData?: {
336
+ pointer: string;
337
+ syntax: "jptr";
338
+ } | undefined;
339
+ };
340
+ } | undefined;
341
+ variant?: string | undefined;
342
+ projectMapNodes?: {
343
+ id: string;
344
+ path: string;
345
+ projectMapId: string;
346
+ }[] | undefined;
347
+ slots?: {
348
+ [key: string]: {
349
+ type: string;
350
+ parameters?: {
351
+ [key: string]: {
352
+ value: unknown;
353
+ type: string;
354
+ connectedData?: {
355
+ pointer: string;
356
+ syntax: "jptr";
357
+ } | undefined;
358
+ };
359
+ } | undefined;
360
+ variant?: string | undefined;
361
+ slots?: {
362
+ [key: string]: any[];
363
+ } | undefined;
364
+ _id?: string | undefined;
365
+ _pattern?: string | undefined;
366
+ _dataResources?: {
367
+ [key: string]: {
368
+ type: string;
369
+ isPatternParameter?: boolean | undefined;
370
+ ignorePatternParameterDefault?: boolean | undefined;
371
+ variables?: {
372
+ [key: string]: string;
373
+ } | undefined;
374
+ };
375
+ } | undefined;
376
+ _patternDataResources?: {
377
+ [key: string]: {
378
+ type: string;
379
+ isPatternParameter?: boolean | undefined;
380
+ ignorePatternParameterDefault?: boolean | undefined;
381
+ variables?: {
382
+ [key: string]: string;
383
+ } | undefined;
384
+ };
385
+ } | undefined;
386
+ _patternError?: "NOTFOUND" | "CYCLIC" | undefined;
387
+ _overrides?: {
388
+ [key: string]: {
389
+ parameters?: {
390
+ [key: string]: {
391
+ value: unknown;
392
+ type: string;
393
+ connectedData?: {
394
+ pointer: string;
395
+ syntax: "jptr";
396
+ } | undefined;
397
+ };
398
+ } | undefined;
399
+ variant?: string | undefined;
400
+ };
401
+ } | undefined;
402
+ _overridability?: {
403
+ parameters?: {
404
+ [key: string]: "yes" | "no";
405
+ } | undefined;
406
+ variants?: boolean | undefined;
407
+ } | undefined;
408
+ }[];
409
+ } | undefined;
410
+ _id: string;
411
+ _slug?: string | null | undefined;
412
+ _name: string;
413
+ _dataResources?: {
414
+ [key: string]: {
415
+ type: string;
416
+ isPatternParameter?: boolean | undefined;
417
+ ignorePatternParameterDefault?: boolean | undefined;
418
+ variables?: {
419
+ [key: string]: string;
420
+ } | undefined;
421
+ };
422
+ } | undefined;
423
+ _overrides?: {
424
+ [key: string]: {
425
+ parameters?: {
426
+ [key: string]: {
427
+ value: unknown;
428
+ type: string;
429
+ connectedData?: {
430
+ pointer: string;
431
+ syntax: "jptr";
432
+ } | undefined;
433
+ };
434
+ } | undefined;
435
+ variant?: string | undefined;
436
+ };
437
+ } | undefined;
438
+ _overridability?: {
439
+ parameters?: {
440
+ [key: string]: "yes" | "no";
441
+ } | undefined;
442
+ variants?: boolean | undefined;
443
+ } | undefined;
444
+ } | undefined;
445
+ isContextualEditing: boolean;
210
446
  };
447
+ /** @deprecated use UseUniformContextualEditingProps instead */
448
+ type UseContextualEditingProps = UseUniformContextualEditingProps;
211
449
 
212
450
  type UniformCompositionProps<TRenderProps = unknown> = UniformComponentProps<TRenderProps> & {
213
451
  /** The composition data */
@@ -218,6 +456,7 @@ type UniformCompositionContextValue = {
218
456
  data: UniformCompositionProps['data'] | undefined;
219
457
  resolveRenderer?: UniformCompositionProps['resolveRenderer'];
220
458
  behaviorTracking?: UniformCompositionProps['behaviorTracking'];
459
+ isContextualEditing: boolean;
221
460
  };
222
461
  /**
223
462
  * Gets the data of the closest `<UniformComposition />` ancestor.
@@ -229,6 +468,12 @@ declare function useUniformCurrentComposition(): UniformCompositionContextValue;
229
468
  * It also takes care of enabling [Contextual Editing](https://docs.uniform.app/capabilities/composition/contextual-editing).
230
469
  */
231
470
  declare function UniformComposition<TRenderProps = unknown>({ data, behaviorTracking, children, resolveRenderer, contextualEditingEnhancer, }: UniformCompositionProps<TRenderProps>): JSX.Element;
471
+ /** @deprecated use `useUniformCurrentComposition` instead */
472
+ declare const useComposition: typeof useUniformCurrentComposition;
473
+ /** @deprecated use `UniformComposition` instead */
474
+ declare const Composition: typeof UniformComposition;
475
+ /** @deprecated use `UniformCompositionProps` instead */
476
+ type CompositionProps<TRenderProps = unknown> = UniformCompositionProps<TRenderProps>;
232
477
 
233
478
  type CustomSlotChildRenderFunc = (options: {
234
479
  child: ReactNode;
@@ -254,6 +499,10 @@ type UniformSlotProps<TSlotNames extends string> = {
254
499
  };
255
500
  /** Renders a named Slot within a Composition. */
256
501
  declare function UniformSlot<TSlotNames extends string = string>({ name, resolveRenderer, children, emptyPlaceholder, }: UniformSlotProps<TSlotNames>): JSX.Element | null;
502
+ /** @deprecated use `UniformSlotProps` instead */
503
+ type SlotProps<TSlotNames extends string> = UniformSlotProps<TSlotNames>;
504
+ /** @deprecated use `UniformSlot` instead */
505
+ declare const Slot: typeof UniformSlot;
257
506
 
258
507
  type UseCompositionEventEffectOptions = Omit<Partial<SubscribeToCompositionOptions>, 'callback'> & {
259
508
  enabled: boolean;
@@ -278,4 +527,4 @@ declare const createComponentStoreResolver: (options: {
278
527
  defaultComponent?: React$1.ComponentType<ComponentProps<any>>;
279
528
  }) => RenderComponentResolver;
280
529
 
281
- export { ComponentProps, ComponentStore, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, RenderComponentResolver, SystemRenderConfig, SystemRenderFunction, UniformComponent, UniformComponentContextValue, UniformComponentProps, UniformComposition, UniformCompositionProps, UniformSlot, UniformSlotProps, UseCompositionEventEffectOptions, UseUniformContextualEditingProps, componentStore, componentStoreResolver, createComponentStore, createComponentStoreResolver, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformCurrentComponent, useUniformCurrentComposition };
530
+ export { ComponentProps, ComponentStore, Composition, CompositionProps, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, RenderComponentResolver, Slot, SlotProps, SystemRenderConfig, SystemRenderFunction, UniformComponent, UniformComponentContextValue, UniformComponentProps, UniformComposition, UniformCompositionProps, UniformSlot, UniformSlotProps, UseCompositionEventEffectOptions, UseContextualEditingProps, UseUniformContextualEditingProps, componentStore, componentStoreResolver, createApiEnhancer, createComponentStore, createComponentStoreResolver, registerUniformComponent, useComposition, useCompositionEventEffect, useContextualEditing, useUniformContextualEditing, useUniformCurrentComponent, useUniformCurrentComposition };