@uniformdev/canvas-react 19.61.1 → 19.62.1-alpha.127

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
@@ -1,7 +1,7 @@
1
1
  import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
2
- import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, SubscribeToCompositionOptions } from '@uniformdev/canvas';
2
+ import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, SubscribeToCompositionOptions, UpdateContextualEditingStateInternalMessage } from '@uniformdev/canvas';
3
3
  export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
4
- import { PureUniformTextProps } from './core.js';
4
+ import { P as PureUniformTextProps } from './PureUniformText-B3GAm6Dc.js';
5
5
  import { RichTextNode } from '@uniformdev/richtext';
6
6
 
7
7
  /**
@@ -31,6 +31,7 @@ type ComponentStore = {
31
31
  component: React.ComponentType<ComponentProps<any>>;
32
32
  }) => void;
33
33
  get: (type: string, variantId?: string) => React.ComponentType<ComponentProps<any>> | undefined;
34
+ getComponentsMap: () => Map<string, React.ComponentType<ComponentProps<any>>>;
34
35
  };
35
36
 
36
37
  /**
@@ -104,11 +105,17 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
104
105
  type: string;
105
106
  parameters?: {
106
107
  [key: string]: {
107
- value: unknown;
108
+ value?: unknown;
108
109
  type: string;
109
110
  connectedData?: {
110
111
  pointer: string;
111
112
  syntax: "jptr";
113
+ failureAction?: "a" | "p" | "t" | "c" | undefined;
114
+ failureLogLevel?: "i" | "e" | "w" | undefined;
115
+ failureDefault?: string | undefined;
116
+ } | undefined;
117
+ locales?: {
118
+ [key: string]: unknown;
112
119
  } | undefined;
113
120
  };
114
121
  } | undefined;
@@ -117,17 +124,38 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
117
124
  id: string;
118
125
  path: string;
119
126
  projectMapId: string;
127
+ data?: {
128
+ isSearchHit?: boolean | undefined;
129
+ queryStrings?: {
130
+ name: string;
131
+ value?: string | undefined;
132
+ helpText?: string | undefined;
133
+ }[] | undefined;
134
+ previewValue?: string | undefined;
135
+ } | undefined;
136
+ locales?: {
137
+ [key: string]: {
138
+ path: string;
139
+ inherited: boolean;
140
+ };
141
+ } | undefined;
120
142
  }[] | undefined;
121
143
  slots?: {
122
144
  [key: string]: {
123
145
  type: string;
124
146
  parameters?: {
125
147
  [key: string]: {
126
- value: unknown;
148
+ value?: unknown;
127
149
  type: string;
128
150
  connectedData?: {
129
151
  pointer: string;
130
152
  syntax: "jptr";
153
+ failureAction?: "a" | "p" | "t" | "c" | undefined;
154
+ failureLogLevel?: "i" | "e" | "w" | undefined;
155
+ failureDefault?: string | undefined;
156
+ } | undefined;
157
+ locales?: {
158
+ [key: string]: unknown;
131
159
  } | undefined;
132
160
  };
133
161
  } | undefined;
@@ -162,14 +190,23 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
162
190
  [key: string]: {
163
191
  parameters?: {
164
192
  [key: string]: {
165
- value: unknown;
193
+ value?: unknown;
166
194
  type: string;
167
195
  connectedData?: {
168
196
  pointer: string;
169
197
  syntax: "jptr";
198
+ failureAction?: "a" | "p" | "t" | "c" | undefined;
199
+ failureLogLevel?: "i" | "e" | "w" | undefined;
200
+ failureDefault?: string | undefined;
201
+ } | undefined;
202
+ locales?: {
203
+ [key: string]: unknown;
170
204
  } | undefined;
171
205
  };
172
206
  } | undefined;
207
+ slots?: {
208
+ [key: string]: any[];
209
+ } | undefined;
173
210
  variant?: string | undefined;
174
211
  };
175
212
  } | undefined;
@@ -178,12 +215,25 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
178
215
  [key: string]: "yes" | "no";
179
216
  } | undefined;
180
217
  variants?: boolean | undefined;
218
+ hideLockedParameters?: boolean | undefined;
181
219
  } | undefined;
220
+ _locales?: string[] | undefined;
182
221
  }[];
183
222
  } | undefined;
184
223
  _id: string;
185
224
  _slug?: string | null | undefined;
186
225
  _name: string;
226
+ _pattern?: string | undefined;
227
+ _patternDataResources?: {
228
+ [key: string]: {
229
+ type: string;
230
+ isPatternParameter?: boolean | undefined;
231
+ ignorePatternParameterDefault?: boolean | undefined;
232
+ variables?: {
233
+ [key: string]: string;
234
+ } | undefined;
235
+ };
236
+ } | undefined;
187
237
  _dataResources?: {
188
238
  [key: string]: {
189
239
  type: string;
@@ -194,18 +244,28 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
194
244
  } | undefined;
195
245
  };
196
246
  } | undefined;
247
+ _patternError?: "NOTFOUND" | "CYCLIC" | undefined;
197
248
  _overrides?: {
198
249
  [key: string]: {
199
250
  parameters?: {
200
251
  [key: string]: {
201
- value: unknown;
252
+ value?: unknown;
202
253
  type: string;
203
254
  connectedData?: {
204
255
  pointer: string;
205
256
  syntax: "jptr";
257
+ failureAction?: "a" | "p" | "t" | "c" | undefined;
258
+ failureLogLevel?: "i" | "e" | "w" | undefined;
259
+ failureDefault?: string | undefined;
260
+ } | undefined;
261
+ locales?: {
262
+ [key: string]: unknown;
206
263
  } | undefined;
207
264
  };
208
265
  } | undefined;
266
+ slots?: {
267
+ [key: string]: any[];
268
+ } | undefined;
209
269
  variant?: string | undefined;
210
270
  };
211
271
  } | undefined;
@@ -214,7 +274,9 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
214
274
  [key: string]: "yes" | "no";
215
275
  } | undefined;
216
276
  variants?: boolean | undefined;
277
+ hideLockedParameters?: boolean | undefined;
217
278
  } | undefined;
279
+ _locales?: string[] | undefined;
218
280
  } | undefined;
219
281
  isContextualEditing: boolean;
220
282
  };
@@ -380,26 +442,31 @@ type UseUniformContextualEditingStateProps = {
380
442
  **/
381
443
  global?: boolean;
382
444
  };
445
+ type UseUniformContextualEditingStateReturnType = {
446
+ /**
447
+ * Returns `true` when the app is rendered inside Canvas editor. Regardless of which preview mode is currently selected ("editor" or "preview").
448
+ */
449
+ isContextualEditing: boolean;
450
+ /**
451
+ * A reference to the currently selected component in Canvas editor.
452
+ * Returns `undefined` if the selected component is not part of the current React component.
453
+ * Set the `global` option to `true` to get a reference of the selected component anywhere in the composition tree.
454
+ */
455
+ selectedComponentReference: UpdateContextualEditingStateInternalMessage['state']['selectedComponentReference'];
456
+ /**
457
+ * Returns the current preview mode in Canvas editor ("editor" or "preview").
458
+ * Returns `undefined` when the app is not rendered inside Canvas editor.
459
+ * Learn more about the preview modes: https://docs.uniform.app/docs/guides/composition/visual-editing#editing-and-preview-mode
460
+ * @deprecated this is an experimental property, it might receive breaking changes in minor releases ⚠️
461
+ */
462
+ previewMode: UpdateContextualEditingStateInternalMessage['state']['previewMode'] | undefined;
463
+ };
383
464
  /**
384
465
  * Returns the state of contextual editing, when the app is open inside Canvas Editor.
385
466
  * This hook can be used to improve the editing experience of your team.
386
467
  * For example: You can use `selectedComponentReference` to control which element to show inside a carousel or an accordion.
387
468
  */
388
- declare const useUniformContextualEditingState: ({ global, }?: UseUniformContextualEditingStateProps) => {
389
- isContextualEditing: boolean;
390
- selectedComponentReference: {
391
- id: string;
392
- slotName?: string | undefined;
393
- componentIndex?: number | undefined;
394
- totalComponents?: number | undefined;
395
- componentName?: string | undefined;
396
- componentTitle?: string | undefined;
397
- parentId?: string | undefined;
398
- parentType?: string | undefined;
399
- isLocalized?: boolean | undefined;
400
- isReadOnly?: boolean | undefined;
401
- } | undefined;
402
- };
469
+ declare const useUniformContextualEditingState: ({ global, }?: UseUniformContextualEditingStateProps) => UseUniformContextualEditingStateReturnType;
403
470
 
404
471
  declare const componentStore: ComponentStore;
405
472
  declare const registerUniformComponent: ({ type, variantId, component, }: {
@@ -417,4 +484,4 @@ declare const createComponentStoreResolver: (options: {
417
484
  defaultComponent?: React$1.ComponentType<ComponentProps<any>>;
418
485
  }) => RenderComponentResolver;
419
486
 
420
- export { ComponentProps, ComponentStore, CustomSlotChildRenderFunc, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, RenderComponentResolver, RenderRichTextComponentResolver, RichTextComponentProps, RichTextRendererComponent, SystemRenderConfig, SystemRenderFunction, UniformComponent, UniformComponentContextValue, UniformComponentProps, UniformComposition, UniformCompositionContext, UniformCompositionProps, UniformPlayground, UniformPlaygroundDecorator, UniformPlaygroundProps, UniformRichText, UniformRichTextNode, UniformRichTextNodeProps, UniformRichTextProps, UniformSlot, UniformSlotProps, UniformSlotWrapperComponentProps, UniformText, UniformTextProps, UseCompositionEventEffectOptions, UseUniformContextualEditingProps, UseUniformContextualEditingStateProps, componentStore, componentStoreResolver, convertComponentToProps, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
487
+ export { type ComponentProps, type ComponentStore, type CustomSlotChildRenderFunc, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, type RenderComponentResolver, type RenderRichTextComponentResolver, type RichTextComponentProps, type RichTextRendererComponent, type SystemRenderConfig, type SystemRenderFunction, UniformComponent, type UniformComponentContextValue, type UniformComponentProps, UniformComposition, UniformCompositionContext, type UniformCompositionProps, UniformPlayground, type UniformPlaygroundDecorator, type UniformPlaygroundProps, UniformRichText, UniformRichTextNode, type UniformRichTextNodeProps, type UniformRichTextProps, UniformSlot, type UniformSlotProps, type UniformSlotWrapperComponentProps, UniformText, type UniformTextProps, type UseCompositionEventEffectOptions, type UseUniformContextualEditingProps, type UseUniformContextualEditingStateProps, type UseUniformContextualEditingStateReturnType, componentStore, componentStoreResolver, convertComponentToProps, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };