@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 +223 -89
- package/dist/index.d.ts +223 -89
- package/dist/index.esm.js +106 -55
- package/dist/index.js +193 -143
- package/dist/index.mjs +106 -55
- package/package.json +11 -9
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?: "
|
|
114
|
-
failureLogLevel?: "
|
|
115
|
-
failureDefault?: string
|
|
116
|
-
}
|
|
113
|
+
failureAction?: "t" | "p" | "c" | "a";
|
|
114
|
+
failureLogLevel?: "e" | "w" | "i";
|
|
115
|
+
failureDefault?: string;
|
|
116
|
+
};
|
|
117
117
|
locales?: {
|
|
118
118
|
[key: string]: unknown;
|
|
119
|
-
}
|
|
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
|
-
}
|
|
122
|
-
variant?: string
|
|
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
|
|
156
|
+
isSearchHit?: boolean;
|
|
129
157
|
queryStrings?: {
|
|
130
158
|
name: string;
|
|
131
|
-
value?: string
|
|
132
|
-
helpText?: string
|
|
133
|
-
}[]
|
|
134
|
-
previewValue?: string
|
|
135
|
-
}
|
|
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
|
-
}
|
|
142
|
-
}[]
|
|
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?: "
|
|
154
|
-
failureLogLevel?: "
|
|
155
|
-
failureDefault?: string
|
|
156
|
-
}
|
|
181
|
+
failureAction?: "t" | "p" | "c" | "a";
|
|
182
|
+
failureLogLevel?: "e" | "w" | "i";
|
|
183
|
+
failureDefault?: string;
|
|
184
|
+
};
|
|
157
185
|
locales?: {
|
|
158
186
|
[key: string]: unknown;
|
|
159
|
-
}
|
|
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
|
-
}
|
|
162
|
-
variant?: string
|
|
217
|
+
};
|
|
218
|
+
variant?: string;
|
|
163
219
|
slots?: {
|
|
164
220
|
[key: string]: any[];
|
|
165
|
-
}
|
|
166
|
-
_id?: string
|
|
167
|
-
_pattern?: string
|
|
221
|
+
};
|
|
222
|
+
_id?: string;
|
|
223
|
+
_pattern?: string;
|
|
168
224
|
_dataResources?: {
|
|
169
225
|
[key: string]: {
|
|
170
226
|
type: string;
|
|
171
|
-
isPatternParameter?: boolean
|
|
172
|
-
ignorePatternParameterDefault?: boolean
|
|
227
|
+
isPatternParameter?: boolean;
|
|
228
|
+
ignorePatternParameterDefault?: boolean;
|
|
229
|
+
optionalPatternParameter?: boolean;
|
|
173
230
|
variables?: {
|
|
174
231
|
[key: string]: string;
|
|
175
|
-
}
|
|
232
|
+
};
|
|
176
233
|
};
|
|
177
|
-
}
|
|
234
|
+
};
|
|
178
235
|
_patternDataResources?: {
|
|
179
236
|
[key: string]: {
|
|
180
237
|
type: string;
|
|
181
|
-
isPatternParameter?: boolean
|
|
182
|
-
ignorePatternParameterDefault?: boolean
|
|
238
|
+
isPatternParameter?: boolean;
|
|
239
|
+
ignorePatternParameterDefault?: boolean;
|
|
240
|
+
optionalPatternParameter?: boolean;
|
|
183
241
|
variables?: {
|
|
184
242
|
[key: string]: string;
|
|
185
|
-
}
|
|
243
|
+
};
|
|
186
244
|
};
|
|
187
|
-
}
|
|
188
|
-
_patternError?: "NOTFOUND" | "CYCLIC"
|
|
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?: "
|
|
199
|
-
failureLogLevel?: "
|
|
200
|
-
failureDefault?: string
|
|
201
|
-
}
|
|
256
|
+
failureAction?: "t" | "p" | "c" | "a";
|
|
257
|
+
failureLogLevel?: "e" | "w" | "i";
|
|
258
|
+
failureDefault?: string;
|
|
259
|
+
};
|
|
202
260
|
locales?: {
|
|
203
261
|
[key: string]: unknown;
|
|
204
|
-
}
|
|
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
|
-
}
|
|
292
|
+
};
|
|
207
293
|
slots?: {
|
|
208
294
|
[key: string]: any[];
|
|
209
|
-
}
|
|
210
|
-
variant?: string
|
|
295
|
+
};
|
|
296
|
+
variant?: string;
|
|
211
297
|
};
|
|
212
|
-
}
|
|
298
|
+
};
|
|
213
299
|
_overridability?: {
|
|
214
300
|
parameters?: {
|
|
215
301
|
[key: string]: "yes" | "no";
|
|
216
|
-
}
|
|
217
|
-
variants?: boolean
|
|
218
|
-
hideLockedParameters?: boolean
|
|
219
|
-
}
|
|
220
|
-
_locales?: string[]
|
|
302
|
+
};
|
|
303
|
+
variants?: boolean;
|
|
304
|
+
hideLockedParameters?: boolean;
|
|
305
|
+
};
|
|
306
|
+
_locales?: string[];
|
|
221
307
|
}[];
|
|
222
|
-
}
|
|
308
|
+
};
|
|
223
309
|
_id: string;
|
|
224
|
-
_slug?: string | null
|
|
310
|
+
_slug?: string | null;
|
|
225
311
|
_name: string;
|
|
226
|
-
_author?: string
|
|
227
|
-
_authorSubject?: string
|
|
228
|
-
_creator?: string
|
|
229
|
-
_creatorSubject?: string
|
|
230
|
-
_pattern?: string
|
|
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
|
|
235
|
-
ignorePatternParameterDefault?: boolean
|
|
320
|
+
isPatternParameter?: boolean;
|
|
321
|
+
ignorePatternParameterDefault?: boolean;
|
|
322
|
+
optionalPatternParameter?: boolean;
|
|
236
323
|
variables?: {
|
|
237
324
|
[key: string]: string;
|
|
238
|
-
}
|
|
325
|
+
};
|
|
239
326
|
};
|
|
240
|
-
}
|
|
327
|
+
};
|
|
241
328
|
_dataResources?: {
|
|
242
329
|
[key: string]: {
|
|
243
330
|
type: string;
|
|
244
|
-
isPatternParameter?: boolean
|
|
245
|
-
ignorePatternParameterDefault?: boolean
|
|
331
|
+
isPatternParameter?: boolean;
|
|
332
|
+
ignorePatternParameterDefault?: boolean;
|
|
333
|
+
optionalPatternParameter?: boolean;
|
|
246
334
|
variables?: {
|
|
247
335
|
[key: string]: string;
|
|
248
|
-
}
|
|
336
|
+
};
|
|
249
337
|
};
|
|
250
|
-
}
|
|
251
|
-
_patternError?: "NOTFOUND" | "CYCLIC"
|
|
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?: "
|
|
262
|
-
failureLogLevel?: "
|
|
263
|
-
failureDefault?: string
|
|
264
|
-
}
|
|
349
|
+
failureAction?: "t" | "p" | "c" | "a";
|
|
350
|
+
failureLogLevel?: "e" | "w" | "i";
|
|
351
|
+
failureDefault?: string;
|
|
352
|
+
};
|
|
265
353
|
locales?: {
|
|
266
354
|
[key: string]: unknown;
|
|
267
|
-
}
|
|
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
|
-
}
|
|
385
|
+
};
|
|
270
386
|
slots?: {
|
|
271
387
|
[key: string]: any[];
|
|
272
|
-
}
|
|
273
|
-
variant?: string
|
|
388
|
+
};
|
|
389
|
+
variant?: string;
|
|
274
390
|
};
|
|
275
|
-
}
|
|
391
|
+
};
|
|
276
392
|
_overridability?: {
|
|
277
393
|
parameters?: {
|
|
278
394
|
[key: string]: "yes" | "no";
|
|
279
|
-
}
|
|
280
|
-
variants?: boolean
|
|
281
|
-
hideLockedParameters?: boolean
|
|
282
|
-
}
|
|
283
|
-
_locales?: string[]
|
|
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
|
|
320
|
-
* Useful to customize the playground to allow previewing the
|
|
321
|
-
* (e.g.
|
|
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
|
-
|
|
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
|
|
445
|
+
* Playground where you can freely live preview your components and patterns.
|
|
328
446
|
*/
|
|
329
|
-
declare const UniformPlayground: ({ resolveRenderer, decorators, contextualEditingEnhancer, behaviorTracking, contextualEditingDefaultPlaceholder,
|
|
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
|
|
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
|
|
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
|
|
612
|
+
variantId?: string;
|
|
479
613
|
component: React.ComponentType<ComponentProps<any>>;
|
|
480
614
|
}) => void;
|
|
481
615
|
declare const componentStoreResolver: RenderComponentResolver;
|