@uniformdev/canvas-react 19.61.1-alpha.13 → 19.61.1-alpha.23
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/PureUniformText-37defdc5.d.ts +41 -0
- package/dist/core.d.mts +14 -39
- package/dist/core.d.ts +14 -39
- package/dist/core.js +41 -5
- package/dist/core.mjs +43 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +111 -72
- package/dist/index.js +165 -128
- package/dist/index.mjs +111 -72
- package/package.json +6 -6
package/dist/index.esm.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
// src/components/DefaultNotImplementedComponent.tsx
|
|
2
4
|
import { CANVAS_LOCALIZATION_TYPE } from "@uniformdev/canvas";
|
|
3
5
|
import React from "react";
|
|
@@ -73,7 +75,7 @@ import {
|
|
|
73
75
|
CANVAS_ENRICHMENT_TAG_PARAM
|
|
74
76
|
} from "@uniformdev/canvas";
|
|
75
77
|
import { Track, TrackFragment, useUniformContext } from "@uniformdev/context-react";
|
|
76
|
-
import
|
|
78
|
+
import React7, { createContext as createContext2, useContext as useContext2 } from "react";
|
|
77
79
|
|
|
78
80
|
// src/helpers/convertComponentToProps.ts
|
|
79
81
|
function convertComponentToProps(component) {
|
|
@@ -138,7 +140,7 @@ import {
|
|
|
138
140
|
CANVAS_TEST_TYPE,
|
|
139
141
|
EMPTY_COMPOSITION as EMPTY_COMPOSITION2
|
|
140
142
|
} from "@uniformdev/canvas";
|
|
141
|
-
import
|
|
143
|
+
import React6 from "react";
|
|
142
144
|
|
|
143
145
|
// src/defaultSystemComponentResolver.tsx
|
|
144
146
|
import {
|
|
@@ -182,16 +184,50 @@ var defaultSystemComponentResolver = {
|
|
|
182
184
|
};
|
|
183
185
|
|
|
184
186
|
// src/components/ContextualEditingComponentWrapper.tsx
|
|
187
|
+
import {
|
|
188
|
+
isComponentPlaceholderId
|
|
189
|
+
} from "@uniformdev/canvas";
|
|
190
|
+
import React5 from "react";
|
|
191
|
+
|
|
192
|
+
// src/components/PureContextualEditingComponentWrapper.tsx
|
|
185
193
|
import {
|
|
186
194
|
CANVAS_LOCALE_TAG_PARAM,
|
|
187
195
|
IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
|
|
188
|
-
IN_CONTEXT_EDITOR_COMPONENT_START_ROLE
|
|
189
|
-
isComponentPlaceholderId
|
|
196
|
+
IN_CONTEXT_EDITOR_COMPONENT_START_ROLE
|
|
190
197
|
} from "@uniformdev/canvas";
|
|
191
|
-
import
|
|
198
|
+
import React3 from "react";
|
|
199
|
+
var PureContextualEditingComponentWrapper = ({
|
|
200
|
+
children,
|
|
201
|
+
isPlaceholder,
|
|
202
|
+
parentComponent,
|
|
203
|
+
component,
|
|
204
|
+
slotName,
|
|
205
|
+
indexInSlot,
|
|
206
|
+
slotChildrenCount,
|
|
207
|
+
isReadOnly
|
|
208
|
+
}) => {
|
|
209
|
+
var _a, _b, _c, _d;
|
|
210
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
|
|
211
|
+
"script",
|
|
212
|
+
{
|
|
213
|
+
"data-role": IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
|
214
|
+
"data-parent-id": parentComponent == null ? void 0 : parentComponent._id,
|
|
215
|
+
"data-parent-type": parentComponent == null ? void 0 : parentComponent.type,
|
|
216
|
+
"data-component-id": component == null ? void 0 : component._id,
|
|
217
|
+
"data-slot-name": slotName != null ? slotName : "",
|
|
218
|
+
"data-component-index": indexInSlot != null ? indexInSlot : "",
|
|
219
|
+
"data-total-components": slotChildrenCount != null ? slotChildrenCount : "",
|
|
220
|
+
"data-component-name": component == null ? void 0 : component.type,
|
|
221
|
+
"data-is-placeholder": isPlaceholder ? "true" : void 0,
|
|
222
|
+
"data-is-localized": ((_a = component == null ? void 0 : component.parameters) == null ? void 0 : _a[CANVAS_LOCALE_TAG_PARAM]) ? "true" : void 0,
|
|
223
|
+
"data-component-title": (_d = (_c = (_b = component == null ? void 0 : component.parameters) == null ? void 0 : _b.title) == null ? void 0 : _c.value) != null ? _d : "",
|
|
224
|
+
"data-is-readonly": isReadOnly
|
|
225
|
+
}
|
|
226
|
+
), children, /* @__PURE__ */ React3.createElement("script", { "data-role": IN_CONTEXT_EDITOR_COMPONENT_END_ROLE }));
|
|
227
|
+
};
|
|
192
228
|
|
|
193
229
|
// src/components/UniformComposition.tsx
|
|
194
|
-
import
|
|
230
|
+
import React4, { createContext, useContext } from "react";
|
|
195
231
|
|
|
196
232
|
// src/hooks/useUniformContextualEditing.ts
|
|
197
233
|
import {
|
|
@@ -262,7 +298,7 @@ var useUniformContextualEditing = ({
|
|
|
262
298
|
document.head.appendChild(script);
|
|
263
299
|
}, [initialCompositionValue == null ? void 0 : initialCompositionValue._id]);
|
|
264
300
|
return {
|
|
265
|
-
composition: contextualComposition
|
|
301
|
+
composition: contextualComposition ? contextualComposition : initialCompositionValue,
|
|
266
302
|
isContextualEditing: Boolean(contextualComposition)
|
|
267
303
|
};
|
|
268
304
|
};
|
|
@@ -300,12 +336,12 @@ function UniformComposition({
|
|
|
300
336
|
initialCompositionValue: data,
|
|
301
337
|
enhance: contextualEditingEnhancer
|
|
302
338
|
});
|
|
303
|
-
return /* @__PURE__ */
|
|
339
|
+
return /* @__PURE__ */ React4.createElement(
|
|
304
340
|
UniformCompositionContext.Provider,
|
|
305
341
|
{
|
|
306
342
|
value: { data: composition, behaviorTracking, resolveRenderer, isContextualEditing }
|
|
307
343
|
},
|
|
308
|
-
/* @__PURE__ */
|
|
344
|
+
/* @__PURE__ */ React4.createElement(ContextualEditingComponentWrapper, { component: composition }, /* @__PURE__ */ React4.createElement(
|
|
309
345
|
UniformComponent,
|
|
310
346
|
{
|
|
311
347
|
data: composition,
|
|
@@ -328,27 +364,30 @@ function ContextualEditingComponentWrapper({
|
|
|
328
364
|
emptyPlaceholder,
|
|
329
365
|
children
|
|
330
366
|
}) {
|
|
331
|
-
var _a
|
|
367
|
+
var _a;
|
|
332
368
|
const isPlaceholder = isComponentPlaceholderId(component == null ? void 0 : component._id);
|
|
333
369
|
const { isContextualEditing } = useUniformCurrentComposition();
|
|
334
370
|
const isReadOnly = ((_a = component == null ? void 0 : component._contextualEditing) == null ? void 0 : _a.isEditable) ? void 0 : "true";
|
|
335
|
-
|
|
336
|
-
|
|
371
|
+
if (!isContextualEditing) {
|
|
372
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, children);
|
|
373
|
+
}
|
|
374
|
+
if (isPlaceholder && emptyPlaceholder === null) {
|
|
375
|
+
return null;
|
|
376
|
+
}
|
|
377
|
+
return /* @__PURE__ */ React5.createElement(
|
|
378
|
+
PureContextualEditingComponentWrapper,
|
|
337
379
|
{
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
"data-is-readonly": isReadOnly
|
|
350
|
-
}
|
|
351
|
-
), isPlaceholder && emptyPlaceholder !== void 0 ? emptyPlaceholder : children, /* @__PURE__ */ React4.createElement("script", { "data-role": IN_CONTEXT_EDITOR_COMPONENT_END_ROLE }));
|
|
380
|
+
isPlaceholder,
|
|
381
|
+
parentComponent,
|
|
382
|
+
component,
|
|
383
|
+
slotName,
|
|
384
|
+
indexInSlot,
|
|
385
|
+
slotChildrenCount,
|
|
386
|
+
isReadOnly
|
|
387
|
+
},
|
|
388
|
+
isContextualEditing && /* @__PURE__ */ React5.createElement(React5.Fragment, null),
|
|
389
|
+
isPlaceholder && emptyPlaceholder !== void 0 ? emptyPlaceholder : children
|
|
390
|
+
);
|
|
352
391
|
}
|
|
353
392
|
|
|
354
393
|
// src/components/UniformSlot.tsx
|
|
@@ -387,13 +426,13 @@ function UniformSlot({
|
|
|
387
426
|
emptyPlaceholder
|
|
388
427
|
});
|
|
389
428
|
const elements = children ? children({ child, component, key: `wrapped-inner-${index}` }) : child;
|
|
390
|
-
return
|
|
429
|
+
return React6.createElement(React6.Fragment, { key: index }, elements);
|
|
391
430
|
});
|
|
392
431
|
if (!wrapperComponent) {
|
|
393
|
-
return
|
|
432
|
+
return React6.createElement(React6.Fragment, void 0, finalChildren);
|
|
394
433
|
}
|
|
395
434
|
const Wrapper = wrapperComponent;
|
|
396
|
-
return /* @__PURE__ */
|
|
435
|
+
return /* @__PURE__ */ React6.createElement(Wrapper, { items: finalChildren, slotName: name });
|
|
397
436
|
}
|
|
398
437
|
function renderComponent({
|
|
399
438
|
component,
|
|
@@ -425,7 +464,7 @@ function renderComponent({
|
|
|
425
464
|
});
|
|
426
465
|
}
|
|
427
466
|
);
|
|
428
|
-
return /* @__PURE__ */
|
|
467
|
+
return /* @__PURE__ */ React6.createElement(
|
|
429
468
|
ContextualEditingComponentWrapper,
|
|
430
469
|
{
|
|
431
470
|
component,
|
|
@@ -456,7 +495,7 @@ function renderComponent({
|
|
|
456
495
|
});
|
|
457
496
|
}
|
|
458
497
|
);
|
|
459
|
-
return /* @__PURE__ */
|
|
498
|
+
return /* @__PURE__ */ React6.createElement(
|
|
460
499
|
ContextualEditingComponentWrapper,
|
|
461
500
|
{
|
|
462
501
|
component,
|
|
@@ -470,7 +509,7 @@ function renderComponent({
|
|
|
470
509
|
);
|
|
471
510
|
} else if (RenderComponent) {
|
|
472
511
|
const props = convertComponentToProps(component);
|
|
473
|
-
return /* @__PURE__ */
|
|
512
|
+
return /* @__PURE__ */ React6.createElement(UniformComponent, { key, data: component, resolveRenderer }, /* @__PURE__ */ React6.createElement(
|
|
474
513
|
ContextualEditingComponentWrapper,
|
|
475
514
|
{
|
|
476
515
|
component,
|
|
@@ -480,7 +519,7 @@ function renderComponent({
|
|
|
480
519
|
slotChildrenCount,
|
|
481
520
|
emptyPlaceholder
|
|
482
521
|
},
|
|
483
|
-
/* @__PURE__ */
|
|
522
|
+
/* @__PURE__ */ React6.createElement(RenderComponent, { ...props })
|
|
484
523
|
));
|
|
485
524
|
} else if (process.env.NODE_ENV !== "production") {
|
|
486
525
|
console.warn(
|
|
@@ -527,9 +566,9 @@ function UniformComponent({
|
|
|
527
566
|
hasParentLayout: Boolean(parentData.data),
|
|
528
567
|
resolveRenderer: contextValue.resolveRenderer
|
|
529
568
|
});
|
|
530
|
-
return /* @__PURE__ */
|
|
569
|
+
return /* @__PURE__ */ React7.createElement(UniformComponentContext.Provider, { value: contextValue }, contextContextProviderPresent ? (
|
|
531
570
|
/* auto-track behavior signals when in a Canvas context */
|
|
532
|
-
/* @__PURE__ */
|
|
571
|
+
/* @__PURE__ */ React7.createElement(TrackComponent, { behavior: enrichmentTags }, resolvedChildren)
|
|
533
572
|
) : resolvedChildren);
|
|
534
573
|
}
|
|
535
574
|
function resolveChildren({
|
|
@@ -542,14 +581,14 @@ function resolveChildren({
|
|
|
542
581
|
if (!children && !hasParentLayout) {
|
|
543
582
|
const topLevelComponent = resolveRenderer({ type: data.type });
|
|
544
583
|
if (topLevelComponent) {
|
|
545
|
-
children =
|
|
584
|
+
children = React7.createElement(topLevelComponent, convertComponentToProps(data));
|
|
546
585
|
} else {
|
|
547
586
|
if (Object.keys((_a = data.slots) != null ? _a : {}).length > 1 && process.env.NODE_ENV === "development") {
|
|
548
587
|
console.warn(
|
|
549
588
|
`[canvas-dev] All the slots in component '${data.type}' are rendered in no particular order. Use '<UniformSlot name={slotName} />' to reliably render the slots.`
|
|
550
589
|
);
|
|
551
590
|
}
|
|
552
|
-
children = Object.keys(data.slots || {}).map((slotName) => /* @__PURE__ */
|
|
591
|
+
children = Object.keys(data.slots || {}).map((slotName) => /* @__PURE__ */ React7.createElement(UniformSlot, { key: slotName, name: slotName }));
|
|
553
592
|
}
|
|
554
593
|
}
|
|
555
594
|
const renderChildren = typeof children === "function" ? children(convertComponentToProps(data)) : children;
|
|
@@ -558,7 +597,7 @@ function resolveChildren({
|
|
|
558
597
|
|
|
559
598
|
// src/components/UniformPlayground.tsx
|
|
560
599
|
import { EMPTY_COMPOSITION as EMPTY_COMPOSITION3 } from "@uniformdev/canvas";
|
|
561
|
-
import
|
|
600
|
+
import React8, { useMemo as useMemo2 } from "react";
|
|
562
601
|
var UniformPlayground = ({
|
|
563
602
|
resolveRenderer,
|
|
564
603
|
decorators = [],
|
|
@@ -575,7 +614,7 @@ var UniformPlayground = ({
|
|
|
575
614
|
if (!composition) {
|
|
576
615
|
return null;
|
|
577
616
|
}
|
|
578
|
-
let component = /* @__PURE__ */
|
|
617
|
+
let component = /* @__PURE__ */ React8.createElement(ContextualEditingComponentWrapper, { component: composition }, /* @__PURE__ */ React8.createElement(
|
|
579
618
|
UniformComponent,
|
|
580
619
|
{
|
|
581
620
|
data: composition,
|
|
@@ -586,7 +625,7 @@ var UniformPlayground = ({
|
|
|
586
625
|
children
|
|
587
626
|
));
|
|
588
627
|
decorators.forEach((Decorator) => {
|
|
589
|
-
component = /* @__PURE__ */
|
|
628
|
+
component = /* @__PURE__ */ React8.createElement(Decorator, { data: composition }, component);
|
|
590
629
|
});
|
|
591
630
|
return component;
|
|
592
631
|
}, [
|
|
@@ -597,7 +636,7 @@ var UniformPlayground = ({
|
|
|
597
636
|
behaviorTracking,
|
|
598
637
|
contextualEditingDefaultPlaceholder
|
|
599
638
|
]);
|
|
600
|
-
return /* @__PURE__ */
|
|
639
|
+
return /* @__PURE__ */ React8.createElement(
|
|
601
640
|
UniformCompositionContext.Provider,
|
|
602
641
|
{
|
|
603
642
|
value: { data: composition, behaviorTracking, resolveRenderer, isContextualEditing }
|
|
@@ -616,55 +655,55 @@ import {
|
|
|
616
655
|
isRichTextValue,
|
|
617
656
|
isRichTextValueConsideredEmpty
|
|
618
657
|
} from "@uniformdev/richtext";
|
|
619
|
-
import
|
|
658
|
+
import React18, { useMemo as useMemo3 } from "react";
|
|
620
659
|
|
|
621
660
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
622
661
|
import { isRichTextNode } from "@uniformdev/richtext";
|
|
623
|
-
import
|
|
662
|
+
import React17 from "react";
|
|
624
663
|
|
|
625
664
|
// src/components/UniformRichText/nodes/HeadingRichTextNode.tsx
|
|
626
|
-
import
|
|
665
|
+
import React9 from "react";
|
|
627
666
|
var HeadingRichTextNode = ({ children, node }) => {
|
|
628
667
|
const { tag } = node;
|
|
629
668
|
const HTag = tag != null ? tag : "h1";
|
|
630
|
-
return /* @__PURE__ */
|
|
669
|
+
return /* @__PURE__ */ React9.createElement(HTag, null, children);
|
|
631
670
|
};
|
|
632
671
|
|
|
633
672
|
// src/components/UniformRichText/nodes/LinebreakRichTextNode.tsx
|
|
634
|
-
import
|
|
673
|
+
import React10 from "react";
|
|
635
674
|
var LinebreakRichTextNode = () => {
|
|
636
|
-
return /* @__PURE__ */
|
|
675
|
+
return /* @__PURE__ */ React10.createElement("br", null);
|
|
637
676
|
};
|
|
638
677
|
|
|
639
678
|
// src/components/UniformRichText/nodes/LinkRichTextNode.tsx
|
|
640
679
|
import { linkParamValueToHref } from "@uniformdev/richtext";
|
|
641
|
-
import
|
|
680
|
+
import React11 from "react";
|
|
642
681
|
var LinkRichTextNode = ({ children, node }) => {
|
|
643
682
|
const { link } = node;
|
|
644
|
-
return /* @__PURE__ */
|
|
683
|
+
return /* @__PURE__ */ React11.createElement("a", { href: linkParamValueToHref(link) }, children);
|
|
645
684
|
};
|
|
646
685
|
|
|
647
686
|
// src/components/UniformRichText/nodes/ListItemRichTextNode.tsx
|
|
648
|
-
import
|
|
687
|
+
import React12 from "react";
|
|
649
688
|
var ListItemRichTextNode = ({ children, node }) => {
|
|
650
689
|
const { value } = node;
|
|
651
|
-
return /* @__PURE__ */
|
|
690
|
+
return /* @__PURE__ */ React12.createElement("li", { value: Number.isFinite(value) && value > 0 ? value : void 0 }, children);
|
|
652
691
|
};
|
|
653
692
|
|
|
654
693
|
// src/components/UniformRichText/nodes/ListRichTextNode.tsx
|
|
655
|
-
import
|
|
694
|
+
import React13 from "react";
|
|
656
695
|
var ListRichTextNode = ({ children, node }) => {
|
|
657
696
|
const { tag, start } = node;
|
|
658
697
|
const ListTag = tag != null ? tag : "ul";
|
|
659
|
-
return /* @__PURE__ */
|
|
698
|
+
return /* @__PURE__ */ React13.createElement(ListTag, { start: Number.isFinite(start) && start > 0 ? start : void 0 }, children);
|
|
660
699
|
};
|
|
661
700
|
|
|
662
701
|
// src/components/UniformRichText/nodes/ParagraphRichTextNode.tsx
|
|
663
702
|
import { isPureDirection, isPureTextAlign } from "@uniformdev/richtext";
|
|
664
|
-
import
|
|
703
|
+
import React14 from "react";
|
|
665
704
|
var ParagraphRichTextNode = ({ children, node }) => {
|
|
666
705
|
const { format, direction } = node;
|
|
667
|
-
return /* @__PURE__ */
|
|
706
|
+
return /* @__PURE__ */ React14.createElement(
|
|
668
707
|
"p",
|
|
669
708
|
{
|
|
670
709
|
dir: isPureDirection(direction) ? direction : void 0,
|
|
@@ -675,18 +714,18 @@ var ParagraphRichTextNode = ({ children, node }) => {
|
|
|
675
714
|
};
|
|
676
715
|
|
|
677
716
|
// src/components/UniformRichText/nodes/TabRichTextNode.tsx
|
|
678
|
-
import
|
|
717
|
+
import React15 from "react";
|
|
679
718
|
var TabRichTextNode = () => {
|
|
680
|
-
return /* @__PURE__ */
|
|
719
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, " ");
|
|
681
720
|
};
|
|
682
721
|
|
|
683
722
|
// src/components/UniformRichText/nodes/TextRichTextNode.tsx
|
|
684
723
|
import { getRichTextTagsFromTextFormat } from "@uniformdev/richtext";
|
|
685
|
-
import
|
|
724
|
+
import React16 from "react";
|
|
686
725
|
var TextRichTextNode = ({ node }) => {
|
|
687
726
|
const { text, format } = node;
|
|
688
727
|
const tags = getRichTextTagsFromTextFormat(format);
|
|
689
|
-
return /* @__PURE__ */
|
|
728
|
+
return /* @__PURE__ */ React16.createElement(React16.Fragment, null, tags.length > 0 ? tags.reduceRight((children, Tag) => /* @__PURE__ */ React16.createElement(Tag, null, children), text) : text);
|
|
690
729
|
};
|
|
691
730
|
|
|
692
731
|
// src/components/UniformRichText/UniformRichTextNode.tsx
|
|
@@ -701,8 +740,8 @@ function UniformRichTextNode({ node, ...props }) {
|
|
|
701
740
|
if (!NodeRenderer) {
|
|
702
741
|
return null;
|
|
703
742
|
}
|
|
704
|
-
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */
|
|
705
|
-
return /* @__PURE__ */
|
|
743
|
+
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */ React17.createElement(UniformRichTextNode, { ...props, key: i, node: childNode })) : null;
|
|
744
|
+
return /* @__PURE__ */ React17.createElement(NodeRenderer, { node }, children);
|
|
706
745
|
}
|
|
707
746
|
var rendererMap = /* @__PURE__ */ new Map([
|
|
708
747
|
["heading", HeadingRichTextNode],
|
|
@@ -711,12 +750,12 @@ var rendererMap = /* @__PURE__ */ new Map([
|
|
|
711
750
|
["list", ListRichTextNode],
|
|
712
751
|
["listitem", ListItemRichTextNode],
|
|
713
752
|
["paragraph", ParagraphRichTextNode],
|
|
714
|
-
["quote", ({ children }) => /* @__PURE__ */
|
|
753
|
+
["quote", ({ children }) => /* @__PURE__ */ React17.createElement("blockquote", null, children)],
|
|
715
754
|
[
|
|
716
755
|
"code",
|
|
717
|
-
({ children }) => /* @__PURE__ */
|
|
756
|
+
({ children }) => /* @__PURE__ */ React17.createElement("pre", null, /* @__PURE__ */ React17.createElement("code", null, children))
|
|
718
757
|
],
|
|
719
|
-
["root", ({ children }) => /* @__PURE__ */
|
|
758
|
+
["root", ({ children }) => /* @__PURE__ */ React17.createElement(React17.Fragment, null, children)],
|
|
720
759
|
["text", TextRichTextNode],
|
|
721
760
|
["tab", TabRichTextNode]
|
|
722
761
|
]);
|
|
@@ -725,7 +764,7 @@ var resolveRichTextDefaultRenderer = (node) => {
|
|
|
725
764
|
};
|
|
726
765
|
|
|
727
766
|
// src/components/UniformRichText/UniformRichText.tsx
|
|
728
|
-
var UniformRichText =
|
|
767
|
+
var UniformRichText = React18.forwardRef(function UniformRichText2({ parameterId, resolveRichTextRenderer, as: Tag = "div", ...props }, ref) {
|
|
729
768
|
const { data: componentData } = useUniformCurrentComponent();
|
|
730
769
|
const parameter = useMemo3(() => {
|
|
731
770
|
var _a;
|
|
@@ -734,7 +773,7 @@ var UniformRichText = React17.forwardRef(function UniformRichText2({ parameterId
|
|
|
734
773
|
const value = useMemo3(() => parameter == null ? void 0 : parameter.value, [parameter]);
|
|
735
774
|
if (!value || !isRichTextValue(value) || isRichTextValueConsideredEmpty(value))
|
|
736
775
|
return null;
|
|
737
|
-
return Tag === null ? /* @__PURE__ */
|
|
776
|
+
return Tag === null ? /* @__PURE__ */ React18.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ React18.createElement(
|
|
738
777
|
Tag,
|
|
739
778
|
{
|
|
740
779
|
ref,
|
|
@@ -745,15 +784,15 @@ var UniformRichText = React17.forwardRef(function UniformRichText2({ parameterId
|
|
|
745
784
|
[ATTRIBUTE_PARAMETER_TYPE]: "richText"
|
|
746
785
|
}
|
|
747
786
|
},
|
|
748
|
-
/* @__PURE__ */
|
|
787
|
+
/* @__PURE__ */ React18.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
|
|
749
788
|
);
|
|
750
789
|
});
|
|
751
790
|
|
|
752
791
|
// src/components/UniformText.tsx
|
|
753
|
-
import
|
|
792
|
+
import React20, { useState as useState2 } from "react";
|
|
754
793
|
|
|
755
794
|
// src/components/PureUniformText.tsx
|
|
756
|
-
import
|
|
795
|
+
import React19 from "react";
|
|
757
796
|
var PureUniformText = ({
|
|
758
797
|
as: Tag = "span",
|
|
759
798
|
parameterId,
|
|
@@ -772,10 +811,10 @@ var PureUniformText = ({
|
|
|
772
811
|
return null;
|
|
773
812
|
}
|
|
774
813
|
if (!isContextualEditing) {
|
|
775
|
-
return /* @__PURE__ */
|
|
814
|
+
return /* @__PURE__ */ React19.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
|
|
776
815
|
}
|
|
777
816
|
const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
|
|
778
|
-
return /* @__PURE__ */
|
|
817
|
+
return /* @__PURE__ */ React19.createElement(
|
|
779
818
|
Tag,
|
|
780
819
|
{
|
|
781
820
|
...props,
|
|
@@ -813,7 +852,7 @@ var UniformText = ({
|
|
|
813
852
|
}
|
|
814
853
|
const placeholderProp = placeholder != null ? placeholder : contextualEditingDefaultPlaceholder;
|
|
815
854
|
const computedPlaceholder = typeof placeholderProp === "function" ? placeholderProp({ id: parameterId }) : placeholderProp;
|
|
816
|
-
return /* @__PURE__ */
|
|
855
|
+
return /* @__PURE__ */ React20.createElement(
|
|
817
856
|
PureUniformText,
|
|
818
857
|
{
|
|
819
858
|
...props,
|