@uniformdev/canvas-react 19.186.4-alpha.4 → 19.187.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 +0 -4
- package/dist/index.d.ts +0 -4
- package/dist/index.esm.js +51 -36
- package/dist/index.js +60 -45
- package/dist/index.mjs +51 -36
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -227,7 +227,6 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
227
227
|
isPatternParameter?: boolean;
|
|
228
228
|
ignorePatternParameterDefault?: boolean;
|
|
229
229
|
optionalPatternParameter?: boolean;
|
|
230
|
-
dataSourceVariant?: "unpublished";
|
|
231
230
|
variables?: {
|
|
232
231
|
[key: string]: string;
|
|
233
232
|
};
|
|
@@ -239,7 +238,6 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
239
238
|
isPatternParameter?: boolean;
|
|
240
239
|
ignorePatternParameterDefault?: boolean;
|
|
241
240
|
optionalPatternParameter?: boolean;
|
|
242
|
-
dataSourceVariant?: "unpublished";
|
|
243
241
|
variables?: {
|
|
244
242
|
[key: string]: string;
|
|
245
243
|
};
|
|
@@ -322,7 +320,6 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
322
320
|
isPatternParameter?: boolean;
|
|
323
321
|
ignorePatternParameterDefault?: boolean;
|
|
324
322
|
optionalPatternParameter?: boolean;
|
|
325
|
-
dataSourceVariant?: "unpublished";
|
|
326
323
|
variables?: {
|
|
327
324
|
[key: string]: string;
|
|
328
325
|
};
|
|
@@ -334,7 +331,6 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
334
331
|
isPatternParameter?: boolean;
|
|
335
332
|
ignorePatternParameterDefault?: boolean;
|
|
336
333
|
optionalPatternParameter?: boolean;
|
|
337
|
-
dataSourceVariant?: "unpublished";
|
|
338
334
|
variables?: {
|
|
339
335
|
[key: string]: string;
|
|
340
336
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -227,7 +227,6 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
227
227
|
isPatternParameter?: boolean;
|
|
228
228
|
ignorePatternParameterDefault?: boolean;
|
|
229
229
|
optionalPatternParameter?: boolean;
|
|
230
|
-
dataSourceVariant?: "unpublished";
|
|
231
230
|
variables?: {
|
|
232
231
|
[key: string]: string;
|
|
233
232
|
};
|
|
@@ -239,7 +238,6 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
239
238
|
isPatternParameter?: boolean;
|
|
240
239
|
ignorePatternParameterDefault?: boolean;
|
|
241
240
|
optionalPatternParameter?: boolean;
|
|
242
|
-
dataSourceVariant?: "unpublished";
|
|
243
241
|
variables?: {
|
|
244
242
|
[key: string]: string;
|
|
245
243
|
};
|
|
@@ -322,7 +320,6 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
322
320
|
isPatternParameter?: boolean;
|
|
323
321
|
ignorePatternParameterDefault?: boolean;
|
|
324
322
|
optionalPatternParameter?: boolean;
|
|
325
|
-
dataSourceVariant?: "unpublished";
|
|
326
323
|
variables?: {
|
|
327
324
|
[key: string]: string;
|
|
328
325
|
};
|
|
@@ -334,7 +331,6 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
|
|
|
334
331
|
isPatternParameter?: boolean;
|
|
335
332
|
ignorePatternParameterDefault?: boolean;
|
|
336
333
|
optionalPatternParameter?: boolean;
|
|
337
|
-
dataSourceVariant?: "unpublished";
|
|
338
334
|
variables?: {
|
|
339
335
|
[key: string]: string;
|
|
340
336
|
};
|
package/dist/index.esm.js
CHANGED
|
@@ -696,55 +696,69 @@ 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
706
|
import React9 from "react";
|
|
707
|
+
var AssetRichTextNode = ({ node }) => {
|
|
708
|
+
var _a, _b;
|
|
709
|
+
const { __asset } = node;
|
|
710
|
+
if (__asset === void 0) {
|
|
711
|
+
return null;
|
|
712
|
+
}
|
|
713
|
+
if (__asset.type !== "image") {
|
|
714
|
+
return null;
|
|
715
|
+
}
|
|
716
|
+
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);
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
// src/components/UniformRichText/nodes/HeadingRichTextNode.tsx
|
|
720
|
+
import React10 from "react";
|
|
707
721
|
var HeadingRichTextNode = ({ children, node }) => {
|
|
708
722
|
const { tag } = node;
|
|
709
723
|
const HTag = tag != null ? tag : "h1";
|
|
710
|
-
return /* @__PURE__ */
|
|
724
|
+
return /* @__PURE__ */ React10.createElement(HTag, null, children);
|
|
711
725
|
};
|
|
712
726
|
|
|
713
727
|
// src/components/UniformRichText/nodes/LinebreakRichTextNode.tsx
|
|
714
|
-
import
|
|
728
|
+
import React11 from "react";
|
|
715
729
|
var LinebreakRichTextNode = () => {
|
|
716
|
-
return /* @__PURE__ */
|
|
730
|
+
return /* @__PURE__ */ React11.createElement("br", null);
|
|
717
731
|
};
|
|
718
732
|
|
|
719
733
|
// src/components/UniformRichText/nodes/LinkRichTextNode.tsx
|
|
720
734
|
import { linkParamValueToHref } from "@uniformdev/richtext";
|
|
721
|
-
import
|
|
735
|
+
import React12 from "react";
|
|
722
736
|
var LinkRichTextNode = ({ children, node }) => {
|
|
723
737
|
const { link } = node;
|
|
724
|
-
return /* @__PURE__ */
|
|
738
|
+
return /* @__PURE__ */ React12.createElement("a", { href: linkParamValueToHref(link) }, children);
|
|
725
739
|
};
|
|
726
740
|
|
|
727
741
|
// src/components/UniformRichText/nodes/ListItemRichTextNode.tsx
|
|
728
|
-
import
|
|
742
|
+
import React13 from "react";
|
|
729
743
|
var ListItemRichTextNode = ({ children, node }) => {
|
|
730
744
|
const { value } = node;
|
|
731
|
-
return /* @__PURE__ */
|
|
745
|
+
return /* @__PURE__ */ React13.createElement("li", { value: Number.isFinite(value) && value > 0 ? value : void 0 }, children);
|
|
732
746
|
};
|
|
733
747
|
|
|
734
748
|
// src/components/UniformRichText/nodes/ListRichTextNode.tsx
|
|
735
|
-
import
|
|
749
|
+
import React14 from "react";
|
|
736
750
|
var ListRichTextNode = ({ children, node }) => {
|
|
737
751
|
const { tag, start } = node;
|
|
738
752
|
const ListTag = tag != null ? tag : "ul";
|
|
739
|
-
return /* @__PURE__ */
|
|
753
|
+
return /* @__PURE__ */ React14.createElement(ListTag, { start: Number.isFinite(start) && start > 0 ? start : void 0 }, children);
|
|
740
754
|
};
|
|
741
755
|
|
|
742
756
|
// src/components/UniformRichText/nodes/ParagraphRichTextNode.tsx
|
|
743
757
|
import { isPureDirection, isPureTextAlign } from "@uniformdev/richtext";
|
|
744
|
-
import
|
|
758
|
+
import React15 from "react";
|
|
745
759
|
var ParagraphRichTextNode = ({ children, node }) => {
|
|
746
760
|
const { format, direction } = node;
|
|
747
|
-
return /* @__PURE__ */
|
|
761
|
+
return /* @__PURE__ */ React15.createElement(
|
|
748
762
|
"p",
|
|
749
763
|
{
|
|
750
764
|
dir: isPureDirection(direction) ? direction : void 0,
|
|
@@ -756,26 +770,26 @@ var ParagraphRichTextNode = ({ children, node }) => {
|
|
|
756
770
|
|
|
757
771
|
// src/components/UniformRichText/nodes/TableCellRichTextNode.tsx
|
|
758
772
|
import { getRichTextTagFromTableCellHeaderState } from "@uniformdev/richtext";
|
|
759
|
-
import
|
|
773
|
+
import React16 from "react";
|
|
760
774
|
var TableCellRichTextNode = ({ children, node }) => {
|
|
761
775
|
const { headerState } = node;
|
|
762
776
|
const TableCellTag = getRichTextTagFromTableCellHeaderState(headerState);
|
|
763
|
-
return /* @__PURE__ */
|
|
777
|
+
return /* @__PURE__ */ React16.createElement(TableCellTag, null, children);
|
|
764
778
|
};
|
|
765
779
|
|
|
766
780
|
// src/components/UniformRichText/nodes/TabRichTextNode.tsx
|
|
767
|
-
import
|
|
781
|
+
import React17 from "react";
|
|
768
782
|
var TabRichTextNode = () => {
|
|
769
|
-
return /* @__PURE__ */
|
|
783
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, " ");
|
|
770
784
|
};
|
|
771
785
|
|
|
772
786
|
// src/components/UniformRichText/nodes/TextRichTextNode.tsx
|
|
773
787
|
import { getRichTextTagsFromTextFormat } from "@uniformdev/richtext";
|
|
774
|
-
import
|
|
788
|
+
import React18 from "react";
|
|
775
789
|
var TextRichTextNode = ({ node }) => {
|
|
776
790
|
const { text, format } = node;
|
|
777
791
|
const tags = getRichTextTagsFromTextFormat(format);
|
|
778
|
-
return /* @__PURE__ */
|
|
792
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, tags.length > 0 ? tags.reduceRight((children, Tag) => /* @__PURE__ */ React18.createElement(Tag, null, children), text) : text);
|
|
779
793
|
};
|
|
780
794
|
|
|
781
795
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
@@ -789,8 +803,8 @@ function UniformRichTextNode({ node, ...props }) {
|
|
|
789
803
|
if (!NodeRenderer) {
|
|
790
804
|
return null;
|
|
791
805
|
}
|
|
792
|
-
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */
|
|
793
|
-
return /* @__PURE__ */
|
|
806
|
+
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */ React19.createElement(UniformRichTextNode, { ...props, key: i, node: childNode })) : null;
|
|
807
|
+
return /* @__PURE__ */ React19.createElement(NodeRenderer, { node }, children);
|
|
794
808
|
}
|
|
795
809
|
var rendererMap = /* @__PURE__ */ new Map([
|
|
796
810
|
["heading", HeadingRichTextNode],
|
|
@@ -799,27 +813,28 @@ var rendererMap = /* @__PURE__ */ new Map([
|
|
|
799
813
|
["list", ListRichTextNode],
|
|
800
814
|
["listitem", ListItemRichTextNode],
|
|
801
815
|
["paragraph", ParagraphRichTextNode],
|
|
802
|
-
["quote", ({ children }) => /* @__PURE__ */
|
|
816
|
+
["quote", ({ children }) => /* @__PURE__ */ React19.createElement("blockquote", null, children)],
|
|
803
817
|
[
|
|
804
818
|
"code",
|
|
805
|
-
({ children }) => /* @__PURE__ */
|
|
819
|
+
({ children }) => /* @__PURE__ */ React19.createElement("pre", null, /* @__PURE__ */ React19.createElement("code", null, children))
|
|
806
820
|
],
|
|
807
|
-
["root", ({ children }) => /* @__PURE__ */
|
|
821
|
+
["root", ({ children }) => /* @__PURE__ */ React19.createElement(React19.Fragment, null, children)],
|
|
808
822
|
["text", TextRichTextNode],
|
|
809
823
|
["tab", TabRichTextNode],
|
|
810
824
|
[
|
|
811
825
|
"table",
|
|
812
|
-
({ children }) => /* @__PURE__ */
|
|
826
|
+
({ children }) => /* @__PURE__ */ React19.createElement("table", null, /* @__PURE__ */ React19.createElement("tbody", null, children))
|
|
813
827
|
],
|
|
814
|
-
["tablerow", ({ children }) => /* @__PURE__ */
|
|
815
|
-
["tablecell", TableCellRichTextNode]
|
|
828
|
+
["tablerow", ({ children }) => /* @__PURE__ */ React19.createElement("tr", null, children)],
|
|
829
|
+
["tablecell", TableCellRichTextNode],
|
|
830
|
+
["asset", AssetRichTextNode]
|
|
816
831
|
]);
|
|
817
832
|
var resolveRichTextDefaultRenderer = (node) => {
|
|
818
833
|
return rendererMap.get(node.type);
|
|
819
834
|
};
|
|
820
835
|
|
|
821
836
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
822
|
-
var UniformRichText =
|
|
837
|
+
var UniformRichText = React20.forwardRef(function UniformRichText2({ parameterId, resolveRichTextRenderer, as: Tag = "div", placeholder, ...props }, ref) {
|
|
823
838
|
var _a;
|
|
824
839
|
const { data: componentData, contextualEditingDefaultPlaceholder } = useUniformCurrentComponent();
|
|
825
840
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
@@ -832,7 +847,7 @@ var UniformRichText = React19.forwardRef(function UniformRichText2({ parameterId
|
|
|
832
847
|
const value = parameter.value;
|
|
833
848
|
if (!value || !isRichTextValue(value)) return null;
|
|
834
849
|
if (!isContextualEditing && isRichTextValueConsideredEmpty(value)) return null;
|
|
835
|
-
return Tag === null ? /* @__PURE__ */
|
|
850
|
+
return Tag === null ? /* @__PURE__ */ React20.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ React20.createElement(
|
|
836
851
|
Tag,
|
|
837
852
|
{
|
|
838
853
|
ref,
|
|
@@ -843,15 +858,15 @@ var UniformRichText = React19.forwardRef(function UniformRichText2({ parameterId
|
|
|
843
858
|
[ATTRIBUTE_PARAMETER_TYPE]: "richText"
|
|
844
859
|
} : {}
|
|
845
860
|
},
|
|
846
|
-
isRichTextValueConsideredEmpty(value) ? /* @__PURE__ */
|
|
861
|
+
isRichTextValueConsideredEmpty(value) ? /* @__PURE__ */ React20.createElement("p", null, /* @__PURE__ */ React20.createElement("i", null, computedPlaceholder)) : /* @__PURE__ */ React20.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
|
|
847
862
|
);
|
|
848
863
|
});
|
|
849
864
|
|
|
850
865
|
// src/components/UniformText.tsx
|
|
851
|
-
import
|
|
866
|
+
import React22, { useState as useState2 } from "react";
|
|
852
867
|
|
|
853
868
|
// src/components/PureUniformText.tsx
|
|
854
|
-
import
|
|
869
|
+
import React21 from "react";
|
|
855
870
|
var PureUniformText = ({
|
|
856
871
|
as: Tag = "span",
|
|
857
872
|
parameterId,
|
|
@@ -870,10 +885,10 @@ var PureUniformText = ({
|
|
|
870
885
|
return null;
|
|
871
886
|
}
|
|
872
887
|
if (!isContextualEditing) {
|
|
873
|
-
return /* @__PURE__ */
|
|
888
|
+
return /* @__PURE__ */ React21.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
|
|
874
889
|
}
|
|
875
890
|
const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
|
|
876
|
-
return /* @__PURE__ */
|
|
891
|
+
return /* @__PURE__ */ React21.createElement(
|
|
877
892
|
Tag,
|
|
878
893
|
{
|
|
879
894
|
...props,
|
|
@@ -911,7 +926,7 @@ var UniformText = ({
|
|
|
911
926
|
}
|
|
912
927
|
const placeholderProp = placeholder != null ? placeholder : contextualEditingDefaultPlaceholder;
|
|
913
928
|
const computedPlaceholder = typeof placeholderProp === "function" ? placeholderProp({ id: parameterId }) : placeholderProp;
|
|
914
|
-
return /* @__PURE__ */
|
|
929
|
+
return /* @__PURE__ */ React22.createElement(
|
|
915
930
|
PureUniformText,
|
|
916
931
|
{
|
|
917
932
|
...props,
|
package/dist/index.js
CHANGED
|
@@ -720,55 +720,69 @@ var UniformPlayground = ({
|
|
|
720
720
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
721
721
|
var import_canvas11 = 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
730
|
var import_react11 = __toESM(require("react"));
|
|
731
|
+
var AssetRichTextNode = ({ node }) => {
|
|
732
|
+
var _a, _b;
|
|
733
|
+
const { __asset } = node;
|
|
734
|
+
if (__asset === void 0) {
|
|
735
|
+
return null;
|
|
736
|
+
}
|
|
737
|
+
if (__asset.type !== "image") {
|
|
738
|
+
return null;
|
|
739
|
+
}
|
|
740
|
+
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);
|
|
741
|
+
};
|
|
742
|
+
|
|
743
|
+
// src/components/UniformRichText/nodes/HeadingRichTextNode.tsx
|
|
744
|
+
var import_react12 = __toESM(require("react"));
|
|
731
745
|
var HeadingRichTextNode = ({ children, node }) => {
|
|
732
746
|
const { tag } = node;
|
|
733
747
|
const HTag = tag != null ? tag : "h1";
|
|
734
|
-
return /* @__PURE__ */
|
|
748
|
+
return /* @__PURE__ */ import_react12.default.createElement(HTag, null, children);
|
|
735
749
|
};
|
|
736
750
|
|
|
737
751
|
// src/components/UniformRichText/nodes/LinebreakRichTextNode.tsx
|
|
738
|
-
var
|
|
752
|
+
var import_react13 = __toESM(require("react"));
|
|
739
753
|
var LinebreakRichTextNode = () => {
|
|
740
|
-
return /* @__PURE__ */
|
|
754
|
+
return /* @__PURE__ */ import_react13.default.createElement("br", null);
|
|
741
755
|
};
|
|
742
756
|
|
|
743
757
|
// src/components/UniformRichText/nodes/LinkRichTextNode.tsx
|
|
744
758
|
var import_richtext = require("@uniformdev/richtext");
|
|
745
|
-
var
|
|
759
|
+
var import_react14 = __toESM(require("react"));
|
|
746
760
|
var LinkRichTextNode = ({ children, node }) => {
|
|
747
761
|
const { link } = node;
|
|
748
|
-
return /* @__PURE__ */
|
|
762
|
+
return /* @__PURE__ */ import_react14.default.createElement("a", { href: (0, import_richtext.linkParamValueToHref)(link) }, children);
|
|
749
763
|
};
|
|
750
764
|
|
|
751
765
|
// src/components/UniformRichText/nodes/ListItemRichTextNode.tsx
|
|
752
|
-
var
|
|
766
|
+
var import_react15 = __toESM(require("react"));
|
|
753
767
|
var ListItemRichTextNode = ({ children, node }) => {
|
|
754
768
|
const { value } = node;
|
|
755
|
-
return /* @__PURE__ */
|
|
769
|
+
return /* @__PURE__ */ import_react15.default.createElement("li", { value: Number.isFinite(value) && value > 0 ? value : void 0 }, children);
|
|
756
770
|
};
|
|
757
771
|
|
|
758
772
|
// src/components/UniformRichText/nodes/ListRichTextNode.tsx
|
|
759
|
-
var
|
|
773
|
+
var import_react16 = __toESM(require("react"));
|
|
760
774
|
var ListRichTextNode = ({ children, node }) => {
|
|
761
775
|
const { tag, start } = node;
|
|
762
776
|
const ListTag = tag != null ? tag : "ul";
|
|
763
|
-
return /* @__PURE__ */
|
|
777
|
+
return /* @__PURE__ */ import_react16.default.createElement(ListTag, { start: Number.isFinite(start) && start > 0 ? start : void 0 }, children);
|
|
764
778
|
};
|
|
765
779
|
|
|
766
780
|
// src/components/UniformRichText/nodes/ParagraphRichTextNode.tsx
|
|
767
781
|
var import_richtext2 = require("@uniformdev/richtext");
|
|
768
|
-
var
|
|
782
|
+
var import_react17 = __toESM(require("react"));
|
|
769
783
|
var ParagraphRichTextNode = ({ children, node }) => {
|
|
770
784
|
const { format, direction } = node;
|
|
771
|
-
return /* @__PURE__ */
|
|
785
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
772
786
|
"p",
|
|
773
787
|
{
|
|
774
788
|
dir: (0, import_richtext2.isPureDirection)(direction) ? direction : void 0,
|
|
@@ -780,26 +794,26 @@ var ParagraphRichTextNode = ({ children, node }) => {
|
|
|
780
794
|
|
|
781
795
|
// src/components/UniformRichText/nodes/TableCellRichTextNode.tsx
|
|
782
796
|
var import_richtext3 = require("@uniformdev/richtext");
|
|
783
|
-
var
|
|
797
|
+
var import_react18 = __toESM(require("react"));
|
|
784
798
|
var TableCellRichTextNode = ({ children, node }) => {
|
|
785
799
|
const { headerState } = node;
|
|
786
800
|
const TableCellTag = (0, import_richtext3.getRichTextTagFromTableCellHeaderState)(headerState);
|
|
787
|
-
return /* @__PURE__ */
|
|
801
|
+
return /* @__PURE__ */ import_react18.default.createElement(TableCellTag, null, children);
|
|
788
802
|
};
|
|
789
803
|
|
|
790
804
|
// src/components/UniformRichText/nodes/TabRichTextNode.tsx
|
|
791
|
-
var
|
|
805
|
+
var import_react19 = __toESM(require("react"));
|
|
792
806
|
var TabRichTextNode = () => {
|
|
793
|
-
return /* @__PURE__ */
|
|
807
|
+
return /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, " ");
|
|
794
808
|
};
|
|
795
809
|
|
|
796
810
|
// src/components/UniformRichText/nodes/TextRichTextNode.tsx
|
|
797
811
|
var import_richtext4 = require("@uniformdev/richtext");
|
|
798
|
-
var
|
|
812
|
+
var import_react20 = __toESM(require("react"));
|
|
799
813
|
var TextRichTextNode = ({ node }) => {
|
|
800
814
|
const { text, format } = node;
|
|
801
815
|
const tags = (0, import_richtext4.getRichTextTagsFromTextFormat)(format);
|
|
802
|
-
return /* @__PURE__ */
|
|
816
|
+
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
817
|
};
|
|
804
818
|
|
|
805
819
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
@@ -813,8 +827,8 @@ function UniformRichTextNode({ node, ...props }) {
|
|
|
813
827
|
if (!NodeRenderer) {
|
|
814
828
|
return null;
|
|
815
829
|
}
|
|
816
|
-
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */
|
|
817
|
-
return /* @__PURE__ */
|
|
830
|
+
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */ import_react21.default.createElement(UniformRichTextNode, { ...props, key: i, node: childNode })) : null;
|
|
831
|
+
return /* @__PURE__ */ import_react21.default.createElement(NodeRenderer, { node }, children);
|
|
818
832
|
}
|
|
819
833
|
var rendererMap = /* @__PURE__ */ new Map([
|
|
820
834
|
["heading", HeadingRichTextNode],
|
|
@@ -823,27 +837,28 @@ var rendererMap = /* @__PURE__ */ new Map([
|
|
|
823
837
|
["list", ListRichTextNode],
|
|
824
838
|
["listitem", ListItemRichTextNode],
|
|
825
839
|
["paragraph", ParagraphRichTextNode],
|
|
826
|
-
["quote", ({ children }) => /* @__PURE__ */
|
|
840
|
+
["quote", ({ children }) => /* @__PURE__ */ import_react21.default.createElement("blockquote", null, children)],
|
|
827
841
|
[
|
|
828
842
|
"code",
|
|
829
|
-
({ children }) => /* @__PURE__ */
|
|
843
|
+
({ children }) => /* @__PURE__ */ import_react21.default.createElement("pre", null, /* @__PURE__ */ import_react21.default.createElement("code", null, children))
|
|
830
844
|
],
|
|
831
|
-
["root", ({ children }) => /* @__PURE__ */
|
|
845
|
+
["root", ({ children }) => /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, children)],
|
|
832
846
|
["text", TextRichTextNode],
|
|
833
847
|
["tab", TabRichTextNode],
|
|
834
848
|
[
|
|
835
849
|
"table",
|
|
836
|
-
({ children }) => /* @__PURE__ */
|
|
850
|
+
({ children }) => /* @__PURE__ */ import_react21.default.createElement("table", null, /* @__PURE__ */ import_react21.default.createElement("tbody", null, children))
|
|
837
851
|
],
|
|
838
|
-
["tablerow", ({ children }) => /* @__PURE__ */
|
|
839
|
-
["tablecell", TableCellRichTextNode]
|
|
852
|
+
["tablerow", ({ children }) => /* @__PURE__ */ import_react21.default.createElement("tr", null, children)],
|
|
853
|
+
["tablecell", TableCellRichTextNode],
|
|
854
|
+
["asset", AssetRichTextNode]
|
|
840
855
|
]);
|
|
841
856
|
var resolveRichTextDefaultRenderer = (node) => {
|
|
842
857
|
return rendererMap.get(node.type);
|
|
843
858
|
};
|
|
844
859
|
|
|
845
860
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
846
|
-
var UniformRichText =
|
|
861
|
+
var UniformRichText = import_react22.default.forwardRef(function UniformRichText2({ parameterId, resolveRichTextRenderer, as: Tag = "div", placeholder, ...props }, ref) {
|
|
847
862
|
var _a;
|
|
848
863
|
const { data: componentData, contextualEditingDefaultPlaceholder } = useUniformCurrentComponent();
|
|
849
864
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
@@ -856,7 +871,7 @@ var UniformRichText = import_react21.default.forwardRef(function UniformRichText
|
|
|
856
871
|
const value = parameter.value;
|
|
857
872
|
if (!value || !(0, import_richtext6.isRichTextValue)(value)) return null;
|
|
858
873
|
if (!isContextualEditing && (0, import_richtext6.isRichTextValueConsideredEmpty)(value)) return null;
|
|
859
|
-
return Tag === null ? /* @__PURE__ */
|
|
874
|
+
return Tag === null ? /* @__PURE__ */ import_react22.default.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ import_react22.default.createElement(
|
|
860
875
|
Tag,
|
|
861
876
|
{
|
|
862
877
|
ref,
|
|
@@ -867,15 +882,15 @@ var UniformRichText = import_react21.default.forwardRef(function UniformRichText
|
|
|
867
882
|
[import_canvas11.ATTRIBUTE_PARAMETER_TYPE]: "richText"
|
|
868
883
|
} : {}
|
|
869
884
|
},
|
|
870
|
-
(0, import_richtext6.isRichTextValueConsideredEmpty)(value) ? /* @__PURE__ */
|
|
885
|
+
(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
886
|
);
|
|
872
887
|
});
|
|
873
888
|
|
|
874
889
|
// src/components/UniformText.tsx
|
|
875
|
-
var
|
|
890
|
+
var import_react24 = __toESM(require("react"));
|
|
876
891
|
|
|
877
892
|
// src/components/PureUniformText.tsx
|
|
878
|
-
var
|
|
893
|
+
var import_react23 = __toESM(require("react"));
|
|
879
894
|
var PureUniformText = ({
|
|
880
895
|
as: Tag = "span",
|
|
881
896
|
parameterId,
|
|
@@ -894,10 +909,10 @@ var PureUniformText = ({
|
|
|
894
909
|
return null;
|
|
895
910
|
}
|
|
896
911
|
if (!isContextualEditing) {
|
|
897
|
-
return /* @__PURE__ */
|
|
912
|
+
return /* @__PURE__ */ import_react23.default.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
|
|
898
913
|
}
|
|
899
914
|
const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
|
|
900
|
-
return /* @__PURE__ */
|
|
915
|
+
return /* @__PURE__ */ import_react23.default.createElement(
|
|
901
916
|
Tag,
|
|
902
917
|
{
|
|
903
918
|
...props,
|
|
@@ -926,7 +941,7 @@ var UniformText = ({
|
|
|
926
941
|
var _a, _b, _c;
|
|
927
942
|
const { data: componentData, contextualEditingDefaultPlaceholder } = useUniformCurrentComponent();
|
|
928
943
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
929
|
-
const [isFocused, setIsFocused] = (0,
|
|
944
|
+
const [isFocused, setIsFocused] = (0, import_react24.useState)(false);
|
|
930
945
|
const parameter = (_a = componentData == null ? void 0 : componentData.parameters) == null ? void 0 : _a[parameterId];
|
|
931
946
|
const isEditable = (_c = (_b = parameter == null ? void 0 : parameter._contextualEditing) == null ? void 0 : _b.isEditable) != null ? _c : false;
|
|
932
947
|
const shouldSkipCustomRendering = isFocused && isEditable;
|
|
@@ -935,7 +950,7 @@ var UniformText = ({
|
|
|
935
950
|
}
|
|
936
951
|
const placeholderProp = placeholder != null ? placeholder : contextualEditingDefaultPlaceholder;
|
|
937
952
|
const computedPlaceholder = typeof placeholderProp === "function" ? placeholderProp({ id: parameterId }) : placeholderProp;
|
|
938
|
-
return /* @__PURE__ */
|
|
953
|
+
return /* @__PURE__ */ import_react24.default.createElement(
|
|
939
954
|
PureUniformText,
|
|
940
955
|
{
|
|
941
956
|
...props,
|
|
@@ -968,14 +983,14 @@ var getParameterAttributes = (options) => {
|
|
|
968
983
|
|
|
969
984
|
// src/hooks/useCompositionEventEffect.ts
|
|
970
985
|
var import_canvas13 = require("@uniformdev/canvas");
|
|
971
|
-
var
|
|
986
|
+
var import_react25 = require("react");
|
|
972
987
|
function useCompositionEventEffect({
|
|
973
988
|
enabled,
|
|
974
989
|
projectId,
|
|
975
990
|
compositionId,
|
|
976
991
|
effect
|
|
977
992
|
}) {
|
|
978
|
-
(0,
|
|
993
|
+
(0, import_react25.useEffect)(() => {
|
|
979
994
|
if (!enabled || !compositionId || !projectId) {
|
|
980
995
|
return;
|
|
981
996
|
}
|
|
@@ -1004,17 +1019,17 @@ function useCompositionEventEffect({
|
|
|
1004
1019
|
|
|
1005
1020
|
// src/hooks/useUniformContextualEditingState.ts
|
|
1006
1021
|
var import_canvas14 = require("@uniformdev/canvas");
|
|
1007
|
-
var
|
|
1022
|
+
var import_react26 = require("react");
|
|
1008
1023
|
var useUniformContextualEditingState = ({
|
|
1009
1024
|
global = false
|
|
1010
1025
|
} = {}) => {
|
|
1011
1026
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
1012
1027
|
const { data: componentData } = useUniformCurrentComponent();
|
|
1013
|
-
const [selectedComponentReference, setSelectedComponentReference] = (0,
|
|
1014
|
-
const [previewMode, setPreviewMode] = (0,
|
|
1028
|
+
const [selectedComponentReference, setSelectedComponentReference] = (0, import_react26.useState)();
|
|
1029
|
+
const [previewMode, setPreviewMode] = (0, import_react26.useState)(
|
|
1015
1030
|
isContextualEditing ? "editor" : void 0
|
|
1016
1031
|
);
|
|
1017
|
-
const channel = (0,
|
|
1032
|
+
const channel = (0, import_react26.useMemo)(() => {
|
|
1018
1033
|
if (!isContextualEditing) {
|
|
1019
1034
|
return;
|
|
1020
1035
|
}
|
|
@@ -1024,7 +1039,7 @@ var useUniformContextualEditingState = ({
|
|
|
1024
1039
|
});
|
|
1025
1040
|
return channel2;
|
|
1026
1041
|
}, [isContextualEditing]);
|
|
1027
|
-
(0,
|
|
1042
|
+
(0, import_react26.useEffect)(() => {
|
|
1028
1043
|
var _a, _b;
|
|
1029
1044
|
if (!channel) {
|
|
1030
1045
|
return;
|
|
@@ -1048,7 +1063,7 @@ var useUniformContextualEditingState = ({
|
|
|
1048
1063
|
unsubscribe();
|
|
1049
1064
|
};
|
|
1050
1065
|
}, [global, channel, componentData == null ? void 0 : componentData._id, setSelectedComponentReference, setPreviewMode]);
|
|
1051
|
-
return (0,
|
|
1066
|
+
return (0, import_react26.useMemo)(
|
|
1052
1067
|
() => ({
|
|
1053
1068
|
isContextualEditing,
|
|
1054
1069
|
selectedComponentReference,
|
package/dist/index.mjs
CHANGED
|
@@ -696,55 +696,69 @@ 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
706
|
import React9 from "react";
|
|
707
|
+
var AssetRichTextNode = ({ node }) => {
|
|
708
|
+
var _a, _b;
|
|
709
|
+
const { __asset } = node;
|
|
710
|
+
if (__asset === void 0) {
|
|
711
|
+
return null;
|
|
712
|
+
}
|
|
713
|
+
if (__asset.type !== "image") {
|
|
714
|
+
return null;
|
|
715
|
+
}
|
|
716
|
+
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);
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
// src/components/UniformRichText/nodes/HeadingRichTextNode.tsx
|
|
720
|
+
import React10 from "react";
|
|
707
721
|
var HeadingRichTextNode = ({ children, node }) => {
|
|
708
722
|
const { tag } = node;
|
|
709
723
|
const HTag = tag != null ? tag : "h1";
|
|
710
|
-
return /* @__PURE__ */
|
|
724
|
+
return /* @__PURE__ */ React10.createElement(HTag, null, children);
|
|
711
725
|
};
|
|
712
726
|
|
|
713
727
|
// src/components/UniformRichText/nodes/LinebreakRichTextNode.tsx
|
|
714
|
-
import
|
|
728
|
+
import React11 from "react";
|
|
715
729
|
var LinebreakRichTextNode = () => {
|
|
716
|
-
return /* @__PURE__ */
|
|
730
|
+
return /* @__PURE__ */ React11.createElement("br", null);
|
|
717
731
|
};
|
|
718
732
|
|
|
719
733
|
// src/components/UniformRichText/nodes/LinkRichTextNode.tsx
|
|
720
734
|
import { linkParamValueToHref } from "@uniformdev/richtext";
|
|
721
|
-
import
|
|
735
|
+
import React12 from "react";
|
|
722
736
|
var LinkRichTextNode = ({ children, node }) => {
|
|
723
737
|
const { link } = node;
|
|
724
|
-
return /* @__PURE__ */
|
|
738
|
+
return /* @__PURE__ */ React12.createElement("a", { href: linkParamValueToHref(link) }, children);
|
|
725
739
|
};
|
|
726
740
|
|
|
727
741
|
// src/components/UniformRichText/nodes/ListItemRichTextNode.tsx
|
|
728
|
-
import
|
|
742
|
+
import React13 from "react";
|
|
729
743
|
var ListItemRichTextNode = ({ children, node }) => {
|
|
730
744
|
const { value } = node;
|
|
731
|
-
return /* @__PURE__ */
|
|
745
|
+
return /* @__PURE__ */ React13.createElement("li", { value: Number.isFinite(value) && value > 0 ? value : void 0 }, children);
|
|
732
746
|
};
|
|
733
747
|
|
|
734
748
|
// src/components/UniformRichText/nodes/ListRichTextNode.tsx
|
|
735
|
-
import
|
|
749
|
+
import React14 from "react";
|
|
736
750
|
var ListRichTextNode = ({ children, node }) => {
|
|
737
751
|
const { tag, start } = node;
|
|
738
752
|
const ListTag = tag != null ? tag : "ul";
|
|
739
|
-
return /* @__PURE__ */
|
|
753
|
+
return /* @__PURE__ */ React14.createElement(ListTag, { start: Number.isFinite(start) && start > 0 ? start : void 0 }, children);
|
|
740
754
|
};
|
|
741
755
|
|
|
742
756
|
// src/components/UniformRichText/nodes/ParagraphRichTextNode.tsx
|
|
743
757
|
import { isPureDirection, isPureTextAlign } from "@uniformdev/richtext";
|
|
744
|
-
import
|
|
758
|
+
import React15 from "react";
|
|
745
759
|
var ParagraphRichTextNode = ({ children, node }) => {
|
|
746
760
|
const { format, direction } = node;
|
|
747
|
-
return /* @__PURE__ */
|
|
761
|
+
return /* @__PURE__ */ React15.createElement(
|
|
748
762
|
"p",
|
|
749
763
|
{
|
|
750
764
|
dir: isPureDirection(direction) ? direction : void 0,
|
|
@@ -756,26 +770,26 @@ var ParagraphRichTextNode = ({ children, node }) => {
|
|
|
756
770
|
|
|
757
771
|
// src/components/UniformRichText/nodes/TableCellRichTextNode.tsx
|
|
758
772
|
import { getRichTextTagFromTableCellHeaderState } from "@uniformdev/richtext";
|
|
759
|
-
import
|
|
773
|
+
import React16 from "react";
|
|
760
774
|
var TableCellRichTextNode = ({ children, node }) => {
|
|
761
775
|
const { headerState } = node;
|
|
762
776
|
const TableCellTag = getRichTextTagFromTableCellHeaderState(headerState);
|
|
763
|
-
return /* @__PURE__ */
|
|
777
|
+
return /* @__PURE__ */ React16.createElement(TableCellTag, null, children);
|
|
764
778
|
};
|
|
765
779
|
|
|
766
780
|
// src/components/UniformRichText/nodes/TabRichTextNode.tsx
|
|
767
|
-
import
|
|
781
|
+
import React17 from "react";
|
|
768
782
|
var TabRichTextNode = () => {
|
|
769
|
-
return /* @__PURE__ */
|
|
783
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, " ");
|
|
770
784
|
};
|
|
771
785
|
|
|
772
786
|
// src/components/UniformRichText/nodes/TextRichTextNode.tsx
|
|
773
787
|
import { getRichTextTagsFromTextFormat } from "@uniformdev/richtext";
|
|
774
|
-
import
|
|
788
|
+
import React18 from "react";
|
|
775
789
|
var TextRichTextNode = ({ node }) => {
|
|
776
790
|
const { text, format } = node;
|
|
777
791
|
const tags = getRichTextTagsFromTextFormat(format);
|
|
778
|
-
return /* @__PURE__ */
|
|
792
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, tags.length > 0 ? tags.reduceRight((children, Tag) => /* @__PURE__ */ React18.createElement(Tag, null, children), text) : text);
|
|
779
793
|
};
|
|
780
794
|
|
|
781
795
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
@@ -789,8 +803,8 @@ function UniformRichTextNode({ node, ...props }) {
|
|
|
789
803
|
if (!NodeRenderer) {
|
|
790
804
|
return null;
|
|
791
805
|
}
|
|
792
|
-
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */
|
|
793
|
-
return /* @__PURE__ */
|
|
806
|
+
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */ React19.createElement(UniformRichTextNode, { ...props, key: i, node: childNode })) : null;
|
|
807
|
+
return /* @__PURE__ */ React19.createElement(NodeRenderer, { node }, children);
|
|
794
808
|
}
|
|
795
809
|
var rendererMap = /* @__PURE__ */ new Map([
|
|
796
810
|
["heading", HeadingRichTextNode],
|
|
@@ -799,27 +813,28 @@ var rendererMap = /* @__PURE__ */ new Map([
|
|
|
799
813
|
["list", ListRichTextNode],
|
|
800
814
|
["listitem", ListItemRichTextNode],
|
|
801
815
|
["paragraph", ParagraphRichTextNode],
|
|
802
|
-
["quote", ({ children }) => /* @__PURE__ */
|
|
816
|
+
["quote", ({ children }) => /* @__PURE__ */ React19.createElement("blockquote", null, children)],
|
|
803
817
|
[
|
|
804
818
|
"code",
|
|
805
|
-
({ children }) => /* @__PURE__ */
|
|
819
|
+
({ children }) => /* @__PURE__ */ React19.createElement("pre", null, /* @__PURE__ */ React19.createElement("code", null, children))
|
|
806
820
|
],
|
|
807
|
-
["root", ({ children }) => /* @__PURE__ */
|
|
821
|
+
["root", ({ children }) => /* @__PURE__ */ React19.createElement(React19.Fragment, null, children)],
|
|
808
822
|
["text", TextRichTextNode],
|
|
809
823
|
["tab", TabRichTextNode],
|
|
810
824
|
[
|
|
811
825
|
"table",
|
|
812
|
-
({ children }) => /* @__PURE__ */
|
|
826
|
+
({ children }) => /* @__PURE__ */ React19.createElement("table", null, /* @__PURE__ */ React19.createElement("tbody", null, children))
|
|
813
827
|
],
|
|
814
|
-
["tablerow", ({ children }) => /* @__PURE__ */
|
|
815
|
-
["tablecell", TableCellRichTextNode]
|
|
828
|
+
["tablerow", ({ children }) => /* @__PURE__ */ React19.createElement("tr", null, children)],
|
|
829
|
+
["tablecell", TableCellRichTextNode],
|
|
830
|
+
["asset", AssetRichTextNode]
|
|
816
831
|
]);
|
|
817
832
|
var resolveRichTextDefaultRenderer = (node) => {
|
|
818
833
|
return rendererMap.get(node.type);
|
|
819
834
|
};
|
|
820
835
|
|
|
821
836
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
822
|
-
var UniformRichText =
|
|
837
|
+
var UniformRichText = React20.forwardRef(function UniformRichText2({ parameterId, resolveRichTextRenderer, as: Tag = "div", placeholder, ...props }, ref) {
|
|
823
838
|
var _a;
|
|
824
839
|
const { data: componentData, contextualEditingDefaultPlaceholder } = useUniformCurrentComponent();
|
|
825
840
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
@@ -832,7 +847,7 @@ var UniformRichText = React19.forwardRef(function UniformRichText2({ parameterId
|
|
|
832
847
|
const value = parameter.value;
|
|
833
848
|
if (!value || !isRichTextValue(value)) return null;
|
|
834
849
|
if (!isContextualEditing && isRichTextValueConsideredEmpty(value)) return null;
|
|
835
|
-
return Tag === null ? /* @__PURE__ */
|
|
850
|
+
return Tag === null ? /* @__PURE__ */ React20.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ React20.createElement(
|
|
836
851
|
Tag,
|
|
837
852
|
{
|
|
838
853
|
ref,
|
|
@@ -843,15 +858,15 @@ var UniformRichText = React19.forwardRef(function UniformRichText2({ parameterId
|
|
|
843
858
|
[ATTRIBUTE_PARAMETER_TYPE]: "richText"
|
|
844
859
|
} : {}
|
|
845
860
|
},
|
|
846
|
-
isRichTextValueConsideredEmpty(value) ? /* @__PURE__ */
|
|
861
|
+
isRichTextValueConsideredEmpty(value) ? /* @__PURE__ */ React20.createElement("p", null, /* @__PURE__ */ React20.createElement("i", null, computedPlaceholder)) : /* @__PURE__ */ React20.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
|
|
847
862
|
);
|
|
848
863
|
});
|
|
849
864
|
|
|
850
865
|
// src/components/UniformText.tsx
|
|
851
|
-
import
|
|
866
|
+
import React22, { useState as useState2 } from "react";
|
|
852
867
|
|
|
853
868
|
// src/components/PureUniformText.tsx
|
|
854
|
-
import
|
|
869
|
+
import React21 from "react";
|
|
855
870
|
var PureUniformText = ({
|
|
856
871
|
as: Tag = "span",
|
|
857
872
|
parameterId,
|
|
@@ -870,10 +885,10 @@ var PureUniformText = ({
|
|
|
870
885
|
return null;
|
|
871
886
|
}
|
|
872
887
|
if (!isContextualEditing) {
|
|
873
|
-
return /* @__PURE__ */
|
|
888
|
+
return /* @__PURE__ */ React21.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
|
|
874
889
|
}
|
|
875
890
|
const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
|
|
876
|
-
return /* @__PURE__ */
|
|
891
|
+
return /* @__PURE__ */ React21.createElement(
|
|
877
892
|
Tag,
|
|
878
893
|
{
|
|
879
894
|
...props,
|
|
@@ -911,7 +926,7 @@ var UniformText = ({
|
|
|
911
926
|
}
|
|
912
927
|
const placeholderProp = placeholder != null ? placeholder : contextualEditingDefaultPlaceholder;
|
|
913
928
|
const computedPlaceholder = typeof placeholderProp === "function" ? placeholderProp({ id: parameterId }) : placeholderProp;
|
|
914
|
-
return /* @__PURE__ */
|
|
929
|
+
return /* @__PURE__ */ React22.createElement(
|
|
915
930
|
PureUniformText,
|
|
916
931
|
{
|
|
917
932
|
...props,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-react",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.187.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.
|
|
49
|
-
"@uniformdev/context": "19.
|
|
50
|
-
"@uniformdev/context-react": "19.
|
|
51
|
-
"@uniformdev/richtext": "19.
|
|
48
|
+
"@uniformdev/canvas": "19.187.0",
|
|
49
|
+
"@uniformdev/context": "19.187.0",
|
|
50
|
+
"@uniformdev/context-react": "19.187.0",
|
|
51
|
+
"@uniformdev/richtext": "19.187.0"
|
|
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": "9ccfdb652e2d67d66fe90e2df1845c3c2e3bee8b"
|
|
71
71
|
}
|