@uniformdev/canvas-react 19.62.0 → 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/LICENSE.txt CHANGED
@@ -1,2 +1,2 @@
1
- © 2023 Uniform Systems, Inc. All Rights Reserved.
1
+ © 2024 Uniform Systems, Inc. All Rights Reserved.
2
2
  See details of Uniform Systems, Inc. Master Subscription Agreement here: https://uniform.dev/eula
@@ -0,0 +1,41 @@
1
+ import { ComponentInstance } from '@uniformdev/canvas';
2
+ import React from 'react';
3
+
4
+ type ParameterTextValue = string | undefined;
5
+ type PureUniformTextProps = {
6
+ /**
7
+ * The name of the HTML tag to render.
8
+ * @default "span"
9
+ */
10
+ as?: React.ElementType;
11
+ /** The ID of the parameter. */
12
+ parameterId: string;
13
+ /** The component that contains the parameter. */
14
+ component: ComponentInstance;
15
+ skipCustomRendering: boolean;
16
+ isContextualEditing: boolean;
17
+ /**
18
+ * When set to true, it adds `whiteSpace: 'pre-wrap'` to the styles of the root element to allow the rendering of line breaks.
19
+ * @default false
20
+ */
21
+ isMultiline?: boolean;
22
+ /**
23
+ * Sets the value to show in Canvas editor when the parameter value is empty.
24
+ * Can be a static string, or a function to generate the placeholder out of parameter info.
25
+ * @default undefined
26
+ */
27
+ placeholder?: string | ((parameter: {
28
+ id: string;
29
+ }) => string | undefined);
30
+ /**
31
+ * A function to customize the rendering of the parameter value. Useful to format the value before rendering it.
32
+ * @default "(value) => value"
33
+ */
34
+ render?: (value: ParameterTextValue) => React.ReactNode;
35
+ } & Omit<React.HTMLAttributes<HTMLSpanElement>, 'children' | 'placeholder'>;
36
+ /**
37
+ * Renders text parameters. Offers inline editing capability out of the box.
38
+ */
39
+ declare const PureUniformText: ({ as: Tag, parameterId, component, skipCustomRendering, isContextualEditing, isMultiline, placeholder, render, ...props }: PureUniformTextProps) => React.JSX.Element | null;
40
+
41
+ export { type PureUniformTextProps as P, PureUniformText as a };
@@ -0,0 +1,41 @@
1
+ import { ComponentInstance } from '@uniformdev/canvas';
2
+ import React from 'react';
3
+
4
+ type ParameterTextValue = string | undefined;
5
+ type PureUniformTextProps = {
6
+ /**
7
+ * The name of the HTML tag to render.
8
+ * @default "span"
9
+ */
10
+ as?: React.ElementType;
11
+ /** The ID of the parameter. */
12
+ parameterId: string;
13
+ /** The component that contains the parameter. */
14
+ component: ComponentInstance;
15
+ skipCustomRendering: boolean;
16
+ isContextualEditing: boolean;
17
+ /**
18
+ * When set to true, it adds `whiteSpace: 'pre-wrap'` to the styles of the root element to allow the rendering of line breaks.
19
+ * @default false
20
+ */
21
+ isMultiline?: boolean;
22
+ /**
23
+ * Sets the value to show in Canvas editor when the parameter value is empty.
24
+ * Can be a static string, or a function to generate the placeholder out of parameter info.
25
+ * @default undefined
26
+ */
27
+ placeholder?: string | ((parameter: {
28
+ id: string;
29
+ }) => string | undefined);
30
+ /**
31
+ * A function to customize the rendering of the parameter value. Useful to format the value before rendering it.
32
+ * @default "(value) => value"
33
+ */
34
+ render?: (value: ParameterTextValue) => React.ReactNode;
35
+ } & Omit<React.HTMLAttributes<HTMLSpanElement>, 'children' | 'placeholder'>;
36
+ /**
37
+ * Renders text parameters. Offers inline editing capability out of the box.
38
+ */
39
+ declare const PureUniformText: ({ as: Tag, parameterId, component, skipCustomRendering, isContextualEditing, isMultiline, placeholder, render, ...props }: PureUniformTextProps) => React.JSX.Element | null;
40
+
41
+ export { type PureUniformTextProps as P, PureUniformText as a };
package/dist/core.d.mts CHANGED
@@ -1,41 +1,16 @@
1
- import { ComponentInstance } from '@uniformdev/canvas';
2
- import React from 'react';
1
+ import { ComponentInstance, RootComponentInstance } from '@uniformdev/canvas';
2
+ import React, { PropsWithChildren } from 'react';
3
+ export { a as PureUniformText, P as PureUniformTextProps } from './PureUniformText-B3GAm6Dc.mjs';
3
4
 
4
- type ParameterTextValue = string | undefined;
5
- type PureUniformTextProps = {
6
- /**
7
- * The name of the HTML tag to render.
8
- * @default "span"
9
- */
10
- as?: React.ElementType;
11
- /** The ID of the parameter. */
12
- parameterId: string;
13
- /** The component that contains the parameter. */
14
- component: ComponentInstance;
15
- skipCustomRendering: boolean;
16
- isContextualEditing: boolean;
17
- /**
18
- * When set to true, it adds `whiteSpace: 'pre-wrap'` to the styles of the root element to allow the rendering of line breaks.
19
- * @default false
20
- */
21
- isMultiline?: boolean;
22
- /**
23
- * Sets the value to show in Canvas editor when the parameter value is empty.
24
- * Can be a static string, or a function to generate the placeholder out of parameter info.
25
- * @default undefined
26
- */
27
- placeholder?: string | ((parameter: {
28
- id: string;
29
- }) => string | undefined);
30
- /**
31
- * A function to customize the rendering of the parameter value. Useful to format the value before rendering it.
32
- * @default "(value) => value"
33
- */
34
- render?: (value: ParameterTextValue) => React.ReactNode;
35
- } & Omit<React.HTMLAttributes<HTMLSpanElement>, 'children' | 'placeholder'>;
36
- /**
37
- * Renders text parameters. Offers inline editing capability out of the box.
38
- */
39
- declare const PureUniformText: ({ as: Tag, parameterId, component, skipCustomRendering, isContextualEditing, isMultiline, placeholder, render, ...props }: PureUniformTextProps) => React.JSX.Element | null;
5
+ type PureContextualEditingComponentWrapperProps = {
6
+ isPlaceholder: boolean | undefined;
7
+ parentComponent: ComponentInstance | undefined;
8
+ component: ComponentInstance | RootComponentInstance;
9
+ slotName: string | undefined;
10
+ indexInSlot: number | undefined;
11
+ slotChildrenCount: number | undefined;
12
+ isReadOnly: string | undefined;
13
+ };
14
+ declare const PureContextualEditingComponentWrapper: ({ children, isPlaceholder, parentComponent, component, slotName, indexInSlot, slotChildrenCount, isReadOnly, }: PropsWithChildren<PureContextualEditingComponentWrapperProps>) => React.JSX.Element;
40
15
 
41
- export { PureUniformText, PureUniformTextProps };
16
+ export { PureContextualEditingComponentWrapper, type PureContextualEditingComponentWrapperProps };
package/dist/core.d.ts CHANGED
@@ -1,41 +1,16 @@
1
- import { ComponentInstance } from '@uniformdev/canvas';
2
- import React from 'react';
1
+ import { ComponentInstance, RootComponentInstance } from '@uniformdev/canvas';
2
+ import React, { PropsWithChildren } from 'react';
3
+ export { a as PureUniformText, P as PureUniformTextProps } from './PureUniformText-B3GAm6Dc.js';
3
4
 
4
- type ParameterTextValue = string | undefined;
5
- type PureUniformTextProps = {
6
- /**
7
- * The name of the HTML tag to render.
8
- * @default "span"
9
- */
10
- as?: React.ElementType;
11
- /** The ID of the parameter. */
12
- parameterId: string;
13
- /** The component that contains the parameter. */
14
- component: ComponentInstance;
15
- skipCustomRendering: boolean;
16
- isContextualEditing: boolean;
17
- /**
18
- * When set to true, it adds `whiteSpace: 'pre-wrap'` to the styles of the root element to allow the rendering of line breaks.
19
- * @default false
20
- */
21
- isMultiline?: boolean;
22
- /**
23
- * Sets the value to show in Canvas editor when the parameter value is empty.
24
- * Can be a static string, or a function to generate the placeholder out of parameter info.
25
- * @default undefined
26
- */
27
- placeholder?: string | ((parameter: {
28
- id: string;
29
- }) => string | undefined);
30
- /**
31
- * A function to customize the rendering of the parameter value. Useful to format the value before rendering it.
32
- * @default "(value) => value"
33
- */
34
- render?: (value: ParameterTextValue) => React.ReactNode;
35
- } & Omit<React.HTMLAttributes<HTMLSpanElement>, 'children' | 'placeholder'>;
36
- /**
37
- * Renders text parameters. Offers inline editing capability out of the box.
38
- */
39
- declare const PureUniformText: ({ as: Tag, parameterId, component, skipCustomRendering, isContextualEditing, isMultiline, placeholder, render, ...props }: PureUniformTextProps) => React.JSX.Element | null;
5
+ type PureContextualEditingComponentWrapperProps = {
6
+ isPlaceholder: boolean | undefined;
7
+ parentComponent: ComponentInstance | undefined;
8
+ component: ComponentInstance | RootComponentInstance;
9
+ slotName: string | undefined;
10
+ indexInSlot: number | undefined;
11
+ slotChildrenCount: number | undefined;
12
+ isReadOnly: string | undefined;
13
+ };
14
+ declare const PureContextualEditingComponentWrapper: ({ children, isPlaceholder, parentComponent, component, slotName, indexInSlot, slotChildrenCount, isReadOnly, }: PropsWithChildren<PureContextualEditingComponentWrapperProps>) => React.JSX.Element;
40
15
 
41
- export { PureUniformText, PureUniformTextProps };
16
+ export { PureContextualEditingComponentWrapper, type PureContextualEditingComponentWrapperProps };
package/dist/core.js CHANGED
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  "use strict";
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
@@ -30,18 +31,52 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
31
  // src/core.ts
31
32
  var core_exports = {};
32
33
  __export(core_exports, {
34
+ PureContextualEditingComponentWrapper: () => PureContextualEditingComponentWrapper,
33
35
  PureUniformText: () => PureUniformText
34
36
  });
35
37
  module.exports = __toCommonJS(core_exports);
36
38
 
37
- // src/components/PureUniformText.tsx
39
+ // src/components/PureContextualEditingComponentWrapper.tsx
40
+ var import_canvas = require("@uniformdev/canvas");
38
41
  var import_react = __toESM(require("react"));
42
+ var PureContextualEditingComponentWrapper = ({
43
+ children,
44
+ isPlaceholder,
45
+ parentComponent,
46
+ component,
47
+ slotName,
48
+ indexInSlot,
49
+ slotChildrenCount,
50
+ isReadOnly
51
+ }) => {
52
+ var _a, _b, _c, _d;
53
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
54
+ "script",
55
+ {
56
+ "data-role": import_canvas.IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
57
+ "data-parent-id": parentComponent == null ? void 0 : parentComponent._id,
58
+ "data-parent-type": parentComponent == null ? void 0 : parentComponent.type,
59
+ "data-component-id": component == null ? void 0 : component._id,
60
+ "data-slot-name": slotName != null ? slotName : "",
61
+ "data-component-index": indexInSlot != null ? indexInSlot : "",
62
+ "data-total-components": slotChildrenCount != null ? slotChildrenCount : "",
63
+ "data-component-name": component == null ? void 0 : component.type,
64
+ "data-is-placeholder": isPlaceholder ? "true" : void 0,
65
+ "data-is-localized": ((_a = component == null ? void 0 : component.parameters) == null ? void 0 : _a[import_canvas.CANVAS_LOCALE_TAG_PARAM]) ? "true" : void 0,
66
+ "data-component-title": (_d = (_c = (_b = component == null ? void 0 : component.parameters) == null ? void 0 : _b.title) == null ? void 0 : _c.value) != null ? _d : "",
67
+ "data-is-readonly": isReadOnly
68
+ }
69
+ ), children, /* @__PURE__ */ import_react.default.createElement("script", { "data-role": import_canvas.IN_CONTEXT_EDITOR_COMPONENT_END_ROLE }));
70
+ };
71
+
72
+ // src/components/PureUniformText.tsx
73
+ var import_react2 = __toESM(require("react"));
39
74
 
40
75
  // src/helpers/getParameterAttributes.ts
41
- var import_canvas = require("@uniformdev/canvas");
76
+ var import_canvas2 = require("@uniformdev/canvas");
42
77
  var getParameterAttributes = (options) => {
43
78
  return {
44
- ...(0, import_canvas.getParameterAttributes)(options),
79
+ ...(0, import_canvas2.getParameterAttributes)(options),
45
80
  suppressContentEditableWarning: true
46
81
  };
47
82
  };
@@ -65,10 +100,10 @@ var PureUniformText = ({
65
100
  return null;
66
101
  }
67
102
  if (!isContextualEditing) {
68
- return /* @__PURE__ */ import_react.default.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
103
+ return /* @__PURE__ */ import_react2.default.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
69
104
  }
70
105
  const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
71
- return /* @__PURE__ */ import_react.default.createElement(
106
+ return /* @__PURE__ */ import_react2.default.createElement(
72
107
  Tag,
73
108
  {
74
109
  ...props,
@@ -86,5 +121,6 @@ var PureUniformText = ({
86
121
  };
87
122
  // Annotate the CommonJS export names for ESM import in node:
88
123
  0 && (module.exports = {
124
+ PureContextualEditingComponentWrapper,
89
125
  PureUniformText
90
126
  });
package/dist/core.mjs CHANGED
@@ -1,5 +1,44 @@
1
- // src/components/PureUniformText.tsx
1
+ 'use client';
2
+
3
+ // src/components/PureContextualEditingComponentWrapper.tsx
4
+ import {
5
+ CANVAS_LOCALE_TAG_PARAM,
6
+ IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
7
+ IN_CONTEXT_EDITOR_COMPONENT_START_ROLE
8
+ } from "@uniformdev/canvas";
2
9
  import React from "react";
10
+ var PureContextualEditingComponentWrapper = ({
11
+ children,
12
+ isPlaceholder,
13
+ parentComponent,
14
+ component,
15
+ slotName,
16
+ indexInSlot,
17
+ slotChildrenCount,
18
+ isReadOnly
19
+ }) => {
20
+ var _a, _b, _c, _d;
21
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
22
+ "script",
23
+ {
24
+ "data-role": IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
25
+ "data-parent-id": parentComponent == null ? void 0 : parentComponent._id,
26
+ "data-parent-type": parentComponent == null ? void 0 : parentComponent.type,
27
+ "data-component-id": component == null ? void 0 : component._id,
28
+ "data-slot-name": slotName != null ? slotName : "",
29
+ "data-component-index": indexInSlot != null ? indexInSlot : "",
30
+ "data-total-components": slotChildrenCount != null ? slotChildrenCount : "",
31
+ "data-component-name": component == null ? void 0 : component.type,
32
+ "data-is-placeholder": isPlaceholder ? "true" : void 0,
33
+ "data-is-localized": ((_a = component == null ? void 0 : component.parameters) == null ? void 0 : _a[CANVAS_LOCALE_TAG_PARAM]) ? "true" : void 0,
34
+ "data-component-title": (_d = (_c = (_b = component == null ? void 0 : component.parameters) == null ? void 0 : _b.title) == null ? void 0 : _c.value) != null ? _d : "",
35
+ "data-is-readonly": isReadOnly
36
+ }
37
+ ), children, /* @__PURE__ */ React.createElement("script", { "data-role": IN_CONTEXT_EDITOR_COMPONENT_END_ROLE }));
38
+ };
39
+
40
+ // src/components/PureUniformText.tsx
41
+ import React2 from "react";
3
42
 
4
43
  // src/helpers/getParameterAttributes.ts
5
44
  import {
@@ -31,10 +70,10 @@ var PureUniformText = ({
31
70
  return null;
32
71
  }
33
72
  if (!isContextualEditing) {
34
- return /* @__PURE__ */ React.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
73
+ return /* @__PURE__ */ React2.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
35
74
  }
36
75
  const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
37
- return /* @__PURE__ */ React.createElement(
76
+ return /* @__PURE__ */ React2.createElement(
38
77
  Tag,
39
78
  {
40
79
  ...props,
@@ -51,5 +90,6 @@ var PureUniformText = ({
51
90
  );
52
91
  };
53
92
  export {
93
+ PureContextualEditingComponentWrapper,
54
94
  PureUniformText
55
95
  };
package/dist/index.d.mts 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.mjs';
4
+ import { P as PureUniformTextProps } from './PureUniformText-B3GAm6Dc.mjs';
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 };