@uniformdev/canvas-react 19.184.1 → 19.185.1-alpha.8
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.esm.js +52 -36
- package/dist/index.js +74 -58
- package/dist/index.mjs +52 -36
- package/package.json +6 -6
package/dist/index.esm.js
CHANGED
|
@@ -696,55 +696,70 @@ import {
|
|
|
696
696
|
ATTRIBUTE_PARAMETER_TYPE
|
|
697
697
|
} from "@uniformdev/canvas";
|
|
698
698
|
import { isRichTextValue, isRichTextValueConsideredEmpty } from "@uniformdev/richtext";
|
|
699
|
-
import
|
|
699
|
+
import React20 from "react";
|
|
700
700
|
|
|
701
701
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
702
702
|
import { isRichTextNode } from "@uniformdev/richtext";
|
|
703
|
-
import
|
|
703
|
+
import React19 from "react";
|
|
704
704
|
|
|
705
|
-
// src/components/UniformRichText/nodes/
|
|
705
|
+
// src/components/UniformRichText/nodes/AssetRichTextNode.tsx
|
|
706
|
+
import { ASSETS_SOURCE_UNIFORM } from "@uniformdev/canvas";
|
|
706
707
|
import React9 from "react";
|
|
708
|
+
var AssetRichTextNode = ({ node }) => {
|
|
709
|
+
var _a, _b;
|
|
710
|
+
const { __asset } = node;
|
|
711
|
+
if (__asset === void 0) {
|
|
712
|
+
return null;
|
|
713
|
+
}
|
|
714
|
+
if (__asset.type !== "image" || __asset._source !== ASSETS_SOURCE_UNIFORM) {
|
|
715
|
+
return null;
|
|
716
|
+
}
|
|
717
|
+
return /* @__PURE__ */ React9.createElement("figure", null, /* @__PURE__ */ React9.createElement("img", { src: __asset.fields.url.value, alt: (_a = __asset.fields.title) == null ? void 0 : _a.value }), ((_b = __asset.fields.description) == null ? void 0 : _b.value) ? /* @__PURE__ */ React9.createElement("figcaption", null, __asset.fields.description.value) : null);
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
// src/components/UniformRichText/nodes/HeadingRichTextNode.tsx
|
|
721
|
+
import React10 from "react";
|
|
707
722
|
var HeadingRichTextNode = ({ children, node }) => {
|
|
708
723
|
const { tag } = node;
|
|
709
724
|
const HTag = tag != null ? tag : "h1";
|
|
710
|
-
return /* @__PURE__ */
|
|
725
|
+
return /* @__PURE__ */ React10.createElement(HTag, null, children);
|
|
711
726
|
};
|
|
712
727
|
|
|
713
728
|
// src/components/UniformRichText/nodes/LinebreakRichTextNode.tsx
|
|
714
|
-
import
|
|
729
|
+
import React11 from "react";
|
|
715
730
|
var LinebreakRichTextNode = () => {
|
|
716
|
-
return /* @__PURE__ */
|
|
731
|
+
return /* @__PURE__ */ React11.createElement("br", null);
|
|
717
732
|
};
|
|
718
733
|
|
|
719
734
|
// src/components/UniformRichText/nodes/LinkRichTextNode.tsx
|
|
720
735
|
import { linkParamValueToHref } from "@uniformdev/richtext";
|
|
721
|
-
import
|
|
736
|
+
import React12 from "react";
|
|
722
737
|
var LinkRichTextNode = ({ children, node }) => {
|
|
723
738
|
const { link } = node;
|
|
724
|
-
return /* @__PURE__ */
|
|
739
|
+
return /* @__PURE__ */ React12.createElement("a", { href: linkParamValueToHref(link) }, children);
|
|
725
740
|
};
|
|
726
741
|
|
|
727
742
|
// src/components/UniformRichText/nodes/ListItemRichTextNode.tsx
|
|
728
|
-
import
|
|
743
|
+
import React13 from "react";
|
|
729
744
|
var ListItemRichTextNode = ({ children, node }) => {
|
|
730
745
|
const { value } = node;
|
|
731
|
-
return /* @__PURE__ */
|
|
746
|
+
return /* @__PURE__ */ React13.createElement("li", { value: Number.isFinite(value) && value > 0 ? value : void 0 }, children);
|
|
732
747
|
};
|
|
733
748
|
|
|
734
749
|
// src/components/UniformRichText/nodes/ListRichTextNode.tsx
|
|
735
|
-
import
|
|
750
|
+
import React14 from "react";
|
|
736
751
|
var ListRichTextNode = ({ children, node }) => {
|
|
737
752
|
const { tag, start } = node;
|
|
738
753
|
const ListTag = tag != null ? tag : "ul";
|
|
739
|
-
return /* @__PURE__ */
|
|
754
|
+
return /* @__PURE__ */ React14.createElement(ListTag, { start: Number.isFinite(start) && start > 0 ? start : void 0 }, children);
|
|
740
755
|
};
|
|
741
756
|
|
|
742
757
|
// src/components/UniformRichText/nodes/ParagraphRichTextNode.tsx
|
|
743
758
|
import { isPureDirection, isPureTextAlign } from "@uniformdev/richtext";
|
|
744
|
-
import
|
|
759
|
+
import React15 from "react";
|
|
745
760
|
var ParagraphRichTextNode = ({ children, node }) => {
|
|
746
761
|
const { format, direction } = node;
|
|
747
|
-
return /* @__PURE__ */
|
|
762
|
+
return /* @__PURE__ */ React15.createElement(
|
|
748
763
|
"p",
|
|
749
764
|
{
|
|
750
765
|
dir: isPureDirection(direction) ? direction : void 0,
|
|
@@ -756,26 +771,26 @@ var ParagraphRichTextNode = ({ children, node }) => {
|
|
|
756
771
|
|
|
757
772
|
// src/components/UniformRichText/nodes/TableCellRichTextNode.tsx
|
|
758
773
|
import { getRichTextTagFromTableCellHeaderState } from "@uniformdev/richtext";
|
|
759
|
-
import
|
|
774
|
+
import React16 from "react";
|
|
760
775
|
var TableCellRichTextNode = ({ children, node }) => {
|
|
761
776
|
const { headerState } = node;
|
|
762
777
|
const TableCellTag = getRichTextTagFromTableCellHeaderState(headerState);
|
|
763
|
-
return /* @__PURE__ */
|
|
778
|
+
return /* @__PURE__ */ React16.createElement(TableCellTag, null, children);
|
|
764
779
|
};
|
|
765
780
|
|
|
766
781
|
// src/components/UniformRichText/nodes/TabRichTextNode.tsx
|
|
767
|
-
import
|
|
782
|
+
import React17 from "react";
|
|
768
783
|
var TabRichTextNode = () => {
|
|
769
|
-
return /* @__PURE__ */
|
|
784
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, " ");
|
|
770
785
|
};
|
|
771
786
|
|
|
772
787
|
// src/components/UniformRichText/nodes/TextRichTextNode.tsx
|
|
773
788
|
import { getRichTextTagsFromTextFormat } from "@uniformdev/richtext";
|
|
774
|
-
import
|
|
789
|
+
import React18 from "react";
|
|
775
790
|
var TextRichTextNode = ({ node }) => {
|
|
776
791
|
const { text, format } = node;
|
|
777
792
|
const tags = getRichTextTagsFromTextFormat(format);
|
|
778
|
-
return /* @__PURE__ */
|
|
793
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, tags.length > 0 ? tags.reduceRight((children, Tag) => /* @__PURE__ */ React18.createElement(Tag, null, children), text) : text);
|
|
779
794
|
};
|
|
780
795
|
|
|
781
796
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
@@ -789,8 +804,8 @@ function UniformRichTextNode({ node, ...props }) {
|
|
|
789
804
|
if (!NodeRenderer) {
|
|
790
805
|
return null;
|
|
791
806
|
}
|
|
792
|
-
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */
|
|
793
|
-
return /* @__PURE__ */
|
|
807
|
+
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */ React19.createElement(UniformRichTextNode, { ...props, key: i, node: childNode })) : null;
|
|
808
|
+
return /* @__PURE__ */ React19.createElement(NodeRenderer, { node }, children);
|
|
794
809
|
}
|
|
795
810
|
var rendererMap = /* @__PURE__ */ new Map([
|
|
796
811
|
["heading", HeadingRichTextNode],
|
|
@@ -799,27 +814,28 @@ var rendererMap = /* @__PURE__ */ new Map([
|
|
|
799
814
|
["list", ListRichTextNode],
|
|
800
815
|
["listitem", ListItemRichTextNode],
|
|
801
816
|
["paragraph", ParagraphRichTextNode],
|
|
802
|
-
["quote", ({ children }) => /* @__PURE__ */
|
|
817
|
+
["quote", ({ children }) => /* @__PURE__ */ React19.createElement("blockquote", null, children)],
|
|
803
818
|
[
|
|
804
819
|
"code",
|
|
805
|
-
({ children }) => /* @__PURE__ */
|
|
820
|
+
({ children }) => /* @__PURE__ */ React19.createElement("pre", null, /* @__PURE__ */ React19.createElement("code", null, children))
|
|
806
821
|
],
|
|
807
|
-
["root", ({ children }) => /* @__PURE__ */
|
|
822
|
+
["root", ({ children }) => /* @__PURE__ */ React19.createElement(React19.Fragment, null, children)],
|
|
808
823
|
["text", TextRichTextNode],
|
|
809
824
|
["tab", TabRichTextNode],
|
|
810
825
|
[
|
|
811
826
|
"table",
|
|
812
|
-
({ children }) => /* @__PURE__ */
|
|
827
|
+
({ children }) => /* @__PURE__ */ React19.createElement("table", null, /* @__PURE__ */ React19.createElement("tbody", null, children))
|
|
813
828
|
],
|
|
814
|
-
["tablerow", ({ children }) => /* @__PURE__ */
|
|
815
|
-
["tablecell", TableCellRichTextNode]
|
|
829
|
+
["tablerow", ({ children }) => /* @__PURE__ */ React19.createElement("tr", null, children)],
|
|
830
|
+
["tablecell", TableCellRichTextNode],
|
|
831
|
+
["asset", AssetRichTextNode]
|
|
816
832
|
]);
|
|
817
833
|
var resolveRichTextDefaultRenderer = (node) => {
|
|
818
834
|
return rendererMap.get(node.type);
|
|
819
835
|
};
|
|
820
836
|
|
|
821
837
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
822
|
-
var UniformRichText =
|
|
838
|
+
var UniformRichText = React20.forwardRef(function UniformRichText2({ parameterId, resolveRichTextRenderer, as: Tag = "div", placeholder, ...props }, ref) {
|
|
823
839
|
var _a;
|
|
824
840
|
const { data: componentData, contextualEditingDefaultPlaceholder } = useUniformCurrentComponent();
|
|
825
841
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
@@ -832,7 +848,7 @@ var UniformRichText = React19.forwardRef(function UniformRichText2({ parameterId
|
|
|
832
848
|
const value = parameter.value;
|
|
833
849
|
if (!value || !isRichTextValue(value)) return null;
|
|
834
850
|
if (!isContextualEditing && isRichTextValueConsideredEmpty(value)) return null;
|
|
835
|
-
return Tag === null ? /* @__PURE__ */
|
|
851
|
+
return Tag === null ? /* @__PURE__ */ React20.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ React20.createElement(
|
|
836
852
|
Tag,
|
|
837
853
|
{
|
|
838
854
|
ref,
|
|
@@ -843,15 +859,15 @@ var UniformRichText = React19.forwardRef(function UniformRichText2({ parameterId
|
|
|
843
859
|
[ATTRIBUTE_PARAMETER_TYPE]: "richText"
|
|
844
860
|
} : {}
|
|
845
861
|
},
|
|
846
|
-
isRichTextValueConsideredEmpty(value) ? /* @__PURE__ */
|
|
862
|
+
isRichTextValueConsideredEmpty(value) ? /* @__PURE__ */ React20.createElement("p", null, /* @__PURE__ */ React20.createElement("i", null, computedPlaceholder)) : /* @__PURE__ */ React20.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
|
|
847
863
|
);
|
|
848
864
|
});
|
|
849
865
|
|
|
850
866
|
// src/components/UniformText.tsx
|
|
851
|
-
import
|
|
867
|
+
import React22, { useState as useState2 } from "react";
|
|
852
868
|
|
|
853
869
|
// src/components/PureUniformText.tsx
|
|
854
|
-
import
|
|
870
|
+
import React21 from "react";
|
|
855
871
|
var PureUniformText = ({
|
|
856
872
|
as: Tag = "span",
|
|
857
873
|
parameterId,
|
|
@@ -870,10 +886,10 @@ var PureUniformText = ({
|
|
|
870
886
|
return null;
|
|
871
887
|
}
|
|
872
888
|
if (!isContextualEditing) {
|
|
873
|
-
return /* @__PURE__ */
|
|
889
|
+
return /* @__PURE__ */ React21.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
|
|
874
890
|
}
|
|
875
891
|
const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
|
|
876
|
-
return /* @__PURE__ */
|
|
892
|
+
return /* @__PURE__ */ React21.createElement(
|
|
877
893
|
Tag,
|
|
878
894
|
{
|
|
879
895
|
...props,
|
|
@@ -911,7 +927,7 @@ var UniformText = ({
|
|
|
911
927
|
}
|
|
912
928
|
const placeholderProp = placeholder != null ? placeholder : contextualEditingDefaultPlaceholder;
|
|
913
929
|
const computedPlaceholder = typeof placeholderProp === "function" ? placeholderProp({ id: parameterId }) : placeholderProp;
|
|
914
|
-
return /* @__PURE__ */
|
|
930
|
+
return /* @__PURE__ */ React22.createElement(
|
|
915
931
|
PureUniformText,
|
|
916
932
|
{
|
|
917
933
|
...props,
|
package/dist/index.js
CHANGED
|
@@ -718,57 +718,72 @@ var UniformPlayground = ({
|
|
|
718
718
|
};
|
|
719
719
|
|
|
720
720
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
721
|
-
var
|
|
721
|
+
var import_canvas12 = require("@uniformdev/canvas");
|
|
722
722
|
var import_richtext6 = require("@uniformdev/richtext");
|
|
723
|
-
var
|
|
723
|
+
var import_react22 = __toESM(require("react"));
|
|
724
724
|
|
|
725
725
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
726
726
|
var import_richtext5 = require("@uniformdev/richtext");
|
|
727
|
-
var
|
|
727
|
+
var import_react21 = __toESM(require("react"));
|
|
728
728
|
|
|
729
|
-
// src/components/UniformRichText/nodes/
|
|
729
|
+
// src/components/UniformRichText/nodes/AssetRichTextNode.tsx
|
|
730
|
+
var import_canvas11 = require("@uniformdev/canvas");
|
|
730
731
|
var import_react11 = __toESM(require("react"));
|
|
732
|
+
var AssetRichTextNode = ({ node }) => {
|
|
733
|
+
var _a, _b;
|
|
734
|
+
const { __asset } = node;
|
|
735
|
+
if (__asset === void 0) {
|
|
736
|
+
return null;
|
|
737
|
+
}
|
|
738
|
+
if (__asset.type !== "image" || __asset._source !== import_canvas11.ASSETS_SOURCE_UNIFORM) {
|
|
739
|
+
return null;
|
|
740
|
+
}
|
|
741
|
+
return /* @__PURE__ */ import_react11.default.createElement("figure", null, /* @__PURE__ */ import_react11.default.createElement("img", { src: __asset.fields.url.value, alt: (_a = __asset.fields.title) == null ? void 0 : _a.value }), ((_b = __asset.fields.description) == null ? void 0 : _b.value) ? /* @__PURE__ */ import_react11.default.createElement("figcaption", null, __asset.fields.description.value) : null);
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
// src/components/UniformRichText/nodes/HeadingRichTextNode.tsx
|
|
745
|
+
var import_react12 = __toESM(require("react"));
|
|
731
746
|
var HeadingRichTextNode = ({ children, node }) => {
|
|
732
747
|
const { tag } = node;
|
|
733
748
|
const HTag = tag != null ? tag : "h1";
|
|
734
|
-
return /* @__PURE__ */
|
|
749
|
+
return /* @__PURE__ */ import_react12.default.createElement(HTag, null, children);
|
|
735
750
|
};
|
|
736
751
|
|
|
737
752
|
// src/components/UniformRichText/nodes/LinebreakRichTextNode.tsx
|
|
738
|
-
var
|
|
753
|
+
var import_react13 = __toESM(require("react"));
|
|
739
754
|
var LinebreakRichTextNode = () => {
|
|
740
|
-
return /* @__PURE__ */
|
|
755
|
+
return /* @__PURE__ */ import_react13.default.createElement("br", null);
|
|
741
756
|
};
|
|
742
757
|
|
|
743
758
|
// src/components/UniformRichText/nodes/LinkRichTextNode.tsx
|
|
744
759
|
var import_richtext = require("@uniformdev/richtext");
|
|
745
|
-
var
|
|
760
|
+
var import_react14 = __toESM(require("react"));
|
|
746
761
|
var LinkRichTextNode = ({ children, node }) => {
|
|
747
762
|
const { link } = node;
|
|
748
|
-
return /* @__PURE__ */
|
|
763
|
+
return /* @__PURE__ */ import_react14.default.createElement("a", { href: (0, import_richtext.linkParamValueToHref)(link) }, children);
|
|
749
764
|
};
|
|
750
765
|
|
|
751
766
|
// src/components/UniformRichText/nodes/ListItemRichTextNode.tsx
|
|
752
|
-
var
|
|
767
|
+
var import_react15 = __toESM(require("react"));
|
|
753
768
|
var ListItemRichTextNode = ({ children, node }) => {
|
|
754
769
|
const { value } = node;
|
|
755
|
-
return /* @__PURE__ */
|
|
770
|
+
return /* @__PURE__ */ import_react15.default.createElement("li", { value: Number.isFinite(value) && value > 0 ? value : void 0 }, children);
|
|
756
771
|
};
|
|
757
772
|
|
|
758
773
|
// src/components/UniformRichText/nodes/ListRichTextNode.tsx
|
|
759
|
-
var
|
|
774
|
+
var import_react16 = __toESM(require("react"));
|
|
760
775
|
var ListRichTextNode = ({ children, node }) => {
|
|
761
776
|
const { tag, start } = node;
|
|
762
777
|
const ListTag = tag != null ? tag : "ul";
|
|
763
|
-
return /* @__PURE__ */
|
|
778
|
+
return /* @__PURE__ */ import_react16.default.createElement(ListTag, { start: Number.isFinite(start) && start > 0 ? start : void 0 }, children);
|
|
764
779
|
};
|
|
765
780
|
|
|
766
781
|
// src/components/UniformRichText/nodes/ParagraphRichTextNode.tsx
|
|
767
782
|
var import_richtext2 = require("@uniformdev/richtext");
|
|
768
|
-
var
|
|
783
|
+
var import_react17 = __toESM(require("react"));
|
|
769
784
|
var ParagraphRichTextNode = ({ children, node }) => {
|
|
770
785
|
const { format, direction } = node;
|
|
771
|
-
return /* @__PURE__ */
|
|
786
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
772
787
|
"p",
|
|
773
788
|
{
|
|
774
789
|
dir: (0, import_richtext2.isPureDirection)(direction) ? direction : void 0,
|
|
@@ -780,26 +795,26 @@ var ParagraphRichTextNode = ({ children, node }) => {
|
|
|
780
795
|
|
|
781
796
|
// src/components/UniformRichText/nodes/TableCellRichTextNode.tsx
|
|
782
797
|
var import_richtext3 = require("@uniformdev/richtext");
|
|
783
|
-
var
|
|
798
|
+
var import_react18 = __toESM(require("react"));
|
|
784
799
|
var TableCellRichTextNode = ({ children, node }) => {
|
|
785
800
|
const { headerState } = node;
|
|
786
801
|
const TableCellTag = (0, import_richtext3.getRichTextTagFromTableCellHeaderState)(headerState);
|
|
787
|
-
return /* @__PURE__ */
|
|
802
|
+
return /* @__PURE__ */ import_react18.default.createElement(TableCellTag, null, children);
|
|
788
803
|
};
|
|
789
804
|
|
|
790
805
|
// src/components/UniformRichText/nodes/TabRichTextNode.tsx
|
|
791
|
-
var
|
|
806
|
+
var import_react19 = __toESM(require("react"));
|
|
792
807
|
var TabRichTextNode = () => {
|
|
793
|
-
return /* @__PURE__ */
|
|
808
|
+
return /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, " ");
|
|
794
809
|
};
|
|
795
810
|
|
|
796
811
|
// src/components/UniformRichText/nodes/TextRichTextNode.tsx
|
|
797
812
|
var import_richtext4 = require("@uniformdev/richtext");
|
|
798
|
-
var
|
|
813
|
+
var import_react20 = __toESM(require("react"));
|
|
799
814
|
var TextRichTextNode = ({ node }) => {
|
|
800
815
|
const { text, format } = node;
|
|
801
816
|
const tags = (0, import_richtext4.getRichTextTagsFromTextFormat)(format);
|
|
802
|
-
return /* @__PURE__ */
|
|
817
|
+
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);
|
|
803
818
|
};
|
|
804
819
|
|
|
805
820
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
@@ -813,8 +828,8 @@ function UniformRichTextNode({ node, ...props }) {
|
|
|
813
828
|
if (!NodeRenderer) {
|
|
814
829
|
return null;
|
|
815
830
|
}
|
|
816
|
-
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */
|
|
817
|
-
return /* @__PURE__ */
|
|
831
|
+
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */ import_react21.default.createElement(UniformRichTextNode, { ...props, key: i, node: childNode })) : null;
|
|
832
|
+
return /* @__PURE__ */ import_react21.default.createElement(NodeRenderer, { node }, children);
|
|
818
833
|
}
|
|
819
834
|
var rendererMap = /* @__PURE__ */ new Map([
|
|
820
835
|
["heading", HeadingRichTextNode],
|
|
@@ -823,27 +838,28 @@ var rendererMap = /* @__PURE__ */ new Map([
|
|
|
823
838
|
["list", ListRichTextNode],
|
|
824
839
|
["listitem", ListItemRichTextNode],
|
|
825
840
|
["paragraph", ParagraphRichTextNode],
|
|
826
|
-
["quote", ({ children }) => /* @__PURE__ */
|
|
841
|
+
["quote", ({ children }) => /* @__PURE__ */ import_react21.default.createElement("blockquote", null, children)],
|
|
827
842
|
[
|
|
828
843
|
"code",
|
|
829
|
-
({ children }) => /* @__PURE__ */
|
|
844
|
+
({ children }) => /* @__PURE__ */ import_react21.default.createElement("pre", null, /* @__PURE__ */ import_react21.default.createElement("code", null, children))
|
|
830
845
|
],
|
|
831
|
-
["root", ({ children }) => /* @__PURE__ */
|
|
846
|
+
["root", ({ children }) => /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, children)],
|
|
832
847
|
["text", TextRichTextNode],
|
|
833
848
|
["tab", TabRichTextNode],
|
|
834
849
|
[
|
|
835
850
|
"table",
|
|
836
|
-
({ children }) => /* @__PURE__ */
|
|
851
|
+
({ children }) => /* @__PURE__ */ import_react21.default.createElement("table", null, /* @__PURE__ */ import_react21.default.createElement("tbody", null, children))
|
|
837
852
|
],
|
|
838
|
-
["tablerow", ({ children }) => /* @__PURE__ */
|
|
839
|
-
["tablecell", TableCellRichTextNode]
|
|
853
|
+
["tablerow", ({ children }) => /* @__PURE__ */ import_react21.default.createElement("tr", null, children)],
|
|
854
|
+
["tablecell", TableCellRichTextNode],
|
|
855
|
+
["asset", AssetRichTextNode]
|
|
840
856
|
]);
|
|
841
857
|
var resolveRichTextDefaultRenderer = (node) => {
|
|
842
858
|
return rendererMap.get(node.type);
|
|
843
859
|
};
|
|
844
860
|
|
|
845
861
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
846
|
-
var UniformRichText =
|
|
862
|
+
var UniformRichText = import_react22.default.forwardRef(function UniformRichText2({ parameterId, resolveRichTextRenderer, as: Tag = "div", placeholder, ...props }, ref) {
|
|
847
863
|
var _a;
|
|
848
864
|
const { data: componentData, contextualEditingDefaultPlaceholder } = useUniformCurrentComponent();
|
|
849
865
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
@@ -856,26 +872,26 @@ var UniformRichText = import_react21.default.forwardRef(function UniformRichText
|
|
|
856
872
|
const value = parameter.value;
|
|
857
873
|
if (!value || !(0, import_richtext6.isRichTextValue)(value)) return null;
|
|
858
874
|
if (!isContextualEditing && (0, import_richtext6.isRichTextValueConsideredEmpty)(value)) return null;
|
|
859
|
-
return Tag === null ? /* @__PURE__ */
|
|
875
|
+
return Tag === null ? /* @__PURE__ */ import_react22.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ import_react22.default.createElement(
|
|
860
876
|
Tag,
|
|
861
877
|
{
|
|
862
878
|
ref,
|
|
863
879
|
...props,
|
|
864
880
|
...isContextualEditing ? {
|
|
865
|
-
[
|
|
866
|
-
[
|
|
867
|
-
[
|
|
881
|
+
[import_canvas12.ATTRIBUTE_COMPONENT_ID]: componentData == null ? void 0 : componentData._id,
|
|
882
|
+
[import_canvas12.ATTRIBUTE_PARAMETER_ID]: parameterId,
|
|
883
|
+
[import_canvas12.ATTRIBUTE_PARAMETER_TYPE]: "richText"
|
|
868
884
|
} : {}
|
|
869
885
|
},
|
|
870
|
-
(0, import_richtext6.isRichTextValueConsideredEmpty)(value) ? /* @__PURE__ */
|
|
886
|
+
(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 })
|
|
871
887
|
);
|
|
872
888
|
});
|
|
873
889
|
|
|
874
890
|
// src/components/UniformText.tsx
|
|
875
|
-
var
|
|
891
|
+
var import_react24 = __toESM(require("react"));
|
|
876
892
|
|
|
877
893
|
// src/components/PureUniformText.tsx
|
|
878
|
-
var
|
|
894
|
+
var import_react23 = __toESM(require("react"));
|
|
879
895
|
var PureUniformText = ({
|
|
880
896
|
as: Tag = "span",
|
|
881
897
|
parameterId,
|
|
@@ -894,10 +910,10 @@ var PureUniformText = ({
|
|
|
894
910
|
return null;
|
|
895
911
|
}
|
|
896
912
|
if (!isContextualEditing) {
|
|
897
|
-
return /* @__PURE__ */
|
|
913
|
+
return /* @__PURE__ */ import_react23.default.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
|
|
898
914
|
}
|
|
899
915
|
const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
|
|
900
|
-
return /* @__PURE__ */
|
|
916
|
+
return /* @__PURE__ */ import_react23.default.createElement(
|
|
901
917
|
Tag,
|
|
902
918
|
{
|
|
903
919
|
...props,
|
|
@@ -926,7 +942,7 @@ var UniformText = ({
|
|
|
926
942
|
var _a, _b, _c;
|
|
927
943
|
const { data: componentData, contextualEditingDefaultPlaceholder } = useUniformCurrentComponent();
|
|
928
944
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
929
|
-
const [isFocused, setIsFocused] = (0,
|
|
945
|
+
const [isFocused, setIsFocused] = (0, import_react24.useState)(false);
|
|
930
946
|
const parameter = (_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId];
|
|
931
947
|
const isEditable = (_c = (_b = parameter == null ? void 0 : parameter._contextualEditing) == null ? void 0 : _b.isEditable) != null ? _c : false;
|
|
932
948
|
const shouldSkipCustomRendering = isFocused && isEditable;
|
|
@@ -935,7 +951,7 @@ var UniformText = ({
|
|
|
935
951
|
}
|
|
936
952
|
const placeholderProp = placeholder != null ? placeholder : contextualEditingDefaultPlaceholder;
|
|
937
953
|
const computedPlaceholder = typeof placeholderProp === "function" ? placeholderProp({ id: parameterId }) : placeholderProp;
|
|
938
|
-
return /* @__PURE__ */
|
|
954
|
+
return /* @__PURE__ */ import_react24.default.createElement(
|
|
939
955
|
PureUniformText,
|
|
940
956
|
{
|
|
941
957
|
...props,
|
|
@@ -958,35 +974,35 @@ var UniformText = ({
|
|
|
958
974
|
};
|
|
959
975
|
|
|
960
976
|
// src/helpers/getParameterAttributes.ts
|
|
961
|
-
var
|
|
977
|
+
var import_canvas13 = require("@uniformdev/canvas");
|
|
962
978
|
var getParameterAttributes = (options) => {
|
|
963
979
|
return {
|
|
964
|
-
...(0,
|
|
980
|
+
...(0, import_canvas13.getParameterAttributes)(options),
|
|
965
981
|
suppressContentEditableWarning: true
|
|
966
982
|
};
|
|
967
983
|
};
|
|
968
984
|
|
|
969
985
|
// src/hooks/useCompositionEventEffect.ts
|
|
970
|
-
var
|
|
971
|
-
var
|
|
986
|
+
var import_canvas14 = require("@uniformdev/canvas");
|
|
987
|
+
var import_react25 = require("react");
|
|
972
988
|
function useCompositionEventEffect({
|
|
973
989
|
enabled,
|
|
974
990
|
projectId,
|
|
975
991
|
compositionId,
|
|
976
992
|
effect
|
|
977
993
|
}) {
|
|
978
|
-
(0,
|
|
994
|
+
(0, import_react25.useEffect)(() => {
|
|
979
995
|
if (!enabled || !compositionId || !projectId) {
|
|
980
996
|
return;
|
|
981
997
|
}
|
|
982
998
|
let goodbye = void 0;
|
|
983
999
|
const loadEffect = async () => {
|
|
984
|
-
const eventBus = await (0,
|
|
1000
|
+
const eventBus = await (0, import_canvas14.createEventBus)();
|
|
985
1001
|
if (eventBus) {
|
|
986
|
-
goodbye = (0,
|
|
1002
|
+
goodbye = (0, import_canvas14.subscribeToComposition)({
|
|
987
1003
|
eventBus,
|
|
988
1004
|
compositionId,
|
|
989
|
-
compositionState:
|
|
1005
|
+
compositionState: import_canvas14.CANVAS_DRAFT_STATE,
|
|
990
1006
|
projectId,
|
|
991
1007
|
callback: effect,
|
|
992
1008
|
event: "updated"
|
|
@@ -1003,28 +1019,28 @@ function useCompositionEventEffect({
|
|
|
1003
1019
|
}
|
|
1004
1020
|
|
|
1005
1021
|
// src/hooks/useUniformContextualEditingState.ts
|
|
1006
|
-
var
|
|
1007
|
-
var
|
|
1022
|
+
var import_canvas15 = require("@uniformdev/canvas");
|
|
1023
|
+
var import_react26 = require("react");
|
|
1008
1024
|
var useUniformContextualEditingState = ({
|
|
1009
1025
|
global = false
|
|
1010
1026
|
} = {}) => {
|
|
1011
1027
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
1012
1028
|
const { data: componentData } = useUniformCurrentComponent();
|
|
1013
|
-
const [selectedComponentReference, setSelectedComponentReference] = (0,
|
|
1014
|
-
const [previewMode, setPreviewMode] = (0,
|
|
1029
|
+
const [selectedComponentReference, setSelectedComponentReference] = (0, import_react26.useState)();
|
|
1030
|
+
const [previewMode, setPreviewMode] = (0, import_react26.useState)(
|
|
1015
1031
|
isContextualEditing ? "editor" : void 0
|
|
1016
1032
|
);
|
|
1017
|
-
const channel = (0,
|
|
1033
|
+
const channel = (0, import_react26.useMemo)(() => {
|
|
1018
1034
|
if (!isContextualEditing) {
|
|
1019
1035
|
return;
|
|
1020
1036
|
}
|
|
1021
|
-
const channel2 = (0,
|
|
1037
|
+
const channel2 = (0, import_canvas15.createCanvasChannel)({
|
|
1022
1038
|
broadcastTo: [window],
|
|
1023
1039
|
listenTo: [window]
|
|
1024
1040
|
});
|
|
1025
1041
|
return channel2;
|
|
1026
1042
|
}, [isContextualEditing]);
|
|
1027
|
-
(0,
|
|
1043
|
+
(0, import_react26.useEffect)(() => {
|
|
1028
1044
|
var _a, _b;
|
|
1029
1045
|
if (!channel) {
|
|
1030
1046
|
return;
|
|
@@ -1034,7 +1050,7 @@ var useUniformContextualEditingState = ({
|
|
|
1034
1050
|
}
|
|
1035
1051
|
const unsubscribe = channel.on("update-contextual-editing-state-internal", async (message) => {
|
|
1036
1052
|
var _a2;
|
|
1037
|
-
if (!(0,
|
|
1053
|
+
if (!(0, import_canvas15.isUpdateContextualEditingStateInternalMessage)(message)) {
|
|
1038
1054
|
return;
|
|
1039
1055
|
}
|
|
1040
1056
|
setPreviewMode(message.state.previewMode);
|
|
@@ -1048,7 +1064,7 @@ var useUniformContextualEditingState = ({
|
|
|
1048
1064
|
unsubscribe();
|
|
1049
1065
|
};
|
|
1050
1066
|
}, [global, channel, componentData == null ? void 0 : componentData._id, setSelectedComponentReference, setPreviewMode]);
|
|
1051
|
-
return (0,
|
|
1067
|
+
return (0, import_react26.useMemo)(
|
|
1052
1068
|
() => ({
|
|
1053
1069
|
isContextualEditing,
|
|
1054
1070
|
selectedComponentReference,
|
package/dist/index.mjs
CHANGED
|
@@ -696,55 +696,70 @@ import {
|
|
|
696
696
|
ATTRIBUTE_PARAMETER_TYPE
|
|
697
697
|
} from "@uniformdev/canvas";
|
|
698
698
|
import { isRichTextValue, isRichTextValueConsideredEmpty } from "@uniformdev/richtext";
|
|
699
|
-
import
|
|
699
|
+
import React20 from "react";
|
|
700
700
|
|
|
701
701
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
702
702
|
import { isRichTextNode } from "@uniformdev/richtext";
|
|
703
|
-
import
|
|
703
|
+
import React19 from "react";
|
|
704
704
|
|
|
705
|
-
// src/components/UniformRichText/nodes/
|
|
705
|
+
// src/components/UniformRichText/nodes/AssetRichTextNode.tsx
|
|
706
|
+
import { ASSETS_SOURCE_UNIFORM } from "@uniformdev/canvas";
|
|
706
707
|
import React9 from "react";
|
|
708
|
+
var AssetRichTextNode = ({ node }) => {
|
|
709
|
+
var _a, _b;
|
|
710
|
+
const { __asset } = node;
|
|
711
|
+
if (__asset === void 0) {
|
|
712
|
+
return null;
|
|
713
|
+
}
|
|
714
|
+
if (__asset.type !== "image" || __asset._source !== ASSETS_SOURCE_UNIFORM) {
|
|
715
|
+
return null;
|
|
716
|
+
}
|
|
717
|
+
return /* @__PURE__ */ React9.createElement("figure", null, /* @__PURE__ */ React9.createElement("img", { src: __asset.fields.url.value, alt: (_a = __asset.fields.title) == null ? void 0 : _a.value }), ((_b = __asset.fields.description) == null ? void 0 : _b.value) ? /* @__PURE__ */ React9.createElement("figcaption", null, __asset.fields.description.value) : null);
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
// src/components/UniformRichText/nodes/HeadingRichTextNode.tsx
|
|
721
|
+
import React10 from "react";
|
|
707
722
|
var HeadingRichTextNode = ({ children, node }) => {
|
|
708
723
|
const { tag } = node;
|
|
709
724
|
const HTag = tag != null ? tag : "h1";
|
|
710
|
-
return /* @__PURE__ */
|
|
725
|
+
return /* @__PURE__ */ React10.createElement(HTag, null, children);
|
|
711
726
|
};
|
|
712
727
|
|
|
713
728
|
// src/components/UniformRichText/nodes/LinebreakRichTextNode.tsx
|
|
714
|
-
import
|
|
729
|
+
import React11 from "react";
|
|
715
730
|
var LinebreakRichTextNode = () => {
|
|
716
|
-
return /* @__PURE__ */
|
|
731
|
+
return /* @__PURE__ */ React11.createElement("br", null);
|
|
717
732
|
};
|
|
718
733
|
|
|
719
734
|
// src/components/UniformRichText/nodes/LinkRichTextNode.tsx
|
|
720
735
|
import { linkParamValueToHref } from "@uniformdev/richtext";
|
|
721
|
-
import
|
|
736
|
+
import React12 from "react";
|
|
722
737
|
var LinkRichTextNode = ({ children, node }) => {
|
|
723
738
|
const { link } = node;
|
|
724
|
-
return /* @__PURE__ */
|
|
739
|
+
return /* @__PURE__ */ React12.createElement("a", { href: linkParamValueToHref(link) }, children);
|
|
725
740
|
};
|
|
726
741
|
|
|
727
742
|
// src/components/UniformRichText/nodes/ListItemRichTextNode.tsx
|
|
728
|
-
import
|
|
743
|
+
import React13 from "react";
|
|
729
744
|
var ListItemRichTextNode = ({ children, node }) => {
|
|
730
745
|
const { value } = node;
|
|
731
|
-
return /* @__PURE__ */
|
|
746
|
+
return /* @__PURE__ */ React13.createElement("li", { value: Number.isFinite(value) && value > 0 ? value : void 0 }, children);
|
|
732
747
|
};
|
|
733
748
|
|
|
734
749
|
// src/components/UniformRichText/nodes/ListRichTextNode.tsx
|
|
735
|
-
import
|
|
750
|
+
import React14 from "react";
|
|
736
751
|
var ListRichTextNode = ({ children, node }) => {
|
|
737
752
|
const { tag, start } = node;
|
|
738
753
|
const ListTag = tag != null ? tag : "ul";
|
|
739
|
-
return /* @__PURE__ */
|
|
754
|
+
return /* @__PURE__ */ React14.createElement(ListTag, { start: Number.isFinite(start) && start > 0 ? start : void 0 }, children);
|
|
740
755
|
};
|
|
741
756
|
|
|
742
757
|
// src/components/UniformRichText/nodes/ParagraphRichTextNode.tsx
|
|
743
758
|
import { isPureDirection, isPureTextAlign } from "@uniformdev/richtext";
|
|
744
|
-
import
|
|
759
|
+
import React15 from "react";
|
|
745
760
|
var ParagraphRichTextNode = ({ children, node }) => {
|
|
746
761
|
const { format, direction } = node;
|
|
747
|
-
return /* @__PURE__ */
|
|
762
|
+
return /* @__PURE__ */ React15.createElement(
|
|
748
763
|
"p",
|
|
749
764
|
{
|
|
750
765
|
dir: isPureDirection(direction) ? direction : void 0,
|
|
@@ -756,26 +771,26 @@ var ParagraphRichTextNode = ({ children, node }) => {
|
|
|
756
771
|
|
|
757
772
|
// src/components/UniformRichText/nodes/TableCellRichTextNode.tsx
|
|
758
773
|
import { getRichTextTagFromTableCellHeaderState } from "@uniformdev/richtext";
|
|
759
|
-
import
|
|
774
|
+
import React16 from "react";
|
|
760
775
|
var TableCellRichTextNode = ({ children, node }) => {
|
|
761
776
|
const { headerState } = node;
|
|
762
777
|
const TableCellTag = getRichTextTagFromTableCellHeaderState(headerState);
|
|
763
|
-
return /* @__PURE__ */
|
|
778
|
+
return /* @__PURE__ */ React16.createElement(TableCellTag, null, children);
|
|
764
779
|
};
|
|
765
780
|
|
|
766
781
|
// src/components/UniformRichText/nodes/TabRichTextNode.tsx
|
|
767
|
-
import
|
|
782
|
+
import React17 from "react";
|
|
768
783
|
var TabRichTextNode = () => {
|
|
769
|
-
return /* @__PURE__ */
|
|
784
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, " ");
|
|
770
785
|
};
|
|
771
786
|
|
|
772
787
|
// src/components/UniformRichText/nodes/TextRichTextNode.tsx
|
|
773
788
|
import { getRichTextTagsFromTextFormat } from "@uniformdev/richtext";
|
|
774
|
-
import
|
|
789
|
+
import React18 from "react";
|
|
775
790
|
var TextRichTextNode = ({ node }) => {
|
|
776
791
|
const { text, format } = node;
|
|
777
792
|
const tags = getRichTextTagsFromTextFormat(format);
|
|
778
|
-
return /* @__PURE__ */
|
|
793
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, tags.length > 0 ? tags.reduceRight((children, Tag) => /* @__PURE__ */ React18.createElement(Tag, null, children), text) : text);
|
|
779
794
|
};
|
|
780
795
|
|
|
781
796
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
@@ -789,8 +804,8 @@ function UniformRichTextNode({ node, ...props }) {
|
|
|
789
804
|
if (!NodeRenderer) {
|
|
790
805
|
return null;
|
|
791
806
|
}
|
|
792
|
-
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */
|
|
793
|
-
return /* @__PURE__ */
|
|
807
|
+
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */ React19.createElement(UniformRichTextNode, { ...props, key: i, node: childNode })) : null;
|
|
808
|
+
return /* @__PURE__ */ React19.createElement(NodeRenderer, { node }, children);
|
|
794
809
|
}
|
|
795
810
|
var rendererMap = /* @__PURE__ */ new Map([
|
|
796
811
|
["heading", HeadingRichTextNode],
|
|
@@ -799,27 +814,28 @@ var rendererMap = /* @__PURE__ */ new Map([
|
|
|
799
814
|
["list", ListRichTextNode],
|
|
800
815
|
["listitem", ListItemRichTextNode],
|
|
801
816
|
["paragraph", ParagraphRichTextNode],
|
|
802
|
-
["quote", ({ children }) => /* @__PURE__ */
|
|
817
|
+
["quote", ({ children }) => /* @__PURE__ */ React19.createElement("blockquote", null, children)],
|
|
803
818
|
[
|
|
804
819
|
"code",
|
|
805
|
-
({ children }) => /* @__PURE__ */
|
|
820
|
+
({ children }) => /* @__PURE__ */ React19.createElement("pre", null, /* @__PURE__ */ React19.createElement("code", null, children))
|
|
806
821
|
],
|
|
807
|
-
["root", ({ children }) => /* @__PURE__ */
|
|
822
|
+
["root", ({ children }) => /* @__PURE__ */ React19.createElement(React19.Fragment, null, children)],
|
|
808
823
|
["text", TextRichTextNode],
|
|
809
824
|
["tab", TabRichTextNode],
|
|
810
825
|
[
|
|
811
826
|
"table",
|
|
812
|
-
({ children }) => /* @__PURE__ */
|
|
827
|
+
({ children }) => /* @__PURE__ */ React19.createElement("table", null, /* @__PURE__ */ React19.createElement("tbody", null, children))
|
|
813
828
|
],
|
|
814
|
-
["tablerow", ({ children }) => /* @__PURE__ */
|
|
815
|
-
["tablecell", TableCellRichTextNode]
|
|
829
|
+
["tablerow", ({ children }) => /* @__PURE__ */ React19.createElement("tr", null, children)],
|
|
830
|
+
["tablecell", TableCellRichTextNode],
|
|
831
|
+
["asset", AssetRichTextNode]
|
|
816
832
|
]);
|
|
817
833
|
var resolveRichTextDefaultRenderer = (node) => {
|
|
818
834
|
return rendererMap.get(node.type);
|
|
819
835
|
};
|
|
820
836
|
|
|
821
837
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
822
|
-
var UniformRichText =
|
|
838
|
+
var UniformRichText = React20.forwardRef(function UniformRichText2({ parameterId, resolveRichTextRenderer, as: Tag = "div", placeholder, ...props }, ref) {
|
|
823
839
|
var _a;
|
|
824
840
|
const { data: componentData, contextualEditingDefaultPlaceholder } = useUniformCurrentComponent();
|
|
825
841
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
@@ -832,7 +848,7 @@ var UniformRichText = React19.forwardRef(function UniformRichText2({ parameterId
|
|
|
832
848
|
const value = parameter.value;
|
|
833
849
|
if (!value || !isRichTextValue(value)) return null;
|
|
834
850
|
if (!isContextualEditing && isRichTextValueConsideredEmpty(value)) return null;
|
|
835
|
-
return Tag === null ? /* @__PURE__ */
|
|
851
|
+
return Tag === null ? /* @__PURE__ */ React20.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ React20.createElement(
|
|
836
852
|
Tag,
|
|
837
853
|
{
|
|
838
854
|
ref,
|
|
@@ -843,15 +859,15 @@ var UniformRichText = React19.forwardRef(function UniformRichText2({ parameterId
|
|
|
843
859
|
[ATTRIBUTE_PARAMETER_TYPE]: "richText"
|
|
844
860
|
} : {}
|
|
845
861
|
},
|
|
846
|
-
isRichTextValueConsideredEmpty(value) ? /* @__PURE__ */
|
|
862
|
+
isRichTextValueConsideredEmpty(value) ? /* @__PURE__ */ React20.createElement("p", null, /* @__PURE__ */ React20.createElement("i", null, computedPlaceholder)) : /* @__PURE__ */ React20.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
|
|
847
863
|
);
|
|
848
864
|
});
|
|
849
865
|
|
|
850
866
|
// src/components/UniformText.tsx
|
|
851
|
-
import
|
|
867
|
+
import React22, { useState as useState2 } from "react";
|
|
852
868
|
|
|
853
869
|
// src/components/PureUniformText.tsx
|
|
854
|
-
import
|
|
870
|
+
import React21 from "react";
|
|
855
871
|
var PureUniformText = ({
|
|
856
872
|
as: Tag = "span",
|
|
857
873
|
parameterId,
|
|
@@ -870,10 +886,10 @@ var PureUniformText = ({
|
|
|
870
886
|
return null;
|
|
871
887
|
}
|
|
872
888
|
if (!isContextualEditing) {
|
|
873
|
-
return /* @__PURE__ */
|
|
889
|
+
return /* @__PURE__ */ React21.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
|
|
874
890
|
}
|
|
875
891
|
const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
|
|
876
|
-
return /* @__PURE__ */
|
|
892
|
+
return /* @__PURE__ */ React21.createElement(
|
|
877
893
|
Tag,
|
|
878
894
|
{
|
|
879
895
|
...props,
|
|
@@ -911,7 +927,7 @@ var UniformText = ({
|
|
|
911
927
|
}
|
|
912
928
|
const placeholderProp = placeholder != null ? placeholder : contextualEditingDefaultPlaceholder;
|
|
913
929
|
const computedPlaceholder = typeof placeholderProp === "function" ? placeholderProp({ id: parameterId }) : placeholderProp;
|
|
914
|
-
return /* @__PURE__ */
|
|
930
|
+
return /* @__PURE__ */ React22.createElement(
|
|
915
931
|
PureUniformText,
|
|
916
932
|
{
|
|
917
933
|
...props,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-react",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.185.1-alpha.8+53f7f96124",
|
|
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.
|
|
49
|
-
"@uniformdev/context": "19.
|
|
50
|
-
"@uniformdev/context-react": "19.
|
|
51
|
-
"@uniformdev/richtext": "19.
|
|
48
|
+
"@uniformdev/canvas": "19.185.1-alpha.8+53f7f96124",
|
|
49
|
+
"@uniformdev/context": "19.185.1-alpha.8+53f7f96124",
|
|
50
|
+
"@uniformdev/context-react": "19.185.1-alpha.8+53f7f96124",
|
|
51
|
+
"@uniformdev/richtext": "19.185.1-alpha.8+53f7f96124"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"immer": ">= 10",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "53f7f961242f3518b103e55337ada7ad91c18dd7"
|
|
71
71
|
}
|