@uniformdev/canvas-react 19.165.2-alpha.0 → 19.167.2-alpha.3

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
@@ -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.
@@ -313,24 +313,26 @@ declare function useUniformCurrentComposition(): UniformCompositionContextValue;
313
313
  declare function UniformComposition<TRenderProps = unknown>({ data, behaviorTracking, children, resolveRenderer, contextualEditingEnhancer, contextualEditingDefaultPlaceholder, }: UniformCompositionProps<TRenderProps>): React$1.JSX.Element;
314
314
 
315
315
  type UniformPlaygroundDecorator = (props: {
316
- /** The rendered component instance, needs to wrapped and rendered by the decorator */
316
+ /** The rendered component instance, needs to be wrapped and rendered by the decorator */
317
317
  children: React$1.ReactNode;
318
318
  /** The component instance data */
319
319
  data: ComponentInstance | RootComponentInstance;
320
320
  }) => React$1.ReactElement;
321
321
  type UniformPlaygroundProps = {
322
322
  /**
323
- * Allows wrapping the playground in custom components.
324
- * Useful to customize the playground to allow previewing the components in realistic scenarios
325
- * (e.g. different background color, different parent size)
323
+ * Allows wrapping the playground in custom layouts.
324
+ * Useful to customize the playground to allow previewing the patterns in realistic scenarios
325
+ * (e.g. wrap the pattern in a specific layout, show a background color selector, parent size selector, etc.)
326
326
  * @deprecated This feature is not stable yet and might be changed or removed in a minor release. Do not use it in production environments.
327
327
  */
328
328
  decorators?: UniformPlaygroundDecorator[];
329
- } & Omit<UniformCompositionProps, 'data'>;
329
+ /** @deprecated This prop is not supported anymore. */
330
+ children?: ReactNode;
331
+ } & Omit<UniformCompositionProps, 'data' | 'children'>;
330
332
  /**
331
- * Playground where you can freely live preview your components and pattern.
333
+ * Playground where you can freely live preview your components and patterns.
332
334
  */
333
- declare const UniformPlayground: ({ resolveRenderer, decorators, contextualEditingEnhancer, behaviorTracking, contextualEditingDefaultPlaceholder, children, }: UniformPlaygroundProps) => React$1.JSX.Element;
335
+ declare const UniformPlayground: ({ resolveRenderer, decorators, contextualEditingEnhancer, behaviorTracking, contextualEditingDefaultPlaceholder, }: UniformPlaygroundProps) => React$1.JSX.Element;
334
336
 
335
337
  type RichTextComponentProps<TNode extends RichTextNode = RichTextNode> = {
336
338
  node: TNode;
package/dist/index.d.ts 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.
@@ -313,24 +313,26 @@ declare function useUniformCurrentComposition(): UniformCompositionContextValue;
313
313
  declare function UniformComposition<TRenderProps = unknown>({ data, behaviorTracking, children, resolveRenderer, contextualEditingEnhancer, contextualEditingDefaultPlaceholder, }: UniformCompositionProps<TRenderProps>): React$1.JSX.Element;
314
314
 
315
315
  type UniformPlaygroundDecorator = (props: {
316
- /** The rendered component instance, needs to wrapped and rendered by the decorator */
316
+ /** The rendered component instance, needs to be wrapped and rendered by the decorator */
317
317
  children: React$1.ReactNode;
318
318
  /** The component instance data */
319
319
  data: ComponentInstance | RootComponentInstance;
320
320
  }) => React$1.ReactElement;
321
321
  type UniformPlaygroundProps = {
322
322
  /**
323
- * Allows wrapping the playground in custom components.
324
- * Useful to customize the playground to allow previewing the components in realistic scenarios
325
- * (e.g. different background color, different parent size)
323
+ * Allows wrapping the playground in custom layouts.
324
+ * Useful to customize the playground to allow previewing the patterns in realistic scenarios
325
+ * (e.g. wrap the pattern in a specific layout, show a background color selector, parent size selector, etc.)
326
326
  * @deprecated This feature is not stable yet and might be changed or removed in a minor release. Do not use it in production environments.
327
327
  */
328
328
  decorators?: UniformPlaygroundDecorator[];
329
- } & Omit<UniformCompositionProps, 'data'>;
329
+ /** @deprecated This prop is not supported anymore. */
330
+ children?: ReactNode;
331
+ } & Omit<UniformCompositionProps, 'data' | 'children'>;
330
332
  /**
331
- * Playground where you can freely live preview your components and pattern.
333
+ * Playground where you can freely live preview your components and patterns.
332
334
  */
333
- declare const UniformPlayground: ({ resolveRenderer, decorators, contextualEditingEnhancer, behaviorTracking, contextualEditingDefaultPlaceholder, children, }: UniformPlaygroundProps) => React$1.JSX.Element;
335
+ declare const UniformPlayground: ({ resolveRenderer, decorators, contextualEditingEnhancer, behaviorTracking, contextualEditingDefaultPlaceholder, }: UniformPlaygroundProps) => React$1.JSX.Element;
334
336
 
335
337
  type RichTextComponentProps<TNode extends RichTextNode = RichTextNode> = {
336
338
  node: TNode;
package/dist/index.esm.js CHANGED
@@ -611,8 +611,7 @@ var UniformPlayground = ({
611
611
  decorators = [],
612
612
  contextualEditingEnhancer,
613
613
  behaviorTracking,
614
- contextualEditingDefaultPlaceholder,
615
- children
614
+ contextualEditingDefaultPlaceholder
616
615
  }) => {
617
616
  const { composition, isContextualEditing } = useUniformContextualEditing({
618
617
  initialCompositionValue: EMPTY_COMPOSITION4,
@@ -629,21 +628,13 @@ var UniformPlayground = ({
629
628
  behaviorTracking,
630
629
  resolveRenderer,
631
630
  contextualEditingDefaultPlaceholder
632
- },
633
- children
631
+ }
634
632
  ));
635
633
  decorators.forEach((Decorator) => {
636
634
  component = /* @__PURE__ */ React8.createElement(Decorator, { data: composition }, component);
637
635
  });
638
636
  return component;
639
- }, [
640
- children,
641
- resolveRenderer,
642
- decorators,
643
- composition,
644
- behaviorTracking,
645
- contextualEditingDefaultPlaceholder
646
- ]);
637
+ }, [resolveRenderer, decorators, composition, behaviorTracking, contextualEditingDefaultPlaceholder]);
647
638
  return /* @__PURE__ */ React8.createElement(
648
639
  UniformCompositionContext.Provider,
649
640
  {
@@ -739,8 +730,7 @@ var TextRichTextNode = ({ node }) => {
739
730
  // src/components/UniformRichText/UniformRichTextNode.tsx
740
731
  function UniformRichTextNode({ node, ...props }) {
741
732
  var _a;
742
- if (!isRichTextNode(node))
743
- return null;
733
+ if (!isRichTextNode(node)) return null;
744
734
  let NodeRenderer = (_a = props.resolveRichTextRenderer) == null ? void 0 : _a.call(props, node);
745
735
  if (typeof NodeRenderer === "undefined") {
746
736
  NodeRenderer = resolveRichTextDefaultRenderer(node);
@@ -779,8 +769,7 @@ var UniformRichText = React18.forwardRef(function UniformRichText2({ parameterId
779
769
  return (_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId];
780
770
  }, [componentData, parameterId]);
781
771
  const value = useMemo3(() => parameter == null ? void 0 : parameter.value, [parameter]);
782
- if (!value || !isRichTextValue(value) || isRichTextValueConsideredEmpty(value))
783
- return null;
772
+ if (!value || !isRichTextValue(value) || isRichTextValueConsideredEmpty(value)) return null;
784
773
  return Tag === null ? /* @__PURE__ */ React18.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ React18.createElement(
785
774
  Tag,
786
775
  {
package/dist/index.js CHANGED
@@ -643,8 +643,7 @@ var UniformPlayground = ({
643
643
  decorators = [],
644
644
  contextualEditingEnhancer,
645
645
  behaviorTracking,
646
- contextualEditingDefaultPlaceholder,
647
- children
646
+ contextualEditingDefaultPlaceholder
648
647
  }) => {
649
648
  const { composition, isContextualEditing } = useUniformContextualEditing({
650
649
  initialCompositionValue: import_canvas8.EMPTY_COMPOSITION,
@@ -661,21 +660,13 @@ var UniformPlayground = ({
661
660
  behaviorTracking,
662
661
  resolveRenderer,
663
662
  contextualEditingDefaultPlaceholder
664
- },
665
- children
663
+ }
666
664
  ));
667
665
  decorators.forEach((Decorator) => {
668
666
  component = /* @__PURE__ */ import_react8.default.createElement(Decorator, { data: composition }, component);
669
667
  });
670
668
  return component;
671
- }, [
672
- children,
673
- resolveRenderer,
674
- decorators,
675
- composition,
676
- behaviorTracking,
677
- contextualEditingDefaultPlaceholder
678
- ]);
669
+ }, [resolveRenderer, decorators, composition, behaviorTracking, contextualEditingDefaultPlaceholder]);
679
670
  return /* @__PURE__ */ import_react8.default.createElement(
680
671
  UniformCompositionContext.Provider,
681
672
  {
@@ -764,8 +755,7 @@ var TextRichTextNode = ({ node }) => {
764
755
  // src/components/UniformRichText/UniformRichTextNode.tsx
765
756
  function UniformRichTextNode({ node, ...props }) {
766
757
  var _a;
767
- if (!(0, import_richtext4.isRichTextNode)(node))
768
- return null;
758
+ if (!(0, import_richtext4.isRichTextNode)(node)) return null;
769
759
  let NodeRenderer = (_a = props.resolveRichTextRenderer) == null ? void 0 : _a.call(props, node);
770
760
  if (typeof NodeRenderer === "undefined") {
771
761
  NodeRenderer = resolveRichTextDefaultRenderer(node);
@@ -804,8 +794,7 @@ var UniformRichText = import_react18.default.forwardRef(function UniformRichText
804
794
  return (_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId];
805
795
  }, [componentData, parameterId]);
806
796
  const value = (0, import_react18.useMemo)(() => parameter == null ? void 0 : parameter.value, [parameter]);
807
- if (!value || !(0, import_richtext5.isRichTextValue)(value) || (0, import_richtext5.isRichTextValueConsideredEmpty)(value))
808
- return null;
797
+ if (!value || !(0, import_richtext5.isRichTextValue)(value) || (0, import_richtext5.isRichTextValueConsideredEmpty)(value)) return null;
809
798
  return Tag === null ? /* @__PURE__ */ import_react18.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ import_react18.default.createElement(
810
799
  Tag,
811
800
  {
package/dist/index.mjs CHANGED
@@ -611,8 +611,7 @@ var UniformPlayground = ({
611
611
  decorators = [],
612
612
  contextualEditingEnhancer,
613
613
  behaviorTracking,
614
- contextualEditingDefaultPlaceholder,
615
- children
614
+ contextualEditingDefaultPlaceholder
616
615
  }) => {
617
616
  const { composition, isContextualEditing } = useUniformContextualEditing({
618
617
  initialCompositionValue: EMPTY_COMPOSITION4,
@@ -629,21 +628,13 @@ var UniformPlayground = ({
629
628
  behaviorTracking,
630
629
  resolveRenderer,
631
630
  contextualEditingDefaultPlaceholder
632
- },
633
- children
631
+ }
634
632
  ));
635
633
  decorators.forEach((Decorator) => {
636
634
  component = /* @__PURE__ */ React8.createElement(Decorator, { data: composition }, component);
637
635
  });
638
636
  return component;
639
- }, [
640
- children,
641
- resolveRenderer,
642
- decorators,
643
- composition,
644
- behaviorTracking,
645
- contextualEditingDefaultPlaceholder
646
- ]);
637
+ }, [resolveRenderer, decorators, composition, behaviorTracking, contextualEditingDefaultPlaceholder]);
647
638
  return /* @__PURE__ */ React8.createElement(
648
639
  UniformCompositionContext.Provider,
649
640
  {
@@ -739,8 +730,7 @@ var TextRichTextNode = ({ node }) => {
739
730
  // src/components/UniformRichText/UniformRichTextNode.tsx
740
731
  function UniformRichTextNode({ node, ...props }) {
741
732
  var _a;
742
- if (!isRichTextNode(node))
743
- return null;
733
+ if (!isRichTextNode(node)) return null;
744
734
  let NodeRenderer = (_a = props.resolveRichTextRenderer) == null ? void 0 : _a.call(props, node);
745
735
  if (typeof NodeRenderer === "undefined") {
746
736
  NodeRenderer = resolveRichTextDefaultRenderer(node);
@@ -779,8 +769,7 @@ var UniformRichText = React18.forwardRef(function UniformRichText2({ parameterId
779
769
  return (_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId];
780
770
  }, [componentData, parameterId]);
781
771
  const value = useMemo3(() => parameter == null ? void 0 : parameter.value, [parameter]);
782
- if (!value || !isRichTextValue(value) || isRichTextValueConsideredEmpty(value))
783
- return null;
772
+ if (!value || !isRichTextValue(value) || isRichTextValueConsideredEmpty(value)) return null;
784
773
  return Tag === null ? /* @__PURE__ */ React18.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ React18.createElement(
785
774
  Tag,
786
775
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-react",
3
- "version": "19.165.2-alpha.0+323887559d",
3
+ "version": "19.167.2-alpha.3+d42f32a982",
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.165.2-alpha.0+323887559d",
49
- "@uniformdev/context": "19.165.2-alpha.0+323887559d",
50
- "@uniformdev/context-react": "19.165.2-alpha.0+323887559d",
51
- "@uniformdev/richtext": "19.165.2-alpha.0+323887559d"
48
+ "@uniformdev/canvas": "19.167.2-alpha.3+d42f32a982",
49
+ "@uniformdev/context": "19.167.2-alpha.3+d42f32a982",
50
+ "@uniformdev/context-react": "19.167.2-alpha.3+d42f32a982",
51
+ "@uniformdev/richtext": "19.167.2-alpha.3+d42f32a982"
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": "323887559d1bdc7432f91d305afaec90b98f660f"
68
+ "gitHead": "d42f32a98294c96f55a29c10c7c461c5327f56f3"
69
69
  }