@uniformdev/canvas-react 19.140.2-alpha.7 → 19.142.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.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
2
- import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, SubscribeToCompositionOptions, UpdateContextualEditingStateInternalMessage } from '@uniformdev/canvas';
2
+ import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, SubscribeToCompositionOptions } from '@uniformdev/canvas';
3
3
  export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
4
4
  import { P as PureUniformTextProps } from './PureUniformText-B3GAm6Dc.mjs';
5
5
  import { RichTextNode } from '@uniformdev/richtext';
@@ -110,6 +110,9 @@ 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;
113
116
  } | undefined;
114
117
  locales?: {
115
118
  [key: string]: unknown;
@@ -147,6 +150,9 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
147
150
  connectedData?: {
148
151
  pointer: string;
149
152
  syntax: "jptr";
153
+ failureAction?: "a" | "p" | "t" | "c" | undefined;
154
+ failureLogLevel?: "i" | "e" | "w" | undefined;
155
+ failureDefault?: string | undefined;
150
156
  } | undefined;
151
157
  locales?: {
152
158
  [key: string]: unknown;
@@ -189,6 +195,9 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
189
195
  connectedData?: {
190
196
  pointer: string;
191
197
  syntax: "jptr";
198
+ failureAction?: "a" | "p" | "t" | "c" | undefined;
199
+ failureLogLevel?: "i" | "e" | "w" | undefined;
200
+ failureDefault?: string | undefined;
192
201
  } | undefined;
193
202
  locales?: {
194
203
  [key: string]: unknown;
@@ -245,6 +254,9 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
245
254
  connectedData?: {
246
255
  pointer: string;
247
256
  syntax: "jptr";
257
+ failureAction?: "a" | "p" | "t" | "c" | undefined;
258
+ failureLogLevel?: "i" | "e" | "w" | undefined;
259
+ failureDefault?: string | undefined;
248
260
  } | undefined;
249
261
  locales?: {
250
262
  [key: string]: unknown;
@@ -430,31 +442,26 @@ type UseUniformContextualEditingStateProps = {
430
442
  **/
431
443
  global?: boolean;
432
444
  };
433
- type UseUniformContextualEditingStateReturnType = {
434
- /**
435
- * Returns `true` when the app is rendered inside Canvas editor. Regardless of which preview mode is currently selected ("editor" or "preview").
436
- */
437
- isContextualEditing: boolean;
438
- /**
439
- * A reference to the currently selected component in Canvas editor.
440
- * Returns `undefined` if the selected component is not part of the current React component.
441
- * Set the `global` option to `true` to get a reference of the selected component anywhere in the composition tree.
442
- */
443
- selectedComponentReference: UpdateContextualEditingStateInternalMessage['state']['selectedComponentReference'];
444
- /**
445
- * Returns the current preview mode in Canvas editor ("editor" or "preview").
446
- * Returns `undefined` when the app is not rendered inside Canvas editor.
447
- * Learn more about the preview modes: https://docs.uniform.app/docs/guides/composition/visual-editing#editing-and-preview-mode
448
- * @deprecated this is an experimental property, it might receive breaking changes in minor releases ⚠️
449
- */
450
- previewMode: UpdateContextualEditingStateInternalMessage['state']['previewMode'] | undefined;
451
- };
452
445
  /**
453
446
  * Returns the state of contextual editing, when the app is open inside Canvas Editor.
454
447
  * This hook can be used to improve the editing experience of your team.
455
448
  * For example: You can use `selectedComponentReference` to control which element to show inside a carousel or an accordion.
456
449
  */
457
- declare const useUniformContextualEditingState: ({ global, }?: UseUniformContextualEditingStateProps) => UseUniformContextualEditingStateReturnType;
450
+ declare const useUniformContextualEditingState: ({ global, }?: UseUniformContextualEditingStateProps) => {
451
+ isContextualEditing: boolean;
452
+ selectedComponentReference: {
453
+ id: string;
454
+ slotName?: string | undefined;
455
+ componentIndex?: number | undefined;
456
+ totalComponents?: number | undefined;
457
+ componentName?: string | undefined;
458
+ componentTitle?: string | undefined;
459
+ parentId?: string | undefined;
460
+ parentType?: string | undefined;
461
+ isLocalized?: boolean | undefined;
462
+ isReadOnly?: boolean | undefined;
463
+ } | undefined;
464
+ };
458
465
 
459
466
  declare const componentStore: ComponentStore;
460
467
  declare const registerUniformComponent: ({ type, variantId, component, }: {
@@ -472,4 +479,4 @@ declare const createComponentStoreResolver: (options: {
472
479
  defaultComponent?: React$1.ComponentType<ComponentProps<any>>;
473
480
  }) => RenderComponentResolver;
474
481
 
475
- 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 };
482
+ 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, componentStore, componentStoreResolver, convertComponentToProps, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
2
- import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, SubscribeToCompositionOptions, UpdateContextualEditingStateInternalMessage } from '@uniformdev/canvas';
2
+ import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, SubscribeToCompositionOptions } from '@uniformdev/canvas';
3
3
  export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
4
4
  import { P as PureUniformTextProps } from './PureUniformText-B3GAm6Dc.js';
5
5
  import { RichTextNode } from '@uniformdev/richtext';
@@ -110,6 +110,9 @@ 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;
113
116
  } | undefined;
114
117
  locales?: {
115
118
  [key: string]: unknown;
@@ -147,6 +150,9 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
147
150
  connectedData?: {
148
151
  pointer: string;
149
152
  syntax: "jptr";
153
+ failureAction?: "a" | "p" | "t" | "c" | undefined;
154
+ failureLogLevel?: "i" | "e" | "w" | undefined;
155
+ failureDefault?: string | undefined;
150
156
  } | undefined;
151
157
  locales?: {
152
158
  [key: string]: unknown;
@@ -189,6 +195,9 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
189
195
  connectedData?: {
190
196
  pointer: string;
191
197
  syntax: "jptr";
198
+ failureAction?: "a" | "p" | "t" | "c" | undefined;
199
+ failureLogLevel?: "i" | "e" | "w" | undefined;
200
+ failureDefault?: string | undefined;
192
201
  } | undefined;
193
202
  locales?: {
194
203
  [key: string]: unknown;
@@ -245,6 +254,9 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
245
254
  connectedData?: {
246
255
  pointer: string;
247
256
  syntax: "jptr";
257
+ failureAction?: "a" | "p" | "t" | "c" | undefined;
258
+ failureLogLevel?: "i" | "e" | "w" | undefined;
259
+ failureDefault?: string | undefined;
248
260
  } | undefined;
249
261
  locales?: {
250
262
  [key: string]: unknown;
@@ -430,31 +442,26 @@ type UseUniformContextualEditingStateProps = {
430
442
  **/
431
443
  global?: boolean;
432
444
  };
433
- type UseUniformContextualEditingStateReturnType = {
434
- /**
435
- * Returns `true` when the app is rendered inside Canvas editor. Regardless of which preview mode is currently selected ("editor" or "preview").
436
- */
437
- isContextualEditing: boolean;
438
- /**
439
- * A reference to the currently selected component in Canvas editor.
440
- * Returns `undefined` if the selected component is not part of the current React component.
441
- * Set the `global` option to `true` to get a reference of the selected component anywhere in the composition tree.
442
- */
443
- selectedComponentReference: UpdateContextualEditingStateInternalMessage['state']['selectedComponentReference'];
444
- /**
445
- * Returns the current preview mode in Canvas editor ("editor" or "preview").
446
- * Returns `undefined` when the app is not rendered inside Canvas editor.
447
- * Learn more about the preview modes: https://docs.uniform.app/docs/guides/composition/visual-editing#editing-and-preview-mode
448
- * @deprecated this is an experimental property, it might receive breaking changes in minor releases ⚠️
449
- */
450
- previewMode: UpdateContextualEditingStateInternalMessage['state']['previewMode'] | undefined;
451
- };
452
445
  /**
453
446
  * Returns the state of contextual editing, when the app is open inside Canvas Editor.
454
447
  * This hook can be used to improve the editing experience of your team.
455
448
  * For example: You can use `selectedComponentReference` to control which element to show inside a carousel or an accordion.
456
449
  */
457
- declare const useUniformContextualEditingState: ({ global, }?: UseUniformContextualEditingStateProps) => UseUniformContextualEditingStateReturnType;
450
+ declare const useUniformContextualEditingState: ({ global, }?: UseUniformContextualEditingStateProps) => {
451
+ isContextualEditing: boolean;
452
+ selectedComponentReference: {
453
+ id: string;
454
+ slotName?: string | undefined;
455
+ componentIndex?: number | undefined;
456
+ totalComponents?: number | undefined;
457
+ componentName?: string | undefined;
458
+ componentTitle?: string | undefined;
459
+ parentId?: string | undefined;
460
+ parentType?: string | undefined;
461
+ isLocalized?: boolean | undefined;
462
+ isReadOnly?: boolean | undefined;
463
+ } | undefined;
464
+ };
458
465
 
459
466
  declare const componentStore: ComponentStore;
460
467
  declare const registerUniformComponent: ({ type, variantId, component, }: {
@@ -472,4 +479,4 @@ declare const createComponentStoreResolver: (options: {
472
479
  defaultComponent?: React$1.ComponentType<ComponentProps<any>>;
473
480
  }) => RenderComponentResolver;
474
481
 
475
- 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 };
482
+ 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, componentStore, componentStoreResolver, convertComponentToProps, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
package/dist/index.esm.js CHANGED
@@ -940,9 +940,6 @@ var useUniformContextualEditingState = ({
940
940
  const { isContextualEditing } = useUniformCurrentComposition();
941
941
  const { data: componentData } = useUniformCurrentComponent();
942
942
  const [selectedComponentReference, setSelectedComponentReference] = useState3();
943
- const [previewMode, setPreviewMode] = useState3(
944
- isContextualEditing ? "editor" : void 0
945
- );
946
943
  const channel = useMemo4(() => {
947
944
  if (!isContextualEditing) {
948
945
  return;
@@ -962,7 +959,6 @@ var useUniformContextualEditingState = ({
962
959
  if (!isUpdateContextualEditingStateInternalMessage(message)) {
963
960
  return;
964
961
  }
965
- setPreviewMode(message.state.previewMode);
966
962
  if (!global && (componentData == null ? void 0 : componentData._id) !== ((_a = message.state.selectedComponentReference) == null ? void 0 : _a.parentId)) {
967
963
  setSelectedComponentReference(void 0);
968
964
  return;
@@ -972,14 +968,13 @@ var useUniformContextualEditingState = ({
972
968
  return () => {
973
969
  unsubscribe();
974
970
  };
975
- }, [global, channel, componentData == null ? void 0 : componentData._id, setSelectedComponentReference, setPreviewMode]);
971
+ }, [global, channel, componentData == null ? void 0 : componentData._id, setSelectedComponentReference]);
976
972
  return useMemo4(
977
973
  () => ({
978
974
  isContextualEditing,
979
- selectedComponentReference,
980
- previewMode
975
+ selectedComponentReference
981
976
  }),
982
- [isContextualEditing, selectedComponentReference, previewMode]
977
+ [isContextualEditing, selectedComponentReference]
983
978
  );
984
979
  };
985
980
  export {
package/dist/index.js CHANGED
@@ -956,9 +956,6 @@ var useUniformContextualEditingState = ({
956
956
  const { isContextualEditing } = useUniformCurrentComposition();
957
957
  const { data: componentData } = useUniformCurrentComponent();
958
958
  const [selectedComponentReference, setSelectedComponentReference] = (0, import_react22.useState)();
959
- const [previewMode, setPreviewMode] = (0, import_react22.useState)(
960
- isContextualEditing ? "editor" : void 0
961
- );
962
959
  const channel = (0, import_react22.useMemo)(() => {
963
960
  if (!isContextualEditing) {
964
961
  return;
@@ -978,7 +975,6 @@ var useUniformContextualEditingState = ({
978
975
  if (!(0, import_canvas12.isUpdateContextualEditingStateInternalMessage)(message)) {
979
976
  return;
980
977
  }
981
- setPreviewMode(message.state.previewMode);
982
978
  if (!global && (componentData == null ? void 0 : componentData._id) !== ((_a = message.state.selectedComponentReference) == null ? void 0 : _a.parentId)) {
983
979
  setSelectedComponentReference(void 0);
984
980
  return;
@@ -988,14 +984,13 @@ var useUniformContextualEditingState = ({
988
984
  return () => {
989
985
  unsubscribe();
990
986
  };
991
- }, [global, channel, componentData == null ? void 0 : componentData._id, setSelectedComponentReference, setPreviewMode]);
987
+ }, [global, channel, componentData == null ? void 0 : componentData._id, setSelectedComponentReference]);
992
988
  return (0, import_react22.useMemo)(
993
989
  () => ({
994
990
  isContextualEditing,
995
- selectedComponentReference,
996
- previewMode
991
+ selectedComponentReference
997
992
  }),
998
- [isContextualEditing, selectedComponentReference, previewMode]
993
+ [isContextualEditing, selectedComponentReference]
999
994
  );
1000
995
  };
1001
996
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -940,9 +940,6 @@ var useUniformContextualEditingState = ({
940
940
  const { isContextualEditing } = useUniformCurrentComposition();
941
941
  const { data: componentData } = useUniformCurrentComponent();
942
942
  const [selectedComponentReference, setSelectedComponentReference] = useState3();
943
- const [previewMode, setPreviewMode] = useState3(
944
- isContextualEditing ? "editor" : void 0
945
- );
946
943
  const channel = useMemo4(() => {
947
944
  if (!isContextualEditing) {
948
945
  return;
@@ -962,7 +959,6 @@ var useUniformContextualEditingState = ({
962
959
  if (!isUpdateContextualEditingStateInternalMessage(message)) {
963
960
  return;
964
961
  }
965
- setPreviewMode(message.state.previewMode);
966
962
  if (!global && (componentData == null ? void 0 : componentData._id) !== ((_a = message.state.selectedComponentReference) == null ? void 0 : _a.parentId)) {
967
963
  setSelectedComponentReference(void 0);
968
964
  return;
@@ -972,14 +968,13 @@ var useUniformContextualEditingState = ({
972
968
  return () => {
973
969
  unsubscribe();
974
970
  };
975
- }, [global, channel, componentData == null ? void 0 : componentData._id, setSelectedComponentReference, setPreviewMode]);
971
+ }, [global, channel, componentData == null ? void 0 : componentData._id, setSelectedComponentReference]);
976
972
  return useMemo4(
977
973
  () => ({
978
974
  isContextualEditing,
979
- selectedComponentReference,
980
- previewMode
975
+ selectedComponentReference
981
976
  }),
982
- [isContextualEditing, selectedComponentReference, previewMode]
977
+ [isContextualEditing, selectedComponentReference]
983
978
  );
984
979
  };
985
980
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-react",
3
- "version": "19.140.2-alpha.7+b328af635c",
3
+ "version": "19.142.0",
4
4
  "description": "React SDK for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -45,10 +45,10 @@
45
45
  "document": "api-extractor run --local"
46
46
  },
47
47
  "dependencies": {
48
- "@uniformdev/canvas": "19.140.2-alpha.7+b328af635c",
49
- "@uniformdev/context": "19.140.2-alpha.7+b328af635c",
50
- "@uniformdev/context-react": "19.140.2-alpha.7+b328af635c",
51
- "@uniformdev/richtext": "19.140.2-alpha.7+b328af635c"
48
+ "@uniformdev/canvas": "19.142.0",
49
+ "@uniformdev/context": "19.142.0",
50
+ "@uniformdev/context-react": "19.142.0",
51
+ "@uniformdev/richtext": "19.142.0"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "react": ">= 16 || 17 || 18",
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "b328af635c3bf3547580cef498cb277a30912339"
68
+ "gitHead": "468077a132e42dbe08f94ab1784c787000d29458"
69
69
  }