@uniformdev/canvas-react 20.74.7-alpha.12 → 20.74.7-alpha.14.sha-79426f9415

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.
@@ -5,7 +5,7 @@ type ParameterTextValue = string | undefined;
5
5
  type PureUniformTextProps = {
6
6
  /**
7
7
  * The name of the HTML tag to render.
8
- * @default "span"
8
+ * @defaultValue "span"
9
9
  */
10
10
  as?: React.ElementType;
11
11
  /** The ID of the parameter. */
@@ -16,20 +16,20 @@ type PureUniformTextProps = {
16
16
  isContextualEditing: boolean;
17
17
  /**
18
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
19
+ * @defaultValue false
20
20
  */
21
21
  isMultiline?: boolean;
22
22
  /**
23
23
  * Sets the value to show in Canvas editor when the parameter value is empty.
24
24
  * Can be a static string, or a function to generate the placeholder out of parameter info.
25
- * @default undefined
25
+ * @defaultValue undefined
26
26
  */
27
27
  placeholder?: string | ((parameter: {
28
28
  id: string;
29
29
  }) => string | undefined);
30
30
  /**
31
31
  * A function to customize the rendering of the parameter value. Useful to format the value before rendering it.
32
- * @default "(value) => value"
32
+ * @defaultValue "(value) => value"
33
33
  */
34
34
  render?: (value: ParameterTextValue) => React.ReactNode;
35
35
  } & Omit<React.HTMLAttributes<HTMLSpanElement>, 'children' | 'placeholder'>;
@@ -5,7 +5,7 @@ type ParameterTextValue = string | undefined;
5
5
  type PureUniformTextProps = {
6
6
  /**
7
7
  * The name of the HTML tag to render.
8
- * @default "span"
8
+ * @defaultValue "span"
9
9
  */
10
10
  as?: React.ElementType;
11
11
  /** The ID of the parameter. */
@@ -16,20 +16,20 @@ type PureUniformTextProps = {
16
16
  isContextualEditing: boolean;
17
17
  /**
18
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
19
+ * @defaultValue false
20
20
  */
21
21
  isMultiline?: boolean;
22
22
  /**
23
23
  * Sets the value to show in Canvas editor when the parameter value is empty.
24
24
  * Can be a static string, or a function to generate the placeholder out of parameter info.
25
- * @default undefined
25
+ * @defaultValue undefined
26
26
  */
27
27
  placeholder?: string | ((parameter: {
28
28
  id: string;
29
29
  }) => string | undefined);
30
30
  /**
31
31
  * A function to customize the rendering of the parameter value. Useful to format the value before rendering it.
32
- * @default "(value) => value"
32
+ * @defaultValue "(value) => value"
33
33
  */
34
34
  render?: (value: ParameterTextValue) => React.ReactNode;
35
35
  } & Omit<React.HTMLAttributes<HTMLSpanElement>, 'children' | 'placeholder'>;
package/dist/core.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ComponentInstance, RootComponentInstance } from '@uniformdev/canvas';
2
2
  import React, { PropsWithChildren } from 'react';
3
- export { P as PureUniformText, a as PureUniformTextProps } from './PureUniformText-CzdaUBnC.mjs';
3
+ export { P as PureUniformText, a as PureUniformTextProps } from './PureUniformText-BFhXK0lt.mjs';
4
4
 
5
5
  type PureContextualEditingComponentWrapperProps = {
6
6
  isPlaceholder: boolean | undefined;
package/dist/core.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ComponentInstance, RootComponentInstance } from '@uniformdev/canvas';
2
2
  import React, { PropsWithChildren } from 'react';
3
- export { P as PureUniformText, a as PureUniformTextProps } from './PureUniformText-CzdaUBnC.js';
3
+ export { P as PureUniformText, a as PureUniformTextProps } from './PureUniformText-BFhXK0lt.js';
4
4
 
5
5
  type PureContextualEditingComponentWrapperProps = {
6
6
  isPlaceholder: boolean | undefined;
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
2
2
  import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, UpdateContextualEditingStateInternalMessage } from '@uniformdev/canvas';
3
3
  export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
4
- import { a as PureUniformTextProps } from './PureUniformText-CzdaUBnC.mjs';
4
+ import { a as PureUniformTextProps } from './PureUniformText-BFhXK0lt.mjs';
5
5
  import { CompositionMetadata } from '@uniformdev/context';
6
6
  import { RichTextNode } from '@uniformdev/richtext';
7
7
  export { linkParamValueToAnchorProps } from '@uniformdev/richtext';
@@ -792,7 +792,7 @@ type RenderRichTextComponentResolver = (node: RichTextNode) => RichTextRendererC
792
792
  type UniformRichTextProps = {
793
793
  /**
794
794
  * The name of the HTML tag to render.
795
- * @default "div"
795
+ * @defaultValue "div"
796
796
  */
797
797
  as?: React$1.ElementType | null;
798
798
  /** The ID of the parameter. */
@@ -805,7 +805,7 @@ type UniformRichTextProps = {
805
805
  /**
806
806
  * Sets the value to show in Canvas editor when the parameter value is empty.
807
807
  * Can be a static string, or a function to generate the placeholder out of parameter info.
808
- * @default undefined
808
+ * @defaultValue undefined
809
809
  */
810
810
  placeholder?: string | ((parameter: {
811
811
  id: string;
@@ -817,7 +817,7 @@ type UniformRichTextProps = {
817
817
  declare const UniformRichText: React$1.ForwardRefExoticComponent<{
818
818
  /**
819
819
  * The name of the HTML tag to render.
820
- * @default "div"
820
+ * @defaultValue "div"
821
821
  */
822
822
  as?: React$1.ElementType | null;
823
823
  /** The ID of the parameter. */
@@ -830,7 +830,7 @@ declare const UniformRichText: React$1.ForwardRefExoticComponent<{
830
830
  /**
831
831
  * Sets the value to show in Canvas editor when the parameter value is empty.
832
832
  * Can be a static string, or a function to generate the placeholder out of parameter info.
833
- * @default undefined
833
+ * @defaultValue undefined
834
834
  */
835
835
  placeholder?: string | ((parameter: {
836
836
  id: string;
@@ -896,7 +896,7 @@ type UseUniformContextualEditingStateProps = {
896
896
  /**
897
897
  * When set to true, the hook will return the global contextual state no matter where its used.
898
898
  * When set to false, it will return only the state relevant to the current component (determined using `useUniformCurrentComponent`).
899
- * @default false
899
+ * @defaultValue false
900
900
  **/
901
901
  global?: boolean;
902
902
  };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
2
2
  import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, UpdateContextualEditingStateInternalMessage } from '@uniformdev/canvas';
3
3
  export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
4
- import { a as PureUniformTextProps } from './PureUniformText-CzdaUBnC.js';
4
+ import { a as PureUniformTextProps } from './PureUniformText-BFhXK0lt.js';
5
5
  import { CompositionMetadata } from '@uniformdev/context';
6
6
  import { RichTextNode } from '@uniformdev/richtext';
7
7
  export { linkParamValueToAnchorProps } from '@uniformdev/richtext';
@@ -792,7 +792,7 @@ type RenderRichTextComponentResolver = (node: RichTextNode) => RichTextRendererC
792
792
  type UniformRichTextProps = {
793
793
  /**
794
794
  * The name of the HTML tag to render.
795
- * @default "div"
795
+ * @defaultValue "div"
796
796
  */
797
797
  as?: React$1.ElementType | null;
798
798
  /** The ID of the parameter. */
@@ -805,7 +805,7 @@ type UniformRichTextProps = {
805
805
  /**
806
806
  * Sets the value to show in Canvas editor when the parameter value is empty.
807
807
  * Can be a static string, or a function to generate the placeholder out of parameter info.
808
- * @default undefined
808
+ * @defaultValue undefined
809
809
  */
810
810
  placeholder?: string | ((parameter: {
811
811
  id: string;
@@ -817,7 +817,7 @@ type UniformRichTextProps = {
817
817
  declare const UniformRichText: React$1.ForwardRefExoticComponent<{
818
818
  /**
819
819
  * The name of the HTML tag to render.
820
- * @default "div"
820
+ * @defaultValue "div"
821
821
  */
822
822
  as?: React$1.ElementType | null;
823
823
  /** The ID of the parameter. */
@@ -830,7 +830,7 @@ declare const UniformRichText: React$1.ForwardRefExoticComponent<{
830
830
  /**
831
831
  * Sets the value to show in Canvas editor when the parameter value is empty.
832
832
  * Can be a static string, or a function to generate the placeholder out of parameter info.
833
- * @default undefined
833
+ * @defaultValue undefined
834
834
  */
835
835
  placeholder?: string | ((parameter: {
836
836
  id: string;
@@ -896,7 +896,7 @@ type UseUniformContextualEditingStateProps = {
896
896
  /**
897
897
  * When set to true, the hook will return the global contextual state no matter where its used.
898
898
  * When set to false, it will return only the state relevant to the current component (determined using `useUniformCurrentComponent`).
899
- * @default false
899
+ * @defaultValue false
900
900
  **/
901
901
  global?: boolean;
902
902
  };
package/dist/index.esm.js CHANGED
@@ -780,18 +780,34 @@ var LinebreakRichTextNode = () => {
780
780
  };
781
781
 
782
782
  // src/components/UniformRichText/nodes/ListItemRichTextNode.tsx
783
+ import { getRichTextListItemValue } from "@uniformdev/richtext";
783
784
  import React13 from "react";
784
785
  var ListItemRichTextNode = ({ children, node }) => {
785
786
  const { value } = node;
786
- return /* @__PURE__ */ React13.createElement("li", { value: Number.isFinite(value) && value > 0 ? value : void 0 }, children);
787
+ const normalizedValue = getRichTextListItemValue(value);
788
+ return /* @__PURE__ */ React13.createElement(
789
+ "li",
790
+ {
791
+ value: typeof normalizedValue === "number" && Number.isFinite(normalizedValue) && normalizedValue > 0 ? normalizedValue : void 0
792
+ },
793
+ children
794
+ );
787
795
  };
788
796
 
789
797
  // src/components/UniformRichText/nodes/ListRichTextNode.tsx
798
+ import { getRichTextListStart } from "@uniformdev/richtext";
790
799
  import React14 from "react";
791
800
  var ListRichTextNode = ({ children, node }) => {
792
801
  const { tag, start } = node;
793
802
  const ListTag = tag != null ? tag : "ul";
794
- return /* @__PURE__ */ React14.createElement(ListTag, { start: Number.isFinite(start) && start > 0 ? start : void 0 }, children);
803
+ const normalizedStart = getRichTextListStart(start);
804
+ return /* @__PURE__ */ React14.createElement(
805
+ ListTag,
806
+ {
807
+ start: typeof normalizedStart === "number" && Number.isFinite(normalizedStart) && normalizedStart > 0 ? normalizedStart : void 0
808
+ },
809
+ children
810
+ );
795
811
  };
796
812
 
797
813
  // src/components/UniformRichText/nodes/ParagraphRichTextNode.tsx
package/dist/index.js CHANGED
@@ -758,11 +758,11 @@ var LinkRichTextNode = ({ children, node }) => {
758
758
 
759
759
  // src/components/UniformRichText/UniformRichText.tsx
760
760
  var import_canvas11 = require("@uniformdev/canvas");
761
- var import_richtext6 = require("@uniformdev/richtext");
761
+ var import_richtext8 = require("@uniformdev/richtext");
762
762
  var import_react22 = __toESM(require("react"));
763
763
 
764
764
  // src/components/UniformRichText/UniformRichTextNode.tsx
765
- var import_richtext5 = require("@uniformdev/richtext");
765
+ var import_richtext7 = require("@uniformdev/richtext");
766
766
  var import_react21 = __toESM(require("react"));
767
767
 
768
768
  // src/components/UniformRichText/nodes/AssetRichTextNode.tsx
@@ -800,41 +800,57 @@ var LinebreakRichTextNode = () => {
800
800
  };
801
801
 
802
802
  // src/components/UniformRichText/nodes/ListItemRichTextNode.tsx
803
+ var import_richtext2 = require("@uniformdev/richtext");
803
804
  var import_react15 = __toESM(require("react"));
804
805
  var ListItemRichTextNode = ({ children, node }) => {
805
806
  const { value } = node;
806
- return /* @__PURE__ */ import_react15.default.createElement("li", { value: Number.isFinite(value) && value > 0 ? value : void 0 }, children);
807
+ const normalizedValue = (0, import_richtext2.getRichTextListItemValue)(value);
808
+ return /* @__PURE__ */ import_react15.default.createElement(
809
+ "li",
810
+ {
811
+ value: typeof normalizedValue === "number" && Number.isFinite(normalizedValue) && normalizedValue > 0 ? normalizedValue : void 0
812
+ },
813
+ children
814
+ );
807
815
  };
808
816
 
809
817
  // src/components/UniformRichText/nodes/ListRichTextNode.tsx
818
+ var import_richtext3 = require("@uniformdev/richtext");
810
819
  var import_react16 = __toESM(require("react"));
811
820
  var ListRichTextNode = ({ children, node }) => {
812
821
  const { tag, start } = node;
813
822
  const ListTag = tag != null ? tag : "ul";
814
- return /* @__PURE__ */ import_react16.default.createElement(ListTag, { start: Number.isFinite(start) && start > 0 ? start : void 0 }, children);
823
+ const normalizedStart = (0, import_richtext3.getRichTextListStart)(start);
824
+ return /* @__PURE__ */ import_react16.default.createElement(
825
+ ListTag,
826
+ {
827
+ start: typeof normalizedStart === "number" && Number.isFinite(normalizedStart) && normalizedStart > 0 ? normalizedStart : void 0
828
+ },
829
+ children
830
+ );
815
831
  };
816
832
 
817
833
  // src/components/UniformRichText/nodes/ParagraphRichTextNode.tsx
818
- var import_richtext2 = require("@uniformdev/richtext");
834
+ var import_richtext4 = require("@uniformdev/richtext");
819
835
  var import_react17 = __toESM(require("react"));
820
836
  var ParagraphRichTextNode = ({ children, node }) => {
821
837
  const { format, direction } = node;
822
838
  return /* @__PURE__ */ import_react17.default.createElement(
823
839
  "p",
824
840
  {
825
- dir: (0, import_richtext2.isPureDirection)(direction) ? direction : void 0,
826
- style: (0, import_richtext2.isPureTextAlign)(format) ? { textAlign: format } : void 0
841
+ dir: (0, import_richtext4.isPureDirection)(direction) ? direction : void 0,
842
+ style: (0, import_richtext4.isPureTextAlign)(format) ? { textAlign: format } : void 0
827
843
  },
828
844
  children
829
845
  );
830
846
  };
831
847
 
832
848
  // src/components/UniformRichText/nodes/TableCellRichTextNode.tsx
833
- var import_richtext3 = require("@uniformdev/richtext");
849
+ var import_richtext5 = require("@uniformdev/richtext");
834
850
  var import_react18 = __toESM(require("react"));
835
851
  var TableCellRichTextNode = ({ children, node }) => {
836
852
  const { headerState } = node;
837
- const TableCellTag = (0, import_richtext3.getRichTextTagFromTableCellHeaderState)(headerState);
853
+ const TableCellTag = (0, import_richtext5.getRichTextTagFromTableCellHeaderState)(headerState);
838
854
  return /* @__PURE__ */ import_react18.default.createElement(TableCellTag, null, children);
839
855
  };
840
856
 
@@ -845,18 +861,18 @@ var TabRichTextNode = () => {
845
861
  };
846
862
 
847
863
  // src/components/UniformRichText/nodes/TextRichTextNode.tsx
848
- var import_richtext4 = require("@uniformdev/richtext");
864
+ var import_richtext6 = require("@uniformdev/richtext");
849
865
  var import_react20 = __toESM(require("react"));
850
866
  var TextRichTextNode = ({ node }) => {
851
867
  const { text, format } = node;
852
- const tags = (0, import_richtext4.getRichTextTagsFromTextFormat)(format);
868
+ const tags = (0, import_richtext6.getRichTextTagsFromTextFormat)(format);
853
869
  return /* @__PURE__ */ import_react20.default.createElement(import_react20.default.Fragment, null, tags.length > 0 ? tags.reduceRight((children, Tag) => /* @__PURE__ */ import_react20.default.createElement(Tag, null, children), text) : text);
854
870
  };
855
871
 
856
872
  // src/components/UniformRichText/UniformRichTextNode.tsx
857
873
  function UniformRichTextNode({ node, ...props }) {
858
874
  var _a;
859
- if (!(0, import_richtext5.isRichTextNode)(node)) return null;
875
+ if (!(0, import_richtext7.isRichTextNode)(node)) return null;
860
876
  let NodeRenderer = (_a = props.resolveRichTextRenderer) == null ? void 0 : _a.call(props, node);
861
877
  if (typeof NodeRenderer === "undefined") {
862
878
  NodeRenderer = resolveRichTextDefaultRenderer(node);
@@ -906,10 +922,10 @@ var UniformRichText = import_react22.default.forwardRef(function UniformRichText
906
922
  const placeholderProp = placeholder != null ? placeholder : contextualEditingDefaultPlaceholder;
907
923
  const computedPlaceholder = typeof placeholderProp === "function" ? placeholderProp({ id: parameterId }) : placeholderProp;
908
924
  const value = parameter.value;
909
- if (!value || !(0, import_richtext6.isRichTextValue)(value)) return null;
910
- if (!isContextualEditing && (0, import_richtext6.isRichTextValueConsideredEmpty)(value)) return null;
925
+ if (!value || !(0, import_richtext8.isRichTextValue)(value)) return null;
926
+ if (!isContextualEditing && (0, import_richtext8.isRichTextValueConsideredEmpty)(value)) return null;
911
927
  if (!Tag) {
912
- return isContextualEditing && (0, import_richtext6.isRichTextValueConsideredEmpty)(value) ? /* @__PURE__ */ import_react22.default.createElement(
928
+ return isContextualEditing && (0, import_richtext8.isRichTextValueConsideredEmpty)(value) ? /* @__PURE__ */ import_react22.default.createElement(
913
929
  "p",
914
930
  {
915
931
  ...{
@@ -932,7 +948,7 @@ var UniformRichText = import_react22.default.forwardRef(function UniformRichText
932
948
  [import_canvas11.ATTRIBUTE_PARAMETER_TYPE]: "richText"
933
949
  } : {}
934
950
  },
935
- (0, import_richtext6.isRichTextValueConsideredEmpty)(value) ? /* @__PURE__ */ import_react22.default.createElement("p", null, /* @__PURE__ */ import_react22.default.createElement("i", null, computedPlaceholder)) : /* @__PURE__ */ import_react22.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
951
+ (0, import_richtext8.isRichTextValueConsideredEmpty)(value) ? /* @__PURE__ */ import_react22.default.createElement("p", null, /* @__PURE__ */ import_react22.default.createElement("i", null, computedPlaceholder)) : /* @__PURE__ */ import_react22.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
936
952
  );
937
953
  });
938
954
 
package/dist/index.mjs CHANGED
@@ -780,18 +780,34 @@ var LinebreakRichTextNode = () => {
780
780
  };
781
781
 
782
782
  // src/components/UniformRichText/nodes/ListItemRichTextNode.tsx
783
+ import { getRichTextListItemValue } from "@uniformdev/richtext";
783
784
  import React13 from "react";
784
785
  var ListItemRichTextNode = ({ children, node }) => {
785
786
  const { value } = node;
786
- return /* @__PURE__ */ React13.createElement("li", { value: Number.isFinite(value) && value > 0 ? value : void 0 }, children);
787
+ const normalizedValue = getRichTextListItemValue(value);
788
+ return /* @__PURE__ */ React13.createElement(
789
+ "li",
790
+ {
791
+ value: typeof normalizedValue === "number" && Number.isFinite(normalizedValue) && normalizedValue > 0 ? normalizedValue : void 0
792
+ },
793
+ children
794
+ );
787
795
  };
788
796
 
789
797
  // src/components/UniformRichText/nodes/ListRichTextNode.tsx
798
+ import { getRichTextListStart } from "@uniformdev/richtext";
790
799
  import React14 from "react";
791
800
  var ListRichTextNode = ({ children, node }) => {
792
801
  const { tag, start } = node;
793
802
  const ListTag = tag != null ? tag : "ul";
794
- return /* @__PURE__ */ React14.createElement(ListTag, { start: Number.isFinite(start) && start > 0 ? start : void 0 }, children);
803
+ const normalizedStart = getRichTextListStart(start);
804
+ return /* @__PURE__ */ React14.createElement(
805
+ ListTag,
806
+ {
807
+ start: typeof normalizedStart === "number" && Number.isFinite(normalizedStart) && normalizedStart > 0 ? normalizedStart : void 0
808
+ },
809
+ children
810
+ );
795
811
  };
796
812
 
797
813
  // src/components/UniformRichText/nodes/ParagraphRichTextNode.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-react",
3
- "version": "20.74.7-alpha.12+f93a44837e",
3
+ "version": "20.74.7-alpha.14.sha-79426f9415",
4
4
  "description": "React SDK for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -44,10 +44,10 @@
44
44
  "apidocs-extract": "api-extractor run --local"
45
45
  },
46
46
  "dependencies": {
47
- "@uniformdev/canvas": "20.74.7-alpha.12+f93a44837e",
48
- "@uniformdev/context": "20.74.7-alpha.12+f93a44837e",
49
- "@uniformdev/context-react": "20.74.7-alpha.12+f93a44837e",
50
- "@uniformdev/richtext": "20.74.7-alpha.12+f93a44837e"
47
+ "@uniformdev/canvas": "20.74.7-alpha.14.sha-79426f9415",
48
+ "@uniformdev/context": "20.74.7-alpha.14.sha-79426f9415",
49
+ "@uniformdev/context-react": "20.74.7-alpha.14.sha-79426f9415",
50
+ "@uniformdev/richtext": "20.74.7-alpha.14.sha-79426f9415"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "immer": ">= 10",
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "gitHead": "f93a44837e168f8ece4f56657a29a6f72467c1cb"
69
+ "gitHead": "79426f9415aefb8cf26dd8fe7a265b24a490749c"
70
70
  }